|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
🔍 Safe string parsing utilities for integers, sizes, and protocol messages More...
Go to the source code of this file.
Functions | |
| asciichat_error_t | safe_parse_size_message (const char *message, unsigned int *width, unsigned int *height) |
| Parse SIZE message format. | |
| asciichat_error_t | safe_parse_audio_message (const char *message, unsigned int *num_samples) |
| Parse AUDIO message format. | |
| asciichat_error_t | parse_long (const char *str, long *out_value, long min_value, long max_value) |
| Parse signed long integer with range validation. | |
| asciichat_error_t | parse_ulong (const char *str, unsigned long *out_value, unsigned long min_value, unsigned long max_value) |
| Parse unsigned long integer with range validation. | |
| asciichat_error_t | parse_ulonglong (const char *str, unsigned long long *out_value, unsigned long long min_value, unsigned long long max_value) |
| Parse unsigned long long integer with range validation. | |
| asciichat_error_t | parse_port (const char *str, uint16_t *out_port) |
| Parse port number (1-65535) from string. | |
| asciichat_error_t | parse_int32 (const char *str, int32_t *out_value, int32_t min_value, int32_t max_value) |
| Parse signed 32-bit integer with range validation. | |
| asciichat_error_t | parse_uint32 (const char *str, uint32_t *out_value, uint32_t min_value, uint32_t max_value) |
| Parse unsigned 32-bit integer with range validation. | |
🔍 Safe string parsing utilities for integers, sizes, and protocol messages
Definition in file parsing.c.
| asciichat_error_t parse_int32 | ( | const char * | str, |
| int32_t * | out_value, | ||
| int32_t | min_value, | ||
| int32_t | max_value | ||
| ) |
Parse signed 32-bit integer with range validation.
| str | String to parse (must be null-terminated) |
| out_value | Output: parsed integer value |
| min_value | Minimum allowed value (inclusive) |
| max_value | Maximum allowed value (inclusive) |
Definition at line 240 of file parsing.c.
References ASCIICHAT_OK, ERROR_INVALID_PARAM, parse_long(), and SET_ERRNO.
Referenced by strtoint_safe().
| asciichat_error_t parse_long | ( | const char * | str, |
| long * | out_value, | ||
| long | min_value, | ||
| long | max_value | ||
| ) |
Parse signed long integer with range validation.
| str | String to parse (must be null-terminated) |
| out_value | Output: parsed integer value |
| min_value | Minimum allowed value (inclusive) |
| max_value | Maximum allowed value (inclusive) |
Safe wrapper for strtol() with overflow detection and range validation.
Definition at line 96 of file parsing.c.
References ASCIICHAT_OK, ERANGE, errno, ERROR_INVALID_PARAM, and SET_ERRNO.
Referenced by parse_int32().
| asciichat_error_t parse_port | ( | const char * | str, |
| uint16_t * | out_port | ||
| ) |
Parse port number (1-65535) from string.
| str | String to parse (must be null-terminated) |
| out_port | Output: parsed port number |
Convenience function for parsing TCP/UDP port numbers.
Definition at line 221 of file parsing.c.
References ASCIICHAT_OK, ERROR_INVALID_PARAM, parse_ulong(), and SET_ERRNO.
Referenced by main(), parse_address_with_optional_port(), parse_ip_with_port(), validate_opt_port(), and validate_port_opt().
| asciichat_error_t parse_uint32 | ( | const char * | str, |
| uint32_t * | out_value, | ||
| uint32_t | min_value, | ||
| uint32_t | max_value | ||
| ) |
Parse unsigned 32-bit integer with range validation.
| str | String to parse (must be null-terminated) |
| out_value | Output: parsed integer value |
| min_value | Minimum allowed value (inclusive) |
| max_value | Maximum allowed value (inclusive) |
Definition at line 259 of file parsing.c.
References ASCIICHAT_OK, ERROR_INVALID_PARAM, parse_ulong(), and SET_ERRNO.
| asciichat_error_t parse_ulong | ( | const char * | str, |
| unsigned long * | out_value, | ||
| unsigned long | min_value, | ||
| unsigned long | max_value | ||
| ) |
Parse unsigned long integer with range validation.
| str | String to parse (must be null-terminated) |
| out_value | Output: parsed integer value |
| min_value | Minimum allowed value (inclusive) |
| max_value | Maximum allowed value (inclusive) |
Definition at line 137 of file parsing.c.
References ASCIICHAT_OK, ERANGE, errno, ERROR_INVALID_PARAM, and SET_ERRNO.
Referenced by main(), parse_port(), and parse_uint32().
| asciichat_error_t parse_ulonglong | ( | const char * | str, |
| unsigned long long * | out_value, | ||
| unsigned long long | min_value, | ||
| unsigned long long | max_value | ||
| ) |
Parse unsigned long long integer with range validation.
| str | String to parse (must be null-terminated) |
| out_value | Output: parsed integer value |
| min_value | Minimum allowed value (inclusive) |
| max_value | Maximum allowed value (inclusive) |
Definition at line 179 of file parsing.c.
References ASCIICHAT_OK, ERANGE, errno, ERROR_INVALID_PARAM, and SET_ERRNO.