The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
API to parse internal format configuration items into native C types. More...
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#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>
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_DEPRECATED(_name, _struct, _field) |
conf_parser_t entry which raises an error if a matching CONF_PAIR is found More... | |
#define | FR_CONF_FLAG_CHECK(_type, _flags, _c_type, _ptr_or_offset) _ptr_or_offset |
#define | FR_CONF_FUNC(_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 More... | |
#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 More... | |
#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 More... | |
#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 More... | |
#define | FR_CONF_OFFSET_SUBSECTION(_name, _flags, _struct, _field, _subcs) |
conf_parser_t which populates a sub-struct using a CONF_SECTION More... | |
#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 More... | |
#define | FR_CONF_POINTER(_name, _type, _flags, _res_p) |
conf_parser_t which parses a single CONF_PAIR producing a single global result More... | |
#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 More... | |
#define | FR_CONF_SUBSECTION_ALLOC(_name, _type, _flags, _struct, _field, _subcs) |
A conf_parser_t multi-subsection. More... | |
#define | FR_CONF_SUBSECTION_GLOBAL(_name, _flags, _subcs) |
conf_parser_t entry which runs conf_parser_t entries for a subsection without any output More... | |
#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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
int | cf_parse_gid (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) |
int | cf_section_parse (TALLOC_CTX *ctx, void *base, CONF_SECTION *cs) |
Parse a configuration section into user-supplied variables. More... | |
int | cf_section_parse_pass2 (void *base, CONF_SECTION *cs) |
Fixup xlat expansions and attributes. More... | |
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. More... | |
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) More... | |
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) More... | |
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_DEPRECATED = (1 << 10) , CONF_FLAG_REQUIRED = (1 << 11) , CONF_FLAG_ATTRIBUTE = (1 << 12) , CONF_FLAG_SECRET = (1 << 13) , CONF_FLAG_FILE_INPUT = (1 << 14) , CONF_FLAG_FILE_OUTPUT = (1 << 15) , CONF_FLAG_XLAT = (1 << 16) , CONF_FLAG_TMPL = (1 << 17) , CONF_FLAG_MULTI = (1 << 18) , CONF_FLAG_NOT_EMPTY = (1 << 19) , CONF_FLAG_FILE_EXISTS = (1 << 20) , CONF_FLAG_IS_SET = (1 << 21) , CONF_FLAG_OK_MISSING = (1 << 22) , CONF_FLAG_HIDDEN = (1 << 23) } |
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 622 of file cf_parse.h.
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 564 of file cf_parse.h.
Data Fields | ||
---|---|---|
union conf_parser_s | __unnamed__ |
Where to write status if FR_TYPE_IS_DEFAULT is set.
|
union conf_parser_s | __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 595 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 602 of file cf_parse.h.
Data Fields | ||
---|---|---|
__unnamed56__ | __unnamed__ | |
__unnamed56__ | __unnamed__ |
struct conf_parser_s.__unnamed56__.__unnamed58__ |
Definition at line 603 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 609 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 635 of file cf_parse.h.
#define CF_FILE_ERROR (1) |
Definition at line 634 of file cf_parse.h.
#define CF_FILE_MODULE (1 << 3) |
Definition at line 636 of file cf_parse.h.
#define CF_FILE_NONE (0) |
Definition at line 633 of file cf_parse.h.
#define cf_section_rule_push | ( | _cs, | |
_rule | |||
) | _cf_section_rule_push(_cs, _rule, __FILE__, __LINE__) |
Definition at line 657 of file cf_parse.h.
#define cf_section_rules_push | ( | _cs, | |
_rule | |||
) | _cf_section_rules_push(_cs, _rule, __FILE__, __LINE__) |
Definition at line 659 of file cf_parse.h.
#define CONF_CTYPE_TO_FLAGS | ( | _ct | ) |
Definition at line 190 of file cf_parse.h.
#define CONF_PARSER_PARTIAL_TERMINATOR |
Definition at line 630 of file cf_parse.h.
#define CONF_PARSER_TERMINATOR |
Definition at line 627 of file cf_parse.h.
#define FR_CONF_DEPRECATED | ( | _name, | |
_struct, | |||
_field | |||
) |
conf_parser_t entry which raises an error if a matching CONF_PAIR is found
[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 385 of file cf_parse.h.
#define FR_CONF_FLAG_CHECK | ( | _type, | |
_flags, | |||
_c_type, | |||
_ptr_or_offset | |||
) | _ptr_or_offset |
Definition at line 187 of file cf_parse.h.
#define FR_CONF_FUNC | ( | _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 | f lags 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 361 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 268 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 256 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 282 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 297 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 241 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 310 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 325 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 345 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 374 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 487 of file cf_parse.h.
#define FR_INTEGER_COND_CHECK | ( | _name, | |
_var, | |||
_cond, | |||
_new | |||
) |
Definition at line 479 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 331 of file cf_parse.h.
#define fr_rule_deprecated | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_DEPRECATED) |
Definition at line 439 of file cf_parse.h.
#define fr_rule_dflt | ( | _rule | ) | ((_rule)->dflt || (_rule)->dflt_func) |
Definition at line 460 of file cf_parse.h.
#define fr_rule_file_exists | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_FILE_EXISTS) |
Definition at line 458 of file cf_parse.h.
#define fr_rule_file_input | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_FILE_INPUT) |
Definition at line 445 of file cf_parse.h.
#define fr_rule_file_output | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_FILE_OUTPUT) |
Definition at line 447 of file cf_parse.h.
#define fr_rule_is_attribute | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_ATTRIBUTE) |
Definition at line 462 of file cf_parse.h.
#define fr_rule_is_set | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_IS_SET) |
Definition at line 454 of file cf_parse.h.
#define fr_rule_is_tmpl | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_TMPL) |
Definition at line 466 of file cf_parse.h.
#define fr_rule_is_xlat | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_XLAT) |
Definition at line 464 of file cf_parse.h.
#define fr_rule_multi | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_MULTI) |
Definition at line 450 of file cf_parse.h.
#define fr_rule_not_empty | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_NOT_EMPTY) |
Definition at line 452 of file cf_parse.h.
#define fr_rule_ok_missing | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_OK_MISSING) |
Definition at line 456 of file cf_parse.h.
#define fr_rule_required | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_REQUIRED) |
Definition at line 441 of file cf_parse.h.
#define fr_rule_secret | ( | _rule | ) | ((_rule)->flags & CONF_FLAG_SECRET) |
Definition at line 443 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 477 of file cf_parse.h.
#define FR_SIZE_COND_CHECK | ( | _name, | |
_var, | |||
_cond, | |||
_new | |||
) |
Definition at line 469 of file cf_parse.h.
#define FR_TIME_DELTA_BOUND_CHECK | ( | _name, | |
_var, | |||
_op, | |||
_bound | |||
) |
Definition at line 498 of file cf_parse.h.
#define FR_TIME_DELTA_COND_CHECK | ( | _name, | |
_var, | |||
_cond, | |||
_new | |||
) |
Definition at line 489 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 534 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 521 of file cf_parse.h.
typedef struct conf_parser_s conf_parser_t |
Definition at line 1 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_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_INPUT | File matching value must exist, and must be readable. |
CONF_FLAG_FILE_OUTPUT | File matching value must exist, and must be writable. |
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_FILE_EXISTS | File matching value must exist. |
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. |
Definition at line 397 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 1351 of file cf_parse.c.
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 1448 of file cf_parse.c.
void cf_pair_debug_log | ( | CONF_SECTION const * | cs, |
CONF_PAIR * | cp, | ||
conf_parser_t const * | rule | ||
) |
Definition at line 49 of file cf_parse.c.
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
#FR_TYPE_DEPRECATED -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_INPUT - File matching value must exist, and must be readable.flag
CONF_FLAG_FILE_OUTPUT - 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 700 of file cf_parse.c.
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 126 of file cf_parse.c.
int cf_parse_gid | ( | 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 | ||
) |
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 985 of file cf_parse.c.
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 1163 of file cf_parse.c.
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 1474 of file cf_parse.c.
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 1490 of file cf_parse.c.
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 1506 of file cf_parse.c.