![]() |
The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
AVP manipulation and search API. More...
#include <freeradius-devel/util/dict.h>#include <freeradius-devel/util/pair.h>#include <freeradius-devel/util/pair_legacy.h>#include <freeradius-devel/util/proto.h>#include <freeradius-devel/util/regex.h>#include <freeradius-devel/protocol/radius/rfc2865.h>#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
Include dependency graph for pair_legacy.c:Go to the source code of this file.
Data Structures | |
| struct | legacy_da_stack_t |
| Our version of a DA stack. More... | |
Macros | |
| #define | CLEAN_DA_STACK |
Functions | |
| int | fr_pair_list_afrom_file (TALLOC_CTX *ctx, fr_dict_t const *dict, fr_pair_list_t *out, FILE *fp, bool *pfiledone) |
| Read valuepairs from the fp up to End-Of-File. | |
| fr_slen_t | fr_pair_list_afrom_substr (fr_pair_parse_t const *root, fr_pair_parse_t *relative, fr_sbuff_t *in) |
| Parse a fr_pair_list_t from a substring. | |
| void | fr_pair_list_move_op (fr_pair_list_t *to, fr_pair_list_t *from, fr_token_t op) |
| Move pairs from source list to destination list respecting operator. | |
| static ssize_t | fr_pair_value_from_substr (fr_pair_t *vp, fr_sbuff_t *in, UNUSED bool tainted) |
Variables | |
| static fr_sbuff_term_t const | bareword_terminals |
| static fr_sbuff_parse_rules_t const | bareword_unquoted |
| static fr_table_num_sorted_t const | pair_assignment_op_table [] |
| static ssize_t | pair_assignment_op_table_len = NUM_ELEMENTS(pair_assignment_op_table) |
| static fr_table_num_sorted_t const | pair_comparison_op_table [] |
| static size_t | pair_comparison_op_table_len = NUM_ELEMENTS(pair_comparison_op_table) |
AVP manipulation and search API.
Definition in file pair_legacy.c.
| struct legacy_da_stack_t |
Our version of a DA stack.
@todo - add in whether or not we added / created the vp? maybe an edit list? and then we can clean up the unknown DAs, simply by talloc freeing the edit list.
Definition at line 148 of file pair_legacy.c.
Collaboration diagram for legacy_da_stack_t:| Data Fields | ||
|---|---|---|
| fr_dict_attr_t const * | da[FR_DICT_MAX_TLV_STACK] | parent for parsing |
| int | depth | |
| fr_pair_t * | vp[FR_DICT_MAX_TLV_STACK] | which VP we have created or found |
| #define CLEAN_DA_STACK |
| int fr_pair_list_afrom_file | ( | TALLOC_CTX * | ctx, |
| fr_dict_t const * | dict, | ||
| fr_pair_list_t * | out, | ||
| FILE * | fp, | ||
| bool * | pfiledone | ||
| ) |
Read valuepairs from the fp up to End-Of-File.
| [in] | ctx | for talloc |
| [in] | dict | to resolve attributes in. |
| [in,out] | out | where the parsed fr_pair_ts will be appended. |
| [in] | fp | to read valuepairs from. |
| [out] | pfiledone | true if file parsing complete; |
Definition at line 1148 of file pair_legacy.c.
Here is the call graph for this function:
Here is the caller graph for this function:| fr_slen_t fr_pair_list_afrom_substr | ( | fr_pair_parse_t const * | root, |
| fr_pair_parse_t * | relative, | ||
| fr_sbuff_t * | in | ||
| ) |
Parse a fr_pair_list_t from a substring.
Syntax: ([raw.]|.)<name>[<.name>] op [(cast)] value...
A "raw" prefix creates a raw attribute, which allows us to encode raw data which might be invalid for the given data type. Or if a "(cast)" is given, the value is parsed as the specified data type. Note that casts can only be to a "leaf" data type, and not to a structural type such as "tlv", "group", "struct", etc. The "(cast)" syntax can only be used for "raw" attributes, and not for attributes which are known. The "name" can be either a known attribute, or a numerical OID. Either way, the final attribute which is created is marked as "raw" or "unknown", and is encoded via the "raw" rules, and not as the known data type.
If the first name begins with ".", then it is a relative name. The attribute is created in the context of the most recently created "structural" data type.
TBD - we have to determine what the heck that means...
The "name" can be one or more names from the input dictionary. The names must be known, as numerical OIDs can only be used when the "raw" prefix is used.
If there are multiple names (e.g. "foo.bar.baz"), then only the last name can be a "leaf" data type. All of the intermediate names must be "structural" data types.
Depending on the input arguments, the operator can be a comparison operator (==, <=, etc.). Or, else it can be an assignment operator (=, +=). The "=" operator is used to assign, and the "+=" operator is used to append. No other assignment operators are permitted. Note that "+=" cannot be used with relative names (i.e. where the name begins with ".")
The "value" can either be a "leaf" data type (e.g. number, IP address, etc.) or for "structural" data types it can be a sub-list. A sub-list is a set of attribute assignments which are surrounded by curly brackets "{...}". When a sub-list is specified, the contents must be either children of the parent attribute (for "tlv", "struct"), or children referenced by a "group", or internal attributes.
If an intermediate "name" is an ALIAS, then the attributes are created / used as if all intermediate names were specified. i.e. ALIAS is a short-cut for names (think "soft link), but it does not change the hierarchy for normal attributes. @iverbatim Examples -------- Name = value Leaf attributes. The value MUST be parsed as the leaf data type. Name = { children } Structural attributes. The children MUST be children of the parent. OR the children can be from the "internal" dictionary. OR for type 'group', children of the group reference (usually the dictionary root)
raw.Name = 0xabcdef Raw attributes. The value MUST be a hex string.
raw.Name = { children }
| [in] | root | where we start parsing from |
| [in,out] | relative | where we left off, or where we should continue from |
| [in] | in | input sbuff |
Definition at line 219 of file pair_legacy.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void fr_pair_list_move_op | ( | fr_pair_list_t * | to, |
| fr_pair_list_t * | from, | ||
| fr_token_t | op | ||
| ) |
Move pairs from source list to destination list respecting operator.
| [in,out] | to | destination list. |
| [in,out] | from | source list. |
| [in] | op | operator for list move. |
Definition at line 1233 of file pair_legacy.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 101 of file pair_legacy.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 35 of file pair_legacy.c.
|
static |
Definition at line 88 of file pair_legacy.c.
|
static |
Definition at line 58 of file pair_legacy.c.
|
static |
Definition at line 63 of file pair_legacy.c.
|
static |
Definition at line 65 of file pair_legacy.c.
|
static |
Definition at line 80 of file pair_legacy.c.
1.9.8