ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
packet_parsing.c File Reference

📡 Shared packet parsing utilities implementation More...

Go to the source code of this file.

Macros

#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 *frame_data_ptr, size_t frame_data_len, bool is_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_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.
 

Detailed Description

📡 Shared packet parsing utilities implementation

Provides reusable packet parsing functions used by both server and client protocol handlers to eliminate code duplication and ensure consistency.

Author
Zachary Fogg me@zf.nosp@m.o.gg
Date
December 2025

Definition in file packet_parsing.c.