#include "mhd_str.h"
#include "mhd_limits.h"
Go to the source code of this file.
|
int | MHD_str_equal_caseless_ (const char *str1, const char *str2) |
|
int | MHD_str_equal_caseless_n_ (const char *const str1, const char *const str2, size_t maxlen) |
|
bool | MHD_str_has_token_caseless_ (const char *str, const char *const token, size_t token_len) |
|
size_t | MHD_str_to_uint64_ (const char *str, uint64_t *out_val) |
|
size_t | MHD_str_to_uint64_n_ (const char *str, size_t maxlen, uint64_t *out_val) |
|
size_t | MHD_strx_to_uint32_ (const char *str, uint32_t *out_val) |
|
size_t | MHD_strx_to_uint32_n_ (const char *str, size_t maxlen, uint32_t *out_val) |
|
size_t | MHD_strx_to_uint64_ (const char *str, uint64_t *out_val) |
|
size_t | MHD_strx_to_uint64_n_ (const char *str, size_t maxlen, uint64_t *out_val) |
|
◆ isasciialnum
Check whether character is decimal digit or letter in US-ASCII
- Parameters
-
- Returns
- boolean true if character is decimal digit or letter, boolean false otherwise
Definition at line 271 of file mhd_str.c.
◆ isasciialpha
Checks whether character is letter in US-ASCII
- Parameters
-
- Returns
- boolean true if character is letter, boolean false otherwise
Definition at line 239 of file mhd_str.c.
◆ isasciidigit
#define isasciidigit |
( |
|
c | ) |
(((char)(c)) >= '0' && ((char)(c)) <= '9') |
Check whether character is decimal digit in US-ASCII
- Parameters
-
- Returns
- boolean true if character is decimal digit, boolean false otherwise
Definition at line 249 of file mhd_str.c.
◆ isasciilower
#define isasciilower |
( |
|
c | ) |
(((char)(c)) >= 'a' && ((char)(c)) <= 'z') |
Checks whether character is lower case letter in US-ASCII
- Parameters
-
- Returns
- boolean true if character is lower case letter, boolean false otherwise
Definition at line 219 of file mhd_str.c.
◆ isasciiupper
#define isasciiupper |
( |
|
c | ) |
(((char)(c)) >= 'A' && ((char)(c)) <= 'Z') |
Checks whether character is upper case letter in US-ASCII
- Parameters
-
- Returns
- boolean true if character is upper case letter, boolean false otherwise
Definition at line 229 of file mhd_str.c.
◆ isasciixdigit
#define isasciixdigit |
( |
|
c | ) |
|
Value: (((char)(c)) >= 'A' && ((char)(c)) <= 'F') || \
(((char)(c)) >= 'a' && ((char)(c)) <= 'f') )
Check whether character is hexadecimal digit in US-ASCII
- Parameters
-
- Returns
- boolean true if character is hexadecimal digit, boolean false otherwise
Definition at line 259 of file mhd_str.c.
◆ toasciilower
#define toasciilower |
( |
|
c | ) |
((isasciiupper(c)) ? (((char)(c)) - 'A' + 'a') : ((char)(c))) |
Convert US-ASCII character to lower case. If character is upper case letter in US-ASCII than it's converted to lower case analog. If character is NOT upper case letter than it's returned unmodified.
- Parameters
-
- Returns
- converted to lower case character
Definition at line 283 of file mhd_str.c.
◆ toasciiupper
#define toasciiupper |
( |
|
c | ) |
((isasciilower(c)) ? (((char)(c)) - 'a' + 'A') : ((char)(c))) |
Convert US-ASCII character to upper case. If character is lower case letter in US-ASCII than it's converted to upper case analog. If character is NOT lower case letter than it's returned unmodified.
- Parameters
-
- Returns
- converted to upper case character
Definition at line 295 of file mhd_str.c.
◆ todigitvalue
#define todigitvalue |
( |
|
c | ) |
(isasciidigit(c) ? (int)(((char)(c)) - '0') : (int)(-1)) |
Convert US-ASCII decimal digit to its value.
- Parameters
-
- Returns
- value of hexadecimal digit or -1 if @ c is not hexadecimal digit
Definition at line 304 of file mhd_str.c.
◆ toxdigitvalue
#define toxdigitvalue |
( |
|
c | ) |
|
Value: ( (((char)(c)) >= 'A' && ((char)(c)) <= 'F') ? \
(int)(((unsigned char)(c)) - 'A' + 10) : \
( (((char)(c)) >= 'a' && ((char)(c)) <= 'f') ? \
(int)(((unsigned char)(c)) - 'a' + 10) : (int)(-1) )))
Convert US-ASCII hexadecimal digit to its value.
- Parameters
-
- Returns
- value of hexadecimal digit or -1 if @ c is not hexadecimal digit
Definition at line 312 of file mhd_str.c.
◆ MHD_str_equal_caseless_()
int MHD_str_equal_caseless_ |
( |
const char * |
str1, |
|
|
const char * |
str2 |
|
) |
| |
Check two string for equality, ignoring case of US-ASCII letters.
- Parameters
-
str1 | first string to compare |
str2 | second string to compare |
- Returns
- non-zero if two strings are equal, zero otherwise.
Definition at line 329 of file mhd_str.c.
Referenced by build_header_response(), check_response_header_token_ci(), digest_calc_ha1_from_digest(), keepalive_possible(), method_string_to_enum(), MHD_add_response_header(), MHD_connection_handle_idle(), MHD_lookup_header_token_ci(), MHD_queue_response(), MHD_request_lookup_value(), MHD_response_get_header(), need_100_continue(), parse_connection_headers(), and parse_request_headers().
◆ MHD_str_equal_caseless_n_()
int MHD_str_equal_caseless_n_ |
( |
const char *const |
str1, |
|
|
const char *const |
str2, |
|
|
size_t |
maxlen |
|
) |
| |
◆ MHD_str_has_token_caseless_()
bool MHD_str_has_token_caseless_ |
( |
const char * |
str, |
|
|
const char *const |
token, |
|
|
size_t |
token_len |
|
) |
| |
Check whether str has case-insensitive token. Token could be surrounded by spaces and tabs and delimited by comma. Match succeed if substring between start, end (of string) or comma contains only case-insensitive token and optional spaces and tabs.
- Warning
- token must not contain null-charters except optional terminating null-character.
- Parameters
-
str | the string to check |
token | the token to find |
token_len | length of token, not including optional terminating null-character. |
- Returns
- non-zero if two strings are equal, zero otherwise.
Definition at line 393 of file mhd_str.c.
Referenced by check_response_header_token_ci(), MHD_check_response_header_token_ci(), and MHD_lookup_header_token_ci().
◆ MHD_str_to_uint64_()
size_t MHD_str_to_uint64_ |
( |
const char * |
str, |
|
|
uint64_t * |
out_val |
|
) |
| |
Convert decimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character.
- Parameters
-
| str | string to convert |
[out] | out_val | pointer to uint64_t to store result of conversion |
- Returns
- non-zero number of characters processed on succeed, zero if no digit is found, resulting value is larger then possible to store in uint64_t or out_val is NULL
Definition at line 450 of file mhd_str.c.
Referenced by parse_connection_headers(), and parse_request_headers().
◆ MHD_str_to_uint64_n_()
size_t MHD_str_to_uint64_n_ |
( |
const char * |
str, |
|
|
size_t |
maxlen, |
|
|
uint64_t * |
out_val |
|
) |
| |
Convert not more then maxlen decimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character or after maxlen digits.
- Parameters
-
| str | string to convert |
| maxlen | maximum number of characters to process |
[out] | out_val | pointer to uint64_t to store result of conversion |
- Returns
- non-zero number of characters processed on succeed, zero if no digit is found, resulting value is larger then possible to store in uint64_t or out_val is NULL
Definition at line 492 of file mhd_str.c.
◆ MHD_strx_to_uint32_()
size_t MHD_strx_to_uint32_ |
( |
const char * |
str, |
|
|
uint32_t * |
out_val |
|
) |
| |
Convert hexadecimal US-ASCII digits in string to number in uint32_t. Conversion stopped at first non-digit character.
- Parameters
-
| str | string to convert |
[out] | out_val | pointer to uint32_t to store result of conversion |
- Returns
- non-zero number of characters processed on succeed, zero if no digit is found, resulting value is larger then possible to store in uint32_t or out_val is NULL
Definition at line 535 of file mhd_str.c.
◆ MHD_strx_to_uint32_n_()
size_t MHD_strx_to_uint32_n_ |
( |
const char * |
str, |
|
|
size_t |
maxlen, |
|
|
uint32_t * |
out_val |
|
) |
| |
Convert not more then maxlen hexadecimal US-ASCII digits in string to number in uint32_t. Conversion stopped at first non-digit character or after maxlen digits.
- Parameters
-
| str | string to convert |
| maxlen | maximum number of characters to process |
[out] | out_val | pointer to uint32_t to store result of conversion |
- Returns
- non-zero number of characters processed on succeed, zero if no digit is found, resulting value is larger then possible to store in uint32_t or out_val is NULL
Definition at line 581 of file mhd_str.c.
Referenced by digest_auth_check_all(), and MHD_http_unescape().
◆ MHD_strx_to_uint64_()
size_t MHD_strx_to_uint64_ |
( |
const char * |
str, |
|
|
uint64_t * |
out_val |
|
) |
| |
Convert hexadecimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character.
- Parameters
-
| str | string to convert |
[out] | out_val | pointer to uint64_t to store result of conversion |
- Returns
- non-zero number of characters processed on succeed, zero if no digit is found, resulting value is larger then possible to store in uint64_t or out_val is NULL
Definition at line 621 of file mhd_str.c.
◆ MHD_strx_to_uint64_n_()
size_t MHD_strx_to_uint64_n_ |
( |
const char * |
str, |
|
|
size_t |
maxlen, |
|
|
uint64_t * |
out_val |
|
) |
| |
Convert not more then maxlen hexadecimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character or after maxlen digits.
- Parameters
-
| str | string to convert |
| maxlen | maximum number of characters to process |
[out] | out_val | pointer to uint64_t to store result of conversion |
- Returns
- non-zero number of characters processed on succeed, zero if no digit is found, resulting value is larger then possible to store in uint64_t or out_val is NULL
Definition at line 666 of file mhd_str.c.
Referenced by digest_auth_check_all(), and process_request_body().