ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
transport.c File Reference

Go to the source code of this file.

Data Structures

struct  webrtc_recv_msg_t
 Receive queue element (variable-length message). More...
struct  webrtc_transport_data_t
 WebRTC transport implementation data. More...

Macros

#define WEBRTC_RECV_QUEUE_SIZE   512
 Receive queue element (variable-length message).
#define WEBRTC_RECV_QUEUE_HIGH_WATER   12
#define WEBRTC_SEND_VIDEO_HIGH_WATER   (256 * 1024)
#define WEBRTC_DISCONNECTED_GRACE_NS   (30 * NS_PER_SEC_INT)

Functions

acip_security_t * acip_webrtc_transport_security (acip_transport_t *transport)
acip_transport_t * acip_webrtc_transport_create (webrtc_peer_connection_t *peer_conn, webrtc_data_channel_t *data_channel, crypto_context_t *crypto_ctx)
acip_transport_t * acip_webrtc_transport_create_secure (webrtc_peer_connection_t *peer_conn, webrtc_data_channel_t *data_channel, acip_security_t *security, void(*on_ready)(acip_transport_t *, void *), void *user_data)

Macro Definition Documentation

◆ WEBRTC_DISCONNECTED_GRACE_NS

#define WEBRTC_DISCONNECTED_GRACE_NS   (30 * NS_PER_SEC_INT)

Definition at line 67 of file webrtc/transport.c.

◆ WEBRTC_RECV_QUEUE_HIGH_WATER

#define WEBRTC_RECV_QUEUE_HIGH_WATER   12

Definition at line 58 of file webrtc/transport.c.

◆ WEBRTC_RECV_QUEUE_SIZE

#define WEBRTC_RECV_QUEUE_SIZE   512

Receive queue element (variable-length message).

Maximum receive queue size (messages buffered before recv())

Power of 2 for ringbuffer optimization. Completed ACIP packets are queued here. On overflow, retain control packets and recent media so the connection can recover.

Definition at line 55 of file webrtc/transport.c.

◆ WEBRTC_SEND_VIDEO_HIGH_WATER

#define WEBRTC_SEND_VIDEO_HIGH_WATER   (256 * 1024)

Definition at line 63 of file webrtc/transport.c.

Function Documentation

◆ acip_webrtc_transport_create()

acip_transport_t * acip_webrtc_transport_create ( webrtc_peer_connection_t * peer_conn,
webrtc_data_channel_t * data_channel,
crypto_context_t * crypto_ctx )

Definition at line 896 of file webrtc/transport.c.

896 {
897 return webrtc_transport_create(peer_conn, data_channel, crypto_ctx, NULL, NULL, NULL);
898}

◆ acip_webrtc_transport_create_secure()

acip_transport_t * acip_webrtc_transport_create_secure ( struct webrtc_peer_connection * peer,
struct webrtc_data_channel * channel,
acip_security_t * security,
void(* on_ready )(acip_transport_t *, void *),
void * user_data )

Transfer security ownership on success. Ready fires only after negotiation.

Definition at line 900 of file webrtc/transport.c.

901 {
902 if (!security) {
903 SET_ERRNO(ERROR_INVALID_PARAM, "Missing WebRTC security state");
904 return NULL;
905 }
906 return webrtc_transport_create(peer_conn, data_channel, &security->handshake.crypto_ctx, security, on_ready, user_data);
907}
#define SET_ERRNO(code,...)
@ ERROR_INVALID_PARAM
crypto_handshake_context_t handshake
Definition security.h:19

References crypto_handshake_context_t::crypto_ctx, ERROR_INVALID_PARAM, acip_security::handshake, and SET_ERRNO.

◆ acip_webrtc_transport_security()

acip_security_t * acip_webrtc_transport_security ( acip_transport_t * transport)

Borrow security already owned by an authenticated peer transport.

Definition at line 759 of file webrtc/transport.c.

759 {
760 if (!transport || transport->methods != &webrtc_methods || !transport->impl_data)
761 return NULL;
762 return ((webrtc_transport_data_t *)transport->impl_data)->security;
763}
void * impl_data
Transport-specific state.
const acip_transport_methods_t * methods
Method table (virtual functions).
WebRTC transport implementation data.

References acip_transport::impl_data, and acip_transport::methods.