aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-rpc-client-core/src/ffi/err.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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-061-2/+2
| | | | Closes #1588.
* 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-071-4/+4
| | | | | | | | | | | | | | 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.
* 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.
* 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-091-0/+43
| | | | | 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-031-1/+1
|
* 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: New out_val_opt type for outptrs to non-pointersNick Mathewson2024-08-121-1/+1
| | | | | | | | 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: 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-311-6/+6
|
* ffi: Clean up long lines and confusing expressions.Nick Mathewson2024-07-311-5/+7
|
* ffi: use void to omit unreachable "on invalid" blocksNick Mathewson2024-07-311-5/+11
|
* ffi: Remove all non-opt conversionsNick Mathewson2024-07-311-11/+15
| | | | | | | 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-311-25/+9
|
* Use macros to make FFI functions simpler to read and check.Nick Mathewson2024-07-311-47/+54
| | | | | | | | | | | | | | | | | | | | These macros do the only part of our FFI functions that needs to be `unsafe`: converting input pointers into types that can be used in safe rust. I've added documentation about what requirements each of these conversions puts onto out inputs: both informally, and via a reference to the relevant parts of the Rust library documentation. While doing this I found a safety bug in `OutPtr::from_opt_ptr`: it should have been using `MaybeUninit`. These macros should allow us to build a "proof sketch" for the safety of our FFI code. We need to show, for each input parameter: - That the documented requirements for its conversion method are also documented requirements for that kind of input, in our header file. - That the documented requirements for how it can be used after conversion are in fact followed in the code.
* Rename Utf8CStr=>Utf8CStringNick Mathewson2024-07-311-2/+2
|
* rpclib ffi: Grand identifier renamingNick Mathewson2024-07-311-20/+21
| | | | In brief: Everything now starts with ARTI_RPC, arti_rpc, or ArtiRpc.
* rpclib: Revise/condense "safety" docs for C functionsNick Mathewson2024-07-311-15/+12
| | | | | | | | | | | | | | | These documents are no longer called "safety". They are now mostly collected as a big list of "correctness requirements" at the start of the cbindgen header. Because of these requirements, most functions no longer need their own "safety" sections. I am explicitly using `#[allow(clippy::missing_safety_doc)]` on each function, rather than adding a blanket exception: - There are other unsafe functions in this code, to which we wouldn't want an exception to apply. - Documenting the safety^W correctness requirements of a function is important enough to make sure that we aren't skipping out on it unintentionally.
* rpc: Rename OutPtr functions for clarityNick Mathewson2024-07-311-2/+2
|
* rpclib: Grand error refactoring: outparam, not thread-localNick Mathewson2024-07-311-92/+35
| | | | | | | | Per discussion, we'd rather have an optional output parameter for error objects rather than mess with thread-local variables. This is possibly less convenient for direct usage from C, but likely more convenient for wrapper functions in other languages.
* rpclib: Add "STATUS" to status codes.Nick Mathewson2024-07-311-6/+6
|
* rpc: Improve documentation and strings for FFI status codes.Nick Mathewson2024-07-311-5/+29
|