summaryrefslogtreecommitdiff
path: root/crates/arti-rpcserver/src/connection.rs
Commit message (Collapse)AuthorAgeFilesLines
* Implement rpc::Context on Connection directlyNick Mathewson2024-06-101-25/+7
| | | | | | | | | | | This lets us get rid of a now-spurious `RequestContext` wrapper type and an extra layer of indirection; it will also make it easier to treat a Connection _as_ a context, so that we can have a context in the socks-rpc interface code. This patch removes a TODO about "treading carefully" when we make this change. When I added that TODO, I had misremembered some implementation details of the RPC object system.
* rpc: allow Connection::lookup_object to take &selfNick Mathewson2024-06-101-7/+16
| | | | This will allow us to implement rpc::Context on Connection directly.
* rpc: Make the connection type always-Arc.Nick Mathewson2024-06-101-3/+3
|
* Use refactored invoke_rpc_method in rpcserver.Nick Mathewson2024-06-101-6/+1
|
* rpc: Pass around our rpc::Context in an Arc.Nick Mathewson2024-06-101-1/+3
| | | | | | | | Formerly we used a Box. That was okay at first, but now that we want RPC methods to be able to invoke other RPC methods, we don't want the Invocable methods to have to consume the Context. This requires that Context become Sync.
* RPC: Expose dispatch table from ContextNick Mathewson2024-05-161-0/+4
| | | | | We need to do this so that we can actually invoke RPC functions from one another.
* rpc: Move typetag onto subtrait of DynMethodNick Mathewson2024-05-161-6/+7
| | | | | | This will allow us to create dispatchable methods that are only invoked from inside the arti code, and are not themselves serializable.
* rpcserver: rename streams.rs to codecs.rs.Nick Mathewson2024-05-091-1/+1
| | | | I think I'm going to add another stream management module here.
* Refactor: remove existence of HasConstTypeId_ as a traitNick Mathewson2024-04-081-1/+1
| | | | | | | | | We don't actually need this to be a trait; we just need methods and objects to have a `CONST_TYPE_ID_` if they want to participate in the inventory-based method registry. Removing this trait makes it much simpler to declare methods and objects.
* Port many of the macros in tor-rpcbase to use derive-deftly.Nick Mathewson2024-04-041-1/+4
| | | | | | This simplifies our implementation logic in a few places, and simplifies our invocation syntax greatly. There are a few infelicities, noted in `TODO RPC` comments.
* rpc: Expand and clarify and cross-reference lock hierarchyIan Jackson2023-06-161-0/+2
|
* rpc: Document relationship between `Connection` and `RpcSession`Ian Jackson2023-06-161-0/+6
|
* rpc: Give the session-creation function an argument.Nick Mathewson2023-06-151-1/+1
| | | | | | This will later let us tell the session-creation function how the authentication occurred, which will let it decide what privileges to provide.
* rpc: revise session initialization a lot.Nick Mathewson2023-06-151-7/+21
| | | | | | | | | | | | | | Formerly, every time we wanted to launch a new connection, we had to give the RpcMgr a TorClient. The connection would hold that TorClient until a session was authenticated, and then would wrap it in a Session and put it in the object map. Now, the RpcMgr holds a Box<dyn Fn()...> that knows how to create Sessions. When a connection is authenticated, it asks the Mgr to make it a new session. This lets us make it clearer that the TorClient simply can't be given out until the connection is authenticated. Later, it will let us create more types of Session objects under more complicated rules.
* rpc: connection_id _is_ used: remove a comment to the contraryNick Mathewson2023-06-141-3/+0
|
* rpc: revise the relationship between Mgr and ConnectionNick Mathewson2023-06-141-6/+18
| | | | | | | | This adds a Weak reference from Connection to Mgr, makes DispatchTable mutable, and makes a few other changes as discussed between me and Diziet the other week. I bet we are not done tweaking this, but I hope it's a setp forwards.
* rpc: make decl_object! responsible for writing impl Object {} blocks.Nick Mathewson2023-06-071-1/+0
|
* RPC: Give out and accept GlobalIds for appropriate objects.Nick Mathewson2023-06-051-9/+71
|
* RPC: Implement a "global identifier" for non-session-bound IDsNick Mathewson2023-06-051-6/+29
| | | | | | | These identifiers are actually only "global" with respect to a given `RpcMgr`, but they should not be forgeable or reusable across RpcMgr objects. We're going to use them so that we have a kind of identifier for `TorClient`s that we can expose to SOCKS.
* rpc: Slightly refactor GenIdx encoding.Nick Mathewson2023-06-051-1/+1
|
* rpc: Give RpcMgr a registry of connections.Nick Mathewson2023-06-051-0/+16
| | | | | We're going to use this to implement arti#863, which requires that some RPC objects be globally nameable.
* rpc: Remove downgrade_owned for nowNick Mathewson2023-05-241-12/+0
| | | | | | | Rationale: Our weak-vs-strong design is a bit confused at the moment due to concerns about deduplication and capability semantics. It's not clear that a general "change strong to weak" method is compatible with what we want to provide.
* rpc: Implement functionality to remove objects from a sessionNick Mathewson2023-05-241-0/+33
| | | | | | | | | | | I've made doing some design choices here: * Reserving "rpc" as a prefix for post-authentication functionality that is not arti-specific. * Declaring these to be methods on the session rather than methods on the objects themselves. There's a problem with defining an API to drop a weak reference; see comment in code.
* rpc: Make the top-level returned object a "session".Nick Mathewson2023-05-241-32/+2
| | | | | | This will make it easier to change the semantics of what exactly we return, whether it has to be/contain a client, whether you can use it to look up all the live objects, &etc.
* rpc: move existing auth code to new module.Nick Mathewson2023-05-231-72/+2
|
* rpc: rename GenIdx::into/try_from implementationsNick Mathewson2023-05-151-3/+3
| | | | | These are about to become nondeterministic-ish and probably shouldn't use the Into/TryFrom traits.
* RPC: Make the "client" return optional.Nick Mathewson2023-05-041-2/+2
|
* RPC: Rename session.rs to connection.rsNick Mathewson2023-05-041-0/+494