aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-rpc-client-core/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge branch 'rename_singleton_id' into 'main'Jim Newsome2024-09-251-2/+2
|\ \ \ | |/ / |/| / | |/ | | | | | | rpc: Rename SingletonId to SingleIdResponse Closes #1585 See merge request tpo/core/arti!2448
| * rpc: Rename SingletonId to SingleIdResponseNick Mathewson2024-09-241-2/+2
| | | | | | | | | | | | | | | | | | | | Calling it "singleton" might have suggested that it was using the [singleton pattern](https://en.wikipedia.org/wiki/Singleton_pattern), which it isn't. (Renaming done with rust-analyzer and double-checked with `git grep`.) Closes #1585.
* | rpclib: Use prop351 protocol to open streams.Nick Mathewson2024-09-182-10/+13
|/ | | | | | | | | | | Now that prop351 is what Arti speaks, it's what the rpclib needs to provide. Note one change in particular: the `isolation` string is no longer an optional argument when opening a stream. (With prop351, there is no longer such a thing as an "absent" isolation string, and we don't want to imply that there is a difference between None and "".)
* rpclib: Remove TODO about connect=>stream renaming.Nick Mathewson2024-09-101-4/+0
| | | | | AFIACT, all of this renaming is done. I've grepped for `[Cc]onn` and didn't find any more identifiers that needed to be renamed.
* rpclib: Rename "connect" to "open_stream" as appropriate.Nick Mathewson2024-09-102-10/+10
|
* rpclib: Rename connect.rs to stream.rsNick Mathewson2024-09-102-2/+2
| | | | | | (This is about DataStreams, so we should make it less confusing. This commit is _just_ about the file renaming, with no associated function renaming.)
* Add TODO for renaming connect.rs to streams.rsNick Mathewson2024-09-091-0/+4
|
* socksproto: Add a const for suggested buffer length.Nick Mathewson2024-09-091-2/+2
| | | | | Ticket #1509 will probably get rid of this constant, but for now we may as well put it in one place.
* rpclib: testing for future-proof proxyinfo formatNick Mathewson2024-09-091-9/+65
| | | | | Here we make sure that we can actually skip over other proxy formats in the future.
* arti/rpclib: Tweak proxy_info format.Nick Mathewson2024-09-091-6/+7
| | | | | | | Renamed address to tcp_address, and made it optional, so that later we can have a unix_path, etc. On deser side, add support for unrecognized listener types.
* arti/rpclib: Lowercase our socks5 listener variant.Nick Mathewson2024-09-091-0/+1
|
* rpclib: New error type for unauthenticated connectionsNick Mathewson2024-09-092-2/+16
| | | | | | This is done so that we can make "not authenticated" a non-internal error, under the theory that someday unauthenticated connections might be exposed.
* rpclib: FFI for opening data streams.Nick Mathewson2024-09-097-6/+248
| | | | | There's a blocking TODO here about exposing socks error codes that I still need to solve.
* rpclib: Support opening a data stream.Nick Mathewson2024-09-094-4/+336
| | | | | | Requires #1523. Implements #1524.
* Fix typosDimitris Apostolou2024-09-033-3/+3
|
* rpclib: Remove in_mut_ptr_opt, and document why.Nick Mathewson2024-08-271-25/+7
|
* rpclib, ffi: Allow simultaneous calls to `arti_rpc_handle_wait()`Nick Mathewson2024-08-274-13/+25
| | | | | | | | | | | | | | Its underlying function previously took `&mut RpcHandle`, which was an accident waiting to happen. Now it takes `&RpcHandle` and includes a Mutex to prevent multiple threads from waiting for updates on the same request ID at once. As an alternative, we *could* try to update connimpl::Receiver to allow multiple simultaneous listeners on the same request ID. But that would (I think) require a lot more bookkeeping, and thus would be a bit more error-prone. Closes #1532.
* rpclib: Allow ConnectionClosed in arti_socket_closed testNick Mathewson2024-08-211-0/+9
| | | | | | | | | | | | | | This test is supposed to check the case where we launch a bunch of requests but the socket is dropped before we get a response. Different operating systems handle 'drop' a bit differently, and schedule threads differently, so we shouldn't be surprised at slightly different errors here. In particular, OSX is more prone to deliver the close as a proper "close" rather than an EPIPE or such, which previously broke this test. Closes #1510.
* ffi: Rename arti_rpc_status_to_str.Nick Mathewson2024-08-141-1/+1
| | | | | | (This function manipulates an ArtiRpcStatus; and we try to have all of the ffi functions in this library begin with "arti_rpc_".)
* ffi: Add support for request handlesNick Mathewson2024-08-123-8/+169
| | | | | This API allows the caller to launch a request and then watch for updates on it.
* ffi: New in_mut_ptr_opt type for receiving *mut T.Nick Mathewson2024-08-121-0/+25
| | | | | | | | Previously, we had in_ptr_opt for functions that want to take a nullable `*const T` without consuming it. This is the equivalent for taking a nullable `*mut T` without consuming it.
* ffi: New out_val_opt type for outptrs to non-pointersNick Mathewson2024-08-123-22/+80
| | | | | | | | Previously, we had out_ptr_opt for functions that wanted to return a newly allocated `ArtiRpcFoo` via a `struct ArtiRpcFoo **` argument. But we didn't have a way to return non-allocated `int` via an `int *` argument. This code provides that.
* rpclib: Rename ParsedRequest to ParsedRequestFieldsNick Mathewson2024-08-071-11/+10
| | | | | | | | | | | | | This name change should emphasize that the (module-private) `ParsedRequestFields` type is only for parsing, and we aren't supposed to actually construct them for our own requests. With this change, and the others on the branch, there's no longer a risk of trying to serialize a ParsedRequestFields (since it doesn't implement Serialize), or to deserialize a Request (since it doesn't implement Deserialize). Closes #1511.
* rpclib: Use JsonValue to re-encode requests.Nick Mathewson2024-08-074-97/+81
| | | | | | | | As with responses, we previously used a strategy that could have failed in the future, if we forgot to add an "unexpected_fields" member to one of our structs. Closes #1512.
* rpclib: Unify error type for ValidatedRequest failure.Nick Mathewson2024-08-074-12/+36
|
* rpclib: Refactor request canonicalizationNick Mathewson2024-08-074-28/+38
| | | | | | This lets us make a couple of types module-private, and prepares the way for using the serde_json::Value trick on requests too.
* rpclib: Ensure that re-encoded responses end with NLNick Mathewson2024-08-071-1/+4
|
* rpclib: Use JsonValue to re-encode responsesNick Mathewson2024-08-072-38/+127
| | | | | | | | This approach keeps the property that we still preserve any unrecognized fields, but takes a different approach. Instead of using our own `structs` to round-trip the json, we use a `serde_json::Value`, to ensure that we cannot forget to add the `unexpected_fields` element to a struct.
* FFI: Expose the object ID for the session.Nick Mathewson2024-08-062-0/+37
| | | | (Without this, it isn't actually possible to use the RPC subsystem.)
* rpc: Make ObjectId hold a Utf8CString internally.Nick Mathewson2024-08-063-15/+95
| | | | This will enable us to return it to FFI callers as a nul-terminated string.
* Merge branch 'rpc-reencoding' into 'main'Nick Mathewson2024-08-055-93/+187
|\ | | | | | | | | | | | | rpc-client-core: Always re-encode requests and responses, and preserve unrecognized struct fields. Closes #1491 See merge request tpo/core/arti!2312
| * rpclib: Apply serde(default) to RpcMeta::updates.Nick Mathewson2024-08-051-0/+1
| | | | | | | | This enable a `meta` object to have no `updates` field set.
| * rpclib: re-encode responses from arti, and preserve fields.Nick Mathewson2024-08-041-60/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to re-encode responses to avoid possible mismatch between how arti-rpc-client-core parses messages and how the user application parses messages. (In theory this shouldn't be necessary so long as arti-rpc-client-core and arti have the same json implementation, and arti-rpc-client-core is only used for talking to arti. But those assumptions might change in the future.) Closes #1491. We want to preserve fields so that, if Arti adds any new elements to response or error in the future, and the client knows about them, they won't be lost simply because arti-rpc-client-core hasn't heard of them.
| * rpclib: preserve unrecognized request fieldsNick Mathewson2024-08-042-6/+41
| | | | | | | | | | | | When writing a request, we want to keep any fields that we don't recognize, in case the application (and arti) know about some field that we haven't heard of.
| * rpclib: Split ParsedRequest and Request types.Nick Mathewson2024-08-043-27/+58
| | | | | | | | (They are about to diverge even further.)
* | Merge branch 'typo-fix-1' into 'main'Ian Jackson2024-08-051-2/+2
|\ \ | | | | | | | | | | | | Fix a pair of typos in an ffi comment. See merge request tpo/core/arti!2310
| * | Fix a pair of typos in an ffi comment.Nick Mathewson2024-08-031-2/+2
| |/
* | ffi: Expose OS error field.Nick Mathewson2024-08-031-2/+23
| | | | | | | | Closes #1501.
* | ffi: Store the os error code in FfiError.Nick Mathewson2024-08-031-0/+40
| | | | | | | | (This is an errno or a GetLastError.)
* | rpc-client-core: Add thiserror #[source] annotationsNick Mathewson2024-08-032-7/+7
|/ | | | | This will make error outputs more usable, and will make it possible to expose OS error codes.
* ffi: Make "sealed" a little less effective.Nick Mathewson2024-07-311-7/+7
| | | | | Rust 1.70 (our MSRV) will not allow us to use a trait from a private module in this way, unfortunately.
* ffi: Add some explicit ()s to prove they are there.Nick Mathewson2024-07-312-2/+6
|
* ffi: Document safety for each function using ffi_body_raw.Nick Mathewson2024-07-312-3/+17
|
* ffi: rename ffi_body_simple to ffi_body_rawNick Mathewson2024-07-313-18/+18
|
* ffi: Document rules for ensuring return valuesNick Mathewson2024-07-311-0/+13
|
* ffi: Clean up long lines and confusing expressions.Nick Mathewson2024-07-312-8/+16
|
* ffi: use void to omit unreachable "on invalid" blocksNick Mathewson2024-07-313-26/+58
|
* RPC: Re-wrap some macro definitions and usages.Nick Mathewson2024-07-311-14/+41
|
* ffi: Remove all non-opt conversionsNick Mathewson2024-07-313-206/+120
| | | | | | | Additionally, inline the related conversion functions. This should reduce the total amount of unsafe code that somebody would need to look at.
* ffi: Always abort on panic.Nick Mathewson2024-07-313-42/+13
|