ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
webrtc.h File Reference

Go to the source code of this file.

Data Structures

struct  webrtc_config_t
 WebRTC configuration. More...
 
struct  webrtc_datachannel_callbacks_t
 DataChannel callback structure. More...
 

Typedefs

typedef struct webrtc_peer_connection webrtc_peer_connection_t
 
typedef struct webrtc_data_channel webrtc_data_channel_t
 
typedef void(* webrtc_state_callback_t) (webrtc_peer_connection_t *pc, webrtc_state_t state, void *user_data)
 Callback for state changes.
 
typedef 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.
 
typedef 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.
 
typedef void(* webrtc_datachannel_open_callback_t) (webrtc_data_channel_t *dc, void *user_data)
 Callback for DataChannel open event.
 
typedef 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.
 
typedef void(* webrtc_datachannel_error_callback_t) (webrtc_data_channel_t *dc, const char *error, void *user_data)
 Callback for DataChannel error.
 

Enumerations

enum  webrtc_state_t {
  WEBRTC_STATE_NEW = 0 , WEBRTC_STATE_CONNECTING , WEBRTC_STATE_CONNECTED , WEBRTC_STATE_DISCONNECTED ,
  WEBRTC_STATE_FAILED , WEBRTC_STATE_CLOSED
}
 WebRTC connection state. More...
 
enum  webrtc_gathering_state_t { WEBRTC_GATHERING_NEW = 0 , WEBRTC_GATHERING_GATHERING , WEBRTC_GATHERING_COMPLETE }
 ICE gathering state. More...
 

Functions

asciichat_error_t webrtc_init (void)
 Initialize WebRTC library (libdatachannel)
 
void webrtc_cleanup (void)
 Cleanup WebRTC library 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.
 
void webrtc_close_peer_connection (webrtc_peer_connection_t *pc)
 Close and destroy a peer connection.
 
webrtc_state_t webrtc_get_state (webrtc_peer_connection_t *pc)
 Get current connection state.
 
void * webrtc_get_user_data (webrtc_peer_connection_t *pc)
 Get user data pointer from connection.
 
asciichat_error_t webrtc_create_offer (webrtc_peer_connection_t *pc)
 Create and set local SDP offer (for connection initiator)
 
asciichat_error_t webrtc_set_remote_description (webrtc_peer_connection_t *pc, const char *sdp, const char *type)
 Set remote SDP offer/answer.
 
asciichat_error_t webrtc_add_remote_candidate (webrtc_peer_connection_t *pc, const char *candidate, const char *mid)
 Add remote ICE candidate.
 
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)
 
asciichat_error_t webrtc_datachannel_send (webrtc_data_channel_t *dc, const uint8_t *data, size_t size)
 Send data over DataChannel.
 
bool webrtc_datachannel_is_open (webrtc_data_channel_t *dc)
 Check if DataChannel is open and ready.
 
const char * webrtc_datachannel_get_label (webrtc_data_channel_t *dc)
 Get DataChannel label.
 
asciichat_error_t webrtc_datachannel_set_callbacks (webrtc_data_channel_t *dc, const webrtc_datachannel_callbacks_t *callbacks)
 Set DataChannel callbacks.
 
void webrtc_close_datachannel (webrtc_data_channel_t *dc)
 Close a DataChannel.
 
void webrtc_datachannel_destroy (webrtc_data_channel_t *dc)
 Destroy a DataChannel and free resources.
 
void webrtc_peer_connection_close (webrtc_peer_connection_t *pc)
 Close a peer connection.
 
void webrtc_peer_connection_destroy (webrtc_peer_connection_t *pc)
 Destroy a peer connection and free resources.