26 #include <freeradius-devel/libradius.h>
32 #ifdef WITH_VERIFY_PTR
33 # define VERIFY_DA(_x) fr_dict_verify(__FILE__, __LINE__, _x)
35 # define VERIFY_DA(_x) fr_assert(_x)
44 unsigned int internal : 1;
53 unsigned int virtual : 1;
113 #define FR_DICT_ENUM_MAX_NAME_LEN (128)
114 #define FR_DICT_VENDOR_MAX_NAME_LEN (128)
115 #define FR_DICT_ATTR_MAX_NAME_LEN (128)
119 #define FR_DICT_TLV_NEST_MAX (24)
123 #define FR_DICT_MAX_TLV_STACK (FR_DICT_TLV_NEST_MAX + 5)
127 #define FR_DICT_ATTR_SIZE (sizeof(fr_dict_attr_t) + FR_DICT_ATTR_MAX_NAME_LEN)
143 char const *dir,
char const *fn,
char const *
name);
166 unsigned int vendor,
unsigned int attr)
CC_HINT(nonnull);
169 unsigned int vendor,
unsigned int attr)
CC_HINT(nonnull);
191 unsigned int *vendor,
unsigned int *attr,
char const *oid);
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.
void fr_dict_unknown_free(fr_dict_attr_t const **da)
Free dynamically allocated (unknown attributes)
fr_dict_attr_t * fr_dict_unknown_afrom_fields(TALLOC_CTX *ctx, fr_dict_attr_t const *parent, unsigned int vendor, unsigned int attr) CC_HINT(nonnull)
Allocates an unknown attribute.
unsigned int array
Pack multiples into 1 attr.
void fr_dict_print(fr_dict_attr_t const *da, int depth)
int fr_dict_read(fr_dict_t *dict, char const *dir, char const *filename)
fr_dict_attr_t const ** children
Children of this attribute.
struct attr_flags fr_dict_attr_flags_t
Values of the encryption flags.
const size_t dict_attr_sizes[PW_TYPE_MAX][2]
Map data types to min / max data sizes.
uint8_t length
length of the attribute
fr_dict_attr_t const * da
Dictionary attribute enum is associated with.
size_t length
Length of length data.
int fr_dict_vendor_add(fr_dict_t *dict, char const *name, unsigned int value)
Add a vendor to the dictionary.
unsigned int is_pointer
data is a pointer
size_t flags
Vendor flags.
int fr_dict_attr_add(fr_dict_t *dict, fr_dict_attr_t const *parent, char const *name, int attr, PW_TYPE type, fr_dict_attr_flags_t flags)
Add an attribute to the dictionary.
Number of defined data types.
Values of the encryption flags.
char const * fr_dict_enum_name_by_da(fr_dict_t *dict, fr_dict_attr_t const *da, int value)
Lookup the name of an enum value in a fr_dict_attr_t.
unsigned int depth
Depth of nesting for this attribute.
struct dict_enum fr_dict_enum_t
Value of an enumerated attribute.
fr_dict_enum_t * fr_dict_enum_by_name(fr_dict_t *dict, fr_dict_attr_t const *da, char const *val)
fr_dict_attr_flags_t flags
Flags.
fr_dict_vendor_t const * fr_dict_vendor_by_num(fr_dict_t *dict, int vendor)
Look up a vendor by its PEN.
const int fr_dict_attr_allowed_chars[256]
Don't encrypt the attribute.
Vendors and attribute names.
int fr_dict_vendor_by_name(fr_dict_t *dict, char const *name)
Look up a vendor by its name.
void fr_dict_verify(char const *file, int line, fr_dict_attr_t const *da)
unsigned int is_unknown
Attribute number or vendor is unknown.
int fr_dict_valid_name(char const *name)
const FR_NAME_NUMBER dict_attr_types[]
Map data types to names representing those types.
unsigned int attr
Attribute number.
int fr_dict_oid_component(unsigned int *out, char const **oid)
Process a single OID component.
unsigned int vendor
Vendor that defines this attribute.
int fr_dict_enum_add(fr_dict_t *dict, char const *attr, char const *alias, int value)
int fr_dict_unknown_from_suboid(fr_dict_t *dict, fr_dict_attr_t *vendor_da, fr_dict_attr_t *da, fr_dict_attr_t const *parent, char const **name)
Create a dictionary attribute by name embedded in another string.
fr_dict_attr_t const * parent
Immediate parent of this attribute.
enum attr_flags::@0 encrypt
unsigned int is_root
Is root of a dictionary.
unsigned int concat
concatenate multiple instances
int fr_dict_unknown_from_fields(fr_dict_attr_t *da, fr_dict_attr_t const *parent, unsigned int vendor, unsigned int attr) CC_HINT(nonnull)
Initialises an unknown attribute.
Encrypt attribute RFC 2868 style.
fr_dict_attr_t const * next
Next child in bin.
fr_dict_attr_t const * fr_dict_attr_by_type(fr_dict_t *dict, unsigned int vendor, unsigned int attr, PW_TYPE type)
Lookup a attribute by its its vendor and attribute numbers and data type.
char name[1]
Attribute name.
struct dict_vendor fr_dict_vendor_t
Private enterprise.
Encrypt attribute RFC 2865 style.
Encrypt attribute ascend style.
size_t dict_print_attr_oid(char *buffer, size_t outlen, fr_dict_attr_t const *ancestor, fr_dict_attr_t const *da)
Build the tlv_stack for the specified DA and encode the path in OID form.
unsigned int vendorpec
Private enterprise number.
fr_dict_enum_t * fr_dict_enum_by_da(fr_dict_t *dict, fr_dict_attr_t const *da, int value)
Lookup the structure representing an enum value in a fr_dict_attr_t.
fr_dict_attr_t const * fr_dict_attr_by_name_substr(fr_dict_t *dict, char const **name)
Look up a dictionary attribute by a name embedded in another string.
fr_dict_attr_t const * fr_dict_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.
unsigned int has_tag
Tagged attribute.
int fr_dict_unknown_vendor_afrom_num(TALLOC_CTX *ctx, fr_dict_attr_t const **out, fr_dict_attr_t const *parent, unsigned int vendor)
Build an unknown vendor, parented by a VSA or EVS attribute.
size_t type
Length of type data.
fr_dict_attr_t const * fr_dict_parent_common(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.
int fr_dict_parse_str(fr_dict_t *dict, char *buf, fr_dict_attr_t const *parent, unsigned int vendor)
fr_dict_attr_t const * fr_dict_unknown_afrom_oid(TALLOC_CTX *ctx, fr_dict_t *dict, fr_dict_attr_t const *parent, char const *name)
Create a fr_dict_attr_t from an ASCII attribute and value.
uint8_t type_size
for TLV2, size of the type
fr_dict_attr_t const * fr_dict_attr_by_num(fr_dict_t *dict, unsigned int vendor, unsigned int attr)
Lookup a fr_dict_attr_t by its vendor and attribute numbers.
ssize_t fr_dict_attr_by_oid(fr_dict_t *dict, fr_dict_attr_t const **parent, unsigned int *vendor, unsigned int *attr, char const *oid)
Get the leaf attribute of an OID string.
int fr_dict_unknown_from_oid(fr_dict_t *dict, fr_dict_attr_t *vendor_da, fr_dict_attr_t *da, fr_dict_attr_t const *parent, char const *name)
Initialise a fr_dict_attr_t from an ASCII attribute and value.
fr_dict_t * fr_dict_internal
Internal server dictionary.
fr_dict_attr_t const * fr_dict_root(fr_dict_t const *dict)
Return the root attribute of a dictionary.
int fr_dict_str_to_argv(char *str, char **argv, int max_argc)
unsigned int compare
has a paircompare registered
Value of an enumerated attribute.
int fr_dict_init(TALLOC_CTX *ctx, fr_dict_t **out, char const *dir, char const *fn, char const *name)
(re)initialize a protocol dictionary
fr_dict_attr_t const * fr_dict_attr_child_by_da(fr_dict_attr_t const *parent, fr_dict_attr_t const *child)
Check if a child attribute exists in a parent using a pointer (da)
PW_TYPE
Internal data types used within libfreeradius.
fr_dict_attr_t const * fr_dict_attr_by_name(fr_dict_t *dict, char const *attr)
Locate a fr_dict_attr_t by its name.
unsigned int has_value
Has a value.