The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Enumerations | Functions | Variables
types.h File Reference

Types of values contained within an fr_value_box_t. More...

#include <freeradius-devel/util/table.h>
#include <freeradius-devel/util/talloc.h>
#include <stdbool.h>
+ Include dependency graph for types.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FR_CTYPE_TO_TYPE(_ct)
 Given a variable, return the equivalent FR_TYPE_* value. More...
 

Enumerations

enum  fr_type_t {
  FR_TYPE_NULL = 0 ,
  FR_TYPE_STRING ,
  FR_TYPE_OCTETS ,
  FR_TYPE_IPV4_ADDR ,
  FR_TYPE_IPV4_PREFIX ,
  FR_TYPE_IPV6_ADDR ,
  FR_TYPE_IPV6_PREFIX ,
  FR_TYPE_IFID ,
  FR_TYPE_COMBO_IP_ADDR ,
  FR_TYPE_COMBO_IP_PREFIX ,
  FR_TYPE_ETHERNET ,
  FR_TYPE_BOOL ,
  FR_TYPE_UINT8 ,
  FR_TYPE_UINT16 ,
  FR_TYPE_UINT32 ,
  FR_TYPE_UINT64 ,
  FR_TYPE_INT8 ,
  FR_TYPE_INT16 ,
  FR_TYPE_INT32 ,
  FR_TYPE_INT64 ,
  FR_TYPE_FLOAT32 ,
  FR_TYPE_FLOAT64 ,
  FR_TYPE_DATE ,
  FR_TYPE_TIME_DELTA ,
  FR_TYPE_SIZE ,
  FR_TYPE_TLV ,
  FR_TYPE_STRUCT ,
  FR_TYPE_VSA ,
  FR_TYPE_VENDOR ,
  FR_TYPE_GROUP ,
  FR_TYPE_VALUE_BOX ,
  FR_TYPE_VOID ,
  FR_TYPE_MAX ,
  FR_TYPE_NULL = 0 ,
  FR_TYPE_STRING ,
  FR_TYPE_OCTETS ,
  FR_TYPE_IPV4_ADDR ,
  FR_TYPE_IPV4_PREFIX ,
  FR_TYPE_IPV6_ADDR ,
  FR_TYPE_IPV6_PREFIX ,
  FR_TYPE_IFID ,
  FR_TYPE_COMBO_IP_ADDR ,
  FR_TYPE_COMBO_IP_PREFIX ,
  FR_TYPE_ETHERNET ,
  FR_TYPE_BOOL ,
  FR_TYPE_UINT8 ,
  FR_TYPE_UINT16 ,
  FR_TYPE_UINT32 ,
  FR_TYPE_UINT64 ,
  FR_TYPE_INT8 ,
  FR_TYPE_INT16 ,
  FR_TYPE_INT32 ,
  FR_TYPE_INT64 ,
  FR_TYPE_FLOAT32 ,
  FR_TYPE_FLOAT64 ,
  FR_TYPE_DATE ,
  FR_TYPE_TIME_DELTA ,
  FR_TYPE_SIZE ,
  FR_TYPE_TLV ,
  FR_TYPE_STRUCT ,
  FR_TYPE_VSA ,
  FR_TYPE_VENDOR ,
  FR_TYPE_GROUP ,
  FR_TYPE_VALUE_BOX ,
  FR_TYPE_VOID ,
  FR_TYPE_MAX
}
 Internal data types. More...
 

Functions

void ** fr_type_array_alloc (TALLOC_CTX *ctx, fr_type_t type, size_t count)
 Allocate an array of a given type. More...
 
bool fr_type_cast (fr_type_t dst, fr_type_t src)
 Return if we're allowed to cast the types. More...
 
static fr_type_t fr_type_from_str (char const *type)
 Return the constant value representing a type. More...
 
fr_type_t fr_type_promote (fr_type_t a, fr_type_t b)
 Return the promoted type. More...
 
static char const * fr_type_to_str (fr_type_t type)
 Return a static string containing the type name. More...
 

Variables

fr_table_num_ordered_t const fr_type_table []
 Map data types to names representing those types. More...
 
size_t fr_type_table_len
 

Type grouping macros

#define FR_TYPE_FIXED_SIZE_DEF(_beg, _mid, _end)
 Match all fixed length types. More...
 
#define FR_TYPE_INTEGER_DEF(_beg, _mid, _end)
 Signed or unsigned integers. More...
 
#define FR_TYPE_INTEGER_EXCEPT_BOOL_DEF(_beg, _mid, _end)
 All integer types except bool. More...
 
#define FR_TYPE_IP_DEF(_beg, _mid, _end)
 Types which can fit in an fr_ipaddr_t. More...
 
#define FR_TYPE_LEAF_DEF(_beg, _mid, _end)
 Types which represent concrete values. More...
 
#define FR_TYPE_NON_LEAF_DEF(_beg, _mid, _end)
 Types which do not represent leaf values. More...
 
#define FR_TYPE_NUMERIC_DEF(_beg, _mid, _end)
 Naturally numeric types. More...
 
#define FR_TYPE_QUOTED_DEF(_beg, _mid, _end)
 Types which should be wrapped in double quotes when printed. More...
 
#define FR_TYPE_SIGNED_DEF(_beg, _mid, _end)
 Signed values. More...
 
#define FR_TYPE_STRUCTURAL_DEF(_beg, _mid, _end)
 Match all non value types in case statements. More...
 
#define FR_TYPE_STRUCTURAL_EXCEPT_GROUP_DEF(_beg, _mid, _end)
 Hack for truthiness check. More...
 
#define FR_TYPE_STRUCTURAL_EXCEPT_VSA_DEF(_beg, _mid, _end)
 Stupid hack for things which produce special error messages for VSAs. More...
 
#define FR_TYPE_VARIABLE_SIZE_DEF(_beg, _mid, _end)
 Match all variable length types. More...
 

Macros that emit multiple case statements to group types

#define CASE_BEG(_type)   _type:
 
#define CASE_END(_type)   case _type
 
#define CASE_MID(_type)   case _type:
 
#define FR_TYPE_FIXED_SIZE   FR_TYPE_FIXED_SIZE_DEF(CASE_BEG, CASE_MID, CASE_END)
 
#define FR_TYPE_INTEGER   FR_TYPE_INTEGER_DEF(CASE_BEG, CASE_MID, CASE_END)
 
#define FR_TYPE_INTEGER_EXCEPT_BOOL   FR_TYPE_INTEGER_EXCEPT_BOOL_DEF(CASE_BEG, CASE_MID, CASE_END)
 
#define FR_TYPE_IP   FR_TYPE_IP_DEF(CASE_BEG, CASE_MID, CASE_END)
 
#define FR_TYPE_LEAF   FR_TYPE_LEAF_DEF(CASE_BEG, CASE_MID, CASE_END)
 
#define FR_TYPE_NON_LEAF   FR_TYPE_NON_LEAF_DEF(CASE_BEG, CASE_MID, CASE_END)
 
#define FR_TYPE_NUMERIC   FR_TYPE_NUMERIC_DEF(CASE_BEG, CASE_MID, CASE_END)
 
#define FR_TYPE_QUOTED   FR_TYPE_QUOTED_DEF(CASE_BEG, CASE_MID, CASE_END)
 
#define FR_TYPE_SIGNED   FR_TYPE_SIGNED_DEF(CASE_BEG, CASE_MID, CASE_END)
 
#define FR_TYPE_STRUCTURAL   FR_TYPE_STRUCTURAL_DEF(CASE_BEG, CASE_MID, CASE_END)
 
#define FR_TYPE_STRUCTURAL_EXCEPT_GROUP   FR_TYPE_STRUCTURAL_EXCEPT_GROUP_DEF(CASE_BEG, CASE_MID, CASE_END)
 
#define FR_TYPE_STRUCTURAL_EXCEPT_VSA   FR_TYPE_STRUCTURAL_EXCEPT_VSA_DEF(CASE_BEG, CASE_MID, CASE_END)
 
#define FR_TYPE_VARIABLE_SIZE   FR_TYPE_VARIABLE_SIZE_DEF(CASE_BEG, CASE_MID, CASE_END)
 

Type checking macros

#define fr_type_is_bool(_x)   ((_x) == FR_TYPE_BOOL)
 
#define fr_type_is_combo_ipaddr(_x)   ((_x) == FR_TYPE_COMBO_IP_ADDR)
 
#define fr_type_is_combo_ipprefix(_x)   ((_x) == FR_TYPE_COMBO_IP_PREFIX)
 
#define fr_type_is_date(_x)   ((_x) == FR_TYPE_DATE)
 
#define fr_type_is_ethernet(_x)   ((_x) == FR_TYPE_ETHERNET)
 
#define fr_type_is_fixed_size(_x)   (fr_type_fixed_size[_x])
 
#define fr_type_is_float32(_x)   ((_x) == FR_TYPE_FLOAT32)
 
#define fr_type_is_float64(_x)   ((_x) == FR_TYPE_FLOAT64)
 
#define fr_type_is_group(_x)   ((_x) == FR_TYPE_GROUP)
 
#define fr_type_is_ifid(_x)   ((_x) == FR_TYPE_IFID)
 
#define fr_type_is_int16(_x)   ((_x) == FR_TYPE_INT16)
 
#define fr_type_is_int32(_x)   ((_x) == FR_TYPE_INT32)
 
#define fr_type_is_int64(_x)   ((_x) == FR_TYPE_INT64)
 
#define fr_type_is_int8(_x)   ((_x) == FR_TYPE_INT8)
 
#define fr_type_is_integer(_x)   (fr_type_integer[_x])
 
#define fr_type_is_integer_except_bool(_x)   (fr_type_integer_except_bool[_x])
 
#define fr_type_is_ip(_x)   (fr_type_ip[_x])
 
#define fr_type_is_ipv4addr(_x)   ((_x) == FR_TYPE_IPV4_ADDR)
 
#define fr_type_is_ipv4prefix(_x)   ((_x) == FR_TYPE_IPV4_PREFIX)
 
#define fr_type_is_ipv6addr(_x)   ((_x) == FR_TYPE_IPV6_ADDR)
 
#define fr_type_is_ipv6prefix(_x)   ((_x) == FR_TYPE_IPV6_PREFIX)
 
#define fr_type_is_leaf(_x)   (fr_type_leaf[_x])
 
#define fr_type_is_non_leaf(_x)   (fr_type_non_leaf[_x])
 
#define fr_type_is_null(_x)   ((_x) == FR_TYPE_NULL)
 
#define fr_type_is_numeric(_x)   (fr_type_numeric[_x])
 
#define fr_type_is_octets(_x)   ((_x) == FR_TYPE_OCTETS)
 
#define fr_type_is_quoted(_x)   (fr_type_quoted[_x])
 
#define fr_type_is_signed(_x)   (fr_type_signed[_x])
 
#define fr_type_is_size(_x)   ((_x) == FR_TYPE_SIZE)
 
#define fr_type_is_string(_x)   ((_x) == FR_TYPE_STRING)
 
#define fr_type_is_struct(_x)   ((_x) == FR_TYPE_STRUCT)
 
#define fr_type_is_structural(_x)   (fr_type_structural[_x])
 
#define fr_type_is_structural_except_vsa(_x)   (fr_type_structural_except_vsa[_x])
 
#define fr_type_is_time_delta(_x)   ((_x) == FR_TYPE_TIME_DELTA)
 
#define fr_type_is_tlv(_x)   ((_x) == FR_TYPE_TLV)
 
#define fr_type_is_uint16(_x)   ((_x) == FR_TYPE_UINT16)
 
#define fr_type_is_uint32(_x)   ((_x) == FR_TYPE_UINT32)
 
#define fr_type_is_uint64(_x)   ((_x) == FR_TYPE_UINT64)
 
#define fr_type_is_uint8(_x)   ((_x) == FR_TYPE_UINT8)
 
#define fr_type_is_value_box(_x)   ((_x) == FR_TYPE_VALUE_BOX)
 
#define fr_type_is_variable_size(_x)   (fr_type_variable_size[_x])
 
#define fr_type_is_vendor(_x)   ((_x) == FR_TYPE_VENDOR)
 
#define fr_type_is_void(_x)   ((_x) == FR_TYPE_VOID)
 
#define fr_type_is_vsa(_x)   ((_x) == FR_TYPE_VSA)
 

Bool arrays that group types

bool const fr_type_fixed_size [FR_TYPE_MAX+1]
 
bool const fr_type_integer [FR_TYPE_MAX+1]
 
bool const fr_type_integer_except_bool [FR_TYPE_MAX+1]
 
bool const fr_type_ip [FR_TYPE_MAX+1]
 
bool const fr_type_leaf [FR_TYPE_MAX+1]
 
bool const fr_type_non_leaf [FR_TYPE_MAX+1]
 
bool const fr_type_numeric [FR_TYPE_MAX+1]
 
bool const fr_type_quoted [FR_TYPE_MAX+1]
 
bool const fr_type_signed [FR_TYPE_MAX+1]
 
bool const fr_type_structural [FR_TYPE_MAX+1]
 
bool const fr_type_structural_except_vsa [FR_TYPE_MAX+1]
 
bool const fr_type_variable_size [FR_TYPE_MAX+1]
 

Detailed Description

Types of values contained within an fr_value_box_t.

Definition in file types.h.

Macro Definition Documentation

◆ CASE_BEG

#define CASE_BEG (   _type)    _type:

Definition at line 279 of file types.h.

◆ CASE_END

#define CASE_END (   _type)    case _type

Definition at line 281 of file types.h.

◆ CASE_MID

#define CASE_MID (   _type)    case _type:

Definition at line 280 of file types.h.

◆ FR_CTYPE_TO_TYPE

#define FR_CTYPE_TO_TYPE (   _ct)

Given a variable, return the equivalent FR_TYPE_* value.

Note
Does not work for:
  • size_t / FR_TYPE_SIZE - Conflicts with other integers on many systems.
  • fr_ipaddr_t - Too many potential type mappings.
  • tmpl_t - Not an FR_TYPE_*.
Parameters
[in]_ctvariable to translate.

Definition at line 385 of file types.h.

◆ FR_TYPE_FIXED_SIZE

Definition at line 290 of file types.h.

◆ FR_TYPE_FIXED_SIZE_DEF

#define FR_TYPE_FIXED_SIZE_DEF (   _beg,
  _mid,
  _end 
)
Value:
_mid(FR_TYPE_IFID) \
FR_TYPE_NUMERIC_DEF(_mid, _mid, _end)
@ FR_TYPE_IPV4_ADDR
32 Bit IPv4 Address.
Definition: types.h:43
@ FR_TYPE_ETHERNET
48 Bit Mac-Address.
Definition: types.h:50
@ FR_TYPE_IPV6_PREFIX
IPv6 Prefix.
Definition: types.h:46
@ FR_TYPE_IPV6_ADDR
128 Bit IPv6 Address.
Definition: types.h:45
@ FR_TYPE_IPV4_PREFIX
IPv4 Prefix.
Definition: types.h:44
@ FR_TYPE_IFID
Interface ID.
Definition: types.h:47

Match all fixed length types.

  • Network addresses
  • Integers
  • All other fixed types

Definition at line 176 of file types.h.

◆ FR_TYPE_INTEGER

Definition at line 284 of file types.h.

◆ FR_TYPE_INTEGER_DEF

#define FR_TYPE_INTEGER_DEF (   _beg,
  _mid,
  _end 
)
Value:
_beg(FR_TYPE_BOOL) \
FR_TYPE_INTEGER_EXCEPT_BOOL_DEF(_mid, _mid, _end)
@ FR_TYPE_BOOL
A truth value.
Definition: types.h:52

Signed or unsigned integers.

  • Integers
  • Dates
  • Deltas
  • Bools

Definition at line 121 of file types.h.

◆ FR_TYPE_INTEGER_EXCEPT_BOOL

#define FR_TYPE_INTEGER_EXCEPT_BOOL   FR_TYPE_INTEGER_EXCEPT_BOOL_DEF(CASE_BEG, CASE_MID, CASE_END)

Definition at line 283 of file types.h.

◆ FR_TYPE_INTEGER_EXCEPT_BOOL_DEF

#define FR_TYPE_INTEGER_EXCEPT_BOOL_DEF (   _beg,
  _mid,
  _end 
)
Value:
_beg(FR_TYPE_UINT8) \
_mid(FR_TYPE_INT8) \
_mid(FR_TYPE_INT16) \
_mid(FR_TYPE_INT32) \
_mid(FR_TYPE_INT64) \
_mid(FR_TYPE_DATE) \
@ FR_TYPE_TIME_DELTA
A period of time measured in nanoseconds.
Definition: types.h:70
@ FR_TYPE_INT8
8 Bit signed integer.
Definition: types.h:60
@ FR_TYPE_UINT16
16 Bit unsigned integer.
Definition: types.h:55
@ FR_TYPE_INT64
64 Bit signed integer.
Definition: types.h:63
@ FR_TYPE_INT16
16 Bit signed integer.
Definition: types.h:61
@ FR_TYPE_DATE
Unix time stamp, always has value >2^31.
Definition: types.h:68
@ FR_TYPE_UINT8
8 Bit unsigned integer.
Definition: types.h:54
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition: types.h:56
@ FR_TYPE_INT32
32 Bit signed integer.
Definition: types.h:62
@ FR_TYPE_UINT64
64 Bit unsigned integer.
Definition: types.h:57
@ FR_TYPE_SIZE
Unsigned integer capable of representing any memory address on the local system.
Definition: types.h:72

All integer types except bool.

  • Integers
  • Dates
  • Delta

Definition at line 101 of file types.h.

◆ FR_TYPE_IP

Definition at line 288 of file types.h.

◆ FR_TYPE_IP_DEF

#define FR_TYPE_IP_DEF (   _beg,
  _mid,
  _end 
)
Value:
@ FR_TYPE_COMBO_IP_PREFIX
IPv4 or IPv6 address prefix depending on length.
Definition: types.h:49
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
Definition: types.h:48

Types which can fit in an fr_ipaddr_t.

  • Combo IP addresses
  • Combo IP prefixes
  • IPv4 addresses
  • IPv6 addresses
  • IPv4 prefix
  • IPv6 prefix

Definition at line 162 of file types.h.

◆ fr_type_is_bool

#define fr_type_is_bool (   _x)    ((_x) == FR_TYPE_BOOL)

Definition at line 337 of file types.h.

◆ fr_type_is_combo_ipaddr

#define fr_type_is_combo_ipaddr (   _x)    ((_x) == FR_TYPE_COMBO_IP_ADDR)

Definition at line 334 of file types.h.

◆ fr_type_is_combo_ipprefix

#define fr_type_is_combo_ipprefix (   _x)    ((_x) == FR_TYPE_COMBO_IP_PREFIX)

Definition at line 335 of file types.h.

◆ fr_type_is_date

#define fr_type_is_date (   _x)    ((_x) == FR_TYPE_DATE)

Definition at line 348 of file types.h.

◆ fr_type_is_ethernet

#define fr_type_is_ethernet (   _x)    ((_x) == FR_TYPE_ETHERNET)

Definition at line 336 of file types.h.

◆ fr_type_is_fixed_size

#define fr_type_is_fixed_size (   _x)    (fr_type_fixed_size[_x])

Definition at line 366 of file types.h.

◆ fr_type_is_float32

#define fr_type_is_float32 (   _x)    ((_x) == FR_TYPE_FLOAT32)

Definition at line 346 of file types.h.

◆ fr_type_is_float64

#define fr_type_is_float64 (   _x)    ((_x) == FR_TYPE_FLOAT64)

Definition at line 347 of file types.h.

◆ fr_type_is_group

#define fr_type_is_group (   _x)    ((_x) == FR_TYPE_GROUP)

Definition at line 355 of file types.h.

◆ fr_type_is_ifid

#define fr_type_is_ifid (   _x)    ((_x) == FR_TYPE_IFID)

Definition at line 333 of file types.h.

◆ fr_type_is_int16

#define fr_type_is_int16 (   _x)    ((_x) == FR_TYPE_INT16)

Definition at line 343 of file types.h.

◆ fr_type_is_int32

#define fr_type_is_int32 (   _x)    ((_x) == FR_TYPE_INT32)

Definition at line 344 of file types.h.

◆ fr_type_is_int64

#define fr_type_is_int64 (   _x)    ((_x) == FR_TYPE_INT64)

Definition at line 345 of file types.h.

◆ fr_type_is_int8

#define fr_type_is_int8 (   _x)    ((_x) == FR_TYPE_INT8)

Definition at line 342 of file types.h.

◆ fr_type_is_integer

#define fr_type_is_integer (   _x)    (fr_type_integer[_x])

Definition at line 360 of file types.h.

◆ fr_type_is_integer_except_bool

#define fr_type_is_integer_except_bool (   _x)    (fr_type_integer_except_bool[_x])

Definition at line 359 of file types.h.

◆ fr_type_is_ip

#define fr_type_is_ip (   _x)    (fr_type_ip[_x])

Definition at line 364 of file types.h.

◆ fr_type_is_ipv4addr

#define fr_type_is_ipv4addr (   _x)    ((_x) == FR_TYPE_IPV4_ADDR)

Definition at line 329 of file types.h.

◆ fr_type_is_ipv4prefix

#define fr_type_is_ipv4prefix (   _x)    ((_x) == FR_TYPE_IPV4_PREFIX)

Definition at line 330 of file types.h.

◆ fr_type_is_ipv6addr

#define fr_type_is_ipv6addr (   _x)    ((_x) == FR_TYPE_IPV6_ADDR)

Definition at line 331 of file types.h.

◆ fr_type_is_ipv6prefix

#define fr_type_is_ipv6prefix (   _x)    ((_x) == FR_TYPE_IPV6_PREFIX)

Definition at line 332 of file types.h.

◆ fr_type_is_leaf

#define fr_type_is_leaf (   _x)    (fr_type_leaf[_x])

Definition at line 372 of file types.h.

◆ fr_type_is_non_leaf

#define fr_type_is_non_leaf (   _x)    (fr_type_non_leaf[_x])

Definition at line 373 of file types.h.

◆ fr_type_is_null

#define fr_type_is_null (   _x)    ((_x) == FR_TYPE_NULL)

Definition at line 326 of file types.h.

◆ fr_type_is_numeric

#define fr_type_is_numeric (   _x)    (fr_type_numeric[_x])

Definition at line 361 of file types.h.

◆ fr_type_is_octets

#define fr_type_is_octets (   _x)    ((_x) == FR_TYPE_OCTETS)

Definition at line 328 of file types.h.

◆ fr_type_is_quoted

#define fr_type_is_quoted (   _x)    (fr_type_quoted[_x])

Definition at line 368 of file types.h.

◆ fr_type_is_signed

#define fr_type_is_signed (   _x)    (fr_type_signed[_x])

Definition at line 362 of file types.h.

◆ fr_type_is_size

#define fr_type_is_size (   _x)    ((_x) == FR_TYPE_SIZE)

Definition at line 350 of file types.h.

◆ fr_type_is_string

#define fr_type_is_string (   _x)    ((_x) == FR_TYPE_STRING)

Definition at line 327 of file types.h.

◆ fr_type_is_struct

#define fr_type_is_struct (   _x)    ((_x) == FR_TYPE_STRUCT)

Definition at line 352 of file types.h.

◆ fr_type_is_structural

#define fr_type_is_structural (   _x)    (fr_type_structural[_x])

Definition at line 371 of file types.h.

◆ fr_type_is_structural_except_vsa

#define fr_type_is_structural_except_vsa (   _x)    (fr_type_structural_except_vsa[_x])

Definition at line 370 of file types.h.

◆ fr_type_is_time_delta

#define fr_type_is_time_delta (   _x)    ((_x) == FR_TYPE_TIME_DELTA)

Definition at line 349 of file types.h.

◆ fr_type_is_tlv

#define fr_type_is_tlv (   _x)    ((_x) == FR_TYPE_TLV)

Definition at line 351 of file types.h.

◆ fr_type_is_uint16

#define fr_type_is_uint16 (   _x)    ((_x) == FR_TYPE_UINT16)

Definition at line 339 of file types.h.

◆ fr_type_is_uint32

#define fr_type_is_uint32 (   _x)    ((_x) == FR_TYPE_UINT32)

Definition at line 340 of file types.h.

◆ fr_type_is_uint64

#define fr_type_is_uint64 (   _x)    ((_x) == FR_TYPE_UINT64)

Definition at line 341 of file types.h.

◆ fr_type_is_uint8

#define fr_type_is_uint8 (   _x)    ((_x) == FR_TYPE_UINT8)

Definition at line 338 of file types.h.

◆ fr_type_is_value_box

#define fr_type_is_value_box (   _x)    ((_x) == FR_TYPE_VALUE_BOX)

Definition at line 356 of file types.h.

◆ fr_type_is_variable_size

#define fr_type_is_variable_size (   _x)    (fr_type_variable_size[_x])

Definition at line 367 of file types.h.

◆ fr_type_is_vendor

#define fr_type_is_vendor (   _x)    ((_x) == FR_TYPE_VENDOR)

Definition at line 354 of file types.h.

◆ fr_type_is_void

#define fr_type_is_void (   _x)    ((_x) == FR_TYPE_VOID)

Definition at line 357 of file types.h.

◆ fr_type_is_vsa

#define fr_type_is_vsa (   _x)    ((_x) == FR_TYPE_VSA)

Definition at line 353 of file types.h.

◆ FR_TYPE_LEAF

Definition at line 297 of file types.h.

◆ FR_TYPE_LEAF_DEF

#define FR_TYPE_LEAF_DEF (   _beg,
  _mid,
  _end 
)
Value:
_mid(FR_TYPE_IFID) \
FR_TYPE_IP_DEF(_mid, _mid, _mid) \
FR_TYPE_VARIABLE_SIZE_DEF(_mid, _mid, _mid) \
FR_TYPE_NUMERIC_DEF(_mid, _mid, _end)

Types which represent concrete values.

  • Network addresses
  • Strings
  • Octets
  • Numbers

Definition at line 252 of file types.h.

◆ FR_TYPE_NON_LEAF

Definition at line 298 of file types.h.

◆ FR_TYPE_NON_LEAF_DEF

#define FR_TYPE_NON_LEAF_DEF (   _beg,
  _mid,
  _end 
)
Value:
_mid(FR_TYPE_VOID) \
_mid(FR_TYPE_NULL) \
_mid(FR_TYPE_MAX) \
FR_TYPE_STRUCTURAL_DEF(_mid, _mid, _end)
@ FR_TYPE_MAX
Number of defined data types.
Definition: types.h:87
@ FR_TYPE_NULL
Invalid (uninitialised) attribute type.
Definition: types.h:38
@ FR_TYPE_VALUE_BOX
A boxed value.
Definition: types.h:82
@ FR_TYPE_VOID
User data.
Definition: types.h:84

Types which do not represent leaf values.

  • Structural
  • Boxes (can represent any type)
  • Void (opaque types)
  • Null (lack of value)
  • Invalid values

Definition at line 267 of file types.h.

◆ FR_TYPE_NUMERIC

Definition at line 286 of file types.h.

◆ FR_TYPE_NUMERIC_DEF

#define FR_TYPE_NUMERIC_DEF (   _beg,
  _mid,
  _end 
)
Value:
FR_TYPE_INTEGER_DEF(_mid, _mid, _end)
@ FR_TYPE_FLOAT32
Single precision floating point.
Definition: types.h:65
@ FR_TYPE_FLOAT64
Double precision floating point.
Definition: types.h:66

Naturally numeric types.

  • Integers
  • Dates
  • Deltas
  • Bools
  • Floats

Definition at line 148 of file types.h.

◆ FR_TYPE_QUOTED

Definition at line 292 of file types.h.

◆ FR_TYPE_QUOTED_DEF

#define FR_TYPE_QUOTED_DEF (   _beg,
  _mid,
  _end 
)
Value:
@ FR_TYPE_STRING
String of printable characters.
Definition: types.h:40

Types which should be wrapped in double quotes when printed.

  • Strings
  • Dates

Definition at line 203 of file types.h.

◆ FR_TYPE_SIGNED

Definition at line 285 of file types.h.

◆ FR_TYPE_SIGNED_DEF

#define FR_TYPE_SIGNED_DEF (   _beg,
  _mid,
  _end 
)
Value:

Signed values.

  • Int8, 16, 32, 64
  • Deltas
  • Floats

Definition at line 131 of file types.h.

◆ FR_TYPE_STRUCTURAL

Definition at line 296 of file types.h.

◆ FR_TYPE_STRUCTURAL_DEF

#define FR_TYPE_STRUCTURAL_DEF (   _beg,
  _mid,
  _end 
)
Value:
_beg(FR_TYPE_VSA) \
FR_TYPE_STRUCTURAL_EXCEPT_VSA_DEF(_mid, _mid, _end)
@ FR_TYPE_VSA
Vendor-Specific, for RADIUS attribute 26.
Definition: types.h:78

Match all non value types in case statements.

  • Groups
  • Structs
  • TLVs
  • Vendors
  • VSAs (i.e. a container of vendors)

Definition at line 241 of file types.h.

◆ FR_TYPE_STRUCTURAL_EXCEPT_GROUP

#define FR_TYPE_STRUCTURAL_EXCEPT_GROUP   FR_TYPE_STRUCTURAL_EXCEPT_GROUP_DEF(CASE_BEG, CASE_MID, CASE_END)

Definition at line 295 of file types.h.

◆ FR_TYPE_STRUCTURAL_EXCEPT_GROUP_DEF

#define FR_TYPE_STRUCTURAL_EXCEPT_GROUP_DEF (   _beg,
  _mid,
  _end 
)
Value:
_beg(FR_TYPE_VSA) \
_mid(FR_TYPE_TLV) \
@ FR_TYPE_TLV
Contains nested attributes.
Definition: types.h:75
@ FR_TYPE_STRUCT
like TLV, but without T or L, and fixed-width children
Definition: types.h:76
@ FR_TYPE_VENDOR
Attribute that represents a vendor in the attribute tree.
Definition: types.h:79

Hack for truthiness check.

  • VSAs
  • Structs
  • TLVs
  • Vendors

Definition at line 227 of file types.h.

◆ FR_TYPE_STRUCTURAL_EXCEPT_VSA

#define FR_TYPE_STRUCTURAL_EXCEPT_VSA   FR_TYPE_STRUCTURAL_EXCEPT_VSA_DEF(CASE_BEG, CASE_MID, CASE_END)

Definition at line 294 of file types.h.

◆ FR_TYPE_STRUCTURAL_EXCEPT_VSA_DEF

#define FR_TYPE_STRUCTURAL_EXCEPT_VSA_DEF (   _beg,
  _mid,
  _end 
)
Value:
_beg(FR_TYPE_GROUP) \
_mid(FR_TYPE_TLV) \
@ FR_TYPE_GROUP
A grouping of other attributes.
Definition: types.h:81

Stupid hack for things which produce special error messages for VSAs.

  • Groups
  • Structs
  • TLVs
  • Vendors

Definition at line 214 of file types.h.

◆ FR_TYPE_VARIABLE_SIZE

#define FR_TYPE_VARIABLE_SIZE   FR_TYPE_VARIABLE_SIZE_DEF(CASE_BEG, CASE_MID, CASE_END)

Definition at line 291 of file types.h.

◆ FR_TYPE_VARIABLE_SIZE_DEF

#define FR_TYPE_VARIABLE_SIZE_DEF (   _beg,
  _mid,
  _end 
)
Value:
@ FR_TYPE_OCTETS
Raw octets.
Definition: types.h:41

Match all variable length types.

Note
Whilst combo IP addresses and prefixes may technically be variable length on the wire, these groupings are referring to our internal box representation which is fixed size.
  • Strings
  • Octets

Definition at line 194 of file types.h.

Enumeration Type Documentation

◆ fr_type_t

enum fr_type_t

Internal data types.

Enumerator
FR_TYPE_NULL 

Invalid (uninitialised) attribute type.

FR_TYPE_STRING 

String of printable characters.

FR_TYPE_OCTETS 

Raw octets.

FR_TYPE_IPV4_ADDR 

32 Bit IPv4 Address.

FR_TYPE_IPV4_PREFIX 

IPv4 Prefix.

FR_TYPE_IPV6_ADDR 

128 Bit IPv6 Address.

FR_TYPE_IPV6_PREFIX 

IPv6 Prefix.

FR_TYPE_IFID 

Interface ID.

FR_TYPE_COMBO_IP_ADDR 

IPv4 or IPv6 address depending on length.

FR_TYPE_COMBO_IP_PREFIX 

IPv4 or IPv6 address prefix depending on length.

FR_TYPE_ETHERNET 

48 Bit Mac-Address.

FR_TYPE_BOOL 

A truth value.

FR_TYPE_UINT8 

8 Bit unsigned integer.

FR_TYPE_UINT16 

16 Bit unsigned integer.

FR_TYPE_UINT32 

32 Bit unsigned integer.

FR_TYPE_UINT64 

64 Bit unsigned integer.

FR_TYPE_INT8 

8 Bit signed integer.

FR_TYPE_INT16 

16 Bit signed integer.

FR_TYPE_INT32 

32 Bit signed integer.

FR_TYPE_INT64 

64 Bit signed integer.

FR_TYPE_FLOAT32 

Single precision floating point.

FR_TYPE_FLOAT64 

Double precision floating point.

FR_TYPE_DATE 

Unix time stamp, always has value >2^31.

FR_TYPE_TIME_DELTA 

A period of time measured in nanoseconds.

FR_TYPE_SIZE 

Unsigned integer capable of representing any memory address on the local system.

FR_TYPE_TLV 

Contains nested attributes.

FR_TYPE_STRUCT 

like TLV, but without T or L, and fixed-width children

FR_TYPE_VSA 

Vendor-Specific, for RADIUS attribute 26.

FR_TYPE_VENDOR 

Attribute that represents a vendor in the attribute tree.

FR_TYPE_GROUP 

A grouping of other attributes.

FR_TYPE_VALUE_BOX 

A boxed value.

FR_TYPE_VOID 

User data.

Should be a talloced chunk assigned to the ptr value of the union.

FR_TYPE_MAX 

Number of defined data types.

FR_TYPE_NULL 

Invalid (uninitialised) attribute type.

FR_TYPE_STRING 

String of printable characters.

FR_TYPE_OCTETS 

Raw octets.

FR_TYPE_IPV4_ADDR 

32 Bit IPv4 Address.

FR_TYPE_IPV4_PREFIX 

IPv4 Prefix.

FR_TYPE_IPV6_ADDR 

128 Bit IPv6 Address.

FR_TYPE_IPV6_PREFIX 

IPv6 Prefix.

FR_TYPE_IFID 

Interface ID.

FR_TYPE_COMBO_IP_ADDR 

IPv4 or IPv6 address depending on length.

FR_TYPE_COMBO_IP_PREFIX 

IPv4 or IPv6 address prefix depending on length.

FR_TYPE_ETHERNET 

48 Bit Mac-Address.

FR_TYPE_BOOL 

A truth value.

FR_TYPE_UINT8 

8 Bit unsigned integer.

FR_TYPE_UINT16 

16 Bit unsigned integer.

FR_TYPE_UINT32 

32 Bit unsigned integer.

FR_TYPE_UINT64 

64 Bit unsigned integer.

FR_TYPE_INT8 

8 Bit signed integer.

FR_TYPE_INT16 

16 Bit signed integer.

FR_TYPE_INT32 

32 Bit signed integer.

FR_TYPE_INT64 

64 Bit signed integer.

FR_TYPE_FLOAT32 

Single precision floating point.

FR_TYPE_FLOAT64 

Double precision floating point.

FR_TYPE_DATE 

Unix time stamp, always has value >2^31.

FR_TYPE_TIME_DELTA 

A period of time measured in nanoseconds.

FR_TYPE_SIZE 

Unsigned integer capable of representing any memory address on the local system.

FR_TYPE_TLV 

Contains nested attributes.

FR_TYPE_STRUCT 

like TLV, but without T or L, and fixed-width children

FR_TYPE_VSA 

Vendor-Specific, for RADIUS attribute 26.

FR_TYPE_VENDOR 

Attribute that represents a vendor in the attribute tree.

FR_TYPE_GROUP 

A grouping of other attributes.

FR_TYPE_VALUE_BOX 

A boxed value.

FR_TYPE_VOID 

User data.

Should be a talloced chunk assigned to the ptr value of the union.

FR_TYPE_MAX 

Number of defined data types.

Definition at line 37 of file types.h.

Function Documentation

◆ fr_type_array_alloc()

void** fr_type_array_alloc ( TALLOC_CTX *  ctx,
fr_type_t  type,
size_t  count 
)

Allocate an array of a given type.

Parameters
[in]ctxto allocate array in.
[in]typearray to allocate.
[in]countThe number of elements to allocate.
Returns
  • NULL on error.
  • A new talloc array.

Definition at line 631 of file types.c.

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

◆ fr_type_cast()

bool fr_type_cast ( fr_type_t  dst,
fr_type_t  src 
)

Return if we're allowed to cast the types.

Parameters
dstthe destination type we wish to cast to
srcthe source type we wish to cast to

Definition at line 283 of file types.c.

+ Here is the caller graph for this function:

◆ fr_type_from_str()

static fr_type_t fr_type_from_str ( char const *  type)
inlinestatic

Return the constant value representing a type.

Parameters
[in]typeto return the constant value for.
Returns
The constant type value or FR_TYPE_NULL if no type matches.

Definition at line 443 of file types.h.

+ Here is the caller graph for this function:

◆ fr_type_promote()

fr_type_t fr_type_promote ( fr_type_t  a,
fr_type_t  b 
)

Return the promoted type.

We presume that the two types are compatible, as checked by calling fr_type_cast(). The main difference here is that the two types don't have any src / dst relationship. Instead, we just pick one which best suits any value-box comparisons

Note that this function can return a type which is not a or b.

Parameters
atype one
btype two
Returns
the promoted type

Definition at line 572 of file types.c.

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

◆ fr_type_to_str()

static char const* fr_type_to_str ( fr_type_t  type)
inlinestatic

Return a static string containing the type name.

Parameters
[in]typeto return name for.
Returns
name of the type

Definition at line 433 of file types.h.

Variable Documentation

◆ fr_type_fixed_size

bool const fr_type_fixed_size[FR_TYPE_MAX+1]
extern

Definition at line 178 of file types.c.

◆ fr_type_integer

bool const fr_type_integer[FR_TYPE_MAX+1]
extern

Definition at line 172 of file types.c.

◆ fr_type_integer_except_bool

bool const fr_type_integer_except_bool[FR_TYPE_MAX+1]
extern

Definition at line 171 of file types.c.

◆ fr_type_ip

bool const fr_type_ip[FR_TYPE_MAX+1]
extern

Definition at line 176 of file types.c.

◆ fr_type_leaf

bool const fr_type_leaf[FR_TYPE_MAX+1]
extern

Definition at line 184 of file types.c.

◆ fr_type_non_leaf

bool const fr_type_non_leaf[FR_TYPE_MAX+1]
extern

Definition at line 185 of file types.c.

◆ fr_type_numeric

bool const fr_type_numeric[FR_TYPE_MAX+1]
extern

Definition at line 173 of file types.c.

◆ fr_type_quoted

bool const fr_type_quoted[FR_TYPE_MAX+1]
extern

Definition at line 180 of file types.c.

◆ fr_type_signed

bool const fr_type_signed[FR_TYPE_MAX+1]
extern

Definition at line 174 of file types.c.

◆ fr_type_structural

bool const fr_type_structural[FR_TYPE_MAX+1]
extern

Definition at line 183 of file types.c.

◆ fr_type_structural_except_vsa

bool const fr_type_structural_except_vsa[FR_TYPE_MAX+1]
extern

Definition at line 182 of file types.c.

◆ fr_type_table

fr_table_num_ordered_t const fr_type_table[]
extern

Map data types to names representing those types.

Definition at line 31 of file types.c.

◆ fr_type_table_len

size_t fr_type_table_len
extern

Definition at line 84 of file types.c.

◆ fr_type_variable_size

bool const fr_type_variable_size[FR_TYPE_MAX+1]
extern

Definition at line 179 of file types.c.