The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18/** Types of values contained within an #fr_value_box_t
19 *
20 * @file src/lib/util/types.h
21 *
22 * @copyright 2021 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
23 * @copyright 2017 The FreeRADIUS server project
24 */
25RCSIDH(types_h, "$Id: a310f3ed4d2839eff56a7e525ee91414c30d2d15 $")
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#include <freeradius-devel/util/table.h>
32#include <freeradius-devel/util/talloc.h>
33#include <stdbool.h>
34
35/** Internal data types
36 */
37typedef enum {
38 FR_TYPE_NULL = 0, //!< Invalid (uninitialised) attribute type.
39
40 FR_TYPE_STRING, //!< String of printable characters.
41 FR_TYPE_OCTETS, //!< Raw octets.
42
43 FR_TYPE_IPV4_ADDR, //!< 32 Bit IPv4 Address.
44 FR_TYPE_IPV4_PREFIX, //!< IPv4 Prefix.
45 FR_TYPE_IPV6_ADDR, //!< 128 Bit IPv6 Address.
46 FR_TYPE_IPV6_PREFIX, //!< IPv6 Prefix.
47 FR_TYPE_IFID, //!< Interface ID.
48 FR_TYPE_COMBO_IP_ADDR, //!< IPv4 or IPv6 address depending on length.
49 FR_TYPE_COMBO_IP_PREFIX, //!< IPv4 or IPv6 address prefix depending on length.
50 FR_TYPE_ETHERNET, //!< 48 Bit Mac-Address.
51
52 FR_TYPE_BOOL, //!< A truth value.
53
54 FR_TYPE_UINT8, //!< 8 Bit unsigned integer.
55 FR_TYPE_UINT16, //!< 16 Bit unsigned integer.
56 FR_TYPE_UINT32, //!< 32 Bit unsigned integer.
57 FR_TYPE_UINT64, //!< 64 Bit unsigned integer.
58
59
60 FR_TYPE_INT8, //!< 8 Bit signed integer.
61 FR_TYPE_INT16, //!< 16 Bit signed integer.
62 FR_TYPE_INT32, //!< 32 Bit signed integer.
63 FR_TYPE_INT64, //!< 64 Bit signed integer.
64
65 FR_TYPE_FLOAT32, //!< Single precision floating point.
66 FR_TYPE_FLOAT64, //!< Double precision floating point.
67
68 FR_TYPE_DATE, //!< Unix time stamp, always has value >2^31
69
70 FR_TYPE_TIME_DELTA, //!< A period of time measured in nanoseconds.
71
72 FR_TYPE_SIZE, //!< Unsigned integer capable of representing any memory
73 //!< address on the local system.
74
75 FR_TYPE_TLV, //!< Contains nested attributes.
76 FR_TYPE_STRUCT, //!< like TLV, but without T or L, and fixed-width children
77
78 FR_TYPE_VSA, //!< Vendor-Specific, for RADIUS attribute 26.
79 FR_TYPE_VENDOR, //!< Attribute that represents a vendor in the attribute tree.
80
81 FR_TYPE_GROUP, //!< A grouping of other attributes
82 FR_TYPE_UNION, //!< A union of limited children
83 FR_TYPE_VALUE_BOX, //!< A boxed value.
84 FR_TYPE_ATTR, //!< A contains an attribute reference
85
86 FR_TYPE_VOID, //!< User data. Should be a talloced chunk
87 ///< assigned to the ptr value of the union.
88
89 FR_TYPE_VALUE_BOX_CURSOR, //!< cursor over a #fr_value_box_t
90
91 FR_TYPE_PAIR_CURSOR, //!< cursor over a #fr_pair_t
92
93 FR_TYPE_MAX //!< Number of defined data types.
95
96/** @name Type grouping macros
97 *
98 * @{
99 */
100
101/** All integer types except bool
102 *
103 * - Integers
104 * - Dates
105 * - Delta
106 */
107#define FR_TYPE_INTEGER_EXCEPT_BOOL_DEF(_beg, _mid, _end) \
108 _beg(FR_TYPE_UINT8) \
109 _mid(FR_TYPE_UINT16) \
110 _mid(FR_TYPE_UINT32) \
111 _mid(FR_TYPE_UINT64) \
112 _mid(FR_TYPE_INT8) \
113 _mid(FR_TYPE_INT16) \
114 _mid(FR_TYPE_INT32) \
115 _mid(FR_TYPE_INT64) \
116 _mid(FR_TYPE_DATE) \
117 _mid(FR_TYPE_TIME_DELTA) \
118 _end(FR_TYPE_SIZE)
119
120/** Signed or unsigned integers
121 *
122 * - Integers
123 * - Dates
124 * - Deltas
125 * - Bools
126 */
127#define FR_TYPE_INTEGER_DEF(_beg, _mid, _end) \
128 _beg(FR_TYPE_BOOL) \
129 FR_TYPE_INTEGER_EXCEPT_BOOL_DEF(_mid, _mid, _end)
130
131/** Signed values
132 *
133 * - Int8, 16, 32, 64
134 * - Deltas
135 * - Floats
136 */
137#define FR_TYPE_SIGNED_DEF(_beg, _mid, _end) \
138 _beg(FR_TYPE_INT8) \
139 _mid(FR_TYPE_INT16) \
140 _mid(FR_TYPE_INT32) \
141 _mid(FR_TYPE_INT64) \
142 _mid(FR_TYPE_TIME_DELTA) \
143 _mid(FR_TYPE_FLOAT32) \
144 _end(FR_TYPE_FLOAT64)
145
146/** Naturally numeric types
147 *
148 * - Integers
149 * - Dates
150 * - Deltas
151 * - Bools
152 * - Floats
153 */
154#define FR_TYPE_NUMERIC_DEF(_beg, _mid, _end) \
155 _beg(FR_TYPE_FLOAT32) \
156 _mid(FR_TYPE_FLOAT64) \
157 FR_TYPE_INTEGER_DEF(_mid, _mid, _end)
158
159/** Types which can fit in an #fr_ipaddr_t
160 *
161 * - Combo IP addresses
162 * - Combo IP prefixes
163 * - IPv4 addresses
164 * - IPv6 addresses
165 * - IPv4 prefix
166 * - IPv6 prefix
167 */
168#define FR_TYPE_IP_DEF(_beg, _mid, _end) \
169 _beg(FR_TYPE_COMBO_IP_ADDR) \
170 _mid(FR_TYPE_COMBO_IP_PREFIX) \
171 _mid(FR_TYPE_IPV4_ADDR) \
172 _mid(FR_TYPE_IPV4_PREFIX) \
173 _mid(FR_TYPE_IPV6_ADDR) \
174 _end(FR_TYPE_IPV6_PREFIX)
175
176/** Match all fixed length types
177 *
178 * - Network addresses
179 * - Integers
180 * - All other fixed types
181 */
182#define FR_TYPE_FIXED_SIZE_DEF(_beg, _mid, _end) \
183 _beg(FR_TYPE_ETHERNET) \
184 _mid(FR_TYPE_IFID) \
185 _mid(FR_TYPE_IPV4_ADDR) \
186 _mid(FR_TYPE_IPV4_PREFIX) \
187 _mid(FR_TYPE_IPV6_ADDR) \
188 _mid(FR_TYPE_IPV6_PREFIX) \
189 FR_TYPE_NUMERIC_DEF(_mid, _mid, _end)
190
191/** Match all variable length types
192 *
193 * @note Whilst combo IP addresses and prefixes may technically be
194 * variable length on the wire, these groupings are referring
195 * to our internal box representation which is fixed size.
196 *
197 * - Strings
198 * - Octets
199 */
200#define FR_TYPE_VARIABLE_SIZE_DEF(_beg, _mid, _end) \
201 _beg(FR_TYPE_STRING) \
202 _end(FR_TYPE_OCTETS)
203
204/** Types which should be wrapped in double quotes when printed
205 *
206 * - Strings
207 * - Dates
208 */
209#define FR_TYPE_QUOTED_DEF(_beg, _mid, _end) \
210 _beg(FR_TYPE_STRING) \
211 _end(FR_TYPE_DATE)
212
213/** Stupid hack for things which produce special error messages for VSAs
214 *
215 * - Groups
216 * - Structs
217 * - TLVs
218 * - Vendors
219 */
220#define FR_TYPE_STRUCTURAL_EXCEPT_VSA_DEF(_beg, _mid, _end) \
221 _beg(FR_TYPE_GROUP) \
222 _mid(FR_TYPE_STRUCT) \
223 _mid(FR_TYPE_TLV) \
224 _mid(FR_TYPE_UNION) \
225 _end(FR_TYPE_VENDOR)
226
227/** Hack for truthiness check
228 *
229 * - VSAs
230 * - Structs
231 * - TLVs
232 * - Vendors
233 */
234#define FR_TYPE_STRUCTURAL_EXCEPT_GROUP_DEF(_beg, _mid, _end) \
235 _beg(FR_TYPE_VSA) \
236 _mid(FR_TYPE_STRUCT) \
237 _mid(FR_TYPE_TLV) \
238 _mid(FR_TYPE_UNION) \
239 _end(FR_TYPE_VENDOR)
240
241/** Match all non value types in case statements
242 *
243 * - Groups
244 * - Structs
245 * - TLVs
246 * - Vendors
247 * - VSAs (i.e. a container of vendors)
248 */
249#define FR_TYPE_STRUCTURAL_DEF(_beg, _mid, _end) \
250 _beg(FR_TYPE_VSA) \
251 FR_TYPE_STRUCTURAL_EXCEPT_VSA_DEF(_mid, _mid, _end)
252
253/** Types which represent concrete values
254 *
255 * - Network addresses
256 * - Strings
257 * - Octets
258 * - Numbers
259 */
260#define FR_TYPE_LEAF_DEF(_beg, _mid, _end) \
261 _beg(FR_TYPE_ETHERNET) \
262 _mid(FR_TYPE_IFID) \
263 _mid(FR_TYPE_ATTR) \
264 FR_TYPE_IP_DEF(_mid, _mid, _mid) \
265 FR_TYPE_VARIABLE_SIZE_DEF(_mid, _mid, _mid) \
266 FR_TYPE_NUMERIC_DEF(_mid, _mid, _end)
267
268/** Types which are internal, and should not be used for real data.
269 *
270 * - Boxes (can represent any type)
271 * - Void (opaque types)
272 * - Invalid values
273 */
274#define FR_TYPE_INTERNAL_DEF(_beg, _mid, _end) \
275 _beg(FR_TYPE_VALUE_BOX) \
276 _mid(FR_TYPE_VOID) \
277 _mid(FR_TYPE_VALUE_BOX_CURSOR) \
278 _mid(FR_TYPE_PAIR_CURSOR) \
279 _end(FR_TYPE_MAX)
280
281/** Types which do not represent leaf values
282 *
283 * - Structural
284 * - Boxes (can represent any type)
285 * - Void (opaque types)
286 * - Null (lack of value)
287 * - Invalid values
288 */
289#define FR_TYPE_NON_LEAF_DEF(_beg, _mid, _end) \
290 _beg(FR_TYPE_NULL) \
291 FR_TYPE_INTERNAL_DEF(_mid, _mid, _mid) \
292 FR_TYPE_STRUCTURAL_DEF(_mid, _mid, _end)
293
294/** @} */
295
296/** @name Macros that emit multiple case statements to group types
297 *
298 * @{
299 */
300#define CASE_BEG(_type) _type:
301#define CASE_MID(_type) case _type:
302#define CASE_END(_type) case _type
303
304#define FR_TYPE_INTEGER_EXCEPT_BOOL FR_TYPE_INTEGER_EXCEPT_BOOL_DEF(CASE_BEG, CASE_MID, CASE_END)
305#define FR_TYPE_INTEGER FR_TYPE_INTEGER_DEF(CASE_BEG, CASE_MID, CASE_END)
306#define FR_TYPE_SIGNED FR_TYPE_SIGNED_DEF(CASE_BEG, CASE_MID, CASE_END)
307#define FR_TYPE_NUMERIC FR_TYPE_NUMERIC_DEF(CASE_BEG, CASE_MID, CASE_END)
308
309#define FR_TYPE_IP FR_TYPE_IP_DEF(CASE_BEG, CASE_MID, CASE_END)
310
311#define FR_TYPE_FIXED_SIZE FR_TYPE_FIXED_SIZE_DEF(CASE_BEG, CASE_MID, CASE_END)
312#define FR_TYPE_VARIABLE_SIZE FR_TYPE_VARIABLE_SIZE_DEF(CASE_BEG, CASE_MID, CASE_END)
313#define FR_TYPE_QUOTED FR_TYPE_QUOTED_DEF(CASE_BEG, CASE_MID, CASE_END)
314
315#define FR_TYPE_STRUCTURAL_EXCEPT_VSA FR_TYPE_STRUCTURAL_EXCEPT_VSA_DEF(CASE_BEG, CASE_MID, CASE_END)
316#define FR_TYPE_STRUCTURAL_EXCEPT_GROUP FR_TYPE_STRUCTURAL_EXCEPT_GROUP_DEF(CASE_BEG, CASE_MID, CASE_END)
317#define FR_TYPE_STRUCTURAL FR_TYPE_STRUCTURAL_DEF(CASE_BEG, CASE_MID, CASE_END)
318#define FR_TYPE_LEAF FR_TYPE_LEAF_DEF(CASE_BEG, CASE_MID, CASE_END)
319#define FR_TYPE_NON_LEAF FR_TYPE_NON_LEAF_DEF(CASE_BEG, CASE_MID, CASE_END)
320#define FR_TYPE_INTERNAL FR_TYPE_INTERNAL_DEF(CASE_BEG, CASE_MID, CASE_END)
321/** @} */
322
323/** @name Bool arrays that group types
324 *
325 * @{
326 */
327extern bool const fr_type_integer_except_bool[FR_TYPE_MAX + 1];
328extern bool const fr_type_integer[FR_TYPE_MAX + 1];
329extern bool const fr_type_signed[FR_TYPE_MAX + 1];
330extern bool const fr_type_numeric[FR_TYPE_MAX + 1];
331
332extern bool const fr_type_ip[FR_TYPE_MAX + 1];
333
334extern bool const fr_type_fixed_size[FR_TYPE_MAX + 1];
335extern bool const fr_type_variable_size[FR_TYPE_MAX + 1];
336extern bool const fr_type_quoted[FR_TYPE_MAX + 1];
337
338extern bool const fr_type_structural_except_vsa[FR_TYPE_MAX + 1];
339extern bool const fr_type_structural[FR_TYPE_MAX + 1];
340extern bool const fr_type_leaf[FR_TYPE_MAX + 1];
341extern bool const fr_type_non_leaf[FR_TYPE_MAX + 1];
342/** @} */
343
344/** @name Type checking macros
345 *
346 * @{
347 */
348#define fr_type_is_null(_x) ((_x) == FR_TYPE_NULL)
349#define fr_type_is_string(_x) ((_x) == FR_TYPE_STRING)
350#define fr_type_is_octets(_x) ((_x) == FR_TYPE_OCTETS)
351#define fr_type_is_ipv4addr(_x) ((_x) == FR_TYPE_IPV4_ADDR)
352#define fr_type_is_ipv4prefix(_x) ((_x) == FR_TYPE_IPV4_PREFIX)
353#define fr_type_is_ipv6addr(_x) ((_x) == FR_TYPE_IPV6_ADDR)
354#define fr_type_is_ipv6prefix(_x) ((_x) == FR_TYPE_IPV6_PREFIX)
355#define fr_type_is_ifid(_x) ((_x) == FR_TYPE_IFID)
356#define fr_type_is_combo_ipaddr(_x) ((_x) == FR_TYPE_COMBO_IP_ADDR)
357#define fr_type_is_combo_ipprefix(_x) ((_x) == FR_TYPE_COMBO_IP_PREFIX)
358#define fr_type_is_ethernet(_x) ((_x) == FR_TYPE_ETHERNET)
359#define fr_type_is_bool(_x) ((_x) == FR_TYPE_BOOL)
360#define fr_type_is_uint8(_x) ((_x) == FR_TYPE_UINT8)
361#define fr_type_is_uint16(_x) ((_x) == FR_TYPE_UINT16)
362#define fr_type_is_uint32(_x) ((_x) == FR_TYPE_UINT32)
363#define fr_type_is_uint64(_x) ((_x) == FR_TYPE_UINT64)
364#define fr_type_is_int8(_x) ((_x) == FR_TYPE_INT8)
365#define fr_type_is_int16(_x) ((_x) == FR_TYPE_INT16)
366#define fr_type_is_int32(_x) ((_x) == FR_TYPE_INT32)
367#define fr_type_is_int64(_x) ((_x) == FR_TYPE_INT64)
368#define fr_type_is_float32(_x) ((_x) == FR_TYPE_FLOAT32)
369#define fr_type_is_float64(_x) ((_x) == FR_TYPE_FLOAT64)
370#define fr_type_is_date(_x) ((_x) == FR_TYPE_DATE)
371#define fr_type_is_time_delta(_x) ((_x) == FR_TYPE_TIME_DELTA)
372#define fr_type_is_size(_x) ((_x) == FR_TYPE_SIZE)
373#define fr_type_is_tlv(_x) ((_x) == FR_TYPE_TLV)
374#define fr_type_is_struct(_x) ((_x) == FR_TYPE_STRUCT)
375#define fr_type_is_vsa(_x) ((_x) == FR_TYPE_VSA)
376#define fr_type_is_vendor(_x) ((_x) == FR_TYPE_VENDOR)
377#define fr_type_is_group(_x) ((_x) == FR_TYPE_GROUP)
378#define fr_type_is_value_box(_x) ((_x) == FR_TYPE_VALUE_BOX)
379#define fr_type_is_void(_x) ((_x) == FR_TYPE_VOID)
380
381#define fr_type_is_integer_except_bool(_x) (fr_type_integer_except_bool[_x])
382#define fr_type_is_integer(_x) (fr_type_integer[_x])
383#define fr_type_is_numeric(_x) (fr_type_numeric[_x])
384#define fr_type_is_signed(_x) (fr_type_signed[_x])
385
386#define fr_type_is_ip(_x) (fr_type_ip[_x])
387
388#define fr_type_is_fixed_size(_x) (fr_type_fixed_size[_x])
389#define fr_type_is_variable_size(_x) (fr_type_variable_size[_x])
390#define fr_type_is_quoted(_x) (fr_type_quoted[_x])
391
392#define fr_type_is_structural_except_vsa(_x) (fr_type_structural_except_vsa[_x])
393#define fr_type_is_structural(_x) (fr_type_structural[_x])
394#define fr_type_is_leaf(_x) (fr_type_leaf[_x])
395#define fr_type_is_non_leaf(_x) (fr_type_non_leaf[_x])
396/** @} */
397
398/** Given a variable, return the equivalent FR_TYPE_* value
399 *
400 * @note Does not work for:
401 * - size_t / FR_TYPE_SIZE - Conflicts with other integers on many systems.
402 * - fr_ipaddr_t - Too many potential type mappings.
403 * - tmpl_t - Not an FR_TYPE_*.
404 *
405 * @param[in] _ct variable to translate.
406 */
407# define FR_CTYPE_TO_TYPE(_ct) \
408_Generic(&(_ct), \
409 fr_ethernet_t * : FR_TYPE_ETHERNET, \
410 fr_ethernet_t ** : FR_TYPE_ETHERNET, \
411 fr_ifid_t * : FR_TYPE_IFID, \
412 fr_ifid_t ** : FR_TYPE_IFID, \
413 fr_time_t * : FR_TYPE_DATE, \
414 fr_time_t ** : FR_TYPE_DATE, \
415 fr_time_delta_t * : FR_TYPE_TIME_DELTA, \
416 fr_time_delta_t ** : FR_TYPE_TIME_DELTA, \
417 char const ** : FR_TYPE_STRING, \
418 char const *** : FR_TYPE_STRING, \
419 bool * : FR_TYPE_BOOL, \
420 bool ** : FR_TYPE_BOOL, \
421 uint8_t const ** : FR_TYPE_OCTETS, \
422 uint8_t const *** : FR_TYPE_OCTETS, \
423 uint8_t * : FR_TYPE_UINT8, \
424 uint8_t ** : FR_TYPE_UINT8, \
425 uint16_t * : FR_TYPE_UINT16, \
426 uint16_t ** : FR_TYPE_UINT16, \
427 uint32_t * : FR_TYPE_UINT32, \
428 uint32_t ** : FR_TYPE_UINT32, \
429 uint64_t * : FR_TYPE_UINT64, \
430 uint64_t ** : FR_TYPE_UINT64, \
431 int8_t * : FR_TYPE_INT8, \
432 int8_t ** : FR_TYPE_INT8, \
433 int16_t * : FR_TYPE_INT16, \
434 int16_t ** : FR_TYPE_INT16, \
435 int32_t * : FR_TYPE_INT32, \
436 int32_t ** : FR_TYPE_INT32, \
437 int64_t * : FR_TYPE_INT64, \
438 int64_t ** : FR_TYPE_INT64, \
439 float * : FR_TYPE_FLOAT32, \
440 float ** : FR_TYPE_FLOAT32, \
441 double * : FR_TYPE_FLOAT64, \
442 double ** : FR_TYPE_FLOAT64, \
443 default : FR_TYPE_VOID )
444
446extern size_t fr_type_table_len;
447
448/** Return a static string containing the type name
449 *
450 * @param[in] type to return name for.
451 * @return name of the type
452 *
453 * @hidecallergraph
454 */
455static inline char const *fr_type_to_str(fr_type_t type)
456{
457 return fr_table_str_by_value(fr_type_table, type, "<INVALID>");
458}
459
460/** Return the constant value representing a type
461 *
462 * @param[in] type to return the constant value for.
463 * @return The constant type value or FR_TYPE_NULL if no type matches.
464 */
465static inline fr_type_t fr_type_from_str(char const *type)
466{
468}
469
470bool fr_type_cast(fr_type_t dst, fr_type_t src);
472
473void **fr_type_array_alloc(TALLOC_CTX *ctx, fr_type_t type, size_t count);
474
475#ifdef __cplusplus
476}
477#endif
#define RCSIDH(h, id)
Definition build.h:486
fr_type_t
return count
Definition module.c:155
fr_aka_sim_id_type_t type
#define fr_table_value_by_str(_table, _name, _def)
Convert a string to a value using a sorted or ordered table.
Definition table.h:653
#define fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
Definition table.h:772
An element in an arbitrarily ordered array of name to num mappings.
Definition table.h:57
fr_table_num_ordered_t const fr_type_table[]
Map data types to names representing those types.
Definition types.c:31
bool const fr_type_structural_except_vsa[FR_TYPE_MAX+1]
Definition types.c:193
fr_type_t
Internal data types.
Definition types.h:37
@ FR_TYPE_TIME_DELTA
A period of time measured in nanoseconds.
Definition types.h:70
@ FR_TYPE_FLOAT32
Single precision floating point.
Definition types.h:65
@ FR_TYPE_VALUE_BOX_CURSOR
cursor over a fr_value_box_t
Definition types.h:89
@ FR_TYPE_IPV4_ADDR
32 Bit IPv4 Address.
Definition types.h:43
@ FR_TYPE_INT8
8 Bit signed integer.
Definition types.h:60
@ FR_TYPE_TLV
Contains nested attributes.
Definition types.h:75
@ FR_TYPE_ETHERNET
48 Bit Mac-Address.
Definition types.h:50
@ FR_TYPE_IPV6_PREFIX
IPv6 Prefix.
Definition types.h:46
@ FR_TYPE_STRING
String of printable characters.
Definition types.h:40
@ FR_TYPE_MAX
Number of defined data types.
Definition types.h:93
@ FR_TYPE_NULL
Invalid (uninitialised) attribute type.
Definition types.h:38
@ 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_UNION
A union of limited children.
Definition types.h:82
@ FR_TYPE_COMBO_IP_PREFIX
IPv4 or IPv6 address prefix depending on length.
Definition types.h:49
@ FR_TYPE_VALUE_BOX
A boxed value.
Definition types.h:83
@ FR_TYPE_UINT8
8 Bit unsigned integer.
Definition types.h:54
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition types.h:56
@ FR_TYPE_STRUCT
like TLV, but without T or L, and fixed-width children
Definition types.h:76
@ FR_TYPE_ATTR
A contains an attribute reference.
Definition types.h:84
@ FR_TYPE_INT32
32 Bit signed integer.
Definition types.h:62
@ FR_TYPE_VENDOR
Attribute that represents a vendor in the attribute tree.
Definition types.h:79
@ FR_TYPE_UINT64
64 Bit unsigned integer.
Definition types.h:57
@ FR_TYPE_IPV6_ADDR
128 Bit IPv6 Address.
Definition types.h:45
@ FR_TYPE_IPV4_PREFIX
IPv4 Prefix.
Definition types.h:44
@ FR_TYPE_VOID
User data.
Definition types.h:86
@ FR_TYPE_BOOL
A truth value.
Definition types.h:52
@ FR_TYPE_SIZE
Unsigned integer capable of representing any memory address on the local system.
Definition types.h:72
@ FR_TYPE_VSA
Vendor-Specific, for RADIUS attribute 26.
Definition types.h:78
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
Definition types.h:48
@ FR_TYPE_IFID
Interface ID.
Definition types.h:47
@ FR_TYPE_PAIR_CURSOR
cursor over a fr_pair_t
Definition types.h:91
@ FR_TYPE_OCTETS
Raw octets.
Definition types.h:41
@ FR_TYPE_GROUP
A grouping of other attributes.
Definition types.h:81
@ FR_TYPE_FLOAT64
Double precision floating point.
Definition types.h:66
bool const fr_type_non_leaf[FR_TYPE_MAX+1]
Definition types.c:196
bool fr_type_cast(fr_type_t dst, fr_type_t src)
Return if we're allowed to cast the types.
Definition types.c:294
bool const fr_type_signed[FR_TYPE_MAX+1]
Definition types.c:185
bool const fr_type_integer[FR_TYPE_MAX+1]
Definition types.c:183
bool const fr_type_variable_size[FR_TYPE_MAX+1]
Definition types.c:190
bool const fr_type_numeric[FR_TYPE_MAX+1]
Definition types.c:184
bool const fr_type_ip[FR_TYPE_MAX+1]
Definition types.c:187
bool const fr_type_fixed_size[FR_TYPE_MAX+1]
Definition types.c:189
bool const fr_type_integer_except_bool[FR_TYPE_MAX+1]
Definition types.c:182
bool const fr_type_quoted[FR_TYPE_MAX+1]
Definition types.c:191
void ** fr_type_array_alloc(TALLOC_CTX *ctx, fr_type_t type, size_t count)
Allocate an array of a given type.
Definition types.c:642
bool const fr_type_leaf[FR_TYPE_MAX+1]
Definition types.c:195
size_t fr_type_table_len
Definition types.c:87
fr_type_t fr_type_promote(fr_type_t a, fr_type_t b)
Return the promoted type.
Definition types.c:583
static char const * fr_type_to_str(fr_type_t type)
Return a static string containing the type name.
Definition types.h:455
bool const fr_type_structural[FR_TYPE_MAX+1]
Definition types.c:194
static fr_type_t fr_type_from_str(char const *type)
Return the constant value representing a type.
Definition types.h:465