NPRPC docs

C++ API

404 declarations · 404 documented

(global)

  • operator<< operator

    Prints an object reference's fields, one per line.

nprpc

  • as_awaitable function

    Wraps a Task so it can be awaited inside a Boost.Asio coroutine:

  • BidiStream struct

    Both directions of a bidi_stream method: read what the other side sends, write what you send. Move-only.

  • DispatchExecutor struct

    Optional dispatch executor for servant callbacks / SHM offload.

  • EndPoint class

    A transport plus an address: host and port, or a shared-memory channel id. One entry of ObjectId::urls(), parsed.

  • Exception class

    Base of every exception NPRPC raises, including those declared in IDL.

  • flat_buffer class

    A flat buffer that can operate in two modes: 1. Owned mode: manages its own heap-allocated memory (like boost::beast::flat_buffer) 2. View mode: references external memory (e.g., shared memory ring buffer)

  • get_context function

    The session of the call being dispatched on this thread. Only valid inside a servant method; throws Exception elsewhere.

  • get_io_context function

    Returns the io_context for the current RPC instance. Safe to call from any thread, including servant dispatch handlers. Use with nprpc::spawn_task() to schedule async work after dispatch returns.

  • invalid_object_id variable

    Object id that names no object, e.g. a failed nameserver lookup.

  • IterableCollection concept

    A sized forward range; generated helpers accept any container that satisfies it.

  • kEmptyStreamFinalSequence variable

    StreamComplete.final_sequence of a stream that sent no chunks.

  • make_wrapper1 function

    Uniform -> access to a value or a pointer to one; used by generated code to accept both containers of values and containers of pointers.

  • mem_prefix variable

    URL scheme of shared-memory endpoints (same machine only).

  • narrow function

    Converts a generic Object to the proxy type T of its interface.

  • Object class

    Client-side proxy for a remote object. npidl generates a subclass per interface with a method for each call.

  • ObjectId class

    A reference to an object: its id, where it lives, and the URLs it can be reached at. Object adds a connection to it.

  • ObjectPtr class

    Owning handle to a proxy (Object or a generated subclass), like a shared_ptr whose count lives in the object: copies call add_ref(), destruction and reset() call release().

  • ObjectServant class

    Base of every server-side object. npidl generates I<Interface>_Servant from it; implement the interface's methods in a subclass and activate an instance with Poa::activate_object.

  • OperationCancelled class

    Thrown when an async RPC call is cancelled via std::stop_token.

  • operator<< operator

    Prints the endpoint as a URL.

  • PageHandler typealias

    Renders a page in-process, on the HTTP server's own thread.

  • PageRequest struct

    An HTTP request offered to the application for server-side rendering.

  • PageResponse struct

    The application's answer for a PageRequest.

  • Poa class

    Portable Object Adapter: holds servants and routes incoming calls to them. Create one with Rpc::create_poa(); see the POA guide for the threading options.

  • PoaBuilder class

    Configures a POA; get one from Rpc::create_poa() and finish with build().

  • quic_prefix variable

    URL scheme of native QUIC endpoints.

  • read_size_helper function

    How much Boost.Beast should read into buf at once: at least 64 KiB, capped by max_size.

  • ReferenceList class

    The servants a session holds references to. Released together when the session ends, so a client that disconnects without releasing its references does not keep transient objects alive.

  • reload_certificates function

    Re-read the configured TLS certificate and key files

  • Rpc class

    The runtime: listeners, sessions and POAs. Create it with RpcBuilder.

  • RpcBuilder class

    Entry point for configuring and starting the runtime; see RpcBuilderBase for the settings and an example.

  • RpcBuilderBase class

    Settings shared by every transport. Start from RpcBuilder, call with_tcp(), with_http() or with_quic() for transport-specific ones, and finish with build().

  • RpcBuilderHttp class

    HTTP, WebSocket, HTTP/3 and WebTransport settings; see RpcBuilderBase::with_http.

  • RpcBuilderQuic class

    Native QUIC settings; see RpcBuilderBase::with_quic.

  • RpcBuilderTcp class

    TCP settings; see RpcBuilderBase::with_tcp.

  • SessionContext struct

    One client connection as seen by a servant: who is calling, and the state that lives as long as the connection. Get the current one with get_context() inside a servant method.

  • spawn_task function

    Runs factory(), which returns boost::asio::awaitable<void>, on ioc without waiting for it:

  • stream_final_sequence_for_sent_chunks function

    StreamComplete.final_sequence after sent_chunk_count chunks.

  • StreamReader class

    The receiving end of a stream of T: what a proxy's server_stream method returns, and what a servant's client_stream method receives.

  • StreamReaderBase class

    Type-erased StreamReader, as the runtime stores it.

  • StreamWriter class

    The sending end of a stream of T. It works in two ways:

  • StreamWriterBase class

    Type-erased StreamWriter, as the runtime stores it.

  • Task class

    A coroutine result: Task<T> f() { co_return value; }.

  • tcp_prefix variable

    URL scheme of native TCP endpoints.

  • web_prefix variable

    URL scheme shared by HTTP, WebSocket and WebTransport endpoints.

nprpc::PoaPolicy

  • Lifespan enum

    How long a POA's objects live.

  • ObjectIdPolicy enum

    Who picks object ids.

  • TransportAffinity enum

    Where servant dispatch may run relative to the transport I/O thread (SHM ring consumer, TCP read loop, etc.).

nprpc::flat

  • Boolean class

    A boolean as stored on the wire: one byte, 0 or 1.

  • make_read_only_span function

    A read-only byte view of str, e.g. to pass as vector<u8>.

  • make_span function

    A writable view of v's elements.

  • operator<< operator

    Prints the characters.

  • Optional_Direct class

    Accessor for an optional (name?: T) field. value() returns T& for plain types and the TD accessor for messages and strings.

  • OwnedDirect class

    Generic zero-copy buffer owner for any flat Direct accessor type. Used for 'out direct struct/array/string/optional' RPC arguments. Stores the shared_ptr that keeps the receive buffer alive, plus the absolute byte offset at which the Direct object lives. The Direct accessor TD is reconstructed cheaply on every call to get().

  • OwnedSpan class

    Owns a flat_buffer (via shared_ptr) and exposes a zero-copy span view. Used as the parameter type for 'out direct vector<T>' (primitive element) RPC arguments so the receive buffer is never copied.

  • Span struct

    A contiguous run of T inside a buffer: pointers first and last, begin()/end(), size(), operator[] and data(). Does not own the memory.

  • Span_ref struct

    A vector of messages or strings inside a buffer. Iterating yields a TD accessor (<Message>_Direct, String_Direct1) for each element.

  • String class

    A string's layout in the buffer. Public, unlike the other layout types: servants taking vector<string> receive Span_ref<String, String_Direct1>.

  • String_Direct1 class

    Accessor for a string field; call it for a Span<char>.

  • Vector_Direct class

    Accessor for a vector<T> field while building or reading a message. Vector_Direct1 and Vector_Direct2 add element access.

  • Vector_Direct1 class

    Vector_Direct for elements of plain types; call it for a Span<T>.

  • Vector_Direct2 class

    Vector_Direct for elements that are messages or strings; call it for a Span_ref of TD accessors.

nprpc::http

  • clear_cookie function

    Remove a cookie on the client side by setting Max-Age=0.

  • CookieOptions struct

    Options for a Set-Cookie header.

  • get_cookie function

    Get a named cookie value from the current HTTP request. Returns std::nullopt when: - not inside an HTTP-dispatched servant call, or - the named cookie is absent.

  • set_cookie function

    Queue a Set-Cookie header for the current HTTP response. No-op when called from a non-HTTP session.