asciichat_error_t
Error and exit codes - unified status values (0-255)
asciichat_error_t webrtc_create_datachannel(webrtc_peer_connection_t *pc, const char *label, webrtc_data_channel_t **dc_out)
Create a DataChannel (for connection initiator)
void webrtc_close_peer_connection(webrtc_peer_connection_t *pc)
Close and destroy a peer connection.
void webrtc_cleanup(void)
Cleanup WebRTC library resources.
asciichat_error_t webrtc_create_offer(webrtc_peer_connection_t *pc)
Create and set local SDP offer (for connection initiator)
asciichat_error_t webrtc_datachannel_set_callbacks(webrtc_data_channel_t *dc, const webrtc_datachannel_callbacks_t *callbacks)
Set DataChannel callbacks.
asciichat_error_t webrtc_add_remote_candidate(webrtc_peer_connection_t *pc, const char *candidate, const char *mid)
Add remote ICE candidate.
webrtc_state_t webrtc_get_state(webrtc_peer_connection_t *pc)
Get current connection state.
asciichat_error_t webrtc_init(void)
Initialize WebRTC library (libdatachannel)
void webrtc_datachannel_destroy(webrtc_data_channel_t *dc)
Destroy a DataChannel and free resources.
asciichat_error_t webrtc_create_peer_connection(const webrtc_config_t *config, webrtc_peer_connection_t **pc_out)
Create a new WebRTC peer connection.
const char * webrtc_datachannel_get_label(webrtc_data_channel_t *dc)
Get DataChannel label.
void(* webrtc_local_description_callback_t)(webrtc_peer_connection_t *pc, const char *sdp, const char *type, void *user_data)
Callback for local SDP offer/answer generation.
webrtc_gathering_state_t
ICE gathering state.
void * webrtc_get_user_data(webrtc_peer_connection_t *pc)
Get user data pointer from connection.
void(* webrtc_datachannel_message_callback_t)(webrtc_data_channel_t *dc, const uint8_t *data, size_t size, void *user_data)
Callback for DataChannel message received.
void(* webrtc_state_callback_t)(webrtc_peer_connection_t *pc, webrtc_state_t state, void *user_data)
Callback for state changes.
void webrtc_peer_connection_close(webrtc_peer_connection_t *pc)
Close a peer connection.
webrtc_state_t
WebRTC connection state.
void(* webrtc_datachannel_open_callback_t)(webrtc_data_channel_t *dc, void *user_data)
Callback for DataChannel open event.
void(* webrtc_local_candidate_callback_t)(webrtc_peer_connection_t *pc, const char *candidate, const char *mid, void *user_data)
Callback for local ICE candidate discovery.
void webrtc_peer_connection_destroy(webrtc_peer_connection_t *pc)
Destroy a peer connection and free resources.
asciichat_error_t webrtc_set_remote_description(webrtc_peer_connection_t *pc, const char *sdp, const char *type)
Set remote SDP offer/answer.
void webrtc_close_datachannel(webrtc_data_channel_t *dc)
Close a DataChannel.
bool webrtc_datachannel_is_open(webrtc_data_channel_t *dc)
Check if DataChannel is open and ready.
asciichat_error_t webrtc_datachannel_send(webrtc_data_channel_t *dc, const uint8_t *data, size_t size)
Send data over DataChannel.
void(* webrtc_datachannel_error_callback_t)(webrtc_data_channel_t *dc, const char *error, void *user_data)
Callback for DataChannel error.
@ WEBRTC_GATHERING_COMPLETE
All candidates gathered.
@ WEBRTC_GATHERING_GATHERING
Gathering candidates.
@ WEBRTC_GATHERING_NEW
Not started.
@ WEBRTC_STATE_NEW
Connection created but not started.
@ WEBRTC_STATE_DISCONNECTED
Connection lost.
@ WEBRTC_STATE_FAILED
Connection failed (fatal)
@ WEBRTC_STATE_CLOSED
Connection closed cleanly.
@ WEBRTC_STATE_CONNECTING
ICE gathering/connection in progress.
@ WEBRTC_STATE_CONNECTED
DataChannel established and ready.
webrtc_datachannel_message_callback_t on_datachannel_message
webrtc_local_description_callback_t on_local_description
webrtc_local_candidate_callback_t on_local_candidate
size_t stun_count
Number of STUN servers.
webrtc_state_callback_t on_state_change
webrtc_datachannel_error_callback_t on_datachannel_error
turn_server_t * turn_servers
Array of TURN servers.
stun_server_t * stun_servers
Array of STUN servers.
void * user_data
Passed to all callbacks.
size_t turn_count
Number of TURN servers.
webrtc_datachannel_open_callback_t on_datachannel_open
webrtc_peer_connection_t * pc
Parent peer connection.
DataChannel callback structure.
void * user_data
Passed to all callbacks.