24 RCSIDH(dict_h,
"$Id: 4a6c6989443e9b12c2ff42c9c0a9c1bbf3dd6b38 $")
30 #include <freeradius-devel/build.h>
31 #include <freeradius-devel/missing.h>
32 #include <freeradius-devel/util/dl.h>
33 #include <freeradius-devel/util/ext.h>
34 #include <freeradius-devel/util/rb.h>
35 #include <freeradius-devel/util/sbuff.h>
36 #include <freeradius-devel/util/table.h>
37 #include <freeradius-devel/util/talloc.h>
38 #include <freeradius-devel/util/types.h>
55 # error _CONST can only be defined in the local header
63 #ifdef WITH_VERIFY_PTR
64 # define DA_VERIFY(_x) fr_dict_attr_verify(__FILE__, __LINE__, _x)
66 # define DA_VERIFY(_x) fr_cond_assert(_x)
114 unsigned int local : 1;
138 #define flag_time_res type_size
139 #define flag_byte_offset type_size
152 #define fr_dict_attr_is_key_field(_da) ((_da)->flags.extra && ((_da)->flags.subtype == FLAG_KEY_FIELD))
153 #define da_is_bit_field(_da) ((_da)->flags.extra && ((_da)->flags.subtype == FLAG_BIT_FIELD))
154 #define da_is_length_field(_da) ((_da)->flags.extra && (((_da)->flags.subtype == FLAG_LENGTH_UINT8) || ((_da)->flags.subtype == FLAG_LENGTH_UINT16)))
155 #define da_length_offset(_da) ((_da)->flags.type_size)
406 #define FR_DICT_ATTR_FLAG_FUNC(_struct, _name) \
407 static int dict_flag_##_name(fr_dict_attr_t **da_p, UNUSED char const *value, UNUSED fr_dict_flag_parser_rule_t const *rules)\
409 _struct *flags = fr_dict_attr_ext(*da_p, FR_DICT_ATTR_EXT_PROTOCOL_SPECIFIC); \
420 # define FR_DICT_PROTOCOL_FLAG(_struct, _field) \
421 .type = FR_CTYPE_TO_TYPE((((_struct *)NULL)->_field)), \
422 .offset = offsetof(_struct, _field)
469 #define FR_DICT_PROTO_MAX_NAME_LEN (128)
470 #define FR_DICT_ENUM_MAX_NAME_LEN (128)
471 #define FR_DICT_VENDOR_MAX_NAME_LEN (128)
472 #define FR_DICT_ATTR_MAX_NAME_LEN (128)
476 #define FR_DICT_TLV_NEST_MAX (24)
480 #define FR_DICT_DA_STACK_CACHE_MAX (5)
492 #define FR_DICT_MAX_TLV_STACK (FR_DICT_TLV_NEST_MAX + 5)
508 #include <freeradius-devel/util/dict_ext.h>
611 if (a->flags.is_unknown | a->flags.is_raw | b->flags.is_unknown | b->flags.is_raw) {
612 ret =
CMP(a->depth, b->depth);
613 if (ret != 0)
return ret;
615 ret =
CMP(a->attr, b->attr);
616 if (ret != 0)
return ret;
618 ret = (a->parent == NULL) - (b->parent == NULL);
619 if ((ret != 0) || !a->parent)
return ret;
651 if (ret != 0)
return ret;
653 ret =
CMP(a->attr, b->attr);
654 if (ret != 0)
return ret;
656 ret =
CMP(a->parent, b->parent);
657 if (ret != 0)
return ret;
660 if (ret != 0)
return ret;
665 if (a_proto->
attr.flags.cmp && (ret = a_proto->
attr.flags.cmp(a, b)))
return ret;
667 return CMP(memcmp(&a->flags, &b->flags,
sizeof(a->flags)), 0);
697 #define FR_DICT_ATTR_OID_PRINT_RETURN(...) FR_SBUFF_RETURN(fr_dict_attr_oid_print, ##__VA_ARGS__)
700 unsigned int *attr,
char const *oid) CC_HINT(
nonnull);
757 return da->parent->flags.is_root;
771 bool internal,
bool foreign)
777 bool internal,
bool foreign)
783 bool internal,
bool foreign)
787 fr_dict_t const *dict_def,
char const *attr,
788 bool internal,
bool foreign)
794 bool internal,
bool foreign)
829 char const *dependent);
832 char const *dependent);
847 #define fr_dict_autoload(_to_load) _fr_dict_autoload(_to_load, __FILE__)
850 #define fr_dict_autofree(_to_free) _fr_dict_autofree(_to_free, __FILE__)
853 #define fr_dict_autoload_talloc(_ctx, _dict_out, _proto) _fr_dict_autoload_talloc(_ctx, _dict_out, _proto, __FILE__)
#define CMP(_a, _b)
Same as CMP_PREFER_SMALLER use when you don't really care about ordering, you just want an ordering.
fr_dcursor_eval_t void const * uctx
fr_table_elem_name_t name
Name of the flag.
bool continuation
we only have one flag for now, for WiMAX
fr_dict_t * fr_dict_global_ctx_iter_init(fr_dict_global_ctx_iter_t *iter)
Iterate protocols by name.
size_t type
Length of type data.
fr_dict_attr_t const * fr_dict_attr_by_oid(fr_dict_attr_err_t *err, fr_dict_attr_t const *parent, char const *oid))
Resolve an attribute using an OID string.
void fr_dict_global_ctx_debug(fr_dict_gctx_t const *gctx)
Dump information about currently loaded dictionaries.
dl_t * fr_dict_dl(fr_dict_t const *dict)
static fr_dict_attr_t * fr_dict_attr_unknown_copy(TALLOC_CTX *ctx, fr_dict_attr_t const *da)
char const * fr_dict_global_ctx_dir(void)
fr_dict_protocol_free_t free
free the library
size_t name_len
Allows for efficient name lookups when operating on partial buffers.
fr_dict_attr_flags_t flags
Flags.
fr_dict_attr_decode_func_t decode
for decoding attributes.
int(* fr_dict_flag_parse_func_t)(fr_dict_attr_t **da_p, UNUSED char const *value, UNUSED fr_dict_flag_parser_rule_t const *rule)
Custom protocol-specific flag parsing function.
fr_slen_t fr_dict_attr_by_name_substr(fr_dict_attr_err_t *err, fr_dict_attr_t const **out, fr_dict_attr_t const *parent, fr_sbuff_t *name, fr_sbuff_term_t const *tt))
fr_dict_attr_t const * fr_dict_attr_unknown_add(fr_dict_t *dict, fr_dict_attr_t const *old)
Converts an unknown to a known by adding it to the internal dictionaries.
int fr_dict_attr_add_initialised(fr_dict_attr_t *da)
A variant of fr_dict_attr_t that allows a pre-allocated, populated fr_dict_attr_t to be added.
char const * name
of the attribute.
@ FLAG_EXTRA_NONE
no extra meaning, should be invalid
@ FLAG_LENGTH_UINT8
string / octets type is prefixed by uint8 of length
@ FLAG_LENGTH_UINT16
string / octets type is prefixed by uint16 of length
@ FLAG_KEY_FIELD
this is a key field for a subsequent struct
@ FLAG_BIT_FIELD
bit field inside of a struct
int fr_dict_internal_afrom_file(fr_dict_t **out, char const *internal_name, char const *dependent)
(Re-)Initialize the special internal dictionary
unsigned int name_only
this attribute should always be referred to by name.
ssize_t fr_dict_valid_oid_str(char const *name, ssize_t len)
int fr_dict_global_ctx_dir_set(char const *dict_dir)
Allow the default dict dir to be changed after initialisation.
fr_slen_t fr_dict_enum_name_from_substr(fr_sbuff_t *out, fr_sbuff_parse_error_t *err, fr_sbuff_t *in, fr_sbuff_term_t const *tt)
Extract an enumeration name from a string.
int fr_dict_enum_add_name(fr_dict_attr_t *da, char const *name, fr_value_box_t const *value, bool coerce, bool replace)
Add a value name.
unsigned int has_value
Has a value.
fr_dict_enum_ext_t
Extension identifier.
@ FR_DICT_ENUM_EXT_UNION_REF
Reference to a union/subs-struct.
fr_slen_t fr_dict_attr_oid_print(fr_sbuff_t *out, fr_dict_attr_t const *ancestor, fr_dict_attr_t const *da, bool numeric)
Build the da_stack for the specified DA and encode the path by name in OID form.
int fr_dict_attr_add_name_only(fr_dict_t *dict, fr_dict_attr_t const *parent, char const *name, fr_type_t type, fr_dict_attr_flags_t const *flags))
Add an attribute to the dictionary.
char const * name
Vendor name.
fr_dict_attr_t * fr_dict_attr_unconst(fr_dict_attr_t const *da)
Coerce to non-const.
char const * filename
Where the attribute was defined.
void * uctx
Use context to pass to the custom parsing function.
fr_dict_attr_t const * fr_dict_attr_search_by_qualified_oid(fr_dict_attr_err_t *err, fr_dict_t const *dict_def, char const *attr, bool internal, bool foreign))
Locate a qualified fr_dict_attr_t by its name and a dictionary qualifier.
fr_dict_attr_t const ** attr
The protocol dictionary the attribute should be resolved in.
fr_dict_vendor_t const * fr_dict_vendor_by_num(fr_dict_t const *dict, uint32_t vendor_pen)
Look up a vendor by its PEN.
unsigned int is_root
Is root of a dictionary.
int fr_dict_enum_autoload(fr_dict_enum_autoload_t const *to_load)
Process a dict_attr_autoload element to load/verify a dictionary attribute.
int _fr_dict_autofree(fr_dict_autoload_t const *to_free, char const *dependent)
Decrement the reference count on a previously loaded dictionary.
int fr_dict_walk(fr_dict_attr_t const *da, fr_dict_walk_t callback, void *uctx)
fr_dict_t * fr_dict_protocol_alloc(fr_dict_t const *parent)
Allocate a new local dictionary.
size_t name_len
Length of the name.
int line
Line number where the attribute was defined.
bool(* fr_dict_attr_valid_func_t)(fr_dict_attr_t *da)
int fr_dl_dict_enum_autoload(dl_t const *module, void *symbol, void *user_ctx)
fr_dict_attr_t * fr_dict_attr_unknown_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t const *da))
Copy a known or unknown attribute to produce an unknown attribute with the specified name.
void fr_dict_namespace_debug(fr_dict_attr_t const *da)
fr_dict_attr_t const * fr_dict_attr_by_name(fr_dict_attr_err_t *err, fr_dict_attr_t const *parent, char const *attr))
Locate a fr_dict_attr_t by its name.
fr_dict_t * fr_dict_alloc(char const *proto_name, unsigned int proto_number)
bool const fr_dict_attr_allowed_chars[UINT8_MAX+1]
Characters that are allowed in dictionary attribute names.
ssize_t(* fr_dict_attr_encode_func_t)(fr_dbuff_t *dbuff, fr_pair_list_t const *vps)
A generic interface for encoding fr_pair_ts to packets.
int fr_dict_attr_acopy_local(fr_dict_attr_t const *dst, fr_dict_attr_t const *src)
bool fr_dict_compatible(fr_dict_t const *dict1, fr_dict_t const *dict2)
See if two dictionaries have the same end parent.
int(* fr_dict_flags_cmp_func_t)(fr_dict_attr_t const *da_a, fr_dict_attr_t const *da_b)
Compare the protocol specific flags struct from two attributes.
fr_value_box_t const ** out
Enumeration value.
fr_dict_attr_t const * fr_dict_attr_common_parent(fr_dict_attr_t const *a, fr_dict_attr_t const *b, bool is_ancestor)
Find a common ancestor that two TLV type attributes share.
fr_dict_t const ** dict
The protocol dictionary the attribute should be resolved in.
fr_slen_t fr_dict_attr_by_oid_substr(fr_dict_attr_err_t *err, fr_dict_attr_t const **out, fr_dict_attr_t const *parent, fr_sbuff_t *in, fr_sbuff_term_t const *tt))
Resolve an attribute using an OID string.
fr_dict_attr_t const * fr_dict_vendor_da_by_num(fr_dict_attr_t const *vendor_root, uint32_t vendor_pen)
Return vendor attribute for the specified dictionary and pen.
void fr_dict_attr_verify(char const *file, int line, fr_dict_attr_t const *da)
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_str_to_argv(char *str, char **argv, int max_argc)
bool fr_dict_attr_can_contain(fr_dict_attr_t const *parent, fr_dict_attr_t const *child)
See if a structural da is allowed to contain another da.
static fr_dict_attr_t * fr_dict_attr_unknown_vendor_afrom_num(TALLOC_CTX *ctx, fr_dict_attr_t const *parent, unsigned int vendor)
fr_slen_t fr_dict_attr_flags_print(fr_sbuff_t *out, fr_dict_t const *dict, fr_type_t type, fr_dict_attr_flags_t const *flags)
fr_dict_t const * fr_dict_by_protocol_num(unsigned int num)
Lookup a protocol by its number.
fr_dict_t const * fr_dict_by_protocol_name(char const *name)
Lookup a protocol by its name.
int(* fr_dict_walk_t)(fr_dict_attr_t const *da, void *uctx)
fr_dict_attr_t const * fr_dict_attr_iterate_children(fr_dict_attr_t const *parent, fr_dict_attr_t const **prev)
Iterate over children of a DA.
struct dict_attr_s::@120 state
unsigned int array
Pack multiples into 1 attr.
fr_dict_enum_value_t * fr_dict_enum_by_value(fr_dict_attr_t const *da, fr_value_box_t const *value)
Lookup the structure representing an enum value in a fr_dict_attr_t.
unsigned int secret
this attribute should be omitted in debug mode
void fr_dict_debug(fr_dict_t const *dict)
fr_dict_flag_parse_func_t func
Custom parsing function to convert a flag value string to a C type value.
unsigned int extra
really "subtype is used by dict, not by protocol"
unsigned int internal
Internal attribute, should not be received in protocol packets, should not be encoded.
fr_dict_attr_t const ** out
Where to write a pointer to the resolved fr_dict_attr_t.
fr_dict_t const * fr_dict_by_attr_name(fr_dict_attr_t const **found, char const *name)
fr_dict_t const ** out
Where to write a pointer to the loaded/resolved fr_dict_t.
void fr_dict_global_ctx_set(fr_dict_gctx_t const *gctx)
Set a new, active, global dictionary context.
fr_dict_attr_t const * next
Next child in bin.
fr_dict_t _CONST *_CONST dict
Dict attribute belongs to.
fr_slen_t fr_dict_attr_search_by_oid_substr(fr_dict_attr_err_t *err, fr_dict_attr_t const **out, fr_dict_t const *dict_def, fr_sbuff_t *in, fr_sbuff_term_t const *tt, bool internal, bool foreign))
Locate a qualified fr_dict_attr_t by a dictionary using a non-qualified OID string.
char const * name
Attribute name.
fr_dict_protocol_init_t init
initialize the library
unsigned int is_raw
This dictionary attribute was constructed from a known attribute to allow the user to assign octets v...
fr_slen_t fr_dict_attr_by_oid_legacy(fr_dict_t const *dict, fr_dict_attr_t const **parent, unsigned int *attr, char const *oid)
Get the leaf attribute of an OID string.
fr_dict_attr_t const * fr_dict_root(fr_dict_t const *dict)
Return the root attribute of a dictionary.
bool const fr_dict_enum_allowed_chars[UINT8_MAX+1]
Characters that are allowed in dictionary enumeration value names.
int fr_dict_attr_unknown_parent_to_known(fr_dict_attr_t *da, fr_dict_attr_t const *parent)
Fixup the parent of an unknown attribute using an equivalent known attribute.
char const * name
of the attribute.
fr_value_box_t const * value
Enum value (what name maps to).
unsigned int attr
Attribute number.
int fr_dict_enum_add_name_next(fr_dict_attr_t *da, char const *name)
Add an name to an integer attribute hashing the name for the integer value.
uint8_t ext[FR_DICT_ATTR_EXT_MAX]
Extensions to the dictionary attribute.
int(* fr_dict_flags_copy_func_t)(fr_dict_attr_t *da_to, void *flags_to, void *flags_from)
Copy custom flags from one attribute to another.
int default_type_size
how many octets are in "type" field
uint32_t pen
Private enterprise number.
int fr_dict_free(fr_dict_t **dict, char const *dependent)
Decrement the reference count on a previously loaded dictionary.
void fr_dict_attr_unknown_free(fr_dict_attr_t const **da)
Free dynamically allocated (unknown attributes)
fr_type_t type
of the attribute. Mismatch is a fatal error.
fr_dict_flag_parser_rule_t value
Function and context to parse the flag.
fr_dict_t const * fr_dict_by_da(fr_dict_attr_t const *da)
Attempt to locate the protocol dictionary containing an attribute.
int fr_dict_oid_component_legacy(unsigned int *out, char const **oid)
Process a single OID component.
fr_slen_t fr_dict_enum_by_name_substr(fr_dict_enum_value_t **out, fr_dict_attr_t const *da, fr_sbuff_t *in)
void fr_dict_global_ctx_perm_check(fr_dict_gctx_t *gctx, bool enable)
Set whether we check dictionary file permissions.
void fr_dict_global_ctx_read_only(void)
Mark all dictionaries and the global dictionary ctx as read only.
uint8_t type_size
For TLV2 and root attributes.
unsigned int depth
Depth of nesting for this attribute.
int fr_dict_const_free(fr_dict_t const **dict, char const *dependent)
Decrement the reference count on a previously loaded dictionary.
int fr_dict_attr_autoload(fr_dict_attr_autoload_t const *to_load)
Process a dict_attr_autoload element to load/verify a dictionary attribute.
static fr_dict_attr_t * fr_dict_attr_unknown_raw_afrom_num(TALLOC_CTX *ctx, fr_dict_attr_t const *parent, unsigned int attr)
fr_slen_t fr_dict_by_protocol_substr(fr_dict_attr_err_t *err, fr_dict_t const **out, fr_sbuff_t *name, fr_dict_t const *dict_def)
Look up a protocol name embedded in another string.
int fr_dict_dependent_add(fr_dict_t const *dict, char const *dependent)
Manually increase the reference count for a dictionary.
fr_slen_t fr_dict_attr_search_by_qualified_name_substr(fr_dict_attr_err_t *err, fr_dict_attr_t const **out, fr_dict_t const *dict_def, fr_sbuff_t *name, fr_sbuff_term_t const *tt, bool internal, bool foreign))
Locate a qualified fr_dict_attr_t by its name and a dictionary qualifier.
size_t length
Length of length data.
bool fr_dict_is_read_only(fr_dict_t const *dict)
char const * base_dir
Directory structure beneath share.
fr_dict_attr_t const * parent
Immediate parent of this attribute.
fr_slen_t fr_dict_attr_unknown_afrom_oid_substr(TALLOC_CTX *ctx, fr_dict_attr_t const **out, fr_dict_attr_t const *parent, fr_sbuff_t *in, fr_type_t type))
Create a fr_dict_attr_t from an ASCII attribute and value.
fr_dict_enum_value_t * fr_dict_enum_by_name(fr_dict_attr_t const *da, char const *name, ssize_t len)
static fr_dict_attr_t * fr_dict_attr_unknown_typed_afrom_num(TALLOC_CTX *ctx, fr_dict_attr_t const *parent, unsigned int num, fr_type_t type)
fr_dict_attr_t * fr_dict_attr_unknown_raw_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t const *da))
Initialise an octets type attribute from a da.
fr_dict_t const * fr_dict_internal(void)
fr_dict_t * fr_dict_unconst(fr_dict_t const *dict)
Coerce to non-const.
fr_slen_t fr_dict_attr_search_by_name_substr(fr_dict_attr_err_t *err, fr_dict_attr_t const **out, fr_dict_t const *dict_def, fr_sbuff_t *name, fr_sbuff_term_t const *tt, bool internal, bool foreign))
Locate a fr_dict_attr_t by its name in the top level namespace of a dictionary.
static bool fr_dict_attr_is_top_level(fr_dict_attr_t const *da)
Return true if this attribute is parented directly off the dictionary root.
void(* fr_dict_protocol_free_t)(void)
fr_dict_attr_encode_func_t encode
for encoding attributes.
fr_dict_attr_ext_t
Extension identifier.
@ FR_DICT_ATTR_EXT_PROTOCOL_SPECIFIC
Protocol specific extensions.
@ FR_DICT_ATTR_EXT_ENUMV
Enumeration values.
@ FR_DICT_ATTR_EXT_NAMESPACE
Attribute has its own namespace.
@ FR_DICT_ATTR_EXT_DA_STACK
Cached da stack.
@ FR_DICT_ATTR_EXT_REF
Attribute references another attribute and/or dictionary.
@ FR_DICT_ATTR_EXT_VENDOR
Cached vendor pointer.
@ FR_DICT_ATTR_EXT_NAME
Name of the attribute.
@ FR_DICT_ATTR_EXT_CHILDREN
Attribute has children.
fr_dict_autoload_talloc_t * _fr_dict_autoload_talloc(TALLOC_CTX *ctx, fr_dict_t const **out, char const *proto, char const *dependent)
Autoload a dictionary and bind the lifetime to a talloc chunk.
fr_dict_attr_t const * fr_dict_attr_unknown_resolve(fr_dict_t const *dict, fr_dict_attr_t const *da)
Check to see if we can convert a nested TLV structure to known attributes.
static fr_slen_t fr_dict_enum_name_afrom_substr(TALLOC_CTX *ctx, char **out, fr_sbuff_parse_error_t *err, fr_sbuff_t *in, fr_sbuff_term_t const *tt) 1(fr_dict_enum_name_from_substr
unsigned int last_child_attr
highest value of last child attribute.
int fr_dict_global_ctx_free(fr_dict_gctx_t const *gctx)
Explicitly free all data associated with a global dictionary context.
unsigned int is_known_width
is treated as if it has a known width for structs
int fr_dict_parse_str(fr_dict_t *dict, char *buf, fr_dict_attr_t const *parent)
int fr_dict_read(fr_dict_t *dict, char const *dict_dir, char const *filename)
Read supplementary attribute definitions into an existing dictionary.
void fr_dl_dict_autofree(dl_t const *module, void *symbol, void *user_ctx)
fr_dict_vendor_t const * fr_dict_vendor_by_da(fr_dict_attr_t const *da)
Look up a vendor by one of its child attributes.
int default_type_length
how many octets are in "length" field
fr_dict_attr_err_t
Errors returned by attribute lookup functions.
@ FR_DICT_ATTR_OK
No error.
@ FR_DICT_ATTR_NOT_ANCESTOR
Attribute is not an ancestor of the child attribute.
@ FR_DICT_ATTR_NOT_DESCENDENT
Attribute is not a descendent of the parent attribute.
@ FR_DICT_ATTR_NOTFOUND
Attribute couldn't be found.
@ FR_DICT_ATTR_EINVAL
Invalid arguments.
@ FR_DICT_ATTR_PROTOCOL_NOTFOUND
Protocol couldn't be found.
@ FR_DICT_ATTR_NO_CHILDREN
Child lookup in attribute with no children.
@ FR_DICT_ATTR_OOM
Memory allocation error.
@ FR_DICT_ATTR_PARSE_ERROR
Attribute string couldn't be parsed.
@ FR_DICT_ATTR_INTERNAL_ERROR
Internal error occurred.
fr_slen_t fr_dict_attr_search_by_qualified_oid_substr(fr_dict_attr_err_t *err, fr_dict_attr_t const **out, fr_dict_t const *dict_def, fr_sbuff_t *in, fr_sbuff_term_t const *tt, bool internal, bool foreign))
Locate a qualified fr_dict_attr_t by a dictionary qualified OID string.
int(* fr_dict_protocol_init_t)(void)
Init / free callbacks.
bool needs_value
This parsing flag must have a value. Else we error.
struct fr_dict_protocol_t::@121 attr
int fr_dict_attr_add(fr_dict_t *dict, fr_dict_attr_t const *parent, char const *name, unsigned int attr, fr_type_t type, fr_dict_attr_flags_t const *flags))
Add an attribute to the dictionary.
fr_dict_attr_t const * fr_dict_unlocal(fr_dict_attr_t const *da)
fr_dict_t * fr_dict_global_ctx_iter_next(fr_dict_global_ctx_iter_t *iter)
int _fr_dict_autoload(fr_dict_autoload_t const *to_load, char const *dependent)
Process a dict_autoload element to load a protocol.
unsigned int is_unsigned
hackity hack for dates and time deltas
int fr_dl_dict_autoload(dl_t const *module, void *symbol, void *user_ctx)
ssize_t fr_dict_valid_name(char const *name, ssize_t len)
fr_slen_t fr_dict_oid_component(fr_dict_attr_err_t *err, fr_dict_attr_t const **out, fr_dict_attr_t const *parent, fr_sbuff_t *in, fr_sbuff_term_t const *tt))
Parse an OID component, resolving it to a defined attribute.
ssize_t(* fr_dict_attr_decode_func_t)(TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t const *data, size_t data_len)
A generic interface for decoding packets to fr_pair_ts.
void fr_dict_export(fr_dict_t const *dict)
Export in the standard form: ATTRIBUTE name oid flags.
fr_dict_attr_t const * fr_dict_attr_child_by_num(fr_dict_attr_t const *parent, unsigned int attr)
Check if a child attribute exists in a parent using an attribute number.
char const * proto
The protocol dictionary name.
fr_dict_vendor_t const * fr_dict_vendor_by_name(fr_dict_t const *dict, char const *name)
Look up a vendor by its name.
void fr_dict_attr_debug(fr_dict_attr_t const *da)
char const * name
Enum name.
fr_type_t type
Value type.
fr_dict_protocol_t const * fr_dict_protocol(fr_dict_t const *dict)
Return the protocol descriptor for the dictionary.
char const * name
name of this protocol
uint8_t subtype
protocol-specific values, OR key fields
static int8_t fr_dict_attr_cmp_fields(const fr_dict_attr_t *a, const fr_dict_attr_t *b)
Compare two dictionary attributes by their contents.
fr_dict_attr_t * fr_dict_attr_unknown_typed_afrom_num_raw(TALLOC_CTX *ctx, fr_dict_attr_t const *parent, unsigned int num, fr_type_t type, bool raw))
Initialise a fr_dict_attr_t from a number and a data type.
uint8_t length
length of the attribute
unsigned int is_alias
This isn't a real attribute, it's a reference to to one.
char const * fr_dict_enum_name_by_value(fr_dict_attr_t const *da, fr_value_box_t const *value)
Lookup the name of an enum value in a fr_dict_attr_t.
fr_dict_gctx_t * fr_dict_global_ctx_init(TALLOC_CTX *ctx, bool free_at_exit, char const *dict_dir)
Initialise the global protocol hashes.
unsigned int counter
integer attribute is actually an impulse / counter
unsigned int is_unknown
This dictionary attribute is ephemeral and not part of the main dictionary.
int fr_dl_dict_attr_autoload(dl_t const *module, void *symbol, void *user_ctx)
static int8_t fr_dict_attr_cmp(fr_dict_attr_t const *a, fr_dict_attr_t const *b)
Specifies an attribute which must be present for the module to function.
Values of the encryption flags.
Specifies a dictionary which must be loaded/loadable for the module to function.
Specifies a value which must be present for the module to function.
Value of an enumerated attribute.
Protocol specific custom flag definitnion.
Protocol-specific callbacks in libfreeradius-PROTOCOL.
static uint32_t fr_dict_vendor_num_by_da(fr_dict_attr_t const *da)
Return the vendor number for an attribute.
bool free_at_exit
This gctx will be freed on exit.
Vendors and attribute names.
Structure used to managed the lifetime of a dictionary.
#define FR_EXT_ALIGNMENT
The alignment of object extension structures.
Stores the state of the current iteration operation.
@ FR_TYPE_VENDOR
Attribute that represents a vendor in the attribute tree.
@ FR_TYPE_OCTETS
Raw octets.
static char const * proto(int id, int porttype)
#define SBUFF_OUT_TALLOC_FUNC_NO_LEN_DEF(_func,...)
Set of terminal elements.
fr_aka_sim_id_type_t type
static size_t char ** out
Union containing all data types supported by the server.