![]() |
The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
|
API to parse internal format configuration items into native C types. More...
#include <unistd.h>#include <sys/time.h>#include <freeradius-devel/util/rb.h>#include <freeradius-devel/util/table.h>#include <freeradius-devel/util/value.h>#include <freeradius-devel/server/cf_util.h>
Include dependency graph for cf_parse.h:Go to the source code of this file.
Data Structures | |
| struct | cf_table_parse_ctx_t |
| struct | conf_parser_s |
| Defines a CONF_PAIR to C data type mapping. More... | |
| union | conf_parser_s.__unnamed54__ |
| Where to write status if FR_TYPE_IS_DEFAULT is set. More... | |
| union | conf_parser_s.__unnamed56__ |
| struct | conf_parser_s.__unnamed56__.__unnamed58__ |
| struct | conf_parser_s.__unnamed56__.__unnamed60__ |
Macros | |
| #define | CF_FILE_CONFIG (1 << 2) |
| #define | CF_FILE_ERROR (1) |
| #define | CF_FILE_MODULE (1 << 3) |
| #define | CF_FILE_NONE (0) |
| #define | cf_section_rule_push(_cs, _rule) _cf_section_rule_push(_cs, _rule, __FILE__, __LINE__) |
| #define | cf_section_rules_push(_cs, _rule) _cf_section_rules_push(_cs, _rule, __FILE__, __LINE__) |
| #define | CONF_CTYPE_TO_FLAGS(_ct) |
| #define | CONF_PARSER_PARTIAL_TERMINATOR |
| #define | CONF_PARSER_TERMINATOR |
| #define | FR_CONF_FLAG_CHECK(_type, _flags, _c_type, _ptr_or_offset) _ptr_or_offset |
| #define | FR_CONF_OFFSET(_name, _struct, _field) |
| conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct | |
| #define | FR_CONF_OFFSET_FLAGS(_name, _flags, _struct, _field) |
| conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct | |
| #define | FR_CONF_OFFSET_HINT_TYPE(_name, _type, _struct, _field) |
| conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct | |
| #define | FR_CONF_OFFSET_IS_SET(_name, _type, _flags, _struct, _field) |
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct, recording if a default was used in <_field>_is_set | |
| #define | FR_CONF_OFFSET_REF(_struct, _field, _subcs) |
| conf_parser_t which populates a sub-struct using a CONF_SECTION | |
| #define | FR_CONF_OFFSET_SUBSECTION(_name, _flags, _struct, _field, _subcs) |
| conf_parser_t which populates a sub-struct using a CONF_SECTION | |
| #define | FR_CONF_OFFSET_TYPE_FLAGS(_name, _type, _flags, _struct, _field) |
| conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct | |
| #define | FR_CONF_PAIR_GLOBAL(_name, _type, _flags, _func, _dflt_func) |
| conf_parser_t entry which doesn't fill in a pointer or offset, but relies on functions to record values | |
| #define | FR_CONF_POINTER(_name, _type, _flags, _res_p) |
| conf_parser_t which parses a single CONF_PAIR producing a single global result | |
| #define | FR_CONF_POINTER_IS_SET(_name, _type, _flags, _res_p) |
conf_parser_t which parses a single CONF_PAIR producing a single global result, recording if a default was used in <_res_p>_is_set | |
| #define | FR_CONF_SUBSECTION_ALLOC(_name, _type, _flags, _struct, _field, _subcs) |
| A conf_parser_t multi-subsection. | |
| #define | FR_CONF_SUBSECTION_GLOBAL(_name, _flags, _subcs) |
| conf_parser_t entry which runs conf_parser_t entries for a subsection without any output | |
| #define | FR_CONF_V3_DEPRECATED(_name, _struct, _field) |
| conf_parser_t entry which raises an error if a deprecated v3 item is found | |
| #define | FR_INTEGER_BOUND_CHECK(_name, _var, _op, _bound) FR_INTEGER_COND_CHECK(_name, _var, (_var _op _bound), _bound) |
| #define | FR_INTEGER_COND_CHECK(_name, _var, _cond, _new) |
| #define | FR_ITEM_POINTER(_type, _res_p) _type, FR_CONF_FLAG_CHECK((_type), 0, (_res_p), _res_p) |
| #define | FR_SIZE_BOUND_CHECK(_name, _var, _op, _bound) FR_SIZE_COND_CHECK(_name, _var, (_var _op _bound), _bound) |
| #define | FR_SIZE_COND_CHECK(_name, _var, _cond, _new) |
| #define | FR_TIME_DELTA_BOUND_CHECK(_name, _var, _op, _bound) |
| #define | FR_TIME_DELTA_COND_CHECK(_name, _var, _cond, _new) |
Typedefs | |
| typedef int(* | cf_dflt_t) (CONF_PAIR **out, void *parent, CONF_SECTION *cs, fr_token_t quote, conf_parser_t const *rule) |
| Callback for producing dynamic defaults from 3rd party libraries. | |
| typedef int(* | cf_parse_t) (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
| Callback for performing custom parsing of a CONF_SECTION or CONF_PAIR. | |
| typedef struct conf_parser_s | conf_parser_t |
Functions | |
| int | _cf_section_rule_push (CONF_SECTION *cs, conf_parser_t const *rule, char const *filename, int lineno) |
| Add a single rule to a CONF_SECTION. | |
| int | _cf_section_rules_push (CONF_SECTION *cs, conf_parser_t const *rules, char const *filename, int lineno) |
| Add an array of parse rules to a CONF_SECTION. | |
| int | cf_null_on_read (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
| void | cf_pair_debug_log (CONF_SECTION const *cs, CONF_PAIR *cp, conf_parser_t const *rule) |
| int | cf_pair_parse (TALLOC_CTX *ctx, CONF_SECTION *cs, char const *name, unsigned int type, void *data, char const *dflt, fr_token_t dflt_quote)) |
| Parses a CONF_PAIR into a C data type, with a default value. | |
| int | cf_pair_parse_value (TALLOC_CTX *ctx, void *out, void *base, CONF_ITEM *ci, conf_parser_t const *rule)) |
| int | cf_pair_to_value_box (TALLOC_CTX *ctx, fr_value_box_t *out, CONF_PAIR *cp, conf_parser_t const *rule)) |
| Parses a CONF_PAIR into a boxed value. | |
| int | cf_parse_gid (TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
| int | cf_parse_permissions (TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
| int | cf_parse_uid (TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
| char const * | cf_parser_flag_to_enum_str (conf_parser_flags_t mask) |
| Return the source-identifier name for a single CONF_FLAG_* bit. | |
| int | cf_section_parse (TALLOC_CTX *ctx, void *base, CONF_SECTION *cs) |
| Parse a configuration section into user-supplied variables. | |
| int | cf_section_parse_pass2 (void *base, CONF_SECTION *cs) |
| Fixup xlat expansions and attributes. | |
| int | cf_table_parse_int (UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
| Generic function for parsing conf pair values as int. | |
| int | cf_table_parse_int32 (UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
| Generic function for parsing conf pair values as int32_t (FR_TYPE_INT32) | |
| int | cf_table_parse_uint32 (UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
| Generic function for parsing conf pair values as int32_t (FR_TYPE_UINT32) | |
Variables | |
| bool | check_config |
#conf_parser_t type flags | |
These flags should be or'd with another FR_TYPE_* value to create validation rules for the cf_pair_parse function. | |
| enum | conf_parser_flags_t { CONF_FLAG_NONE = 0 , CONF_FLAG_SUBSECTION = (1 << 1) , CONF_FLAG_V3_DEPRECATED = (1 << 10) , CONF_FLAG_REQUIRED = (1 << 11) , CONF_FLAG_ATTRIBUTE = (1 << 12) , CONF_FLAG_SECRET = (1 << 13) , CONF_FLAG_FILE_READABLE = (1 << 14) , CONF_FLAG_FILE_WRITABLE = (1 << 15) , CONF_FLAG_FILE_SOCKET = (1 << 16) , CONF_FLAG_FILE_EXISTS = (1 << 17) , CONF_FLAG_XLAT = (1 << 18) , CONF_FLAG_TMPL = (1 << 19) , CONF_FLAG_MULTI = (1 << 20) , CONF_FLAG_NOT_EMPTY = (1 << 21) , CONF_FLAG_IS_SET = (1 << 22) , CONF_FLAG_OK_MISSING = (1 << 23) , CONF_FLAG_HIDDEN = (1 << 24) , CONF_FLAG_REF = (1 << 25) , CONF_FLAG_OPTIONAL = (1 << 26) , CONF_FLAG_ALWAYS_PARSE = (1 << 27) , CONF_FLAG_NO_OUTPUT = (1 << 28) } |
API to parse internal format configuration items into native C types.
Definition in file cf_parse.h.
| struct cf_table_parse_ctx_t |
Definition at line 668 of file cf_parse.h.
Collaboration diagram for cf_table_parse_ctx_t:| Data Fields | ||
|---|---|---|
| size_t * | len | |
| fr_table_num_sorted_t const * | table | |
| struct conf_parser_s |
Defines a CONF_PAIR to C data type mapping.
Is typically used to define mappings between module sections, and module instance structs. May also be used to set global configuration options.
Offset/data values should be set using FR_CONF_OFFSET or FR_CONF_POINTER.
Example with FR_CONF_OFFSET :
Example with FR_CONF_POINTER :
Definition at line 610 of file cf_parse.h.
Collaboration diagram for conf_parser_s:| Data Fields | ||
|---|---|---|
| union conf_parser_s.__unnamed54__ | __unnamed__ |
Where to write status if FR_TYPE_IS_DEFAULT is set.
|
| union conf_parser_s.__unnamed56__ | __unnamed__ | |
| void * | data |
Pointer to a static variable to write the parsed value to.
|
| conf_parser_flags_t | flags | Flags which control parsing behaviour. |
| cf_parse_t | func | Override default parsing behaviour for the specified type with a custom parsing function. |
| char const * | name1 | Name of the CONF_ITEM to parse. |
| char const * | name2 | Second identifier for CONF_SECTION. |
| size_t | offset |
Relative offset of field or structure to write the parsed value to. When flags is set to CONF_FLAG_SUBSECTION, may be used to specify a base offset to add to all offsets contained within the subsection.
|
| cf_parse_t | on_read | Function to call as the item is being read, just after it has been allocated and initialized. |
| fr_token_t | quote | Quoting around the default value. Only used for templates. |
| fr_type_t | type | An fr_type_t value, controls the output type. |
| void const * | uctx |
User data accessible by the cf_parse_t func. Useful for building reusable functions. |
| union conf_parser_s.__unnamed54__ |
Where to write status if FR_TYPE_IS_DEFAULT is set.
Definition at line 641 of file cf_parse.h.
| Data Fields | ||
|---|---|---|
| size_t | is_set_offset |
If type contains FR_TYPE_IS_DEFAULT write status to bool. at this address. |
| void * | is_set_ptr | If type contains FR_TYPE_IS_DEFAULT write status to ptr at this address. |
| union conf_parser_s.__unnamed56__ |
Definition at line 648 of file cf_parse.h.
| Data Fields | ||
|---|---|---|
| struct conf_parser_s.__unnamed56__.__unnamed58__ | __unnamed__ | |
| struct conf_parser_s.__unnamed56__.__unnamed60__ | __unnamed__ | |
| struct conf_parser_s.__unnamed56__.__unnamed58__ |
Definition at line 649 of file cf_parse.h.
| Data Fields | ||
|---|---|---|
| char const * | dflt | Default as it would appear in radiusd.conf. |
| cf_dflt_t | dflt_func | Function to produce dynamic defaults. |
| struct conf_parser_s.__unnamed56__.__unnamed60__ |
Definition at line 655 of file cf_parse.h.
| Data Fields | ||
|---|---|---|
| conf_parser_t const * | subcs | When CONF_FLAG_SUBSECTION is set, should be a pointer to the start of another array of conf_parser_t structs, forming the subsection. |
| size_t | subcs_size | If non-zero, allocate structs of this size to hold the parsed data. |
| char const * | subcs_type | Set a specific talloc type for subcs structures. |
| #define CF_FILE_CONFIG (1 << 2) |
Definition at line 681 of file cf_parse.h.
| #define CF_FILE_ERROR (1) |
Definition at line 680 of file cf_parse.h.
| #define CF_FILE_MODULE (1 << 3) |
Definition at line 682 of file cf_parse.h.
| #define CF_FILE_NONE (0) |
Definition at line 679 of file cf_parse.h.
| #define cf_section_rule_push | ( | _cs, | |
| _rule | |||
| ) | _cf_section_rule_push(_cs, _rule, __FILE__, __LINE__) |
Definition at line 703 of file cf_parse.h.
| #define cf_section_rules_push | ( | _cs, | |
| _rule | |||
| ) | _cf_section_rules_push(_cs, _rule, __FILE__, __LINE__) |
Definition at line 705 of file cf_parse.h.
| #define CONF_CTYPE_TO_FLAGS | ( | _ct | ) |
Definition at line 187 of file cf_parse.h.
| #define CONF_PARSER_PARTIAL_TERMINATOR |
Definition at line 676 of file cf_parse.h.
| #define CONF_PARSER_TERMINATOR |
Definition at line 673 of file cf_parse.h.
| #define FR_CONF_FLAG_CHECK | ( | _type, | |
| _flags, | |||
| _c_type, | |||
| _ptr_or_offset | |||
| ) | _ptr_or_offset |
Definition at line 184 of file cf_parse.h.
| #define FR_CONF_OFFSET | ( | _name, | |
| _struct, | |||
| _field | |||
| ) |
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
| [in] | _name | of the CONF_PAIR to search for. |
| [in] | _struct | containing the field to write the result to. |
| [in] | _field | to write the result to. |
Definition at line 280 of file cf_parse.h.
| #define FR_CONF_OFFSET_FLAGS | ( | _name, | |
| _flags, | |||
| _struct, | |||
| _field | |||
| ) |
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
This variant takes additional flags, and will add CONF_FLAG_MULTI automatically if the field is an array.
| [in] | _name | of the CONF_PAIR to search for. |
| [in] | _flags | controlling parsing behaviour. |
| [in] | _struct | containing the field to write the result to. |
| [in] | _field | to write the result to. |
Definition at line 268 of file cf_parse.h.
| #define FR_CONF_OFFSET_HINT_TYPE | ( | _name, | |
| _type, | |||
| _struct, | |||
| _field | |||
| ) |
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
This variant takes output hint type. If the type is a bare word, it MUST be of the relevant data type.
| [in] | _name | of the CONF_PAIR to search for. |
| [in] | _type | to parse the CONF_PAIR as. |
| [in] | _struct | containing the field to write the result to. |
| [in] | _field | to write the result to. |
Definition at line 253 of file cf_parse.h.
| #define FR_CONF_OFFSET_IS_SET | ( | _name, | |
| _type, | |||
| _flags, | |||
| _struct, | |||
| _field | |||
| ) |
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct, recording if a default was used in <_field>_is_set
| [in] | _name | of the CONF_PAIR to search for. |
| [in] | _type | to parse the CONF_PAIR as. |
| [in] | _flags | controlling parsing behaviour. |
| [in] | _struct | containing the field to write the result to. |
| [in] | _field | to write the result to. |
Definition at line 294 of file cf_parse.h.
| #define FR_CONF_OFFSET_REF | ( | _struct, | |
| _field, | |||
| _subcs | |||
| ) |
conf_parser_t which populates a sub-struct using a CONF_SECTION
| [in] | _struct | containing the sub-struct to populate. |
| [in] | _field | containing the sub-struct to populate. |
| [in] | _subcs | conf_parser_t to include in-line in this section |
Definition at line 321 of file cf_parse.h.
| #define FR_CONF_OFFSET_SUBSECTION | ( | _name, | |
| _flags, | |||
| _struct, | |||
| _field, | |||
| _subcs | |||
| ) |
conf_parser_t which populates a sub-struct using a CONF_SECTION
| [in] | _name | of the CONF_SECTION to search for. |
| [in] | _flags | controlling parsing behaviour. |
| [in] | _struct | containing the sub-struct to populate. |
| [in] | _field | containing the sub-struct to populate. |
| [in] | _subcs | CONF_SECTION to parse. |
Definition at line 309 of file cf_parse.h.
| #define FR_CONF_OFFSET_TYPE_FLAGS | ( | _name, | |
| _type, | |||
| _flags, | |||
| _struct, | |||
| _field | |||
| ) |
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
This variant takes output type and flags manually, instead of determining them automatically.
| [in] | _name | of the CONF_PAIR to search for. |
| [in] | _type | to parse the CONF_PAIR as. |
| [in] | _flags | controlling parsing behaviour. |
| [in] | _struct | containing the field to write the result to. |
| [in] | _field | to write the result to. |
Definition at line 238 of file cf_parse.h.
| #define FR_CONF_PAIR_GLOBAL | ( | _name, | |
| _type, | |||
| _flags, | |||
| _func, | |||
| _dflt_func | |||
| ) |
conf_parser_t entry which doesn't fill in a pointer or offset, but relies on functions to record values
| [in] | _name | name of pair to search for. |
| [in] | _type | base type to parse pair as. |
| [in] | _flags | flags controlling parsing behaviour. |
| [in] | _func | to use to record value. |
| [in] | _dflt_func | to use to get defaults from a 3rd party library. |
Definition at line 385 of file cf_parse.h.
| #define FR_CONF_POINTER | ( | _name, | |
| _type, | |||
| _flags, | |||
| _res_p | |||
| ) |
conf_parser_t which parses a single CONF_PAIR producing a single global result
| [in] | _name | of the CONF_PAIR to search for. |
| [in] | _type | to parse the CONF_PAIR as. |
| [in] | _flags | controlling parsing behaviour. |
| [out] | _res_p | pointer to a global var, where the result will be written. |
Definition at line 334 of file cf_parse.h.
| #define FR_CONF_POINTER_IS_SET | ( | _name, | |
| _type, | |||
| _flags, | |||
| _res_p | |||
| ) |
conf_parser_t which parses a single CONF_PAIR producing a single global result, recording if a default was used in <_res_p>_is_set
<_res_p>_is_set.| [in] | _name | of the CONF_PAIR to search for. |
| [in] | _type | to parse the CONF_PAIR as. |
| [in] | _flags | controlling parsing behaviour. |
| [out] | _res_p | pointer to a global var, where the result will be written. |
Definition at line 349 of file cf_parse.h.
| #define FR_CONF_SUBSECTION_ALLOC | ( | _name, | |
| _type, | |||
| _flags, | |||
| _struct, | |||
| _field, | |||
| _subcs | |||
| ) |
A conf_parser_t multi-subsection.
Parse multiple instance of a subsection, allocating an array of structs to hold the result.
| [in] | _name | name of subsection to search for. |
| [in] | _type | the output type. |
| [in] | _flags | flags controlling parsing behaviour. |
| [in] | _struct | instance data struct. |
| [in] | _field | field in instance data struct. |
| [in] | _subcs | conf_parser_t array to use to parse subsection data. |
Definition at line 369 of file cf_parse.h.
| #define FR_CONF_SUBSECTION_GLOBAL | ( | _name, | |
| _flags, | |||
| _subcs | |||
| ) |
conf_parser_t entry which runs conf_parser_t entries for a subsection without any output
| [in] | _name | of pair to search for. |
| [in] | _flags | flags controlling parsing behaviour. |
| [in] | _subcs | to use to get defaults from a 3rd party library. |
Definition at line 398 of file cf_parse.h.
| #define FR_CONF_V3_DEPRECATED | ( | _name, | |
| _struct, | |||
| _field | |||
| ) |
conf_parser_t entry which raises an error if a deprecated v3 item is found
We don't want to include v3 compatibility support forever. But we do want to catch the cases where people use the v3 config. So we add CONF_PARSER entries for the old config, and then produce errors when they're seen.
| [in] | _name | of pair to search for. |
| [in] | _struct | where the result was previously written. |
| [in] | _field | in the struct where the result was previously written. |
Definition at line 413 of file cf_parse.h.
| #define FR_INTEGER_BOUND_CHECK | ( | _name, | |
| _var, | |||
| _op, | |||
| _bound | |||
| ) | FR_INTEGER_COND_CHECK(_name, _var, (_var _op _bound), _bound) |
Definition at line 533 of file cf_parse.h.
| #define FR_INTEGER_COND_CHECK | ( | _name, | |
| _var, | |||
| _cond, | |||
| _new | |||
| ) |
Definition at line 525 of file cf_parse.h.
| #define FR_ITEM_POINTER | ( | _type, | |
| _res_p | |||
| ) | _type, FR_CONF_FLAG_CHECK((_type), 0, (_res_p), _res_p) |
Definition at line 355 of file cf_parse.h.
| #define fr_rule_dflt | ( | _rule | ) | ((_rule)->dflt || (_rule)->dflt_func) |
Definition at line 506 of file cf_parse.h.
| #define fr_rule_file_exists | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_FILE_EXISTS) |
Definition at line 496 of file cf_parse.h.
| #define fr_rule_file_readable | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_FILE_READABLE) |
Definition at line 490 of file cf_parse.h.
| #define fr_rule_file_socket | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_FILE_SOCKET) |
Definition at line 494 of file cf_parse.h.
| #define fr_rule_file_writable | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_FILE_WRITABLE) |
Definition at line 492 of file cf_parse.h.
| #define fr_rule_is_attribute | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_ATTRIBUTE) |
Definition at line 508 of file cf_parse.h.
| #define fr_rule_is_set | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_IS_SET) |
Definition at line 502 of file cf_parse.h.
| #define fr_rule_is_tmpl | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_TMPL) |
Definition at line 512 of file cf_parse.h.
| #define fr_rule_is_xlat | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_XLAT) |
Definition at line 510 of file cf_parse.h.
| #define fr_rule_multi | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_MULTI) |
Definition at line 498 of file cf_parse.h.
| #define fr_rule_not_empty | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_NOT_EMPTY) |
Definition at line 500 of file cf_parse.h.
| #define fr_rule_ok_missing | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_OK_MISSING) |
Definition at line 504 of file cf_parse.h.
| #define fr_rule_required | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_REQUIRED) |
Definition at line 486 of file cf_parse.h.
| #define fr_rule_secret | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_SECRET) |
Definition at line 488 of file cf_parse.h.
| #define fr_rule_v3_deprecated | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_V3_DEPRECATED) |
Definition at line 484 of file cf_parse.h.
| #define FR_SIZE_BOUND_CHECK | ( | _name, | |
| _var, | |||
| _op, | |||
| _bound | |||
| ) | FR_SIZE_COND_CHECK(_name, _var, (_var _op _bound), _bound) |
Definition at line 523 of file cf_parse.h.
| #define FR_SIZE_COND_CHECK | ( | _name, | |
| _var, | |||
| _cond, | |||
| _new | |||
| ) |
Definition at line 515 of file cf_parse.h.
| #define FR_TIME_DELTA_BOUND_CHECK | ( | _name, | |
| _var, | |||
| _op, | |||
| _bound | |||
| ) |
Definition at line 544 of file cf_parse.h.
| #define FR_TIME_DELTA_COND_CHECK | ( | _name, | |
| _var, | |||
| _cond, | |||
| _new | |||
| ) |
Definition at line 535 of file cf_parse.h.
| typedef int(* cf_dflt_t) (CONF_PAIR **out, void *parent, CONF_SECTION *cs, fr_token_t quote, conf_parser_t const *rule) |
Callback for producing dynamic defaults from 3rd party libraries.
| [out] | out | Where to write default conf pair. |
| [in] | parent | being populated. |
| [in] | cs | to allocate pair in. |
| [in] | quote | to use when allocing the pair. Provided as a convenience. |
| [in] | rule | to produce default for. |
Definition at line 580 of file cf_parse.h.
| typedef int(* cf_parse_t) (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
Callback for performing custom parsing of a CONF_SECTION or CONF_PAIR.
| [in] | ctx | to allocate any data in. |
| [out] | out | Where to write the result of parsing. |
| [in] | parent | The base address of the structure. |
| [in] | ci | The CONF_SECTION or CONF_PAIR to parse. |
| [in] | rule | Parse rules - How the CONF_PAIR or CONF_SECTION should be converted. |
Definition at line 567 of file cf_parse.h.
| typedef struct conf_parser_s conf_parser_t |
Definition at line 28 of file cf_parse.h.
| enum conf_parser_flags_t |
| Enumerator | |
|---|---|
| CONF_FLAG_NONE | No special flags. |
| CONF_FLAG_SUBSECTION | Instead of putting the information into a configuration structure, the configuration file routines MAY just parse it directly into user-supplied variables. |
| CONF_FLAG_V3_DEPRECATED | If a matching CONF_PAIR is found, error out with a deprecated message. |
| CONF_FLAG_REQUIRED | Error out if no matching CONF_PAIR is found, and no dflt value is set. |
| CONF_FLAG_ATTRIBUTE | Value must resolve to attribute in dict (deprecated, use CONF_FLAG_TMPL). |
| CONF_FLAG_SECRET | Only print value if debug level >= 3. |
| CONF_FLAG_FILE_READABLE | File matching value must exist, and must be readable. |
| CONF_FLAG_FILE_WRITABLE | File matching value must exist, and must be writable. |
| CONF_FLAG_FILE_SOCKET | File matching value must exist, and must be a unix socket. |
| CONF_FLAG_FILE_EXISTS | File matching value must exist. |
| CONF_FLAG_XLAT | string will be dynamically expanded. |
| CONF_FLAG_TMPL | CONF_PAIR should be parsed as a template. |
| CONF_FLAG_MULTI | CONF_PAIR can have multiple copies. |
| CONF_FLAG_NOT_EMPTY | CONF_PAIR is required to have a non zero length value. |
| CONF_FLAG_IS_SET | Write whether this config item was left as the default to is_set_offset or is_set_ptr. |
| CONF_FLAG_OK_MISSING | OK if it's missing. |
| CONF_FLAG_HIDDEN | Used by scripts to omit items from the generated documentation. |
| CONF_FLAG_REF | reference another conf_parser_t inline in this one |
| CONF_FLAG_OPTIONAL | subsection is pushed only if a non-optional matching one is pushed |
| CONF_FLAG_ALWAYS_PARSE | Run this rule even against items already marked parsed. Useful for CF_IDENT_ANY observer rules that want to see every item, not just the leftovers, or for a second-pass rule that needs to re-examine something an earlier rule already claimed. |
| CONF_FLAG_NO_OUTPUT | Rule has no framework-managed output destination. The parse function owns its own side effects - the framework will not pre-zero |
Definition at line 425 of file cf_parse.h.
| int _cf_section_rule_push | ( | CONF_SECTION * | cs, |
| conf_parser_t const * | rule, | ||
| char const * | filename, | ||
| int | lineno | ||
| ) |
Add a single rule to a CONF_SECTION.
| [in] | cs | to add rules to. |
| [in] | rule | to add. |
| [in] | filename | where the rule was pushed. |
| [in] | lineno | where the rule was pushed. |
Definition at line 1586 of file cf_parse.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int _cf_section_rules_push | ( | CONF_SECTION * | cs, |
| conf_parser_t const * | rules, | ||
| char const * | filename, | ||
| int | lineno | ||
| ) |
Add an array of parse rules to a CONF_SECTION.
| [in] | cs | to add rules to. |
| [in] | rules | to add. Last element should have NULL name field. |
| [in] | filename | where the rule was pushed. |
| [in] | lineno | where the rule was pushed. |
Definition at line 1697 of file cf_parse.c.
Here is the call graph for this function:| int cf_null_on_read | ( | TALLOC_CTX * | ctx, |
| void * | out, | ||
| void * | parent, | ||
| CONF_ITEM * | ci, | ||
| conf_parser_t const * | rule | ||
| ) |
| void cf_pair_debug_log | ( | CONF_SECTION const * | cs, |
| CONF_PAIR * | cp, | ||
| conf_parser_t const * | rule | ||
| ) |
Definition at line 50 of file cf_parse.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int cf_pair_parse | ( | TALLOC_CTX * | ctx, |
| CONF_SECTION * | cs, | ||
| char const * | name, | ||
| unsigned int | type, | ||
| void * | data, | ||
| char const * | dflt, | ||
| fr_token_t | dflt_quote | ||
| ) |
Parses a CONF_PAIR into a C data type, with a default value.
Takes fields from a conf_parser_t struct and uses them to parse the string value of a CONF_PAIR into a C data type matching the type argument.
The format of the types are the same as fr_value_box_t types.
fr_type_t to data type mappings
| fr_type_t | Data type | Dynamically allocated |
|---|---|---|
| FR_TYPE_BOOL | bool | No |
| FR_TYPE_UINT32 | uint32_t | No |
| FR_TYPE_UINT16 | uint16_t | No |
| FR_TYPE_UINT64 | uint64_t | No |
| FR_TYPE_INT32 | int32_t | No |
| FR_TYPE_STRING | char const * | Yes |
| FR_TYPE_IPV4_ADDR | fr_ipaddr_t | No |
| FR_TYPE_IPV4_PREFIX | fr_ipaddr_t | No |
| FR_TYPE_IPV6_ADDR | fr_ipaddr_t | No |
| FR_TYPE_IPV6_PREFIX | fr_ipaddr_t | No |
| FR_TYPE_COMBO_IP_ADDR | fr_ipaddr_t | No |
| FR_TYPE_COMBO_IP_PREFIX | fr_ipaddr_t | No |
| FR_TYPE_TIME_DELTA | fr_time_delta_t | No |
| [in] | ctx | To allocate arrays and values in. |
| [in] | cs | to search for matching CONF_PAIR in. |
| [in] | name | of CONF_PAIR to search for. |
| [in] | type | Data type to parse CONF_PAIR value as. Should be one of the following data types, and one or more of the following flag types or'd together: |
data FR_TYPE_BOOL - A truth value. data FR_TYPE_UINT32 - 32 Bit unsigned integer. data FR_TYPE_UINT16 - 16 Bit unsigned integer. data FR_TYPE_UINT64 - 64 Bit unsigned integer. data FR_TYPE_INT32 - 32 Bit signed integer. data FR_TYPE_STRING - String of printable characters. data FR_TYPE_IPV4_ADDR - 32 Bit IPv4 Address. (IPv4 address with prefix 32).data FR_TYPE_IPV4_PREFIX - IPv4 Prefix. (IPv4 address with variable prefix).data FR_TYPE_IPV6_ADDR - 128 Bit IPv6 Address. (IPv6 address with prefix 128).data FR_TYPE_IPV6_PREFIX - IPv6 Prefix. (IPv6 address with variable prefix).data FR_TYPE_COMBO_IP_ADDR - IPv4 or IPv6 address depending on length. (IPv4/IPv6 address with prefix 32/128).data FR_TYPE_COMBO_IP_PREFIX - IPv4 or IPv6 address prefix depending on length. (IPv4/IPv6 address with variable prefix).data FR_TYPE_TIME_DELTA - A period of time measured in nanoseconds. flag CONF_FLAG_TMPL - CONF_PAIR should be parsed as a template. Feeds the value into tmpl_afrom_substr. Value can be obtained when processing requests, with tmpl_expand or tmpl_aexpand.flag CONF_FLAG_V3_DEPRECATED - If a matching CONF_PAIR is found, error out with a deprecated message. flag CONF_FLAG_REQUIRED - Error out if no matching CONF_PAIR is found, and no dflt value is set. flag CONF_FLAG_ATTRIBUTE - Value must resolve to attribute in dict (deprecated, use CONF_FLAG_TMPL). flag CONF_FLAG_SECRET - Only print value if debug level >= 3. flag CONF_FLAG_FILE_READABLE - File matching value must exist, and must be readable. flag CONF_FLAG_FILE_WRITABLE - File matching value must exist, and must be writable. flag CONF_FLAG_NOT_EMPTY - CONF_PAIR is required to have a non zero length value. flag CONF_FLAG_MULTI - CONF_PAIR can have multiple copies. flag CONF_FLAG_IS_SET - Write whether this config item was left as the default to is_set_offset or is_set_ptr. | [out] | data | Pointer to a global variable, or pointer to a field in the struct being populated with values. |
| [in] | dflt | value to use, if no CONF_PAIR is found. |
| [in] | dflt_quote | around the dflt value. |
Definition at line 794 of file cf_parse.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int cf_pair_parse_value | ( | TALLOC_CTX * | ctx, |
| void * | out, | ||
| void * | base, | ||
| CONF_ITEM * | ci, | ||
| conf_parser_t const * | rule | ||
| ) |
| int cf_pair_to_value_box | ( | TALLOC_CTX * | ctx, |
| fr_value_box_t * | out, | ||
| CONF_PAIR * | cp, | ||
| conf_parser_t const * | rule | ||
| ) |
Parses a CONF_PAIR into a boxed value.
Return the value of a CONF_PAIR.
| [in] | ctx | to allocate any dynamic buffers in. |
| [out] | out | Where to write the parsed value. |
| [in] | cp | to parse. |
| [in] | rule | to parse to. May contain flags. |
Definition at line 127 of file cf_parse.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int cf_parse_gid | ( | TALLOC_CTX * | ctx, |
| void * | out, | ||
| UNUSED void * | parent, | ||
| CONF_ITEM * | ci, | ||
| conf_parser_t const * | rule | ||
| ) |
| int cf_parse_permissions | ( | TALLOC_CTX * | ctx, |
| void * | out, | ||
| UNUSED void * | parent, | ||
| CONF_ITEM * | ci, | ||
| conf_parser_t const * | rule | ||
| ) |
| int cf_parse_uid | ( | TALLOC_CTX * | ctx, |
| void * | out, | ||
| UNUSED void * | parent, | ||
| CONF_ITEM * | ci, | ||
| conf_parser_t const * | rule | ||
| ) |
| char const * cf_parser_flag_to_enum_str | ( | conf_parser_flags_t | mask | ) |
Return the source-identifier name for a single CONF_FLAG_* bit.
mask MUST be a single-bit mask from conf_parser_flags_t (e.g. CONF_FLAG_REQUIRED). Used by tooling that wants to stringify a flag set bit-by-bit (radmod2json).
| [in] | mask | single-bit CONF_FLAG_* value. |
NULL if mask is not a known flag bit. Definition at line 1873 of file cf_parse.c.
Here is the caller graph for this function:| int cf_section_parse | ( | TALLOC_CTX * | ctx, |
| void * | base, | ||
| CONF_SECTION * | cs | ||
| ) |
Parse a configuration section into user-supplied variables.
| [in] | ctx | to allocate any strings, or additional structures in. Usually the same as base, unless base is a nested struct. |
| [out] | base | pointer to a struct to fill with data. |
| [in] | cs | to parse. |
Definition at line 1288 of file cf_parse.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int cf_section_parse_pass2 | ( | void * | base, |
| CONF_SECTION * | cs | ||
| ) |
Fixup xlat expansions and attributes.
| [out] | base | start of structure to write tmpl_t s to. |
| [in] | cs | CONF_SECTION to fixup. |
Definition at line 1398 of file cf_parse.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int cf_table_parse_int | ( | UNUSED TALLOC_CTX * | ctx, |
| void * | out, | ||
| UNUSED void * | parent, | ||
| CONF_ITEM * | ci, | ||
| conf_parser_t const * | rule | ||
| ) |
Generic function for parsing conf pair values as int.
Definition at line 1723 of file cf_parse.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int cf_table_parse_int32 | ( | UNUSED TALLOC_CTX * | ctx, |
| void * | out, | ||
| UNUSED void * | parent, | ||
| CONF_ITEM * | ci, | ||
| conf_parser_t const * | rule | ||
| ) |
Generic function for parsing conf pair values as int32_t (FR_TYPE_INT32)
Definition at line 1739 of file cf_parse.c.
Here is the call graph for this function:| int cf_table_parse_uint32 | ( | UNUSED TALLOC_CTX * | ctx, |
| void * | out, | ||
| UNUSED void * | parent, | ||
| CONF_ITEM * | ci, | ||
| conf_parser_t const * | rule | ||
| ) |
Generic function for parsing conf pair values as int32_t (FR_TYPE_UINT32)
Definition at line 1755 of file cf_parse.c.
Here is the call graph for this function:
Here is the caller graph for this function:
1.9.8