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

Go to the source code of this file.

Macros

#define NETWORK_PACKET_PARSING_SIZE_BUFFER_SIZE   32
#define NETWORK_PACKET_PARSING_HEX_BUFFER_SIZE   256
#define PACKET_MAX_FRAME_SIZE   (256 * 1024 * 1024)
 Maximum frame size (256MB) - prevents memory exhaustion attacks.
#define PACKET_MAX_DIMENSION   32768
 Maximum frame dimension (32768x32768) - prevents overflow.

Functions

char * packet_decode_frame_data_malloc (const char *data, size_t length, bool compressed, uint32_t original_size, uint32_t compressed_size)
 Decode frame data (malloc version for client handlers).
asciichat_error_t packet_decode_frame_data_buffer (const char *frame_data_ptr, size_t frame_data_len, bool is_compressed, void *output_buffer, size_t output_size, uint32_t original_size, uint32_t compressed_size)
 Decode frame data (fixed buffer version for server handlers).
asciichat_error_t packet_decode_frame_data_workspace (buffer_workspace_t *workspace, const void *data, size_t length, bool compressed, uint32_t original_size, uint32_t compressed_size)
asciichat_error_t packet_validate_frame_dimensions (uint32_t width, uint32_t height, size_t *out_rgb_size)
 Validate frame dimensions and calculate RGB buffer size.
asciichat_error_t packet_parse_opus_batch (const void *packet_data, size_t packet_len, const uint8_t **out_opus_data, size_t *out_opus_size, const uint16_t **out_frame_sizes, int *out_sample_rate, int *out_frame_duration, int *out_frame_count)
 Parse Opus audio batch packet header and extract frame data.

Macro Definition Documentation

◆ NETWORK_PACKET_PARSING_HEX_BUFFER_SIZE

#define NETWORK_PACKET_PARSING_HEX_BUFFER_SIZE   256

Definition at line 4 of file network/packet/parsing.c.

Referenced by packet_parse_opus_batch().

◆ NETWORK_PACKET_PARSING_SIZE_BUFFER_SIZE

#define NETWORK_PACKET_PARSING_SIZE_BUFFER_SIZE   32

Definition at line 3 of file network/packet/parsing.c.

Referenced by packet_validate_frame_dimensions().