Expand description
C ABI surface for the Group Protocol Stack.
Designed for consumption from .NET (or any FFI-capable runtime) via
P/Invoke. The C ABI is grouped into the following families:
- GBP (
gbp_node_*) — the IP-like base layer: framing, AEAD, replay window, control plane. - GTP (
gtp_client_*) — text sub-protocol. - GAP (
gap_client_*) — audio sub-protocol. - GSP (
gsp_client_*) — signalling sub-protocol. - MLS (
gbp_mls_*) — RFC 9420 context. - SFrame (
gbp_sframe_*) — E2EE for GAP audio frames.
Conventions:
- Handle-based — every long-lived object lives in a Rust-side
registry keyed by an
i32handle. - GbpBuffer — binary blobs are returned as
(ptr, len, cap)triples and MUST be released withgbp_buffer_free. - Owned C-string — text values are returned as owned
*mut c_charand MUST be released withgbp_string_free. - Last error — every fallible call writes to a thread-local error
slot that callers can read via
gbp_last_error.
Structs§
- GbpBuffer
- Binary buffer produced by Rust. The caller MUST release it via
gbp_buffer_free.
Functions§
- gap_
client_ ⚠accept - Accepts a GAP audio payload.
- gap_
client_ create - Creates a stateful GAP client.
- gap_
client_ destroy - Destroys a GAP client.
- gap_
client_ reset - Clears the client state. Intended for use after an epoch change.
- gap_
client_ ⚠send - Sends an Opus audio frame via GAP.
- gbp_
buffer_ ⚠free - Releases a
GbpBuffer. - gbp_
error_ lookup - Returns a CBOR-encoded
ErrorObjectfor the given code. - gbp_
frame_ ⚠encode_ v - CBOR-encodes a [
gbp::GbpFrame] with an arbitrary version byte. - gbp_
last_ error - Returns the text of the last error, or an empty string if none.
- gbp_
mls_ ⚠accept_ welcome - Replaces the local group with the one described by the given Welcome.
- gbp_
mls_ clear_ pending_ commit - Discards any pending commit without applying it. Used on
ABORT_TRANSITIONto roll back to the pre-commit MLS state. - gbp_
mls_ ⚠create - Creates a new MLS context. Returns the new handle, or
0on failure. - gbp_
mls_ destroy - Destroys an MLS context.
- gbp_
mls_ epoch - Returns the current epoch of the MLS context, or
0on failure. - gbp_
mls_ export_ key_ package - Exports the TLS-serialised KeyPackage that can be used to invite this member into someone else’s group.
- gbp_
mls_ finalize_ commit - Merges any pending commit produced by
gbp_mls_invite_fullorgbp_mls_remove. Returnstrueon success,falseon failure. - gbp_
mls_ ⚠group_ id - Writes the 16-byte group identifier into
out16. - gbp_
mls_ ⚠invite - Invites the given KeyPackage into the local group. Returns the
TLS-serialised Welcome bytes that the invitee must consume with
gbp_mls_accept_welcome. - gbp_
mls_ ⚠invite_ full - Invites the given KeyPackage and returns BOTH the MLS Commit (which the caller MUST broadcast to existing members so they can advance their MLS epoch) and the Welcome (which the caller MUST unicast to the new joiner).
- gbp_
mls_ ⚠process_ message - Applies a Commit (or staged Proposal) message to the local MLS group.
Returns:
1 — Commit applied (epoch advanced)
2 — Application message (no-op for GBP)
3 — Proposal staged
4 — External message (no group state change)
0 — failure (see
gbp_last_error). - gbp_
mls_ remove - Removes the member at the given MLS LeafIndex and returns the TLS-serialised Commit. Caller MUST broadcast the Commit to remaining members so they advance their MLS epoch.
- gbp_
node_ apply_ transition - Applies an epoch transition locally.
- gbp_
node_ bootstrap_ creator - Drives the node to
ACTIVEas a creator. - gbp_
node_ bootstrap_ joiner - Drives the node to
ACTIVEas a joiner.expected_first_tidlets the joiner pre-arm pending transition state so that the firstEXECUTE_TRANSITIONafter Welcome is accepted; pass0if the joiner recovered out-of-band and is already current. - gbp_
node_ ⚠create - Creates a new GBP node and returns its handle.
- gbp_
node_ destroy - Destroys a GBP node.
- gbp_
node_ drain_ events - Drains the queued events (without consuming any wire bytes).
- gbp_
node_ epoch - Returns the node’s current epoch.
- gbp_
node_ last_ transition_ id - Returns the node’s last applied
transition_id. - gbp_
node_ ⚠on_ wire - Feeds wire bytes to the node. Returns a JSON-encoded array of events.
- gbp_
node_ ⚠send_ control - Sends a control plane message on Stream 0.
- gbp_
node_ set_ epoch - Forcibly sets the node’s
current_epoch(intended for tests of late peers andEPOCH_MISMATCHrecovery). - gbp_
node_ state - Returns the current
NodeStateencoded asu32. - gbp_
sframe_ ⚠decrypt - Decrypts one SFrame payload.
- gbp_
sframe_ ⚠encrypt - Encrypts one audio frame.
- gbp_
sframe_ ⚠encryptor_ create - Creates an encryptor for the local sender (
leaf_index) within an epoch. - gbp_
sframe_ encryptor_ free - Frees an encryptor created by
gbp_sframe_encryptor_create. - gbp_
sframe_ ⚠session_ create - Creates an SFrame session from an existing MLS context.
- gbp_
sframe_ session_ free - Frees an SFrame session created by
gbp_sframe_session_create. - gbp_
string_ ⚠free - Releases a string previously returned by an FFI function.
- gbp_
version - Returns the FFI library version with a short summary of the layers.
- gsp_
client_ ⚠accept - Accepts a GSP signal payload.
- gsp_
client_ create - Creates a stateful GSP client.
- gsp_
client_ destroy - Destroys a GSP client.
- gsp_
client_ reset - Clears the client state. Intended for use after an epoch change.
- gsp_
client_ send - Sends a GSP signal.
- gsp_
client_ ⚠send_ with_ args - Sends a GSP signal with opcode-specific CBOR
argsbytes. Use this for signals that require structured arguments (MUTE, UNMUTE, ROLE_CHANGE, STREAM_START, STREAM_STOP, CODEC_UPDATE). - gtp_
client_ ⚠accept - Accepts a plaintext payload that the GBP layer surfaced via a
payload_receivedevent. Returns a JSON object of the form{"status":"new|duplicate|error", ...}. - gtp_
client_ create - Creates a stateful GTP client (idempotency tracking).
- gtp_
client_ destroy - Destroys a GTP client.
- gtp_
client_ reset - Clears the client state. Intended for use after an epoch change.
- gtp_
client_ ⚠send - Sends a text message via GTP.