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