veyron/lib/bluetooth,veyron/runtimes/google/ipc/stream: Support for VCs
created over bluetooth RFCOMM connections on Linux.
This commit enables Linux-based veyron processes to use bluetooth to
establish VCs between each other. For example, to create a tunnel
(veyron/examples/tunnel), the server can be started with:
./bin/tunneld --protocol=bluetooth --address=00:00:00:00:00:00-0
A client can then transparently connect to this server via bluetooth
by simply connecting to the object name exported by the server.
For non-linux platforms, currently connections to bluetooth-based
endpoints will fail.
Tested using raspberry pi's and my linux desktop.
Specific changes:
(1) bluetooth net.Addr implementation now uses a "-" instead of a "/"
to separate the MAC address from the channel id since the "/"
confuses object name parsing (veyron2/naming)
(2) Hook up the bluetooth package's net.Conn implementation with
veyron/runtimes/google/ipc/stream.
(3) Return string descriptions of error messages in addition
to errno from bt.c
(4) Ensure that the net.Conn implementation returns n=0 on
failures to Read/Write. io.Reader/io.Writer implementations
are supposed to do this and clients (such as iobuf.Reader)
rely on non-negative return values.
(5) rename "port" to "channel" to more closely reflect RFCOMM
terminology
While this commit enables bluetooth support, there are still caveats
to it:
(1) Only works with Linux
(2) the net.Conn and net.Listener implementations are not safe for
concurrent method invocations, which they should be (as per the
interface guidelines).
and thus bluetooth should only be used for toys right now, till
these problems, particularly (2) are addressed.
Change-Id: Iebdc7a6062133dc5a7f9a3c4871042083388160e
10 files changed