|  | The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
    | 
Various miscellaneous utility functions. More...
#include <freeradius-devel/build.h>#include <freeradius-devel/missing.h>#include <freeradius-devel/util/print.h>#include <freeradius-devel/util/talloc.h>#include <freeradius-devel/util/time.h>#include <signal.h> Include dependency graph for misc.h:
 Include dependency graph for misc.h:Go to the source code of this file.
| Macros | |
| #define | fr_zero_whitespace(_p) while (isspace((uint8_t) *_p)) *(_p++) = '\0' | 
| Zero out any whitespace with nul bytes. | |
| #define | VERIFY_ALL_TALLOC | 
| Typedefs | |
| typedef int8_t(* | fr_cmp_t) (void const *a, void const *b) | 
| typedef void(* | fr_free_t) (void *) | 
| Functions | |
| int | fr_blocking (int fd) | 
| 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. | |
| char const * | fr_filename (char const *path) | 
| Get the filename from a path. | |
| char const * | fr_filename_common_trim (char const *path, char const *common) | 
| Trim a common prefix from a filename. | |
| int | fr_nonblock (int fd) | 
| int8_t | fr_pointer_cmp (void const *a, void const *b) | 
| Compares two pointers. | |
| 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. | |
| int | fr_set_signal (int sig, sig_t func) | 
| Sets a signal handler using sigaction if available, else signal. | |
| size_t | fr_snprint_uint128 (char *out, size_t outlen, uint128_t const num) | 
| Write 128bit unsigned integer to buffer. | |
| int | fr_strtoll (int64_t *out, char **end, char const *value) | 
| Consume the integer (or hex) portion of a value string. | |
| int | fr_strtoull (uint64_t *out, char **end, char const *value) | 
| Consume the integer (or hex) portion of a value string. | |
| char * | fr_tolower (char *str) | 
| char * | fr_trim (char const *str, size_t size) | 
| Trim whitespace from the end of a string. | |
| int | fr_unset_signal (int sig) | 
| Uninstall a signal for a specific handler. | |
| ssize_t | fr_utf8_to_ucs2 (uint8_t *out, size_t outlen, char const *in, size_t inlen) | 
| Convert UTF8 string to UCS2 encoding. | |
| static bool | is_integer (char const *value) | 
| Check whether the string is all numbers. | |
| static bool | is_printable (void const *value, size_t len) | 
| Check whether the string is made up of printable UTF8 chars. | |
| static bool | is_whitespace (char const *value) | 
| Check whether the string is all whitespace. | |
| static bool | is_zero (char const *value) | 
| Check whether the string is all zeros. | |
| int | rad_lockfd (int fd, int lock_len) | 
| int | rad_lockfd_nonblock (int fd, int lock_len) | 
| int | rad_unlockfd (int fd, int lock_len) | 
Various miscellaneous utility functions.
Definition in file misc.h.
| int fr_blocking | ( | int | fd | ) | 
Do a comparison of two authentication digests by comparing the FULL data.
Otherwise, the server can be subject to timing attacks.
http://www.cs.rice.edu/~dwallach/pub/crosby-timing2009.pdf
Definition at line 473 of file misc.c.
 Here is the caller graph for this function:
 Here is the caller graph for this function:| char const * fr_filename | ( | char const * | path | ) | 
| char const * fr_filename_common_trim | ( | char const * | path, | 
| char const * | common | ||
| ) | 
| int fr_nonblock | ( | int | fd | ) | 
| int8_t fr_pointer_cmp | ( | void const * | a, | 
| void const * | b | ||
| ) | 
| void fr_quick_sort | ( | void const * | to_sort[], | 
| int | start, | ||
| int | end, | ||
| fr_cmp_t | cmp | ||
| ) | 
Quick sort an array of pointers using a comparator.
| to_sort | array of pointers to sort. | 
| start | the lowest index (usually 0). | 
| end | the length of the array. | 
| cmp | the comparison function to use to sort the array elements. | 
Definition at line 430 of file misc.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| int fr_set_signal | ( | int | sig, | 
| sig_t | func | ||
| ) | 
| int fr_strtoll | ( | int64_t * | out, | 
| char ** | end, | ||
| char const * | value | ||
| ) | 
Consume the integer (or hex) portion of a value string.
Allows integer or hex representations of integers (but not octal, as octal is deemed to be confusing).
| [out] | out | Result of parsing string as signed 64bit integer. | 
| [out] | end | pointer to the first non numeric char. | 
| [in] | value | string to parse. | 
| int fr_strtoull | ( | uint64_t * | out, | 
| char ** | end, | ||
| char const * | value | ||
| ) | 
Consume the integer (or hex) portion of a value string.
Allows integer or hex representations of integers (but not octal, as octal is deemed to be confusing).
| [out] | out | Result of parsing string as unsigned 64bit integer. | 
| [out] | end | pointer to the first non numeric char. | 
| [in] | value | string to parse. | 
| char * fr_tolower | ( | char * | str | ) | 
| char * fr_trim | ( | char const * | str, | 
| size_t | size | ||
| ) | 
| int fr_unset_signal | ( | int | sig | ) | 
Convert UTF8 string to UCS2 encoding.
| [out] | out | Where to write the ucs2 string. | 
| [in] | outlen | Size of output buffer. | 
| [in] | in | UTF8 string to convert. | 
| [in] | inlen | length of UTF8 string. | 
Definition at line 316 of file misc.c.
 Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | inlinestatic | 
Check whether the string is made up of printable UTF8 chars.
| value | to check. | 
| len | of value. | 
Definition at line 88 of file misc.h.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | inlinestatic | 
| 
 | inlinestatic | 
| int rad_lockfd | ( | int | fd, | 
| int | lock_len | ||
| ) | 
| int rad_lockfd_nonblock | ( | int | fd, | 
| int | lock_len | ||
| ) | 
 1.9.8
 1.9.8