24RCSID(
"$Id: 1fb87ee2b4cbfbd3872c89fe2e770ba0f065b72e $")
26#include <freeradius-devel/util/dict_priv.h>
45 void *ext_ptr,
UNUSED size_t ext_ptr_len)
58 TALLOC_CTX *chunk_dst,
60 UNUSED TALLOC_CTX
const *chunk_src,
107 if (da_dst->type != enumv->
value->
type) {
117 true,
true, key_child_ref) < 0)
return -1;
127 TALLOC_CTX *chunk_dst,
128 void *dst_ext_ptr,
UNUSED size_t dst_ext_len,
129 UNUSED TALLOC_CTX
const *chunk_src,
130 void *src_ext_ptr,
UNUSED size_t src_ext_len)
149 for (da = da_dst->parent; da; da = da->parent) {
150 if ((da->type == old_vendor->type) && (da->attr == old_vendor->attr)) {
160 TALLOC_CTX *dst_chunk,
161 void *dst_ext_ptr,
size_t dst_ext_len,
162 TALLOC_CTX
const *src_chunk,
163 void *src_ext_ptr,
size_t src_ext_len)
176 if (from->dict != to->dict)
return 0;
181 if (
unlikely(from_proto->
attr.flags.len != src_ext_len)) {
182 fr_strerror_printf(
"Protocol specific extension length mismatch in source attribute %s. Expected %zu, got %zu",
188 if (
unlikely(to_proto->
attr.flags.len != dst_ext_len)) {
189 fr_strerror_printf(
"Protocol specific extension length mismatch in destination attribute %s. Expected %zu, got %zu",
198 if (!to_proto->
attr.flags.copy) {
199 memcpy(dst_ext_ptr, src_ext_ptr, src_ext_len);
208 return to_proto->
attr.flags.copy(dst_chunk, dst_ext_ptr, src_ext_ptr);
216 TALLOC_CTX *chunk_dst,
217 void *dst_ext_ptr,
UNUSED size_t dst_ext_len,
218 UNUSED TALLOC_CTX
const *chunk_src,
219 void *src_ext_ptr,
UNUSED size_t src_ext_len)
229 fr_assert(da_dst->parent != src_ext->ref->parent);
234 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_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.
@ 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 - 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.