cwist
Modern C web framework with libttak runtime
Loading...
Searching...
No Matches
cwist_webrtc_ctx Struct Reference

A UDP endpoint bound to one reactor, serving many conns. More...

#include <webrtc_internal.h>

Collaboration diagram for cwist_webrtc_ctx:

Public Attributes

cwist_reactor_t * reactor
 
bool owns_reactor
 
pid_t owner_pid
 
pthread_t thread
 
bool thread_running
 
atomic_int refs
 
int udp_fd
 
uint16_t port
 
bool udp_armed
 
bool closed
 
atomic_int ice_lite_server
 
X509 * cert
 
EVP_PKEY * pkey
 
SSL_CTX * server_ssl_ctx
 
SSL_CTX * client_ssl_ctx
 
char fingerprint [128]
 
char ice_ufrag [16]
 
char ice_pwd [64]
 
char host_ip [64]
 
cwist_webrtc_message_cb msg_cb
 
void * msg_user
 
cwist_webrtc_channel_cb ch_cb
 
void * ch_user
 
cwist_webrtc_close_cb close_cb
 
void * close_user
 
cwist_webrtc_conn ** buckets
 
uint32_t nbuckets
 
uint32_t nconns
 
cwist_webrtc_conn * parked
 
cwist_webrtc_conn * dirty
 
atomic_int ready_count
 
cwist_reactor_timer_t sctp_timer
 
int sctp_assocs
 
uint64_t last_activity_ns
 
bool sctp_fast
 
uint8_t * rx_bufs
 
uint8_t * plain_buf
 
uint8_t * sctp_buf
 
uint8_t * tx_bufs
 
size_t tx_len [CWIST_WEBRTC_TX_BATCH]
 
struct sockaddr_in tx_addr [CWIST_WEBRTC_TX_BATCH]
 
uint32_t tx_n
 
uint64_t now_ns
 
cwist_reactor_post_t free_post
 
pthread_mutex_t free_mu
 
pthread_cond_t free_cv
 
bool fd_closed
 

Detailed Description

A UDP endpoint bound to one reactor, serving many conns.

Definition at line 132 of file webrtc_internal.h.

Member Data Documentation

◆ buckets

cwist_webrtc_conn** cwist_webrtc_ctx::buckets

Hash buckets (power of two).

Definition at line 163 of file webrtc_internal.h.

◆ cert

X509* cwist_webrtc_ctx::cert

Ephemeral DTLS certificate.

Definition at line 146 of file webrtc_internal.h.

◆ ch_cb

cwist_webrtc_channel_cb cwist_webrtc_ctx::ch_cb

Channel-open handler.

Definition at line 157 of file webrtc_internal.h.

Referenced by cwist_webrtc_conn_on_channel_open(), and cwist_webrtc_ctx_set_channel_handler().

◆ ch_user

void* cwist_webrtc_ctx::ch_user

Its user pointer.

Definition at line 158 of file webrtc_internal.h.

Referenced by cwist_webrtc_conn_on_channel_open(), and cwist_webrtc_ctx_set_channel_handler().

◆ client_ssl_ctx

SSL_CTX* cwist_webrtc_ctx::client_ssl_ctx

DTLS client (active) context.

Definition at line 149 of file webrtc_internal.h.

◆ close_cb

cwist_webrtc_close_cb cwist_webrtc_ctx::close_cb

Connection-closed handler.

Definition at line 159 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_set_close_handler().

◆ close_user

void* cwist_webrtc_ctx::close_user

Its user pointer.

Definition at line 160 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_set_close_handler().

◆ closed

bool cwist_webrtc_ctx::closed

Teardown ran (owner thread).

Definition at line 143 of file webrtc_internal.h.

◆ dirty

cwist_webrtc_conn* cwist_webrtc_ctx::dirty

Conns to service at the end of this round.

Definition at line 167 of file webrtc_internal.h.

◆ fd_closed

bool cwist_webrtc_ctx::fd_closed

UDP socket closed by the owner.

Definition at line 190 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_free().

◆ fingerprint

char cwist_webrtc_ctx::fingerprint[128]

SHA-256 fingerprint of cert, SDP form.

Definition at line 150 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_fingerprint(), and cwist_webrtc_handle_offer().

◆ free_cv

pthread_cond_t cwist_webrtc_ctx::free_cv

Signals fd_closed.

Definition at line 189 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_free().

◆ free_mu

pthread_mutex_t cwist_webrtc_ctx::free_mu

Guards fd_closed.

Definition at line 188 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_free().

◆ free_post

cwist_reactor_post_t cwist_webrtc_ctx::free_post

Teardown post.

Definition at line 187 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_free().

◆ host_ip

char cwist_webrtc_ctx::host_ip[64]

Best-guess local IPv4 for the SDP host candidate.

Definition at line 153 of file webrtc_internal.h.

Referenced by cwist_webrtc_handle_offer().

◆ ice_lite_server

atomic_int cwist_webrtc_ctx::ice_lite_server

An offer was answered: accept Binding requests.

Definition at line 144 of file webrtc_internal.h.

Referenced by cwist_webrtc_handle_offer().

◆ ice_pwd

char cwist_webrtc_ctx::ice_pwd[64]

Local ICE password.

Definition at line 152 of file webrtc_internal.h.

Referenced by cwist_webrtc_handle_offer().

◆ ice_ufrag

char cwist_webrtc_ctx::ice_ufrag[16]

Local ICE ufrag.

Definition at line 151 of file webrtc_internal.h.

Referenced by cwist_webrtc_handle_offer().

◆ last_activity_ns

uint64_t cwist_webrtc_ctx::last_activity_ns

Last datagram or send; picks the tick rate.

Definition at line 173 of file webrtc_internal.h.

◆ msg_cb

cwist_webrtc_message_cb cwist_webrtc_ctx::msg_cb

Message handler.

Definition at line 155 of file webrtc_internal.h.

Referenced by cwist_webrtc_conn_on_message(), and cwist_webrtc_ctx_set_message_handler().

◆ msg_user

void* cwist_webrtc_ctx::msg_user

Its user pointer.

Definition at line 156 of file webrtc_internal.h.

Referenced by cwist_webrtc_conn_on_message(), and cwist_webrtc_ctx_set_message_handler().

◆ nbuckets

uint32_t cwist_webrtc_ctx::nbuckets

Bucket count.

Definition at line 164 of file webrtc_internal.h.

◆ nconns

uint32_t cwist_webrtc_ctx::nconns

Conns in the table.

Definition at line 165 of file webrtc_internal.h.

◆ now_ns

uint64_t cwist_webrtc_ctx::now_ns

Monotonic time cached at the start of a round.

Definition at line 184 of file webrtc_internal.h.

◆ owner_pid

pid_t cwist_webrtc_ctx::owner_pid

Process that created the ctx (fork detection).

Definition at line 135 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_free(), and cwist_webrtc_handle_offer().

◆ owns_reactor

bool cwist_webrtc_ctx::owns_reactor

Created by cwist_webrtc_ctx_new(); run on our thread.

Definition at line 134 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_free().

◆ parked

cwist_webrtc_conn* cwist_webrtc_ctx::parked

Answered offers not yet nominated.

Definition at line 166 of file webrtc_internal.h.

◆ pkey

EVP_PKEY* cwist_webrtc_ctx::pkey

Its private key.

Definition at line 147 of file webrtc_internal.h.

◆ plain_buf

uint8_t* cwist_webrtc_ctx::plain_buf

Decrypted DTLS record buffer.

Definition at line 178 of file webrtc_internal.h.

◆ port

uint16_t cwist_webrtc_ctx::port

Bound UDP port.

Definition at line 141 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_port(), and cwist_webrtc_handle_offer().

◆ reactor

cwist_reactor_t* cwist_webrtc_ctx::reactor

◆ ready_count

atomic_int cwist_webrtc_ctx::ready_count

Conns with SCTP up.

Definition at line 168 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_connection_count().

◆ refs

atomic_int cwist_webrtc_ctx::refs

Reference count (user + conns + posts + armed fd slot).

Definition at line 138 of file webrtc_internal.h.

◆ rx_bufs

uint8_t* cwist_webrtc_ctx::rx_bufs

CWIST_WEBRTC_RX_BATCH datagram buffers.

Definition at line 177 of file webrtc_internal.h.

◆ sctp_assocs

int cwist_webrtc_ctx::sctp_assocs

Conns holding an SCTP socket.

Definition at line 172 of file webrtc_internal.h.

◆ sctp_buf

uint8_t* cwist_webrtc_ctx::sctp_buf

usrsctp_recvv() buffer (one full message).

Definition at line 179 of file webrtc_internal.h.

Referenced by cwist_sctp_conn_drain().

◆ sctp_fast

bool cwist_webrtc_ctx::sctp_fast

The tick is armed at the fast rate.

Definition at line 174 of file webrtc_internal.h.

◆ sctp_timer

cwist_reactor_timer_t cwist_webrtc_ctx::sctp_timer

Drives usrsctp timers while associations exist.

Definition at line 171 of file webrtc_internal.h.

◆ server_ssl_ctx

SSL_CTX* cwist_webrtc_ctx::server_ssl_ctx

DTLS server (passive) context.

Definition at line 148 of file webrtc_internal.h.

◆ thread

pthread_t cwist_webrtc_ctx::thread

Run thread when owns_reactor.

Definition at line 136 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_free(), and cwist_webrtc_ctx_new().

◆ thread_running

bool cwist_webrtc_ctx::thread_running

thread was started.

Definition at line 137 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_free(), and cwist_webrtc_ctx_new().

◆ tx_addr

struct sockaddr_in cwist_webrtc_ctx::tx_addr[CWIST_WEBRTC_TX_BATCH]

Queued destinations.

Definition at line 182 of file webrtc_internal.h.

◆ tx_bufs

uint8_t* cwist_webrtc_ctx::tx_bufs

CWIST_WEBRTC_TX_BATCH datagram buffers.

Definition at line 180 of file webrtc_internal.h.

◆ tx_len

size_t cwist_webrtc_ctx::tx_len[CWIST_WEBRTC_TX_BATCH]

Queued datagram lengths.

Definition at line 181 of file webrtc_internal.h.

◆ tx_n

uint32_t cwist_webrtc_ctx::tx_n

Datagrams queued.

Definition at line 183 of file webrtc_internal.h.

◆ udp_armed

bool cwist_webrtc_ctx::udp_armed

A read slot is pending on the reactor.

Definition at line 142 of file webrtc_internal.h.

◆ udp_fd

int cwist_webrtc_ctx::udp_fd

Non-blocking UDP socket.

Definition at line 140 of file webrtc_internal.h.

Referenced by cwist_webrtc_ctx_free(), and cwist_webrtc_ctx_new_on().


The documentation for this struct was generated from the following file: