24RCSID(
"$Id: df1316b79126ecc3dd47c94e497c1be401c45b45 $")
26#include <freeradius-devel/util/dict_priv.h>
46 void *ext_ptr,
UNUSED size_t ext_ptr_len)
59 TALLOC_CTX *chunk_dst,
61 UNUSED TALLOC_CTX
const *chunk_src,
108 if (da_dst->type != enumv->
value->
type) {
118 true,
true, key_child_ref) < 0)
return -1;
128 TALLOC_CTX *chunk_dst,
129 void *dst_ext_ptr,
UNUSED size_t dst_ext_len,
130 UNUSED TALLOC_CTX
const *chunk_src,
131 void *src_ext_ptr,
UNUSED size_t src_ext_len)
151 new_vendor = da_stack[old_vendor->depth];
152 if ((new_vendor->type == old_vendor->type) && (new_vendor->attr == old_vendor->attr)) {
153 dst_ext->
vendor = new_vendor;
165 for (da = da_dst->parent; da; da = da->parent) {
166 if ((da->type == old_vendor->type) && (da->attr == old_vendor->attr)) {
176 TALLOC_CTX *dst_chunk,
177 void *dst_ext_ptr,
size_t dst_ext_len,
178 TALLOC_CTX
const *src_chunk,
179 void *src_ext_ptr,
size_t src_ext_len)
192 if (from->dict != to->dict)
return 0;
197 if (
unlikely(from_proto->
attr.flags.len != src_ext_len)) {
198 fr_strerror_printf(
"Protocol specific extension length mismatch in source attribute %s. Expected %zu, got %zu",
204 if (
unlikely(to_proto->
attr.flags.len != dst_ext_len)) {
205 fr_strerror_printf(
"Protocol specific extension length mismatch in destintion attribute %s. Expected %zu, got %zu",
214 if (!to_proto->
attr.flags.copy) {
215 memcpy(dst_ext_ptr, src_ext_ptr, src_ext_len);
224 return to_proto->
attr.flags.copy(dst_chunk, dst_ext_ptr, src_ext_ptr);
232 TALLOC_CTX *chunk_dst,
233 void *dst_ext_ptr,
UNUSED size_t dst_ext_len,
234 UNUSED TALLOC_CTX
const *chunk_src,
235 void *src_ext_ptr,
UNUSED size_t src_ext_len)
245 fr_assert(da_dst->parent != src_ext->ref->parent);
250 da_dst->parent->name, src_ext->ref->name);
#define L(_str)
Helper for initialising arrays of string literals.
@ FR_DICT_ENUM_EXT_ATTR_REF
Reference to a child attribute associated with this key value.
fr_dict_protocol_t const * fr_dict_protocol(fr_dict_t const *dict)
Return the protocol descriptor for the dictionary.
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.
char const * name
Attribute name.
fr_value_box_t const * value
Enum value (what name maps to).
struct fr_dict_protocol_t::@127 attr
fr_dict_attr_t const * parent
Immediate parent of this attribute.
@ 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_KEY
UNION attribute references a key.
@ 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.
char const * name
Enum name.
fr_type_t type
Value type.
fr_dict_attr_t const * da
the child structure referenced by this value of key
Enum extension - Sub-struct or union pointer.
Value of an enumerated attribute.
Protocol-specific callbacks in libfreeradius-PROTOCOL.
fr_ext_t const fr_dict_attr_ext_def
Holds additional information about extension structures.
static int fr_dict_attr_ext_enumv_copy(UNUSED int ext, TALLOC_CTX *chunk_dst, UNUSED void *dst_ext_ptr, UNUSED size_t dst_ext_len, UNUSED TALLOC_CTX const *chunk_src, UNUSED void *src_ext_ptr, UNUSED size_t src_ext_len)
Copy all enumeration values from one attribute to another.
fr_ext_t const fr_dict_enum_ext_def
Holds additional information about extension structures.
static int fr_dict_attr_ext_vendor_copy(UNUSED int ext, TALLOC_CTX *chunk_dst, void *dst_ext_ptr, UNUSED size_t dst_ext_len, UNUSED TALLOC_CTX const *chunk_src, void *src_ext_ptr, UNUSED size_t src_ext_len)
Rediscover the parent of this attribute, and cache it.
static int fr_dict_attr_ext_key_copy(UNUSED int ext, TALLOC_CTX *chunk_dst, void *dst_ext_ptr, UNUSED size_t dst_ext_len, UNUSED TALLOC_CTX const *chunk_src, void *src_ext_ptr, UNUSED size_t src_ext_len)
Rediscover the key reference for this attribute, and cache it.
static size_t dict_attr_ext_table_len
static size_t dict_enum_ext_table_len
void fr_dict_attr_ext_debug(fr_dict_attr_t const *da)
static fr_table_num_ordered_t const dict_enum_ext_table[]
static int dict_ext_protocol_specific_copy(UNUSED int ext, TALLOC_CTX *dst_chunk, void *dst_ext_ptr, size_t dst_ext_len, TALLOC_CTX const *src_chunk, void *src_ext_ptr, size_t src_ext_len)
static fr_table_num_ordered_t const dict_attr_ext_table[]
static int fr_dict_attr_ext_name_fixup(UNUSED int ext, TALLOC_CTX *chunk, void *ext_ptr, UNUSED size_t ext_ptr_len)
Fixup name pointer on realloc.
static void * fr_dict_enum_ext(fr_dict_enum_value_t const *enumv, fr_dict_enum_ext_t ext)
fr_dict_attr_t const * vendor
ancestor which has type FR_TYPE_VENDOR
fr_hash_table_t * value_by_name
Lookup an enumeration value by name.
static fr_dict_attr_t const ** fr_dict_attr_da_stack(fr_dict_attr_t const *da)
Return the cached da stack (if any) associated with an attribute.
@ FR_DICT_ATTR_REF_KEY
it is a UNION which has a ref to a key, and children.
Attribute extension - Holds children for an attribute.
Attribute extension - Stack of dictionary attributes that describe the path back to the root of the d...
Attribute extension - Holds enumeration values.
Attribute extension - Holds a hash table with the names of all children of this attribute.
Attribute extension - Holds a reference to an attribute in another dictionary.
Attribute extension - Cached vendor pointer.
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)
void fr_ext_debug(fr_ext_t const *def, char const *name, void const *chunk)
Print out all extensions and hexdump their contents.
size_t offset_of_exts
Where in the extended struct the extensions array starts.
#define FR_EXT_ALIGNMENT
The alignment of object extension structures.
Additional information for a given extension.
Structure to define a set of extensions.
void * fr_hash_table_iter_next(fr_hash_table_t *ht, fr_hash_iter_t *iter)
Iterate over entries in a hash table.
void * fr_hash_table_iter_init(fr_hash_table_t *ht, fr_hash_iter_t *iter)
Initialise an iterator.
Stores the state of the current iteration operation.
An element in an arbitrarily ordered array of name to num mappings.
#define talloc_get_type_abort_const
#define fr_strerror_printf(_fmt,...)
Log to thread local error buffer.
@ FR_TYPE_UNION
A union of limited children.
#define fr_type_is_integer(_x)
int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t dst_type, fr_dict_attr_t const *dst_enumv, fr_value_box_t const *src)
Convert one type of fr_value_box_t to another.
fr_type_t _CONST type
Type and flags should appear together for packing efficiency.