The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Boxed value structures and functions to manipulate them. More...
#include <freeradius-devel/build.h>
#include <freeradius-devel/util/dcursor.h>
#include <freeradius-devel/missing.h>
#include <freeradius-devel/util/dbuff.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/util/dlist.h>
#include <freeradius-devel/util/inet.h>
#include <freeradius-devel/util/log.h>
#include <freeradius-devel/util/strerror.h>
#include <freeradius-devel/util/table.h>
#include <freeradius-devel/util/time.h>
#include <freeradius-devel/util/token.h>
#include <freeradius-devel/util/types.h>
Go to the source code of this file.
Data Structures | |
union | fr_value_box_datum_t |
struct | fr_value_box_datum_t.__unnamed153__ |
union | fr_value_box_datum_t.__unnamed153__.__unnamed155__ |
struct | value_box_s |
Union containing all data types supported by the server. More... | |
Typedefs | |
typedef struct value_box_s | fr_value_box_t |
Enumerations | |
enum | fr_value_box_list_action_t { FR_VALUE_BOX_LIST_NONE = 0x00 , FR_VALUE_BOX_LIST_REMOVE = 0x01 , FR_VALUE_BOX_LIST_FREE_BOX = (0x02 | FR_VALUE_BOX_LIST_REMOVE) , FR_VALUE_BOX_LIST_FREE_BOX_VALUE = 0x04 , FR_VALUE_BOX_LIST_FREE = (FR_VALUE_BOX_LIST_FREE_BOX | FR_VALUE_BOX_LIST_FREE_BOX_VALUE) } |
Actions to perform when we process a box in a list. More... | |
Functions | |
void | _fr_value_box_mark_safe_for (fr_value_box_t *box, fr_value_box_safe_for_t safe_for) |
Mark a value-box as "safe", of a particular type. More... | |
int | fr_value_box_cast (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t dst_type, fr_dict_attr_t const *dst_enumv, fr_value_box_t const *src)) |
Convert one type of fr_value_box_t to another. More... | |
int | fr_value_box_cast_in_place (TALLOC_CTX *ctx, fr_value_box_t *vb, fr_type_t dst_type, fr_dict_attr_t const *dst_enumv)) |
Convert one type of fr_value_box_t to another in place. More... | |
int8_t | fr_value_box_cmp (fr_value_box_t const *a, fr_value_box_t const *b) |
Compare two values. More... | |
int | fr_value_box_cmp_op (fr_token_t op, fr_value_box_t const *a, fr_value_box_t const *b) |
Compare two attributes using an operator. More... | |
static bool | fr_value_box_contains_secret (fr_value_box_t const *box) |
ssize_t | fr_value_box_from_network (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t type, fr_dict_attr_t const *enumv, fr_dbuff_t *dbuff, size_t len, bool tainted)) |
Decode a fr_value_box_t from serialized binary data. More... | |
static size_t char fr_sbuff_t size_t char quote int | fr_value_box_hton (fr_value_box_t *dst, fr_value_box_t const *src) |
Performs byte order reversal for types that need it. More... | |
void | fr_value_box_increment (fr_value_box_t *vb) |
Increment a boxed value. More... | |
int | fr_value_box_ipaddr (fr_value_box_t *dst, fr_dict_attr_t const *enumv, fr_ipaddr_t const *ipaddr, bool tainted)) |
Assign a fr_value_box_t value from an fr_ipaddr_t. More... | |
static bool | fr_value_box_is_secret (fr_value_box_t const *box) |
bool | fr_value_box_is_truthy (fr_value_box_t const *box)) |
Check truthiness of values. More... | |
void | fr_value_box_list_mark_safe_for (fr_value_box_list_t *list, fr_value_box_safe_for_t safe_for) |
Set the escaped flag for all value boxes in a list. More... | |
void | fr_value_box_list_verify (char const *file, int line, fr_value_box_list_t const *list)) |
void | fr_value_box_mark_unsafe (fr_value_box_t *box) |
Mark a value-box as "unsafe". More... | |
size_t | fr_value_box_network_length (fr_value_box_t const *value) |
Get the size of the value held by the fr_value_box_t. More... | |
static void | fr_value_box_set_secret (fr_value_box_t *box, bool secret) |
int | fr_value_box_to_key (uint8_t **out, size_t *outlen, fr_value_box_t const *value) |
Get a key from a value box. More... | |
ssize_t | fr_value_box_to_network (fr_dbuff_t *dbuff, fr_value_box_t const *value) |
Encode a single value box, serializing its contents in generic network format. More... | |
void | fr_value_box_verify (char const *file, int line, fr_value_box_t const *vb)) |
Validation function to check that a fr_value_box_t is correctly initialised. More... | |
static size_t | fr_value_str_aunescape (TALLOC_CTX *ctx, char **out, fr_sbuff_t *in, size_t inlen, char quote) static inline size_t fr_value_substr_aunescape(TALLOC_CTX *ctx |
size_t | fr_value_str_unescape (fr_sbuff_t *out, fr_sbuff_t *in, size_t inlen, char quote) |
Convert a string value with escape sequences into its binary form. More... | |
size_t | fr_value_substr_unescape (fr_sbuff_t *out, fr_sbuff_t *in, size_t inlen, char quote) |
Convert a string value with escape sequences into its binary form. More... | |
int | fr_value_unbox_ipaddr (fr_ipaddr_t *dst, fr_value_box_t *src) |
Unbox an IP address performing a type check. More... | |
List and cursor function definitions | |
#define | fr_value_box_list_foreach(_list_head, _iter) fr_dlist_foreach(fr_value_box_list_dlist_head(_list_head), fr_value_box_t, _iter) |
#define | fr_value_box_list_foreach_safe(_list_head, _iter) fr_dlist_foreach_safe(fr_value_box_list_dlist_head(_list_head), fr_value_box_t, _iter) |
Field accessors for #fr_value_box_t | |
Use these instead of accessing fields directly to make refactoring easier in future. | |
#define | vb_bool datum.boolean |
#define | vb_date datum.date |
#define | vb_ether datum.ether.addr |
#define | vb_float32 datum.float32 |
#define | vb_float64 datum.float64 |
#define | vb_group datum.children |
#define | vb_ifid datum.ifid.addr |
#define | vb_int16 datum.int16 |
#define | vb_int32 datum.int32 |
#define | vb_int64 datum.int64 |
#define | vb_int8 datum.int8 |
#define | vb_ip datum.ip |
#define | vb_length datum.length |
#define | vb_octets datum.octets |
#define | vb_size datum.size |
#define | vb_strvalue datum.strvalue |
#define | vb_time_delta datum.time_delta |
#define | vb_timeval datum.timeval |
#define | vb_uint128 datum.uint128 |
#define | vb_uint16 datum.uint16 |
#define | vb_uint32 datum.uint32 |
#define | vb_uint64 datum.uint64 |
#define | vb_uint8 datum.uint8 |
#define | vb_void datum.ptr |
Allocation and initialisation functions | |
These macros and inline functions simplify working with lists of value boxes. | |
static fr_value_box_t * | _fr_value_box_alloc (NDEBUG_LOCATION_ARGS TALLOC_CTX *ctx, fr_type_t type, fr_dict_attr_t const *enumv) |
static always_inline void | _fr_value_box_init (NDEBUG_LOCATION_ARGS fr_value_box_t *vb, fr_type_t type, fr_dict_attr_t const *enumv, bool tainted) |
#define | fr_value_box_alloc(_ctx, _type, _enumv) _fr_value_box_alloc(NDEBUG_LOCATION_EXP _ctx, _type, _enumv) |
Allocate a value box of a specific type. More... | |
#define | fr_value_box_alloc_null(_ctx) _fr_value_box_alloc(NDEBUG_LOCATION_EXP _ctx, FR_TYPE_NULL, NULL) |
Allocate a value box for later use with a value assignment function. More... | |
#define | fr_value_box_init(_vb, _type, _enumv, _tainted) _fr_value_box_init(NDEBUG_LOCATION_EXP _vb, _type, _enumv, _tainted) |
Initialise a fr_value_box_t. More... | |
#define | fr_value_box_init_null(_vb) _fr_value_box_init(NDEBUG_LOCATION_EXP _vb, FR_TYPE_NULL, NULL, false) |
Initialise an empty/null box that will be filled later. More... | |
#define | FR_VALUE_BOX_INITIALISER(_vb, _type, _field, _val) |
A static initialiser for stack/globally allocated boxes. More... | |
#define | FR_VALUE_BOX_INITIALISER_NULL(_vb) |
A static initialiser for stack/globally allocated boxes. More... | |
Value box assignment functions | |
These functions allow C values to be assigned to value boxes. They will work with uninitialised/stack allocated memory. | |
#define | DEF_BOXING_FUNC(_ctype, _field, _type) |
#define | DEF_UNBOXING_FUNC(_ctype, _field, _type) |
#define | fr_value_box(_box, _var, _tainted) |
Automagically fill in a box, determining the value type from the type of the C variable. More... | |
static always_inline int | fr_value_box_ethernet_addr (fr_value_box_t *dst, fr_dict_attr_t const *enumv, fr_ethernet_t const *src, bool tainted) |
#define | fr_value_box_len(_ctx, _box, _var, _len, _tainted) |
Automagically fill in a box, for types with length. More... | |
static int | fr_value_box_memcpy_in (fr_value_box_t *vb, void const *in) |
Copy a C value value to a value box. More... | |
static int | fr_value_box_memcpy_out (void *out, fr_value_box_t const *vb) |
Copy the value of a value box to a field in a C struct. More... | |
static uint8_t * | fr_value_box_raw (fr_value_box_t const *vb, fr_type_t type) |
Return a pointer to the "raw" value from a value-box. More... | |
static int | fr_value_unbox_ethernet_addr (fr_ethernet_t *dst, fr_value_box_t *src) |
Unbox an ethernet value (6 bytes, network byte order) More... | |
#define | fr_value_unbox_shallow(_var, _box) |
Unbox simple types performing type checks. More... | |
List and cursor type definitions | |
typedef uintptr_t | fr_value_box_safe_for_t |
Escaping that's been applied to a value box. More... | |
Escape functions | |
Apply a transformation to a value box or list of value boxes. | |
int | fr_value_box_escape_in_place (fr_value_box_t *vb, fr_value_box_escape_t escape, fr_value_box_safe_for_t escaped, void *uctx)) |
Escape a single value box in place. More... | |
typedef int(* | fr_value_box_escape_t) (fr_value_box_t *vb, void *uctx) |
Escape a value box. More... | |
int | fr_value_box_list_escape_in_place (fr_value_box_list_t *list, fr_value_box_escape_t escape, fr_value_box_safe_for_t escaped, void *uctx)) |
Escape a list of value boxes in place. More... | |
Parsing rules for various types of string | |
fr_sbuff_parse_rules_t const * | value_parse_rules_3quoted [T_TOKEN_LAST] |
fr_sbuff_parse_rules_t const | value_parse_rules_backtick_3quoted |
fr_sbuff_parse_rules_t const | value_parse_rules_backtick_quoted |
fr_sbuff_parse_rules_t const | value_parse_rules_backtick_unquoted |
fr_sbuff_parse_rules_t const | value_parse_rules_bareword_quoted |
fr_sbuff_parse_rules_t const | value_parse_rules_bareword_unquoted |
Default formatting rules. More... | |
fr_sbuff_parse_rules_t const | value_parse_rules_double_3quoted |
fr_sbuff_parse_rules_t const | value_parse_rules_double_quoted |
fr_sbuff_parse_rules_t const | value_parse_rules_double_unquoted |
fr_sbuff_parse_rules_t const * | value_parse_rules_quoted [T_TOKEN_LAST] |
Parse rules for quoted strings. More... | |
fr_sbuff_parse_rules_t const * | value_parse_rules_quoted_char [UINT8_MAX] |
fr_sbuff_parse_rules_t const | value_parse_rules_single_3quoted |
fr_sbuff_parse_rules_t const | value_parse_rules_single_quoted |
fr_sbuff_parse_rules_t const | value_parse_rules_single_unquoted |
fr_sbuff_parse_rules_t const | value_parse_rules_solidus_3quoted |
fr_sbuff_parse_rules_t const | value_parse_rules_solidus_quoted |
fr_sbuff_parse_rules_t const | value_parse_rules_solidus_unquoted |
fr_sbuff_parse_rules_t const * | value_parse_rules_unquoted [T_TOKEN_LAST] |
Parse rules for non-quoted strings. More... | |
fr_sbuff_parse_rules_t const * | value_parse_rules_unquoted_char [UINT8_MAX] |
Print the value of a value box as a string | |
static fr_slen_t | data |
static fr_slen_t | fr_value_box_aprint (TALLOC_CTX *ctx, char **out, fr_value_box_t const *data, fr_sbuff_escape_rules_t const *e_rules) 1(fr_value_box_print |
static fr_slen_t static e_rules fr_slen_t | fr_value_box_aprint_quoted (TALLOC_CTX *ctx, char **out, fr_value_box_t const *data, fr_token_t quote) 1(fr_value_box_print_quoted |
ssize_t | fr_value_box_print (fr_sbuff_t *out, fr_value_box_t const *data, fr_sbuff_escape_rules_t const *e_rules)) |
Print one boxed value to a string. More... | |
ssize_t | fr_value_box_print_quoted (fr_sbuff_t *out, fr_value_box_t const *data, fr_token_t quote) |
Print one boxed value to a string with quotes (where needed) More... | |
Convenience functions | |
These macros and inline functions simplify working with lists of value boxes. | |
static bool | fr_value_box_list_len_min (fr_value_box_list_t const *list, unsigned int min) |
Determines whether a list contains the number of boxes required. More... | |
Box to box copying | |
static fr_value_box_t * | fr_value_box_acopy (TALLOC_CTX *ctx, fr_value_box_t const *src) |
Copy an existing box, allocating a new box to hold its contents. More... | |
void | fr_value_box_clear (fr_value_box_t *data)) |
Clear/free any existing value and metadata. More... | |
void | fr_value_box_clear_value (fr_value_box_t *data)) |
Clear/free any existing value. More... | |
int | fr_value_box_copy (TALLOC_CTX *ctx, fr_value_box_t *dst, const fr_value_box_t *src)) |
Copy value data verbatim duplicating any buffers. More... | |
void | fr_value_box_copy_shallow (TALLOC_CTX *ctx, fr_value_box_t *dst, const fr_value_box_t *src)) |
Perform a shallow copy of a value_box. More... | |
int | fr_value_box_steal (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_value_box_t *src)) |
Copy value data verbatim moving any buffers to the specified context. More... | |
Assign and manipulate binary-unsafe C strings | |
int | format (printf, 5, 0)) |
int | fr_value_box_asprintf (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, bool tainted, char const *fmt,...) |
int | fr_value_box_strdup (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, bool tainted)) |
Copy a nul terminated string to a fr_value_box_t. More... | |
void | fr_value_box_strdup_shallow (fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, bool tainted)) |
Assign a buffer containing a nul terminated string to a box, but don't copy it. More... | |
void | fr_value_box_strdup_shallow_replace (fr_value_box_t *vb, char const *src, ssize_t len) |
Free the existing buffer (if talloced) associated with the valuebox, and replace it with a new one. More... | |
int | fr_value_box_strtrim (TALLOC_CTX *ctx, fr_value_box_t *vb)) |
Trim the length of the string buffer to match the length of the C string. More... | |
int | fr_value_box_vasprintf (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, bool tainted, char const *fmt, va_list ap) |
int | nonnull (2, 5)) |
Assign and manipulate binary-safe strings | |
int | fr_value_box_bstr_alloc (TALLOC_CTX *ctx, char **out, fr_value_box_t *dst, fr_dict_attr_t const *enumv, size_t len, bool tainted)) |
Alloc and assign an empty \0 terminated string to a fr_value_box_t. More... | |
int | fr_value_box_bstr_append_buffer (TALLOC_CTX *ctx, fr_value_box_t *dst, char const *src, bool tainted)) |
Append a talloced buffer to an existing fr_value_box_t. More... | |
int | fr_value_box_bstr_realloc (TALLOC_CTX *ctx, char **out, fr_value_box_t *dst, size_t len)) |
Change the length of a buffer already allocated to a value box. More... | |
int | fr_value_box_bstrdup_buffer (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, bool tainted)) |
Copy a nul terminated talloced buffer to a fr_value_box_t. More... | |
int | fr_value_box_bstrdup_buffer_shallow (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, bool tainted)) |
Assign a talloced buffer containing a nul terminated string to a box, but don't copy it. More... | |
int | fr_value_box_bstrn_append (TALLOC_CTX *ctx, fr_value_box_t *dst, char const *src, size_t len, bool tainted)) |
Append bytes from a buffer to an existing fr_value_box_t. More... | |
int | fr_value_box_bstrndup (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, size_t len, bool tainted)) |
Copy a string to to a fr_value_box_t. More... | |
int | fr_value_box_bstrndup_dbuff (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, fr_dbuff_t *dbuff, size_t len, bool tainted)) |
void | fr_value_box_bstrndup_shallow (fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, size_t len, bool tainted)) |
Assign a string to to a fr_value_box_t. More... | |
Assign and manipulate octets strings | |
int | fr_value_box_mem_alloc (TALLOC_CTX *ctx, uint8_t **out, fr_value_box_t *dst, fr_dict_attr_t const *enumv, size_t len, bool tainted)) |
Pre-allocate an octets buffer for filling by the caller. More... | |
int | fr_value_box_mem_append (TALLOC_CTX *ctx, fr_value_box_t *dst, uint8_t const *src, size_t len, bool tainted)) |
Append data to an existing fr_value_box_t. More... | |
int | fr_value_box_mem_append_buffer (TALLOC_CTX *ctx, fr_value_box_t *dst, uint8_t const *src, bool tainted)) |
Append a talloc buffer to an existing fr_value_box_t. More... | |
int | fr_value_box_mem_realloc (TALLOC_CTX *ctx, uint8_t **out, fr_value_box_t *dst, size_t len)) |
Change the length of a buffer already allocated to a value box. More... | |
int | fr_value_box_memdup (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, uint8_t const *src, size_t len, bool tainted)) |
Copy a buffer to a fr_value_box_t. More... | |
int | fr_value_box_memdup_buffer (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, uint8_t const *src, bool tainted)) |
Copy a talloced buffer to a fr_value_box_t. More... | |
void | fr_value_box_memdup_buffer_shallow (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, uint8_t const *src, bool tainted)) |
Assign a talloced buffer to a box, but don't copy it. More... | |
int | fr_value_box_memdup_dbuff (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, fr_dbuff_t *dbuff, size_t len, bool tainted)) |
void | fr_value_box_memdup_shallow (fr_value_box_t *dst, fr_dict_attr_t const *enumv, uint8_t const *src, size_t len, bool tainted)) |
Assign a buffer to a box, but don't copy it. More... | |
Parsing | |
ssize_t | fr_value_box_from_str (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t dst_type, fr_dict_attr_t const *dst_enumv, char const *in, size_t inlen, fr_sbuff_unescape_rules_t const *erules, bool tainted)) |
ssize_t | fr_value_box_from_substr (TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t dst_type, fr_dict_attr_t const *dst_enumv, fr_sbuff_t *in, fr_sbuff_parse_rules_t const *rules, bool tainted)) |
Convert string value to a fr_value_box_t type. More... | |
Work with lists of boxed values | |
void | fr_value_box_flatten (TALLOC_CTX *ctx, fr_value_box_list_t *list, bool steal, bool free)) |
Removes a single layer of nesting, moving all children into the parent list. More... | |
int | fr_value_box_list_acopy (TALLOC_CTX *ctx, fr_value_box_list_t *out, fr_value_box_list_t const *in)) |
Do a full copy of a list of value boxes. More... | |
char * | fr_value_box_list_aprint (TALLOC_CTX *ctx, fr_value_box_list_t const *list, char const *delim, fr_sbuff_escape_rules_t const *e_rules)) |
Concatenate the string representations of a list of value boxes together. More... | |
char * | fr_value_box_list_aprint_secure (TALLOC_CTX *ctx, fr_value_box_list_t const *list, char const *delim, fr_sbuff_escape_rules_t const *e_rules)) |
Concatenate the string representations of a list of value boxes together hiding "secret" values. More... | |
ssize_t | fr_value_box_list_concat_as_octets (bool *tainted, bool *secret, fr_dbuff_t *dbuff, fr_value_box_list_t *list, uint8_t const *sep, size_t sep_len, fr_value_box_list_action_t proc_action, bool flatten)) |
Concatenate a list of value boxes together. More... | |
ssize_t | fr_value_box_list_concat_as_string (bool *tainted, bool *secret, fr_sbuff_t *sbuff, fr_value_box_list_t *list, char const *sep, size_t sep_len, fr_sbuff_escape_rules_t const *e_rules, fr_value_box_list_action_t proc_action, fr_value_box_safe_for_t safe_for, bool flatten)) |
Concatenate a list of value boxes together. More... | |
int | fr_value_box_list_concat_in_place (TALLOC_CTX *ctx, fr_value_box_t *out, fr_value_box_list_t *list, fr_type_t type, fr_value_box_list_action_t proc_action, bool flatten, size_t max_size)) |
Concatenate a list of value boxes. More... | |
void | fr_value_box_list_taint (fr_value_box_list_t *head)) |
Taint every list member (and their children) More... | |
bool | fr_value_box_list_tainted (fr_value_box_list_t const *head)) |
Check to see if any list members (or their children) are tainted. More... | |
void | fr_value_box_list_untaint (fr_value_box_list_t *head)) |
Untaint every list member (and their children) More... | |
Hashing | |
uint32_t | fr_value_box_hash (fr_value_box_t const *vb) |
Hash the contents of a value box. More... | |
Debug functions | |
void | fr_value_box_debug (fr_value_box_t const *vb) |
Print the value of a box as info messages. More... | |
void | fr_value_box_list_debug (fr_value_box_list_t const *head) |
Print a list of value boxes as info messages. More... | |
Boxed value structures and functions to manipulate them.
Definition in file value.h.
union fr_value_box_datum_t |
Data Fields | ||
---|---|---|
struct fr_value_box_datum_t | __unnamed__ | |
bool | boolean | A truth value. |
fr_value_box_list_t | children | for groups |
fr_unix_time_t | date | Date internal format in nanoseconds. |
fr_ethernet_t | ether | Ethernet (MAC) address. |
float | float32 | Single precision float. |
double | float64 | Double precision float. |
fr_ifid_t | ifid | IPv6 interface ID. |
int16_t | int16 | 16bit signed integer. |
int32_t | int32 | 32bit signed integer. |
int64_t | int64 | 64bit signed integer; |
int8_t | int8 | 8bit signed integer. |
fr_ipaddr_t | ip | IPv4/6 address/prefix. |
size_t | size | System specific file/memory size. |
fr_time_delta_t | time_delta | a delta time in nanoseconds |
uint128_t | uint128 | 128bit unsigned integer. |
uint16_t | uint16 | 16bit unsigned integer. |
uint32_t | uint32 | 32bit unsigned integer. |
uint64_t | uint64 | 64bit unsigned integer. |
uint8_t | uint8 | 8bit unsigned integer. |
struct fr_value_box_datum_t.__unnamed153__ |
Data Fields | ||
---|---|---|
__unnamed153__ | __unnamed__ | |
size_t | length | Only these types are variable length. |
union fr_value_box_datum_t.__unnamed153__.__unnamed155__ |
struct value_box_s |
Union containing all data types supported by the server.
This union contains all data types that can be represented by fr_pair_ts. It may also be used in other parts of the server where values of different types need to be stored.
fr_type_t should be an enumeration of the values in this union.
Don't change the order of the fields below without checking that the output of radsize doesn't change.
The first few fields (before safe_for) are reused in the fr_pair_t. This allows structural data types to have vp->vp_type, and to also use / set the various flags defined below. Do NOT change the order of the fields!
Data Fields | ||
---|---|---|
fr_value_box_datum_t | datum |
The value held by the value box. Should appear last for packing efficiency. |
unsigned int | edit: 1 | to control foreach / edits |
fr_value_box_entry_t | entry | Doubly linked list entry. |
fr_dict_attr_t const * | enumv | Enumeration values. |
char const * | file | File where the box was allocated or initialised. |
unsigned int | immutable: 1 | once set, the value cannot be changed |
int | line | Line where the box was allocated or initialised. |
uint64_t | magic | Value to verify that the structure was allocated or initialised properly. |
fr_value_box_safe_for_t _CONST | safe_for |
A unique value to indicate if that value box is safe for consumption by a particular module for a particular purpose. e.g. LDAP, SQL, etc. Usually set by the xlat framework on behalf of an xlat escaping function, and checked by a fr_value_box_escape_t to see if it needs to operate. |
unsigned int | secret: 1 | Same as fr_dict_attr_flags_t secret. |
unsigned int | tainted: 1 | i.e. did it come from an untrusted source |
unsigned int | talloced: 1 | Talloced, not stack or text allocated. |
fr_type_t _CONST | type |
Type and flags should appear together for packing efficiency. Type of this value-box, at the start, see pair.h |
#define _fr_box | ( | _type, | |
_field, | |||
_val | |||
) | (&(fr_value_box_t){ .type = _type, _field = (_val), VALUE_BOX_NDEBUG_INITIALISER }) |
#define _fr_box_with_da | ( | _type, | |
_field, | |||
_val, | |||
_da | |||
) | (&(fr_value_box_t){ .type = _type, _field = (_val), .enumv = (_da) }) |
#define _fr_box_with_len | ( | _type, | |
_field, | |||
_val, | |||
_len | |||
) | &(fr_value_box_t){ .type = _type, _field = _val, .vb_length = _len, VALUE_BOX_NDEBUG_INITIALISER } |
#define DEF_BOXING_FUNC | ( | _ctype, | |
_field, | |||
_type | |||
) |
#define DEF_UNBOXING_FUNC | ( | _ctype, | |
_field, | |||
_type | |||
) |
#define fr_box | ( | _val | ) |
Create an ephemeral box.
[in] | _val | to box. |
#define fr_box_bool | ( | _val | ) | _fr_box(FR_TYPE_BOOL, .vb_bool, _val) |
#define fr_box_date | ( | _val | ) | _fr_box(FR_TYPE_DATE, .vb_date, _val) |
#define fr_box_ether | ( | _val | ) | &(fr_value_box_t){ .type = FR_TYPE_ETHERNET, .vb_ether = { _val[0], _val[1], _val[2], _val[3], _val[4], _val[5] } } |
#define fr_box_float32 | ( | _val | ) | _fr_box(FR_TYPE_FLOAT32, .vb_float32, _val) |
#define fr_box_float64 | ( | _val | ) | _fr_box(FR_TYPE_FLOAT64, .vb_float64, _val) |
#define fr_box_ifid | ( | _val | ) | _fr_box(FR_TYPE_IFID, .vb_ifid, _val) |
#define fr_box_int16 | ( | _val | ) | _fr_box(FR_TYPE_INT16, .vb_int16, _val) |
#define fr_box_int32 | ( | _val | ) | _fr_box(FR_TYPE_INT32, .vb_int32, _val) |
#define fr_box_int64 | ( | _val | ) | _fr_box(FR_TYPE_INT64, .vb_int64, _val) |
#define fr_box_int8 | ( | _val | ) | _fr_box(FR_TYPE_INT8, .vb_int8, _val) |
#define fr_box_ipaddr | ( | _val | ) |
#define fr_box_ipv4addr | ( | _val | ) | _fr_box(FR_TYPE_IPV4_ADDR, .vb_ip, _val) |
#define fr_box_ipv4prefix | ( | _val | ) | _fr_box(FR_TYPE_IPV4_PREFIX, .vb_ip, _val) |
#define fr_box_ipv6addr | ( | _val | ) | _fr_box(FR_TYPE_IPV6_ADDR, .vb_ip, _val) |
#define fr_box_ipv6prefix | ( | _val | ) | _fr_box(FR_TYPE_IPV6_PREFIX, .vb_ip, _val) |
#define fr_box_is_bool | ( | _x | ) | fr_type_is_bool((_x)->type) |
#define fr_box_is_combo_ipaddr | ( | _x | ) | fr_type_is_combo_ipaddr((_x)->type) |
#define fr_box_is_combo_ipprefix | ( | _x | ) | fr_type_is_combo_ipprefix((_x)->type) |
#define fr_box_is_date | ( | _x | ) | fr_type_is_date((_x)->type) |
#define fr_box_is_ethernet | ( | _x | ) | fr_type_is_ethernet((_x)->type) |
#define fr_box_is_fixed_size | ( | _x | ) | fr_type_is_fixed_size((_x)->type) |
#define fr_box_is_float32 | ( | _x | ) | fr_type_is_float32((_x)->type) |
#define fr_box_is_float64 | ( | _x | ) | fr_type_is_float64((_x)->type) |
#define fr_box_is_group | ( | _x | ) | fr_type_is_group((_x)->type) |
#define fr_box_is_ifid | ( | _x | ) | fr_type_is_ifid((_x)->type) |
#define fr_box_is_int16 | ( | _x | ) | fr_type_is_int16((_x)->type) |
#define fr_box_is_int32 | ( | _x | ) | fr_type_is_int32((_x)->type) |
#define fr_box_is_int64 | ( | _x | ) | fr_type_is_int64((_x)->type) |
#define fr_box_is_int8 | ( | _x | ) | fr_type_is_int8((_x)->type) |
#define fr_box_is_integer | ( | _x | ) | fr_type_is_integer((_x)->type) |
#define fr_box_is_integer_except_bool | ( | _x | ) | fr_type_is_integer_except_bool((_x)->type) |
#define fr_box_is_ip | ( | _x | ) | fr_type_is_ip((_x)->type) |
#define fr_box_is_ipv4addr | ( | _x | ) | fr_type_is_ipv4addr((_x)->type) |
#define fr_box_is_ipv4prefix | ( | _x | ) | fr_type_is_ipv4prefix((_x)->type) |
#define fr_box_is_ipv6addr | ( | _x | ) | fr_type_is_ipv6addr((_x)->type) |
#define fr_box_is_ipv6prefix | ( | _x | ) | fr_type_is_ipv6prefix((_x)->type) |
#define fr_box_is_null | ( | _x | ) | fr_type_is_null((_x)->type) |
#define fr_box_is_numeric | ( | _x | ) | fr_type_is_numeric((_x)->type) |
#define fr_box_is_octets | ( | _x | ) | fr_type_is_octets((_x)->type) |
#define fr_box_is_quoted | ( | _x | ) | fr_type_is_quoted((_x)->type) |
#define fr_box_is_size | ( | _x | ) | fr_type_is_size((_x)->type) |
#define fr_box_is_string | ( | _x | ) | fr_type_is_string((_x)->type) |
#define fr_box_is_struct | ( | _x | ) | fr_type_is_struct((_x)->type) |
#define fr_box_is_structural | ( | _x | ) | fr_type_is_structural((_x)->type) |
#define fr_box_is_structural_except_vsa | ( | _x | ) | fr_type_is_structural_except_vsa((_x)->type) |
#define fr_box_is_time_delta | ( | _x | ) | fr_type_is_time_delta((_x)->type) |
#define fr_box_is_tlv | ( | _x | ) | fr_type_is_tlv((_x)->type) |
#define fr_box_is_uint16 | ( | _x | ) | fr_type_is_uint16((_x)->type) |
#define fr_box_is_uint32 | ( | _x | ) | fr_type_is_uint32((_x)->type) |
#define fr_box_is_uint64 | ( | _x | ) | fr_type_is_uint64((_x)->type) |
#define fr_box_is_uint8 | ( | _x | ) | fr_type_is_uint8((_x)->type) |
#define fr_box_is_value_box | ( | _x | ) | fr_type_is_value_box((_x)->type) |
#define fr_box_is_variable_size | ( | _x | ) | fr_type_is_variable_size((_x)->type) |
#define fr_box_is_vendor | ( | _x | ) | fr_type_is_vendor((_x)->type) |
#define fr_box_is_void | ( | _x | ) | fr_type_is_void((_x)->type) |
#define fr_box_is_vsa | ( | _x | ) | fr_type_is_vsa((_x)->type) |
#define fr_box_len | ( | _val, | |
_len | |||
) |
Create an ephemeral boxed value with a variable length.
[in] | _val | C variable to assign value from. |
[in] | _len | of C variable. |
#define fr_box_octets | ( | _val, | |
_len | |||
) | _fr_box_with_len(FR_TYPE_OCTETS, .vb_octets, _val, _len) |
#define fr_box_octets_buffer | ( | _val | ) | _fr_box_with_len(FR_TYPE_OCTETS, .vb_octets, _val, talloc_array_length(_val)) |
#define fr_box_size | ( | _val | ) | _fr_box(FR_TYPE_SIZE, .vb_size, _val) |
#define fr_box_strvalue | ( | _val | ) | _fr_box_with_len(FR_TYPE_STRING, .vb_strvalue, _val, strlen(_val)) |
#define fr_box_strvalue_buffer | ( | _val | ) | _fr_box_with_len(FR_TYPE_STRING, .vb_strvalue, _val, talloc_array_length(_val) - 1) |
#define fr_box_strvalue_len | ( | _val, | |
_len | |||
) | _fr_box_with_len(FR_TYPE_STRING, .vb_strvalue, _val, _len) |
#define fr_box_time | ( | _val | ) | _fr_box(FR_TYPE_DATE, .vb_date, fr_time_to_unix_time(_val)) |
#define fr_box_time_delta | ( | _val | ) | fr_box_time_delta_with_res((_val), FR_TIME_RES_SEC) |
#define fr_box_time_delta_msec | ( | _val | ) | fr_box_time_delta_with_res((_val), FR_TIME_RES_MSEC) |
#define fr_box_time_delta_nsec | ( | _val | ) | fr_box_time_delta_with_res((_val), FR_TIME_RES_NSEC) |
#define fr_box_time_delta_sec | ( | _val | ) | fr_box_time_delta_with_res((_val), FR_TIME_RES_SEC) |
#define fr_box_time_delta_usec | ( | _val | ) | fr_box_time_delta_with_res((_val), FR_TIME_RES_USEC) |
#define fr_box_time_delta_with_res | ( | _val, | |
_res | |||
) |
#define fr_box_uint128 | ( | _val | ) | _fr_box(FR_TYPE_UINT128, .vb_uint128, _val) |
#define fr_box_uint16 | ( | _val | ) | _fr_box(FR_TYPE_UINT16, .vb_uint16, _val) |
#define fr_box_uint32 | ( | _val | ) | _fr_box(FR_TYPE_UINT32, .vb_uint32, _val) |
#define fr_box_uint64 | ( | _val | ) | _fr_box(FR_TYPE_UINT64, .vb_uint64, _val) |
#define fr_box_uint8 | ( | _val | ) | _fr_box(FR_TYPE_UINT8, .vb_uint8, _val) |
#define FR_MAX_STRING_LEN 254 /* RFC2138: string 0-253 octets */ |
#define fr_value_box | ( | _box, | |
_var, | |||
_tainted | |||
) |
Automagically fill in a box, determining the value type from the type of the C variable.
Simplify boxing for simple C types using the _Generic macro to emit code that fills in the value box based on the type of _var provided.
[in] | _box | to assign value to. |
[in] | _var | C variable to assign value from. |
[in] | _tainted | Whether the value came from an untrusted source. |
#define fr_value_box_alloc | ( | _ctx, | |
_type, | |||
_enumv | |||
) | _fr_value_box_alloc(NDEBUG_LOCATION_EXP _ctx, _type, _enumv) |
Allocate a value box of a specific type.
Allocates memory for the box, and sets the length of the value for fixed length types.
[in] | _ctx | to allocate the value_box in. |
[in] | _type | of value. |
[in] | _enumv | Enumeration values. |
#define fr_value_box_alloc_null | ( | _ctx | ) | _fr_value_box_alloc(NDEBUG_LOCATION_EXP _ctx, FR_TYPE_NULL, NULL) |
Allocate a value box for later use with a value assignment function.
[in] | _ctx | to allocate the value_box in. |
#define fr_value_box_init | ( | _vb, | |
_type, | |||
_enumv, | |||
_tainted | |||
) | _fr_value_box_init(NDEBUG_LOCATION_EXP _vb, _type, _enumv, _tainted) |
Initialise a fr_value_box_t.
The value should be set later with one of the fr_value_box_* functions.
[in] | _vb | to initialise. |
[in] | _type | to set. |
[in] | _enumv | Enumeration values. |
[in] | _tainted | Whether data will come from an untrusted source. |
#define fr_value_box_init_null | ( | _vb | ) | _fr_value_box_init(NDEBUG_LOCATION_EXP _vb, FR_TYPE_NULL, NULL, false) |
#define FR_VALUE_BOX_INITIALISER | ( | _vb, | |
_type, | |||
_field, | |||
_val | |||
) |
A static initialiser for stack/globally allocated boxes.
#define FR_VALUE_BOX_INITIALISER_NULL | ( | _vb | ) |
A static initialiser for stack/globally allocated boxes.
We can only safely initialise a null box, as many other type need special initialisation
#define fr_value_box_is_safe_for | ( | _box, | |
_safe_for | |||
) | (_box->safe_for == (fr_value_box_safe_for_t)_safe_for) |
#define fr_value_box_len | ( | _ctx, | |
_box, | |||
_var, | |||
_len, | |||
_tainted | |||
) |
Automagically fill in a box, for types with length.
[in] | _ctx | to allocate value in. |
[in] | _box | to assign value to. |
[in] | _var | C variable to assign value from. |
[in] | _len | of C variable. |
[in] | _tainted | Whether the value came from an untrusted source. |
#define fr_value_box_list_foreach | ( | _list_head, | |
_iter | |||
) | fr_dlist_foreach(fr_value_box_list_dlist_head(_list_head), fr_value_box_t, _iter) |
#define fr_value_box_list_foreach_safe | ( | _list_head, | |
_iter | |||
) | fr_dlist_foreach_safe(fr_value_box_list_dlist_head(_list_head), fr_value_box_t, _iter) |
#define FR_VALUE_BOX_MAGIC RADIUSD_MAGIC_NUMBER |
#define fr_value_box_mark_safe_for | ( | _box, | |
_safe_for | |||
) | _fr_value_box_mark_safe_for(_box, (fr_value_box_safe_for_t)_safe_for) |
#define FR_VALUE_BOX_NET_ERROR SSIZE_MIN |
#define FR_VALUE_BOX_NET_MAX (FR_VALUE_BOX_NET_OOM + 1) |
#define FR_VALUE_BOX_NET_OOM (FR_VALUE_BOX_NET_ERROR + 1) |
#define FR_VALUE_BOX_TO_NETWORK_RETURN | ( | _dbuff, | |
_value | |||
) | FR_DBUFF_RETURN(fr_value_box_to_network, _dbuff, _value) |
#define fr_value_unbox_shallow | ( | _var, | |
_box | |||
) |
Unbox simple types performing type checks.
[out] | _var | to write to. |
[in] | _box | to unbox. |
#define VALUE_BOX_NDEBUG_INITIALISER .file = __FILE__, .line = __LINE__, .magic = FR_VALUE_BOX_MAGIC |
#define vb_float64 datum.float64 |
#define vb_should_free | ( | _action | ) | ((_action & FR_VALUE_BOX_LIST_FREE_BOX) == FR_VALUE_BOX_LIST_FREE_BOX) |
#define vb_should_free_value | ( | _action | ) | ((_action & FR_VALUE_BOX_LIST_FREE_BOX_VALUE) == FR_VALUE_BOX_LIST_FREE_BOX_VALUE) |
#define vb_should_remove | ( | _action | ) | ((_action & FR_VALUE_BOX_LIST_REMOVE) == FR_VALUE_BOX_LIST_REMOVE) |
typedef int(* fr_value_box_escape_t) (fr_value_box_t *vb, void *uctx) |
typedef uintptr_t fr_value_box_safe_for_t |
Escaping that's been applied to a value box.
This should be a unique value for each dialect being escaped. If the value is 0, then the box is not escaped. If the escaped value matches the escaped value of the function performing the escaping then it should not be re-escaped.
typedef struct value_box_s fr_value_box_t |
Actions to perform when we process a box in a list.
|
inlinestatic |
|
inlinestatic |
void _fr_value_box_mark_safe_for | ( | fr_value_box_t * | box, |
fr_value_box_safe_for_t | safe_for | ||
) |
int format | ( | printf | , |
5 | , | ||
0 | |||
) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
int fr_value_box_asprintf | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
bool | tainted, | ||
char const * | fmt, | ||
... | |||
) |
int fr_value_box_bstr_alloc | ( | TALLOC_CTX * | ctx, |
char ** | out, | ||
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
size_t | len, | ||
bool | tainted | ||
) |
Alloc and assign an empty \0 terminated string to a fr_value_box_t.
[in] | ctx | to allocate any new buffers in. |
[out] | out | if non-null where to write a pointer to the new buffer. |
[in] | dst | to assign new buffer to. |
[in] | enumv | Aliases for values. |
[in] | len | of buffer to allocate. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 4071 of file value.c.
int fr_value_box_bstr_append_buffer | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
char const * | src, | ||
bool | tainted | ||
) |
Append a talloced buffer to an existing fr_value_box_t.
[in] | ctx | Where to allocate any talloc buffers required. |
[in] | dst | value box to append to. |
[in] | src | string data to append. |
[in] | tainted | Whether src is tainted. |
Definition at line 4337 of file value.c.
int fr_value_box_bstr_realloc | ( | TALLOC_CTX * | ctx, |
char ** | out, | ||
fr_value_box_t * | dst, | ||
size_t | len | ||
) |
Change the length of a buffer already allocated to a value box.
[in] | ctx | to realloc buffer in. |
[out] | out | if non-null where to write a pointer to the new buffer. |
[in] | dst | to realloc buffer for. |
[in] | len | to realloc to (don't include nul byte). |
Definition at line 4104 of file value.c.
int fr_value_box_bstrdup_buffer | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
char const * | src, | ||
bool | tainted | ||
) |
Copy a nul terminated talloced buffer to a fr_value_box_t.
Copy a talloced nul terminated buffer, setting fields in the dst value box appropriately.
The buffer must be \0 terminated, or an error will be returned.
[in] | ctx | to allocate any new buffers in. |
[in] | dst | to assign new buffer to. |
[in] | enumv | Aliases for values. |
[in] | src | a talloced nul terminated buffer. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 4208 of file value.c.
int fr_value_box_bstrdup_buffer_shallow | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
char const * | src, | ||
bool | tainted | ||
) |
Assign a talloced buffer containing a nul terminated string to a box, but don't copy it.
Adds a reference to the src buffer so that it cannot be freed until the ctx is freed.
[in] | ctx | to add reference from. If NULL no reference will be added. |
[in] | dst | to assign string to. |
[in] | enumv | Aliases for values. |
[in] | src | to copy string from. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 4253 of file value.c.
int fr_value_box_bstrn_append | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
char const * | src, | ||
size_t | len, | ||
bool | tainted | ||
) |
Append bytes from a buffer to an existing fr_value_box_t.
[in] | ctx | Where to allocate any talloc buffers required. |
[in] | dst | value box to append to. |
[in] | src | octets data to append. |
[in] | len | length of octets data. |
[in] | tainted | Whether src is tainted. |
Definition at line 4284 of file value.c.
int fr_value_box_bstrndup | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
char const * | src, | ||
size_t | len, | ||
bool | tainted | ||
) |
Copy a string to to a fr_value_box_t.
[in] | ctx | to allocate any new buffers in. |
[in] | dst | to assign buffer to. |
[in] | enumv | Aliases for values. |
[in] | src | a string. May be NULL only if len == 0. |
[in] | len | of src. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 4148 of file value.c.
int fr_value_box_bstrndup_dbuff | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
fr_dbuff_t * | dbuff, | ||
size_t | len, | ||
bool | tainted | ||
) |
void fr_value_box_bstrndup_shallow | ( | fr_value_box_t * | dst, |
fr_dict_attr_t const * | enumv, | ||
char const * | src, | ||
size_t | len, | ||
bool | tainted | ||
) |
Assign a string to to a fr_value_box_t.
[in] | dst | to assign new buffer to. |
[in] | enumv | Aliases for values. |
[in] | src | a string. |
[in] | len | of src. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 4232 of file value.c.
int fr_value_box_cast | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_type_t | dst_type, | ||
fr_dict_attr_t const * | dst_enumv, | ||
fr_value_box_t const * | src | ||
) |
Convert one type of fr_value_box_t to another.
This should be the canonical function used to convert between INTERNAL data formats.
If you want to convert from PRESENTATION format, use fr_value_box_from_substr.
ctx | to allocate buffers in (usually the same as dst) |
dst | Where to write result of casting. |
dst_type | to cast to. |
dst_enumv | Aliases for values contained within this fr_value_box_t. If fr_value_box_t is passed to fr_value_box_aprint names will be printed instead of actual value. |
src | Input data. |
Definition at line 3352 of file value.c.
int fr_value_box_cast_in_place | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | vb, | ||
fr_type_t | dst_type, | ||
fr_dict_attr_t const * | dst_enumv | ||
) |
Convert one type of fr_value_box_t to another in place.
This should be the canonical function used to convert between INTERNAL data formats.
If you want to convert from PRESENTATION format, use fr_value_box_from_substr.
ctx | to allocate buffers in (usually the same as dst) |
vb | to cast. |
dst_type | to cast to. |
dst_enumv | Aliases for values contained within this fr_value_box_t. If fr_value_box_t is passed to fr_value_box_aprint names will be printed instead of actual value. |
Definition at line 3572 of file value.c.
void fr_value_box_clear | ( | fr_value_box_t * | data | ) |
void fr_value_box_clear_value | ( | fr_value_box_t * | data | ) |
int8_t fr_value_box_cmp | ( | fr_value_box_t const * | a, |
fr_value_box_t const * | b | ||
) |
int fr_value_box_cmp_op | ( | fr_token_t | op, |
fr_value_box_t const * | a, | ||
fr_value_box_t const * | b | ||
) |
|
inlinestatic |
int fr_value_box_copy | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
const fr_value_box_t * | src | ||
) |
Copy value data verbatim duplicating any buffers.
ctx | To allocate buffers in. |
dst | Where to copy value_box to. |
src | Where to copy value_box from. |
Definition at line 3740 of file value.c.
void fr_value_box_copy_shallow | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_value_box_t const * | src | ||
) |
Perform a shallow copy of a value_box.
Like fr_value_box_copy, but does not duplicate the buffers of the src value_box.
For FR_TYPE_STRING and FR_TYPE_OCTETS adds a reference from ctx so that the buffer cannot be freed until the ctx is freed.
[in] | ctx | to add reference from. If NULL no reference will be added. |
[in] | dst | to copy value to. |
[in] | src | to copy value from. |
Definition at line 3834 of file value.c.
void fr_value_box_debug | ( | fr_value_box_t const * | vb | ) |
int fr_value_box_escape_in_place | ( | fr_value_box_t * | vb, |
fr_value_box_escape_t | escape, | ||
fr_value_box_safe_for_t | safe_for, | ||
void * | uctx | ||
) |
Escape a single value box in place.
[in] | vb | to escape. |
[in] | escape | function to apply to the value box. |
[in] | safe_for | the escaped value to check value boxes again. box has an escaped value that matches, it will not be re-escaped. |
[in] | uctx | user context to pass to the escape function. |
Definition at line 5945 of file value.c.
|
inlinestatic |
Removes a single layer of nesting, moving all children into the parent list.
[in] | ctx | to reparent children in if steal is true. |
[in] | list | to flatten. |
[in] | steal | whether to change the talloc ctx of children. |
[in] | free | whether to free any group boxes which have had their children removed. |
Definition at line 6003 of file value.c.
ssize_t fr_value_box_from_network | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_type_t | type, | ||
fr_dict_attr_t const * | enumv, | ||
fr_dbuff_t * | dbuff, | ||
size_t | len, | ||
bool | tainted | ||
) |
Decode a fr_value_box_t from serialized binary data.
The general deserialization rules are:
Dates are decoded as 32bit unsigned UNIX timestamps.
All of the dictionary rules are respected. string/octets can have a fixed length, or can have an 8/16-bit "length" prefix. If the enumv is not an array, then the input # len MUST be the correct size (not too large or small), otherwise an error is returned.
If the enumv is an array, then the input must have the minimum length, and the number of bytes decoded is capped at the maximum length allowed to be decoded. This behavior allows the caller to decode an array of values simply by calling this function in a loop.
[in] | ctx | Where to allocate any talloc buffers required. |
[out] | dst | value_box to write the result to. |
[in] | type | to decode data to. |
[in] | enumv | Aliases for values. |
[in] | dbuff | Binary data to decode. |
[in] | len | Length of data to decode. For fixed length types we only decode complete values. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 1754 of file value.c.
ssize_t fr_value_box_from_str | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_type_t | dst_type, | ||
fr_dict_attr_t const * | dst_enumv, | ||
char const * | in, | ||
size_t | inlen, | ||
fr_sbuff_unescape_rules_t const * | erules, | ||
bool | tainted | ||
) |
ssize_t fr_value_box_from_substr | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_type_t | dst_type, | ||
fr_dict_attr_t const * | dst_enumv, | ||
fr_sbuff_t * | in, | ||
fr_sbuff_parse_rules_t const * | rules, | ||
bool | tainted | ||
) |
Convert string value to a fr_value_box_t type.
[in] | ctx | to alloc strings in. |
[out] | dst | where to write parsed value. |
[in,out] | dst_type | of value data to create/dst_type of value created. |
[in] | dst_enumv | fr_dict_attr_t with string names for uint32 values. |
[in] | in | sbuff to read data from. |
[in] | rules | unescape and termination rules. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 4802 of file value.c.
uint32_t fr_value_box_hash | ( | fr_value_box_t const * | vb | ) |
static size_t char fr_sbuff_t size_t char quote int fr_value_box_hton | ( | fr_value_box_t * | dst, |
fr_value_box_t const * | src | ||
) |
Performs byte order reversal for types that need it.
[in] | dst | Where to write the result. May be the same as src. |
[in] | src | fr_value_box_t containing an uint32 value. |
Definition at line 1231 of file value.c.
void fr_value_box_increment | ( | fr_value_box_t * | vb | ) |
int fr_value_box_ipaddr | ( | fr_value_box_t * | dst, |
fr_dict_attr_t const * | enumv, | ||
fr_ipaddr_t const * | ipaddr, | ||
bool | tainted | ||
) |
Assign a fr_value_box_t value from an fr_ipaddr_t.
Automatically determines the type of the value box from the ipaddr address family and the length of the prefix field.
[in] | dst | to assign ipaddr to. |
[in] | enumv | Aliases for values. |
[in] | ipaddr | to copy address from. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 3630 of file value.c.
|
inlinestatic |
bool fr_value_box_is_truthy | ( | fr_value_box_t const * | in | ) |
Check truthiness of values.
The casting rules for expressions / conditions are slightly different than fr_value_box_cast(). Largely because that function is used to parse configuration files, and parses "yes / no" and "true / false" strings, even if there's no fr_dict_attr_t passed to it.
Definition at line 6326 of file value.c.
int fr_value_box_list_acopy | ( | TALLOC_CTX * | ctx, |
fr_value_box_list_t * | out, | ||
fr_value_box_list_t const * | in | ||
) |
Do a full copy of a list of value boxes.
[in] | ctx | to allocate boxes in. |
[out] | out | Where to write the head of the new list. |
[in] | in | boxes to copy. |
Definition at line 6158 of file value.c.
char* fr_value_box_list_aprint | ( | TALLOC_CTX * | ctx, |
fr_value_box_list_t const * | list, | ||
char const * | delim, | ||
fr_sbuff_escape_rules_t const * | e_rules | ||
) |
Concatenate the string representations of a list of value boxes together.
[in] | ctx | to allocate the buffer in. |
[in] | list | of value boxes. |
[in] | delim | to insert between value box values. |
[in] | e_rules | to control escaping of the concatenated elements. |
Definition at line 6028 of file value.c.
char* fr_value_box_list_aprint_secure | ( | TALLOC_CTX * | ctx, |
fr_value_box_list_t const * | list, | ||
char const * | delim, | ||
fr_sbuff_escape_rules_t const * | e_rules | ||
) |
Concatenate the string representations of a list of value boxes together hiding "secret" values.
[in] | ctx | to allocate the buffer in. |
[in] | list | of value boxes. |
[in] | delim | to insert between value box values. |
[in] | e_rules | to control escaping of the concatenated elements. |
Definition at line 6078 of file value.c.
ssize_t fr_value_box_list_concat_as_octets | ( | bool * | tainted, |
bool * | secret, | ||
fr_dbuff_t * | dbuff, | ||
fr_value_box_list_t * | list, | ||
uint8_t const * | sep, | ||
size_t | sep_len, | ||
fr_value_box_list_action_t | proc_action, | ||
bool | flatten | ||
) |
Concatenate a list of value boxes together.
All boxes will be removed from the list.
[out] | tainted | If nonnull, will be set to true if any input boxes are tainted. bool pointed to must be initialised. |
[out] | secret | If nonnull, will be set to true if any input boxes are secret. |
[out] | dbuff | to write the result of the concatenation to. |
[in] | list | to concatenate. |
[in] | sep | Insert a separator between the values. |
[in] | sep_len | Length of the separator. |
[in] | proc_action | What to do with the boxes in the list once they've been processed. |
[in] | flatten | If true and we encounter a FR_TYPE_GROUP, we concat the contents of its children together. If false, the contents will be cast to FR_TYPE_OCTETS. |
Definition at line 5677 of file value.c.
ssize_t fr_value_box_list_concat_as_string | ( | bool * | tainted, |
bool * | secret, | ||
fr_sbuff_t * | sbuff, | ||
fr_value_box_list_t * | list, | ||
char const * | sep, | ||
size_t | sep_len, | ||
fr_sbuff_escape_rules_t const * | e_rules, | ||
fr_value_box_list_action_t | proc_action, | ||
fr_value_box_safe_for_t | safe_for, | ||
bool | flatten | ||
) |
Concatenate a list of value boxes together.
All boxes will be removed from the list.
[out] | tainted | If nonnull, will be set to true if any input boxes are tainted. bool pointed to must be initialised. |
[out] | secret | If nonnull, will be set to true if any input boxes are secret. |
[out] | sbuff | to write the result of the concatenation to. |
[in] | list | to concatenate. |
[in] | sep | Insert a separator between the values. |
[in] | sep_len | Length of the separator. |
[in] | e_rules | To apply to FR_TYPE_STRING types. Is not currently applied to any other box type. |
[in] | proc_action | What to do with the boxes in the list once they've been processed. |
[in] | safe_for | if value has this safe_for value, don't apply the escape rules. |
[in] | flatten | If true and we encounter a FR_TYPE_GROUP, we concat the contents of its children together. If false, the contents will be cast to FR_TYPE_STRING. |
Definition at line 5584 of file value.c.
int fr_value_box_list_concat_in_place | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | out, | ||
fr_value_box_list_t * | list, | ||
fr_type_t | type, | ||
fr_value_box_list_action_t | proc_action, | ||
bool | flatten, | ||
size_t | max_size | ||
) |
Concatenate a list of value boxes.
[in] | ctx | to allocate new value buffer in. |
[out] | out | Where to write the resulting box. |
[in] | list | to concatenate together. |
[in] | type | May be FR_TYPE_STRING or FR_TYPE_OCTETS, no other types are supported. |
[in] | proc_action | What to do with the boxes in the list once they've been processed. |
[in] | flatten | If true and we encounter a FR_TYPE_GROUP, we concat the contents of its children together. If false, the contents will be cast to the given type. |
[in] | max_size | of the value. |
Definition at line 5777 of file value.c.
void fr_value_box_list_debug | ( | fr_value_box_list_t const * | head | ) |
int fr_value_box_list_escape_in_place | ( | fr_value_box_list_t * | list, |
fr_value_box_escape_t | escape, | ||
fr_value_box_safe_for_t | safe_for, | ||
void * | uctx | ||
) |
Escape a list of value boxes in place.
[in] | list | to escape. |
[in] | escape | function to apply to the value box. |
[in] | safe_for | the escaped value to check value boxes again. box has an escaped value that matches, it will not be re-escaped. |
[in] | uctx | user context to pass to the escape function. |
Definition at line 5982 of file value.c.
|
inlinestatic |
Determines whether a list contains the number of boxes required.
[in] | list | of value boxes. |
[in] | min | The number of boxes required to return true. |
Definition at line 677 of file value.h.
void fr_value_box_list_mark_safe_for | ( | fr_value_box_list_t * | list, |
fr_value_box_safe_for_t | safe_for | ||
) |
void fr_value_box_list_taint | ( | fr_value_box_list_t * | head | ) |
bool fr_value_box_list_tainted | ( | fr_value_box_list_t const * | head | ) |
void fr_value_box_list_untaint | ( | fr_value_box_list_t * | head | ) |
void fr_value_box_list_verify | ( | char const * | file, |
int | line, | ||
fr_value_box_list_t const * | list | ||
) |
void fr_value_box_mark_unsafe | ( | fr_value_box_t * | vb | ) |
int fr_value_box_mem_alloc | ( | TALLOC_CTX * | ctx, |
uint8_t ** | out, | ||
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
size_t | len, | ||
bool | tainted | ||
) |
Pre-allocate an octets buffer for filling by the caller.
[in] | ctx | to allocate any new buffers in. |
[out] | out | If non-null will be filled with a pointer to the new buffer. |
[in] | dst | to assign new buffer to. |
[in] | enumv | Aliases for values. |
[in] | len | of data in the buffer. If 0, a zero length talloc buffer will be alloced. dst->vb_octets will NOT be NULL. You should use the length field of the box to determine if any value is assigned. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 4371 of file value.c.
int fr_value_box_mem_append | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
uint8_t const * | src, | ||
size_t | len, | ||
bool | tainted | ||
) |
Append data to an existing fr_value_box_t.
[in] | ctx | Where to allocate any talloc buffers required. |
[in] | dst | value box to append to. |
[in] | src | octets data to append. |
[in] | len | length of octets data. |
[in] | tainted | Whether src is tainted. |
Definition at line 4587 of file value.c.
int fr_value_box_mem_append_buffer | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
uint8_t const * | src, | ||
bool | tainted | ||
) |
Append a talloc buffer to an existing fr_value_box_t.
[in] | ctx | Where to allocate any talloc buffers required. |
[in] | dst | value box to append to. |
[in] | src | octets data to append. |
[in] | tainted | Whether src is tainted. |
Definition at line 4637 of file value.c.
int fr_value_box_mem_realloc | ( | TALLOC_CTX * | ctx, |
uint8_t ** | out, | ||
fr_value_box_t * | dst, | ||
size_t | len | ||
) |
Change the length of a buffer already allocated to a value box.
[in] | ctx | to realloc buffer in. |
[out] | out | if non-null where to write a pointer to the new buffer. |
[in] | dst | to realloc buffer for. |
[in] | len | to realloc to. |
Definition at line 4404 of file value.c.
|
inlinestatic |
Copy a C value value to a value box.
This is useful when interacting with 3rd party libraries, and doing configuration parsing as it allows us to use standard parsing and casting functions and then emit the result as a C value.
The field pointed to by in must be of the same type as we use to represent the value boxe's value in its datum union, or at least the same size.
No checks are done to ensure this is the case, so if you get this wrong it'll lead to silent memory corruption.
[in] | vb | destination value box, MUST already be initialized |
[out] | in | C variable to read from |
Definition at line 798 of file value.h.
|
inlinestatic |
Copy the value of a value box to a field in a C struct.
This is useful when interacting with 3rd party libraries, and doing configuration parsing as it allows us to use standard parsing and casting functions and then emit the result as a C value.
The field pointed to by out must be of the same type as we use to represent the value boxe's value in its datum union, or at least the same size.
No checks are done to ensure this is the case, so if you get this wrong it'll lead to silent memory corruption.
[out] | out | Field in struct to write variable to. |
[in] | vb | to copy value from. |
Definition at line 764 of file value.h.
int fr_value_box_memdup | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
uint8_t const * | src, | ||
size_t | len, | ||
bool | tainted | ||
) |
Copy a buffer to a fr_value_box_t.
Copy a buffer containing binary data, setting fields in the dst value box appropriately.
[in] | ctx | to allocate any new buffers in. |
[in] | dst | to assign new buffer to. |
[in] | enumv | Aliases for values. |
[in] | src | a buffer. |
[in] | len | of data in the buffer. If 0, a zero length talloc buffer will be alloced. dst->vb_octets will NOT be NULL. You should use the length field of the box to determine if any value is assigned. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 4468 of file value.c.
int fr_value_box_memdup_buffer | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
uint8_t const * | src, | ||
bool | tainted | ||
) |
Copy a talloced buffer to a fr_value_box_t.
Copy a buffer containing binary data, setting fields in the dst value box appropriately.
[in] | ctx | to allocate any new buffers in. |
[in] | dst | to assign new buffer to. |
[in] | enumv | Aliases for values. |
[in] | src | a buffer. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 4526 of file value.c.
void fr_value_box_memdup_buffer_shallow | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
uint8_t const * | src, | ||
bool | tainted | ||
) |
Assign a talloced buffer to a box, but don't copy it.
Adds a reference to the src buffer so that it cannot be freed until the ctx is freed.
[in] | ctx | to allocate any new buffers in. |
[in] | dst | to assign buffer to. |
[in] | enumv | Aliases for values. |
[in] | src | a talloced buffer. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 4566 of file value.c.
int fr_value_box_memdup_dbuff | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
fr_dbuff_t * | dbuff, | ||
size_t | len, | ||
bool | tainted | ||
) |
void fr_value_box_memdup_shallow | ( | fr_value_box_t * | dst, |
fr_dict_attr_t const * | enumv, | ||
uint8_t const * | src, | ||
size_t | len, | ||
bool | tainted | ||
) |
Assign a buffer to a box, but don't copy it.
Adds a reference to the src buffer so that it cannot be freed until the ctx is freed.
Caller should set dst->taint = true, where the value was acquired from an untrusted source.
[in] | dst | to assign buffer to. |
[in] | enumv | Aliases for values. |
[in] | src | a talloced buffer. |
[in] | len | of buffer. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 4548 of file value.c.
size_t fr_value_box_network_length | ( | fr_value_box_t const * | value | ) |
Get the size of the value held by the fr_value_box_t.
This is the length of the NETWORK presentation
Definition at line 1325 of file value.c.
ssize_t fr_value_box_print | ( | fr_sbuff_t * | out, |
fr_value_box_t const * | data, | ||
fr_sbuff_escape_rules_t const * | e_rules | ||
) |
Print one boxed value to a string.
This function should primarily be used when a fr_value_box_t is being serialized in some non-standard way, i.e. as a value for a field in a database, in all other instances it's better to use fr_value_box_print_quoted.
[in] | out | Where to write the printed string. |
[in] | data | Value box to print. |
[in] | e_rules | To apply to FR_TYPE_STRING types, for escaping quotation characters only. Is not currently applied to any other box type. |
Definition at line 5352 of file value.c.
ssize_t fr_value_box_print_quoted | ( | fr_sbuff_t * | out, |
fr_value_box_t const * | data, | ||
fr_token_t | quote | ||
) |
Print one boxed value to a string with quotes (where needed)
[in] | out | Where to write the printed string. |
[in] | data | Value box to print. |
[in] | quote | To apply to FR_TYPE_STRING types. Is not currently applied to any other box type. |
Definition at line 5540 of file value.c.
|
inlinestatic |
Return a pointer to the "raw" value from a value-box.
This has "const" input and "unconst" output because sometimes it's used to copy out of, and sometimes in to, a value-box. We rely on the caller to know the correct uses of it.
Definition at line 740 of file value.h.
|
inlinestatic |
int fr_value_box_steal | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_value_box_t * | src | ||
) |
Copy value data verbatim moving any buffers to the specified context.
[in] | ctx | to allocate any new buffers in. |
[in] | dst | to copy value to. |
[in] | src | to copy value from. |
Definition at line 3858 of file value.c.
int fr_value_box_strdup | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
char const * | src, | ||
bool | tainted | ||
) |
Copy a nul terminated string to a fr_value_box_t.
[in] | ctx | to allocate any new buffers in. |
[in] | dst | to assign new buffer to. |
[in] | enumv | Aliases for values. |
[in] | src | a nul terminated buffer. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 3927 of file value.c.
void fr_value_box_strdup_shallow | ( | fr_value_box_t * | dst, |
fr_dict_attr_t const * | enumv, | ||
char const * | src, | ||
bool | tainted | ||
) |
Assign a buffer containing a nul terminated string to a box, but don't copy it.
[in] | dst | to assign string to. |
[in] | enumv | Aliases for values. |
[in] | src | to copy string from. |
[in] | tainted | Whether the value came from a trusted source. |
Definition at line 4036 of file value.c.
void fr_value_box_strdup_shallow_replace | ( | fr_value_box_t * | vb, |
char const * | src, | ||
ssize_t | len | ||
) |
Free the existing buffer (if talloced) associated with the valuebox, and replace it with a new one.
[in] | vb | to replace string in. |
[in] | src | to assign string from. |
[in] | len | of src. |
Definition at line 4052 of file value.c.
int fr_value_box_strtrim | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | vb | ||
) |
int fr_value_box_to_key | ( | uint8_t ** | out, |
size_t * | outlen, | ||
fr_value_box_t const * | value | ||
) |
Get a key from a value box.
[in,out] | out | - set to a small buffer on input. If the callback has more data than is available here, the callback can update "out" to point elsewhere |
[in,out] | outlen | The number of bits available in the initial buffer. On output, the number of bits available in the key |
[in] | value | the value box which contains the key |
Definition at line 2084 of file value.c.
ssize_t fr_value_box_to_network | ( | fr_dbuff_t * | dbuff, |
fr_value_box_t const * | value | ||
) |
Encode a single value box, serializing its contents in generic network format.
The serialized form of fr_value_box_t may not match the requirements of your protocol completely. In cases where they do not, you should overload specific types in the function calling fr_value_box_to_network.
The general serialization rules are:
FR_TYPE_SIZE is not encodable, as it is system specific.
This function will not encode structural types (TLVs, VSAs etc...). These are usually specific to the protocol anyway.
All of the dictionary rules are respected. string/octets can have a fixed length (which is zero-padded if necessary), or can have an 8/16-bit "length" prefix.
[out] | dbuff | Where to write serialized data. |
[in] | value | to encode. |
Definition at line 1404 of file value.c.
int fr_value_box_vasprintf | ( | TALLOC_CTX * | ctx, |
fr_value_box_t * | dst, | ||
fr_dict_attr_t const * | enumv, | ||
bool | tainted, | ||
char const * | fmt, | ||
va_list | ap | ||
) |
void fr_value_box_verify | ( | char const * | file, |
int | line, | ||
fr_value_box_t const * | vb | ||
) |
Validation function to check that a fr_value_box_t is correctly initialised.
Definition at line 6229 of file value.c.
|
inlinestatic |
size_t fr_value_str_unescape | ( | fr_sbuff_t * | out, |
fr_sbuff_t * | in, | ||
size_t | inlen, | ||
char | quote | ||
) |
Convert a string value with escape sequences into its binary form.
The quote character determines the escape sequences recognised.
- \\ - Literal backslash. - \<quote> - The quotation char.
- \a - Alert. - \b - Backspace. - \e - Escape character i.e. (\) - \r - Carriage return. - \n - Newline. - \t - Tab. - \v - Vertical tab - \<oct> - An octal escape sequence. - \x<hex> - A hex escape sequence.
[out] | out | Where to write the unescaped string. |
[in] | in | The string to unescape. |
[in] | inlen | Length of input string. Pass SIZE_MAX to copy all data in the input buffer. |
[in] | quote | Character around the string, determines unescaping mode. |
Definition at line 1128 of file value.c.
size_t fr_value_substr_unescape | ( | fr_sbuff_t * | out, |
fr_sbuff_t * | in, | ||
size_t | inlen, | ||
char | quote | ||
) |
Convert a string value with escape sequences into its binary form.
The quote character determines the escape sequences recognised.
- \\ - Literal backslash. - \<quote> - The quotation char.
- \a - Alert. - \b - Backspace. - \e - Escape character i.e. (\) - \r - Carriage return. - \n - Newline. - \t - Tab. - \v - Vertical tab - \<oct> - An octal escape sequence. - \x<hex> - A hex escape sequence.
[out] | out | Where to write the unescaped string. |
[in] | in | The string to unescape. |
[in] | inlen | Length of input string. Pass SIZE_MAX to copy all data in the input buffer. |
[in] | quote | Character around the string, determines unescaping mode. |
Definition at line 1201 of file value.c.
|
inlinestatic |
Unbox an ethernet value (6 bytes, network byte order)
[in] | dst | Where to copy the ethernet address to. |
[in] | src | Where to copy the ethernet address from. |
Definition at line 915 of file value.h.
int fr_value_unbox_ipaddr | ( | fr_ipaddr_t * | dst, |
fr_value_box_t * | src | ||
) |
int nonnull | ( | 2 | , |
5 | |||
) |
|
extern |
How many bytes wide each of the value data fields are.
This is useful when copying a value from a fr_value_box_t to a memory location passed as a void *.
|
extern |
Where the value starts in the fr_value_box_t.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
size_t char fr_sbuff_t* in |
size_t char fr_sbuff_t size_t inlen |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Parse rules for quoted strings.
These parse rules should be used for internal parsing functions that are working with configuration files.
They include appropriate quote terminals to force functions parsing quoted strings to return when they reach a quote character.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Parse rules for non-quoted strings.
These parse rules should be used for processing escape sequences in data from external data sources like SQL databases and REST APIs.
They do not include terminals to stop parsing as it assumes the values are discrete, and not wrapped in quotes.