diff --git a/annotated.html b/annotated.html index 465e64c..c3f99f8 100644 --- a/annotated.html +++ b/annotated.html @@ -59,12 +59,14 @@
AANode | Tree node |
AATree | Tree header, for storing helper functions |
Bitmap256 | Bitmap of 256 bits |
CfContext | Top-level config information |
CfKey | Parameter description |
CfLookup | Lookup entry for CF_LOOKUP table |
CfOps | Callbacks for setting and getting a variable value |
CfSect | Section description |
CfValue | Helper structure for passing key info to CfOps |
ChaCha | ChaCha state |
CxMem | Memory allocation context |
CxOps | Ops for allocator that takes context |
DigestInfo | Algoright info |
gaicb | Request data for getaddrinfo_a() |
HashItem | HashTab slot |
HashTab | Single HashTab segment |
JsonContext | Allocation context |
JsonValue | Json value |
KeccakContext | Keccak state structure for all modes |
KeccakPRNG | State structure |
List | Structure for both list nodes and heads |
MappedFile | Info about mapped file |
MBuf | MBuf structure |
regex_t | Compiled regex |
regmatch_t | Match location |
sha1_ctx | SHA1 state |
sha256_ctx | State structure for both SHA256 and SHA224 |
SHA3Context | State structure |
sha512_ctx | State structure for both SHA512 and SHA384 |
SHList | List node/head |
StatList | Header structure for StatList |
Defines | |
#define | PRIdZ |
printf 'd' format specifier for ssize_t | |
#define | PRIiZ |
printf 'i' format specifier for ssize_t | |
#define | PRIoZ |
printf 'o' format specifier for size_t | |
#define | PRIuZ |
printf 'u' format specifier for size_t | |
#define | PRIxZ |
printf 'x' format specifier for size_t | |
#define | PRIXZ |
printf 'X' format specifier for size_t | |
#define | offsetof(type, field) |
give offset of a field inside struct | |
#define | container_of(ptr, type, field) |
preferred alignment | |
#define | ARRAY_NELEM(a) |
number of elements in array | |
#define | FLEX_ARRAY |
Compat helper to specify array with unknown length. | |
#define | STR(x) |
Make string token from C expression. | |
#define | CONCAT(a, b) |
Make single C token from 3 separate tokens. | |
#define | CONCAT4(a, b, c, d) |
Make single C token from 4 separate tokens. | |
#define | __func__ |
Pre-processor macro for current function name. | |
#define | static_assert(expr, msg) |
Compile-time assert. | |
#define | Assert(e) |
assert() that uses <usual/logging> module | |
#define | free(x) |
Compat: make free() accept const pointer. | |
Compiler attributes. | |
-#define | _COMPILER_GNUC(maj, min) |
-#define | _COMPILER_CLANG(maj, min) |
-#define | _COMPILER_MSC(ver) |
-#define | _COMPILER_ICC(ver) |
Compiler checks, mainly for internal usage. | |
#define | _COMPILER_GNUC(maj, min) |
Pre-processor macro to check if compiler is GCC with high enough version. | |
#define | _COMPILER_CLANG(maj, min) |
Pre-processor macro to check if compiler is CLANG with high enough version. | |
#define | _COMPILER_MSC(ver) |
Pre-processor macro to check if compiler is Visual C with high enough version. | |
#define | _COMPILER_ICC(ver) |
Pre-processor macro to check if compiler is Intel CC with high enough version. | |
+#define | __has_builtin(x) |
+#define | __has_feature(x) |
+#define | __has_extension(x) |
+#define | __has_attribute(x) |
Function/struct attributes. | |
#define | _PACKED |
Disable padding for structure. | |
-#define | __func__ |
-#define | _MUSTCHECK |
-#define | _DEPRECATED |
-#define | _PRINTF(x, y) |
-#define | _MALLOC |
-#define | _UNUSED |
-#define | _NOINLINE |
-#define | _NORETURN |
-#define | unlikely(x) |
-#define | likely(x) |
#define | _MUSTCHECK |
Show warning if function result is not used. | |
#define | _DEPRECATED |
Show warning if used. | |
#define | _PRINTF(fmtpos, argpos) |
Check printf-style format and arg sanity. | |
#define | _MALLOC |
Function returns new pointer. | |
#define | _UNUSED |
Disable 'unused' warning for function/argument. | |
#define | _NOINLINE |
Do not inline function. | |
#define | _NORETURN |
Indicates that function never returns. | |
#define | likely(x) |
Hint for compiler that expression (x) is likely to be true. | |
#define | unlikely(x) |
Hint for compiler that expression (x) is likely to be false. | |
Functions | |
static _MUSTCHECK void * | zmalloc (size_t len) |
static _MUSTCHECK void * | zmalloc (size_t len) |
Zeroing malloc. | |
int | posix_memalign (void **ptr_p, size_t align, size_t len) |
Compat: posix_memalign() | |
void * | reallocarray (void *p, size_t count, size_t size) |
Same as realloc(), but safely calculates total size. |
Basic C environment.
#define PRIdZ | +
printf 'd' format specifier for ssize_t
+ +#define PRIiZ | +
printf 'i' format specifier for ssize_t
+ +#define PRIoZ | +
printf 'o' format specifier for size_t
+ +#define PRIuZ | +
printf 'u' format specifier for size_t
+ +#define PRIxZ | +
printf 'x' format specifier for size_t
+ +#define PRIXZ | +
printf 'X' format specifier for size_t
+ +number of elements in array
+#define FLEX_ARRAY | +
Make single C token from 4 separate tokens.
+ + + +#define __func__ | +
Pre-processor macro for current function name.
+ +#define _COMPILER_GNUC | +( | ++ | maj, | +
+ | + | + | min | +
+ | ) | ++ |
Pre-processor macro to check if compiler is GCC with high enough version.
+ +#define _COMPILER_CLANG | +( | ++ | maj, | +
+ | + | + | min | +
+ | ) | ++ |
Pre-processor macro to check if compiler is CLANG with high enough version.
+ +#define _COMPILER_MSC | +( | ++ | ver | ) | ++ |
Pre-processor macro to check if compiler is Visual C with high enough version.
+ +#define _COMPILER_ICC | +( | ++ | ver | ) | ++ |
Pre-processor macro to check if compiler is Intel CC with high enough version.
+Disable padding for structure.
+ + + +#define _MUSTCHECK | +
Show warning if function result is not used.
+ +#define _DEPRECATED | +
Show warning if used.
+ +#define _PRINTF | +( | ++ | fmtpos, | +
+ | + | + | argpos | +
+ | ) | ++ |
Check printf-style format and arg sanity.
+ +#define _MALLOC | +
Function returns new pointer.
+ +#define _UNUSED | +
Disable 'unused' warning for function/argument.
+ +#define _NOINLINE | +
Do not inline function.
+ +#define _NORETURN | +
Indicates that function never returns.
+ +#define likely | +( | ++ | x | ) | ++ |
Hint for compiler that expression (x) is likely to be true.
+ +#define unlikely | +( | ++ | x | ) | ++ |
Hint for compiler that expression (x) is likely to be false.
+static _MUSTCHECK void* zmalloc | +static _MUSTCHECK void* zmalloc | ( | size_t | len | ) | @@ -547,6 +947,41 @@
void* reallocarray | +( | +void * | +p, | +
+ | + | size_t | +count, | +
+ | + | size_t | +size | +
+ | ) | ++ |
Same as realloc(), but safely calculates total size.
+Functions | |
static int | is_power_of_2 (int n) |
Checks if integer has only one bit set. | |
static bool | is_power_of_2 (unsigned int n) |
Checks if integer has only one bit set. | |
static uint16_t | rol16 (uint16_t v, int s) |
Rotate 16-bit int to left. | |
static uint32_t | rol32 (uint32_t v, int s) |
static uint64_t | ror64 (uint64_t v, int s) |
Rotate 64-bit int to right. | |
static int | fls (int x) |
Compat: Find last (MSB) set bit, 1-based ofs, 0 if arg == 0. | |
Find last (highest) set bit, 1-based offset, 0 if arg == 0. | |
static int | flsl (long x) |
Compat: Find last (MSB) set bit, 1-based ofs, 0 if arg == 0. | |
Find last (highest) set bit, 1-based offset, 0 if arg == 0. | |
static int | flsll (long long x) |
Compat: Find last (MSB) set bit, 1-based ofs, 0 if arg == 0. | |
Find last (highest) set bit, 1-based offset, 0 if arg == 0. | |
static int | ffs (int x) |
Compat: Find first (LSB) set bit, 1-based ofs, 0 if arg == 0. | |
Find first (lowest) set bit, 1-based ofs, 0 if arg == 0. | |
static int | ffsl (long x) |
Compat: Find first (LSB) set bit, 1-based ofs, 0 if arg == 0. | |
Find first (lowest) set bit, 1-based ofs, 0 if arg == 0. | |
static int | ffsll (long long x) |
Compat: Find first (LSB) set bit, 1-based ofs, 0 if arg == 0. | |
Find first (lowest) set bit, 1-based ofs, 0 if arg == 0. | |
static bool | safe_mul_uint (unsigned int *res_p, unsigned int a, unsigned int b) |
Multiply with overflow check for 'unsigned int'. | |
static bool | safe_mul_ulong (unsigned long *res_p, unsigned long a, unsigned long b) |
Multiply with overflow check for 'unsigned long'. | |
static bool | safe_mul_uint8 (uint8_t *res_p, uint8_t a, uint8_t b) |
Multiply with overflow check for 'uint8_t'. | |
static bool | safe_mul_uint16 (uint16_t *res_p, uint16_t a, uint16_t b) |
Multiply with overflow check for 'uint16_t'. | |
static bool | safe_mul_uint32 (uint32_t *res_p, uint32_t a, uint32_t b) |
Multiply with overflow check for 'uint32_t'. | |
static bool | safe_mul_uint64 (uint64_t *res_p, uint64_t a, uint64_t b) |
Multiply with overflow check for 'uint64_t'. | |
static bool | safe_mul_size (size_t *res_p, size_t a, size_t b) |
Multiply with overflow check for 'size_t'. |
Bit arithmetics.
@@ -101,14 +115,14 @@static int is_power_of_2 | +static bool is_power_of_2 | ( | -int | +unsigned int | n | ) | [inline, static] |
static bool safe_mul_uint | +( | +unsigned int * | +res_p, | +
+ | + | unsigned int | +a, | +
+ | + | unsigned int | +b | +
+ | ) | + [inline, static] |
+
Multiply with overflow check for 'unsigned int'.
+ +static bool safe_mul_ulong | +( | +unsigned long * | +res_p, | +
+ | + | unsigned long | +a, | +
+ | + | unsigned long | +b | +
+ | ) | + [inline, static] |
+
Multiply with overflow check for 'unsigned long'.
+ +static bool safe_mul_uint8 | +( | +uint8_t * | +res_p, | +
+ | + | uint8_t | +a, | +
+ | + | uint8_t | +b | +
+ | ) | + [inline, static] |
+
Multiply with overflow check for 'uint8_t'.
+ +static bool safe_mul_uint16 | +( | +uint16_t * | +res_p, | +
+ | + | uint16_t | +a, | +
+ | + | uint16_t | +b | +
+ | ) | + [inline, static] |
+
Multiply with overflow check for 'uint16_t'.
+ +static bool safe_mul_uint32 | +( | +uint32_t * | +res_p, | +
+ | + | uint32_t | +a, | +
+ | + | uint32_t | +b | +
+ | ) | + [inline, static] |
+
Multiply with overflow check for 'uint32_t'.
+ +static bool safe_mul_uint64 | +( | +uint64_t * | +res_p, | +
+ | + | uint64_t | +a, | +
+ | + | uint64_t | +b | +
+ | ) | + [inline, static] |
+
Multiply with overflow check for 'uint64_t'.
+ +static bool safe_mul_size | +( | +size_t * | +res_p, | +
+ | + | size_t | +a, | +
+ | + | size_t | +b | +
+ | ) | + [inline, static] |
+
Multiply with overflow check for 'size_t'.
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
Map 256 byte values to bit or int. +More...
++Data Structures | |
struct | Bitmap256 |
Bitmap of 256 bits. More... | |
+Defines | |
#define | BITMAP256_CONST(check) |
Use C preprocessor to fill Bitmap256. | |
#define | INTMAP256_CONST(map_value) |
Use C preprocessor to generate array of 256 values. | |
+Functions | |
static void | bitmap256_init (struct Bitmap256 *bmap) |
Clear bitmap. | |
static void | bitmap256_set (struct Bitmap256 *bmap, uint8_t byte) |
Set one bit. | |
static bool | bitmap256_is_set (const struct Bitmap256 *bmap, uint8_t byte) |
Check if bit is set. |
Map 256 byte values to bit or int.
+#define BITMAP256_CONST | +( | ++ | check | ) | ++ |
Use C preprocessor to fill Bitmap256.
+Usage:
+#define check_isdigit(c) ((c) >= '0' && (c) <= '9') + static const struct Bitmap256 map_isdigit = BITMAP256_CONST(check_isdigit); +
#define INTMAP256_CONST | +( | ++ | map_value | ) | ++ |
Use C preprocessor to generate array of 256 values.
+Usage:
+#define my_hexval(c) (((c) >= '0' && (c) <= '9') ? ((c) - '0') : ( \ + ((c) >= 'A' && (c) <= 'F') ? ((c) - 'A' + 10) : ( \ + ((c) >= 'a' && (c) <= 'f') ? ((c) - 'a' + 10) : -1 ))) + static const int map_hexval[] = INTMAP256_CONST(my_hexval); +
static void bitmap256_init | +( | +struct Bitmap256 * | +bmap | ) | + [inline, static] |
+
Clear bitmap.
+ +static void bitmap256_set | +( | +struct Bitmap256 * | +bmap, | +
+ | + | uint8_t | +byte | +
+ | ) | + [inline, static] |
+
Set one bit.
+ +static bool bitmap256_is_set | +( | +const struct Bitmap256 * | +bmap, | +
+ | + | uint8_t | +byte | +
+ | ) | + [inline, static] |
+
Check if bit is set.
+ +Typedefs | |
typedef unsigned int(* | cbtree_getkey_func )(void *ctx, void *obj, const void **dst_p) |
returns length of the key | |
typedef size_t(* | cbtree_getkey_func )(void *ctx, void *obj, const void **dst_p) |
returns length of the key | |
typedef bool(* | cbtree_walker_func )(void *ctx, void *obj) |
walk over tree | |
Functions | |
struct CBTree * | cbtree_create (cbtree_getkey_func obj_key_cb, cbtree_walker_func obj_free_cb, void *cb_ctx, CxMem *cx) |
struct CBTree * | cbtree_create (cbtree_getkey_func obj_key_cb, cbtree_walker_func obj_free_cb, void *cb_ctx, CxMem *cx) |
Create new tree. | |
void | cbtree_destroy (struct CBTree *tree) |
frees all resources allocated. | |
bool | cbtree_insert (struct CBTree *tree, void *obj) _MUSTCHECK |
bool | cbtree_insert (struct CBTree *tree, void *obj) _MUSTCHECK |
Inserts new node to tree. | |
bool | cbtree_delete (struct CBTree *tree, const void *key, unsigned klen) |
Removed node from tree. | |
void * | cbtree_lookup (struct CBTree *tree, const void *key, unsigned klen) |
Lookup a key. | |
bool | cbtree_delete (struct CBTree *tree, const void *key, size_t klen) |
Removed node from tree. | |
void * | cbtree_lookup (struct CBTree *tree, const void *key, size_t klen) |
Lookup a key. | |
bool | cbtree_walk (struct CBTree *tree, cbtree_walker_func cb_func, void *cb_arg) |
Walk over tree. |
Crit-bit tree / binary radix tree.
typedef unsigned int(* cbtree_getkey_func)(void *ctx, void *obj, const void **dst_p) | +typedef size_t(* cbtree_getkey_func)(void *ctx, void *obj, const void **dst_p) |
bool cbtree_delete | +bool cbtree_delete | ( | struct CBTree * | tree, | @@ -236,7 +236,7 @@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- | unsigned | +size_t | klen | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
void* cbtree_lookup | +void* cbtree_lookup | ( | struct CBTree * | tree, | @@ -273,7 +273,7 @@
- | unsigned | +size_t | klen | |
Ops for lookup, takes table as argument. | ||||
Functions | ||||
bool | cf_load_file (const struct CfContext *cf, const char *fn) _MUSTCHECK | |||
bool | cf_load_file (const struct CfContext *cf, const char *fn) _MUSTCHECK | |||
Load config from file. | ||||
const char * | cf_get (const struct CfContext *cf, const char *sect, const char *var, char *buf, int buflen) | |||
Get single value. | ||||
typedef bool(* | cf_handler_f )(void *arg, bool is_sect, const char *key, const char *val) | |||
Callback signarure for parse_ini_file() | ||||
bool | parse_ini_file (const char *fn, cf_handler_f user_handler, void *arg) _MUSTCHECK | |||
bool | parse_ini_file (const char *fn, cf_handler_f user_handler, void *arg) _MUSTCHECK | |||
Simple parser, launches callback for each line. |
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
+Data Structures | |
struct | ChaCha |
ChaCha state. More... | |
+Functions | |
void | chacha_set_key_256 (struct ChaCha *ctx, const void *key) |
Set 256-bit key. | |
void | chacha_set_key_128 (struct ChaCha *ctx, const void *key) |
Set 128-bit key. | |
void | chacha_set_nonce (struct ChaCha *ctx, uint32_t counter_low, uint32_t counter_high, const void *iv) |
Set 2x32-bit counter and 8-byte IV. | |
void | chacha_keystream (struct ChaCha *ctx, void *stream, size_t bytes) |
Extract plain keystream. | |
void | chacha_keystream_xor (struct ChaCha *ctx, const void *plain, void *encrypted, size_t bytes) |
XOR data with keystream. |
ChaCha cipher.
+void chacha_set_key_256 | +( | +struct ChaCha * | +ctx, | +
+ | + | const void * | +key | +
+ | ) | ++ |
Set 256-bit key.
+ +void chacha_set_key_128 | +( | +struct ChaCha * | +ctx, | +
+ | + | const void * | +key | +
+ | ) | ++ |
Set 128-bit key.
+ +void chacha_set_nonce | +( | +struct ChaCha * | +ctx, | +
+ | + | uint32_t | +counter_low, | +
+ | + | uint32_t | +counter_high, | +
+ | + | const void * | +iv | +
+ | ) | ++ |
Set 2x32-bit counter and 8-byte IV.
+ +void chacha_keystream | +( | +struct ChaCha * | +ctx, | +
+ | + | void * | +stream, | +
+ | + | size_t | +bytes | +
+ | ) | ++ |
Extract plain keystream.
+ +void chacha_keystream_xor | +( | +struct ChaCha * | +ctx, | +
+ | + | const void * | +plain, | +
+ | + | void * | +encrypted, | +
+ | + | size_t | +bytes | +
+ | ) | ++ |
XOR data with keystream.
+ +
| CfValue |
| MBuf | regmatch_t | |||||
CxMem | md5_ctx |
| CfSect |
|
| regmatch_t | |||
CfValue |
| ||||||||
AANode | CxOps | HashItem |
| ||||||
AATree |
| HashTab | sha1_ctx | ||||||
AANode | ChaCha | HashItem | MappedFile | ||||||
AATree | CxMem | HashTab | MBuf | sha1_ctx | |||||
| CxOps |
| md5_ctx | sha256_ctx | |||||
|
| SHA3Context | |||||||
Bitmap256 | JsonContext | sha512_ctx | |||||||
| DigestInfo | JsonValue | option | SHList | |||||
|
| option | SHList | ||||||
DigestInfo |
|
| StatList | ||||||
CfContext |
| KeccakContext | |||||||
CfKey |
| PStr | |||||||
CfLookup | event |
| |||||||
CfContext | |||||||||
CfKey | event | KeccakContext | PStr | ||||||
CfLookup |
| KeccakPRNG |
| ||||||
CfOps |
| ||||||||
CfOps |
| List | |||||||
CfSect |
| regex_t | |||||||
gaicb | |||||||||
MappedFile | |||||||||
gaicb | regex_t | ||||||||
List | |||||||||
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
Cryptographically Secure Randomness. +More...
++Functions | |
uint32_t | csrandom (void) |
Return random uint32_t. | |
uint32_t | csrandom_range (uint32_t upper_bound) |
Return unsigned integer in range. | |
void | csrandom_bytes (void *buf, size_t nbytes) |
Fill buffer with random bytes. |
Cryptographically Secure Randomness.
+uint32_t csrandom | +( | +void | +) | ++ |
Return random uint32_t.
+ +uint32_t csrandom_range | +( | +uint32_t | +upper_bound | ) | ++ |
Return unsigned integer in range.
+ +void csrandom_bytes | +( | +void * | +buf, | +
+ | + | size_t | +nbytes | +
+ | ) | ++ |
Fill buffer with random bytes.
+ +Context-based Memory Allocator.
@@ -338,15 +346,167 @@Allocate and copy string.
+int cx_asprintf | +( | +CxMem * | +cx, | +
+ | + | char ** | +dst_p, | +
+ | + | const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Print to allocated string, return length or -1 on error.
+ +int int cx_vasprintf | +( | +CxMem * | +cx, | +
+ | + | char ** | +dst_p, | +
+ | + | const char * | +fmt, | +
+ | + | va_list | +ap | +
+ | ) | ++ |
Print to allocated string, return length or -1 on error.
+ +int int char* cx_sprintf | +( | +CxMem * | +cx, | +
+ | + | const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Print to allocated string, return new string or NULL on error.
+ +int int char char* cx_vsprintf | +( | +CxMem * | +cx, | +
+ | + | const char * | +fmt, | +
+ | + | va_list | +ap | +
+ | ) | ++ |
Print to allocated string, return new string or NULL on error.
+CxMem cx_libc_allocator | +int int char char CxMem cx_libc_allocator |
Functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CxMem * | cx_new_pool (CxMem *parent) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Creates allocator that pools all memory together, without keeping track of single objects, to be freed all together in one shot. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CxMem * | cx_new_pool (CxMem *parent, size_t initial_size, unsigned int align) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Creates allocator that pools all memory together, without keeping track of single objects, to be freed all together in one shot. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CxMem * | cx_new_tree (CxMem *parent) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Creates allocator that remebers all allocations done under it and allows all of it to be freed together. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@@ -79,16 +79,32 @@
Extra allocators for cxalloc.
| SHA384 message digest. | struct DigestInfo * | digest_SHA512 (void) | | SHA512 message digest. | struct DigestInfo * | digest_KECCAK224 (void) | | Keccak-224 message digest. | struct DigestInfo * | digest_KECCAK256 (void) | | Keccak-256 message digest. | struct DigestInfo * | digest_KECCAK384 (void) | | Keccak-384 message digest. | struct DigestInfo * | digest_KECCAK512 (void) | | Keccak-512 message digest. | struct DigestInfo * | digest_KECCAK_STREAM (void) | | Keccak in arbitrary output length mode. | struct DigestInfo * | digest_SHA3_224 (void) | | SHA3-224 message digest. | struct DigestInfo * | digest_SHA3_256 (void) | | SHA3-256 message digest. | struct DigestInfo * | digest_SHA3_384 (void) | | SHA3-384 message digest. | struct DigestInfo * | digest_SHA3_512 (void) | | SHA3-512 message digest. | struct DigestInfo * | digest_SHAKE128 (void) | | SHAKE128 in regular digest mode. | struct DigestInfo * | digest_SHAKE256 (void) | | SHAKE256 in regular digest mode. | |
Common API for cryptographic digests.
@@ -393,12 +395,12 @@struct DigestInfo* digest_KECCAK224 | +struct DigestInfo* digest_SHA3_224 | ( | void | ) | @@ -408,16 +410,16 @@
struct DigestInfo* digest_KECCAK256 | +struct DigestInfo* digest_SHA3_256 | ( | void | ) | @@ -427,16 +429,16 @@
struct DigestInfo* digest_KECCAK384 | +struct DigestInfo* digest_SHA3_384 | ( | void | ) | @@ -446,16 +448,16 @@
struct DigestInfo* digest_KECCAK512 | +struct DigestInfo* digest_SHA3_512 | ( | void | ) | @@ -465,16 +467,16 @@
struct DigestInfo* digest_KECCAK_STREAM | +struct DigestInfo* digest_SHAKE128 | ( | void | ) | @@ -484,7 +486,26 @@
struct DigestInfo* digest_SHAKE256 | +( | +void | +) | + [read] |
+
SHAKE256 in regular digest mode.
Endianess conversion macros. +
Endianess conversion, convert integers to bytes. More...
Defines | |
Host <-> LE/BE | |
-#define | htobe16(x) |
-#define | htobe32(x) |
-#define | htobe64(x) |
-#define | htole16(x) |
-#define | htole32(x) |
-#define | htole64(x) |
-#define | be16toh(x) |
-#define | be32toh(x) |
-#define | be64toh(x) |
-#define | le16toh(x) |
-#define | le32toh(x) |
-#define | le64toh(x) |
Convert host-endian int to BE/LE. | |
#define | htobe16(x) |
Convert native 16-bit int to big-endian. | |
#define | htobe32(x) |
Convert native 32-bit int to big-endian. | |
#define | htobe64(x) |
Convert native 64-bit int to big-endian. | |
#define | htole16(x) |
Convert native 16-bit int to little-endian. | |
#define | htole32(x) |
Convert native 32-bit int to little-endian. | |
#define | htole64(x) |
Convert native 64-bit int to little-endian. | |
#define | be16toh(x) |
Convert big-endian 16-bit int to host-endian. | |
#define | be32toh(x) |
Convert big-endian 32-bit int to host-endian. | |
#define | be64toh(x) |
Convert big-endian 64-bit int to host-endian. | |
#define | le16toh(x) |
Convert little-endian 64-bit int to host-endian. | |
#define | le32toh(x) |
Convert little-endian 64-bit int to host-endian. | |
#define | le64toh(x) |
Convert little-endian 64-bit int to host-endian. | |
Functions | |
Always swap. | |
-static uint16_t | bswap16 (uint16_t x) |
-static uint32_t | bswap32 (uint32_t x) |
-static uint64_t | bswap64 (uint64_t x) |
Read LE/BE values from memory and convert to host format | |
-static uint16_t | be16dec (const void *p) |
-static uint32_t | be32dec (const void *p) |
-static uint64_t | be64dec (const void *p) |
-static uint16_t | le16dec (const void *p) |
-static uint32_t | le32dec (const void *p) |
-static uint64_t | le64dec (const void *p) |
static uint16_t | bswap16 (uint16_t x) |
Swap 16-bit int. | |
static uint32_t | bswap32 (uint32_t x) |
Swap 32-bit int. | |
static uint64_t | bswap64 (uint64_t x) |
Swap 64-bit int. | |
Read integer values from memory and convert to host format. | |
static uint16_t | be16dec (const void *p) |
Read big-endian 16-bit int from memory. | |
static uint32_t | be32dec (const void *p) |
Read big-endian 32-bit int from memory. | |
static uint64_t | be64dec (const void *p) |
Read big-endian 64-bit int from memory. | |
static uint16_t | le16dec (const void *p) |
Read little-endian 16-bit int from memory. | |
static uint32_t | le32dec (const void *p) |
Read little-endian 32-bit int from memory. | |
static uint64_t | le64dec (const void *p) |
Read little-endian 64-bit int from memory. | |
static uint16_t | h16dec (const void *p) |
Read host-endian 16-bit int from memory. | |
static uint32_t | h32dec (const void *p) |
Read host-endian 32-bit int from memory. | |
static uint64_t | h64dec (const void *p) |
Read host-endian 64-bit int from memory. | |
Convert host value to LE/BE and write to memory | |
-static void | be16enc (void *p, uint16_t x) |
-static void | be32enc (void *p, uint32_t x) |
-static void | be64enc (void *p, uint64_t x) |
-static void | le16enc (void *p, uint16_t x) |
-static void | le32enc (void *p, uint32_t x) |
-static void | le64enc (void *p, uint64_t x) |
static void | be16enc (void *p, uint16_t x) |
Write big-endian 16-bit int to memory. | |
static void | be32enc (void *p, uint32_t x) |
Write big-endian 32-bit int to memory. | |
static void | be64enc (void *p, uint64_t x) |
Write big-endian 64-bit int to memory. | |
static void | le16enc (void *p, uint16_t x) |
Write little-endian 16-bit int to memory. | |
static void | le32enc (void *p, uint32_t x) |
Write little-endian 32-bit int to memory. | |
static void | le64enc (void *p, uint64_t x) |
Write little-endian 64-bit int to memory. | |
static void | h16enc (void *p, uint16_t x) |
Write host-endian 16-bit int to memory. | |
static void | h32enc (void *p, uint32_t x) |
Write host-endian 32-bit int to memory. | |
static void | h64enc (void *p, uint64_t x) |
Write host-endian 64-bit int to memory. |
Endianess conversion macros.
-Endianess conversion, convert integers to bytes.
+#define htobe16 | +( | ++ | x | ) | ++ |
#define htobe32 | +( | ++ | x | ) | ++ |
#define htobe64 | +( | ++ | x | ) | ++ |
#define htole16 | +( | ++ | x | ) | ++ |
#define htole32 | +( | ++ | x | ) | ++ |
#define htole64 | +( | ++ | x | ) | ++ |
#define be16toh | +( | ++ | x | ) | ++ |
Convert big-endian 16-bit int to host-endian.
+ +#define be32toh | +( | ++ | x | ) | ++ |
Convert big-endian 32-bit int to host-endian.
+ +#define be64toh | +( | ++ | x | ) | ++ |
Convert big-endian 64-bit int to host-endian.
+ +#define le16toh | +( | ++ | x | ) | ++ |
Convert little-endian 64-bit int to host-endian.
+ +#define le32toh | +( | ++ | x | ) | ++ |
Convert little-endian 64-bit int to host-endian.
+ +#define le64toh | +( | ++ | x | ) | ++ |
Convert little-endian 64-bit int to host-endian.
+ +static uint16_t bswap16 | +( | +uint16_t | +x | ) | + [inline, static] |
+
Swap 16-bit int.
+ +static uint32_t bswap32 | +( | +uint32_t | +x | ) | + [inline, static] |
+
Swap 32-bit int.
+ +Referenced by bswap64().
+ +static uint64_t bswap64 | +( | +uint64_t | +x | ) | + [inline, static] |
+
Swap 64-bit int.
+ +References bswap32().
+ +static uint16_t be16dec | +( | +const void * | +p | ) | + [inline, static] |
+
Read big-endian 16-bit int from memory.
+ +References htobe16.
+ +static uint32_t be32dec | +( | +const void * | +p | ) | + [inline, static] |
+
Read big-endian 32-bit int from memory.
+ +References htobe32.
+ +static uint64_t be64dec | +( | +const void * | +p | ) | + [inline, static] |
+
Read big-endian 64-bit int from memory.
+ +References htobe64.
+ +static uint16_t le16dec | +( | +const void * | +p | ) | + [inline, static] |
+
Read little-endian 16-bit int from memory.
+ +References htole16.
+ +static uint32_t le32dec | +( | +const void * | +p | ) | + [inline, static] |
+
Read little-endian 32-bit int from memory.
+ +References htole32.
+ +static uint64_t le64dec | +( | +const void * | +p | ) | + [inline, static] |
+
Read little-endian 64-bit int from memory.
+ +References htole64.
+ +static uint16_t h16dec | +( | +const void * | +p | ) | + [inline, static] |
+
Read host-endian 16-bit int from memory.
+ +static uint32_t h32dec | +( | +const void * | +p | ) | + [inline, static] |
+
Read host-endian 32-bit int from memory.
+ +static uint64_t h64dec | +( | +const void * | +p | ) | + [inline, static] |
+
Read host-endian 64-bit int from memory.
+ +static void be16enc | +( | +void * | +p, | +
+ | + | uint16_t | +x | +
+ | ) | + [inline, static] |
+
Write big-endian 16-bit int to memory.
+ +References htobe16.
+ +static void be32enc | +( | +void * | +p, | +
+ | + | uint32_t | +x | +
+ | ) | + [inline, static] |
+
Write big-endian 32-bit int to memory.
+ +References htobe32.
+ +static void be64enc | +( | +void * | +p, | +
+ | + | uint64_t | +x | +
+ | ) | + [inline, static] |
+
Write big-endian 64-bit int to memory.
+ +References htobe64.
+ +static void le16enc | +( | +void * | +p, | +
+ | + | uint16_t | +x | +
+ | ) | + [inline, static] |
+
Write little-endian 16-bit int to memory.
+ +References htole16.
+ +static void le32enc | +( | +void * | +p, | +
+ | + | uint32_t | +x | +
+ | ) | + [inline, static] |
+
Write little-endian 32-bit int to memory.
+ +References htole32.
+ +static void le64enc | +( | +void * | +p, | +
+ | + | uint64_t | +x | +
+ | ) | + [inline, static] |
+
Write little-endian 64-bit int to memory.
+ +References htole64.
+ +static void h16enc | +( | +void * | +p, | +
+ | + | uint16_t | +x | +
+ | ) | + [inline, static] |
+
Write host-endian 16-bit int to memory.
+ +static void h32enc | +( | +void * | +p, | +
+ | + | uint32_t | +x | +
+ | ) | + [inline, static] |
+
Write host-endian 32-bit int to memory.
+ +static void h64enc | +( | +void * | +p, | +
+ | + | uint64_t | +x | +
+ | ) | + [inline, static] |
+
Write host-endian 64-bit int to memory.
+ +
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
Load entropy from OS. +More...
++Functions | |
int | getentropy (void *dst, size_t len) |
Fetch entropy from OS kernel. |
Load entropy from OS.
+int getentropy | +( | +void * | +dst, | +
+ | + | size_t | +len | +
+ | ) | ++ |
Fetch entropy from OS kernel.
+ +Functions | |
void | err (int e, const char *fmt,...) _PRINTF(2 |
void | err (int e, const char *fmt,...) _PRINTF(2 |
Print formatted message and strerror(errno) to stderr and exit with given error code. | |
void void | errx (int e, const char *fmt,...) _PRINTF(2 |
void void | errx (int e, const char *fmt,...) _PRINTF(2 |
Print formatted message to stderr and exit with given error code. | |
void void void | warn (const char *fmt,...) _PRINTF(1 |
void void void | warn (const char *fmt,...) _PRINTF(1 |
Print formatted message and strerror(errno) to stderr. | |
void void void void | warnx (const char *fmt,...) _PRINTF(1 |
void void void void | warnx (const char *fmt,...) _PRINTF(1 |
Print formatted message to stderr. | |
void void void void void | setprogname (const char *s) |
Set program name to that will printed as prefix to error messages. | |
usual/aatree.h | AA-Tree - Binary tree with embeddable nodes |
usual/base.h | Basic C environment |
usual/bits.h | Bit arithmetics |
usual/bytemap.h | Map 256 byte values to bit or int |
usual/cbtree.h | Crit-bit tree / binary radix tree |
usual/cfparser.h | Config file parser |
usual/ctype.h | Ctype compat |
usual/cxalloc.h | Context-based Memory Allocator |
usual/cxextra.h | Extra allocators for cxalloc |
usual/daemon.h | Daemonization & pidfile handling |
usual/endian.h | Endianess conversion macros |
usual/endian.h | Endianess conversion, convert integers to bytes |
usual/err.h | Error printing for command-line utilities |
usual/event.h | Libevent compat |
usual/fileutil.h | File access utils |
usual/getopt.h | Getopt compat |
usual/hashtab-impl.h | Simple customizable hashtable implementation |
usual/heap.h | Binary heap |
usual/json.h | Read and write JSON |
usual/list.h | Circular doubly linked list |
usual/logging.h | Logging framework for unix services |
usual/mbuf.h | Safe and easy access to memory buffer |
usual/statlist.h | Circular list that keep track of stats about the list |
usual/string.h | Theme include for strings |
usual/strpool.h | Storage for shared strings |
usual/talloc.h | Talloc - hierarchical memory allocator |
usual/time.h | *Time-related functionality |
usual/utf8.h | Low-level UTF8 handling |
usual/crypto/chacha.h | ChaCha cipher |
usual/crypto/csrandom.h | Cryptographically Secure Randomness |
usual/crypto/digest.h | Common API for cryptographic digests |
usual/crypto/entropy.h | Load entropy from OS |
usual/crypto/hmac.h | HMAC-SHA1 implementation (RFC2104) |
usual/crypto/keccak.h | Keccak with SHA3 parameters |
usual/crypto/keccak.h | Simple API to Keccak1600 permutation + sponge |
usual/crypto/keccak_prng.h | Implements PRNG mode for Keccak sponge function |
usual/crypto/md5.h | MD5 cryptographic hash |
usual/crypto/sha1.h | SHA1 implementation |
usual/crypto/sha256.h | SHA256 and SHA224 cryptographic hashes |
usual/crypto/sha3.h | SHA3 variants of Keccak |
usual/crypto/sha512.h | SHA512 and SHA384 cryptographic hashes |
usual/hashing/crc32.h | CRC32 checksum |
usual/hashing/lookup3.h | Jenkins' lookup3 non-cryptographic hash |
usual/hashing/memhash.h | Randomized in-memory hashing |
usual/hashing/siphash.h | SipHash-2-4 |
usual/hashing/spooky.h | Jenkins SpookyHash V2 - fast hash for 64-bit CPUs |
usual/hashing/xxhash.h | XxHash - fast hash for 32-bit cpu's |
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
Read and write JSON. +More...
++Typedefs | |
typedef bool(* | json_dict_iter_callback_f )(void *arg, struct JsonValue *key, struct JsonValue *val) |
Callback for dict iterator. | |
typedef bool(* | json_list_iter_callback_f )(void *arg, struct JsonValue *elem) |
Callback for list iterator. | |
+Enumerations | |
enum | JsonValueType { + JSON_NULL, +JSON_BOOL, +JSON_INT, +JSON_FLOAT, + + JSON_STRING, +JSON_LIST, +JSON_DICT + + } |
JSON value types. More... | |
enum | JsonParseOptions { JSON_STRICT, +JSON_PARSE_RELAXED, +JSON_PARSE_IGNORE_ENCODING + } |
Options for JSON parser. More... | |
+Functions | |
Allocation context. | |
struct JsonContext * | json_new_context (const void *cx_mem, size_t initial_mem) |
Create allocation context. | |
void | json_free_context (struct JsonContext *ctx) |
Create allocation context. | |
const char * | json_strerror (struct JsonContext *ctx) |
Create allocation context. | |
Parse JSON | |
struct JsonValue * | json_parse (struct JsonContext *ctx, const char *src, size_t length) |
Parse JSON string. | |
void | json_set_options (struct JsonContext *ctx, unsigned int options) |
Set parsing options. | |
Examine single value | |
enum JsonValueType | json_value_type (struct JsonValue *jv) |
Return type for value. | |
size_t | json_value_size (struct JsonValue *jv) |
Return element size. | |
static bool | json_value_is_null (struct JsonValue *jv) |
Return true if value is null. | |
static bool | json_value_is_bool (struct JsonValue *jv) |
Return true if value is boolean. | |
static bool | json_value_is_int (struct JsonValue *jv) |
Return true if value is int. | |
static bool | json_value_is_float (struct JsonValue *jv) |
Return true if value is float. | |
static bool | json_value_is_string (struct JsonValue *jv) |
Return true if value is string. | |
static bool | json_value_is_list (struct JsonValue *jv) |
Return true if value is list. | |
static bool | json_value_is_dict (struct JsonValue *jv) |
Return true if value is dict. | |
bool | json_value_as_bool (struct JsonValue *jv, bool *dst_p) |
Get bool value. | |
bool | json_value_as_int (struct JsonValue *jv, int64_t *dst_p) |
Get int value. | |
bool | json_value_as_float (struct JsonValue *jv, double *dst_p) |
Get double value. | |
bool | json_value_as_string (struct JsonValue *jv, const char **dst_p, size_t *size_p) |
Get string value. | |
Get values from dict | |
bool | json_dict_get_value (struct JsonValue *dict, const char *key, struct JsonValue **val_p) |
Get key value from dict. | |
bool | json_dict_is_null (struct JsonValue *jv, const char *key) |
Return true if value is null or missing. | |
bool | json_dict_get_bool (struct JsonValue *jv, const char *key, bool *dst_p) |
Get boolean value from dict. | |
bool | json_dict_get_int (struct JsonValue *jv, const char *key, int64_t *dst_p) |
Get int value from dict. | |
bool | json_dict_get_float (struct JsonValue *jv, const char *key, double *dst_p) |
Get float value from dict. | |
bool | json_dict_get_string (struct JsonValue *jv, const char *key, const char **dst_p, size_t *len_p) |
Get string value from dict. | |
bool | json_dict_get_dict (struct JsonValue *jv, const char *key, struct JsonValue **dst_p) |
Get sub-dict from dict. | |
bool | json_dict_get_list (struct JsonValue *jv, const char *key, struct JsonValue **dst_p) |
Get list from dict. | |
bool | json_dict_get_opt_bool (struct JsonValue *jv, const char *key, bool *dst_p) |
Get optional bool from dict. | |
bool | json_dict_get_opt_int (struct JsonValue *jv, const char *key, int64_t *dst_p) |
Get optional int from dict. | |
bool | json_dict_get_opt_float (struct JsonValue *jv, const char *key, double *dst_p) |
Get optional float from dict. | |
bool | json_dict_get_opt_string (struct JsonValue *jv, const char *key, const char **dst_p, size_t *len_p) |
Get optional string from dict. | |
bool | json_dict_get_opt_list (struct JsonValue *jv, const char *key, struct JsonValue **dst_p) |
Get optional list from dict. | |
bool | json_dict_get_opt_dict (struct JsonValue *jv, const char *key, struct JsonValue **dst_p) |
Get optional dict from dict. | |
Get values from list. | |
bool | json_list_get_value (struct JsonValue *list, size_t index, struct JsonValue **val_p) |
Get value from list. | |
bool | json_list_is_null (struct JsonValue *list, size_t index) |
Return true if value is null or missing. | |
bool | json_list_get_bool (struct JsonValue *list, size_t index, bool *val_p) |
Get bool from list. | |
bool | json_list_get_int (struct JsonValue *list, size_t index, int64_t *val_p) |
Get int from list. | |
bool | json_list_get_float (struct JsonValue *list, size_t index, double *val_p) |
Get float from list. | |
bool | json_list_get_string (struct JsonValue *list, size_t index, const char **val_p, size_t *len_p) |
Get string from list. | |
bool | json_list_get_list (struct JsonValue *list, size_t index, struct JsonValue **val_p) |
Get list value from list. | |
bool | json_list_get_dict (struct JsonValue *list, size_t index, struct JsonValue **val_p) |
Get dict value from list. | |
Iterate over elements in list/dict. | |
bool | json_dict_iter (struct JsonValue *dict, json_dict_iter_callback_f cb_func, void *cb_arg) |
Walk over dict elements. | |
bool | json_list_iter (struct JsonValue *list, json_list_iter_callback_f cb_func, void *cb_arg) |
Walk over list elements. | |
Output JSON. | |
bool | json_render (struct MBuf *dst, struct JsonValue *jv) |
Render JSON object as string. | |
Create new values. | |
struct JsonValue * | json_new_null (struct JsonContext *ctx) |
Create NULL value. | |
struct JsonValue * | json_new_bool (struct JsonContext *ctx, bool val) |
Create bool value. | |
struct JsonValue * | json_new_int (struct JsonContext *ctx, int64_t val) |
Create int value. | |
struct JsonValue * | json_new_float (struct JsonContext *ctx, double val) |
Create float value. | |
struct JsonValue * | json_new_string (struct JsonContext *ctx, const char *val) |
Create string value. | |
struct JsonValue * | json_new_dict (struct JsonContext *ctx) |
Create dict value. | |
struct JsonValue * | json_new_list (struct JsonContext *ctx) |
Create list value. | |
Add values to containers. | |
bool | json_list_append (struct JsonValue *list, struct JsonValue *elem) |
Add value to list. | |
bool | json_list_append_null (struct JsonValue *list) |
Add null to list. | |
bool | json_list_append_bool (struct JsonValue *list, bool val) |
Add bool to list. | |
bool | json_list_append_int (struct JsonValue *list, int64_t val) |
Add int to list. | |
bool | json_list_append_float (struct JsonValue *list, double val) |
Add float to list. | |
bool | json_list_append_string (struct JsonValue *list, const char *val) |
Add string to list. | |
bool | json_dict_put (struct JsonValue *dict, const char *key, struct JsonValue *val) |
Add element to dict. | |
bool | json_dict_put_null (struct JsonValue *dict, const char *key) |
Add null to dict. | |
bool | json_dict_put_bool (struct JsonValue *dict, const char *key, bool val) |
Add bool to dict. | |
bool | json_dict_put_int (struct JsonValue *dict, const char *key, int64_t val) |
Add int to dict. | |
bool | json_dict_put_float (struct JsonValue *dict, const char *key, double val) |
Add float to dict. | |
bool | json_dict_put_string (struct JsonValue *dict, const char *key, const char *str) |
Add string to dict. |
Read and write JSON.
+Features:
+Optional features for JSON config files, off by default:
+typedef bool(* json_dict_iter_callback_f)(void *arg, struct JsonValue *key, struct JsonValue *val) | +
Callback for dict iterator.
+ +typedef bool(* json_list_iter_callback_f)(void *arg, struct JsonValue *elem) | +
Callback for list iterator.
+ +enum JsonValueType | +
JSON value types.
+Returned by json_value_type().
+ + +enum JsonParseOptions | +
Options for JSON parser.
+ + +struct JsonContext* json_new_context | +( | +const void * | +cx_mem, | +
+ | + | size_t | +initial_mem | +
+ | ) | + [read] |
+
Create allocation context.
+ +void json_free_context | +( | +struct JsonContext * | +ctx | ) | ++ |
Create allocation context.
+ +const char* json_strerror | +( | +struct JsonContext * | +ctx | ) | ++ |
Create allocation context.
+ +struct JsonValue* json_parse | +( | +struct JsonContext * | +ctx, | +
+ | + | const char * | +src, | +
+ | + | size_t | +length | +
+ | ) | + [read] |
+
Parse JSON string.
+ +void json_set_options | +( | +struct JsonContext * | +ctx, | +
+ | + | unsigned int | +options | +
+ | ) | ++ |
Set parsing options.
+ +enum JsonValueType json_value_type | +( | +struct JsonValue * | +jv | ) | ++ |
Return type for value.
+ +Referenced by json_value_is_bool(), json_value_is_dict(), json_value_is_float(), json_value_is_int(), json_value_is_list(), json_value_is_null(), and json_value_is_string().
+ +size_t json_value_size | +( | +struct JsonValue * | +jv | ) | ++ |
Return element size.
+For JSON strings, it's bytes in string, for list and dict it returns number of elements.
+ +static bool json_value_is_null | +( | +struct JsonValue * | +jv | ) | + [inline, static] |
+
Return true if value is null.
+ +References JSON_NULL, and json_value_type().
+ +static bool json_value_is_bool | +( | +struct JsonValue * | +jv | ) | + [inline, static] |
+
Return true if value is boolean.
+ +References JSON_BOOL, and json_value_type().
+ +static bool json_value_is_int | +( | +struct JsonValue * | +jv | ) | + [inline, static] |
+
Return true if value is int.
+ +References JSON_INT, and json_value_type().
+ +static bool json_value_is_float | +( | +struct JsonValue * | +jv | ) | + [inline, static] |
+
Return true if value is float.
+ +References JSON_FLOAT, and json_value_type().
+ +static bool json_value_is_string | +( | +struct JsonValue * | +jv | ) | + [inline, static] |
+
Return true if value is string.
+ +References JSON_STRING, and json_value_type().
+ +static bool json_value_is_list | +( | +struct JsonValue * | +jv | ) | + [inline, static] |
+
Return true if value is list.
+ +References JSON_LIST, and json_value_type().
+ +static bool json_value_is_dict | +( | +struct JsonValue * | +jv | ) | + [inline, static] |
+
Return true if value is dict.
+ +References JSON_DICT, and json_value_type().
+ +bool json_value_as_bool | +( | +struct JsonValue * | +jv, | +
+ | + | bool * | +dst_p | +
+ | ) | ++ |
Get bool value.
+ +bool json_value_as_int | +( | +struct JsonValue * | +jv, | +
+ | + | int64_t * | +dst_p | +
+ | ) | ++ |
Get int value.
+ +bool json_value_as_float | +( | +struct JsonValue * | +jv, | +
+ | + | double * | +dst_p | +
+ | ) | ++ |
Get double value.
+ +bool json_value_as_string | +( | +struct JsonValue * | +jv, | +
+ | + | const char ** | +dst_p, | +
+ | + | size_t * | +size_p | +
+ | ) | ++ |
Get string value.
+ +bool json_dict_get_value | +( | +struct JsonValue * | +dict, | +
+ | + | const char * | +key, | +
+ | + | struct JsonValue ** | +val_p | +
+ | ) | ++ |
Get key value from dict.
+ +bool json_dict_is_null | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key | +
+ | ) | ++ |
Return true if value is null or missing.
+ +bool json_dict_get_bool | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key, | +
+ | + | bool * | +dst_p | +
+ | ) | ++ |
Get boolean value from dict.
+ +bool json_dict_get_int | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key, | +
+ | + | int64_t * | +dst_p | +
+ | ) | ++ |
Get int value from dict.
+ +bool json_dict_get_float | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key, | +
+ | + | double * | +dst_p | +
+ | ) | ++ |
Get float value from dict.
+ +bool json_dict_get_string | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key, | +
+ | + | const char ** | +dst_p, | +
+ | + | size_t * | +len_p | +
+ | ) | ++ |
Get string value from dict.
+ +bool json_dict_get_dict | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key, | +
+ | + | struct JsonValue ** | +dst_p | +
+ | ) | ++ |
Get sub-dict from dict.
+ +bool json_dict_get_list | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key, | +
+ | + | struct JsonValue ** | +dst_p | +
+ | ) | ++ |
Get list from dict.
+ +bool json_dict_get_opt_bool | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key, | +
+ | + | bool * | +dst_p | +
+ | ) | ++ |
Get optional bool from dict.
+ +bool json_dict_get_opt_int | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key, | +
+ | + | int64_t * | +dst_p | +
+ | ) | ++ |
Get optional int from dict.
+ +bool json_dict_get_opt_float | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key, | +
+ | + | double * | +dst_p | +
+ | ) | ++ |
Get optional float from dict.
+ +bool json_dict_get_opt_string | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key, | +
+ | + | const char ** | +dst_p, | +
+ | + | size_t * | +len_p | +
+ | ) | ++ |
Get optional string from dict.
+ +bool json_dict_get_opt_list | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key, | +
+ | + | struct JsonValue ** | +dst_p | +
+ | ) | ++ |
Get optional list from dict.
+ +bool json_dict_get_opt_dict | +( | +struct JsonValue * | +jv, | +
+ | + | const char * | +key, | +
+ | + | struct JsonValue ** | +dst_p | +
+ | ) | ++ |
Get optional dict from dict.
+ +bool json_list_get_value | +( | +struct JsonValue * | +list, | +
+ | + | size_t | +index, | +
+ | + | struct JsonValue ** | +val_p | +
+ | ) | ++ |
Get value from list.
+ +bool json_list_is_null | +( | +struct JsonValue * | +list, | +
+ | + | size_t | +index | +
+ | ) | ++ |
Return true if value is null or missing.
+ +bool json_list_get_bool | +( | +struct JsonValue * | +list, | +
+ | + | size_t | +index, | +
+ | + | bool * | +val_p | +
+ | ) | ++ |
Get bool from list.
+ +bool json_list_get_int | +( | +struct JsonValue * | +list, | +
+ | + | size_t | +index, | +
+ | + | int64_t * | +val_p | +
+ | ) | ++ |
Get int from list.
+ +bool json_list_get_float | +( | +struct JsonValue * | +list, | +
+ | + | size_t | +index, | +
+ | + | double * | +val_p | +
+ | ) | ++ |
Get float from list.
+ +bool json_list_get_string | +( | +struct JsonValue * | +list, | +
+ | + | size_t | +index, | +
+ | + | const char ** | +val_p, | +
+ | + | size_t * | +len_p | +
+ | ) | ++ |
Get string from list.
+ +bool json_list_get_list | +( | +struct JsonValue * | +list, | +
+ | + | size_t | +index, | +
+ | + | struct JsonValue ** | +val_p | +
+ | ) | ++ |
Get list value from list.
+ +bool json_list_get_dict | +( | +struct JsonValue * | +list, | +
+ | + | size_t | +index, | +
+ | + | struct JsonValue ** | +val_p | +
+ | ) | ++ |
Get dict value from list.
+ +bool json_dict_iter | +( | +struct JsonValue * | +dict, | +
+ | + | json_dict_iter_callback_f | +cb_func, | +
+ | + | void * | +cb_arg | +
+ | ) | ++ |
Walk over dict elements.
+ +bool json_list_iter | +( | +struct JsonValue * | +list, | +
+ | + | json_list_iter_callback_f | +cb_func, | +
+ | + | void * | +cb_arg | +
+ | ) | ++ |
Walk over list elements.
+ +bool json_render | +( | +struct MBuf * | +dst, | +
+ | + | struct JsonValue * | +jv | +
+ | ) | ++ |
Render JSON object as string.
+ +struct JsonValue* json_new_null | +( | +struct JsonContext * | +ctx | ) | + [read] |
+
Create NULL value.
+ +struct JsonValue* json_new_bool | +( | +struct JsonContext * | +ctx, | +
+ | + | bool | +val | +
+ | ) | + [read] |
+
Create bool value.
+ +struct JsonValue* json_new_int | +( | +struct JsonContext * | +ctx, | +
+ | + | int64_t | +val | +
+ | ) | + [read] |
+
Create int value.
+ +struct JsonValue* json_new_float | +( | +struct JsonContext * | +ctx, | +
+ | + | double | +val | +
+ | ) | + [read] |
+
Create float value.
+ +struct JsonValue* json_new_string | +( | +struct JsonContext * | +ctx, | +
+ | + | const char * | +val | +
+ | ) | + [read] |
+
Create string value.
+ +struct JsonValue* json_new_dict | +( | +struct JsonContext * | +ctx | ) | + [read] |
+
Create dict value.
+ +struct JsonValue* json_new_list | +( | +struct JsonContext * | +ctx | ) | + [read] |
+
Create list value.
+ +bool json_list_append | +( | +struct JsonValue * | +list, | +
+ | + | struct JsonValue * | +elem | +
+ | ) | ++ |
Add value to list.
+ +bool json_list_append_null | +( | +struct JsonValue * | +list | ) | ++ |
Add null to list.
+ +bool json_list_append_bool | +( | +struct JsonValue * | +list, | +
+ | + | bool | +val | +
+ | ) | ++ |
Add bool to list.
+ +bool json_list_append_int | +( | +struct JsonValue * | +list, | +
+ | + | int64_t | +val | +
+ | ) | ++ |
Add int to list.
+ +bool json_list_append_float | +( | +struct JsonValue * | +list, | +
+ | + | double | +val | +
+ | ) | ++ |
Add float to list.
+ +bool json_list_append_string | +( | +struct JsonValue * | +list, | +
+ | + | const char * | +val | +
+ | ) | ++ |
Add string to list.
+ +bool json_dict_put | +( | +struct JsonValue * | +dict, | +
+ | + | const char * | +key, | +
+ | + | struct JsonValue * | +val | +
+ | ) | ++ |
Add element to dict.
+ +bool json_dict_put_null | +( | +struct JsonValue * | +dict, | +
+ | + | const char * | +key | +
+ | ) | ++ |
Add null to dict.
+ +bool json_dict_put_bool | +( | +struct JsonValue * | +dict, | +
+ | + | const char * | +key, | +
+ | + | bool | +val | +
+ | ) | ++ |
Add bool to dict.
+ +bool json_dict_put_int | +( | +struct JsonValue * | +dict, | +
+ | + | const char * | +key, | +
+ | + | int64_t | +val | +
+ | ) | ++ |
Add int to dict.
+ +bool json_dict_put_float | +( | +struct JsonValue * | +dict, | +
+ | + | const char * | +key, | +
+ | + | double | +val | +
+ | ) | ++ |
Add float to dict.
+ +bool json_dict_put_string | +( | +struct JsonValue * | +dict, | +
+ | + | const char * | +key, | +
+ | + | const char * | +str | +
+ | ) | ++ |
Add string to dict.
+ +Keccak with SHA3 parameters. +
Simple API to Keccak1600 permutation + sponge. More...
Data Structures | |
struct | KeccakContext |
Keccak state structure for all modes. More... | |
-Defines | |
#define | KECCAK224_DIGEST_LENGTH |
Output length for 224-bit mode (in bytes) | |
#define | KECCAK256_DIGEST_LENGTH |
Output length for 256-bit mode (in bytes) | |
#define | KECCAK384_DIGEST_LENGTH |
Output length for 384-bit mode (in bytes) | |
#define | KECCAK512_DIGEST_LENGTH |
Output length for 512-bit mode (in bytes) | |
#define | KECCAK224_BLOCK_SIZE |
Number of data bytes processed in one loop. | |
#define | KECCAK256_BLOCK_SIZE |
Number of data bytes processed in one loop. | |
#define | KECCAK384_BLOCK_SIZE |
Number of data bytes processed in one loop. | |
#define | KECCAK512_BLOCK_SIZE |
Number of data bytes processed in one loop. | |
#define | KECCAK_STREAM_BLOCK_SIZE |
Number of data bytes processed in one go. | |
#define | KECCAK_STREAM_DIGEST_LENGTH |
Output length for stream mode (in bytes). | |
Functions | |
void | keccak224_init (struct KeccakContext *ctx) |
SHA3 fixed length output mode. | |
void | keccak256_init (struct KeccakContext *ctx) |
SHA3 fixed length output mode. | |
void | keccak384_init (struct KeccakContext *ctx) |
SHA3 fixed length output mode. | |
void | keccak512_init (struct KeccakContext *ctx) |
SHA3 fixed length output mode. | |
void | keccak_stream_init (struct KeccakContext *ctx) |
SHA3 stream mode for Keccak. | |
void | keccak_update (struct KeccakContext *ctx, const void *data, unsigned int len) |
Hash additional data. | |
void | keccak_final (struct KeccakContext *ctx, uint8_t *dst) |
Return final result. | |
int | keccak_init (struct KeccakContext *ctx, unsigned int capacity) |
Set up state with specified capacity. | |
void | keccak_absorb (struct KeccakContext *ctx, const void *data, size_t len) |
Hash additional data. | |
void | keccak_squeeze (struct KeccakContext *ctx, uint8_t *dst, size_t len) |
Extract bytes from state. | |
void | keccak_squeeze_xor (struct KeccakContext *ctx, uint8_t *dst, const void *src, size_t len) |
Extract bytes from state, XOR into data. | |
void | keccak_encrypt (struct KeccakContext *ctx, uint8_t *dst, const void *src, size_t len) |
XOR data into state and return it. | |
void | keccak_decrypt (struct KeccakContext *ctx, uint8_t *dst, const void *src, size_t len) |
XOR state with data and return it. | |
void | keccak_pad (struct KeccakContext *ctx, const void *data, size_t len) |
Hash pad suffix. | |
void | keccak_rewind (struct KeccakContext *ctx) |
Move internal position to start of buffer. | |
void | keccak_forget (struct KeccakContext *ctx) |
Clear rate bits. |
Keccak with SHA3 parameters.
-Simple API to Keccak1600 permutation + sponge.
+#define KECCAK224_DIGEST_LENGTH | +int keccak_init | +( | +struct KeccakContext * | +ctx, |
Output length for 224-bit mode (in bytes)
- -#define KECCAK256_DIGEST_LENGTH | ++ | + | unsigned int | +capacity |
Output length for 256-bit mode (in bytes)
- -#define KECCAK384_DIGEST_LENGTH | ++ | ) | +
Output length for 384-bit mode (in bytes)
+Set up state with specified capacity.
+Returns 1 if successful, 0 if invalid capacity.
#define KECCAK512_DIGEST_LENGTH | +void keccak_absorb | +( | +struct KeccakContext * | +ctx, |
Output length for 512-bit mode (in bytes)
- -#define KECCAK224_BLOCK_SIZE | ++ | + | const void * | +data, |
Number of data bytes processed in one loop.
- -#define KECCAK256_BLOCK_SIZE | ++ | + | size_t | +len |
Number of data bytes processed in one loop.
- -#define KECCAK384_BLOCK_SIZE | ++ | ) | +
Number of data bytes processed in one loop.
+Hash additional data.
#define KECCAK512_BLOCK_SIZE | +void keccak_squeeze | +( | +struct KeccakContext * | +ctx, |
Number of data bytes processed in one loop.
- -#define KECCAK_STREAM_BLOCK_SIZE | ++ | + | uint8_t * | +dst, |
Number of data bytes processed in one go.
- -#define KECCAK_STREAM_DIGEST_LENGTH | ++ | + | size_t | +len |
Output length for stream mode (in bytes).
-This means output from single call to keccak_final(). It can be called repeatedly to get more output.
- -void keccak224_init | -( | -struct KeccakContext * | -ctx | ) | + | ) | +
SHA3 fixed length output mode.
+Extract bytes from state.
void keccak256_init | +void keccak_squeeze_xor | ( | struct KeccakContext * | -ctx | ) | +ctx, | +
+ | uint8_t * | +dst, |
SHA3 fixed length output mode.
- -void keccak384_init | -( | -struct KeccakContext * | -ctx | ) | ++ | const void * | +src, | +|
+ | + | size_t | +len | +|||||
+ | ) | +
SHA3 fixed length output mode.
+Extract bytes from state, XOR into data.
void keccak512_init | +void keccak_encrypt | ( | struct KeccakContext * | -ctx | ) | +ctx, | +
+ | + | uint8_t * | +dst, | +|||
+ | + | const void * | +src, | +|||
+ | + | size_t | +len | +|||
+ | ) | +
SHA3 fixed length output mode.
+XOR data into state and return it.
void keccak_stream_init | +void keccak_decrypt | ( | struct KeccakContext * | -ctx | ) | +ctx, | +
+ | uint8_t * | +dst, | +||||
+ | + | const void * | +src, | +|||
+ | + | size_t | +len | +|||
+ | ) | +
SHA3 stream mode for Keccak.
-In stream mode, keccak_final() can be called repeatedly to get output stream of unlimited length.
-On each call it outputs next 128 bytes (1024 bits).
+XOR state with data and return it.
void keccak_update | +void keccak_pad | ( | struct KeccakContext * | ctx, | @@ -378,7 +333,7 @@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- | unsigned int | +size_t | len | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
void keccak_final | +void keccak_rewind | ( | struct KeccakContext * | -ctx, | -|
+ | ctx | ) | - | uint8_t * | -dst |
Move internal position to start of buffer.
+Useful for PRNG/duplex modes.
+ +void keccak_forget | +( | +struct KeccakContext * | +ctx | ) | - | ) | -
Return final result.
-Output length depends on mode. See KECCAK*_DIGEST_LENGTH constants to get length for particular mode.
-In stream mode, this can be called repeatedly.
+Clear rate bits.
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
Implements PRNG mode for Keccak sponge function. +More...
++Data Structures | |
struct | KeccakPRNG |
State structure. More... | |
+Functions | |
bool | keccak_prng_init (struct KeccakPRNG *prng, int capacity) |
Setup Keccak with specified capacity. | |
void | keccak_prng_add_data (struct KeccakPRNG *prng, const void *data, size_t len) |
Merge entropy data into state. | |
bool | keccak_prng_extract (struct KeccakPRNG *prng, void *data, size_t len) |
Extract PRNG bytes from state. |
Implements PRNG mode for Keccak sponge function.
+bool keccak_prng_init | +( | +struct KeccakPRNG * | +prng, | +
+ | + | int | +capacity | +
+ | ) | ++ |
Setup Keccak with specified capacity.
+prng | State structure to be initialized. |
capacity | Keccak capacity in bits. |
void keccak_prng_add_data | +( | +struct KeccakPRNG * | +prng, | +
+ | + | const void * | +data, | +
+ | + | size_t | +len | +
+ | ) | ++ |
Merge entropy data into state.
+ +bool keccak_prng_extract | +( | +struct KeccakPRNG * | +prng, | +
+ | + | void * | +data, | +
+ | + | size_t | +len | +
+ | ) | ++ |
Extract PRNG bytes from state.
+static _MUSTCHECK bool mbuf_get_byte | +static _MUSTCHECK bool mbuf_get_byte | ( | struct MBuf * | buf, | @@ -512,7 +512,7 @@
static _MUSTCHECK bool mbuf_get_char | +static _MUSTCHECK bool mbuf_get_char | ( | struct MBuf * | buf, | @@ -541,7 +541,7 @@
static _MUSTCHECK bool mbuf_get_uint32be | +static _MUSTCHECK bool mbuf_get_uint32be | ( | struct MBuf * | buf, | @@ -572,7 +572,7 @@
static _MUSTCHECK bool mbuf_get_uint64be | +static _MUSTCHECK bool mbuf_get_uint64be | ( | struct MBuf * | buf, | @@ -603,7 +603,7 @@
static _MUSTCHECK bool mbuf_get_chars | +static _MUSTCHECK bool mbuf_get_chars | ( | struct MBuf * | buf, | @@ -638,7 +638,7 @@
_MUSTCHECK bool mbuf_make_room | +_MUSTCHECK bool mbuf_make_room | ( | struct MBuf * | buf, | @@ -669,7 +669,7 @@
static _MUSTCHECK bool mbuf_write_byte | +static _MUSTCHECK bool mbuf_write_byte | ( | struct MBuf * | buf, | @@ -700,7 +700,7 @@
static _MUSTCHECK bool mbuf_write | +static _MUSTCHECK bool mbuf_write | ( | struct MBuf * | buf, | @@ -739,7 +739,7 @@
static _MUSTCHECK bool mbuf_write_raw_mbuf | +static _MUSTCHECK bool mbuf_write_raw_mbuf | ( | struct MBuf * | dst, | @@ -770,7 +770,7 @@
static _MUSTCHECK bool mbuf_write_mbuf | +static _MUSTCHECK bool mbuf_write_mbuf | ( | struct MBuf * | dst, | @@ -807,7 +807,7 @@
static _MUSTCHECK bool mbuf_fill | +static _MUSTCHECK bool mbuf_fill | ( | struct MBuf * | buf, | @@ -844,7 +844,7 @@
static _MUSTCHECK bool mbuf_cut | +static _MUSTCHECK bool mbuf_cut | ( | struct MBuf * | buf, | diff --git a/memhash_8h.html b/memhash_8h.html new file mode 100644 index 0000000..ddb6f1e --- /dev/null +++ b/memhash_8h.html @@ -0,0 +1,172 @@ + + + + + +
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
Randomized in-memory hashing. +More...
++Functions | |
uint32_t | memhash (const void *data, size_t len) |
Hash data. | |
uint32_t | memhash_string (const char *s) |
Hash zero-terminated string. | |
uint32_t | memhash_seed (const void *data, size_t len, uint32_t seed) |
Hash with given seed. |
Randomized in-memory hashing.
+Functions here use randomized seed and pick fastest hash for current CPU.
+uint32_t memhash | +( | +const void * | +data, | +
+ | + | size_t | +len | +
+ | ) | ++ |
Hash data.
+ +uint32_t memhash_string | +( | +const char * | +s | ) | ++ |
Hash zero-terminated string.
+ +uint32_t memhash_seed | +( | +const void * | +data, | +
+ | + | size_t | +len, | +
+ | + | uint32_t | +seed | +
+ | ) | ++ |
Hash with given seed.
+Result is not randomized, but still may vary on different CPU-s.
+ +Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
void * | mempool_alloc (struct MemPool **pool, unsigned size) _MALLOC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
void * | mempool_alloc (struct MemPool **pool, unsigned size) _MALLOC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Allocate from pool. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
void | mempool_destroy (struct MemPool **pool) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Release all memory in pool. |
Functions | |
int | safe_read (int fd, void *buf, int len) _MUSTCHECK |
int | safe_read (int fd, void *buf, int len) _MUSTCHECK |
read | |
int | safe_write (int fd, const void *buf, int len) _MUSTCHECK |
int | safe_write (int fd, const void *buf, int len) _MUSTCHECK |
write | |
int | safe_recv (int fd, void *buf, int len, int flags) _MUSTCHECK |
int | safe_recv (int fd, void *buf, int len, int flags) _MUSTCHECK |
recv | |
int | safe_send (int fd, const void *buf, int len, int flags) _MUSTCHECK |
int | safe_send (int fd, const void *buf, int len, int flags) _MUSTCHECK |
send | |
int | safe_close (int fd) |
close | |
int | safe_recvmsg (int fd, struct msghdr *msg, int flags) _MUSTCHECK |
int | safe_recvmsg (int fd, struct msghdr *msg, int flags) _MUSTCHECK |
recvmsg | |
int | safe_sendmsg (int fd, const struct msghdr *msg, int flags) _MUSTCHECK |
int | safe_sendmsg (int fd, const struct msghdr *msg, int flags) _MUSTCHECK |
sendmsg | |
int | safe_connect (int fd, const struct sockaddr *sa, socklen_t sa_len) _MUSTCHECK |
int | safe_connect (int fd, const struct sockaddr *sa, socklen_t sa_len) _MUSTCHECK |
connect | |
int | safe_accept (int fd, struct sockaddr *sa, socklen_t *sa_len) _MUSTCHECK |
int | safe_accept (int fd, struct sockaddr *sa, socklen_t *sa_len) _MUSTCHECK |
accept |
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
SHA256 and SHA224 cryptographic hashes. +More...
++Data Structures | |
struct | sha256_ctx |
State structure for both SHA256 and SHA224. More... | |
+Defines | |
#define | SHA224_BLOCK_SIZE |
SHA224 block size in bytes. | |
#define | SHA256_BLOCK_SIZE |
SHA256 block size in bytes. | |
#define | SHA224_DIGEST_LENGTH |
SHA224 result length in bytes. | |
#define | SHA256_DIGEST_LENGTH |
SHA256 result length in bytes. | |
+Functions | |
void | sha256_reset (struct sha256_ctx *ctx) |
Initialize structure for SHA256. | |
void | sha256_update (struct sha256_ctx *ctx, const void *data, unsigned int len) |
Process more data. | |
void | sha256_final (struct sha256_ctx *ctx, uint8_t *dst) |
Calculate final result. | |
void | sha224_reset (struct sha256_ctx *ctx) |
Initialize structure for SHA224. | |
void | sha224_update (struct sha256_ctx *ctx, const void *data, unsigned int len) |
Process more data. | |
void | sha224_final (struct sha256_ctx *ctx, uint8_t *dst) |
Calculate final result. |
SHA256 and SHA224 cryptographic hashes.
+#define SHA224_BLOCK_SIZE | +
SHA224 block size in bytes.
+ +#define SHA256_BLOCK_SIZE | +
SHA256 block size in bytes.
+ +#define SHA224_DIGEST_LENGTH | +
SHA224 result length in bytes.
+ +#define SHA256_DIGEST_LENGTH | +
SHA256 result length in bytes.
+ +void sha256_reset | +( | +struct sha256_ctx * | +ctx | ) | ++ |
Initialize structure for SHA256.
+ +void sha256_update | +( | +struct sha256_ctx * | +ctx, | +
+ | + | const void * | +data, | +
+ | + | unsigned int | +len | +
+ | ) | ++ |
Process more data.
+ +void sha256_final | +( | +struct sha256_ctx * | +ctx, | +
+ | + | uint8_t * | +dst | +
+ | ) | ++ |
Calculate final result.
+ +void sha224_reset | +( | +struct sha256_ctx * | +ctx | ) | ++ |
Initialize structure for SHA224.
+ +void sha224_update | +( | +struct sha256_ctx * | +ctx, | +
+ | + | const void * | +data, | +
+ | + | unsigned int | +len | +
+ | ) | ++ |
Process more data.
+ +void sha224_final | +( | +struct sha256_ctx * | +ctx, | +
+ | + | uint8_t * | +dst | +
+ | ) | ++ |
Calculate final result.
+ +
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
SHA3 variants of Keccak. +More...
++Data Structures | |
struct | SHA3Context |
State structure. More... | |
+Defines | |
#define | SHA3_224_CAPACITY |
Keccak capacity area for SHA3-224, in bits. | |
#define | SHA3_256_CAPACITY |
Keccak capacity area for SHA3-256, in bits. | |
#define | SHA3_384_CAPACITY |
Keccak capacity area for SHA3-384, in bits. | |
#define | SHA3_512_CAPACITY |
Keccak capacity area for SHA3-512, in bits. | |
#define | SHAKE128_CAPACITY |
Keccak capacity area for SHAKE128, in bits. | |
#define | SHAKE256_CAPACITY |
Keccak capacity area for SHAKE256, in bits. | |
#define | SHA3_224_DIGEST_LENGTH |
Result length of SHA3-224, in bytes. | |
#define | SHA3_256_DIGEST_LENGTH |
Result length of SHA3-256, in bytes. | |
#define | SHA3_384_DIGEST_LENGTH |
Result length of SHA3-384, in bytes. | |
#define | SHA3_512_DIGEST_LENGTH |
Result length of SHA3-512, in bytes. | |
#define | SHAKE128_DIGEST_LENGTH |
Result length of SHAKE128, in bytes. | |
#define | SHAKE256_DIGEST_LENGTH |
Result length of SHAKE256, in bytes. | |
#define | SHA3_224_BLOCK_SIZE |
Block size of SHA3-224, in bytes. | |
#define | SHA3_256_BLOCK_SIZE |
Block size of SHA3-256, in bytes. | |
#define | SHA3_384_BLOCK_SIZE |
Block size of SHA3-384, in bytes. | |
#define | SHA3_512_BLOCK_SIZE |
Block size of SHA3-512, in bytes. | |
#define | SHAKE128_BLOCK_SIZE |
Block size of SHAKE128, in bytes. | |
#define | SHAKE256_BLOCK_SIZE |
Block size of SHAKE256, in bytes. | |
+Functions | |
void | sha3_224_reset (struct SHA3Context *ctx) |
Initialize state for SHA3-224. | |
void | sha3_256_reset (struct SHA3Context *ctx) |
Initialize state for SHA3-256. | |
void | sha3_384_reset (struct SHA3Context *ctx) |
Initialize state for SHA3-384. | |
void | sha3_512_reset (struct SHA3Context *ctx) |
Initialize state for SHA3-512. | |
void | sha3_update (struct SHA3Context *ctx, const void *ptr, unsigned len) |
Process data, update state. | |
void | sha3_final (struct SHA3Context *ctx, void *dst) |
Calculate final result. | |
void | shake128_reset (struct SHA3Context *ctx) |
Initialize state for SHAKE128. | |
void | shake256_reset (struct SHA3Context *ctx) |
Initialize state for SHAKE256. | |
void | shake_update (struct SHA3Context *ctx, const void *ptr, unsigned len) |
Process data, update state. | |
void | shake_extract (struct SHA3Context *ctx, void *dst, unsigned count) |
Output variable amount of result data. |
SHA3 variants of Keccak.
+SHA3-X are fixed-length hashes, SHAKE is variable-length.
+#define SHA3_224_CAPACITY | +
Keccak capacity area for SHA3-224, in bits.
+ +#define SHA3_256_CAPACITY | +
Keccak capacity area for SHA3-256, in bits.
+ +#define SHA3_384_CAPACITY | +
Keccak capacity area for SHA3-384, in bits.
+ +#define SHA3_512_CAPACITY | +
Keccak capacity area for SHA3-512, in bits.
+ +#define SHAKE128_CAPACITY | +
Keccak capacity area for SHAKE128, in bits.
+ +#define SHAKE256_CAPACITY | +
Keccak capacity area for SHAKE256, in bits.
+ +#define SHA3_224_DIGEST_LENGTH | +
Result length of SHA3-224, in bytes.
+ +#define SHA3_256_DIGEST_LENGTH | +
Result length of SHA3-256, in bytes.
+ +#define SHA3_384_DIGEST_LENGTH | +
Result length of SHA3-384, in bytes.
+ +#define SHA3_512_DIGEST_LENGTH | +
Result length of SHA3-512, in bytes.
+ +#define SHAKE128_DIGEST_LENGTH | +
Result length of SHAKE128, in bytes.
+ +#define SHAKE256_DIGEST_LENGTH | +
Result length of SHAKE256, in bytes.
+ +#define SHA3_224_BLOCK_SIZE | +
Block size of SHA3-224, in bytes.
+ +#define SHA3_256_BLOCK_SIZE | +
Block size of SHA3-256, in bytes.
+ +#define SHA3_384_BLOCK_SIZE | +
Block size of SHA3-384, in bytes.
+ +#define SHA3_512_BLOCK_SIZE | +
Block size of SHA3-512, in bytes.
+ +#define SHAKE128_BLOCK_SIZE | +
Block size of SHAKE128, in bytes.
+ +#define SHAKE256_BLOCK_SIZE | +
Block size of SHAKE256, in bytes.
+ +void sha3_224_reset | +( | +struct SHA3Context * | +ctx | ) | ++ |
Initialize state for SHA3-224.
+ +void sha3_256_reset | +( | +struct SHA3Context * | +ctx | ) | ++ |
Initialize state for SHA3-256.
+ +void sha3_384_reset | +( | +struct SHA3Context * | +ctx | ) | ++ |
Initialize state for SHA3-384.
+ +void sha3_512_reset | +( | +struct SHA3Context * | +ctx | ) | ++ |
Initialize state for SHA3-512.
+ +void sha3_update | +( | +struct SHA3Context * | +ctx, | +
+ | + | const void * | +ptr, | +
+ | + | unsigned | +len | +
+ | ) | ++ |
Process data, update state.
+ +void sha3_final | +( | +struct SHA3Context * | +ctx, | +
+ | + | void * | +dst | +
+ | ) | ++ |
Calculate final result.
+ +void shake128_reset | +( | +struct SHA3Context * | +ctx | ) | ++ |
Initialize state for SHAKE128.
+ +void shake256_reset | +( | +struct SHA3Context * | +ctx | ) | ++ |
Initialize state for SHAKE256.
+ +void shake_update | +( | +struct SHA3Context * | +ctx, | +
+ | + | const void * | +ptr, | +
+ | + | unsigned | +len | +
+ | ) | ++ |
Process data, update state.
+ +void shake_extract | +( | +struct SHA3Context * | +ctx, | +
+ | + | void * | +dst, | +
+ | + | unsigned | +count | +
+ | ) | ++ |
Output variable amount of result data.
+ +
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
SHA512 and SHA384 cryptographic hashes. +More...
++Data Structures | |
struct | sha512_ctx |
State structure for both SHA512 and SHA384. More... | |
+Defines | |
#define | SHA384_BLOCK_SIZE |
SHA384 block size in bytes. | |
#define | SHA512_BLOCK_SIZE |
SHA512 block size in bytes. | |
#define | SHA384_DIGEST_LENGTH |
SHA384 result length in bytes. | |
#define | SHA512_DIGEST_LENGTH |
SHA512 result length in bytes. | |
+Functions | |
void | sha512_reset (struct sha512_ctx *ctx) |
Initialize structure for SHA512. | |
void | sha512_update (struct sha512_ctx *ctx, const void *data, unsigned int len) |
Process more data. | |
void | sha512_final (struct sha512_ctx *ctx, uint8_t *dst) |
Calculate final result. | |
void | sha384_reset (struct sha512_ctx *ctx) |
Initialize structure for SHA384. | |
void | sha384_update (struct sha512_ctx *ctx, const void *data, unsigned int len) |
Process more data. | |
void | sha384_final (struct sha512_ctx *ctx, uint8_t *dst) |
Calculate final result. |
SHA512 and SHA384 cryptographic hashes.
+#define SHA384_BLOCK_SIZE | +
SHA384 block size in bytes.
+ +#define SHA512_BLOCK_SIZE | +
SHA512 block size in bytes.
+ +#define SHA384_DIGEST_LENGTH | +
SHA384 result length in bytes.
+ +#define SHA512_DIGEST_LENGTH | +
SHA512 result length in bytes.
+ +void sha512_reset | +( | +struct sha512_ctx * | +ctx | ) | ++ |
Initialize structure for SHA512.
+ +void sha512_update | +( | +struct sha512_ctx * | +ctx, | +
+ | + | const void * | +data, | +
+ | + | unsigned int | +len | +
+ | ) | ++ |
Process more data.
+ +void sha512_final | +( | +struct sha512_ctx * | +ctx, | +
+ | + | uint8_t * | +dst | +
+ | ) | ++ |
Calculate final result.
+ +void sha384_reset | +( | +struct sha512_ctx * | +ctx | ) | ++ |
Initialize structure for SHA384.
+ +void sha384_update | +( | +struct sha512_ctx * | +ctx, | +
+ | + | const void * | +data, | +
+ | + | unsigned int | +len | +
+ | ) | ++ |
Process more data.
+ +void sha384_final | +( | +struct sha512_ctx * | +ctx, | +
+ | + | uint8_t * | +dst | +
+ | ) | ++ |
Calculate final result.
+ +#define shlist_for_each | +#define shlist_for_each | ( | - | item, | +node, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@@ -163,15 +167,15 @@ - + |
#define shlist_for_each_safe | +#define shlist_for_each_safe | ( | - | item, | +node, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@@ -194,11 +198,53 @@ |
static struct SHList* shlist_get_next | +( | +const struct SHList * | +node | ) | + [static, read] |
+
Get next element in list.
+ +Referenced by shlist_first(), shlist_prepend(), and shlist_remove().
+ +static struct SHList* shlist_get_prev | +( | +const struct SHList * | +node | ) | + [static, read] |
+
Get prev element in list.
+ +Referenced by shlist_append(), shlist_last(), and shlist_remove().
+ +Initialize list head.
-References SHList::next, and SHList::prev.
+Referenced by shlist_remove().
static void shlist_append | +static void shlist_append | ( | struct SHList * | list, | @@ -234,7 +280,7 @@struct SHList * | -item | +node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@@ -247,16 +293,16 @@ |
static void shlist_prepend | +static void shlist_prepend | ( | struct SHList * | list, | @@ -265,7 +311,7 @@struct SHList * | -item | +node | |||||||||
@@ -278,38 +324,28 @@ |
static void shlist_remove | +static void shlist_remove | ( | struct SHList * | -list, | -||
- | - | struct SHList * | -item | -|||
- | ) | - [inline, static] |
+ node | ) | + [inline, static] |
Remove an item.
+Remove an node.
-References SHList::next, and SHList::prev.
+References shlist_get_next(), shlist_get_prev(), and shlist_init().
Referenced by shlist_pop().
@@ -332,8 +368,6 @@No elements?
-References SHList::next, and SHList::prev.
-Referenced by shlist_first(), and shlist_last().
Return first elem.
-References SHList::next, and shlist_empty().
+References shlist_empty(), and shlist_get_next().
Referenced by shlist_pop().
@@ -378,7 +412,7 @@Return last elem.
-References SHList::prev, and shlist_empty().
+References shlist_empty(), and shlist_get_prev().
Remove first elem.
-References shlist_first(), and shlist_remove().
+References shlist_first(), and shlist_remove().
diff --git a/slab_8h.html b/slab_8h.html index 488e437..d4a3e04 100644 --- a/slab_8h.html +++ b/slab_8h.html @@ -75,7 +75,7 @@
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
Jenkins SpookyHash V2 - fast hash for 64-bit CPUs. +More...
++Functions | |
void | spookyhash (const void *message, size_t length, uint64_t *hash1, uint64_t *hash2) |
Run SpookyHash on data. |
Jenkins SpookyHash V2 - fast hash for 64-bit CPUs.
+void spookyhash | +( | +const void * | +message, | +
+ | + | size_t | +length, | +
+ | + | uint64_t * | +hash1, | +
+ | + | uint64_t * | +hash2 | +
+ | ) | ++ |
Run SpookyHash on data.
+ +Compat: find byte in reverse direction.
+ + + +void* memmem | +( | +const void * | +s, | +
+ | + | size_t | +slen, | +
+ | + | const void * | +q, | +
+ | + | size_t | +qlen | +
+ | ) | ++ |
Compat: find memory area.
+ +void* mempbrk | +( | +const void * | +data, | +
+ | + | size_t | +dlen, | +
+ | + | const void * | +find, | +
+ | + | size_t | +flen | +
+ | ) | ++ |
Return position to first byte that is in 'find'.
+ +size_t memcspn | +( | +const void * | +data, | +
+ | + | size_t | +dlen, | +
+ | + | const void * | +reject, | +
+ | + | size_t | +rlen | +
+ | ) | ++ |
Return number of bytes where none are in reject.
+ +size_t memspn | +( | +const void * | +data, | +
+ | + | size_t | +dlen, | +
+ | + | const void * | +accept, | +
+ | + | size_t | +alen | +
+ | ) | ++ |
Return number of bytes where all are in accept.
+Compat: Return directory part of pathname.
Never modifies path, returns either pointer inside path or static buffer.
+ + + +void explicit_bzero | +( | +void * | +buf, | +
+ | + | size_t | +len | +
+ | ) | ++ |
Definitely clear memory.
+ +double strtod_dot | +( | +const char * | +s, | +
+ | + | char ** | +tokend | +
+ | ) | ++ |
strtod() that uses '.
+' as decimal separator
+ +ssize_t dtostr_dot | +( | +char * | +buf, | +
+ | + | size_t | +buflen, | +
+ | + | double | +val | +
+ | ) | ++ |
Convert double to string with '.
+' as decimal separator
+ +long long strtonum | +( | +const char * | +s, | +
+ | + | long long | +minval, | +
+ | + | long long | +maxval, | +
+ | + | const char ** | +errstr_p | +
+ | ) | ++ |
Convert string to integer, check limits.
+Accepts only decimal numbers, no octal or hex. Allows leading whitespace, but not tailing.
+On success, returns value that is minval <= res <= maxval. If errstr_p is given it stores NULL there. Keeps old errno value.
+On error, returns 0, sets errno, and if errstr_p is given, stores error reason there.
+ +char* strsep | +( | +char ** | +stringp, | +
+ | + | const char * | +delim | +
+ | ) | ++ |
Return next token from string.
+Tokens are separated by delim chars Modifies string in-place.
+struct PStr* strpool_get | +struct PStr* strpool_get | ( | struct StrPool * | sp, | @@ -143,7 +143,7 @@
- | int | +ssize_t | len | |
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
Bitmap of 256 bits. + More...
+Bitmap of 256 bits.
+
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
ChaCha state.
+
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
Allocation context. + More...
+Allocation context.
+
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
Json value. + More...
+Json value.
+
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
State structure. + More...
+State structure.
+int PStr::refcnt | +size_t PStr::len |
Reference count.
+String length.
int PStr::len | +int PStr::refcnt |
String length.
+Reference count.
char PStr::str[FLEX_ARRAY] | +char PStr::str[FLEX_ARRAY] |
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
State structure. + More...
+State structure.
+-Data Fields | |
uintptr_t | next |
Offset to next elem. | |
uintptr_t | prev |
Offset from next elem. |
List node/head.
-Uses offsets from head instead of direct pointers.
-uintptr_t SHList::next | -
Offset to next elem.
- -Referenced by shlist_append(), shlist_empty(), shlist_first(), shlist_init(), shlist_prepend(), and shlist_remove().
- -uintptr_t SHList::prev | -
Offset from next elem.
- -Referenced by shlist_append(), shlist_empty(), shlist_init(), shlist_last(), shlist_prepend(), and shlist_remove().
- -Uses offsets from current node instead of direct pointers.
+
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
State structure for both SHA256 and SHA224. + More...
+State structure for both SHA256 and SHA224.
+
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
State structure for both SHA512 and SHA384. + More...
+State structure for both SHA512 and SHA384.
+
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
Talloc - hierarchical memory allocator. +More...
++Defines | |
#define | TALLOC_POS(apifunc) |
Give name to "unnamed" allocations. | |
#define | TALLOC_FREE(ptr) |
Free and set pointer to NULL. | |
+Typedefs | |
typedef void | TALLOC_CTX |
Type for untyped pointers that are usable as talloc parent. | |
typedef int(* | talloc_destructor_f )(void *ptr) |
Destructor signature. | |
+Functions | |
Allocate object and give name based on C type. | |
Object names are set automatically based on C type. + | |
type * | talloc (const void *parent,#type) |
Allocate memory for C type. | |
type * | talloc_zero (const void *parent,#type) |
Allocate zero-filled memory for C type. | |
type * | talloc_array (const void *parent,#type, size_t count) |
Allocate array of elements of type given. | |
type * | talloc_zero_array (const void *parent,#type, size_t count) |
Allocate zero-filled array of elements of type. | |
Allocate object and give custom name. | |
void * | talloc_named_const (const void *parent, size_t size, const char *name) |
Allocate named object. | |
void * | talloc_zero_named_const (const void *parent, size_t size, const char *name) |
Allocate zero-filled memory for named object. | |
void * | talloc_named (const void *parent, size_t size, const char *fmt,...) |
Allocate named context. | |
void * | talloc_init (const char *fmt,...) |
Allocate new top-level named context. | |
Allocate unnamed context. | |
The objects will get name based on calling location. + | |
void * | talloc_size (const void *parent, size_t size) |
Allocate unnamed context. | |
void * | talloc_zero_size (const void *parent, size_t size) |
Allocate unnamed context with zeroed memory. | |
void * | talloc_array_size (const void *parent, size_t size, size_t count) |
Allocate array of elements of type. | |
type * | talloc_ptrtype (const void *parent, type *ptr) |
Allocate unnamed context from typed pointer. | |
type * | talloc_array_ptrtype (const void *parent, type *ptr, size_t count) |
Allocate array of elements of type taken from pointer. | |
void * | talloc_new (const void *parent) |
Allocate unnamed context as child of parent. | |
Special contexts. | |
Contexts that have unusual behaviour. + | |
void * | talloc_autofree_context (void) |
Allocate context that will be freed on program exit. | |
void * | talloc_from_cx (const struct CxMem *cx, size_t size, const char *name) |
Allocate memory from CxMem. | |
struct CxMem * | talloc_as_cx (const void *parent, const char *name) |
Create CxMem context that uses talloc. | |
Free memory. | |
void | talloc_set_destructor (const void *ptr, talloc_destructor_f destructor) |
Set function to be called on final free. | |
int | talloc_free (const void *ptr) |
Free allocated context and all it's children. | |
Reallocate existing context. | |
Only context that have only one reference can be reallocated. + | |
type * | talloc_realloc (const void *parent, const void *ptr,#type, size_t count) |
Reallocate array. | |
void * | talloc_realloc_size (const void *parent, void *ptr, size_t size) |
Reallocate untyped context. | |
void * | talloc_realloc_fn (const void *parent, void *ptr, size_t size) |
Function version of realloc. | |
Custom object name. | |
const char * | talloc_get_name (const void *ptr) |
Return object name. | |
const char * | talloc_set_name (const void *ptr, const char *fmt,...) |
Set formatted name. | |
void | talloc_set_name_const (const void *ptr, const char *name) |
Set name pointer directly. | |
void * | talloc_check_name (const void *ptr, const char *name) |
Return same pointer only if name matches, NULL otherwise. | |
Type-based names. | |
void | talloc_set_type (const void *ptr,#type) |
Set context name from type. | |
type * | talloc_get_type (const void *ptr,#type) |
Get typed pointer only if name matches. | |
type * | talloc_get_type_abort (const void *ptr,#type) |
Get typed pointed only if name matches, aborting otherwise. | |
Allocated area size. | |
size_t | talloc_get_size (const void *ptr) |
Get length of allocated area. | |
size_t | talloc_array_length (const type *array) |
Get number of elements in array. | |
Object parent. | |
void * | talloc_parent (const void *ptr) |
Get parent object. | |
const char * | talloc_parent_name (const void *ptr) |
Get parent object's name. | |
void * | talloc_find_parent_byname (const void *ptr, const char *name) |
Find direct parent based on name. | |
type * | talloc_find_parent_bytype (const void *ptr,#type) |
Find direct parent based on type. | |
Reference handling | |
Talloc operates on references, not reference counts. + | |
void * | talloc_reference (const void *new_parent, const void *ptr) |
Create another reference from parent to child. | |
int | talloc_increase_ref_count (const void *ptr) |
Create another reference from NULL context to child. | |
int | talloc_unlink (const void *parent, const void *ptr) |
Remove parent's reference to child. | |
size_t | talloc_reference_count (const void *ptr) |
Return number of references context has. | |
Change parent | |
void * | talloc_reparent (const void *old_parent, const void *new_parent, const void *ptr) |
Find reference from old parent switch it to new parent. | |
void * | talloc_move (const void *new_parent, void **ptr_p) |
Change primary parent, set old pointer to NULL. | |
void * | talloc_steal (const void *new_parent, const void *ptr) |
Change primary parent. | |
String functions. | |
void * | talloc_memdup (const void *parent, const void *p, size_t len) |
Copy memory. | |
char * | talloc_strdup (const void *parent, const char *s) |
Copy string. | |
char * | talloc_strndup (const void *parent, const char *s, size_t maxlen) |
Copy string with size limit. | |
char * | talloc_asprintf (const void *parent, const char *fmt,...) |
Format string. | |
char * | talloc_vasprintf (const void *parent, const char *fmt, va_list ap) |
Format string taking argument from va_list. | |
String append functions. | |
The *_append() functions use strnlen() to get size of string in buffer. + | |
char * | talloc_strdup_append (char *ptr, const char *s) |
Append string to existing string. | |
char * | talloc_strndup_append (char *ptr, const char *s, size_t maxlen) |
Append string with limit to existing string. | |
char * | talloc_asprintf_append (char *ptr, const char *fmt,...) |
Append formatted string to existing string. | |
char * | talloc_vasprintf_append (char *ptr, const char *fmt, va_list ap) |
Append formatted string to existing string. | |
String append to complete buffer. | |
The *_append_buffer() functions assume talloc_get_size() will give the string length with final NUL byte. + | |
char * | talloc_strdup_append_buffer (char *ptr, const char *str) |
Append string to existing buffer. | |
char * | talloc_strndup_append_buffer (char *ptr, const char *str, size_t maxlen) |
Append string with limit to existing buffer. | |
char * | talloc_asprintf_append_buffer (char *ptr, const char *fmt,...) |
Append formatted string to existing buffer. | |
char * | talloc_vasprintf_append_buffer (char *ptr, const char *fmt, va_list ap) |
Append formatted string to existing buffer. | |
Debugging | |
void | talloc_set_log_fn (void(*log_fn)(const char *message)) |
Set log function. | |
void | talloc_set_log_stderr (void) |
Restore default function. | |
void | talloc_set_abort_fn (void(*abort_fn)(const char *reason)) |
Set function to be called on abort. | |
void | talloc_enable_null_tracking (void) |
Collect all parent==NULL allocations under one context. | |
void | talloc_enable_null_tracking_no_autofree (void) |
Collect all parent==NULL allocations under one context, but not autofree. | |
void | talloc_disable_null_tracking (void) |
Stop collecting all parent==NULL allocations under one context. | |
void | talloc_enable_leak_report (void) |
On program exit, run talloc_report(NULL, stderr) | |
void | talloc_enable_leak_report_full (void) |
On program exit, run talloc_report_full(NULL, stderr) | |
size_t | talloc_total_size (const void *ptr) |
Return allocated bytes under context. | |
size_t | talloc_total_blocks (const void *ptr) |
Return number of contexts under context. | |
bool | talloc_is_parent (const void *parent, const void *ptr) |
Walk parents. | |
void | talloc_report (const void *ptr, FILE *f) |
Print report about context and it's immediate childs. | |
void | talloc_report_full (const void *ptr, FILE *f) |
Print report about context and it's all childs. | |
void | talloc_report_depth_file (const void *ptr, int depth, int max_depth, FILE *f) |
Print full report about context, with customizable depth. | |
void | talloc_report_depth_cb (const void *ptr, int depth, int max_depth, void(*callback)(const void *ptr, int depth, int max_depth, int is_ref, void *private_data), void *private_data) |
Run callback on context and it's children. | |
void | talloc_show_parents (const void *ptr, FILE *file) |
Print parents to file. | |
int | talloc_set_memlimit (const void *ptr, size_t max_size) |
Activate memory limit for object. |
Talloc - hierarchical memory allocator.
+This is reimplementation of Samba's talloc: https://talloc.samba.org/
+Features:
+Missing features:
+It mostly compatible with original so that Samba's documentation is usable, but it does not try to be bug-for-bug compatible.
+#define TALLOC_POS | +( | ++ | apifunc | ) | ++ |
Give name to "unnamed" allocations.
+By default it generates name that contains talloc API function name, source file and line number.
+It can be redefined in user source files.
+ +#define TALLOC_FREE | +( | ++ | ptr | ) | ++ |
Free and set pointer to NULL.
+ +typedef void TALLOC_CTX | +
Type for untyped pointers that are usable as talloc parent.
+For situations where (void*) needs to be used. There it might be used to use TALLOC_CTX to document that talloc pointer is needed.
+ +typedef int(* talloc_destructor_f)(void *ptr) | +
Destructor signature.
+If it returns -1, talloc_free() cancels its operation and also returns -1.
+ptr | Object to be freed. |
type* talloc | +( | +const void * | +parent, | +
+ | + | # | +type | +
+ | ) | ++ |
Allocate memory for C type.
+Returned object will have memory for sizeof(type) bytes.
+parent | Parent context or NULL. | |
type | C type of object. |
type* talloc_zero | +( | +const void * | +parent, | +
+ | + | # | +type | +
+ | ) | ++ |
Allocate zero-filled memory for C type.
+Returned object will have memory for sizeof(type) bytes.
+parent | Parent context or NULL. | |
type | C type of object. |
type* talloc_array | +( | +const void * | +parent, | +
+ | + | # | +type, | +
+ | + | size_t | +count | +
+ | ) | ++ |
Allocate array of elements of type given.
+size = count * sizeof(type);
+parent | Parent context or NULL. |
type | C type. |
count | Number of elements. |
type* talloc_zero_array | +( | +const void * | +parent, | +
+ | + | # | +type, | +
+ | + | size_t | +count | +
+ | ) | ++ |
Allocate zero-filled array of elements of type.
+size = count * sizeof(type);
+parent | Parent context or NULL. |
type | C type. |
count | Number of elements. |
void* talloc_named_const | +( | +const void * | +parent, | +
+ | + | size_t | +size, | +
+ | + | const char * | +name | +
+ | ) | ++ |
Allocate named object.
+Name pointer is used directly, so it should not change.
+parent | Parent context or NULL. |
size | Length in bytes. |
name | Pointer to static string, will be used directly. |
void* talloc_zero_named_const | +( | +const void * | +parent, | +
+ | + | size_t | +size, | +
+ | + | const char * | +name | +
+ | ) | ++ |
Allocate zero-filled memory for named object.
+Name pointer is used directly, so it should not change.
+parent | Parent context or NULL. |
size | Length in bytes. |
name | Pointer to static string, will be used directly. |
void* talloc_named | +( | +const void * | +parent, | +
+ | + | size_t | +size, | +
+ | + | const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Allocate named context.
+Name is formatted via talloc_vasprintf() and allocated as child of main object.
+parent | Parent context or NULL. |
size | Size for allocation. |
fmt | printf format for name. |
void* talloc_init | +( | +const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Allocate new top-level named context.
+Name will be allocaten inside context.
+fmt | Format string for sprintf. |
void* talloc_size | +( | +const void * | +parent, | +
+ | + | size_t | +size | +
+ | ) | ++ |
Allocate unnamed context.
+parent | Parent context or NULL. |
size | Size for allocation. |
void* talloc_zero_size | +( | +const void * | +parent, | +
+ | + | size_t | +size | +
+ | ) | ++ |
Allocate unnamed context with zeroed memory.
+parent | Parent context or NULL. |
size | Size for allocation. |
void* talloc_array_size | +( | +const void * | +parent, | +
+ | + | size_t | +size, | +
+ | + | size_t | +count | +
+ | ) | ++ |
Allocate array of elements of type.
+parent | Parent context or NULL. |
size | Size for one element. |
count | Number of elements. |
type* talloc_ptrtype | +( | +const void * | +parent, | +
+ | + | type * | +ptr | +
+ | ) | ++ |
Allocate unnamed context from typed pointer.
+sizeof(*(ptr)) will be used as allocation size.
+parent | Parent context or NULL. |
ptr | Typed pointer |
type* talloc_array_ptrtype | +( | +const void * | +parent, | +
+ | + | type * | +ptr, | +
+ | + | size_t | +count | +
+ | ) | ++ |
Allocate array of elements of type taken from pointer.
+size = count * sizeof(*ptr);
+parent | Parent context or NULL. |
ptr | Typed pointer. |
count | Number of elements. |
void* talloc_new | +( | +const void * | +parent | ) | ++ |
Allocate unnamed context as child of parent.
+parent | Parent context or NULL |
void* talloc_autofree_context | +( | +void | +) | ++ |
Allocate context that will be freed on program exit.
+Objects allocated under this context will be freed via atexit() handler, unless freed earlier. This is useful to see leaked memory on program exit.
+void* talloc_from_cx | +( | +const struct CxMem * | +cx, | +
+ | + | size_t | +size, | +
+ | + | const char * | +name | +
+ | ) | ++ |
Allocate memory from CxMem.
+Returned pointer and all it's children will be allocated from CxMem;
+Name pointer is used directly, so it should not change.
+cx | CxMem context to allocate from. |
size | Length in bytes. |
name | Pointer to static string, will be used directly. |
struct CxMem* talloc_as_cx | +( | +const void * | +parent, | +
+ | + | const char * | +name | +
+ | ) | + [read] |
+
void talloc_set_destructor | +( | +const void * | +ptr, | +
+ | + | talloc_destructor_f | +destructor | +
+ | ) | ++ |
Set function to be called on final free.
+ +int talloc_free | +( | +const void * | +ptr | ) | ++ |
Free allocated context and all it's children.
+This can be called only on context that have one parent. Use talloc_unlink() if object may have many references.
+ptr | Pointer to previously allocated area. |
type* talloc_realloc | +( | +const void * | +parent, | +
+ | + | const void * | +ptr, | +
+ | + | # | +type, | +
+ | + | size_t | +count | +
+ | ) | ++ |
Reallocate array.
+parent | Parent context or NULL. | |
ptr | Pointer to be reallocated. | |
type | C type of one element. | |
count | Number of elements. |
void* talloc_realloc_size | +( | +const void * | +parent, | +
+ | + | void * | +ptr, | +
+ | + | size_t | +size | +
+ | ) | ++ |
Reallocate untyped context.
+parent | Parent context or NULL. |
ptr | Pointer to be reallocated. |
size | New length in bytes. |
void* talloc_realloc_fn | +( | +const void * | +parent, | +
+ | + | void * | +ptr, | +
+ | + | size_t | +size | +
+ | ) | ++ |
Function version of realloc.
+This is guaranteed to not be macro, unlike other API calls.
+parent | Parent context or NULL. |
ptr | Pointer to be reallocated. |
size | New length in bytes. |
const char* talloc_get_name | +( | +const void * | +ptr | ) | ++ |
Return object name.
+Result will be always non-NULL.
+ +const char* talloc_set_name | +( | +const void * | +ptr, | +
+ | + | const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Set formatted name.
+Format and allocate as child of ptr.
+ptr | Pointer to be named. |
fmt | Format string. |
void talloc_set_name_const | +( | +const void * | +ptr, | +
+ | + | const char * | +name | +
+ | ) | ++ |
Set name pointer directly.
+ptr | Pointer to be named. |
name | Pointer to string. |
void* talloc_check_name | +( | +const void * | +ptr, | +
+ | + | const char * | +name | +
+ | ) | ++ |
Return same pointer only if name matches, NULL otherwise.
+ +void talloc_set_type | +( | +const void * | +ptr, | +
+ | + | # | +type | +
+ | ) | ++ |
Set context name from type.
+ptr | Pointer to be named. | |
type | C type. |
type* talloc_get_type | +( | +const void * | +ptr, | +
+ | + | # | +type | +
+ | ) | ++ |
Get typed pointer only if name matches.
+ptr | Pointer to be checked. | |
type | C type. |
type* talloc_get_type_abort | +( | +const void * | +ptr, | +
+ | + | # | +type | +
+ | ) | ++ |
Get typed pointed only if name matches, aborting otherwise.
+This is more extreme version of talloc_get_type().
+ptr | Pointer to be checked. | |
type | C type. |
size_t talloc_get_size | +( | +const void * | +ptr | ) | ++ |
Get length of allocated area.
+ +size_t talloc_array_length | +( | +const type * | +array | ) | ++ |
Get number of elements in array.
+ +void* talloc_parent | +( | +const void * | +ptr | ) | ++ |
Get parent object.
+ +const char* talloc_parent_name | +( | +const void * | +ptr | ) | ++ |
Get parent object's name.
+ +void* talloc_find_parent_byname | +( | +const void * | +ptr, | +
+ | + | const char * | +name | +
+ | ) | ++ |
Find direct parent based on name.
+ +type* talloc_find_parent_bytype | +( | +const void * | +ptr, | +
+ | + | # | +type | +
+ | ) | ++ |
Find direct parent based on type.
+ +void* talloc_reference | +( | +const void * | +new_parent, | +
+ | + | const void * | +ptr | +
+ | ) | ++ |
Create another reference from parent to child.
+new_parent | New parent context or NULL. |
ptr | Target pointer that is referenced. |
int talloc_increase_ref_count | +( | +const void * | +ptr | ) | ++ |
Create another reference from NULL context to child.
+ptr | Target pointer that is referenced. |
int talloc_unlink | +( | +const void * | +parent, | +
+ | + | const void * | +ptr | +
+ | ) | ++ |
Remove parent's reference to child.
+If parent is found, unlinks and returns 0, otherwise -1.
+When removing last reference, the object is freed.
+parent | Parent context or NULL. |
ptr | Pointer to be unlinked. |
size_t talloc_reference_count | +( | +const void * | +ptr | ) | ++ |
Return number of references context has.
+ +void* talloc_reparent | +( | +const void * | +old_parent, | +
+ | + | const void * | +new_parent, | +
+ | + | const void * | +ptr | +
+ | ) | ++ |
Find reference from old parent switch it to new parent.
+ +void* talloc_move | +( | +const void * | +new_parent, | +
+ | + | void ** | +ptr_p | +
+ | ) | ++ |
Change primary parent, set old pointer to NULL.
+Useful when moving ponters between structs.
+Cannot be used on pointers that have multiple parents.
+new_parent | New parent. |
ptr_p | Location of pointer, will be set to NULL if successful. |
void* talloc_steal | +( | +const void * | +new_parent, | +
+ | + | const void * | +ptr | +
+ | ) | ++ |
Change primary parent.
+Cannot be used on pointers that have multiple parents.
+new_parent | New parent. |
ptr | Pointer to be moved. |
void* talloc_memdup | +( | +const void * | +parent, | +
+ | + | const void * | +p, | +
+ | + | size_t | +len | +
+ | ) | ++ |
Copy memory.
+ +char* talloc_strdup | +( | +const void * | +parent, | +
+ | + | const char * | +s | +
+ | ) | ++ |
Copy string.
+ +char* talloc_strndup | +( | +const void * | +parent, | +
+ | + | const char * | +s, | +
+ | + | size_t | +maxlen | +
+ | ) | ++ |
Copy string with size limit.
+ +char* talloc_asprintf | +( | +const void * | +parent, | +
+ | + | const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Format string.
+ +char* talloc_vasprintf | +( | +const void * | +parent, | +
+ | + | const char * | +fmt, | +
+ | + | va_list | +ap | +
+ | ) | ++ |
Format string taking argument from va_list.
+ +char* talloc_strdup_append | +( | +char * | +ptr, | +
+ | + | const char * | +s | +
+ | ) | ++ |
Append string to existing string.
+ +char* talloc_strndup_append | +( | +char * | +ptr, | +
+ | + | const char * | +s, | +
+ | + | size_t | +maxlen | +
+ | ) | ++ |
Append string with limit to existing string.
+ +char* talloc_asprintf_append | +( | +char * | +ptr, | +
+ | + | const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Append formatted string to existing string.
+ +char* talloc_vasprintf_append | +( | +char * | +ptr, | +
+ | + | const char * | +fmt, | +
+ | + | va_list | +ap | +
+ | ) | ++ |
Append formatted string to existing string.
+ +char* talloc_strdup_append_buffer | +( | +char * | +ptr, | +
+ | + | const char * | +str | +
+ | ) | ++ |
Append string to existing buffer.
+ +char* talloc_strndup_append_buffer | +( | +char * | +ptr, | +
+ | + | const char * | +str, | +
+ | + | size_t | +maxlen | +
+ | ) | ++ |
Append string with limit to existing buffer.
+ +char* talloc_asprintf_append_buffer | +( | +char * | +ptr, | +
+ | + | const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Append formatted string to existing buffer.
+ +char* talloc_vasprintf_append_buffer | +( | +char * | +ptr, | +
+ | + | const char * | +fmt, | +
+ | + | va_list | +ap | +
+ | ) | ++ |
Append formatted string to existing buffer.
+ +void talloc_set_log_fn | +( | +void(*)(const char *message) | +log_fn | ) | ++ |
Set log function.
+ +void talloc_set_log_stderr | +( | +void | +) | ++ |
Restore default function.
+ +void talloc_set_abort_fn | +( | +void(*)(const char *reason) | +abort_fn | ) | ++ |
Set function to be called on abort.
+ +void talloc_enable_null_tracking | +( | +void | +) | ++ |
Collect all parent==NULL allocations under one context.
+ +void talloc_enable_null_tracking_no_autofree | +( | +void | +) | ++ |
Collect all parent==NULL allocations under one context, but not autofree.
+ +void talloc_disable_null_tracking | +( | +void | +) | ++ |
Stop collecting all parent==NULL allocations under one context.
+ +void talloc_enable_leak_report | +( | +void | +) | ++ |
On program exit, run talloc_report(NULL, stderr)
+ +void talloc_enable_leak_report_full | +( | +void | +) | ++ |
On program exit, run talloc_report_full(NULL, stderr)
+ +size_t talloc_total_size | +( | +const void * | +ptr | ) | ++ |
Return allocated bytes under context.
+ +size_t talloc_total_blocks | +( | +const void * | +ptr | ) | ++ |
Return number of contexts under context.
+ +bool talloc_is_parent | +( | +const void * | +parent, | +
+ | + | const void * | +ptr | +
+ | ) | ++ |
Walk parents.
+ +void talloc_report | +( | +const void * | +ptr, | +
+ | + | FILE * | +f | +
+ | ) | ++ |
Print report about context and it's immediate childs.
+ +void talloc_report_full | +( | +const void * | +ptr, | +
+ | + | FILE * | +f | +
+ | ) | ++ |
Print report about context and it's all childs.
+ +void talloc_report_depth_file | +( | +const void * | +ptr, | +
+ | + | int | +depth, | +
+ | + | int | +max_depth, | +
+ | + | FILE * | +f | +
+ | ) | ++ |
Print full report about context, with customizable depth.
+ +void talloc_report_depth_cb | +( | +const void * | +ptr, | +
+ | + | int | +depth, | +
+ | + | int | +max_depth, | +
+ | + | void(*)(const void *ptr, int depth, int max_depth, int is_ref, void *private_data) | +callback, | +
+ | + | void * | +private_data | +
+ | ) | ++ |
Run callback on context and it's children.
+ +void talloc_show_parents | +( | +const void * | +ptr, | +
+ | + | FILE * | +file | +
+ | ) | ++ |
Print parents to file.
+ +int talloc_set_memlimit | +( | +const void * | +ptr, | +
+ | + | size_t | +max_size | +
+ | ) | ++ |
Activate memory limit for object.
+The limit affects only new children allocated after setting it. It does not take account object itself and it's current children.
+ptr | Targer pointer. |
max_size | Limit in bytes. |
Low-level UTF8 handling.
@@ -195,6 +197,35 @@Return UTF8 seq length based on first byte.
+int utf8_validate_seq | +( | +const char * | +src, | +
+ | + | const char * | +srcend | +
+ | ) | ++ |
Return sequence length if all bytes are valid, 0 otherwise.
+
+ libusual
+ 0.1
+
+
+ |
+
+
+
+
xxHash - fast hash for 32-bit cpu's. +More...
++Functions | |
uint32_t | xxhash (const void *input, size_t len, uint32_t seed) |
Calculate the 32-bits hash of sequence of length "len" stored at memory address "input". |
xxHash - fast hash for 32-bit cpu's.
+uint32_t xxhash | +( | +const void * | +input, | +
+ | + | size_t | +len, | +
+ | + | uint32_t | +seed | +
+ | ) | ++ |
Calculate the 32-bits hash of sequence of length "len" stored at memory address "input".
+ +