23RCSID(
"$Id: a8f8fd4113d6f4afb6ad2fa0fa0e414603f10024 $")
25#include <freeradius-devel/util/strerror.h>
26#include <freeradius-devel/util/types.h>
27#include <freeradius-devel/util/value.h>
167#define ARRAY_BEG(_type) { [_type] = true,
168#define ARRAY_MID(_type) [_type] = true,
169#define ARRAY_END(_type) [_type] = true }
187#define O(_x) [FR_TYPE_ ## _x] = true
271 O(BOOL),
O(SIZE),
O(FLOAT32),
O(FLOAT64),
272 O(UINT8),
O(UINT16),
O(UINT32),
O(UINT64),
273 O(INT8),
O(INT16),
O(INT32),
O(INT64),
304 if (src == dst)
return true;
337#define O(_x) [FR_TYPE_ ## _x] = FR_TYPE_ ## _x
576 if (a == b)
return a;
636 if (c_type == NULL) {
#define L(_str)
Helper for initialising arrays of string literals.
Struct to represent an ethernet address.
Struct to represent an interface id.
@ FR_TYPE_TIME_DELTA
A period of time measured in nanoseconds.
@ FR_TYPE_FLOAT32
Single precision floating point.
@ FR_TYPE_IPV4_ADDR
32 Bit IPv4 Address.
@ FR_TYPE_INT8
8 Bit signed integer.
@ FR_TYPE_TLV
Contains nested attributes.
@ FR_TYPE_ETHERNET
48 Bit Mac-Address.
@ FR_TYPE_IPV6_PREFIX
IPv6 Prefix.
@ FR_TYPE_STRING
String of printable characters.
@ FR_TYPE_MAX
Number of defined data types.
@ FR_TYPE_NULL
Invalid (uninitialised) attribute type.
@ FR_TYPE_UINT16
16 Bit unsigned integer.
@ FR_TYPE_INT64
64 Bit signed integer.
@ FR_TYPE_INT16
16 Bit signed integer.
@ FR_TYPE_DATE
Unix time stamp, always has value >2^31.
@ FR_TYPE_COMBO_IP_PREFIX
IPv4 or IPv6 address prefix depending on length.
@ FR_TYPE_VALUE_BOX
A boxed value.
@ FR_TYPE_UINT8
8 Bit unsigned integer.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_STRUCT
like TLV, but without T or L, and fixed-width children
@ FR_TYPE_INT32
32 Bit signed integer.
@ FR_TYPE_VENDOR
Attribute that represents a vendor in the attribute tree.
@ FR_TYPE_UINT64
64 Bit unsigned integer.
@ FR_TYPE_IPV6_ADDR
128 Bit IPv6 Address.
@ FR_TYPE_IPV4_PREFIX
IPv4 Prefix.
@ FR_TYPE_BOOL
A truth value.
@ FR_TYPE_SIZE
Unsigned integer capable of representing any memory address on the local system.
@ FR_TYPE_VSA
Vendor-Specific, for RADIUS attribute 26.
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
@ FR_TYPE_IFID
Interface ID.
@ FR_TYPE_OCTETS
Raw octets.
@ FR_TYPE_GROUP
A grouping of other attributes.
@ FR_TYPE_FLOAT64
Double precision floating point.
fr_aka_sim_id_type_t type
An element in an arbitrarily ordered array of name to num mappings.
struct fr_time_delta_s fr_time_delta_t
A time delta, a difference in time measured in nanoseconds.
#define fr_strerror_printf(_fmt,...)
Log to thread local error buffer.
fr_table_num_ordered_t const fr_type_table[]
Map data types to names representing those types.
static char const * fr_type_to_c_type[]
Table of all the direct mappings between types and C types.
bool const fr_type_structural_except_vsa[FR_TYPE_MAX+1]
bool const fr_type_non_leaf[FR_TYPE_MAX+1]
bool fr_type_cast(fr_type_t dst, fr_type_t src)
Return if we're allowed to cast the types.
bool const fr_type_signed[FR_TYPE_MAX+1]
bool const fr_type_integer[FR_TYPE_MAX+1]
bool const fr_type_variable_size[FR_TYPE_MAX+1]
bool const fr_type_numeric[FR_TYPE_MAX+1]
static fr_type_t type_promote_table[FR_TYPE_MAX][FR_TYPE_MAX]
promote (a,b) -> a or b a/b are not octets / string a and b are both FR_TYPE_VALUE
bool const fr_type_ip[FR_TYPE_MAX+1]
static const bool type_is_number[FR_TYPE_MAX]
bool const fr_type_fixed_size[FR_TYPE_MAX+1]
bool const fr_type_integer_except_bool[FR_TYPE_MAX+1]
bool const fr_type_quoted[FR_TYPE_MAX+1]
void ** fr_type_array_alloc(TALLOC_CTX *ctx, fr_type_t type, size_t count)
Allocate an array of a given type.
bool const fr_type_leaf[FR_TYPE_MAX+1]
static size_t const fr_type_to_c_size[]
Table of all the direct mappings between types and C type sizes.
fr_type_t fr_type_promote(fr_type_t a, fr_type_t b)
Return the promoted type.
static const bool type_cast_table[FR_TYPE_MAX][FR_TYPE_MAX]
bool const fr_type_structural[FR_TYPE_MAX+1]
#define FR_TYPE_NON_LEAF_DEF(_beg, _mid, _end)
Types which do not represent leaf values.
#define FR_TYPE_IP_DEF(_beg, _mid, _end)
Types which can fit in an fr_ipaddr_t.
#define FR_TYPE_FIXED_SIZE_DEF(_beg, _mid, _end)
Match all fixed length types.
#define FR_TYPE_STRUCTURAL_EXCEPT_VSA_DEF(_beg, _mid, _end)
Stupid hack for things which produce special error messages for VSAs.
#define FR_TYPE_SIGNED_DEF(_beg, _mid, _end)
Signed values.
#define FR_TYPE_VARIABLE_SIZE_DEF(_beg, _mid, _end)
Match all variable length types.
#define FR_TYPE_NUMERIC_DEF(_beg, _mid, _end)
Naturally numeric types.
#define FR_TYPE_INTEGER_EXCEPT_BOOL_DEF(_beg, _mid, _end)
All integer types except bool.
#define FR_TYPE_LEAF_DEF(_beg, _mid, _end)
Types which represent concrete values.
#define fr_type_is_leaf(_x)
#define FR_TYPE_STRUCTURAL_DEF(_beg, _mid, _end)
Match all non value types in case statements.
static char const * fr_type_to_str(fr_type_t type)
Return a static string containing the type name.
#define FR_TYPE_QUOTED_DEF(_beg, _mid, _end)
Types which should be wrapped in double quotes when printed.
#define FR_TYPE_INTEGER_DEF(_beg, _mid, _end)
Signed or unsigned integers.