ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
src/common/session/protocol.h
Go to the documentation of this file.
1#pragma once
2
5#include <libplatform/terminal.h>
6#include <ascii-chat/buffer.h>
7
8/* Callbacks borrow decoded buffers for the duration of the call. Device and UI
9 * ownership remain with the mode; one receive worker owns this protocol state. */
10typedef struct {
11 asciichat_error_t (*on_frame)(const ascii_frame_packet_t *header, const char *text, void *context);
12 asciichat_error_t (*on_samples)(const float *samples, size_t count, void *context);
13 asciichat_error_t (*decode_opus)(const void *data, size_t length, float *samples, size_t capacity, size_t *decoded, void *context);
14 void (*on_audio_packet)(size_t length, void *context);
15 void *context;
16 bool terminal_output; // Drop valid obsolete geometry during terminal/settings resize transitions.
17 buffer_workspace_t *frame_workspace; // Optional; receive worker owns it through callback completion.
21
50
52/* Dispatch borrows its payload from the shared connection executor. */
53asciichat_error_t session_protocol_dispatch(session_protocol_t *protocol, packet_type_t type, const void *payload, size_t length);
54
55/* Physical capability advertisement for the initial join. */
56void session_protocol_build_capabilities(unsigned short width, unsigned short height, terminal_capabilities_packet_t *packet);
57typedef asciichat_error_t (*session_protocol_send_settings_fn)(const options_t *values, uint32_t request, void *context);
58/* Call on the connection owner thread. UI publishes automatic dimensions through options.
59 * Each connection retains its own last successfully advertised size; failed sends are retried. */
60asciichat_error_t session_protocol_update_settings(terminal_size_t *advertised, uint64_t *advertised_revision, session_protocol_send_settings_fn send, void *context);
unsigned int height
Definition fft.c:24
unsigned int width
Definition fft.c:24
unsigned int uint32_t
unsigned long long uint64_t
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
packet_type_t
Network protocol packet type enumeration.
Definition packet.h:315
struct options_state options_t
Immutable, RCU-published snapshot of the application's runtime configuration.
struct acip_transport acip_transport_t
Forward declaration of ACIP transport.
Definition host.h:508
ACIP client-side protocol API.
asciichat_error_t session_protocol_update_settings(terminal_size_t *advertised, uint64_t *advertised_revision, session_protocol_send_settings_fn send, void *context)
asciichat_error_t(* session_protocol_send_settings_fn)(const options_t *values, uint32_t request, void *context)
asciichat_error_t session_protocol_dispatch(session_protocol_t *protocol, packet_type_t type, const void *payload, size_t length)
void session_protocol_init(session_protocol_t *protocol, acip_transport_t *transport, session_protocol_media_t media, acip_client_callbacks_t control)
void session_protocol_build_capabilities(unsigned short width, unsigned short height, terminal_capabilities_packet_t *packet)
Client-side packet handler callbacks.
Definition handlers.h:55
acip render settings keeps the values that move through the subsystem: caps, width,...
The wire metadata for one rendered ASCII frame. width and height describe the terminal grid,...
Definition packet.h:920
Owns the temporary storage used by buffer workspace. The data pointers and size or cursor fields desc...
Definition buffer.h:122
asciichat_error_t(* on_samples)(const float *samples, size_t count, void *context)
asciichat_error_t(* decode_opus)(const void *data, size_t length, float *samples, size_t capacity, size_t *decoded, void *context)
asciichat_error_t(* on_frame)(const ascii_frame_packet_t *header, const char *text, void *context)
void(* on_audio_packet)(size_t length, void *context)
session protocol media keeps the values that move through the subsystem: context, terminal_output,...
acip_render_settings_t effective_render_settings
session_protocol_media_t media
acip_client_session_t client_session
acip_client_callbacks_t control
Terminal capabilities packet structure (Packet Type 5).
Definition packet.h:1097