summaryrefslogtreecommitdiff
path: root/crates/arti-rpcserver/src/msgs.rs
Commit message (Collapse)AuthorAgeFilesLines
* Remove a spurious debug_assert in arti-rpcserver.Nick Mathewson2026-01-121-0/+1
| | | | | | | This should never have been retained when we refactored our channels for reporting responses into a single channel. The bug became apparent when quicktest became derived from debug.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* rpcserver: Increase coverage in msgs modulevcrn2025-03-241-6/+25
|
* arti-rpcserver: Rename MethodNotFound to NoSuchMethod.Nick Mathewson2025-01-151-1/+1
| | | | Closes #1500.
* Remove Rpc* variants from tor_error::ErrorKindNick Mathewson2024-10-171-1/+1
| | | | | | | | | | | | | These are not regular ErrorKinds, since they can never occur in an error that's meant to be returned from a Rust API like `arti-client`. Instead, they only exist for errors returned from RpcError. (I can't find the place where we discussed this previously, but the rationale is that if an ErrorKind never makes sense in response to something that the user does from Rust, we should never have that be an ErrorKind. The fact that the removed kinds do not actually appear outside the RPC system suggests that this is reasonable.)
* Replace _ => panic!() elsewhereIan Jackson2024-10-151-1/+1
|
* arti-rpcserver: minimal handling for request.meta.requireNick Mathewson2024-10-071-0/+5
| | | | | | | | | | We have defined a forward-compatibility mechanism for the RPC system, where a request may list one or more required "features", and if any feature is absent, the request will fail. Since no "features" are currently implemented, this code does the bare minimum to implement this mechanism, by rejecting every request with a nonempty "require" field.
* arti-rpcserver: Correctly handle rpc.meta without `updates`Nick Mathewson2024-10-071-0/+1
| | | | | The `update` field in request.meta is optional, so we should allow it to default to `false` when it is absent.
* rpcserver: Remove TODO about optionality of paramsNick Mathewson2024-10-071-3/+0
| | | | | | | The spec no longer says that `params` is optional, so we can remove the TODO about making it optional. Closes #1665.
* rpc: Simplify handling of fatal Json read errors.Nick Mathewson2024-09-161-0/+9
| | | | | | | | | | | | | | | | | | | | Previously, after determining that an error on an RPC connection was fatal, we would: 1. Determine whether it was a "clean" close or one that needed to be logged. 2. In exactly one case (specifically, when the inbound Json stream contained a Value that was not an Object) , we would send back a message to the client. 3. Exit the connection with Ok() or Err(e). We no longer do step "2" above. Additionally, we document: - Why it's important to exit immediately on syntax errors. - A better way to tolerate non-Object Json Values, if we decide someday to do so. Closes #1591.
* rpc: Rename the error codes for something like consistency.Nick Mathewson2024-07-251-1/+1
|
* rpc: Remove RpcError data field and use ReportNick Mathewson2024-07-251-1/+1
| | | | | | | | | | | | Per discussion, this field isn't really specified in a way that lets us fill it sensibly at the moment. So for now, we're going to just omit it. Additionally, we said that we'd Report on our errors; this branch changes the implementation of RpcError to do that. Question: Will the blanket implementation for Into<RpcError> make it harder to re-add a Data field later on if we want to do so?
* rpc: Refactor errors part 1: a new RpcMethod trait.Nick Mathewson2024-07-251-2/+1
| | | | | It is no longer necessary to say, for every RPC method, that its error type is RpcError.
* RPC: Require an Error type in methods.Nick Mathewson2024-05-161-0/+1
| | | | | | | | This is needed so that we can cast special methods' return types properly. I wish I could make this optional, but Rust doesn't allow defaulting an associated type.
* rpc: Move typetag onto subtrait of DynMethodNick Mathewson2024-05-161-1/+1
| | | | | | This will allow us to create dispatchable methods that are only invoked from inside the arti code, and are not themselves serializable.
* rpc: Move deftly attributes into an `rpc` namespace.Nick Mathewson2024-04-111-1/+1
|
* 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-3/+5
| | | | | | 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.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Fix typosDimitris Apostolou2023-07-221-1/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Arti: Add ability to remember the list of methods names.Nick Mathewson2023-04-191-1/+5
| | | | | | | | | | | | Right now, this lets us say whether the method was unrecognized or whether the parameter type was incorrect. We'll use this to enforce correct method names later on. (I have to add another `inventory` here, since the `typetag` maintainer does not want to expose this functionality: see https://github.com/dtolnay/typetag/issues/57#issuecomment-1506106290 )
* rpc: Split Method into DynMethod and MethodNick Mathewson2023-04-191-12/+15
| | | | | Now `Method` has an Output and Update associated type, and `decl_method` can do a little more.
* rpc: Change `id=<SYNTAX>` to "no id".Nick Mathewson2023-04-131-6/+21
| | | | | | | Now instead of hoping that buggy clients will detect a magic `id`, we can simply tell them that they will get no `id` at all. If they can't handle that case, no major harm is done: the connection will get closed anyway.
* rpc: Require that errors are RpcError.Nick Mathewson2023-04-131-4/+2
| | | | | | Since we're serializing everything in this format, let's enforce it. With this change, we can no longer cram arbitrary junk into an RPC error, so we have to clean up our handling of cancelled requests.
* rpc: Improve error reporting for invalid requestsNick Mathewson2023-04-121-1/+93
| | | | | | | | | | | | | | | | This is a bit big, but it's not that _complicated_. The idea here is that we use serde's "untagged" enum facility when parsing our `Request`s, such that if parsing as a `Request` fails, we parse as an `InvalidRequest` and try to report what the problem was exactly. This lets us determine the ID of a request (if it had one), so we can report that ID in our error message. We can also recover from a much broader variety of errors. We now also conform with the spec reporting errors about completely wrong json, requests without IDs, and so on.
* arti-rpcserver: Be careful about saying "result".Nick Mathewson2023-04-121-5/+10
| | | | | | Even though json-rpc uses "result" to mean "a successful return value from a method", we can't: Rust's `Result` type is so pervasive that confusion would be inevitable.
* arti-rpcserver: rename command to method.Nick Mathewson2023-04-121-8/+8
|
* tor-rpcbase: Rename and rephrase "command" to "method"Nick Mathewson2023-04-121-3/+3
|
* Rename tor-rpccmd to tor-rpcbase.Nick Mathewson2023-04-121-2/+2
|
* rpc: Rename BoxedResponseBody => ResponseBodyNick Mathewson2023-04-121-10/+10
|
* rpc: Add standard warnings to arti-rpcserverNick Mathewson2023-04-121-2/+3
|
* rpc: Wire up arti-rpcserver to use tor-rpccmd.Nick Mathewson2023-04-121-0/+6
|
* rpc: do a better job of hiding impl_const_type_id!Nick Mathewson2023-04-121-1/+2
|
* RPC: Initial implementation of a multiple-argument dispatchNick Mathewson2023-04-121-0/+1
| | | | | | | | | | This code uses some kludges (discussed with Ian previously and hopefully well documented here) to get a type-identifier for each type in a const context. It then defines a macro to declare a type-erased versions of a concrete implementation functions, and register those implementations to be called later. We will probably want to tweak a bunch of this code as we move ahead.
* Start on a lower-level tor-rpccmd crate.Nick Mathewson2023-04-121-35/+10
| | | | | This crate will hold the backend pieces of RPC interaction that different parts of Arti get to implement.
* rpc: Implement json message types for serde.Nick Mathewson2023-04-121-0/+214