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