24 RCSIDH(misc_h,
"$Id: de2598cee5289dbb7bcd58e116874b44501bdc30 $")
30 #include <freeradius-devel/build.h>
31 #include <freeradius-devel/missing.h>
32 #include <freeradius-devel/util/print.h>
33 #include <freeradius-devel/util/talloc.h>
34 #include <freeradius-devel/util/time.h>
38 typedef int8_t (*
fr_cmp_t)(
void const *a,
void const *b);
47 void fr_talloc_verify_cb(
const void *ptr,
int depth,
48 int max_depth,
int is_ref,
50 # define VERIFY_ALL_TALLOC talloc_report_depth_cb(NULL, 0, -1, fr_talloc_verify_cb, NULL)
52 # define VERIFY_ALL_TALLOC
59 #define fr_skip_whitespace(_p) while(isspace((uint8_t)*(_p))) _p++
66 #define fr_bskip_whitespace(_p, _e) while((_p < _e) && isspace((uint8_t)*(_p))) _p++
72 #define fr_skip_not_whitespace(_p) while(*_p && !isspace((uint8_t)*(_p))) _p++
78 #define fr_zero_whitespace(_p) while (isspace((uint8_t) *_p)) *(_p++) = '\0'
88 #ifdef STATIC_ANALYZER
89 if (*
value ==
'\0')
return false;
113 for (i = 0; i < len; i++) {
115 if (clen == 0)
return false;
130 #ifdef STATIC_ANALYZER
131 if (*
value ==
'\0')
return false;
149 if (*
value !=
'0')
return false;
162 char *
fr_trim(
char const *str,
size_t size);
static uint8_t depth(fr_minmax_heap_index_t i)
int fr_unset_signal(int sig)
Uninstall a signal for a specific handler.
char * fr_trim(char const *str, size_t size)
Trim whitespace from the end of a string.
int fr_strtoull(uint64_t *out, char **end, char const *value)
Consume the integer (or hex) portion of a value string.
int fr_set_signal(int sig, sig_t func)
Sets a signal handler using sigaction if available, else signal.
int rad_unlockfd(int fd, int lock_len)
static bool is_printable(void const *value, size_t len)
Check whether the string is made up of printable UTF8 chars.
char * fr_tolower(char *str)
static bool is_whitespace(char const *value)
Check whether the string is all whitespace.
ssize_t fr_utf8_to_ucs2(uint8_t *out, size_t outlen, char const *in, size_t inlen)
Convert UTF8 string to UCS2 encoding.
int fr_strtoll(int64_t *out, char **end, char const *value)
Consume the integer (or hex) portion of a value string.
int8_t fr_pointer_cmp(void const *a, void const *b)
Compares two pointers.
static bool is_integer(char const *value)
Check whether the string is all numbers.
void fr_quick_sort(void const *to_sort[], int min_idx, int max_idx, fr_cmp_t cmp)
Quick sort an array of pointers using a comparator.
int8_t(* fr_cmp_t)(void const *a, void const *b)
int rad_lockfd(int fd, int lock_len)
int rad_lockfd_nonblock(int fd, int lock_len)
size_t fr_snprint_uint128(char *out, size_t outlen, uint128_t const num)
Write 128bit unsigned integer to buffer.
void(* fr_free_t)(void *)
int fr_digest_cmp(uint8_t const *a, uint8_t const *b, size_t length)
Do a comparison of two authentication digests by comparing the FULL data.
static bool is_zero(char const *value)
Check whether the string is all zeros.
size_t fr_utf8_char(uint8_t const *str, ssize_t inlen)
Checks for utf-8, taken from http://www.w3.org/International/questions/qa-forms-utf-8.
Signals that can be sent to a request.
static size_t char fr_sbuff_t size_t inlen
static size_t char ** out