|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
ACIP protocol packet handlers (transport-agnostic) More...
Go to the source code of this file.
Data Structures | |
| struct | acip_client_callbacks_t |
| Client-side packet handler callbacks. More... | |
| struct | acip_server_callbacks_t |
| Server-side packet handler callbacks. More... | |
Functions | |
| asciichat_error_t | acip_handle_client_packet (acip_transport_t *transport, packet_type_t type, const void *payload, size_t payload_len, const acip_client_callbacks_t *callbacks) |
| Handle incoming packet on client side. | |
| asciichat_error_t | acip_handle_server_packet (acip_transport_t *transport, packet_type_t type, const void *payload, size_t payload_len, void *client_ctx, const acip_server_callbacks_t *callbacks) |
| Handle incoming packet on server side. | |
ACIP protocol packet handlers (transport-agnostic)
Provides handler functions for all ACIP packet types (1-199). Handlers are transport-agnostic - they work with any acip_transport_t.
Handlers use callback pattern to decouple protocol logic from application logic. Applications register callbacks for events they care about.
Example usage:
Definition in file handlers.h.
| asciichat_error_t acip_handle_client_packet | ( | acip_transport_t * | transport, |
| packet_type_t | type, | ||
| const void * | payload, | ||
| size_t | payload_len, | ||
| const acip_client_callbacks_t * | callbacks | ||
| ) |
Handle incoming packet on client side.
Dispatches packet to appropriate callback based on type. Transport-agnostic - works with TCP, WebSocket, etc.
| transport | Transport instance |
| type | Packet type |
| payload | Packet payload |
| payload_len | Payload length |
| callbacks | Application callbacks |
Definition at line 119 of file handlers.c.
References ASCIICHAT_OK, ERROR_INVALID_PARAM, log_warn, and SET_ERRNO.
Referenced by acip_client_receive_and_dispatch().
| asciichat_error_t acip_handle_server_packet | ( | acip_transport_t * | transport, |
| packet_type_t | type, | ||
| const void * | payload, | ||
| size_t | payload_len, | ||
| void * | client_ctx, | ||
| const acip_server_callbacks_t * | callbacks | ||
| ) |
Handle incoming packet on server side.
Dispatches packet to appropriate callback based on type. Transport-agnostic - works with TCP, WebSocket, etc.
| transport | Transport instance |
| type | Packet type |
| payload | Packet payload |
| payload_len | Payload length |
| client_ctx | Per-client context (e.g., client_info_t*) |
| callbacks | Application callbacks |
Definition at line 534 of file handlers.c.
References ASCIICHAT_OK, ERROR_INVALID_PARAM, log_warn, and SET_ERRNO.
Referenced by acip_server_receive_and_dispatch().