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