The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Functions
dict_unknown.c File Reference

Deal with 'unknown' attributes, creating ephemeral dictionary attributes for them. More...

#include <freeradius-devel/util/dict_priv.h>
+ Include dependency graph for dict_unknown.c:

Go to the source code of this file.

Functions

static fr_dict_attr_tdict_unknown_alloc (TALLOC_CTX *ctx, fr_dict_attr_t const *da, fr_type_t type)
 Allocate an unknown DA. More...
 
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. More...
 
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. More...
 
fr_dict_attr_t const * fr_dict_unknown_add (fr_dict_t *dict, fr_dict_attr_t const *unknown)
 Converts an unknown to a known by adding it to the internal dictionaries. More...
 
fr_dict_attr_tfr_dict_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. More...
 
fr_slen_t fr_dict_unknown_afrom_oid_substr (TALLOC_CTX *ctx, fr_dict_attr_t const **out, fr_dict_attr_t const *parent, fr_sbuff_t *in)
 Create a fr_dict_attr_t from an ASCII attribute and value. More...
 
fr_dict_attr_tfr_dict_unknown_attr_afrom_da (TALLOC_CTX *ctx, fr_dict_attr_t const *da)
 Initialise an octets type attribute from a da. More...
 
fr_dict_attr_tfr_dict_unknown_attr_afrom_num (TALLOC_CTX *ctx, fr_dict_attr_t const *parent, unsigned int num)
 Initialise a fr_dict_attr_t from a number. More...
 
void fr_dict_unknown_free (fr_dict_attr_t const **da)
 Free dynamically allocated (unknown attributes) More...
 
fr_dict_attr_tfr_dict_unknown_tlv_afrom_num (TALLOC_CTX *ctx, fr_dict_attr_t const *parent, unsigned int num)
 Initialise a fr_dict_attr_t from a number. More...
 
fr_dict_attr_tfr_dict_unknown_vendor_afrom_num (TALLOC_CTX *ctx, fr_dict_attr_t const *parent, unsigned int vendor)
 Build an unknown vendor, parented by a VSA attribute. More...
 

Detailed Description

Deal with 'unknown' attributes, creating ephemeral dictionary attributes for them.

Definition in file dict_unknown.c.

Function Documentation

◆ dict_unknown_alloc()

static fr_dict_attr_t* dict_unknown_alloc ( TALLOC_CTX *  ctx,
fr_dict_attr_t const *  da,
fr_type_t  type 
)
static

Allocate an unknown DA.

Definition at line 165 of file dict_unknown.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_dict_attr_unknown_parent_to_known()

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.

This can be useful where an unknown attribute's ancestors are added to a dictionary but not the unknown attribute itself.

Parameters
[in]dato fixup.
[in]parentto assign. If NULL, we will attempt to resolve the parent in the dictionary the current unknown attribute extends.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 536 of file dict_unknown.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_dict_attr_unknown_resolve()

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.

Parameters
[in]dictto search in.
[in]daNested tlv structure to convert.
Returns
  • NULL if we can't.
  • Known attribute if we can.

Definition at line 589 of file dict_unknown.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_dict_unknown_add()

fr_dict_attr_t const* fr_dict_unknown_add ( fr_dict_t dict,
fr_dict_attr_t const *  unknown 
)

Converts an unknown to a known by adding it to the internal dictionaries.

Does not free old fr_dict_attr_t, that is left up to the caller.

Parameters
[in]dictof protocol context we're operating in. If NULL the internal dictionary will be used.
[in]unknownattribute to add.
Returns
  • Existing fr_dict_attr_t if unknown was found in a dictionary.
  • A new entry representing unknown.

Definition at line 38 of file dict_unknown.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_dict_unknown_afrom_da()

fr_dict_attr_t* fr_dict_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.

Will copy the complete hierarchy down to the first known attribute.

Definition at line 226 of file dict_unknown.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_dict_unknown_afrom_oid_substr()

fr_slen_t fr_dict_unknown_afrom_oid_substr ( TALLOC_CTX *  ctx,
fr_dict_attr_t const **  out,
fr_dict_attr_t const *  parent,
fr_sbuff_t in 
)

Create a fr_dict_attr_t from an ASCII attribute and value.

Where the attribute name is in the form:

  • d
  • d.d.d...
Note
If vendor != 0, an unknown vendor (may) also be created, parented by the correct VSA attribute. This is accessible via vp->parent, and will be use the unknown da as its talloc parent.
Parameters
[in]ctxto alloc new attribute in.
[out]outWhere to write the head of the chain unknown dictionary attributes.
[in]parentAttribute to use as the root for resolving OIDs in. Usually the root of a protocol dictionary.
[in]inof attribute.
Returns
  • The number of bytes parsed on success.
  • <= 0 on failure. Negative offset indicates parse error position.

Definition at line 403 of file dict_unknown.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_dict_unknown_attr_afrom_da()

fr_dict_attr_t* fr_dict_unknown_attr_afrom_da ( TALLOC_CTX *  ctx,
fr_dict_attr_t const *  da 
)

Initialise an octets type attribute from a da.

Parameters
[in]ctxto allocate the attribute in.
[in]daof the unknown attribute.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 378 of file dict_unknown.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_dict_unknown_attr_afrom_num()

fr_dict_attr_t* fr_dict_unknown_attr_afrom_num ( TALLOC_CTX *  ctx,
fr_dict_attr_t const *  parent,
unsigned int  num 
)

Initialise a fr_dict_attr_t from a number.

Parameters
[in]ctxto allocate the attribute in.
[in]parentof the unknown attribute (may also be unknown).
[in]numof the unknown attribute.
Returns

Definition at line 345 of file dict_unknown.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_dict_unknown_free()

void fr_dict_unknown_free ( fr_dict_attr_t const **  da)

Free dynamically allocated (unknown attributes)

If the da was dynamically allocated it will be freed, else the function will return without doing anything.

Parameters
[in]dato free.

Definition at line 148 of file dict_unknown.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_dict_unknown_tlv_afrom_num()

fr_dict_attr_t* fr_dict_unknown_tlv_afrom_num ( TALLOC_CTX *  ctx,
fr_dict_attr_t const *  parent,
unsigned int  num 
)

Initialise a fr_dict_attr_t from a number.

Parameters
[in]ctxto allocate the attribute in.
[in]parentof the unknown attribute (may also be unknown).
[in]numof the unknown attribute.
Returns

Definition at line 312 of file dict_unknown.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_dict_unknown_vendor_afrom_num()

fr_dict_attr_t* fr_dict_unknown_vendor_afrom_num ( TALLOC_CTX *  ctx,
fr_dict_attr_t const *  parent,
unsigned int  vendor 
)

Build an unknown vendor, parented by a VSA attribute.

This allows us to complete the path back to the dictionary root in the case of unknown attributes with unknown vendors.

Note
Will return known vendors attributes where possible. Do not free directly, use fr_dict_unknown_free.
Parameters
[in]ctxto allocate the vendor attribute in.
[in]parentof the VSA attribute.
[in]vendorid.
Returns

Definition at line 272 of file dict_unknown.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: