23 RCSID(
"$Id: 585cabd7744f9ca7c9811264663d88339b037cc2 $")
25 #include <freeradius-devel/util/dict_priv.h>
26 #include <freeradius-devel/util/print.h>
27 #include <freeradius-devel/util/proto.h>
34 #define FLAG_SET(_flag) if (flags->_flag) FR_SBUFF_IN_STRCPY_LITERAL_RETURN(&our_out, STRINGIFY(_flag)",")
137 if ((ancestor == da) || (da->depth == 0))
return 0;
145 if (ancestor && da->flags.is_unknown) {
148 ancestor = da_stack.
da[ancestor->depth - 1];
152 if (da_stack.
da[ancestor->depth - 1] != ancestor) {
153 fr_strerror_printf(
"Attribute '%s' is not a descendent of \"%s\"", da->name, ancestor->name);
156 depth = ancestor->depth;
165 for (i =
depth + 1; i < (int)da->depth; i++) {
171 for (i =
depth + 1; i < (int)da->depth; i++) {
195 our_uctx->
dict, da->type, &da->flags);
198 "[%02i] 0x%016" PRIxPTR
"%*s",
237 namespace = dict_attr_namespace(da);
271 *our_uctx->
flags = 0;
273 our_uctx->
dict, da->type, &da->flags);
fr_dcursor_eval_t void const * uctx
#define FR_FAULT_LOG(_fmt,...)
@ 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_walk(fr_dict_attr_t const *da, fr_dict_walk_t callback, void *uctx)
unsigned int extra
really "subtype is used by dict, not by protocol"
fr_dict_attr_t const * fr_dict_root(fr_dict_t const *dict)
Return the root attribute of a dictionary.
fr_value_box_t const * value
Enum value (what name maps to).
fr_dict_t const * fr_dict_by_da(fr_dict_attr_t const *da)
Attempt to locate the protocol dictionary containing an attribute.
@ FR_DICT_ATTR_EXT_ENUMV
Enumeration values.
unsigned int is_unsigned
hackity hack for dates and time deltas
char const * name
Enum name.
uint8_t subtype
protocol-specific values, OR key fields
uint8_t length
length of the attribute
Values of the encryption flags.
Value of an enumerated attribute.
static void * fr_dict_attr_ext(fr_dict_attr_t const *da, fr_dict_attr_ext_t ext)
fr_hash_table_t * name_by_value
Lookup a name by value.
Attribute extension - Holds enumeration values.
static void dict_attr_ext_debug(char const *name, fr_dict_attr_t const *da)
Print extension debug information for attributes.
static int dict_attr_export(fr_dict_attr_t const *da, void *uctx)
void fr_dict_namespace_debug(fr_dict_attr_t const *da)
ssize_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)
void fr_dict_debug(fr_dict_t const *dict)
static void fr_dict_attr_export(fr_dict_attr_t const *da)
ssize_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.
static int dict_attr_debug(fr_dict_attr_t const *da, void *uctx)
void fr_dict_export(fr_dict_t const *dict)
Export in the standard form: ATTRIBUTE name oid flags.
void fr_dict_attr_debug(fr_dict_attr_t const *da)
void * fr_hash_table_iter_init(fr_hash_table_t *ht, fr_hash_iter_t *iter)
Initialise an iterator.
void * fr_hash_table_iter_next(fr_hash_table_t *ht, fr_hash_iter_t *iter)
Iterate over entries in a hash table.
Stores the state of the current iteration operation.
@ FR_TYPE_TIME_DELTA
A period of time measured in nanoseconds.
@ FR_TYPE_DATE
Unix time stamp, always has value >2^31.
static size_t array[MY_ARRAY_SIZE]
static uint8_t depth(fr_minmax_heap_index_t i)
char * fr_asprintf(TALLOC_CTX *ctx, char const *fmt,...)
Special version of asprintf which implements custom format specifiers.
void fr_proto_da_stack_build(fr_da_stack_t *stack, fr_dict_attr_t const *da)
Build a complete DA stack from the da back to the root.
size_t fr_sbuff_trim(fr_sbuff_t *sbuff, bool const to_trim[static UINT8_MAX+1])
Trim trailing characters from a string we're composing.
#define FR_SBUFF_IN_CHAR_RETURN(_sbuff,...)
#define FR_SBUFF_IN_STRCPY_LITERAL_RETURN(_sbuff, _str)
#define FR_SBUFF_IN_SPRINTF_RETURN(...)
#define FR_SBUFF(_sbuff_or_marker)
#define FR_SBUFF_OUT(_start, _len_or_end)
#define fr_sbuff_used(_sbuff_or_marker)
#define FR_SBUFF_IN_STRCPY_RETURN(...)
PUBLIC int snprintf(char *string, size_t length, char *format, va_alist)
fr_aka_sim_id_type_t type
#define fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
fr_table_num_ordered_t const fr_time_precision_table[]
fr_dict_attr_t const * da[FR_DICT_MAX_TLV_STACK+1]
The stack.
Structure for holding the stack of dictionary attributes being encoded.
#define fr_strerror_printf(_fmt,...)
Log to thread local error buffer.
static char const * fr_type_to_str(fr_type_t type)
Return a static string containing the type name.
#define FR_TYPE_FIXED_SIZE
FR_SBUFF_SET_RETURN(sbuff, &our_sbuff)
static size_t char ** out