|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
ACIP server-side protocol implementation. More...
Go to the source code of this file.
Functions | |
| asciichat_error_t | acip_server_receive_and_dispatch (acip_transport_t *transport, void *client_ctx, const acip_server_callbacks_t *callbacks) |
| Receive packet from client and dispatch to callbacks. | |
| asciichat_error_t | acip_send_ascii_frame (acip_transport_t *transport, const char *frame_data, uint32_t width, uint32_t height) |
| Send ASCII frame to client (server → client) | |
| asciichat_error_t | acip_send_clear_console (acip_transport_t *transport) |
| Send clear console command to client (server → client) | |
| asciichat_error_t | acip_send_server_state (acip_transport_t *transport, const server_state_packet_t *state) |
| Send server state update to client (server → client) | |
ACIP server-side protocol implementation.
Provides server-side ACIP protocol utilities for:
ACIP (ASCII-Chat IP Protocol) is the wire protocol for session discovery and WebRTC signaling. This module provides reusable server-side utilities for any ACIP server implementation.
Server-side packet sending and receiving for ascii-chat protocol. Handles server→client communication (ASCII frames, state updates, console control).
Definition in file lib/network/acip/server.c.
| asciichat_error_t acip_send_ascii_frame | ( | acip_transport_t * | transport, |
| const char * | frame_data, | ||
| uint32_t | width, | ||
| uint32_t | height | ||
| ) |
Send ASCII frame to client (server → client)
Sends rendered ASCII art frame to client for display.
| transport | Transport instance |
| frame_data | ASCII frame data (null-terminated string) |
| width | Frame width in characters |
| height | Frame height in characters |
Definition at line 79 of file lib/network/acip/server.c.
References asciichat_crc32, ASCIICHAT_OK, buffer_pool_alloc(), buffer_pool_free(), ascii_frame_packet_t::checksum, ascii_frame_packet_t::compressed_size, ERROR_INVALID_PARAM, ERROR_MEMORY, ascii_frame_packet_t::flags, ascii_frame_packet_t::height, HOST_TO_NET_U32, ascii_frame_packet_t::original_size, packet_send_via_transport(), PACKET_TYPE_ASCII_FRAME, SET_ERRNO, and ascii_frame_packet_t::width.
Referenced by client_send_thread_func().
| asciichat_error_t acip_send_clear_console | ( | acip_transport_t * | transport | ) |
Send clear console command to client (server → client)
Instructs client to clear the terminal/console.
| transport | Transport instance |
Definition at line 125 of file lib/network/acip/server.c.
References ERROR_INVALID_PARAM, packet_send_via_transport(), PACKET_TYPE_CLEAR_CONSOLE, and SET_ERRNO.
Referenced by client_send_thread_func().
| asciichat_error_t acip_send_server_state | ( | acip_transport_t * | transport, |
| const server_state_packet_t * | state | ||
| ) |
Send server state update to client (server → client)
Notifies client of server state changes (client count, grid layout, etc.)
| transport | Transport instance |
| state | Server state structure |
Definition at line 133 of file lib/network/acip/server.c.
References ERROR_INVALID_PARAM, packet_send_via_transport(), PACKET_TYPE_SERVER_STATE, and SET_ERRNO.
Referenced by broadcast_server_state_to_all_clients(), and send_server_state_to_client().
| asciichat_error_t acip_server_receive_and_dispatch | ( | acip_transport_t * | transport, |
| void * | client_ctx, | ||
| const acip_server_callbacks_t * | callbacks | ||
| ) |
Receive packet from client and dispatch to callbacks.
High-level receive function for server side. Receives a single packet from the transport, handles decryption, and dispatches to appropriate callback handler.
| transport | Transport instance |
| client_ctx | Client context pointer (passed to callbacks) |
| callbacks | Callback structure for handling received packets |
Definition at line 29 of file lib/network/acip/server.c.
References acip_handle_server_packet(), packet_envelope_t::allocated_buffer, packet_envelope_t::allocated_size, buffer_pool_free(), acip_transport::crypto_ctx, packet_envelope_t::data, ERROR_CRYPTO, ERROR_INVALID_PARAM, ERROR_NETWORK, acip_transport_methods_t::get_socket, INVALID_SOCKET_VALUE, acip_transport_methods_t::is_connected, packet_envelope_t::len, acip_transport::methods, PACKET_RECV_EOF, PACKET_RECV_SECURITY_VIOLATION, PACKET_RECV_SUCCESS, receive_packet_secure(), SET_ERRNO, and packet_envelope_t::type.
Referenced by client_receive_thread().