summaryrefslogtreecommitdiff
path: root/crates/arti-rpc-client-core
Commit message (Collapse)AuthorAgeFilesLines
* Bump all the unstable tor- and arti- crates to 0.22.0.Gabriela Moldovan2024-09-031-2/+2
| | | | | | | | | | Done using: ``` for crate in $(./maint/list_crates | rg '^(tor|arti-)'); do cargo set-version -p $crate 0.22.0 done ```
* Fix typosDimitris Apostolou2024-09-035-5/+5
|
* rpclib: Remove in_mut_ptr_opt, and document why.Nick Mathewson2024-08-273-37/+22
|
* 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-142-2/+2
| | | | | | (This function manipulates an ArtiRpcStatus; and we try to have all of the ffi functions in this library begin with "arti_rpc_".)
* cbindgen: Correctly hide "Utf8CString".Nick Mathewson2024-08-143-9/+10
|
* Merge branch 'ffi_dylib' into 'main'Alexander Færøy2024-08-131-0/+3
|\ | | | | | | | | ffi: Build arti-rpc-client-core as a C dynamic library. See merge request tpo/core/arti!2331
| * ffi: Build client-core as a dynamic library.Nick Mathewson2024-08-061-0/+3
| |
* | ffi: Add support for request handlesNick Mathewson2024-08-126-9/+285
| | | | | | | | | | 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.
* | Re-run cbindgen; new version has changed whitespace.Nick Mathewson2024-08-121-3/+3
| |
* | Re-run cbindgen to fix CINick Mathewson2024-08-081-4/+0
| | | | | | | | | | | | | | For some reason, we wound up - not with anything missing in the header - but with extra warnings in our expected warnings file. I'm tentatively blaming the git merge algorithm, or perhaps the phase of the moon.
* | Merge branch 'docsrs' into 'main'Jim Newsome2024-08-071-1/+0
|\ \ | | | | | | | | | | | | | | | | | | Don't need to tell docs.rs to enable `docsrs` cfg. It does it automatically as of https://github.com/rust-lang/docs.rs/pull/2390#event-11664409098 While this change isn't in our MSRV yet, we were only using this when building for docs.rs, where we use the latest anyway. See merge request tpo/core/arti!2308
| * | Don't need to tell docs.rs to enable `docsrs` cfgKunal Mehta2024-08-021-1/+0
| | | | | | | | | | | | | | | It now does it automatically, see <https://docs.rs/about/builds#detecting-docsrs>.
* | | Merge branch 'cbindgen-ci' into 'main'David Goulet2024-08-072-0/+33
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Test cbindgen correctness in CI Closes #1502 See merge request tpo/core/arti!2320
| * | | Re-run cbindgen to update our generated header.Nick Mathewson2024-08-072-0/+33
| | | | | | | | | | | | | | | | (This is kind of thing that the CI script should remind us to do.)
* | | | 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.
* Bump versions for tor- and arti- crates to 0.21.0Nick Mathewson2024-08-011-2/+2
| | | | | | | | | | This is the result of: ``` for crate in $( ./maint/list_crates |grep '^\(tor\|arti-\)' ); do cargo set-version -p $crate 0.21.0 done ```
* Run "fixup-features".Nick Mathewson2024-08-011-1/+1
|
* 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: Re-run cbindgen.Nick Mathewson2024-07-312-23/+55
|
* 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-313-9/+18
|
* ffi: Clarify rules for *out pointers.Nick Mathewson2024-07-311-3/+5
| | | | Except for *error_out, they are always set to NULL on error.
* ffi: use void to omit unreachable "on invalid" blocksNick Mathewson2024-07-314-26/+59
|
* 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
|