aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-rpc-client-core/src/ffi
Commit message (Collapse)AuthorAgeFilesLines
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* rpc-client: add support to prefer/require su permissionNick Mathewson2026-03-161-0/+2
|
* rpc: Refactor connimpl in preparation for pollable requests.Nick Mathewson2026-02-261-0/+1
| | | | | | | | | | | | | | | | | | | | | In order to implement this part of #1856, we will internally divide requests into two kinds: "Waitable" and "Pollable". Waitable requests are the kind that we have now: They are created with an "execute" method. They each have their own response queue and their own condvar, and in order to see if they have any responses, the caller needs to call some kind of request-specific method. Pollable requests are the ones we will add. They are created with a "submit" method, and associated with a user-provided tag. They all share the same queue and the same condvar. To see if any of them have a response, the caller will run a function that returns tagged responses. In order to support this division, this commit: - turns `RequestState` into an enum, - makes `ResponseQueue` into its own type, - Adds a trait that will be implemented by every type that can identify a response queue.
* arti-rpc-client-core: Document why we don't need ErrorSources.Nick Mathewson2026-02-161-0/+4
|
* rpc: Move responsibility for wrapping streams to rpc-client-coreNick Mathewson2026-02-041-0/+1
| | | | | This will be necessary since, in order to make the RPC stuff nonblocking, we'll need a better API than just `Box<dyn Read>` etc.
* rpclib: Rename `OutPtr` to `OutBoxedPtr`Neel Chauhan2025-11-062-24/+24
| | | | Closes #1588.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Fix warnings and errors from edition 2024.Nick Mathewson2025-08-071-7/+7
| | | | | | | | | | The two main causes of errors were: - Since some of the lifetime rules have changed, we no longer need to do as many "bind a variable and immediately return it" patterns, and so clippy now warns about them. - We needed to adjust the explicit captures (`use<...>`) in a couple of our RPIT instances.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-072-6/+6
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* fix `clippy::doc_overindented_list_items`Steven Engler2025-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | Example: ```text warning: doc list item overindented --> crates/arti-rpc-client-core/src/conn/connimpl.rs:322:9 | 322 | /// indicates that no more messages will be received for this request. | ^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items note: the lint level is defined here --> crates/arti-rpc-client-core/src/lib.rs:8:9 | 8 | #![warn(clippy::all)] | ^^^^^^^^^^^ = note: `#[warn(clippy::doc_overindented_list_items)]` implied by `#[warn(clippy::all)]` ```
* AF_UNIX terminology: Rename two error variantsIan Jackson2025-03-241-1/+1
| | | | Change `..UnixAddress...` to `...AfUnixAddress..`.
* RPC: Abolish an unused and misnamed error variantIan Jackson2025-03-241-1/+0
| | | | | This variant breaches the new guidelines about AF_UNIX terminology. And its purpose is unclear and it's not used.
* rpclib: Improve output for ConnectFailureNick Mathewson2025-02-041-1/+4
| | | | | | | We want to explain better what has happened, not only with the final fatal error, but with any nonfatal errors that occurred in the middle. Closes #1826.
* rpclib: Include sources when formatting FFI errors.Nick Mathewson2025-02-041-2/+14
| | | | Closes #1650.
* rpclib: New combined error type for RPC connect failures.Nick Mathewson2025-01-291-0/+11
| | | | | This type explains where every error came from, and explains why each declined connect point was declined.
* arti-rpc-client-core: Rename Authentication{Rejected=>Failed}Nick Mathewson2025-01-231-2/+2
| | | | | | | | Also change corresponding message. This way, it will be clear that we're just reporting that Arti gave us an error—not that the error necessarily means that the authentication itself was "wrong".
* rpclib: Avoid overuse of execute_internal_ok.Nick Mathewson2025-01-231-0/+1
| | | | | | | | | | | The execute_internal_ok method converts every error response into an internal error; as such, it's only appropriate when there is no way for a well-behaved Arti instance to give an error response. But we had been using it in a few places where errors were possible under other circumstances. This commit fixes that behavior, and adds documentation to help avoid it.
* arti-rpc-client-core: Client side of cookie authentication.Nick Mathewson2025-01-151-0/+3
|
* Implement banner for RPC protocol.Nick Mathewson2025-01-091-0/+1
| | | | Closes #1753
* rpc-client: Reject relative paths.Nick Mathewson2024-12-091-1/+3
|
* artilib: Revise C and Python APIs for builders.Nick Mathewson2024-12-091-0/+4
| | | | | | | | | | | | | | | Expose ArtiRpcConnBuilder and appropriate C wrapper functions in our FFI code, and wrap those functions in our python wrapper. This breaks the old C API, but that's allowed since the API is still experimental. Some design decisions: * I've wrapped the builder in a Mutex, so that we can continue our FFI rule that we do not require non-Rust code to wrap `&mut`. * I've removed the non-builder connect() function from the C API as extraneous. * I've made a single function to prepend elements to the search path.
* rpc-client-core: Correct various FFI error types.Nick Mathewson2024-12-091-6/+42
|
* rpc-client: Initial implementation for RPC connect points.Nick Mathewson2024-12-091-2/+7
| | | | | | | | | This commit covers the major points of the design: Parsing the environment, parsing and resolving connect points, connecting to Arti, and handling errors. There are a few areas that need to be fixed, all marked with XXXXs.
* Resolve clippy::empty_line_after_doc_comments warnings.Nick Mathewson2024-12-031-1/+1
| | | | These are new in Rust 1.83.
* rpc: correct msg and doc for InvalidInput::NullPointerNick Mathewson2024-10-231-2/+2
| | | | | Previously we implied that it was only for strings, which isn't the case.
* rpclib: Rename RequestCancelled to be accurate.Nick Mathewson2024-10-211-6/+3
|
* arti-rpc-client-core: remove 'c_str_macro' dependencySteven Engler2024-10-091-16/+15
| | | | | Arti has a MSRV of rust 1.77 which supports C string literals, so 'c_str_macro' isn't needed.
* Merge branch 'ffi_seal' into 'main'Nick Mathewson2024-10-021-34/+41
|\ | | | | | | | | artilib: Take a different approach to sealing a pair of traits. See merge request tpo/core/arti!2472
| * artilib: Take a different approach to sealing a pair of traits.Nick Mathewson2024-10-011-34/+41
| | | | | | | | This resolves a "TODO MSRV" comment.
| * socks users: detect closed sockets.Nick Mathewson2024-09-241-0/+1
| | | | | | | | | | | | | | | | | | Without this check, our socks code can enter an infinite loop if a socket is closed at the wrong time. Resolves TROVE-2024-011. Fixes #1635.
* | rpclib: Unify code internally generated requestsNick Mathewson2024-09-251-1/+1
|/ | | | | | | | We now have a single type to represent the error "A request that we made internally didn't get a result we expected." The functions to generate these requests are now centralized too. Closes #1587.
* rpclib: New error type for unauthenticated connectionsNick Mathewson2024-09-091-0/+8
| | | | | | 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-092-2/+100
| | | | | 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-091-0/+1
| | | | | | Requires #1523. Implements #1524.
* Fix typosDimitris Apostolou2024-09-032-2/+2
|
* 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-271-0/+1
| | | | | | | | | | | | | | 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.
* 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-121-3/+0
| | | | | 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-122-20/+78
| | | | | | | | 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.
* 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.)
* 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-311-1/+2
|
* ffi: Document safety for each function using ffi_body_raw.Nick Mathewson2024-07-311-3/+11
|
* ffi: rename ffi_body_simple to ffi_body_rawNick Mathewson2024-07-312-14/+14
|
* ffi: Document rules for ensuring return valuesNick Mathewson2024-07-311-0/+13
|