aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-rpc-client-core/src
Commit message (Collapse)AuthorAgeFilesLines
...
* ffi: Refactor @init macro expansions into new functions.Nick Mathewson2024-07-311-23/+102
| | | | (Documentation movement still needed.)
* ffi: Document internal ffi_initialize macro.Nick Mathewson2024-07-311-0/+14
|
* Apply suggestions about macro behavior, design, and usageNick Mathewson2024-07-311-0/+18
|
* Apply safety-related suggestions from DizietNick Mathewson2024-07-312-2/+11
|
* RPC FFI: Write a bit more text for the C no-UB requirements.Nick Mathewson2024-07-311-0/+2
| | | | | | | I got this by reading over all the relevant Rust stdlib safety documentation (now linked to in the macro definitions), and making sure that the C no-UB text is sufficient to guarantee that those requirements are met.
* ffi: Ensures every converter tries to run.Nick Mathewson2024-07-311-30/+55
| | | | | | | | | Previously, some of our conversion macros tried to exit early with `?`. This is undesirable, since the OutPtr conversion has the side effect of writing NULL to a pointer (if it is present). Now, every conversion runs, and _then_ we exit with an error if any of them fails.
* Use macros to make FFI functions simpler to read and check.Nick Mathewson2024-07-313-145/+406
| | | | | | | | | | | | | | | | | | | | 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.
* rpc: Explain _why_ utf-8 in Utf8CString is a safety requirement.Nick Mathewson2024-07-311-0/+6
| | | | (and to what extent)
* Rename Utf8CStr=>Utf8CStringNick Mathewson2024-07-315-18/+18
|
* rpclib: Suggestions from @diziet for improving safety docs.Nick Mathewson2024-07-311-1/+2
|
* rpclib ffi: Grand identifier renamingNick Mathewson2024-07-313-32/+43
| | | | In brief: Everything now starts with ARTI_RPC, arti_rpc, or ArtiRpc.
* rpclib: Revise/condense "safety" docs for C functionsNick Mathewson2024-07-312-38/+22
| | | | | | | | | | | | | | | 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-313-13/+13
|
* rpclib: Grand error refactoring: outparam, not thread-localNick Mathewson2024-07-313-103/+60
| | | | | | | | 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: _Sketch_ of string API.Nick Mathewson2024-07-313-35/+35
| | | | | | | | | | | | | In this API, borrowed strings are `const char *`, and owned strings are `ArtiRpcStr *`. You can get the former from the latter with `arti_rpc_str_get()`, which returns a `const char *` in hopes that you will neither modify nor free() that `const char *` (Note that there are no places where string ownership needs to be passed into this library; and at present, there is only one case where it is passed out. I do not anticipate that we will need to do intake of owned strings. We will probably need to return these in a few more cases as we add more API surface.)
* 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
|
* rpc ffi: Try a more reference-driven approach to pointer handling.Nick Mathewson2024-07-313-31/+195
|
* rpc: Initial core of an FFI interface.Nick Mathewson2024-07-316-5/+699
| | | | | | | | | This only covers the absolute minimal API in order to launch a connection and run simple requests, and it doesn't document anything nearly well enough. Nonetheless I think it's good enough for an initial review, to make sure that we've got the basics right (as well as a general consensus on the error handling API, naming, and so forth).
* RPC: Make message types able to be CStr or str.Nick Mathewson2024-07-313-22/+65
| | | | (Internally, it is a boxed CStr that is always UTF-8.)
* Merge branch 'rpclib-i64-id' into 'main'David Goulet2024-07-251-3/+2
|\ | | | | | | | | rpclib: Use i64 rather than u64 for request IDs. See merge request tpo/core/arti!2279
| * rpclib: Use i64 rather than u64 for request IDs.Nick Mathewson2024-07-221-3/+2
| | | | | | | | This makes it conform to the spec and match arti-rpcserver.
* | rpc: Rename the error codes for something like consistency.Nick Mathewson2024-07-251-3/+3
| |
* | rpc: Remove RpcError data field and use ReportNick Mathewson2024-07-252-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | 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: split "method not found"Nick Mathewson2024-07-251-4/+2
| | | | | | | | | | We've wanted separate error codes for "no such method exists" and "this method exists, but this object doesn't have it."
* | rpclib: Add tests for errors that terminate an RpcConn.Nick Mathewson2024-07-241-1/+101
| |
* | rpclib: Initial tests for RpcConnNick Mathewson2024-07-244-4/+237
| | | | | | | | | | | | The "complex" test here is fairly involved, since it tries to detect deadlocks and race conditions by using multiple threads and answering requests out of order.
* | rpclib: Test low-level reader/writer.Nick Mathewson2024-07-241-0/+125
| |
* | rpc: Relax 'static requirement on execute_with_updates closure.Nick Mathewson2024-07-241-1/+1
| | | | | | | | This turns out not to be necessary.
* | rpclib: do not include `"meta":null` when serializing.Nick Mathewson2024-07-241-0/+1
| |
* | rpclib: re-encode outgoing requests.Nick Mathewson2024-07-241-5/+6
|/ | | | | | I hadn't been sure that we wanted to do this, since arti is forgiving about its inputs, but IIRC Diziet was in favor of this, and it _does_ make it easier to write tests.
* RPC: Fix rustdoc links.Nick Mathewson2024-07-162-5/+5
|
* rpc: Rename response_err and add a TODO about removing itNick Mathewson2024-07-162-2/+7
|
* rpc: Add TODO about re-normalizing repliesNick Mathewson2024-07-161-0/+4
| | | | Also add a link to #1491 where we discuss it more.
* rpc: Adjust documentation about reply typesNick Mathewson2024-07-161-8/+16
|
* rpc: Make "meta" an Option.Nick Mathewson2024-07-161-6/+11
|
* rpc: Remove negotiation code.Nick Mathewson2024-07-162-53/+5
| | | | I think we'll need this again later, but for now it's redundant.
* rpc-client: Apply the rest of the big warning set.Nick Mathewson2024-07-163-3/+45
|
* rpc client: Documentation.Nick Mathewson2024-07-168-11/+178
|
* Tests and documentation about NULs in the RPC stream.Nick Mathewson2024-07-162-0/+20
|
* Make ErrorResponse (a string) our preferred way to return an error.Nick Mathewson2024-07-163-11/+56
| | | | | | | | If we return RpcError by default, we don't give a good way to actually access the original error string. (Nonetheless, we still enforce that errors can be decoded as RpcError.)
* rpc-client: Resolve some dead-code warnings.Nick Mathewson2024-07-163-23/+11
|
* rpc client: Remove Unvalidated{Reader,Writer}.Nick Mathewson2024-07-161-93/+32
|
* rpc client: resolve unused-foo warnings.Nick Mathewson2024-07-163-4/+2
|
* rpc-client: Expose a few types as pub.Nick Mathewson2024-07-161-0/+3
|
* Make RequestId and ObjectId public.Nick Mathewson2024-07-161-2/+2
|
* Add a TODO about refactoring should_alertNick Mathewson2024-07-161-0/+5
|
* Rename CmdError to ProtoError.Nick Mathewson2024-07-163-23/+23
|
* RPC: Implement connection negotiation.Nick Mathewson2024-07-164-27/+209
|
* WIP: Lower and middle levels of Arti rpc core.Nick Mathewson2024-07-168-0/+1428