RPC: Allow SOCKS applications to create streams.
This is a draft branch to allow streams to be created by SOCKS.
As discussed last week, I've taken a slightly different approach than that in #865 (closed). Previously we had planned to have the SOCKS request provide an auth ID and a stream ID, and to use the stream ID to insert the stream into some RPC namespace.
Instead, we are now making the RPC namespace responsible for creating all object IDs, including stream IDs. Some object IDs can be used as the target of a SOCKS request. These include TorClient and RpcSession—when these are used, the stream gets no ID of its own. But the RPC app can also use one of (TorClient,RpcSession) to create an RpcDataStream object, which starts out as an empty stub. If an RpcDataStream is used as the target of a SOCKS connection, an actual DataStream is built, and a DataStreamCtrl is put in it.
I have a couple of remaining XXXX
issues in socks.rs, related to the silly type issues around the presence or absence of our RPC feature. Any suggestions on those would be welcome; I want to fix those before we merge.
Also, this branch does not yet:
- Provide any useful functionality on the new data stream type.
- Handle stream ownership and RPC shutdown in the way that we have discussed.
I'd like to work on these issueslater, once this branch is merged.