![]() |
The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
|
Parse attribute value pairs from text. More...
#include <freeradius-devel/util/pair.h>#include <freeradius-devel/util/value.h>
Include dependency graph for pair_tokenize.c:Go to the source code of this file.
Functions | |
| fr_slen_t | fr_pair_ctx_afrom_substr (fr_pair_ctx_t *pair_ctx, fr_sbuff_t *in) |
| Parse one pair, or one context change, from a string. | |
| void | fr_pair_ctx_reset (fr_pair_ctx_t *pair_ctx, fr_dict_t const *dict) |
| Reset a pair_ctx to the dictionary root. | |
| static fr_slen_t | pair_afrom_substr (fr_pair_ctx_t *pair_ctx, fr_sbuff_t *in) |
Parse Attribute op value and append the pair to pair_ctx->list. | |
| static fr_slen_t | pair_ctx_set_from_substr (fr_pair_ctx_t *pair_ctx, fr_sbuff_t *in) |
| Set a new parent from a dotted attribute reference. | |
Variables | |
| fr_table_num_sorted_t const | fr_pair_comparison_op_table [] |
| Operators that may appear between an attribute name and a value. | |
| size_t | fr_pair_comparison_op_table_len = NUM_ELEMENTS(fr_pair_comparison_op_table) |
| static fr_sbuff_parse_rules_t const | pair_value_bareword_rules |
| A bare word value ends at whitespace or at the comma before the next pair. | |
Parse attribute value pairs from text.
Definition in file pair_tokenize.c.
| fr_slen_t fr_pair_ctx_afrom_substr | ( | fr_pair_ctx_t * | pair_ctx, |
| fr_sbuff_t * | in | ||
| ) |
Parse one pair, or one context change, from a string.
The function stops at the end of the input or at a comma. The comma remains in the buffer for the caller.
The syntax is:
Attribute = value The function resets the context to the parent of Attribute, a top level attribute, then parses the attribute and the value.Attribute The function resets the context to Attribute, a top level structural attribute (a group, a TLV, or a struct).Attribute.Child The function resets the context to Child, where each component is a structural attribute and a direct child of the component before..Attribute = value, .Attribute and .Attribute.Child As above, with the lookup starting at the current context...Attribute = value, ..Attribute and ..Attribute.Child As above, with the lookup starting at the parent of the current context. Each further '.' starts one level further up, and a reference of dots alone only moves the context up.| [in,out] | pair_ctx | the parsing context. |
| [in,out] | in | to parse. Advanced past what was parsed on success. |
Definition at line 228 of file pair_tokenize.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void fr_pair_ctx_reset | ( | fr_pair_ctx_t * | pair_ctx, |
| fr_dict_t const * | dict | ||
| ) |
Reset a pair_ctx to the dictionary root.
Callers reset the context when the parsed text switches to a different attribute list, for example from request.foo to reply.bar.
The function will need to reset child contexts once pairs store children in vp->vp_children.
| [in,out] | pair_ctx | the parsing context. |
| [in] | dict | whose root becomes the parent. |
Definition at line 320 of file pair_tokenize.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Parse Attribute op value and append the pair to pair_ctx->list.
The function looks the attribute name up under pair_ctx->parent, and the attribute must be a direct child of pair_ctx->parent.
| [in,out] | pair_ctx | the parsing context. |
| [in,out] | in | to parse. Advanced past the value on success. |
Definition at line 73 of file pair_tokenize.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Set a new parent from a dotted attribute reference.
The first component must be a direct child of pair_ctx->parent, and each later component must be a direct child of the component before. The last component becomes the new pair_ctx->parent. The function stops at the end of the input or at a comma. The comma remains in the buffer for the caller.
| [in,out] | pair_ctx | the parsing context. |
| [in,out] | in | to parse. Advanced past the reference on success. |
fr_dlist_t of pair_ctx, where the parser always operates on the last pair_ctx in the list. When the context changes to the parent of an attribute, pair_ctx also changes to a parent context. The list resembles the da stack, but with child cursors as well.The parser also needs to emulate the previous behavior of group attributes, based on the parent and an increasing child_num. When the parser reads a series of "attr-foo = bar" pairs, the parser watches the parent context, and creates a new parent VP when a child has a SMALLER attribute number than the previous child. Emulating the previous behavior keeps existing configurations working.
Definition at line 165 of file pair_tokenize.c.
Here is the call graph for this function:
Here is the caller graph for this function:| fr_table_num_sorted_t const fr_pair_comparison_op_table[] |
Operators that may appear between an attribute name and a value.
fr_table_num_sorted_t requires the entries in sorted order, so keep the entries sorted.
Definition at line 32 of file pair_tokenize.c.
| size_t fr_pair_comparison_op_table_len = NUM_ELEMENTS(fr_pair_comparison_op_table) |
Definition at line 47 of file pair_tokenize.c.
|
static |
A bare word value ends at whitespace or at the comma before the next pair.
Definition at line 52 of file pair_tokenize.c.
1.9.8