The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
dict_fixup_priv.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 finalise and fixup dictionaries
19  *
20  * @file src/lib/util/dict_fixup_priv.h
21  *
22  * @copyright 2020 The FreeRADIUS server project
23  * @copyright 2020,2024 Arran Cudbard-Bell <a.cudbardb@freeradius.org>
24  */
25 RCSIDH(dict_fixup_priv_h, "$Id: 7fa9ab1e0715d56ae523a64a7c61d9e4c7ef8a1e $")
26 
27 #include <freeradius-devel/util/dict_priv.h>
28 #include <freeradius-devel/util/dlist.h>
29 #include <freeradius-devel/util/talloc.h>
30 #include <freeradius-devel/util/value.h>
31 
32 typedef struct {
33  TALLOC_CTX *pool; //!< Temporary pool for fixups, reduces holes
34 
35  fr_dlist_head_t enumv; //!< Raw enumeration values to add.
36  fr_dlist_head_t group; //!< Group references to resolve.
37  fr_dlist_head_t clone; //!< Clone operation to apply.
38  fr_dlist_head_t clone_enum; //!< Clone enum operation to apply.
39  fr_dlist_head_t vsa; //!< VSAs to add vendors for
40  fr_dlist_head_t alias; //!< Aliases that can't be resolved immediately.
42 
43 fr_dict_attr_t const *dict_protocol_reference(fr_dict_attr_t const *root, char const *ref);
44 
45 int dict_fixup_enumv_enqueue(dict_fixup_ctx_t *fctx, char const *filename, int line,
46  char const *attr, size_t attr_len,
47  char const *name, size_t name_len,
48  char const *value, size_t value_len,
49  fr_dict_attr_t const *parent);
50 
51 int dict_fixup_group_enqueue(dict_fixup_ctx_t *fctx, fr_dict_attr_t *da, char const *ref);
52 
53 int dict_fixup_clone_enqueue(dict_fixup_ctx_t *fctx, fr_dict_attr_t *da, char const *ref);
54 
55 int dict_fixup_clone(fr_dict_attr_t **dst_p, fr_dict_attr_t const *src);
56 
57 int dict_fixup_clone_enum_enqueue(dict_fixup_ctx_t *fctx, fr_dict_attr_t *da, char const *ref);
58 
60 
61 int dict_fixup_alias_enqueue(dict_fixup_ctx_t *fctx, char const *filename, int line,
62  fr_dict_attr_t *alias_parent, char const *alias,
63  fr_dict_attr_t *ref_parent, char const *ref);
64 
65 int dict_fixup_init(TALLOC_CTX *ctx, dict_fixup_ctx_t *fctx);
66 
68 
int const char int line
Definition: acutest.h:702
static fr_dict_t * dict
Definition: fuzzer.c:46
#define RCSIDH(h, id)
Definition: build.h:482
int dict_fixup_apply(dict_fixup_ctx_t *fctx)
Apply all outstanding fixes to a set of dictionaries.
Definition: dict_fixup.c:824
fr_dlist_head_t clone_enum
Clone enum operation to apply.
int dict_fixup_enumv_enqueue(dict_fixup_ctx_t *fctx, char const *filename, int line, char const *attr, size_t attr_len, char const *name, size_t name_len, char const *value, size_t value_len, fr_dict_attr_t const *parent)
Add an enumeration value to an attribute which has not yet been defined.
Definition: dict_fixup.c:235
int dict_fixup_alias_enqueue(dict_fixup_ctx_t *fctx, char const *filename, int line, fr_dict_attr_t *alias_parent, char const *alias, fr_dict_attr_t *ref_parent, char const *ref)
Resolve a group reference.
Definition: dict_fixup.c:754
fr_dlist_head_t alias
Aliases that can't be resolved immediately.
fr_dlist_head_t group
Group references to resolve.
int dict_fixup_clone_enqueue(dict_fixup_ctx_t *fctx, fr_dict_attr_t *da, char const *ref)
Clone one area of a tree into another.
Definition: dict_fixup.c:383
int dict_fixup_init(TALLOC_CTX *ctx, dict_fixup_ctx_t *fctx)
Initialise a fixup ctx.
Definition: dict_fixup.c:805
int dict_fixup_clone_enum_enqueue(dict_fixup_ctx_t *fctx, fr_dict_attr_t *da, char const *ref)
Clone enumeration values from one attribute to another.
Definition: dict_fixup.c:592
fr_dlist_head_t clone
Clone operation to apply.
fr_dict_attr_t const * dict_protocol_reference(fr_dict_attr_t const *root, char const *ref)
Resolve a ref= or copy= value to a dictionary.
Definition: dict_fixup.c:130
fr_dlist_head_t vsa
VSAs to add vendors for.
int dict_fixup_vsa_enqueue(dict_fixup_ctx_t *fctx, fr_dict_attr_t *da)
Push a fixup for a VSA.
Definition: dict_fixup.c:694
int dict_fixup_clone(fr_dict_attr_t **dst_p, fr_dict_attr_t const *src)
Clone a dictionary attribute from a ref.
Definition: dict_fixup.c:416
int dict_fixup_group_enqueue(dict_fixup_ctx_t *fctx, fr_dict_attr_t *da, char const *ref)
Resolve a group reference.
Definition: dict_fixup.c:319
fr_dlist_head_t enumv
Raw enumeration values to add.
TALLOC_CTX * pool
Temporary pool for fixups, reduces holes.
void dict_hash_tables_finalise(fr_dict_t *dict)
Walk a dictionary finalising the hash tables in all attributes with a distinct namespace.
Definition: dict_fixup.c:891
Test enumeration values.
Definition: dict_test.h:92
Head of a doubly linked list.
Definition: dlist.h:51
static char const * name
static fr_slen_t parent
Definition: pair.h:851