The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
dict_priv.h File Reference

Private Multi-protocol AVP dictionary API. More...

#include <freeradius-devel/protocol/base.h>
#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/util/dict_ext_priv.h>
#include <freeradius-devel/util/dl.h>
#include <freeradius-devel/util/hash.h>
#include <freeradius-devel/util/value.h>
+ Include dependency graph for dict_priv.h:

Go to the source code of this file.

Data Structures

struct  dict_attr_args_t
 Optional arguments for initialising/allocating attributes. More...
 
struct  fr_dict_dependent_t
 Entry recording dictionary reference holders by file. More...
 
struct  fr_dict_filename_t
 Entry in the filename list of files associated with this dictionary. More...
 
struct  fr_dict_gctx_s
 
struct  fr_dict_s
 Vendors and attribute names. More...
 

Macros

#define _DICT_PRIVATE   1
 
#define DICT_FIXUP_POOL_SIZE   (1024)
 
#define DICT_POOL_SIZE   (1024 * 1024 * 2)
 
#define INTERNAL_IF_NULL(_dict, _ret)
 Set the internal dictionary if none was provided.
 

Functions

fr_dict_tdict_alloc (TALLOC_CTX *ctx)
 Allocate a new dictionary.
 
fr_dict_attr_tdict_attr_acopy (TALLOC_CTX *ctx, fr_dict_attr_t const *in, char const *new_name)
 Copy a an existing attribute.
 
int dict_attr_acopy_children (fr_dict_t *dict, fr_dict_attr_t *dst, fr_dict_attr_t const *src)
 Copy the children of an existing attribute.
 
int dict_attr_acopy_enumv (fr_dict_attr_t *dst, fr_dict_attr_t const *src)
 Copy the VALUEs of an existing attribute, by casting them.
 
int dict_attr_add_to_namespace (fr_dict_attr_t const *parent, fr_dict_attr_t *da)
 Add an attribute to the name table for an attribute.
 
int dict_attr_alias_add (fr_dict_attr_t const *parent, char const *alias, fr_dict_attr_t const *ref)
 Add an alias to an existing attribute.
 
fr_dict_attr_tdict_attr_by_name (fr_dict_attr_err_t *err, fr_dict_attr_t const *parent, char const *name)
 
bool dict_attr_can_have_children (fr_dict_attr_t const *da)
 See if a fr_dict_attr_t can have children.
 
int dict_attr_child_add (fr_dict_attr_t *parent, fr_dict_attr_t *child)
 Add a child to a parent.
 
fr_dict_attr_tdict_attr_child_by_num (fr_dict_attr_t const *parent, unsigned int attr)
 Internal version of fr_dict_attr_child_by_num.
 
int dict_attr_enum_add_name (fr_dict_attr_t *da, char const *name, fr_value_box_t const *value, bool coerce, bool replace, fr_dict_attr_t const *child_struct)
 
bool dict_attr_flags_valid (fr_dict_attr_t *da))
 Validate a set of flags.
 
bool dict_attr_valid (fr_dict_attr_t *da)
 Validate a new attribute definition.
 
fr_dict_tdict_by_da (fr_dict_attr_t const *da)
 Internal version of fr_dict_by_da.
 
fr_dict_tdict_by_protocol_name (char const *name)
 Internal version of fr_dict_by_protocol_name.
 
fr_dict_tdict_by_protocol_num (unsigned int num)
 Internal version of fr_dict_by_protocol_num.
 
fr_slen_t dict_by_protocol_substr (fr_dict_attr_err_t *err, fr_dict_t **out, fr_sbuff_t *name, fr_dict_t const *dict_def)
 
int dict_dependent_add (fr_dict_t *dict, char const *dependent)
 Record a new dependency on a dictionary.
 
int dict_dependent_remove (fr_dict_t *dict, char const *dependent)
 Decrement ref count for a dependent in a dictionary.
 
int dict_dlopen (fr_dict_t *dict, char const *name)
 
bool dict_has_dependents (fr_dict_t *dict)
 Check if a dictionary still has dependents.
 
int dict_protocol_add (fr_dict_t *dict)
 Add a protocol to the global protocol table.
 
int dict_vendor_add (fr_dict_t *dict, char const *name, unsigned int num)
 Add a vendor to the dictionary.
 

Variables

fr_dict_gctx_tdict_gctx
 Top level structure containing global dictionary state.
 
fr_dict_attr_t_dict_attr_alloc (char const *filename, int line, TALLOC_CTX *ctx, fr_dict_attr_t const *parent, char const *name, int attr, fr_type_t type, dict_attr_args_t const *args))
 Allocate a dictionary attribute on the heap.
 
fr_dict_attr_t_dict_attr_alloc_root (char const *filename, int line, TALLOC_CTX *ctx, fr_dict_t const *dict, char const *name, int attr, dict_attr_args_t const *args))
 Allocate a dictionary root attribute on the heap.
 
int _dict_attr_init (char const *filename, int line, fr_dict_attr_t **da_p, fr_dict_attr_t const *parent, char const *name, unsigned int attr, fr_type_t type, dict_attr_args_t const *args))
 Initialise fields in a dictionary attribute structure.
 
int _dict_attr_init_name_only (char const *filename, int line, fr_dict_attr_t **da_p, fr_dict_attr_t const *parent, char const *name, fr_type_t type, dict_attr_args_t const *args))
 Initialise fields in a dictionary attribute structure.
 
#define dict_attr_alloc(_ctx, _parent, _name, _attr, _type, _args)    _dict_attr_alloc(__FILE__, __LINE__, _ctx, _parent, _name, _attr, _type, (_args))
 
#define dict_attr_alloc_root(_ctx, _dict, _name, _attr, _args)    _dict_attr_alloc_root(__FILE__, __LINE__, _ctx, _dict, _name, _attr, _args)
 
#define dict_attr_init(_da_p, _parent, _name, _attr, _type, _args)    _dict_attr_init(__FILE__, __LINE__, _da_p, _parent, _name, _attr, _type, _args)
 Full initialisation functions.
 
#define dict_attr_init_name_only(_da_p, _parent, _name, _type, _args)    _dict_attr_init_name_only(__FILE__, __LINE__, _da_p, _parent, _name, _type, _args)
 
fr_dict_attr_tdict_attr_alloc_null (TALLOC_CTX *ctx, fr_dict_protocol_t const *dict)
 Partial initialisation functions.
 
int dict_attr_finalise (fr_dict_attr_t **da_p, char const *name)
 Set remaining fields in a dictionary attribute before insertion.
 
void dict_attr_location_init (fr_dict_attr_t *da, char const *filename, int line)
 Set where the dictionary attribute was defined.
 
int dict_attr_num_init (fr_dict_attr_t *da, unsigned int num)
 Set the attribute number (if any)
 
int dict_attr_num_init_name_only (fr_dict_attr_t *da)
 Set the attribute number (if any)
 
int dict_attr_parent_init (fr_dict_attr_t **da_p, fr_dict_attr_t const *parent)
 Initialise fields which depend on a parent attribute.
 
int dict_attr_type_init (fr_dict_attr_t **da_p, fr_type_t type)
 Initialise type specific fields within the dictionary attribute.
 

Detailed Description

Private Multi-protocol AVP dictionary API.

Definition in file dict_priv.h.


Data Structure Documentation

◆ dict_attr_args_t

struct dict_attr_args_t

Optional arguments for initialising/allocating attributes.

Definition at line 171 of file dict_priv.h.

+ Collaboration diagram for dict_attr_args_t:
Data Fields
fr_dict_attr_flags_t const * flags Any flags to assign to the attribute.
fr_dict_attr_t const * ref This attribute is a reference to another attribute.

◆ fr_dict_dependent_t

struct fr_dict_dependent_t

Entry recording dictionary reference holders by file.

Definition at line 58 of file dict_priv.h.

+ Collaboration diagram for fr_dict_dependent_t:
Data Fields
int count How many references are held by this file.

Signed to help figure out when things go wrong...

char const * dependent File holding the reference.
fr_rb_node_t node

◆ fr_dict_filename_t

struct fr_dict_filename_t

Entry in the filename list of files associated with this dictionary.

Mainly used for debugging.

Definition at line 69 of file dict_priv.h.

+ Collaboration diagram for fr_dict_filename_t:
Data Fields
fr_dlist_t entry Entry in the list of filenames.
char * filename Name of the file the dictionary was loaded on.

◆ fr_dict_gctx_s

struct fr_dict_gctx_s

Definition at line 125 of file dict_priv.h.

+ Collaboration diagram for fr_dict_gctx_s:
Data Fields
fr_dict_attr_t const * attr_protocol_encapsulation
char * dict_dir_default The default location for loading dictionaries if one wasn't provided.
dl_loader_t * dict_loader for protocol validation
bool free_at_exit This gctx will be freed on exit.
fr_dict_t * internal Magic internal dictionary.

Internal dictionary is checked in addition to the protocol dictionary when resolving attribute names.

This is because internal attributes are valid for every protocol.

bool perm_check Whether we should check dictionary file permissions as they're loaded.
fr_hash_table_t * protocol_by_name Hash containing names of all the registered protocols.
fr_hash_table_t * protocol_by_num Hash containing numbers of all the registered protocols.
bool read_only

◆ fr_dict_s

struct fr_dict_s

Vendors and attribute names.

It's very likely that the same vendors will operate in multiple protocol spaces, but number their attributes differently, so we need per protocol dictionaries.

There would also be conflicts for DHCP(v6)/RADIUS attributes etc...

Definition at line 83 of file dict_priv.h.

+ Collaboration diagram for fr_dict_s:
Data Fields
fr_hash_table_t * autoref other dictionaries that we loaded via references
fr_rb_tree_t * dependents Which files are using this dictionary.
dl_t * dl for validation
fr_dlist_head_t filenames Files that this dictionary was loaded from.
fr_dict_attr_t ** fixups Attributes that need fixing up.
fr_dict_gctx_t * gctx Global dictionary context this dictionary was allocated in.
bool in_protocol_by_name Whether the dictionary has been inserted into the protocol_by_name hash.
bool in_protocol_by_num Whether the dictionary has been inserted into the protocol_by_num table.
bool loaded from fr_dict_protocol_afrom_file();
bool loading from fr_dict_protocol_afrom_file();
fr_dict_t const * next for attribute overloading
TALLOC_CTX * pool Talloc memory pool to reduce allocs.

in the dictionary.

fr_dict_protocol_t const * proto protocol-specific validation functions
bool read_only If true, disallow modifications.
fr_dict_attr_t * root Root attribute of this dictionary.
bool string_based TACACS, etc.
fr_hash_table_t * vendors_by_name Lookup vendor by name.
fr_hash_table_t * vendors_by_num Lookup vendor by PEN.
unsigned int vsa_parent varies with different protocols.

Macro Definition Documentation

◆ _DICT_PRIVATE

#define _DICT_PRIVATE   1

Definition at line 28 of file dict_priv.h.

◆ dict_attr_alloc

#define dict_attr_alloc (   _ctx,
  _parent,
  _name,
  _attr,
  _type,
  _args 
)     _dict_attr_alloc(__FILE__, __LINE__, _ctx, _parent, _name, _attr, _type, (_args))

Definition at line 235 of file dict_priv.h.

◆ dict_attr_alloc_root

#define dict_attr_alloc_root (   _ctx,
  _dict,
  _name,
  _attr,
  _args 
)     _dict_attr_alloc_root(__FILE__, __LINE__, _ctx, _dict, _name, _attr, _args)

Definition at line 227 of file dict_priv.h.

◆ dict_attr_init

#define dict_attr_init (   _da_p,
  _parent,
  _name,
  _attr,
  _type,
  _args 
)     _dict_attr_init(__FILE__, __LINE__, _da_p, _parent, _name, _attr, _type, _args)

Full initialisation functions.

These functions either initialise, or allocate and then initialise a complete dictionary attribute.

The output of these functions can be added into a dictionary immediately

Definition at line 211 of file dict_priv.h.

◆ dict_attr_init_name_only

#define dict_attr_init_name_only (   _da_p,
  _parent,
  _name,
  _type,
  _args 
)     _dict_attr_init_name_only(__FILE__, __LINE__, _da_p, _parent, _name, _type, _args)

Definition at line 219 of file dict_priv.h.

◆ DICT_FIXUP_POOL_SIZE

#define DICT_FIXUP_POOL_SIZE   (1024)

Definition at line 38 of file dict_priv.h.

◆ DICT_POOL_SIZE

#define DICT_POOL_SIZE   (1024 * 1024 * 2)

Definition at line 37 of file dict_priv.h.

◆ INTERNAL_IF_NULL

#define INTERNAL_IF_NULL (   _dict,
  _ret 
)
Value:
do { \
if (!(_dict)) { \
_dict = dict_gctx ? dict_gctx->internal : NULL; \
if (unlikely(!(_dict))) { \
fr_strerror_const("No dictionaries available for attribute resolution"); \
return (_ret); \
} \
} \
} while (0)
#define unlikely(_x)
Definition build.h:381
fr_dict_t * internal
Magic internal dictionary.
Definition dict_priv.h:151
fr_dict_gctx_t * dict_gctx
Top level structure containing global dictionary state.
Definition dict_util.c:46

Set the internal dictionary if none was provided.

Parameters
_dictDict pointer to check/set.
_retValue to return if no dictionaries are available.

Definition at line 45 of file dict_priv.h.

Function Documentation

◆ _dict_attr_alloc()

fr_dict_attr_t * _dict_attr_alloc ( char const *  filename,
int  line,
TALLOC_CTX *  ctx,
fr_dict_attr_t const *  parent,
char const *  name,
int  attr,
fr_type_t  type,
dict_attr_args_t const *  args 
)

Allocate a dictionary attribute on the heap.

Parameters
[in]ctxto allocate the attribute in.
[in]parentof the attribute.
[in]nameof the attribute. If NULL an OID string will be created and set as the name.
[in]attrnumber.
[in]typeof the attribute.
[in]argsoptional initialisation arguments.
Returns

Definition at line 988 of file dict_util.c.

+ Here is the call graph for this function:

◆ _dict_attr_alloc_root()

fr_dict_attr_t * _dict_attr_alloc_root ( char const *  filename,
int  line,
TALLOC_CTX *  ctx,
fr_dict_t const *  dict,
char const *  name,
int  proto_number,
dict_attr_args_t const *  args 
)

Allocate a dictionary root attribute on the heap.

Parameters
[in]ctxto allocate the attribute in.
[in]dictthe attribute will be used in.
[in]nameof the attribute. If NULL an OID string will be created and set as the name.
[in]proto_numbernumber. This should be
[in]argsoptional initialisation arguments.
Returns

Definition at line 956 of file dict_util.c.

+ Here is the call graph for this function:

◆ _dict_attr_init()

int _dict_attr_init ( char const *  filename,
int  line,
fr_dict_attr_t **  da_p,
fr_dict_attr_t const *  parent,
char const *  name,
unsigned int  attr,
fr_type_t  type,
dict_attr_args_t const *  args 
)

Initialise fields in a dictionary attribute structure.

This function is a wrapper around the other initialisation functions.

The reason for the separation, is that sometimes we're initialising a dictionary attribute by parsing an actual dictionary file, and other times we're copying attribute, or initialising them programatically.

This function should only be used for the second case, where we have a complet attribute definition already.

Note
This function can only be used before the attribute is inserted into the dictionary.
Parameters
[in]filenamefile.
[in]linenumber.
[in]da_pto initialise.
[in]parentof the attribute, if none, this attribute will be initialised as a dictionary root.
[in]nameof attribute. Pass NULL for auto-generated name.
[in]attrnumber.
[in]typeof the attribute.
[in]argsoptional initialisation arguments.
Returns
  • 0 on success.
  • <0 on error.

Definition at line 824 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _dict_attr_init_name_only()

int _dict_attr_init_name_only ( char const *  filename,
int  line,
fr_dict_attr_t **  da_p,
fr_dict_attr_t const *  parent,
char const *  name,
fr_type_t  type,
dict_attr_args_t const *  args 
)

Initialise fields in a dictionary attribute structure.

This function is a wrapper around the other initialisation functions.

The reason for the separation, is that sometimes we're initialising a dictionary attribute by parsing an actual dictionary file, and other times we're copying attribute, or initialising them programatically.

This function should only be used for the second case, where we have a complet attribute definition already.

Note
This function can only be used before the attribute is inserted into the dictionary.
Parameters
[in]filenamefile.
[in]linenumber.
[in]da_pto initialise.
[in]parentof the attribute, if none, this attribute will be initialised as a dictionary root.
[in]nameof attribute. Pass NULL for auto-generated name. automatically generated.
[in]typeof the attribute.
[in]argsoptional initialisation arguments.
Returns
  • 0 on success.
  • <0 on error.

Definition at line 865 of file dict_util.c.

+ Here is the call graph for this function:

◆ dict_alloc()

fr_dict_t * dict_alloc ( TALLOC_CTX *  ctx)

Allocate a new dictionary.

Parameters
[in]ctxto allocate dictionary in.
Returns
  • NULL on memory allocation error.

Definition at line 3872 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_acopy()

fr_dict_attr_t * dict_attr_acopy ( TALLOC_CTX *  ctx,
fr_dict_attr_t const *  in,
char const *  new_name 
)

Copy a an existing attribute.

Parameters
[in]ctxto allocate new attribute in.
[in]inattribute to copy.
[in]new_nameto assign to the attribute. If NULL the existing name will be used.
Returns

Definition at line 1017 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_acopy_children()

int dict_attr_acopy_children ( fr_dict_t dict,
fr_dict_attr_t dst,
fr_dict_attr_t const *  src 
)

Copy the children of an existing attribute.

Parameters
[in]dictto allocate the children in
[in]dstwhere to copy the children to
[in]srcwhere to copy the children from
Returns
  • 0 on success
  • <0 on error

Definition at line 1087 of file dict_util.c.

+ Here is the caller graph for this function:

◆ dict_attr_acopy_enumv()

int dict_attr_acopy_enumv ( fr_dict_attr_t dst,
fr_dict_attr_t const *  src 
)

Copy the VALUEs of an existing attribute, by casting them.

Parameters
[in]dstwhere to cast the VALUEs to
[in]srcwhere to cast the VALUEs from
Returns
  • 0 on success
  • <0 on error

Definition at line 1145 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_add_to_namespace()

int dict_attr_add_to_namespace ( fr_dict_attr_t const *  parent,
fr_dict_attr_t da 
)

Add an attribute to the name table for an attribute.

Parameters
[in]parentcontaining the namespace to add this attribute to.
[in]dato add to the name lookup tables.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1524 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_alias_add()

int dict_attr_alias_add ( fr_dict_attr_t const *  parent,
char const *  alias,
fr_dict_attr_t const *  ref 
)

Add an alias to an existing attribute.

Definition at line 1174 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_alloc_null()

fr_dict_attr_t * dict_attr_alloc_null ( TALLOC_CTX *  ctx,
fr_dict_protocol_t const *  proto 
)

Partial initialisation functions.

These functions are used to initialise attributes in stages, i.e. when parsing a dictionary.

The finalise function must be called to complete the initialisation.

All functions must be called to fully initialise a dictionary attribute, except dict_attr_parent_init this is not necessary for root attributes.

Partial initialisation functions.

This is useful in some instances where we need to pre-allocate the attribute for talloc hierarchy reasons, but want to finish initialising it with dict_attr_init later.

Parameters
[in]ctxto allocate attribute in.
[in]protoprotocol specific extensions.
Returns
  • A new, partially completed, fr_dict_attr_t on success.
  • NULL on failure (memory allocation error).

Definition at line 917 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_by_name()

fr_dict_attr_t * dict_attr_by_name ( fr_dict_attr_err_t err,
fr_dict_attr_t const *  parent,
char const *  name 
)

Definition at line 3217 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_can_have_children()

bool dict_attr_can_have_children ( fr_dict_attr_t const *  da)

See if a fr_dict_attr_t can have children.

The check for children is complicated by the need for "int" types to have children, when they are key fields in a struct. This situation occurs when a struct has multiple sub-structures, which are selected based on a key field.

There is no other place for the sub-structures to go. In the future, we may extend the functionality of the key field, by allowing non-integer data types. That would require storing keys as fr_dict_enum_value_t, and then placing the child (i.e. sub) structures there. But that would involve adding children to enums, which is currently not supported.

Parameters
dathe dictionary attribute to check.

Definition at line 1391 of file dict_util.c.

+ Here is the caller graph for this function:

◆ dict_attr_child_add()

int dict_attr_child_add ( fr_dict_attr_t parent,
fr_dict_attr_t child 
)

Add a child to a parent.

Parameters
[in]parentwe're adding a child to.
[in]childto add to parent.
Returns
  • 0 on success.
  • -1 on failure (memory allocation error).

Definition at line 1425 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_child_by_num()

fr_dict_attr_t * dict_attr_child_by_num ( fr_dict_attr_t const *  parent,
unsigned int  attr 
)

Internal version of fr_dict_attr_child_by_num.

Definition at line 3281 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_enum_add_name()

int dict_attr_enum_add_name ( fr_dict_attr_t da,
char const *  name,
fr_value_box_t const *  value,
bool  coerce,
bool  replace,
fr_dict_attr_t const *  child_struct 
)

Definition at line 1752 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_finalise()

int dict_attr_finalise ( fr_dict_attr_t **  da_p,
char const *  name 
)

Set remaining fields in a dictionary attribute before insertion.

Parameters
[in]da_pto finalise.
[in]nameof the attribute.
Returns
  • 0 on success.
  • < 0 on error.

Definition at line 709 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_flags_valid()

bool dict_attr_flags_valid ( fr_dict_attr_t da)

Validate a set of flags.

Parameters
[in]dato check.
Returns
  • true if attribute definition is valid.
  • false if attribute definition is not valid.

Definition at line 35 of file dict_validate.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_location_init()

void dict_attr_location_init ( fr_dict_attr_t da,
char const *  filename,
int  line 
)

Set where the dictionary attribute was defined.

Definition at line 695 of file dict_util.c.

+ Here is the caller graph for this function:

◆ dict_attr_num_init()

int dict_attr_num_init ( fr_dict_attr_t da,
unsigned int  num 
)

Set the attribute number (if any)

Parameters
[in]dato set the attribute number for.
[in]numto set.

Definition at line 665 of file dict_util.c.

+ Here is the caller graph for this function:

◆ dict_attr_num_init_name_only()

int dict_attr_num_init_name_only ( fr_dict_attr_t da)

Set the attribute number (if any)

Note
Must have a parent set.
Parameters
[in]dato set the attribute number for.

Definition at line 683 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_parent_init()

int dict_attr_parent_init ( fr_dict_attr_t **  da_p,
fr_dict_attr_t const *  parent 
)

Initialise fields which depend on a parent attribute.

Parameters
[in,out]da_pto initialise.
[in]parentof the attribute.
Returns
  • 0 on success.
  • < 0 on error.

Definition at line 613 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_type_init()

int dict_attr_type_init ( fr_dict_attr_t **  da_p,
fr_type_t  type 
)

Initialise type specific fields within the dictionary attribute.

Call when the type of the attribute is known.

Parameters
[in,out]da_pto set the type for.
[in]typeto set.
Returns
  • 0 on success.
  • < 0 on error.

Definition at line 519 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_attr_valid()

bool dict_attr_valid ( fr_dict_attr_t da)

Validate a new attribute definition.

Todo:
we need to check length of none vendor attributes.
Parameters
[in]dato validate.
Returns
  • true if attribute definition is valid.
  • false if attribute definition is not valid.

Definition at line 603 of file dict_validate.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_by_da()

fr_dict_t * dict_by_da ( fr_dict_attr_t const *  da)

Internal version of fr_dict_by_da.

Note
For internal use by the dictionary API only.

Attempt to locate the protocol dictionary containing an attribute.

Definition at line 2536 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_by_protocol_name()

fr_dict_t * dict_by_protocol_name ( char const *  name)

Internal version of fr_dict_by_protocol_name.

Note
For internal use by the dictionary API only.

Lookup a protocol by its name.

Definition at line 2508 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_by_protocol_num()

fr_dict_t * dict_by_protocol_num ( unsigned int  num)

Internal version of fr_dict_by_protocol_num.

Note
For internal use by the dictionary API only.

Lookup a protocol by its number.

Definition at line 2522 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_by_protocol_substr()

fr_slen_t dict_by_protocol_substr ( fr_dict_attr_err_t err,
fr_dict_t **  out,
fr_sbuff_t name,
fr_dict_t const *  dict_def 
)

Definition at line 2415 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_dependent_add()

int dict_dependent_add ( fr_dict_t dict,
char const *  dependent 
)

Record a new dependency on a dictionary.

These are used to determine what is currently depending on a dictionary.

Parameters
[in]dictto record dependency on.
[in]dependentEither C src file, or another dictionary.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 3647 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_dependent_remove()

int dict_dependent_remove ( fr_dict_t dict,
char const *  dependent 
)

Decrement ref count for a dependent in a dictionary.

Parameters
[in]dictto remove dependency from.
[in]dependentEither C src, or another dictionary dependent. What depends on this dictionary.

Definition at line 3706 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_dlopen()

int dict_dlopen ( fr_dict_t dict,
char const *  name 
)

Definition at line 3555 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_has_dependents()

bool dict_has_dependents ( fr_dict_t dict)

Check if a dictionary still has dependents.

Parameters
[in]dictto check
Returns
  • true if there's still at least one dependent.
  • false if there are no dependents.

Definition at line 3738 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_protocol_add()

int dict_protocol_add ( fr_dict_t dict)

Add a protocol to the global protocol table.

Inserts a protocol into the global protocol table. Uses the root attributes of the dictionary for comparisons.

Parameters
[in]dictof protocol we're inserting.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1236 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dict_vendor_add()

int dict_vendor_add ( fr_dict_t dict,
char const *  name,
unsigned int  num 
)

Add a vendor to the dictionary.

Inserts a vendor entry into the vendor hash table. This must be done before adding attributes under a VSA.

Parameters
[in]dictof protocol context we're operating in. If NULL the internal dictionary will be used.
[in]nameof the vendor.
[in]numVendor's Private Enterprise Number.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1309 of file dict_util.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ dict_gctx

fr_dict_gctx_t* dict_gctx
extern

Top level structure containing global dictionary state.

Definition at line 46 of file dict_util.c.