The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
dict_tokenize.c File Reference

Parse dictionary files. More...

#include <freeradius-devel/radius/defs.h>
#include <freeradius-devel/util/conf.h>
#include <freeradius-devel/util/dict_fixup_priv.h>
#include <freeradius-devel/util/dict_priv.h>
#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/util/file.h>
#include <freeradius-devel/util/rand.h>
#include <freeradius-devel/util/strerror.h>
#include <freeradius-devel/util/syserror.h>
#include <freeradius-devel/util/table.h>
#include <freeradius-devel/util/types.h>
#include <freeradius-devel/util/value.h>
#include <sys/stat.h>
+ Include dependency graph for dict_tokenize.c:

Go to the source code of this file.

Data Structures

struct  dict_tokenize_ctx_s
 
struct  dict_tokenize_frame_t
 Parser context for dict_from_file. More...
 
struct  fr_dict_keyword_parser_t
 
struct  fr_dict_keyword_t
 

Macros

#define ASSERT_CURRENT_NEST(_dctx, _nest)
 
#define CURRENT_DA(_dctx)   (CURRENT_FRAME(_dctx)->da)
 
#define CURRENT_FILENAME(_dctx)   (CURRENT_FRAME(_dctx)->filename)
 
#define CURRENT_FRAME(_dctx)   (&(_dctx)->stack[(_dctx)->stack_depth])
 
#define CURRENT_LINE(_dctx)   (CURRENT_FRAME(_dctx)->line)
 
#define DICT_MAX_ARGV   (8)
 Maximum number of arguments.
 
#define DICT_MAX_STACK   (32)
 Maximum stack size.
 
#define FLAG_FUNC(_name)
 Define a flag setting function, which sets one bit in a fr_dict_attr_flags_t.
 

Typedefs

typedef int(* fr_dict_keyword_parse_t) (dict_tokenize_ctx_t *dctx, char **argv, int argc, fr_dict_attr_flags_t *base_flags)
 Keyword parser.
 
typedef int(* fr_dict_section_begin_t) (dict_tokenize_ctx_t *dctx)
 Pushes a new frame onto the top of the stack based on the current frame.
 

Enumerations

enum  dict_nest_t {
  NEST_NONE = 0x00 ,
  NEST_ROOT = 0x01 ,
  NEST_PROTOCOL = 0x02 ,
  NEST_VENDOR = 0x04 ,
  NEST_ATTRIBUTE = 0x08
}
 This represents explicit BEGIN/END frames pushed onto the stack. More...
 

Functions

static int _dict_from_file (dict_tokenize_ctx_t *dctx, char const *dir_name, char const *filename, char const *src_file, int src_line)
 
static int dict_attr_add_or_fixup (dict_fixup_ctx_t *fixup, fr_dict_attr_t **da_p)
 Add an attribute to the dictionary, or add it to a list of attributes to clone later.
 
static int dict_attr_allow_dup (fr_dict_attr_t const *da)
 Check if this definition is a duplicate, and if it is, whether we should skip it error out.
 
static void dict_attr_location_set (dict_tokenize_ctx_t *dctx, fr_dict_attr_t *da)
 
static int dict_begin_protocol (dict_tokenize_ctx_t *dctx)
 Process an inline BEGIN PROTOCOL block.
 
void dict_dctx_debug (dict_tokenize_ctx_t *dctx)
 
static dict_tokenize_frame_t const * dict_dctx_find_frame (dict_tokenize_ctx_t *dctx, dict_nest_t nest)
 
static dict_tokenize_frame_t const * dict_dctx_pop (dict_tokenize_ctx_t *dctx)
 Pop the current stack frame.
 
static int dict_dctx_push (dict_tokenize_ctx_t *dctx, fr_dict_attr_t const *da, dict_nest_t nest)
 
static int dict_dctx_push_or_update (dict_tokenize_ctx_t *dctx, fr_dict_attr_t const *da, dict_nest_t nest)
 Either updates the da in the current stack frame if 'nest' matches, or pushes a new frame of type 'nest'.
 
static dict_tokenize_frame_t const * dict_dctx_unwind (dict_tokenize_ctx_t *dctx)
 Unwind the entire stack, returning the root frame.
 
static dict_tokenize_frame_t const * dict_dctx_unwind_until (dict_tokenize_ctx_t *dctx, dict_nest_t nest)
 Unwind the stack until it points to a particular type of stack frame.
 
static int dict_filename_add (char **filename_out, fr_dict_t *dict, char const *filename)
 Maintain a linked list of filenames which we've seen loading this dictionary.
 
static bool dict_filename_loaded (fr_dict_t *dict, char const *filename)
 See if we have already loaded the file,.
 
static int dict_finalise (dict_tokenize_ctx_t *dctx)
 
static int dict_flag_clone (fr_dict_attr_t **da_p, char const *value, UNUSED fr_dict_flag_parser_rule_t const *rules)
 
static int dict_flag_enum (fr_dict_attr_t **da_p, char const *value, UNUSED fr_dict_flag_parser_rule_t const *rule)
 
static int dict_flag_key (fr_dict_attr_t **da_p, UNUSED char const *value, UNUSED fr_dict_flag_parser_rule_t const *rule)
 
static int dict_flag_length (fr_dict_attr_t **da_p, char const *value, UNUSED fr_dict_flag_parser_rule_t const *rule)
 
static int dict_flag_offset (fr_dict_attr_t **da_p, char const *value, UNUSED fr_dict_flag_parser_rule_t const *rule)
 
static int dict_flag_precision (fr_dict_attr_t **da_p, char const *value, UNUSED fr_dict_flag_parser_rule_t const *rule)
 
static int dict_flag_ref (fr_dict_attr_t **da_p, char const *value, UNUSED fr_dict_flag_parser_rule_t const *rule)
 
static int dict_flag_secret (fr_dict_attr_t **da_p, UNUSED char const *value, UNUSED fr_dict_flag_parser_rule_t const *rule)
 
static int dict_flag_subtype (fr_dict_attr_t **da_p, char const *value, UNUSED fr_dict_flag_parser_rule_t const *rule)
 
static int dict_from_file (fr_dict_t *dict, char const *dir_name, char const *filename, char const *src_file, int src_line)
 
static int dict_process_type_field (dict_tokenize_ctx_t *dctx, char const *name, fr_dict_attr_t **da_p)
 
static int dict_read_parse_format (char const *format, int *ptype, int *plength, bool *pcontinuation)
 
static int dict_read_process_alias (dict_tokenize_ctx_t *dctx, char **argv, int argc, UNUSED fr_dict_attr_flags_t *base_flags)
 
static int dict_read_process_attribute (dict_tokenize_ctx_t *dctx, char **argv, int argc, fr_dict_attr_flags_t *base_flags)
 
static int dict_read_process_begin (dict_tokenize_ctx_t *dctx, char **argv, int argc, UNUSED fr_dict_attr_flags_t *base_flags)
 
static int dict_read_process_begin_protocol (dict_tokenize_ctx_t *dctx, char **argv, int argc, UNUSED fr_dict_attr_flags_t *base_flags)
 
static int dict_read_process_begin_vendor (dict_tokenize_ctx_t *dctx, char **argv, int argc, UNUSED fr_dict_attr_flags_t *base_flags)
 
static int dict_read_process_common (dict_tokenize_ctx_t *dctx, fr_dict_attr_t **da_p, char const *name, char const *type_name, char *flag_name, fr_dict_attr_flags_t const *base_flags)
 
static int dict_read_process_define (dict_tokenize_ctx_t *dctx, char **argv, int argc, fr_dict_attr_flags_t *base_flags)
 
static int dict_read_process_end (dict_tokenize_ctx_t *dctx, char **argv, int argc, UNUSED fr_dict_attr_flags_t *base_flags)
 
static int dict_read_process_end_protocol (dict_tokenize_ctx_t *dctx, char **argv, int argc, UNUSED fr_dict_attr_flags_t *base_flags)
 
static int dict_read_process_end_vendor (dict_tokenize_ctx_t *dctx, char **argv, int argc, UNUSED fr_dict_attr_flags_t *base_flags)
 
static int dict_read_process_enum (dict_tokenize_ctx_t *dctx, char **argv, int argc, fr_dict_attr_flags_t *base_flags)
 
static int dict_read_process_flags (UNUSED dict_tokenize_ctx_t *dctx, char **argv, int argc, fr_dict_attr_flags_t *base_flags)
 
static int dict_read_process_include (dict_tokenize_ctx_t *dctx, char **argv, int argc, char const *dir)
 
static int dict_read_process_member (dict_tokenize_ctx_t *dctx, char **argv, int argc, fr_dict_attr_flags_t *base_flags)
 
static int dict_read_process_protocol (dict_tokenize_ctx_t *dctx, char **argv, int argc, UNUSED fr_dict_attr_flags_t *base_flag)
 Register the specified dictionary as a protocol dictionary.
 
static int dict_read_process_struct (dict_tokenize_ctx_t *dctx, char **argv, int argc, UNUSED fr_dict_attr_flags_t *base_flags)
 Process a STRUCT name attr value.
 
static int dict_read_process_value (dict_tokenize_ctx_t *dctx, char **argv, int argc, UNUSED fr_dict_attr_flags_t *base_flags)
 Process a value alias.
 
static int dict_read_process_vendor (dict_tokenize_ctx_t *dctx, char **argv, int argc, UNUSED fr_dict_attr_flags_t *base_flags)
 
static int dict_read_sscanf_i (unsigned int *pvalue, char const *str)
 
static int dict_root_set (fr_dict_t *dict, char const *name, unsigned int proto_number)
 Set a new root dictionary attribute.
 
static int dict_set_value_attr (dict_tokenize_ctx_t *dctx, fr_dict_attr_t *da)
 
static int dict_struct_finalise (dict_tokenize_ctx_t *dctx)
 
fr_dict_tfr_dict_alloc (char const *proto_name, unsigned int proto_number)
 
int fr_dict_internal_afrom_file (fr_dict_t **out, char const *dict_subdir, char const *dependent)
 (Re-)Initialize the special internal dictionary
 
int fr_dict_parse_str (fr_dict_t *dict, char *buf, fr_dict_attr_t const *parent)
 
int fr_dict_protocol_afrom_file (fr_dict_t **out, char const *proto_name, char const *proto_dir, char const *dependent)
 (Re)-initialize a protocol dictionary
 
int fr_dict_read (fr_dict_t *dict, char const *dir, char const *filename)
 Read supplementary attribute definitions into an existing dictionary.
 
int fr_dict_str_to_argv (char *str, char **argv, int max_argc)
 
static TABLE_TYPE_NAME_FUNC_RPTR (table_sorted_value_by_str, fr_dict_flag_parser_t const *, fr_dict_attr_flag_to_parser, fr_dict_flag_parser_rule_t const *, fr_dict_flag_parser_rule_t const *)
 A lookup function for dictionary attribute flags.
 
static TABLE_TYPE_NAME_FUNC_RPTR (table_sorted_value_by_str, fr_dict_keyword_t const *, fr_dict_keyword, fr_dict_keyword_parser_t const *, fr_dict_keyword_parser_t const *)
 

Variables

static fr_table_num_sorted_t const dict_nest_table []
 
static size_t const dict_nest_table_len = NUM_ELEMENTS(dict_nest_table)
 

Detailed Description

Parse dictionary files.

Definition in file dict_tokenize.c.


Data Structure Documentation

◆ dict_tokenize_ctx_s

struct dict_tokenize_ctx_s

Definition at line 91 of file dict_tokenize.c.

+ Collaboration diagram for dict_tokenize_ctx_s:
Data Fields
fr_dict_t * dict Protocol dictionary we're inserting attributes into.
dict_fixup_ctx_t fixup
fr_dict_attr_t const * relative_attr for ".82" instead of "1.2.3.82". only for parents of type "tlv"
dict_tokenize_frame_t stack[DICT_MAX_STACK] stack of attributes to track
int stack_depth points to the last used stack frame
fr_dict_attr_t * value_attr Cache of last attribute to speed up value processing.

◆ dict_tokenize_frame_t

struct dict_tokenize_frame_t

Parser context for dict_from_file.

Allows vendor and TLV context to persist across $INCLUDEs

Definition at line 80 of file dict_tokenize.c.

+ Collaboration diagram for dict_tokenize_frame_t:
Data Fields
fr_dict_attr_t const * da the da we care about
fr_dict_t * dict The dictionary before the current BEGIN-PROTOCOL block.
char * filename name of the file we're reading
int line line number of this file
int member_num structure member numbers
dict_nest_t nest for manual vs automatic begin / end things
fr_dict_attr_t const * struct_is_closed no more members are allowed
ssize_t struct_size size of the struct.

◆ fr_dict_keyword_parser_t

struct fr_dict_keyword_parser_t

Definition at line 2841 of file dict_tokenize.c.

+ Collaboration diagram for fr_dict_keyword_parser_t:
Data Fields
fr_dict_section_begin_t begin Can have a BEGIN prefix.
fr_dict_keyword_parse_t parse Function to parse the keyword with.

◆ fr_dict_keyword_t

struct fr_dict_keyword_t

Definition at line 2846 of file dict_tokenize.c.

+ Collaboration diagram for fr_dict_keyword_t:
Data Fields
fr_table_elem_name_t name Name of the keyword, e.g. "ATTRIBUTE".
fr_dict_keyword_parser_t value Value to return from lookup.

Macro Definition Documentation

◆ ASSERT_CURRENT_NEST

#define ASSERT_CURRENT_NEST (   _dctx,
  _nest 
)
Value:
fr_assert_msg(CURRENT_FRAME(_dctx)->nest == (_nest), "Expected frame type %s, got %s", \
fr_table_str_by_value(dict_nest_table, (_nest), "<INVALID>"), fr_table_str_by_value(dict_nest_table, CURRENT_FRAME(_dctx)->nest, "<INVALID>"))
#define fr_assert_msg(_x, _msg,...)
Calls panic_action ifndef NDEBUG, else logs error and causes the server to exit immediately with code...
Definition debug.h:210
static fr_table_num_sorted_t const dict_nest_table[]
#define CURRENT_FRAME(_dctx)
#define fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
Definition table.h:772

Definition at line 111 of file dict_tokenize.c.

◆ CURRENT_DA

#define CURRENT_DA (   _dctx)    (CURRENT_FRAME(_dctx)->da)

Definition at line 107 of file dict_tokenize.c.

◆ CURRENT_FILENAME

#define CURRENT_FILENAME (   _dctx)    (CURRENT_FRAME(_dctx)->filename)

Definition at line 108 of file dict_tokenize.c.

◆ CURRENT_FRAME

#define CURRENT_FRAME (   _dctx)    (&(_dctx)->stack[(_dctx)->stack_depth])

Definition at line 106 of file dict_tokenize.c.

◆ CURRENT_LINE

#define CURRENT_LINE (   _dctx)    (CURRENT_FRAME(_dctx)->line)

Definition at line 109 of file dict_tokenize.c.

◆ DICT_MAX_ARGV

#define DICT_MAX_ARGV   (8)

Maximum number of arguments.

For any one keyword, this is the maxiumum number of arguments that can be passed.

Definition at line 45 of file dict_tokenize.c.

◆ DICT_MAX_STACK

#define DICT_MAX_STACK   (32)

Maximum stack size.

This is the maximum number of nested BEGIN and $INCLUDE statements.

Definition at line 51 of file dict_tokenize.c.

◆ FLAG_FUNC

#define FLAG_FUNC (   _name)
Value:
static int dict_flag_##_name(fr_dict_attr_t **da_p, UNUSED char const *value, UNUSED fr_dict_flag_parser_rule_t const *rules)\
{ \
(*da_p)->flags._name = 1; \
return 0; \
}
#define UNUSED
Definition build.h:315
Test enumeration values.
Definition dict_test.h:92

Define a flag setting function, which sets one bit in a fr_dict_attr_flags_t.

This is here, because AFAIK there's no completely portable way to get the bit offset of a bit field in a structure.

Definition at line 458 of file dict_tokenize.c.

Typedef Documentation

◆ fr_dict_keyword_parse_t

typedef int(* fr_dict_keyword_parse_t) (dict_tokenize_ctx_t *dctx, char **argv, int argc, fr_dict_attr_flags_t *base_flags)

Keyword parser.

Parameters
[in]dctxcontaining the dictionary we're currently parsing.
[in]argvarguments to the keyword.
[in]argcnumber of arguments.
[in]base_flagsset in the context of the current file.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 2821 of file dict_tokenize.c.

◆ fr_dict_section_begin_t

typedef int(* fr_dict_section_begin_t) (dict_tokenize_ctx_t *dctx)

Pushes a new frame onto the top of the stack based on the current frame.

Whenever a protocol, vendor, or attribute is defined in the dictionary it either mutates or pushes a new NONE frame onto the stack. This holds the last defined object at a given level of nesting.

This function is used to push an additional frame onto the stack, effectively entering the context of the last defined object at a given level of nesting

Parameters
[in]dctxContains the current state of the dictionary parser. Used to track what PROTOCOL, VENDOR or TLV block we're in.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 2839 of file dict_tokenize.c.

Enumeration Type Documentation

◆ dict_nest_t

This represents explicit BEGIN/END frames pushed onto the stack.

These are flags to allow multiple nesting types to be passed to the search function.

Enumerator
NEST_NONE 
NEST_ROOT 
NEST_PROTOCOL 
NEST_VENDOR 
NEST_ATTRIBUTE 

Definition at line 58 of file dict_tokenize.c.

Function Documentation

◆ _dict_from_file()

static int _dict_from_file ( dict_tokenize_ctx_t dctx,
char const *  dir_name,
char const *  filename,
char const *  src_file,
int  src_line 
)
static
+ Here is the caller graph for this function:

◆ dict_attr_add_or_fixup()

static int dict_attr_add_or_fixup ( dict_fixup_ctx_t fixup,
fr_dict_attr_t **  da_p 
)
static

Add an attribute to the dictionary, or add it to a list of attributes to clone later.

Parameters
[in]fixupcontext to add an entry to (if needed).
[in]da_pto either add, or create a fixup for.
Returns
  • 0 on success, and an attribute was added.
  • 1 on success, and a deferred entry was added.
  • -1 on failure.

Definition at line 819 of file dict_tokenize.c.

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

◆ dict_attr_allow_dup()

static int dict_attr_allow_dup ( fr_dict_attr_t const *  da)
static

Check if this definition is a duplicate, and if it is, whether we should skip it error out.

Returns
  • 1 if this is not a duplicate.
  • 0 if this is a duplicate, and we should ignore the definition.
  • -1 if this is a duplicate, and we should error out.

Definition at line 886 of file dict_tokenize.c.

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

◆ dict_attr_location_set()

static void dict_attr_location_set ( dict_tokenize_ctx_t dctx,
fr_dict_attr_t da 
)
inlinestatic

Definition at line 804 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_begin_protocol()

static int dict_begin_protocol ( dict_tokenize_ctx_t dctx)
static

Process an inline BEGIN PROTOCOL block.

Definition at line 2794 of file dict_tokenize.c.

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

◆ dict_dctx_debug()

void dict_dctx_debug ( dict_tokenize_ctx_t dctx)

Definition at line 114 of file dict_tokenize.c.

+ Here is the call graph for this function:

◆ dict_dctx_find_frame()

static dict_tokenize_frame_t const * dict_dctx_find_frame ( dict_tokenize_ctx_t dctx,
dict_nest_t  nest 
)
static

Definition at line 128 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_dctx_pop()

static dict_tokenize_frame_t const * dict_dctx_pop ( dict_tokenize_ctx_t dctx)
static

Pop the current stack frame.

Parameters
[in]dctxStack to pop from. @preturn
  • Pointer to the current stack frame.
  • NULL, if we're already at the root.

Definition at line 188 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_dctx_push()

static int dict_dctx_push ( dict_tokenize_ctx_t dctx,
fr_dict_attr_t const *  da,
dict_nest_t  nest 
)
static

Definition at line 139 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_dctx_push_or_update()

static int dict_dctx_push_or_update ( dict_tokenize_ctx_t dctx,
fr_dict_attr_t const *  da,
dict_nest_t  nest 
)
static

Either updates the da in the current stack frame if 'nest' matches, or pushes a new frame of type 'nest'.

Parameters
[in]dctxStack to push to.
[in]daAttribute to push.
[in]nestFrame type to push.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 169 of file dict_tokenize.c.

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

◆ dict_dctx_unwind()

static dict_tokenize_frame_t const * dict_dctx_unwind ( dict_tokenize_ctx_t dctx)
static

Unwind the entire stack, returning the root frame.

Parameters
[in]dctxStack to unwind.
Returns
Pointer to the root frame.

Definition at line 200 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_dctx_unwind_until()

static dict_tokenize_frame_t const * dict_dctx_unwind_until ( dict_tokenize_ctx_t dctx,
dict_nest_t  nest 
)
static

Unwind the stack until it points to a particular type of stack frame.

Parameters
[in]dctxStack to unwind.
[in]nestFrame type to unwind to.
Returns
  • Pointer to the frame matching nest
  • NULL, if we unwound the complete stack and didn't find the frame.

Definition at line 218 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_filename_add()

static int dict_filename_add ( char **  filename_out,
fr_dict_t dict,
char const *  filename 
)
inlinestatic

Maintain a linked list of filenames which we've seen loading this dictionary.

This is used for debug messages, so we have a copy of the original file path that we can reference from fr_dict_attr_t without having the memory bloat of assigning a buffer to every attribute.

Definition at line 2718 of file dict_tokenize.c.

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

◆ dict_filename_loaded()

static bool dict_filename_loaded ( fr_dict_t dict,
char const *  filename 
)
inlinestatic

See if we have already loaded the file,.

Definition at line 2740 of file dict_tokenize.c.

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

◆ dict_finalise()

static int dict_finalise ( dict_tokenize_ctx_t dctx)
static

Definition at line 793 of file dict_tokenize.c.

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

◆ dict_flag_clone()

static int dict_flag_clone ( fr_dict_attr_t **  da_p,
char const *  value,
UNUSED fr_dict_flag_parser_rule_t const *  rules 
)
static

Definition at line 467 of file dict_tokenize.c.

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

◆ dict_flag_enum()

static int dict_flag_enum ( fr_dict_attr_t **  da_p,
char const *  value,
UNUSED fr_dict_flag_parser_rule_t const *  rule 
)
static

Definition at line 485 of file dict_tokenize.c.

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

◆ dict_flag_key()

static int dict_flag_key ( fr_dict_attr_t **  da_p,
UNUSED char const *  value,
UNUSED fr_dict_flag_parser_rule_t const *  rule 
)
static

Definition at line 507 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_flag_length()

static int dict_flag_length ( fr_dict_attr_t **  da_p,
char const *  value,
UNUSED fr_dict_flag_parser_rule_t const *  rule 
)
static

Definition at line 527 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_flag_offset()

static int dict_flag_offset ( fr_dict_attr_t **  da_p,
char const *  value,
UNUSED fr_dict_flag_parser_rule_t const *  rule 
)
static

Definition at line 548 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_flag_precision()

static int dict_flag_precision ( fr_dict_attr_t **  da_p,
char const *  value,
UNUSED fr_dict_flag_parser_rule_t const *  rule 
)
static

Definition at line 573 of file dict_tokenize.c.

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

◆ dict_flag_ref()

static int dict_flag_ref ( fr_dict_attr_t **  da_p,
char const *  value,
UNUSED fr_dict_flag_parser_rule_t const *  rule 
)
static

Definition at line 598 of file dict_tokenize.c.

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

◆ dict_flag_secret()

static int dict_flag_secret ( fr_dict_attr_t **  da_p,
UNUSED char const *  value,
UNUSED fr_dict_flag_parser_rule_t const *  rule 
)
static

Definition at line 618 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_flag_subtype()

static int dict_flag_subtype ( fr_dict_attr_t **  da_p,
char const *  value,
UNUSED fr_dict_flag_parser_rule_t const *  rule 
)
static

Definition at line 632 of file dict_tokenize.c.

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

◆ dict_from_file()

static int dict_from_file ( fr_dict_t dict,
char const *  dir_name,
char const *  filename,
char const *  src_file,
int  src_line 
)
static

Definition at line 3132 of file dict_tokenize.c.

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

◆ dict_process_type_field()

static int dict_process_type_field ( dict_tokenize_ctx_t dctx,
char const *  name,
fr_dict_attr_t **  da_p 
)
static

Definition at line 339 of file dict_tokenize.c.

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

◆ dict_read_parse_format()

static int dict_read_parse_format ( char const *  format,
int *  ptype,
int *  plength,
bool pcontinuation 
)
static

Definition at line 1074 of file dict_tokenize.c.

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

◆ dict_read_process_alias()

static int dict_read_process_alias ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
UNUSED fr_dict_attr_flags_t base_flags 
)
static

Definition at line 1145 of file dict_tokenize.c.

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

◆ dict_read_process_attribute()

static int dict_read_process_attribute ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
fr_dict_attr_flags_t base_flags 
)
static

Definition at line 1198 of file dict_tokenize.c.

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

◆ dict_read_process_begin()

static int dict_read_process_begin ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
UNUSED fr_dict_attr_flags_t base_flags 
)
static

Definition at line 1370 of file dict_tokenize.c.

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

◆ dict_read_process_begin_protocol()

static int dict_read_process_begin_protocol ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
UNUSED fr_dict_attr_flags_t base_flags 
)
static

Definition at line 1423 of file dict_tokenize.c.

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

◆ dict_read_process_begin_vendor()

static int dict_read_process_begin_vendor ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
UNUSED fr_dict_attr_flags_t base_flags 
)
static

Definition at line 1481 of file dict_tokenize.c.

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

◆ dict_read_process_common()

static int dict_read_process_common ( dict_tokenize_ctx_t dctx,
fr_dict_attr_t **  da_p,
char const *  name,
char const *  type_name,
char *  flag_name,
fr_dict_attr_flags_t const *  base_flags 
)
static

Definition at line 953 of file dict_tokenize.c.

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

◆ dict_read_process_define()

static int dict_read_process_define ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
fr_dict_attr_flags_t base_flags 
)
static

Definition at line 1623 of file dict_tokenize.c.

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

◆ dict_read_process_end()

static int dict_read_process_end ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
UNUSED fr_dict_attr_flags_t base_flags 
)
static

Definition at line 1738 of file dict_tokenize.c.

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

◆ dict_read_process_end_protocol()

static int dict_read_process_end_protocol ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
UNUSED fr_dict_attr_flags_t base_flags 
)
static

Definition at line 1794 of file dict_tokenize.c.

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

◆ dict_read_process_end_vendor()

static int dict_read_process_end_vendor ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
UNUSED fr_dict_attr_flags_t base_flags 
)
static

Definition at line 1860 of file dict_tokenize.c.

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

◆ dict_read_process_enum()

static int dict_read_process_enum ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
fr_dict_attr_flags_t base_flags 
)
static

Definition at line 1912 of file dict_tokenize.c.

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

◆ dict_read_process_flags()

static int dict_read_process_flags ( UNUSED dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
fr_dict_attr_flags_t base_flags 
)
static

Definition at line 2015 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_read_process_include()

static int dict_read_process_include ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
char const *  dir 
)
static

Definition at line 1007 of file dict_tokenize.c.

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

◆ dict_read_process_member()

static int dict_read_process_member ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
fr_dict_attr_flags_t base_flags 
)
static

Definition at line 2042 of file dict_tokenize.c.

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

◆ dict_read_process_protocol()

static int dict_read_process_protocol ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
UNUSED fr_dict_attr_flags_t base_flag 
)
static

Register the specified dictionary as a protocol dictionary.

Allows vendor and TLV context to persist across $INCLUDEs

Definition at line 2562 of file dict_tokenize.c.

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

◆ dict_read_process_struct()

static int dict_read_process_struct ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
UNUSED fr_dict_attr_flags_t base_flags 
)
static

Process a STRUCT name attr value.

Define struct 'name' when key 'attr' has 'value'.

Which MUST be a sub-structure of another struct

Definition at line 2248 of file dict_tokenize.c.

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

◆ dict_read_process_value()

static int dict_read_process_value ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
UNUSED fr_dict_attr_flags_t base_flags 
)
static

Process a value alias.

Definition at line 2412 of file dict_tokenize.c.

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

◆ dict_read_process_vendor()

static int dict_read_process_vendor ( dict_tokenize_ctx_t dctx,
char **  argv,
int  argc,
UNUSED fr_dict_attr_flags_t base_flags 
)
static

Definition at line 2506 of file dict_tokenize.c.

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

◆ dict_read_sscanf_i()

static int dict_read_sscanf_i ( unsigned int *  pvalue,
char const *  str 
)
static

Definition at line 271 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_root_set()

static int dict_root_set ( fr_dict_t dict,
char const *  name,
unsigned int  proto_number 
)
static

Set a new root dictionary attribute.

Note
Must only be called once per dictionary.
Parameters
[in]dictto modify.
[in]nameof dictionary root.
[in]proto_numberThe artificial (or IANA allocated) number for the protocol. This is only used for
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 314 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ dict_set_value_attr()

static int dict_set_value_attr ( dict_tokenize_ctx_t dctx,
fr_dict_attr_t da 
)
static

Definition at line 935 of file dict_tokenize.c.

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

◆ dict_struct_finalise()

static int dict_struct_finalise ( dict_tokenize_ctx_t dctx)
static

Definition at line 2754 of file dict_tokenize.c.

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

◆ fr_dict_alloc()

fr_dict_t * fr_dict_alloc ( char const *  proto_name,
unsigned int  proto_number 
)

Definition at line 3423 of file dict_tokenize.c.

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

◆ fr_dict_internal_afrom_file()

int fr_dict_internal_afrom_file ( fr_dict_t **  out,
char const *  dict_subdir,
char const *  dependent 
)

(Re-)Initialize the special internal dictionary

This dictionary has additional programmatically generated attributes added to it, and is checked in addition to the protocol specific dictionaries.

Note
The dictionary pointer returned in out must have its reference counter decremented with fr_dict_free when no longer used.
Parameters
[out]outWhere to write pointer to the internal dictionary.
[in]dict_subdirname of the internal dictionary dir (may be NULL).
[in]dependentEither C src file, or another dictionary.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 3177 of file dict_tokenize.c.

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

◆ fr_dict_parse_str()

int fr_dict_parse_str ( fr_dict_t dict,
char *  buf,
fr_dict_attr_t const *  parent 
)

Definition at line 3478 of file dict_tokenize.c.

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

◆ fr_dict_protocol_afrom_file()

int fr_dict_protocol_afrom_file ( fr_dict_t **  out,
char const *  proto_name,
char const *  proto_dir,
char const *  dependent 
)

(Re)-initialize a protocol dictionary

Initialize the directory, then fix the attr number of all attributes.

Parameters
[out]outWhere to write a pointer to the new dictionary. Will free existing dictionary if files have changed and *out is not NULL.
[in]proto_namethat we're loading the dictionary for.
[in]proto_dirExplicitly set where to hunt for the dictionary files. May be NULL.
[in]dependentEither C src file, or another dictionary.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 3314 of file dict_tokenize.c.

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

◆ fr_dict_read()

int fr_dict_read ( fr_dict_t dict,
char const *  dir,
char const *  filename 
)

Read supplementary attribute definitions into an existing dictionary.

Parameters
[in]dictExisting dictionary.
[in]dirdictionary is located in.
[in]filenameof the dictionary.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 3458 of file dict_tokenize.c.

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

◆ fr_dict_str_to_argv()

int fr_dict_str_to_argv ( char *  str,
char **  argv,
int  max_argc 
)

Definition at line 234 of file dict_tokenize.c.

+ Here is the caller graph for this function:

◆ TABLE_TYPE_NAME_FUNC_RPTR() [1/2]

static TABLE_TYPE_NAME_FUNC_RPTR ( table_sorted_value_by_str  ,
fr_dict_flag_parser_t const *  ,
fr_dict_attr_flag_to_parser  ,
fr_dict_flag_parser_rule_t const *  ,
fr_dict_flag_parser_rule_t const *   
)
static

A lookup function for dictionary attribute flags.

Definition at line 697 of file dict_tokenize.c.

+ Here is the call graph for this function:

◆ TABLE_TYPE_NAME_FUNC_RPTR() [2/2]

static TABLE_TYPE_NAME_FUNC_RPTR ( table_sorted_value_by_str  ,
fr_dict_keyword_t const *  ,
fr_dict_keyword  ,
fr_dict_keyword_parser_t const *  ,
fr_dict_keyword_parser_t const *   
)
static

Definition at line 2851 of file dict_tokenize.c.

+ Here is the call graph for this function:

Variable Documentation

◆ dict_nest_table

fr_table_num_sorted_t const dict_nest_table[]
static
Initial value:
= {
{ L("ATTRIBUTE"), NEST_ATTRIBUTE },
{ L("NONE"), NEST_NONE },
{ L("PROTOCOL"), NEST_PROTOCOL },
{ L("ROOT"), NEST_ROOT },
{ L("VENDOR"), NEST_VENDOR }
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition build.h:209
@ NEST_VENDOR
@ NEST_PROTOCOL
@ NEST_ROOT
@ NEST_ATTRIBUTE
@ NEST_NONE

Definition at line 67 of file dict_tokenize.c.

◆ dict_nest_table_len

size_t const dict_nest_table_len = NUM_ELEMENTS(dict_nest_table)
static

Definition at line 74 of file dict_tokenize.c.