.TH "mesh.h" 3 "Bark" \" -*- nroff -*- .ad l .nh .SH NAME mesh.h \- Bark peer-to-peer WebRTC mesh signaling and data transport\&. .SH SYNOPSIS .br .PP .SS "Classes" .in +1c .ti -1c .RI "struct \fBbark_mesh_cbs\fP" .br .RI "Mesh peer lifecycle and message callbacks\&. " .in -1c .SS "Typedefs" .in +1c .ti -1c .RI "typedef struct bark_mesh \fBbark_mesh_t\fP" .br .RI "Opaque P2P mesh transport handle\&. " .ti -1c .RI "typedef struct \fBbark_mesh_cbs\fP \fBbark_mesh_cbs_t\fP" .br .RI "Mesh peer lifecycle and message callbacks\&. " .in -1c .SS "Functions" .in +1c .ti -1c .RI "\fBbark_mesh_t\fP * \fBbark_mesh_create\fP (struct bark_rtc *rtc, const \fBbark_mesh_cbs_t\fP *cbs, void *user)" .br .RI "Create a DataChannel mesh controller backed by \fRrtc\fP\&. " .ti -1c .RI "void \fBbark_mesh_destroy\fP (\fBbark_mesh_t\fP *mesh)" .br .RI "Destroy the mesh controller and close all peer sessions\&. " .ti -1c .RI "void \fBbark_mesh_set_self_id\fP (\fBbark_mesh_t\fP *mesh, const char *self_id)" .br .RI "Set the local peer identifier used for deterministic offer-glare tie-breaking\&. " .ti -1c .RI "void \fBbark_mesh_set_limits\fP (\fBbark_mesh_t\fP *mesh, size_t part_size, size_t high_water, uint32_t connect_timeout_ms)" .br .RI "Configure chunk part size, send buffer high-water mark, and connect timeout (ms)\&. " .ti -1c .RI "int \fBbark_mesh_connect\fP (\fBbark_mesh_t\fP *mesh, const char *peer_id, uint64_t now_ms)" .br .RI "Initiate or reuse a DataChannel connection to \fRpeer_id\fP\&. " .ti -1c .RI "void \fBbark_mesh_recv_signal\fP (\fBbark_mesh_t\fP *mesh, const char *peer_id, const char *kind, const char *sid, const char *sdp_type, const char *sdp, const char *cand_json, uint64_t now_ms)" .br .RI "Deliver an incoming signaling envelope (\fRoffer\fP, \fRanswer\fP, or \fRice\fP) from \fRpeer_id\fP\&. " .ti -1c .RI "void \fBbark_mesh_on_dc_open\fP (\fBbark_mesh_t\fP *mesh, const char *peer_id)" .br .RI "Forward \fBbark_rtc_cbs_t::on_dc_open\fP into the mesh controller\&. " .ti -1c .RI "void \fBbark_mesh_on_dc_msg\fP (\fBbark_mesh_t\fP *mesh, const char *peer_id, const uint8_t *data, size_t len, int is_bin)" .br .RI "Forward \fBbark_rtc_cbs_t::on_dc_msg\fP into the mesh controller\&. " .ti -1c .RI "void \fBbark_mesh_on_dc_close\fP (\fBbark_mesh_t\fP *mesh, const char *peer_id)" .br .RI "Forward \fBbark_rtc_cbs_t::on_dc_close\fP into the mesh controller\&. " .ti -1c .RI "void \fBbark_mesh_poll\fP (\fBbark_mesh_t\fP *mesh, uint64_t now_ms)" .br .RI "Flush queued outbound messages and expire timed-out peer handshakes\&. " .ti -1c .RI "int \fBbark_mesh_send_text\fP (\fBbark_mesh_t\fP *mesh, const char *peer_id, const char *json, size_t len)" .br .RI "Send a UTF-8 JSON text payload to \fRpeer_id\fP (automatically chunked if larger than part_size)\&. " .ti -1c .RI "int \fBbark_mesh_send_bin\fP (\fBbark_mesh_t\fP *mesh, const char *peer_id, const uint8_t *bytes, size_t len)" .br .RI "Send a raw binary payload to \fRpeer_id\fP\&. " .ti -1c .RI "size_t \fBbark_mesh_buffered\fP (\fBbark_mesh_t\fP *mesh, const char *peer_id)" .br .RI "Return the number of buffered outbound bytes for \fRpeer_id\fP\&. " .ti -1c .RI "int \fBbark_mesh_is_open\fP (const \fBbark_mesh_t\fP *mesh, const char *peer_id)" .br .RI "Return non-zero if \fRpeer_id\fP has an open DataChannel\&. " .ti -1c .RI "int \fBbark_mesh_is_connecting\fP (const \fBbark_mesh_t\fP *mesh, const char *peer_id)" .br .RI "Return non-zero if a handshake with \fRpeer_id\fP is currently in progress\&. " .ti -1c .RI "const char * \fBbark_mesh_peer_sid\fP (const \fBbark_mesh_t\fP *mesh, const char *peer_id)" .br .RI "Return the active signaling session ID (\fRsid\fP) for \fRpeer_id\fP, or NULL\&. " .ti -1c .RI "void \fBbark_mesh_close_peer\fP (\fBbark_mesh_t\fP *mesh, const char *peer_id)" .br .RI "Close and clean up the DataChannel session for \fRpeer_id\fP\&. " .ti -1c .RI "void \fBbark_mesh_close_all\fP (\fBbark_mesh_t\fP *mesh)" .br .RI "Close all peer DataChannel sessions\&. " .in -1c .SH "Detailed Description" .PP Bark peer-to-peer WebRTC mesh signaling and data transport\&. P2P WebRTC DataChannel mesh transport layered over \fBbark_rtc_t\fP\&. .PP Handles per-peer session tracking, simultaneous-offer glare tie-breaking, outbound queueing with high-water flushing, and transparent JSON message chunking and multi-stream reassembly\&. .SH "Author" .PP Generated automatically by Doxygen for Bark from the source code\&.