The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
value.h File Reference

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>
+ Include dependency graph for value.h:

Go to the source code of this file.

Data Structures

union  fr_value_box_datum_t
 
struct  fr_value_box_datum_t.__unnamed145__
 
union  fr_value_box_datum_t.__unnamed145__.__unnamed147__
 
struct  value_box_s
 Union containing all data types supported by the server. More...
 

Macros

#define _CONST   const
 
#define FR_MAX_STRING_LEN   254 /* RFC2138: string 0-253 octets */
 
#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_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
 Special value to indicate fr_value_box_from_network experienced a general error. More...
 
#define FR_VALUE_BOX_NET_MAX   (FR_VALUE_BOX_NET_OOM + 1)
 Special value to ensure other encoding/decoding errors don't overlap. More...
 
#define FR_VALUE_BOX_NET_OOM   (FR_VALUE_BOX_NET_ERROR + 1)
 Special value to indicate fr_value_box_from_network hit an out of memory error. More...
 
#define FR_VALUE_BOX_TO_NETWORK_RETURN(_dbuff, _value)   FR_DBUFF_RETURN(fr_value_box_to_network, _dbuff, _value)
 
#define VALUE_BOX_LIST_VERIFY(_x)   fr_assert(_x)
 
#define VALUE_BOX_LIST_VERIFY(_x)   fr_assert(_x)
 
#define VALUE_BOX_NDEBUG_INITIALISER   .file = __FILE__, .line = __LINE__, .magic = FR_VALUE_BOX_MAGIC
 
#define VALUE_BOX_VERIFY(_x)   fr_assert(_x)
 
#define VALUE_BOX_VERIFY(_x)   fr_assert(_x)
 
#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)
 

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_immutable (fr_value_box_t *box)
 
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...
 

Variables

size_t const fr_value_box_field_sizes []
 How many bytes wide each of the value data fields are. More...
 
size_t const fr_value_box_offsets []
 Where the value starts in the fr_value_box_t. More...
 
fr_sbuff_escape_rules_t fr_value_escape_backtick
 
fr_sbuff_escape_rules_tfr_value_escape_by_char [UINT8_MAX+1]
 
fr_sbuff_escape_rules_tfr_value_escape_by_quote [T_TOKEN_LAST]
 
fr_sbuff_escape_rules_t fr_value_escape_double
 
fr_sbuff_escape_rules_t fr_value_escape_secret
 Escape secret fields by simply mashing all data to '. More...
 
fr_sbuff_escape_rules_t fr_value_escape_single
 
fr_sbuff_escape_rules_t fr_value_escape_solidus
 
fr_sbuff_escape_rules_t fr_value_escape_unprintables
 
fr_sbuff_unescape_rules_t fr_value_unescape_backtick
 
fr_sbuff_unescape_rules_tfr_value_unescape_by_char [UINT8_MAX+1]
 
fr_sbuff_unescape_rules_tfr_value_unescape_by_quote [T_TOKEN_LAST]
 
fr_sbuff_unescape_rules_t fr_value_unescape_double
 
fr_sbuff_unescape_rules_t fr_value_unescape_single
 
fr_sbuff_unescape_rules_t fr_value_unescape_solidus
 
static size_t char fr_sbuff_tin
 
static size_t char fr_sbuff_t size_t inlen
 
static size_t char ** out
 

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
 

Argument boxing macros

These macros allow C types to be passed to functions which take boxed arguments, without needing to declare a fr_value_box_t explicitly on the stack.

#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 fr_box(_val)
 Create an ephemeral box. More...
 
#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_len(_val, _len)
 Create an ephemeral boxed value with a variable length. More...
 
#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)
 

Type checking macros

Convenience macros for checking if a box is a specific type.

#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_non_value(_x)   fr_type_is_non_value((_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(_x)   fr_type_is_value((_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)
 

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_tfr_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_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_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_quoted
 
fr_sbuff_parse_rules_t const value_parse_rules_single_unquoted
 
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_tfr_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, 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...
 

Detailed Description

Boxed value structures and functions to manipulate them.

Definition in file value.h.


Data Structure Documentation

◆ fr_value_box_datum_t

union fr_value_box_datum_t

Definition at line 101 of file value.h.

+ Collaboration diagram for 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.

◆ fr_value_box_datum_t.__unnamed145__

struct fr_value_box_datum_t.__unnamed145__

Definition at line 105 of file value.h.

Data Fields
__unnamed145__ __unnamed__
size_t length Only these types are variable length.

◆ fr_value_box_datum_t.__unnamed145__.__unnamed147__

union fr_value_box_datum_t.__unnamed145__.__unnamed147__

Definition at line 106 of file value.h.

Data Fields
uint8_t const *_CONST octets Pointer to binary string.
void *_CONST ptr generic pointer.
char const *_CONST strvalue Pointer to UTF-8 string.

◆ value_box_s

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.

Definition at line 166 of file value.h.

+ Collaboration diagram for value_box_s:
Data Fields
fr_value_box_datum_t datum The value held by the value box.

Should appear last for packing efficiency.

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

Macro Definition Documentation

◆ _CONST

#define _CONST   const

Definition at line 64 of file value.h.

◆ _fr_box

#define _fr_box (   _type,
  _field,
  _val 
)    (&(fr_value_box_t){ .type = _type, _field = (_val), VALUE_BOX_NDEBUG_INITIALISER })

Definition at line 285 of file value.h.

◆ _fr_box_with_da

#define _fr_box_with_da (   _type,
  _field,
  _val,
  _da 
)    (&(fr_value_box_t){ .type = _type, _field = (_val), .enumv = (_da) })

Definition at line 323 of file value.h.

◆ _fr_box_with_len

#define _fr_box_with_len (   _type,
  _field,
  _val,
  _len 
)    &(fr_value_box_t){ .type = _type, _field = _val, .vb_length = _len, VALUE_BOX_NDEBUG_INITIALISER }

Definition at line 276 of file value.h.

◆ DEF_BOXING_FUNC

#define DEF_BOXING_FUNC (   _ctype,
  _field,
  _type 
)
Value:
static inline , always_inline) \
int fr_value_box_##_field(fr_value_box_t *dst, fr_dict_attr_t const *enumv, \
_ctype const value, bool tainted) { \
fr_value_box_init(dst, _type, enumv, tainted); \
dst->vb_##_field = value; \
return 0; \
}
Test enumeration values.
Definition: dict_test.h:92

Definition at line 818 of file value.h.

◆ DEF_UNBOXING_FUNC

#define DEF_UNBOXING_FUNC (   _ctype,
  _field,
  _type 
)
Value:
static inline \
int fr_value_unbox_##_field(_ctype *var, fr_value_box_t const *src) { \
if (unlikely(src->type != _type)) { \
fr_strerror_printf("Unboxing failed. Needed type %s, had type %s", \
fr_type_to_str(_type), \
fr_type_to_str(src->type)); \
return -1; \
} \
*var = src->vb_##_field; \
return 0; \
}
#define unlikely(_x)
Definition: build.h:378
static char const * fr_type_to_str(fr_type_t type)
Return a static string containing the type name.
Definition: types.h:433

Definition at line 914 of file value.h.

◆ fr_box

#define fr_box (   _val)
Value:
_Generic((_val), \
bool : fr_box_bool, \
int8_t : fr_box_int8, \
int16_t : fr_box_int16, \
int32_t : fr_box_int32, \
int64_t : fr_box_int16, \
uint64_t : fr_box_uint64, \
size_t : fr_box_size, \
float : fr_box_float32, \
double : fr_box_float64 \
)(_val)
Struct to represent an ethernet address.
Definition: inet.h:45
IPv4/6 prefix.
Definition: merged_model.c:272
unsigned short uint16_t
Definition: merged_model.c:31
unsigned int uint32_t
Definition: merged_model.c:33
unsigned char uint8_t
Definition: merged_model.c:30
#define fr_box_uint8(_val)
Definition: value.h:303
#define fr_box_uint16(_val)
Definition: value.h:304
#define fr_box_ipaddr(_val)
Definition: value.h:287
#define fr_box_int8(_val)
Definition: value.h:309
#define fr_box_uint64(_val)
Definition: value.h:306
#define fr_box_int16(_val)
Definition: value.h:310
#define fr_box_int32(_val)
Definition: value.h:311
#define fr_box_float64(_val)
Definition: value.h:315
#define fr_box_float32(_val)
Definition: value.h:314
#define fr_box_ether(_val)
Definition: value.h:299
#define fr_box_uint32(_val)
Definition: value.h:305
#define fr_box_size(_val)
Definition: value.h:321
#define fr_box_bool(_val)
Definition: value.h:301

Create an ephemeral box.

Note
This likely shouldn't be used for variable width integers like 'int' as it obscures the underlying type.
Parameters
[in]_valto box.

Definition at line 353 of file value.h.

◆ fr_box_bool

#define fr_box_bool (   _val)    _fr_box(FR_TYPE_BOOL, .vb_bool, _val)

Definition at line 301 of file value.h.

◆ fr_box_date

#define fr_box_date (   _val)    _fr_box(FR_TYPE_DATE, .vb_date, _val)

Definition at line 317 of file value.h.

◆ fr_box_ether

#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] } }

Definition at line 299 of file value.h.

◆ fr_box_float32

#define fr_box_float32 (   _val)    _fr_box(FR_TYPE_FLOAT32, .vb_float32, _val)

Definition at line 314 of file value.h.

◆ fr_box_float64

#define fr_box_float64 (   _val)    _fr_box(FR_TYPE_FLOAT64, .vb_float64, _val)

Definition at line 315 of file value.h.

◆ fr_box_ifid

#define fr_box_ifid (   _val)    _fr_box(FR_TYPE_IFID, .vb_ifid, _val)

Definition at line 298 of file value.h.

◆ fr_box_int16

#define fr_box_int16 (   _val)    _fr_box(FR_TYPE_INT16, .vb_int16, _val)

Definition at line 310 of file value.h.

◆ fr_box_int32

#define fr_box_int32 (   _val)    _fr_box(FR_TYPE_INT32, .vb_int32, _val)

Definition at line 311 of file value.h.

◆ fr_box_int64

#define fr_box_int64 (   _val)    _fr_box(FR_TYPE_INT64, .vb_int64, _val)

Definition at line 312 of file value.h.

◆ fr_box_int8

#define fr_box_int8 (   _val)    _fr_box(FR_TYPE_INT8, .vb_int8, _val)

Definition at line 309 of file value.h.

◆ fr_box_ipaddr

#define fr_box_ipaddr (   _val)
Value:
_fr_box((((_val).af == AF_INET) ? \
(((_val).prefix == 32) ? FR_TYPE_IPV4_ADDR : \
(((_val).prefix == 128) ? FR_TYPE_IPV6_ADDR : \
.vb_ip, _val)
@ FR_TYPE_IPV4_ADDR
32 Bit IPv4 Address.
Definition: merged_model.c:86
@ FR_TYPE_IPV6_PREFIX
IPv6 Prefix.
Definition: merged_model.c:89
@ FR_TYPE_IPV6_ADDR
128 Bit IPv6 Address.
Definition: merged_model.c:88
@ FR_TYPE_IPV4_PREFIX
IPv4 Prefix.
Definition: merged_model.c:87
#define vb_ip
Definition: value.h:239
#define _fr_box(_type, _field, _val)
Definition: value.h:285

Definition at line 287 of file value.h.

◆ fr_box_ipv4addr

#define fr_box_ipv4addr (   _val)    _fr_box(FR_TYPE_IPV4_ADDR, .vb_ip, _val)

Definition at line 293 of file value.h.

◆ fr_box_ipv4prefix

#define fr_box_ipv4prefix (   _val)    _fr_box(FR_TYPE_IPV4_PREFIX, .vb_ip, _val)

Definition at line 294 of file value.h.

◆ fr_box_ipv6addr

#define fr_box_ipv6addr (   _val)    _fr_box(FR_TYPE_IPV6_ADDR, .vb_ip, _val)

Definition at line 295 of file value.h.

◆ fr_box_ipv6prefix

#define fr_box_ipv6prefix (   _val)    _fr_box(FR_TYPE_IPV6_PREFIX, .vb_ip, _val)

Definition at line 296 of file value.h.

◆ fr_box_is_bool

#define fr_box_is_bool (   _x)    fr_type_is_bool((_x)->type)

Definition at line 405 of file value.h.

◆ fr_box_is_combo_ipaddr

#define fr_box_is_combo_ipaddr (   _x)    fr_type_is_combo_ipaddr((_x)->type)

Definition at line 402 of file value.h.

◆ fr_box_is_combo_ipprefix

#define fr_box_is_combo_ipprefix (   _x)    fr_type_is_combo_ipprefix((_x)->type)

Definition at line 403 of file value.h.

◆ fr_box_is_date

#define fr_box_is_date (   _x)    fr_type_is_date((_x)->type)

Definition at line 416 of file value.h.

◆ fr_box_is_ethernet

#define fr_box_is_ethernet (   _x)    fr_type_is_ethernet((_x)->type)

Definition at line 404 of file value.h.

◆ fr_box_is_fixed_size

#define fr_box_is_fixed_size (   _x)    fr_type_is_fixed_size((_x)->type)

Definition at line 433 of file value.h.

◆ fr_box_is_float32

#define fr_box_is_float32 (   _x)    fr_type_is_float32((_x)->type)

Definition at line 414 of file value.h.

◆ fr_box_is_float64

#define fr_box_is_float64 (   _x)    fr_type_is_float64((_x)->type)

Definition at line 415 of file value.h.

◆ fr_box_is_group

#define fr_box_is_group (   _x)    fr_type_is_group((_x)->type)

Definition at line 423 of file value.h.

◆ fr_box_is_ifid

#define fr_box_is_ifid (   _x)    fr_type_is_ifid((_x)->type)

Definition at line 401 of file value.h.

◆ fr_box_is_int16

#define fr_box_is_int16 (   _x)    fr_type_is_int16((_x)->type)

Definition at line 411 of file value.h.

◆ fr_box_is_int32

#define fr_box_is_int32 (   _x)    fr_type_is_int32((_x)->type)

Definition at line 412 of file value.h.

◆ fr_box_is_int64

#define fr_box_is_int64 (   _x)    fr_type_is_int64((_x)->type)

Definition at line 413 of file value.h.

◆ fr_box_is_int8

#define fr_box_is_int8 (   _x)    fr_type_is_int8((_x)->type)

Definition at line 410 of file value.h.

◆ fr_box_is_integer

#define fr_box_is_integer (   _x)    fr_type_is_integer((_x)->type)

Definition at line 428 of file value.h.

◆ fr_box_is_integer_except_bool

#define fr_box_is_integer_except_bool (   _x)    fr_type_is_integer_except_bool((_x)->type)

Definition at line 427 of file value.h.

◆ fr_box_is_ip

#define fr_box_is_ip (   _x)    fr_type_is_ip((_x)->type)

Definition at line 431 of file value.h.

◆ fr_box_is_ipv4addr

#define fr_box_is_ipv4addr (   _x)    fr_type_is_ipv4addr((_x)->type)

Definition at line 397 of file value.h.

◆ fr_box_is_ipv4prefix

#define fr_box_is_ipv4prefix (   _x)    fr_type_is_ipv4prefix((_x)->type)

Definition at line 398 of file value.h.

◆ fr_box_is_ipv6addr

#define fr_box_is_ipv6addr (   _x)    fr_type_is_ipv6addr((_x)->type)

Definition at line 399 of file value.h.

◆ fr_box_is_ipv6prefix

#define fr_box_is_ipv6prefix (   _x)    fr_type_is_ipv6prefix((_x)->type)

Definition at line 400 of file value.h.

◆ fr_box_is_non_value

#define fr_box_is_non_value (   _x)    fr_type_is_non_value((_x)->type)

Definition at line 440 of file value.h.

◆ fr_box_is_null

#define fr_box_is_null (   _x)    fr_type_is_null((_x)->type)

Definition at line 394 of file value.h.

◆ fr_box_is_numeric

#define fr_box_is_numeric (   _x)    fr_type_is_numeric((_x)->type)

Definition at line 429 of file value.h.

◆ fr_box_is_octets

#define fr_box_is_octets (   _x)    fr_type_is_octets((_x)->type)

Definition at line 396 of file value.h.

◆ fr_box_is_quoted

#define fr_box_is_quoted (   _x)    fr_type_is_quoted((_x)->type)

Definition at line 436 of file value.h.

◆ fr_box_is_size

#define fr_box_is_size (   _x)    fr_type_is_size((_x)->type)

Definition at line 418 of file value.h.

◆ fr_box_is_string

#define fr_box_is_string (   _x)    fr_type_is_string((_x)->type)

Definition at line 395 of file value.h.

◆ fr_box_is_struct

#define fr_box_is_struct (   _x)    fr_type_is_struct((_x)->type)

Definition at line 420 of file value.h.

◆ fr_box_is_structural

#define fr_box_is_structural (   _x)    fr_type_is_structural((_x)->type)

Definition at line 439 of file value.h.

◆ fr_box_is_structural_except_vsa

#define fr_box_is_structural_except_vsa (   _x)    fr_type_is_structural_except_vsa((_x)->type)

Definition at line 438 of file value.h.

◆ fr_box_is_time_delta

#define fr_box_is_time_delta (   _x)    fr_type_is_time_delta((_x)->type)

Definition at line 417 of file value.h.

◆ fr_box_is_tlv

#define fr_box_is_tlv (   _x)    fr_type_is_tlv((_x)->type)

Definition at line 419 of file value.h.

◆ fr_box_is_uint16

#define fr_box_is_uint16 (   _x)    fr_type_is_uint16((_x)->type)

Definition at line 407 of file value.h.

◆ fr_box_is_uint32

#define fr_box_is_uint32 (   _x)    fr_type_is_uint32((_x)->type)

Definition at line 408 of file value.h.

◆ fr_box_is_uint64

#define fr_box_is_uint64 (   _x)    fr_type_is_uint64((_x)->type)

Definition at line 409 of file value.h.

◆ fr_box_is_uint8

#define fr_box_is_uint8 (   _x)    fr_type_is_uint8((_x)->type)

Definition at line 406 of file value.h.

◆ fr_box_is_value

#define fr_box_is_value (   _x)    fr_type_is_value((_x)->type)

Definition at line 435 of file value.h.

◆ fr_box_is_value_box

#define fr_box_is_value_box (   _x)    fr_type_is_value_box((_x)->type)

Definition at line 424 of file value.h.

◆ fr_box_is_variable_size

#define fr_box_is_variable_size (   _x)    fr_type_is_variable_size((_x)->type)

Definition at line 434 of file value.h.

◆ fr_box_is_vendor

#define fr_box_is_vendor (   _x)    fr_type_is_vendor((_x)->type)

Definition at line 422 of file value.h.

◆ fr_box_is_void

#define fr_box_is_void (   _x)    fr_type_is_void((_x)->type)

Definition at line 425 of file value.h.

◆ fr_box_is_vsa

#define fr_box_is_vsa (   _x)    fr_type_is_vsa((_x)->type)

Definition at line 421 of file value.h.

◆ fr_box_len

#define fr_box_len (   _val,
  _len 
)
Value:
_Generic((_val), \
char * : fr_box_strvalue_len, \
char const * : fr_box_strvalue_len, \
uint8_t const * : fr_box_octets \
)(_val, _len)
#define fr_box_strvalue_len(_val, _len)
Definition: value.h:279
#define fr_box_octets(_val, _len)
Definition: value.h:281

Create an ephemeral boxed value with a variable length.

Parameters
[in]_valC variable to assign value from.
[in]_lenof C variable.

Definition at line 377 of file value.h.

◆ fr_box_octets

#define fr_box_octets (   _val,
  _len 
)    _fr_box_with_len(FR_TYPE_OCTETS, .vb_octets, _val, _len)

Definition at line 281 of file value.h.

◆ fr_box_octets_buffer

#define fr_box_octets_buffer (   _val)    _fr_box_with_len(FR_TYPE_OCTETS, .vb_octets, _val, talloc_array_length(_val))

Definition at line 283 of file value.h.

◆ fr_box_size

#define fr_box_size (   _val)    _fr_box(FR_TYPE_SIZE, .vb_size, _val)

Definition at line 321 of file value.h.

◆ fr_box_strvalue

#define fr_box_strvalue (   _val)    _fr_box_with_len(FR_TYPE_STRING, .vb_strvalue, _val, strlen(_val))

Definition at line 278 of file value.h.

◆ fr_box_strvalue_buffer

#define fr_box_strvalue_buffer (   _val)    _fr_box_with_len(FR_TYPE_STRING, .vb_strvalue, _val, talloc_array_length(_val) - 1)

Definition at line 282 of file value.h.

◆ fr_box_strvalue_len

#define fr_box_strvalue_len (   _val,
  _len 
)    _fr_box_with_len(FR_TYPE_STRING, .vb_strvalue, _val, _len)

Definition at line 279 of file value.h.

◆ fr_box_time

#define fr_box_time (   _val)    _fr_box(FR_TYPE_DATE, .vb_date, fr_time_to_unix_time(_val))

Definition at line 319 of file value.h.

◆ fr_box_time_delta

#define fr_box_time_delta (   _val)    fr_box_time_delta_with_res((_val), FR_TIME_RES_SEC)

Definition at line 336 of file value.h.

◆ fr_box_time_delta_msec

#define fr_box_time_delta_msec (   _val)    fr_box_time_delta_with_res((_val), FR_TIME_RES_MSEC)

Definition at line 340 of file value.h.

◆ fr_box_time_delta_nsec

#define fr_box_time_delta_nsec (   _val)    fr_box_time_delta_with_res((_val), FR_TIME_RES_NSEC)

Definition at line 342 of file value.h.

◆ fr_box_time_delta_sec

#define fr_box_time_delta_sec (   _val)    fr_box_time_delta_with_res((_val), FR_TIME_RES_SEC)

Definition at line 338 of file value.h.

◆ fr_box_time_delta_usec

#define fr_box_time_delta_usec (   _val)    fr_box_time_delta_with_res((_val), FR_TIME_RES_USEC)

Definition at line 344 of file value.h.

◆ fr_box_time_delta_with_res

#define fr_box_time_delta_with_res (   _val,
  _res 
)
Value:
(_val), \
.name = NULL, \
.type = FR_TYPE_TIME_DELTA, \
.flags = { \
.type_size = _res \
} \
}))
@ FR_TYPE_TIME_DELTA
A period of time measured in nanoseconds.
Definition: merged_model.c:113
#define _fr_box_with_da(_type, _field, _val, _da)
Definition: value.h:323
#define vb_time_delta
Definition: value.h:263

Definition at line 325 of file value.h.

◆ fr_box_uint128

#define fr_box_uint128 (   _val)    _fr_box(FR_TYPE_UINT128, .vb_uint128, _val)

Definition at line 307 of file value.h.

◆ fr_box_uint16

#define fr_box_uint16 (   _val)    _fr_box(FR_TYPE_UINT16, .vb_uint16, _val)

Definition at line 304 of file value.h.

◆ fr_box_uint32

#define fr_box_uint32 (   _val)    _fr_box(FR_TYPE_UINT32, .vb_uint32, _val)

Definition at line 305 of file value.h.

◆ fr_box_uint64

#define fr_box_uint64 (   _val)    _fr_box(FR_TYPE_UINT64, .vb_uint64, _val)

Definition at line 306 of file value.h.

◆ fr_box_uint8

#define fr_box_uint8 (   _val)    _fr_box(FR_TYPE_UINT8, .vb_uint8, _val)

Definition at line 303 of file value.h.

◆ FR_MAX_STRING_LEN

#define FR_MAX_STRING_LEN   254 /* RFC2138: string 0-253 octets */

Definition at line 30 of file value.h.

◆ fr_value_box

#define fr_value_box (   _box,
  _var,
  _tainted 
)
Value:
_Generic((_var), \
bool : fr_value_box_bool, \
uint8_t : fr_value_box_uint8, \
uint16_t : fr_value_box_uint16, \
uint32_t : fr_value_box_uint32, \
uint64_t : fr_value_box_uint64, \
int8_t : fr_value_box_int8, \
int16_t : fr_value_box_int16, \
int32_t : fr_value_box_int32, \
int64_t : fr_value_box_int64, \
float : fr_value_box_float32, \
double : fr_value_box_float64 \
)(_box, NULL, _var, _tainted)
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.
Definition: value.c:3579
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)
Definition: value.h:810

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.

Note
Will not set the box value to tainted. You should do this manually if required.
Will not work for all box types. Will default to the 'simpler' box type, if the mapping between C type and box type is ambiguous.
Parameters
[in]_boxto assign value to.
[in]_varC variable to assign value from.
[in]_taintedWhether the value came from an untrusted source.

Definition at line 858 of file value.h.

◆ fr_value_box_alloc

#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.

Parameters
[in]_ctxto allocate the value_box in.
[in]_typeof value.
[in]_enumvEnumeration values.
Returns

Definition at line 608 of file value.h.

◆ fr_value_box_alloc_null

#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.

Parameters
[in]_ctxto allocate the value_box in.
Returns

Definition at line 619 of file value.h.

◆ fr_value_box_init

#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.

Parameters
[in]_vbto initialise.
[in]_typeto set.
[in]_enumvEnumeration values.
[in]_taintedWhether data will come from an untrusted source.

Definition at line 574 of file value.h.

◆ fr_value_box_init_null

#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.

Parameters
[in]_vbto initialise.

Definition at line 580 of file value.h.

◆ FR_VALUE_BOX_INITIALISER

#define FR_VALUE_BOX_INITIALISER (   _vb,
  _type,
  _field,
  _val 
)
Value:
{ \
.type = _type, \
.datum = { \
_field = _val, \
}, \
.entry = { \
.entry = FR_DLIST_ENTRY_INITIALISER((_vb).entry.entry) \
}, \
VALUE_BOX_NDEBUG_INITIALISER \
}
#define FR_DLIST_ENTRY_INITIALISER(_entry)
Static initialiser for entries.
Definition: dlist.h:75

A static initialiser for stack/globally allocated boxes.

Definition at line 487 of file value.h.

◆ FR_VALUE_BOX_INITIALISER_NULL

#define FR_VALUE_BOX_INITIALISER_NULL (   _vb)
Value:
{ \
.type = FR_TYPE_NULL, \
.entry = { \
.entry = FR_DLIST_ENTRY_INITIALISER((_vb).entry.entry) \
}, \
VALUE_BOX_NDEBUG_INITIALISER \
}
@ FR_TYPE_NULL
Invalid (uninitialised) attribute type.
Definition: merged_model.c:81

A static initialiser for stack/globally allocated boxes.

We can only safely initialise a null box, as many other type need special initialisation

Definition at line 475 of file value.h.

◆ fr_value_box_is_safe_for

#define fr_value_box_is_safe_for (   _box,
  _safe_for 
)    (_box->safe_for == (fr_value_box_safe_for_t)_safe_for)

Definition at line 1042 of file value.h.

◆ fr_value_box_len

#define fr_value_box_len (   _ctx,
  _box,
  _var,
  _len,
  _tainted 
)
Value:
_Generic((_var), \
char const * : fr_value_box_bstrndup, \
)(_ctx, _box, NULL, _var, _len, _tainted)
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.
Definition: value.c:4417
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.
Definition: value.c:4097

Automagically fill in a box, for types with length.

Parameters
[in]_ctxto allocate value in.
[in]_boxto assign value to.
[in]_varC variable to assign value from.
[in]_lenof C variable.
[in]_taintedWhether the value came from an untrusted source.

Definition at line 885 of file value.h.

◆ fr_value_box_list_foreach

#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)

Definition at line 199 of file value.h.

◆ fr_value_box_list_foreach_safe

#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)

Definition at line 200 of file value.h.

◆ FR_VALUE_BOX_MAGIC

#define FR_VALUE_BOX_MAGIC   RADIUSD_MAGIC_NUMBER

Definition at line 91 of file value.h.

◆ fr_value_box_mark_safe_for

#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)

Definition at line 1035 of file value.h.

◆ FR_VALUE_BOX_NET_ERROR

#define FR_VALUE_BOX_NET_ERROR   SSIZE_MIN

Special value to indicate fr_value_box_from_network experienced a general error.

Definition at line 1001 of file value.h.

◆ FR_VALUE_BOX_NET_MAX

#define FR_VALUE_BOX_NET_MAX   (FR_VALUE_BOX_NET_OOM + 1)

Special value to ensure other encoding/decoding errors don't overlap.

Definition at line 1009 of file value.h.

◆ FR_VALUE_BOX_NET_OOM

#define FR_VALUE_BOX_NET_OOM   (FR_VALUE_BOX_NET_ERROR + 1)

Special value to indicate fr_value_box_from_network hit an out of memory error.

Definition at line 1005 of file value.h.

◆ FR_VALUE_BOX_TO_NETWORK_RETURN

#define FR_VALUE_BOX_TO_NETWORK_RETURN (   _dbuff,
  _value 
)    FR_DBUFF_RETURN(fr_value_box_to_network, _dbuff, _value)

Definition at line 994 of file value.h.

◆ fr_value_unbox_shallow

#define fr_value_unbox_shallow (   _var,
  _box 
)
Value:
_Generic((_var), \
uint8_t * : fr_value_unbox_uint8, \
uint16_t * : fr_value_unbox_uint16, \
uint32_t * : fr_value_unbox_uint32, \
uint64_t * : fr_value_unbox_uint64, \
int8_t * : fr_value_unbox_int8, \
int16_t * : fr_value_unbox_int16, \
int32_t * : fr_value_unbox_int32, \
int64_t * : fr_value_unbox_int64, \
float * : fr_value_unbox_float32, \
double * : fr_value_unbox_float64 \
)(_var, _box)

Unbox simple types performing type checks.

Parameters
[out]_varto write to.
[in]_boxto unbox.

Definition at line 947 of file value.h.

◆ VALUE_BOX_LIST_VERIFY [1/2]

#define VALUE_BOX_LIST_VERIFY (   _x)    fr_assert(_x)

Definition at line 1292 of file value.h.

◆ VALUE_BOX_LIST_VERIFY [2/2]

#define VALUE_BOX_LIST_VERIFY (   _x)    fr_assert(_x)

Definition at line 1292 of file value.h.

◆ VALUE_BOX_NDEBUG_INITIALISER

#define VALUE_BOX_NDEBUG_INITIALISER   .file = __FILE__, .line = __LINE__, .magic = FR_VALUE_BOX_MAGIC

Definition at line 222 of file value.h.

◆ VALUE_BOX_VERIFY [1/2]

#define VALUE_BOX_VERIFY (   _x)    fr_assert(_x)

Definition at line 1291 of file value.h.

◆ VALUE_BOX_VERIFY [2/2]

#define VALUE_BOX_VERIFY (   _x)    fr_assert(_x)

Definition at line 1291 of file value.h.

◆ vb_bool

#define vb_bool   datum.boolean

Definition at line 244 of file value.h.

◆ vb_date

#define vb_date   datum.date

Definition at line 259 of file value.h.

◆ vb_ether

#define vb_ether   datum.ether.addr

Definition at line 242 of file value.h.

◆ vb_float32

#define vb_float32   datum.float32

Definition at line 256 of file value.h.

◆ vb_float64

#define vb_float64   datum.float64

Definition at line 257 of file value.h.

◆ vb_group

#define vb_group   datum.children

Definition at line 237 of file value.h.

◆ vb_ifid

#define vb_ifid   datum.ifid.addr

Definition at line 241 of file value.h.

◆ vb_int16

#define vb_int16   datum.int16

Definition at line 252 of file value.h.

◆ vb_int32

#define vb_int32   datum.int32

Definition at line 253 of file value.h.

◆ vb_int64

#define vb_int64   datum.int64

Definition at line 254 of file value.h.

◆ vb_int8

#define vb_int8   datum.int8

Definition at line 251 of file value.h.

◆ vb_ip

#define vb_ip   datum.ip

Definition at line 239 of file value.h.

◆ vb_length

#define vb_length   datum.length

Definition at line 265 of file value.h.

◆ vb_octets

#define vb_octets   datum.octets

Definition at line 235 of file value.h.

◆ vb_should_free

#define vb_should_free (   _action)    ((_action & FR_VALUE_BOX_LIST_FREE_BOX) == FR_VALUE_BOX_LIST_FREE_BOX)

Definition at line 217 of file value.h.

◆ vb_should_free_value

#define vb_should_free_value (   _action)    ((_action & FR_VALUE_BOX_LIST_FREE_BOX_VALUE) == FR_VALUE_BOX_LIST_FREE_BOX_VALUE)

Definition at line 218 of file value.h.

◆ vb_should_remove

#define vb_should_remove (   _action)    ((_action & FR_VALUE_BOX_LIST_REMOVE) == FR_VALUE_BOX_LIST_REMOVE)

Definition at line 219 of file value.h.

◆ vb_size

#define vb_size   datum.size

Definition at line 261 of file value.h.

◆ vb_strvalue

#define vb_strvalue   datum.strvalue

Definition at line 234 of file value.h.

◆ vb_time_delta

#define vb_time_delta   datum.time_delta

Definition at line 263 of file value.h.

◆ vb_timeval

#define vb_timeval   datum.timeval

Definition at line 262 of file value.h.

◆ vb_uint128

#define vb_uint128   datum.uint128

Definition at line 249 of file value.h.

◆ vb_uint16

#define vb_uint16   datum.uint16

Definition at line 246 of file value.h.

◆ vb_uint32

#define vb_uint32   datum.uint32

Definition at line 247 of file value.h.

◆ vb_uint64

#define vb_uint64   datum.uint64

Definition at line 248 of file value.h.

◆ vb_uint8

#define vb_uint8   datum.uint8

Definition at line 245 of file value.h.

◆ vb_void

#define vb_void   datum.ptr

Definition at line 236 of file value.h.

Typedef Documentation

◆ fr_value_box_escape_t

typedef int(* fr_value_box_escape_t) (fr_value_box_t *vb, void *uctx)

Escape a value box.

Parameters
[in]vbto escape.
[in]uctxuser context to pass to the escape function.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 638 of file value.h.

◆ fr_value_box_safe_for_t

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.

Definition at line 155 of file value.h.

◆ fr_value_box_t

typedef struct value_box_s fr_value_box_t

Definition at line 1 of file value.h.

Enumeration Type Documentation

◆ fr_value_box_list_action_t

Actions to perform when we process a box in a list.

Enumerator
FR_VALUE_BOX_LIST_NONE 

Do nothing to processed boxes.

FR_VALUE_BOX_LIST_REMOVE 

Remove the box from the input list.

FR_VALUE_BOX_LIST_FREE_BOX 

Free each processed box.

FR_VALUE_BOX_LIST_FREE_BOX_VALUE 

Explicitly free any value buffers associated with a box.

FR_VALUE_BOX_LIST_FREE 

Definition at line 208 of file value.h.

Function Documentation

◆ _fr_value_box_alloc()

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 
)
inlinestatic

Definition at line 583 of file value.h.

+ Here is the call graph for this function:

◆ _fr_value_box_init()

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 
)
inlinestatic

Definition at line 500 of file value.h.

+ Here is the caller graph for this function:

◆ _fr_value_box_mark_safe_for()

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.

Definition at line 6240 of file value.c.

◆ format()

int format ( printf  ,
,
 
)
+ Here is the caller graph for this function:

◆ fr_value_box_acopy()

static fr_value_box_t* fr_value_box_acopy ( TALLOC_CTX *  ctx,
fr_value_box_t const *  src 
)
inlinestatic

Copy an existing box, allocating a new box to hold its contents.

Parameters
[in]ctxto allocate new box in.
[in]srcbox to copy.

Definition at line 698 of file value.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_aprint()

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 
)
inlinestatic
+ Here is the caller graph for this function:

◆ fr_value_box_aprint_quoted()

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 
)
inlinestatic
+ Here is the caller graph for this function:

◆ fr_value_box_asprintf()

int fr_value_box_asprintf ( TALLOC_CTX *  ctx,
fr_value_box_t dst,
fr_dict_attr_t const *  enumv,
bool  tainted,
char const *  fmt,
  ... 
)

◆ fr_value_box_bstr_alloc()

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.

Parameters
[in]ctxto allocate any new buffers in.
[out]outif non-null where to write a pointer to the new buffer.
[in]dstto assign new buffer to.
[in]enumvAliases for values.
[in]lenof buffer to allocate.
[in]taintedWhether the value came from a trusted source.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 4020 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_bstr_append_buffer()

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.

Parameters
[in]ctxWhere to allocate any talloc buffers required.
[in]dstvalue box to append to.
[in]srcstring data to append.
[in]taintedWhether src is tainted.
Returns
  • 0 on success.
    • -1 on failure.

Definition at line 4286 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_bstr_realloc()

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.

Note
Do not use on an uninitialised box.
Parameters
[in]ctxto realloc buffer in.
[out]outif non-null where to write a pointer to the new buffer.
[in]dstto realloc buffer for.
[in]lento realloc to (don't include nul byte).
Returns
  • 0 on success.
    • -1 on failure.

Definition at line 4053 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_bstrdup_buffer()

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.

Parameters
[in]ctxto allocate any new buffers in.
[in]dstto assign new buffer to.
[in]enumvAliases for values.
[in]srca talloced nul terminated buffer.
[in]taintedWhether the value came from a trusted source.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 4157 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_bstrdup_buffer_shallow()

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.

Parameters
[in]ctxto add reference from. If NULL no reference will be added.
[in]dstto assign string to.
[in]enumvAliases for values.
[in]srcto copy string from.
[in]taintedWhether the value came from a trusted source.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 4202 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_bstrn_append()

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.

Parameters
[in]ctxWhere to allocate any talloc buffers required.
[in]dstvalue box to append to.
[in]srcoctets data to append.
[in]lenlength of octets data.
[in]taintedWhether src is tainted.
Returns
  • 0 on success.
    • -1 on failure.

Definition at line 4233 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_bstrndup()

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.

Parameters
[in]ctxto allocate any new buffers in.
[in]dstto assign buffer to.
[in]enumvAliases for values.
[in]srca string. May be NULL only if len == 0.
[in]lenof src.
[in]taintedWhether the value came from a trusted source.

Definition at line 4097 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_bstrndup_dbuff()

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 
)

Definition at line 4121 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_bstrndup_shallow()

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.

Parameters
[in]dstto assign new buffer to.
[in]enumvAliases for values.
[in]srca string.
[in]lenof src.
[in]taintedWhether the value came from a trusted source.

Definition at line 4181 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_cast()

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.

Note
src and dst must not be the same box. We do not support casting in place.
Parameters
ctxto allocate buffers in (usually the same as dst)
dstWhere to write result of casting.
dst_typeto cast to.
dst_enumvAliases 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.
srcInput data.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 3301 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_cast_in_place()

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.

Parameters
ctxto allocate buffers in (usually the same as dst)
vbto cast.
dst_typeto cast to.
dst_enumvAliases 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.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 3521 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_clear()

void fr_value_box_clear ( fr_value_box_t data)

Clear/free any existing value and metadata.

Note
Do not use on uninitialised memory.
Parameters
[in]datato clear.

Definition at line 3672 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_clear_value()

void fr_value_box_clear_value ( fr_value_box_t data)

Clear/free any existing value.

Note
Do not use on uninitialised memory.
Parameters
[in]datato clear.

Definition at line 3630 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_cmp()

int8_t fr_value_box_cmp ( fr_value_box_t const *  a,
fr_value_box_t const *  b 
)

Compare two values.

Parameters
[in]aValue to compare.
[in]bValue to compare.
Returns
  • -1 if a is less than b.
  • 0 if both are equal.
  • 1 if a is more than b.
  • < -1 on failure.

Definition at line 640 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_cmp_op()

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.

Parameters
[in]opto use in comparison.
[in]aValue to compare.
[in]bValue to compare.
Returns
  • 1 if true
  • 0 if false
  • -1 on failure.

Definition at line 884 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_contains_secret()

static bool fr_value_box_contains_secret ( fr_value_box_t const *  box)
inlinestatic

Definition at line 1053 of file value.h.

+ Here is the caller graph for this function:

◆ fr_value_box_copy()

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.

Note
Will free any exiting buffers associated with the dst fr_value_box_t.
Parameters
ctxTo allocate buffers in.
dstWhere to copy value_box to.
srcWhere to copy value_box from.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 3689 of file value.c.

+ Here is the call graph for this function:

◆ fr_value_box_copy_shallow()

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.

Parameters
[in]ctxto add reference from. If NULL no reference will be added.
[in]dstto copy value to.
[in]srcto copy value from.

Definition at line 3783 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_debug()

void fr_value_box_debug ( fr_value_box_t const *  vb)

Print the value of a box as info messages.

Note
Call directly from the debugger

Definition at line 6351 of file value.c.

+ Here is the call graph for this function:

◆ fr_value_box_escape_in_place()

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.

Note
Applies recursively to the children of group boxes.
Parameters
[in]vbto escape.
[in]escapefunction to apply to the value box.
[in]safe_forthe escaped value to check value boxes again. box has an escaped value that matches, it will not be re-escaped.
[in]uctxuser context to pass to the escape function.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 5893 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_ethernet_addr()

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 
)
inlinestatic

Definition at line 810 of file value.h.

+ Here is the caller graph for this function:

◆ fr_value_box_flatten()

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.

Parameters
[in]ctxto reparent children in if steal is true.
[in]listto flatten.
[in]stealwhether to change the talloc ctx of children.
[in]freewhether to free any group boxes which have had their children removed.

Definition at line 5951 of file value.c.

+ Here is the call graph for this function:

◆ fr_value_box_from_network()

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:

  • Octets are decoded in binary form (not hex).
  • Strings are decoded without the trailing \0 byte. Strings must consist only of valid UTF8 chars.
  • Integers are decoded big-endian.
  • Bools are decoded using one byte, with value 0x00 (false) or 0x01 (true).
  • Signed integers are decoded two's complement, with the MSB as the sign bit. Byte order is big-endian.
  • Network addresses are decoded big-endian.
  • IPv4 prefixes are decoded with 1 byte for the prefix, then 4 bytes of address.
  • IPv6 prefixes are decoded with 1 byte for the scope_id, 1 byte for the prefix, and 16 bytes of address.
  • Floats are decoded in IEEE-754 format with a big-endian byte order. We rely on the fact that the C standards require floats to be represented in IEEE-754 format in memory.
  • 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.

Parameters
[in]ctxWhere to allocate any talloc buffers required.
[out]dstvalue_box to write the result to.
[in]typeto decode data to.
[in]enumvAliases for values.
[in]dbuffBinary data to decode.
[in]lenLength of data to decode. For fixed length types we only decode complete values.
[in]taintedWhether the value came from a trusted source.
Returns
  • >= 0 The number of bytes consumed.
  • <0 - The negative offset where the error occurred.
  • FR_VALUE_BOX_NET_OOM (negative value) - Out of memory.

Definition at line 1709 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_from_str()

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 
)

Definition at line 5264 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_from_substr()

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.

Parameters
[in]ctxto alloc strings in.
[out]dstwhere to write parsed value.
[in,out]dst_typeof value data to create/dst_type of value created.
[in]dst_enumvfr_dict_attr_t with string names for uint32 values.
[in]insbuff to read data from.
[in]rulesunescape and termination rules.
[in]taintedWhether the value came from a trusted source.
Returns
  • >0 on success.
  • <= 0 on parse error.

Definition at line 4751 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_hash()

uint32_t fr_value_box_hash ( fr_value_box_t const *  vb)

Hash the contents of a value box.

Definition at line 6077 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_hton()

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.

Parameters
[in]dstWhere to write the result. May be the same as src.
[in]srcfr_value_box_t containing an uint32 value.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1186 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_increment()

void fr_value_box_increment ( fr_value_box_t vb)

Increment a boxed value.

Implements safe integer overflow.

Parameters
[in]vbto increment.

Definition at line 4597 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_ipaddr()

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.

Parameters
[in]dstto assign ipaddr to.
[in]enumvAliases for values.
[in]ipaddrto copy address from.
[in]taintedWhether the value came from a trusted source.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 3579 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_is_secret()

static bool fr_value_box_is_secret ( fr_value_box_t const *  box)
inlinestatic

Definition at line 1047 of file value.h.

+ Here is the caller graph for this function:

◆ fr_value_box_is_truthy()

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 6274 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_list_acopy()

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.

Parameters
[in]ctxto allocate boxes in.
[out]outWhere to write the head of the new list.
[in]inboxes to copy.
Returns
  • A duplicate list of value boxes, allocated in the context of 'ctx'
  • NULL on error, or empty input list.

Definition at line 6106 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_list_aprint()

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.

Parameters
[in]ctxto allocate the buffer in.
[in]listof value boxes.
[in]delimto insert between value box values.
[in]e_rulesto control escaping of the concatenated elements.
Returns
  • NULL on error.
  • The concatenation of the string values of the value box list on success.

Definition at line 5976 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_list_aprint_secure()

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.

Parameters
[in]ctxto allocate the buffer in.
[in]listof value boxes.
[in]delimto insert between value box values.
[in]e_rulesto control escaping of the concatenated elements.
Returns
  • NULL on error.
  • The concatenation of the string values of the value box list on success.

Definition at line 6026 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_list_concat_as_octets()

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.

Parameters
[out]taintedIf nonnull, will be set to true if any input boxes are tainted. bool pointed to must be initialised.
[out]secretIf nonnull, will be set to true if any input boxes are secret.
[out]dbuffto write the result of the concatenation to.
[in]listto concatenate.
[in]sepInsert a separator between the values.
[in]sep_lenLength of the separator.
[in]proc_actionWhat to do with the boxes in the list once they've been processed.
[in]flattenIf 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.
Returns
  • >=0 the number of bytes written to the sbuff.
  • <0 how many additional bytes we would have needed to concat the next box.

Definition at line 5625 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_list_concat_as_string()

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,
bool  flatten 
)

Concatenate a list of value boxes together.

All boxes will be removed from the list.

Parameters
[out]taintedIf nonnull, will be set to true if any input boxes are tainted. bool pointed to must be initialised.
[out]secretIf nonnull, will be set to true if any input boxes are secret.
[out]sbuffto write the result of the concatenation to.
[in]listto concatenate.
[in]sepInsert a separator between the values.
[in]sep_lenLength of the separator.
[in]e_rulesTo apply to FR_TYPE_STRING types. Is not currently applied to any other box type.
[in]proc_actionWhat to do with the boxes in the list once they've been processed.
[in]flattenIf 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.
Returns
  • >=0 the number of bytes written to the sbuff.
  • <0 how many additional bytes we would have needed to concat the next box.

Definition at line 5532 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_list_concat_in_place()

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.

Note
Will automatically cast all fr_value_box_t to type specified.
Parameters
[in]ctxto allocate new value buffer in.
[out]outWhere to write the resulting box.
[in]listto concatenate together.
[in]typeMay be FR_TYPE_STRING or FR_TYPE_OCTETS, no other types are supported.
[in]proc_actionWhat to do with the boxes in the list once they've been processed.
[in]flattenIf 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_sizeof the value.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 5725 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_list_debug()

void fr_value_box_list_debug ( fr_value_box_list_t const *  head)

Print a list of value boxes as info messages.

Note
Call directly from the debugger

Definition at line 6324 of file value.c.

+ Here is the call graph for this function:

◆ fr_value_box_list_escape_in_place()

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.

Note
Applies recursively to the children of group boxes.
on error, the list may be left in an inconsistent/partially escaped state.
Parameters
[in]listto escape.
[in]escapefunction to apply to the value box.
[in]safe_forthe escaped value to check value boxes again. box has an escaped value that matches, it will not be re-escaped.
[in]uctxuser context to pass to the escape function.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 5930 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_list_len_min()

static bool fr_value_box_list_len_min ( fr_value_box_list_t const *  list,
unsigned int  min 
)
inlinestatic

Determines whether a list contains the number of boxes required.

Parameters
[in]listof value boxes.
[in]minThe number of boxes required to return true.
Returns
  • true if the list has at least min boxes.
  • false if the list has fewer than min boxes.

Definition at line 664 of file value.h.

+ Here is the call graph for this function:

◆ fr_value_box_list_mark_safe_for()

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.

Note
Only operates on a single level.
Parameters
[in]listto operate on.
[in]safe_forvalue to set.

Definition at line 6261 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_list_taint()

void fr_value_box_list_taint ( fr_value_box_list_t *  head)

Taint every list member (and their children)

Parameters
[in]headof list.

Definition at line 6150 of file value.c.

◆ fr_value_box_list_tainted()

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.

Parameters
[in]headof list to check.
Returns
  • true if a list member is tainted.
  • false if no list members are tainted.

Definition at line 6134 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_list_untaint()

void fr_value_box_list_untaint ( fr_value_box_list_t *  head)

Untaint every list member (and their children)

Parameters
[in]headof list.

Definition at line 6164 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_list_verify()

void fr_value_box_list_verify ( char const *  file,
int  line,
fr_value_box_list_t const *  list 
)

Definition at line 6232 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_mark_unsafe()

void fr_value_box_mark_unsafe ( fr_value_box_t vb)

Mark a value-box as "unsafe".

This always succeeds, and there are no side effects.

Definition at line 6249 of file value.c.

◆ fr_value_box_mem_alloc()

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.

Note
Buffer will not be zeroed, as it's assumed the caller will be filling it.
Parameters
[in]ctxto allocate any new buffers in.
[out]outIf non-null will be filled with a pointer to the new buffer.
[in]dstto assign new buffer to.
[in]enumvAliases for values.
[in]lenof 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]taintedWhether the value came from a trusted source.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 4320 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_mem_append()

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.

Parameters
[in]ctxWhere to allocate any talloc buffers required.
[in]dstvalue box to append to.
[in]srcoctets data to append.
[in]lenlength of octets data.
[in]taintedWhether src is tainted.
Returns
  • 0 on success.
    • -1 on failure.

Definition at line 4536 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_mem_append_buffer()

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.

Parameters
[in]ctxWhere to allocate any talloc buffers required.
[in]dstvalue box to append to.
[in]srcoctets data to append.
[in]taintedWhether src is tainted.
Returns
  • 0 on success.
    • -1 on failure.

Definition at line 4586 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_mem_realloc()

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.

Note
Do not use on an uninitialised box.
Parameters
[in]ctxto realloc buffer in.
[out]outif non-null where to write a pointer to the new buffer.
[in]dstto realloc buffer for.
[in]lento realloc to.
Returns
  • 0 on success.
    • -1 on failure.

Definition at line 4353 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_memcpy_in()

static int fr_value_box_memcpy_in ( fr_value_box_t vb,
void const *  in 
)
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.

Parameters
[in]vbdestination value box, MUST already be initialized
[out]inC variable to read from
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 785 of file value.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_memcpy_out()

static int fr_value_box_memcpy_out ( void *  out,
fr_value_box_t const *  vb 
)
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.

Parameters
[out]outField in struct to write variable to.
[in]vbto copy value from.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 751 of file value.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_memdup()

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.

Parameters
[in]ctxto allocate any new buffers in.
[in]dstto assign new buffer to.
[in]enumvAliases for values.
[in]srca buffer.
[in]lenof 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]taintedWhether the value came from a trusted source.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 4417 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_memdup_buffer()

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.

Parameters
[in]ctxto allocate any new buffers in.
[in]dstto assign new buffer to.
[in]enumvAliases for values.
[in]srca buffer.
[in]taintedWhether the value came from a trusted source.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 4475 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_memdup_buffer_shallow()

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.

Parameters
[in]ctxto allocate any new buffers in.
[in]dstto assign buffer to.
[in]enumvAliases for values.
[in]srca talloced buffer.
[in]taintedWhether the value came from a trusted source.

Definition at line 4515 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_memdup_dbuff()

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 
)

Definition at line 4442 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_memdup_shallow()

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.

Note
Will free any exiting buffers associated with the value box.
Parameters
[in]dstto assign buffer to.
[in]enumvAliases for values.
[in]srca talloced buffer.
[in]lenof buffer.
[in]taintedWhether the value came from a trusted source.

Definition at line 4497 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_network_length()

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 1280 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_print()

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.

Note
- this function does NOT respect tainting! The escaping rules are ONLY for escaping quotation characters, CR, LF, etc.
Parameters
[in]outWhere to write the printed string.
[in]dataValue box to print.
[in]e_rulesTo apply to FR_TYPE_STRING types, for escaping quotation characters only. Is not currently applied to any other box type.

Definition at line 5301 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_print_quoted()

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)

Parameters
[in]outWhere to write the printed string.
[in]dataValue box to print.
[in]quoteTo apply to FR_TYPE_STRING types. Is not currently applied to any other box type.

Definition at line 5489 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_raw()

static uint8_t* fr_value_box_raw ( fr_value_box_t const *  vb,
fr_type_t  type 
)
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 727 of file value.h.

+ Here is the caller graph for this function:

◆ fr_value_box_set_immutable()

static void fr_value_box_set_immutable ( fr_value_box_t box)
inlinestatic

Definition at line 1073 of file value.h.

+ Here is the caller graph for this function:

◆ fr_value_box_set_secret()

static void fr_value_box_set_secret ( fr_value_box_t box,
bool  secret 
)
inlinestatic

Definition at line 1067 of file value.h.

+ Here is the caller graph for this function:

◆ fr_value_box_steal()

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.

Parameters
[in]ctxto allocate any new buffers in.
[in]dstto copy value to.
[in]srcto copy value from.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 3807 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_strdup()

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.

Parameters
[in]ctxto allocate any new buffers in.
[in]dstto assign new buffer to.
[in]enumvAliases for values.
[in]srca nul terminated buffer.
[in]taintedWhether the value came from a trusted source.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 3876 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_strdup_shallow()

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.

Note
Input string will not be duplicated.
Parameters
[in]dstto assign string to.
[in]enumvAliases for values.
[in]srcto copy string from.
[in]taintedWhether the value came from a trusted source.

Definition at line 3985 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_strdup_shallow_replace()

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.

Note
Input string will not be duplicated.
Parameters
[in]vbto replace string in.
[in]srcto assign string from.
[in]lenof src.

Definition at line 4001 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_strtrim()

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.

Parameters
[in]ctxto re-alloc the buffer in.
[in,out]vbto trim.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 3902 of file value.c.

+ Here is the caller graph for this function:

◆ fr_value_box_to_key()

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.

Parameters
[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]outlenThe number of bits available in the initial buffer. On output, the number of bits available in the key
[in]valuethe value box which contains the key
Returns
  • <0 on error
  • 0 on success

Definition at line 2039 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_to_network()

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:

  • Octets are encoded in binary form (not hex).
  • Strings are encoded without the trailing \0 byte.
  • Integers are encoded big-endian.
  • Bools are encoded using one byte, with value 0x00 (false) or 0x01 (true).
  • Signed integers are encoded two's complement, with the MSB as the sign bit. Byte order is big-endian.
  • Network addresses are encoded big-endian.
  • IPv4 prefixes are encoded with 1 byte for the prefix, then 4 bytes of address.
  • IPv6 prefixes are encoded with 1 byte for the scope_id, 1 byte for the prefix, and 16 bytes of address.
  • Floats are encoded in IEEE-754 format with a big-endian byte order. We rely on the fact that the C standards require floats to be represented in IEEE-754 format in memory.
  • Dates are encoded as 16/32/64-bit unsigned UNIX timestamps.
  • time_deltas are encoded as 16/32/64-bit signed integers.

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.

Parameters
[out]dbuffWhere to write serialized data.
[in]valueto encode.
Returns
  • 0 no bytes were written.
  • >0 the number of bytes written to out.
  • <0 the number of bytes we'd need in dbuff to complete the operation.

Definition at line 1359 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_box_vasprintf()

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 
)

◆ fr_value_box_verify()

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 6177 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_str_aunescape()

static size_t fr_value_str_aunescape ( TALLOC_CTX *  ctx,
char **  out,
fr_sbuff_t in,
size_t  inlen,
char  quote 
)
inlinestatic

◆ fr_value_str_unescape()

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 mode ("'" quote char) will unescape:
      - \\        - Literal backslash.
      - \<quote>  - The quotation char.
    
  • Expanded mode ('"' quote char) will also unescape:
      - \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.
    
  • Backtick mode ('‘’ quote char) identical to expanded mode.
  • Regex mode ('/') identical to expanded mode but two successive backslashes will be interpreted as an escape sequence, but not unescaped, so that they will be passed to the underlying regex library.
  • Verbatim mode ('\0' quote char) copies in to out verbatim.
Note
The resulting output may contain embedded \0s.
Unrecognised escape sequences will be copied verbatim.
In and out may point to the same underlying buffer.
Copying will stop early if an unescaped instance of the quoting char is found in the input buffer.
Parameters
[out]outWhere to write the unescaped string.
[in]inThe string to unescape.
[in]inlenLength of input string. Pass SIZE_MAX to copy all data in the input buffer.
[in]quoteCharacter around the string, determines unescaping mode.
Returns
  • 0 if input string was empty.
  • >0 the number of bytes written to out.

Definition at line 1083 of file value.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_substr_unescape()

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 mode ("'" quote char) will unescape:
      - \\        - Literal backslash.
      - \<quote>  - The quotation char.
    
  • Expanded mode ('"' quote char) will also unescape:
      - \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.
    
  • Backtick mode ('‘’ quote char) identical to expanded mode.
  • Regex mode ('/') identical to expanded mode but two successive backslashes will be interpreted as an escape sequence, but not unescaped, so that they will be passed to the underlying regex library.
  • Verbatim mode ('\0' quote char) copies in to out verbatim.
Note
The resulting output may contain embedded \0s.
Unrecognised escape sequences will be copied verbatim.
In and out may point to the same underlying buffer.
Copying will stop early if an unescaped instance of the quoting char is found in the input buffer.
Parameters
[out]outWhere to write the unescaped string.
[in]inThe string to unescape.
[in]inlenLength of input string. Pass SIZE_MAX to copy all data in the input buffer.
[in]quoteCharacter around the string, determines unescaping mode.
Returns
  • 0 if input string was empty.
  • >0 the number of bytes written to out.

Definition at line 1156 of file value.c.

+ Here is the call graph for this function:

◆ fr_value_unbox_ethernet_addr()

static int fr_value_unbox_ethernet_addr ( fr_ethernet_t dst,
fr_value_box_t src 
)
inlinestatic

Unbox an ethernet value (6 bytes, network byte order)

Parameters
[in]dstWhere to copy the ethernet address to.
[in]srcWhere to copy the ethernet address from.
Returns
  • 0 on success.
  • -1 on type mismatch.

Definition at line 902 of file value.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_value_unbox_ipaddr()

int fr_value_unbox_ipaddr ( fr_ipaddr_t dst,
fr_value_box_t src 
)

Unbox an IP address performing a type check.

Parameters
[out]dstWhere to copy the IP address to.
[in]srcWhere to copy the IP address from.
Returns
  • 0 on success.
  • -1 on type mismatch.

Definition at line 3611 of file value.c.

+ Here is the call graph for this function:

◆ nonnull()

int nonnull ( ,
 
)
+ Here is the caller graph for this function:

Variable Documentation

◆ data

static fr_slen_t static e_rules fr_slen_t data

Definition at line 1259 of file value.h.

◆ fr_value_box_field_sizes

size_t const fr_value_box_field_sizes[]
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 *.

Definition at line 149 of file value.c.

◆ fr_value_box_offsets

size_t const fr_value_box_offsets[]
extern

Where the value starts in the fr_value_box_t.

Definition at line 189 of file value.c.

◆ fr_value_escape_backtick

fr_sbuff_escape_rules_t fr_value_escape_backtick
extern

Definition at line 419 of file value.c.

◆ fr_value_escape_by_char

fr_sbuff_escape_rules_t* fr_value_escape_by_char[UINT8_MAX+1]
extern

Definition at line 448 of file value.c.

◆ fr_value_escape_by_quote

fr_sbuff_escape_rules_t* fr_value_escape_by_quote[T_TOKEN_LAST]
extern

Definition at line 441 of file value.c.

◆ fr_value_escape_double

fr_sbuff_escape_rules_t fr_value_escape_double
extern

Definition at line 350 of file value.c.

◆ fr_value_escape_secret

fr_sbuff_escape_rules_t fr_value_escape_secret
extern

Escape secret fields by simply mashing all data to '.

'

The length of the secret still leaks, but that is likely fine. Fixing that is more work.

Definition at line 381 of file value.c.

◆ fr_value_escape_single

fr_sbuff_escape_rules_t fr_value_escape_single
extern

Definition at line 388 of file value.c.

◆ fr_value_escape_solidus

fr_sbuff_escape_rules_t fr_value_escape_solidus
extern

Definition at line 398 of file value.c.

◆ fr_value_escape_unprintables

fr_sbuff_escape_rules_t fr_value_escape_unprintables
extern

Definition at line 455 of file value.c.

◆ fr_value_unescape_backtick

fr_sbuff_unescape_rules_t fr_value_unescape_backtick
extern

Definition at line 317 of file value.c.

◆ fr_value_unescape_by_char

fr_sbuff_unescape_rules_t* fr_value_unescape_by_char[UINT8_MAX+1]
extern

Definition at line 343 of file value.c.

◆ fr_value_unescape_by_quote

fr_sbuff_unescape_rules_t* fr_value_unescape_by_quote[T_TOKEN_LAST]
extern

Definition at line 336 of file value.c.

◆ fr_value_unescape_double

fr_sbuff_unescape_rules_t fr_value_unescape_double
extern

Definition at line 266 of file value.c.

◆ fr_value_unescape_single

fr_sbuff_unescape_rules_t fr_value_unescape_single
extern

Definition at line 285 of file value.c.

◆ fr_value_unescape_solidus

fr_sbuff_unescape_rules_t fr_value_unescape_solidus
extern

Definition at line 296 of file value.c.

◆ in

size_t char fr_sbuff_t* in

Definition at line 984 of file value.h.

◆ inlen

size_t char fr_sbuff_t size_t inlen

Definition at line 984 of file value.h.

◆ out

size_t char** out

Definition at line 984 of file value.h.

◆ value_parse_rules_backtick_quoted

fr_sbuff_parse_rules_t const value_parse_rules_backtick_quoted
extern

Definition at line 565 of file value.c.

◆ value_parse_rules_backtick_unquoted

fr_sbuff_parse_rules_t const value_parse_rules_backtick_unquoted
extern

Definition at line 496 of file value.c.

◆ value_parse_rules_bareword_quoted

fr_sbuff_parse_rules_t const value_parse_rules_bareword_quoted
extern

Definition at line 524 of file value.c.

◆ value_parse_rules_bareword_unquoted

fr_sbuff_parse_rules_t const value_parse_rules_bareword_unquoted
extern

Default formatting rules.

Control token termination, escaping and how the tmpl is printed.

Definition at line 480 of file value.c.

◆ value_parse_rules_double_quoted

fr_sbuff_parse_rules_t const value_parse_rules_double_quoted
extern

Definition at line 547 of file value.c.

◆ value_parse_rules_double_unquoted

fr_sbuff_parse_rules_t const value_parse_rules_double_unquoted
extern

Definition at line 484 of file value.c.

◆ value_parse_rules_quoted

fr_sbuff_parse_rules_t const* value_parse_rules_quoted[T_TOKEN_LAST]
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.

Definition at line 579 of file value.c.

◆ value_parse_rules_quoted_char

fr_sbuff_parse_rules_t const* value_parse_rules_quoted_char[UINT8_MAX]
extern

Definition at line 587 of file value.c.

◆ value_parse_rules_single_quoted

fr_sbuff_parse_rules_t const value_parse_rules_single_quoted
extern

Definition at line 553 of file value.c.

◆ value_parse_rules_single_unquoted

fr_sbuff_parse_rules_t const value_parse_rules_single_unquoted
extern

Definition at line 488 of file value.c.

◆ value_parse_rules_solidus_quoted

fr_sbuff_parse_rules_t const value_parse_rules_solidus_quoted
extern

Definition at line 559 of file value.c.

◆ value_parse_rules_solidus_unquoted

fr_sbuff_parse_rules_t const value_parse_rules_solidus_unquoted
extern

Definition at line 492 of file value.c.

◆ value_parse_rules_unquoted

fr_sbuff_parse_rules_t const* value_parse_rules_unquoted[T_TOKEN_LAST]
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.

Definition at line 508 of file value.c.

◆ value_parse_rules_unquoted_char

fr_sbuff_parse_rules_t const* value_parse_rules_unquoted_char[UINT8_MAX]
extern

Definition at line 516 of file value.c.