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

Transport method table (virtual function table). More...

#include <include/ascii-chat/network/acip/transport.h>

Data Fields

asciichat_error_t(* send )(acip_transport_t *transport, const void *data, size_t len)
 Send data through this transport.
asciichat_error_t(* recv )(acip_transport_t *transport, void **buffer, size_t *out_len, void **out_allocated_buffer)
 Receive data from this transport.
asciichat_error_t(* close )(acip_transport_t *transport)
 Close this transport.
void(* interrupt )(acip_transport_t *transport)
acip_transport_type_t(* get_type )(acip_transport_t *transport)
 Get transport type.
socket_t(* get_socket )(acip_transport_t *transport)
 Get underlying socket (if applicable).
bool(* is_connected )(acip_transport_t *transport)
 Check if transport is connected.
bool(* has_pending_data )(acip_transport_t *transport)
 Check whether the transport has pending readable data.
asciichat_error_t(* sendv )(acip_transport_t *transport, const socket_buffer_t *buffers, size_t count)
 Custom destroy implementation (optional).
size_t(* queued_bytes )(acip_transport_t *transport)
asciichat_error_t(* wait_writable )(acip_transport_t *transport, uint64_t timeout_ns)
size_t reserved_bytes
 Bound for backend-owned pending data not exposed by queued_bytes.
void(* destroy_impl )(acip_transport_t *transport)
asciichat_error_t(* sendv_ex )(acip_transport_t *transport, const socket_buffer_t *buffers, size_t count, const acip_send_options_t *options)
asciichat_error_t(* get_capabilities )(acip_transport_t *transport, acip_transport_capabilities_t *out)
asciichat_error_t(* validate_send_options )(acip_transport_t *transport, const acip_send_options_t *options)
bool(* consume_keyframe_request )(acip_transport_t *transport, uint16_t type, uint32_t stream_id)

Detailed Description

Transport method table (virtual function table).

Each transport implementation provides these methods. ACIP protocol code calls these instead of socket functions.

Definition at line 136 of file include/ascii-chat/network/acip/transport.h.

Field Documentation

◆ close

asciichat_error_t(* acip_transport_methods_t::close) (acip_transport_t *transport)

Close this transport.

Parameters
transportTransport instance
Returns
ASCIICHAT_OK on success, error code on failure
Note
Should be idempotent (safe to call multiple times)
Does NOT free the transport structure itself

Definition at line 177 of file include/ascii-chat/network/acip/transport.h.

Referenced by acip_outbound_destroy(), and acip_transport_destroy().

◆ consume_keyframe_request

bool(* acip_transport_methods_t::consume_keyframe_request) (acip_transport_t *transport, uint16_t type, uint32_t stream_id)

Consume a peer request to restart an encoded stream with a keyframe.

Definition at line 249 of file include/ascii-chat/network/acip/transport.h.

Referenced by acip_outbound_needs_keyframe().

◆ destroy_impl

void(* acip_transport_methods_t::destroy_impl) (acip_transport_t *transport)

Definition at line 241 of file include/ascii-chat/network/acip/transport.h.

Referenced by acip_transport_destroy().

◆ get_capabilities

asciichat_error_t(* acip_transport_methods_t::get_capabilities) (acip_transport_t *transport, acip_transport_capabilities_t *out)

◆ get_socket

socket_t(* acip_transport_methods_t::get_socket) (acip_transport_t *transport)

Get underlying socket (if applicable).

Parameters
transportTransport instance
Returns
Socket descriptor or INVALID_SOCKET_VALUE
Note
Returns INVALID_SOCKET_VALUE for transports without sockets
Useful for select()/poll() integration

Definition at line 201 of file include/ascii-chat/network/acip/transport.h.

◆ get_type

acip_transport_type_t(* acip_transport_methods_t::get_type) (acip_transport_t *transport)

Get transport type.

Parameters
transportTransport instance
Returns
Transport type enum value

Definition at line 190 of file include/ascii-chat/network/acip/transport.h.

Referenced by acip_transport_destroy().

◆ has_pending_data

bool(* acip_transport_methods_t::has_pending_data) (acip_transport_t *transport)

Check whether the transport has pending readable data.

Parameters
transportTransport instance
Returns
true if data is ready to read, false otherwise
Note
This is a lightweight readiness hint, not a guarantee that recv() will succeed.

Definition at line 220 of file include/ascii-chat/network/acip/transport.h.

◆ interrupt

void(* acip_transport_methods_t::interrupt) (acip_transport_t *transport)

Interrupt pending I/O from normal thread context without freeing the transport, joining workers, or taking a mutex held by a blocked sender. The owner retains the transport until all users have stopped.

Definition at line 182 of file include/ascii-chat/network/acip/transport.h.

Referenced by acip_outbound_destroy().

◆ is_connected

bool(* acip_transport_methods_t::is_connected) (acip_transport_t *transport)

Check if transport is connected.

Parameters
transportTransport instance
Returns
true if connected, false otherwise

Definition at line 209 of file include/ascii-chat/network/acip/transport.h.

Referenced by acip_server_receive_and_dispatch(), and acip_transport_destroy().

◆ queued_bytes

size_t(* acip_transport_methods_t::queued_bytes) (acip_transport_t *transport)

Bytes retained by this backend, including an in-progress packet.

Definition at line 237 of file include/ascii-chat/network/acip/transport.h.

◆ recv

asciichat_error_t(* acip_transport_methods_t::recv) (acip_transport_t *transport, void **buffer, size_t *out_len, void **out_allocated_buffer)

Receive data from this transport.

Parameters
transportTransport instance
bufferOutput buffer (allocated by transport)
out_lenReceived data length
out_allocated_bufferBuffer to free (may differ from buffer)
Returns
ASCIICHAT_OK on success, error code on failure
Note
Allocates buffer, caller must free via out_allocated_buffer
May block until data arrives
For TCP: calls socket_recv_all()
For WebSocket: unwraps WebSocket frame

Definition at line 166 of file include/ascii-chat/network/acip/transport.h.

◆ reserved_bytes

size_t acip_transport_methods_t::reserved_bytes

Bound for backend-owned pending data not exposed by queued_bytes.

Definition at line 240 of file include/ascii-chat/network/acip/transport.h.

Referenced by acip_outbound_snapshot().

◆ send

asciichat_error_t(* acip_transport_methods_t::send) (acip_transport_t *transport, const void *data, size_t len)

Send data through this transport.

Parameters
transportTransport instance
dataData to send (NOT owned by transport)
lenData length in bytes
Returns
ASCIICHAT_OK on success, error code on failure
Note
Does NOT take ownership of data buffer
May block until send completes
For TCP: calls socket_send_all()
For WebSocket: wraps in WebSocket frame

Definition at line 150 of file include/ascii-chat/network/acip/transport.h.

Referenced by acip_outbound_create(), and acip_security_flush().

◆ sendv

asciichat_error_t(* acip_transport_methods_t::sendv) (acip_transport_t *transport, const socket_buffer_t *buffers, size_t count)

Custom destroy implementation (optional).

Parameters
transportTransport instance
Note
Called by acip_transport_destroy() before freeing impl_data
Should free transport-specific resources (peer connections, etc.)
May be NULL if no custom cleanup needed Borrow slices until return. Queued transports must copy into owned storage. NULL selects the contiguous fallback, preserving WebSocket/WebRTC messages.

Definition at line 234 of file include/ascii-chat/network/acip/transport.h.

Referenced by acip_security_flush().

◆ sendv_ex

asciichat_error_t(* acip_transport_methods_t::sendv_ex) (acip_transport_t *transport, const socket_buffer_t *buffers, size_t count, const acip_send_options_t *options)

Receives plaintext packet metadata alongside borrowed packet slices.

Definition at line 243 of file include/ascii-chat/network/acip/transport.h.

Referenced by acip_outbound_create(), acip_security_flush(), and acip_transport_sendv_ex().

◆ validate_send_options

asciichat_error_t(* acip_transport_methods_t::validate_send_options) (acip_transport_t *transport, const acip_send_options_t *options)

Validate optional delivery semantics without enqueuing data.

Definition at line 247 of file include/ascii-chat/network/acip/transport.h.

Referenced by acip_transport_sendv_ex().

◆ wait_writable

asciichat_error_t(* acip_transport_methods_t::wait_writable) (acip_transport_t *transport, uint64_t timeout_ns)

Wait until backend-owned output becomes writable or timeout expires.

Definition at line 239 of file include/ascii-chat/network/acip/transport.h.


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