ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
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,
14 void *context);
15 void (*on_audio_packet)(size_t length, void *context);
16 void *context;
17 bool terminal_output; // Drop valid obsolete geometry during terminal/settings resize transitions.
18 buffer_workspace_t *frame_workspace; // Optional; receive worker owns it through callback completion.
22
50
53/* Dispatch borrows its payload from the shared connection executor. */
55 size_t length);
56
57/* Physical capability advertisement for the initial join. */
58void session_protocol_build_capabilities(unsigned short width, unsigned short height,
61 void *context);
62/* Call on the connection owner thread. UI publishes automatic dimensions through options.
63 * Each connection retains its own last successfully advertised size; failed sends are retried. */
64asciichat_error_t session_protocol_update_settings(terminal_size_t *advertised, uint64_t *advertised_revision,
65 session_protocol_send_settings_fn send, void *context);
unsigned int height
Definition fft.c:23
unsigned int width
Definition fft.c:23
unsigned int uint32_t
Definition common.h:62
unsigned long long uint64_t
Definition common.h:63
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:44
packet_type_t
Network protocol packet type enumeration.
Definition packet.h:301
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:506
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:51
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:902
Owns the temporary storage used by buffer workspace. The data pointers and size or cursor fields desc...
Definition buffer.h:102
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_callbacks_t control
Terminal capabilities packet structure (Packet Type 5).
Definition packet.h:1074