|
ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
|
📡 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) |
| 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) |
| asciichat_error_t | packet_validate_frame_dimensions (uint32_t width, uint32_t height, size_t *out_rgb_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) |
📡 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.
Definition in file packet_parsing.c.
| #define PACKET_MAX_DIMENSION 32768 |
Maximum frame dimension (32768x32768) - prevents overflow.
Definition at line 31 of file packet_parsing.c.
| #define PACKET_MAX_FRAME_SIZE (256 * 1024 * 1024) |
Maximum frame size (256MB) - prevents memory exhaustion attacks.
Definition at line 25 of file packet_parsing.c.
| 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 | ||
| ) |
Definition at line 89 of file packet_parsing.c.
References decompress_data().
| 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 | ||
| ) |
Definition at line 33 of file packet_parsing.c.
References decompress_data(), format_bytes_pretty(), and PACKET_MAX_FRAME_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 | ||
| ) |
Definition at line 173 of file packet_parsing.c.
Referenced by handle_audio_opus_batch_packet().
| asciichat_error_t packet_validate_frame_dimensions | ( | uint32_t | width, |
| uint32_t | height, | ||
| size_t * | out_rgb_size | ||
| ) |
Definition at line 130 of file packet_parsing.c.
References format_bytes_pretty(), PACKET_MAX_DIMENSION, and PACKET_MAX_FRAME_SIZE.