ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
websocket_transport_data_t Struct Reference

Private state for one libwebsockets-backed ACIP transport. More...

#include <include/ascii-chat/network/websocket/internal.h>

Data Fields

struct lws * wsi
 libwebsockets instance (owned)
struct lws_context * context
 libwebsockets context (may be owned or borrowed)
bool owns_context
 True if transport owns context (client), false if borrowed (server).
ringbuffer_t * recv_queue
 Receive message queue.
ringbuffer_t * send_queue
 Send message queue (for server-side transports).
mutex_t recv_mutex
 Protect recv_queue operations only.
cond_t recv_cond
 Signal when recv_queue messages arrive.
mutex_t send_mutex
 Protect send_queue operations only.
bool is_connected
 Connection state.
bool connection_failed
 Connection attempt failed (for client-side detection).
mutex_t state_mutex
 Protect state changes.
cond_t state_cond
 Signal when is_connected changes (for connection wait).
platform_thread_t service_thread
 Thread that services libwebsockets context.
bool service_running
 Owner must join the service thread before freeing storage.
uint8_t * partial_buffer
 Partial message buffer being assembled.
size_t partial_size
 Current size of partial buffer.
size_t partial_capacity
 Capacity of partial buffer.
uint64_t reassembly_start_ns
 Start time of current reassembly (for timeout detection).
int fragment_count
 Fragment count for current reassembly.
bool reassembling
 True if currently assembling a message.
size_t pending_send_bytes
 Includes the inflight owner until writable completion.
size_t inflight_bytes
uint8_t * inflight_buffer
 Owned until the next writable callback or teardown.
atomic_t server_handler_owned
atomic_t server_detached
atomic_t is_destroying
 True when destruction has started.

Detailed Description

Private state for one libwebsockets-backed ACIP transport.

It owns or borrows the libwebsockets handles according to owns_context, holds synchronized send/receive queues, tracks connection and service-thread state, and retains partial-fragment and in-flight-send buffers until their completion callbacks release them.

Definition at line 47 of file network/websocket/internal.h.

Field Documentation

◆ connection_failed

bool websocket_transport_data_t::connection_failed

Connection attempt failed (for client-side detection).

Definition at line 57 of file network/websocket/internal.h.

Referenced by acip_websocket_client_transport_create(), websocket_transport_send(), and websocket_transport_write_pending().

◆ context

struct lws_context* websocket_transport_data_t::context

libwebsockets context (may be owned or borrowed)

Definition at line 49 of file network/websocket/internal.h.

Referenced by acip_websocket_client_transport_create(), and acip_websocket_server_transport_create().

◆ fragment_count

int websocket_transport_data_t::fragment_count

Fragment count for current reassembly.

Definition at line 72 of file network/websocket/internal.h.

◆ inflight_buffer

uint8_t* websocket_transport_data_t::inflight_buffer

Owned until the next writable callback or teardown.

Definition at line 77 of file network/websocket/internal.h.

Referenced by acip_websocket_transport_flush(), and websocket_transport_write_pending().

◆ inflight_bytes

size_t websocket_transport_data_t::inflight_bytes

Definition at line 76 of file network/websocket/internal.h.

Referenced by websocket_transport_write_pending().

◆ is_connected

bool websocket_transport_data_t::is_connected

◆ is_destroying

atomic_t websocket_transport_data_t::is_destroying

True when destruction has started.

Definition at line 84 of file network/websocket/internal.h.

Referenced by websocket_transport_write_pending().

◆ owns_context

bool websocket_transport_data_t::owns_context

True if transport owns context (client), false if borrowed (server).

Definition at line 50 of file network/websocket/internal.h.

Referenced by acip_websocket_client_transport_create(), acip_websocket_server_transport_create(), and websocket_transport_send().

◆ partial_buffer

uint8_t* websocket_transport_data_t::partial_buffer

Partial message buffer being assembled.

Definition at line 68 of file network/websocket/internal.h.

◆ partial_capacity

size_t websocket_transport_data_t::partial_capacity

Capacity of partial buffer.

Definition at line 70 of file network/websocket/internal.h.

◆ partial_size

size_t websocket_transport_data_t::partial_size

Current size of partial buffer.

Definition at line 69 of file network/websocket/internal.h.

◆ pending_send_bytes

size_t websocket_transport_data_t::pending_send_bytes

Includes the inflight owner until writable completion.

Definition at line 75 of file network/websocket/internal.h.

Referenced by websocket_transport_write_pending().

◆ reassembling

bool websocket_transport_data_t::reassembling

True if currently assembling a message.

Definition at line 73 of file network/websocket/internal.h.

◆ reassembly_start_ns

uint64_t websocket_transport_data_t::reassembly_start_ns

Start time of current reassembly (for timeout detection).

Definition at line 71 of file network/websocket/internal.h.

◆ recv_cond

cond_t websocket_transport_data_t::recv_cond

Signal when recv_queue messages arrive.

Definition at line 54 of file network/websocket/internal.h.

Referenced by acip_websocket_client_transport_create().

◆ recv_mutex

mutex_t websocket_transport_data_t::recv_mutex

Protect recv_queue operations only.

Definition at line 53 of file network/websocket/internal.h.

Referenced by acip_websocket_client_transport_create().

◆ recv_queue

ringbuffer_t* websocket_transport_data_t::recv_queue

Receive message queue.

Definition at line 51 of file network/websocket/internal.h.

Referenced by acip_websocket_client_transport_create().

◆ send_mutex

mutex_t websocket_transport_data_t::send_mutex

Protect send_queue operations only.

Definition at line 55 of file network/websocket/internal.h.

Referenced by acip_websocket_transport_flush(), and websocket_transport_write_pending().

◆ send_queue

ringbuffer_t* websocket_transport_data_t::send_queue

Send message queue (for server-side transports).

Definition at line 52 of file network/websocket/internal.h.

Referenced by acip_websocket_client_transport_create(), acip_websocket_transport_flush(), and websocket_transport_write_pending().

◆ server_detached

atomic_t websocket_transport_data_t::server_detached

Definition at line 83 of file network/websocket/internal.h.

◆ server_handler_owned

atomic_t websocket_transport_data_t::server_handler_owned

Definition at line 82 of file network/websocket/internal.h.

◆ service_running

bool websocket_transport_data_t::service_running

Owner must join the service thread before freeing storage.

Definition at line 63 of file network/websocket/internal.h.

Referenced by acip_websocket_client_transport_create().

◆ service_thread

platform_thread_t websocket_transport_data_t::service_thread

Thread that services libwebsockets context.

Definition at line 62 of file network/websocket/internal.h.

Referenced by acip_websocket_client_transport_create().

◆ state_cond

cond_t websocket_transport_data_t::state_cond

Signal when is_connected changes (for connection wait).

Definition at line 59 of file network/websocket/internal.h.

Referenced by acip_websocket_client_transport_create(), and websocket_transport_write_pending().

◆ state_mutex

mutex_t websocket_transport_data_t::state_mutex

◆ wsi

struct lws* websocket_transport_data_t::wsi

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