The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
dict_test.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/** Functions to create test dictionaries for unit tests
19 *
20 * @file src/lib/util/dict_test.h
21 *
22 * @copyright 2021 The FreeRADIUS server project
23 */
24RCSIDH(dict_test_h, "$Id: 3e8911bac7012b243446b00d5eacabddaa3ab110 $")
25
26#include <freeradius-devel/util/dict.h>
27#include <freeradius-devel/util/value.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/** Test attribute numbers
34 */
89
90/** Test enumeration values
91 */
92typedef struct value {
93 char const *key; //!< Enumeration name.
94 fr_value_box_t *val; //!< Enumeration value
96
97/** Test enumeration attributes
98 */
99typedef struct {
100 fr_dict_test_attr_number_t attr; //!< Attribute number to create.
101 fr_dict_attr_t const **parent; //!< The parent of this attribute.
102 fr_dict_attr_t const **da; //!< Where to write a pointer to this attribute.
103 char const *name; //!< What to call this attribute.
104 fr_type_t type; //!< What type the attribute.
105 fr_dict_test_attr_value_t *values; //!< Array of enumeration values to add to this attribute.
107
108extern fr_dict_t *fr_dict_test;
111
114
117
123
128
133
136
138
140
142
145
148
152
154
159
161
163
164int fr_dict_test_attrs_init(fr_dict_t *dict, fr_dict_test_attr_t const *test_defs,
165 unsigned int base, int inst);
166
167int fr_dict_test_init(TALLOC_CTX *ctx, fr_dict_t **dict_p, fr_dict_test_attr_t const *test_defs);
168
169#ifdef __cplusplus
170}
171#endif
#define RCSIDH(h, id)
Definition build.h:484
fr_dict_attr_t const * fr_dict_attr_test_struct
Definition dict_test.c:67
fr_dict_attr_t const * fr_dict_attr_test_ethernet
Definition dict_test.c:42
fr_dict_attr_t const * fr_dict_attr_test_ipv6_addr
Definition dict_test.c:36
fr_dict_attr_t const * fr_dict_attr_test_tlv_string
Definition dict_test.c:65
fr_dict_test_attr_t const fr_dict_test_attrs[]
Definition dict_test.c:86
fr_dict_attr_t const * fr_dict_attr_test_nested_leaf_string
Definition dict_test.c:78
fr_value_box_t * val
Enumeration value.
Definition dict_test.h:94
fr_dict_attr_t const * fr_dict_attr_test_enum
Definition dict_test.c:81
fr_dict_attr_t const * fr_dict_attr_test_time_delta
Definition dict_test.c:60
fr_dict_test_attr_number_t
Test attribute numbers.
Definition dict_test.h:35
@ FR_TEST_ATTR_INT16
Definition dict_test.h:58
@ FR_TEST_ATTR_IPV4_PREFIX
Definition dict_test.h:41
@ FR_TEST_ATTR_IFID
Definition dict_test.h:44
@ FR_TEST_ATTR_TLV_STRING
Definition dict_test.h:72
@ FR_TEST_ATTR_TLV
Definition dict_test.h:71
@ FR_TEST_ATTR_COMBO_IP_ADDR
Definition dict_test.h:45
@ FR_TEST_ATTR_ETHERNET
Definition dict_test.h:47
@ FR_TEST_ATTR_IPV6_PREFIX
Definition dict_test.h:43
@ FR_TEST_ATTR_UINT8
Definition dict_test.h:51
@ FR_TEST_ATTR_NESTED_LEAF_INT32
Definition dict_test.h:85
@ FR_TEST_ATTR_INT64
Definition dict_test.h:60
@ FR_TEST_ATTR_BOOL
Definition dict_test.h:49
@ FR_TEST_ATTR_VSA
Definition dict_test.h:76
@ FR_TEST_ATTR_STRING
Definition dict_test.h:37
@ FR_TEST_ATTR_VENDOR
Definition dict_test.h:77
@ FR_TEST_ATTR_FLOAT64
Definition dict_test.h:63
@ FR_TEST_ATTR_STRUCT
Definition dict_test.h:74
@ FR_TEST_ATTR_VENDOR_STRING
Definition dict_test.h:78
@ FR_TEST_ATTR_COMBO_IP_PREFIX
Definition dict_test.h:46
@ FR_TEST_ATTR_IPV6_ADDR
Definition dict_test.h:42
@ FR_TEST_ATTR_NESTED_CHILD_TLV
Definition dict_test.h:83
@ FR_TEST_ATTR_INT32
Definition dict_test.h:59
@ FR_TEST_ATTR_DATE
Definition dict_test.h:65
@ FR_TEST_ATTR_NESTED_LEAF_STRING
Definition dict_test.h:84
@ FR_TEST_ATTR_UINT32
Definition dict_test.h:53
@ FR_TEST_ATTR_TIME_DELTA
Definition dict_test.h:67
@ FR_TEST_ATTR_UINT16
Definition dict_test.h:52
@ FR_TEST_ATTR_OCTETS
Definition dict_test.h:38
@ FR_TEST_ATTR_ENUM
Definition dict_test.h:87
@ FR_TEST_ATTR_UINT64
Definition dict_test.h:54
@ FR_TEST_ATTR_INVALID
Definition dict_test.h:36
@ FR_TEST_ATTR_FLOAT32
Definition dict_test.h:62
@ FR_TEST_ATTR_INT8
Definition dict_test.h:57
@ FR_TEST_ATTR_IPV4_ADDR
Definition dict_test.h:40
@ FR_TEST_ATTR_NESTED_TOP_TLV
Definition dict_test.h:82
@ FR_TEST_ATTR_SIZE
Definition dict_test.h:69
@ FR_TEST_ATTR_GROUP
Definition dict_test.h:80
fr_dict_t * fr_dict_test
Definition dict_test.c:28
fr_dict_test_attr_number_t attr
Attribute number to create.
Definition dict_test.h:100
fr_dict_attr_t const * fr_dict_attr_test_date
Definition dict_test.c:58
fr_dict_attr_t const * fr_dict_attr_test_combo_ip_prefix
Definition dict_test.c:41
fr_dict_attr_t const * fr_dict_attr_test_vendor
Definition dict_test.c:71
fr_dict_attr_t const ** parent
The parent of this attribute.
Definition dict_test.h:101
fr_dict_attr_t const * fr_dict_attr_test_int32
Definition dict_test.c:52
fr_dict_attr_t const * fr_dict_attr_test_tlv
Definition dict_test.c:64
fr_dict_test_attr_value_t * values
Array of enumeration values to add to this attribute.
Definition dict_test.h:105
fr_dict_attr_t const * fr_dict_attr_test_uint64
Definition dict_test.c:48
fr_dict_attr_t const * fr_dict_attr_test_int16
Definition dict_test.c:51
fr_dict_attr_t const * fr_dict_attr_test_ifid
Definition dict_test.c:39
fr_dict_attr_t const * fr_dict_attr_test_nested_top_tlv
Definition dict_test.c:76
fr_dict_attr_t const * fr_dict_attr_test_uint32
Definition dict_test.c:47
fr_dict_attr_t const * fr_dict_attr_test_vendor_string
Definition dict_test.c:72
fr_dict_attr_t const * fr_dict_attr_test_int8
Definition dict_test.c:50
fr_dict_attr_t const * fr_dict_attr_test_ipv6_prefix
Definition dict_test.c:37
fr_dict_attr_t const * fr_dict_attr_test_octets
Definition dict_test.c:31
fr_dict_attr_t const * fr_dict_attr_test_ipv4_prefix
Definition dict_test.c:34
int fr_dict_test_attrs_init(fr_dict_t *dict, fr_dict_test_attr_t const *test_defs, unsigned int base, int inst)
Add our test attributes to our test dictionary.
Definition dict_test.c:176
fr_dict_attr_t const * fr_dict_attr_test_string
Definition dict_test.c:30
fr_dict_attr_t const * fr_dict_attr_test_ipv4_addr
Definition dict_test.c:33
fr_dict_attr_t const * fr_dict_attr_test_nested_child_tlv
Definition dict_test.c:77
int fr_dict_test_init(TALLOC_CTX *ctx, fr_dict_t **dict_p, fr_dict_test_attr_t const *test_defs)
Initialise a test dictionary and add our test_defs to it.
Definition dict_test.c:248
char const * key
Enumeration name.
Definition dict_test.h:93
fr_dict_attr_t const * fr_dict_attr_test_uint8
Definition dict_test.c:45
fr_dict_attr_t const * fr_dict_attr_test_float32
Definition dict_test.c:55
fr_dict_attr_t const * fr_dict_attr_test_group
Definition dict_test.c:74
fr_dict_attr_t const * fr_dict_attr_test_nested_leaf_int32
Definition dict_test.c:79
fr_type_t type
What type the attribute.
Definition dict_test.h:104
fr_dict_attr_t const * fr_dict_attr_test_struct_uint32
Definition dict_test.c:68
fr_dict_attr_t const * fr_dict_attr_test_uint16
Definition dict_test.c:46
fr_dict_attr_t const * fr_dict_attr_test_int64
Definition dict_test.c:53
struct value fr_dict_test_attr_value_t
Test enumeration values.
fr_dict_attr_t const ** da
Where to write a pointer to this attribute.
Definition dict_test.h:102
fr_dict_attr_t const * fr_dict_attr_test_combo_ip_addr
Definition dict_test.c:40
fr_dict_attr_t const * fr_dict_attr_test_bool
Definition dict_test.c:43
char const * name
What to call this attribute.
Definition dict_test.h:103
fr_dict_attr_t const * fr_dict_attr_test_float64
Definition dict_test.c:56
fr_dict_attr_t const * fr_dict_attr_test_vsa
Definition dict_test.c:70
fr_dict_attr_t const * fr_dict_attr_test_size
Definition dict_test.c:62
Test enumeration attributes.
Definition dict_test.h:99
Test enumeration values.
Definition dict_test.h:92
fr_type_t
eap_aka_sim_process_conf_t * inst