The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Functions
cf_util.c File Reference

Functions for building and managing the structure of internal format config items. More...

#include <string.h>
#include <freeradius-devel/server/cf_file.h>
#include <freeradius-devel/server/cf_priv.h>
#include <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/atexit.h>
+ Include dependency graph for cf_util.c:

Go to the source code of this file.

Macros

#define FILENAME_TRUNCATE   60
 
#define IS_WILDCARD(_ident)   (_ident == CF_IDENT_ANY)
 

Functions

static int _cd_free (CONF_DATA *cd)
 Free user data associated with CONF_DATA. More...
 
void _cf_canonicalize_error (CONF_ITEM *ci, ssize_t slen, char const *msg, char const *str)
 
CONF_DATA const * _cf_data_add (CONF_ITEM *ci, void const *data, char const *name, bool do_free, char const *filename, int lineno)
 Add talloced user data to a config section. More...
 
CONF_DATA const * _cf_data_add_static (CONF_ITEM *ci, void const *data, char const *type, char const *name, char const *filename, int lineno)
 Add non-talloced user data to a config section. More...
 
CONF_DATA const * _cf_data_find (CONF_ITEM const *ci, char const *type, char const *name)
 Find user data in a config section. More...
 
CONF_DATA_cf_data_find_in_parent (CONF_ITEM const *ci, char const *type, char const *name)
 Find matching data in the specified section or one of its parents. More...
 
CONF_DATA const * _cf_data_find_next (CONF_ITEM const *ci, CONF_ITEM const *prev, char const *type, char const *name)
 Return the next item of user data. More...
 
void * _cf_data_remove (CONF_ITEM *parent, CONF_DATA const *cd)
 Remove data from a configuration section. More...
 
int _cf_data_walk (CONF_ITEM *ci, char const *type, cf_walker_t cb, void *ctx)
 Walk over a specific type of CONF_DATA. More...
 
void _cf_debug (CONF_ITEM const *ci)
 Print out debugging information about a CONFIG_ITEM. More...
 
char const * _cf_filename (CONF_ITEM const *ci)
 Return the filename the CONF_ITEM was parsed in. More...
 
void _cf_filename_set (CONF_ITEM *ci, char const *filename)
 Set the filename of a CONF_ITEM. More...
 
static int8_t _cf_ident1_cmp (void const *one, void const *two)
 Compare the first identifier of a child. More...
 
static int8_t _cf_ident2_cmp (void const *a, void const *b)
 Compare the first and second identifiers of a child. More...
 
void _cf_item_add (CONF_ITEM *parent, CONF_ITEM *child)
 Add a child. More...
 
void _cf_item_insert_after (CONF_ITEM *parent, CONF_ITEM *prev, CONF_ITEM *child)
 Insert a child after a given one. More...
 
CONF_ITEM_cf_item_next (CONF_ITEM const *ci, CONF_ITEM const *prev)
 Return the next child of cs. More...
 
CONF_ITEM_cf_item_remove (CONF_ITEM *parent, CONF_ITEM *child)
 Remove item from parent and fixup trees. More...
 
int _cf_lineno (CONF_ITEM const *ci)
 Return the lineno the CONF_ITEM was parsed at. More...
 
void _cf_lineno_set (CONF_ITEM *ci, int lineno)
 Set the line number of a CONF_ITEM. More...
 
void _cf_log (fr_log_type_t type, CONF_ITEM const *ci, char const *file, int line, char const *fmt,...)
 Log an error message relating to a CONF_ITEM. More...
 
void _cf_log_by_child (fr_log_type_t type, CONF_SECTION const *parent, char const *child, char const *file, int line, char const *fmt,...)
 Log an error message in the context of a child pair of the specified parent. More...
 
void _cf_log_perr (fr_log_type_t type, CONF_ITEM const *ci, char const *file, int line, fr_log_perror_format_t const *f_rules, char const *fmt,...)
 Log an error message relating to a CONF_ITEM. More...
 
void _cf_log_perr_by_child (fr_log_type_t type, CONF_SECTION const *parent, char const *child, char const *file, int line, fr_log_perror_format_t const *f_rules, char const *fmt,...)
 Log an error message in the context of a child pair of the specified parent. More...
 
void _cf_log_with_filename (fr_log_type_t type, CONF_ITEM const *ci, char const *file, int line, char const *fmt,...)
 Log a debug message relating to a CONF_ITEM. More...
 
CONF_ITEM_cf_parent (CONF_ITEM const *ci)
 Return the parent of a CONF_ITEM. More...
 
CONF_SECTION_cf_root (CONF_ITEM const *ci)
 Return the top level CONF_SECTION holding all other CONF_ITEM. More...
 
CONF_SECTION_cf_section_alloc (TALLOC_CTX *ctx, CONF_SECTION *parent, char const *name1, char const *name2, char const *filename, int lineno)
 Allocate a CONF_SECTION. More...
 
static int _cf_section_free (CONF_SECTION *cs)
 Free a section and associated trees. More...
 
void _cf_vlog (fr_log_type_t type, CONF_ITEM const *ci, char const *file, int line, char const *fmt, va_list ap)
 Log an error message relating to a CONF_ITEM. More...
 
void _cf_vlog_perr (fr_log_type_t type, CONF_ITEM const *ci, char const *file, int line, fr_log_perror_format_t const *f_rules, char const *fmt, va_list ap)
 Log an error message relating to a CONF_ITEM. More...
 
static void _pair_count (int *count, CONF_SECTION const *cs)
 Callback to determine the number of pairs in a section. More...
 
static CONF_DATAcf_data_alloc (CONF_ITEM *parent, void const *data, char const *type, char const *name, bool do_free)
 Allocate a new user data container. More...
 
CONF_ITEMcf_data_to_item (CONF_DATA const *cd)
 Cast CONF_DATA to a CONF_ITEM. More...
 
void * cf_data_value (CONF_DATA const *cd)
 Return the user assigned value of CONF_DATA. More...
 
static CONF_ITEMcf_find (CONF_ITEM const *parent, CONF_ITEM_TYPE type, char const *ident1, char const *ident2)
 Return the next child that's of the specified type with the specified identifiers. More...
 
static CONF_ITEMcf_find_next (CONF_ITEM const *parent, CONF_ITEM const *prev, CONF_ITEM_TYPE type, char const *ident1, char const *ident2)
 Return the next child that's of the specified type with the specified identifiers. More...
 
static int8_t cf_ident2_cmp (void const *one, void const *two)
 Compare only the second identifier of a child. More...
 
void cf_item_free_children (CONF_ITEM *ci)
 
static void cf_item_init (CONF_ITEM *ci, CONF_ITEM_TYPE type, CONF_ITEM *parent, char const *filename, int lineno)
 Initialize a CONF_ITEM, so we don't have repeated code. More...
 
bool cf_item_is_data (CONF_ITEM const *ci)
 Determine if CONF_ITEM is CONF_DATA. More...
 
bool cf_item_is_pair (CONF_ITEM const *ci)
 Determine if CONF_ITEM is a CONF_PAIR. More...
 
bool cf_item_is_section (CONF_ITEM const *ci)
 Determine if CONF_ITEM is a CONF_SECTION. More...
 
CONF_DATAcf_item_to_data (CONF_ITEM const *ci)
 Cast CONF_ITEM to CONF_DATA performing a type check. More...
 
CONF_PAIRcf_item_to_pair (CONF_ITEM const *ci)
 Cast a CONF_ITEM to a CONF_PAIR. More...
 
CONF_SECTIONcf_item_to_section (CONF_ITEM const *ci)
 Cast a CONF_ITEM to a CONF_SECTION. More...
 
static CONF_ITEMcf_next (CONF_ITEM const *parent, CONF_ITEM const *prev, CONF_ITEM_TYPE type)
 Return the next child that's of the specified type. More...
 
CONF_PAIRcf_pair_alloc (CONF_SECTION *parent, char const *attr, char const *value, fr_token_t op, fr_token_t lhs_quote, fr_token_t rhs_quote)
 Allocate a CONF_PAIR. More...
 
char const * cf_pair_attr (CONF_PAIR const *pair)
 Return the attr of a CONF_PAIR. More...
 
fr_token_t cf_pair_attr_quote (CONF_PAIR const *pair)
 Return the value (lhs) quoting of a pair. More...
 
unsigned int cf_pair_count (CONF_SECTION const *cs, char const *attr)
 Count the number of times an attribute occurs in a parent section. More...
 
unsigned int cf_pair_count_descendents (CONF_SECTION const *cs)
 Count the number of conf pairs beneath a section. More...
 
CONF_PAIRcf_pair_dup (CONF_SECTION *parent, CONF_PAIR *cp)
 Duplicate a CONF_PAIR. More...
 
CONF_PAIRcf_pair_find (CONF_SECTION const *cs, char const *attr)
 Search for a CONF_PAIR with a specific name. More...
 
CONF_PAIRcf_pair_find_in_parent (CONF_SECTION const *cs, char const *attr)
 Find a pair with a name matching attr in the specified section or one of its parents. More...
 
CONF_PAIRcf_pair_find_next (CONF_SECTION const *cs, CONF_PAIR const *prev, char const *attr)
 Find a pair with a name matching attr, after specified pair. More...
 
int cf_pair_in_table (int32_t *out, fr_table_num_sorted_t const *table, size_t table_len, CONF_PAIR *cp)
 Check to see if the CONF_PAIR value is present in the specified table. More...
 
bool cf_pair_is_parsed (CONF_PAIR *cp)
 Return whether a pair has already been parsed. More...
 
void cf_pair_mark_parsed (CONF_PAIR *cp)
 Mark a pair as parsed. More...
 
CONF_PAIRcf_pair_next (CONF_SECTION const *cs, CONF_PAIR const *prev)
 Return the next child that's a CONF_PAIR. More...
 
fr_token_t cf_pair_operator (CONF_PAIR const *pair)
 Return the operator of a pair. More...
 
int cf_pair_replace (CONF_SECTION *cs, CONF_PAIR *cp, char const *value)
 Replace pair in a given section with a new pair, of the given value. More...
 
CONF_ITEMcf_pair_to_item (CONF_PAIR const *cp)
 Cast a CONF_PAIR to a CONF_ITEM. More...
 
char const * cf_pair_value (CONF_PAIR const *pair)
 Return the value of a CONF_PAIR. More...
 
fr_token_t cf_pair_value_quote (CONF_PAIR const *pair)
 Return the value (rhs) quoting of a pair. More...
 
fr_slen_t cf_pair_values_concat (fr_sbuff_t *out, CONF_SECTION const *cs, char const *attr, char const *sep)
 Concatenate the values of any pairs with name attr. More...
 
void cf_section_add_name2_quote (CONF_SECTION *cs, fr_token_t token)
 Set the quoting of the name2 identifier. More...
 
char const * cf_section_argv (CONF_SECTION const *cs, int argc)
 Return variadic argument at the specified index. More...
 
fr_token_t cf_section_argv_quote (CONF_SECTION const *cs, int argc)
 Return the quoting for one of the variadic arguments. More...
 
CONF_SECTIONcf_section_dup (TALLOC_CTX *ctx, CONF_SECTION *parent, CONF_SECTION const *cs, char const *name1, char const *name2, bool copy_meta)
 Duplicate a configuration section. More...
 
CONF_SECTIONcf_section_find (CONF_SECTION const *cs, char const *name1, char const *name2)
 Find a CONF_SECTION with name1 and optionally name2. More...
 
CONF_SECTIONcf_section_find_in_parent (CONF_SECTION const *cs, char const *name1, char const *name2)
 Find a section in the lineage of a CONF_SECTION which matches a specific name1 and optionally name2. More...
 
CONF_SECTIONcf_section_find_next (CONF_SECTION const *cs, CONF_SECTION const *prev, char const *name1, char const *name2)
 Return the next matching section. More...
 
CONF_SECTIONcf_section_find_parent (CONF_SECTION const *cs, char const *name1, char const *name2)
 Find a parent CONF_SECTION with name1 and optionally name2. More...
 
char const * cf_section_name (CONF_SECTION const *cs)
 Return name2 if set, else name1. More...
 
char const * cf_section_name1 (CONF_SECTION const *cs)
 Return the second identifier of a CONF_SECTION. More...
 
char const * cf_section_name2 (CONF_SECTION const *cs)
 Return the second identifier of a CONF_SECTION. More...
 
fr_token_t cf_section_name2_quote (CONF_SECTION const *cs)
 Return the quoting of the name2 identifier. More...
 
int8_t cf_section_name_cmp (CONF_SECTION const *cs, char const *name1, char const *name2)
 Check if a given section matches the specified name1/name2 identifiers. More...
 
CONF_SECTIONcf_section_next (CONF_SECTION const *cs, CONF_SECTION const *prev)
 Return the next child that's a CONF_SECTION. More...
 
CONF_ITEMcf_section_to_item (CONF_SECTION const *cs)
 Cast a CONF_SECTION to a CONF_ITEM. More...
 
char const * cf_section_value_find (CONF_SECTION const *cs, char const *attr)
 Find a pair in a CONF_SECTION. More...
 
static void truncate_filename (char const **e, char const **p, int *len, char const *filename)
 

Detailed Description

Functions for building and managing the structure of internal format config items.

Id
d8757fa6af2e6ca3e2002b09bf62d81dd2372bff

Definition in file cf_util.c.

Macro Definition Documentation

◆ FILENAME_TRUNCATE

#define FILENAME_TRUNCATE   60

◆ IS_WILDCARD

#define IS_WILDCARD (   _ident)    (_ident == CF_IDENT_ANY)

Definition at line 57 of file cf_util.c.

Function Documentation

◆ _cd_free()

static int _cd_free ( CONF_DATA cd)
static

Free user data associated with CONF_DATA.

Parameters
[in]cdbeing freed.
Returns
0

Definition at line 1565 of file cf_util.c.

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

◆ _cf_canonicalize_error()

void _cf_canonicalize_error ( CONF_ITEM ci,
ssize_t  slen,
char const *  msg,
char const *  str 
)

Definition at line 2335 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_data_add()

CONF_DATA const* _cf_data_add ( CONF_ITEM ci,
void const *  data,
char const *  name,
bool  do_free,
char const *  filename,
int  lineno 
)

Add talloced user data to a config section.

Parameters
[in]cito add data to.
[in]datato add.
[in]nameString identifier of the user data.
[in]do_freeFunction to free user data when the CONF_SECTION is freed.
[in]filenameSource file the CONF_DATA was added in.
[in]linenothe CONF_DATA was added at.
Returns
  • CONF_DATA - opaque handle to the stored data - on success.
  • NULL error.

Definition at line 1703 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_data_add_static()

CONF_DATA const* _cf_data_add_static ( CONF_ITEM ci,
void const *  data,
char const *  type,
char const *  name,
char const *  filename,
int  lineno 
)

Add non-talloced user data to a config section.

Parameters
[in]cito add data to.
[in]datato add.
[in]typeidentifier of the user data.
[in]nameString identifier of the user data.
[in]filenameSource file the CONF_DATA was added in.
[in]linenothe CONF_DATA was added at.
  • CONF_DATA - opaque handle to the stored data - on success.
  • NULL error.

Definition at line 1745 of file cf_util.c.

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

◆ _cf_data_find()

CONF_DATA const* _cf_data_find ( CONF_ITEM const *  ci,
char const *  type,
char const *  name 
)

Find user data in a config section.

Parameters
[in]ciThe section to search for data in.
[in]typeof user data. Used for name spacing and walking over a specific type of user data.
[in]nameString identifier of the user data. Special value CF_IDENT_ANY may be used to match on type only.
Returns
  • The user data.
  • NULL if no user data exists.

Definition at line 1627 of file cf_util.c.

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

◆ _cf_data_find_in_parent()

CONF_DATA* _cf_data_find_in_parent ( CONF_ITEM const *  ci,
char const *  type,
char const *  name 
)

Find matching data in the specified section or one of its parents.

Parameters
[in]ciThe section to search for data in.
[in]typeof user data. Used for name spacing and walking over a specific type of user data.
[in]nameString identifier of the user data. Special value CF_IDENT_ANY may be used to match on type only.
Returns

Definition at line 1661 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_data_find_next()

CONF_DATA const* _cf_data_find_next ( CONF_ITEM const *  ci,
CONF_ITEM const *  prev,
char const *  type,
char const *  name 
)

Return the next item of user data.

Parameters
[in]ciThe section to search for data in.
[in]prevsection we found. May be NULL in which case we just return the next section after prev.
[in]typeof user data. Used for name spacing and walking over a specific type of user data.
[in]nameString identifier of the user data. Special value CF_IDENT_ANY can be used to match any name2 value.
Returns

Definition at line 1645 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_data_remove()

void* _cf_data_remove ( CONF_ITEM parent,
CONF_DATA const *  cd 
)

Remove data from a configuration section.

Note
If cd was not found it will not be freed, and it is the caller's responsibility to free it explicitly, or free the section it belongs to.
Parameters
[in]parentto remove data from.
[in]cdopaque handle of the stored data.
Returns
  • The value stored within the data (if cd is valid and was found and removed).
  • NULL if not found.

Definition at line 1789 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_data_walk()

int _cf_data_walk ( CONF_ITEM ci,
char const *  type,
cf_walker_t  cb,
void *  ctx 
)

Walk over a specific type of CONF_DATA.

Parameters
[in]cicontaining the CONF_DATA to walk over.
[in]typeof CONF_DATA to walk over.
[in]cbto call when we find CONF_DATA of the specified type.
[in]ctxto pass to cb.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1817 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_debug()

void _cf_debug ( CONF_ITEM const *  ci)

Print out debugging information about a CONFIG_ITEM.

Parameters
[in]cibeing debugged.

Definition at line 2194 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_filename()

char const* _cf_filename ( CONF_ITEM const *  ci)

Return the filename the CONF_ITEM was parsed in.

Parameters
[in]cito return the location of.
Returns
  • NULL if the CONF_ITEM was created programmatically.
  • The path of the config file the CONF_ITEM was located in.

Definition at line 569 of file cf_util.c.

◆ _cf_filename_set()

void _cf_filename_set ( CONF_ITEM ci,
char const *  filename 
)

Set the filename of a CONF_ITEM.

Parameters
[in]cito set filename on.
[in]filenameto set.

Definition at line 861 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_ident1_cmp()

static int8_t _cf_ident1_cmp ( void const *  one,
void const *  two 
)
inlinestatic

Compare the first identifier of a child.

For CONF_ITEM_PAIR this is 'attr'. For CONF_ITEM_SECTION this is 'name1'. For CONF_ITEM_DATA this is 'type'.

Parameters
[in]oneFirst CONF_ITEM to compare.
[in]twoSecond CONF_ITEM to compare.
Returns
CMP(one, two)

Definition at line 241 of file cf_util.c.

+ Here is the caller graph for this function:

◆ _cf_ident2_cmp()

static int8_t _cf_ident2_cmp ( void const *  a,
void const *  b 
)
static

Compare the first and second identifiers of a child.

For CONF_ITEM_SECTION this is 'name2'. For CONF_ITEM_DATA this is 'name'.

Parameters
[in]aFirst CONF_ITEM to compare.
[in]bSecond CONF_ITEM to compare.
Returns
CMP(a, b)

Definition at line 348 of file cf_util.c.

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

◆ _cf_item_add()

void _cf_item_add ( CONF_ITEM parent,
CONF_ITEM child 
)

Add a child.

Parameters
[in]parentto add child to.
[in]childto add.

Definition at line 363 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_item_insert_after()

void _cf_item_insert_after ( CONF_ITEM parent,
CONF_ITEM prev,
CONF_ITEM child 
)

Insert a child after a given one.

Parameters
[in]parentto add child to.
[in]prevprevious
[in]childto add.

Definition at line 390 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_item_next()

CONF_ITEM* _cf_item_next ( CONF_ITEM const *  ci,
CONF_ITEM const *  prev 
)

Return the next child of cs.

Parameters
[in]cito return children from.
[in]prevchild to start searching from.
Returns

Definition at line 490 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_item_remove()

CONF_ITEM* _cf_item_remove ( CONF_ITEM parent,
CONF_ITEM child 
)

Remove item from parent and fixup trees.

Parameters
[in]parentto remove child from.
[in]childto remove.
Returns
  • The item removed.
  • NULL if the item wasn't set.

Definition at line 428 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_lineno()

int _cf_lineno ( CONF_ITEM const *  ci)

Return the lineno the CONF_ITEM was parsed at.

Parameters
[in]cito return the location of.
Returns
  • -1 if the CONF_ITEM was created programmatically.
  • >= 0 where in the config file the line was parsed from.

Definition at line 555 of file cf_util.c.

◆ _cf_lineno_set()

void _cf_lineno_set ( CONF_ITEM ci,
int  lineno 
)

Set the line number of a CONF_ITEM.

Parameters
[in]cito set the lineno for.
[in]linenoto set.

Definition at line 873 of file cf_util.c.

◆ _cf_log()

void _cf_log ( fr_log_type_t  type,
CONF_ITEM const *  ci,
char const *  file,
int  line,
char const *  fmt,
  ... 
)

Log an error message relating to a CONF_ITEM.

Parameters
[in]typeof log message.
[in]filesrc file the log message was generated in.
[in]linenumber the log message was generated on.
[in]ciCONF_ITEM to print file/lineno for.
[in]fmtof the message.
[in]...Message args.

Definition at line 1965 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_log_by_child()

void _cf_log_by_child ( fr_log_type_t  type,
CONF_SECTION const *  parent,
char const *  child,
char const *  file,
int  line,
char const *  fmt,
  ... 
)

Log an error message in the context of a child pair of the specified parent.

Parameters
[in]parentcontaining the pair.
[in]childname to use as a logging context.
[in]typeof log message.
[in]filesrc file the log message was generated in.
[in]linenumber the log message was generated on.
[in]fmtof the message.
[in]...Message args.

Definition at line 2139 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_log_perr()

void _cf_log_perr ( fr_log_type_t  type,
CONF_ITEM const *  ci,
char const *  file,
int  line,
fr_log_perror_format_t const *  f_rules,
char const *  fmt,
  ... 
)

Log an error message relating to a CONF_ITEM.

Drains the fr_strerror() stack emitting one or more error messages.

Parameters
[in]typeof log message.
[in]filesrc file the log message was generated in.
[in]linenumber the log message was generated on.
[in]ciCONF_ITEM to print file/lineno for.
[in]f_rulesAdditional optional formatting controls.
[in]fmtof the message.
[in]...Message args.

Definition at line 2077 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_log_perr_by_child()

void _cf_log_perr_by_child ( fr_log_type_t  type,
CONF_SECTION const *  parent,
char const *  child,
char const *  file,
int  line,
fr_log_perror_format_t const *  f_rules,
char const *  fmt,
  ... 
)

Log an error message in the context of a child pair of the specified parent.

Parameters
[in]parentcontaining the pair.
[in]childname to use as a logging context.
[in]typeof log message.
[in]filesrc file the log message was generated in.
[in]linenumber the log message was generated on.
[in]f_rulesLine prefixes.
[in]fmtof the message.
[in]...Message args.

Definition at line 2170 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_log_with_filename()

void _cf_log_with_filename ( fr_log_type_t  type,
CONF_ITEM const *  ci,
char const *  file,
int  line,
char const *  fmt,
  ... 
)

Log a debug message relating to a CONF_ITEM.

Always emits a filename/lineno prefix if available

Parameters
[in]typeof log message.
[in]filesrc file the log message was generated in.
[in]linenumber the log message was generated on.
[in]ciCONF_ITEM to print file/lineno for.
[in]fmtof the message.
[in]...Message args.

Definition at line 2100 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_parent()

CONF_ITEM* _cf_parent ( CONF_ITEM const *  ci)

Return the parent of a CONF_ITEM.

Parameters
[in]cito return the parent of.
Returns
  • NULL if ci was NULL or it has no parents.
  • The parent of ci.

Definition at line 541 of file cf_util.c.

◆ _cf_root()

CONF_SECTION* _cf_root ( CONF_ITEM const *  ci)

Return the top level CONF_SECTION holding all other CONF_ITEM.

Parameters
[in]cito traverse up from.
Returns

Definition at line 523 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_section_alloc()

CONF_SECTION* _cf_section_alloc ( TALLOC_CTX *  ctx,
CONF_SECTION parent,
char const *  name1,
char const *  name2,
char const *  filename,
int  lineno 
)

Allocate a CONF_SECTION.

Parameters
[in]ctxto allocate
[in]parentCONF_SECTION to hang this CONF_SECTION off of. If parent is not NULL, the new section will be added as a child.
[in]name1Primary name.
[in]name2Secondary name.
[in]filenameCaller file name for debugging. May be overridden later.
[in]linenoCaller line number for debugging. May be overridden later.
Returns

Definition at line 752 of file cf_util.c.

+ Here is the call graph for this function:

◆ _cf_section_free()

static int _cf_section_free ( CONF_SECTION cs)
static

Free a section and associated trees.

Parameters
[in]csto free.
Returns
0

Definition at line 731 of file cf_util.c.

+ Here is the caller graph for this function:

◆ _cf_vlog()

void _cf_vlog ( fr_log_type_t  type,
CONF_ITEM const *  ci,
char const *  file,
int  line,
char const *  fmt,
va_list  ap 
)

Log an error message relating to a CONF_ITEM.

Parameters
[in]typeof log message.
[in]ciCONF_ITEM to print file/lineno for.
[in]filesrc file the log message was generated in.
[in]linenumber the log message was generated on.
[in]fmtof the message.
[in]apMessage args.

Definition at line 1926 of file cf_util.c.

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

◆ _cf_vlog_perr()

void _cf_vlog_perr ( fr_log_type_t  type,
CONF_ITEM const *  ci,
char const *  file,
int  line,
fr_log_perror_format_t const *  f_rules,
char const *  fmt,
va_list  ap 
)

Log an error message relating to a CONF_ITEM.

Drains the fr_strerror() stack emitting one or more error messages.

Parameters
[in]typeof log message.
[in]filesrc file the log message was generated in.
[in]linenumber the log message was generated on.
[in]ciCONF_ITEM to print file/lineno for.
[in]f_rulesAdditional optional formatting controls.
[in]fmtof the message.
[in]apMessage args.

Definition at line 1988 of file cf_util.c.

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

◆ _pair_count()

static void _pair_count ( int *  count,
CONF_SECTION const *  cs 
)
static

Callback to determine the number of pairs in a section.

Parameters
[out]countWhere we store the number of pairs found.
[in]cswe're currently searching in.

Definition at line 1403 of file cf_util.c.

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

◆ cf_data_alloc()

static CONF_DATA* cf_data_alloc ( CONF_ITEM parent,
void const *  data,
char const *  type,
char const *  name,
bool  do_free 
)
static

Allocate a new user data container.

Parameters
[in]parentCONF_PAIR, or CONF_SECTION to hang CONF_DATA off of.
[in]databeing added.
[in]typeof data being added.
[in]nameString identifier of the user data.
[in]do_freefunction, called when the parent CONF_SECTION is being freed.
Returns
  • CONF_DATA on success.
  • NULL on error.

Definition at line 1587 of file cf_util.c.

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

◆ cf_data_to_item()

CONF_ITEM* cf_data_to_item ( CONF_DATA const *  cd)

Cast CONF_DATA to a CONF_ITEM.

Parameters
[in]cdto cast.
Returns
  • The common CONF_ITEM header.
  • NULL if cd was NULL.

Definition at line 719 of file cf_util.c.

◆ cf_data_value()

void* cf_data_value ( CONF_DATA const *  cd)

Return the user assigned value of CONF_DATA.

Parameters
[in]cdto return value of.
Returns
the user data stored within the CONF_DATA.

Definition at line 1680 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_find()

static CONF_ITEM* cf_find ( CONF_ITEM const *  parent,
CONF_ITEM_TYPE  type,
char const *  ident1,
char const *  ident2 
)
static

Return the next child that's of the specified type with the specified identifiers.

Parameters
[in]parentThe section we're searching in.
[in]typeof CONF_ITEM we're searching for.
[in]ident1The first identifier.
[in]ident2The second identifier. Special value CF_IDENT_ANY can be used to match any ident2 value.
Returns
  • The first matching item.
  • NULL if no items matched.

Definition at line 70 of file cf_util.c.

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

◆ cf_find_next()

static CONF_ITEM* cf_find_next ( CONF_ITEM const *  parent,
CONF_ITEM const *  prev,
CONF_ITEM_TYPE  type,
char const *  ident1,
char const *  ident2 
)
static

Return the next child that's of the specified type with the specified identifiers.

Parameters
[in]parentThe section we're searching in.
[in]previtem we found, or NULL to start from the beginning.
[in]typeof CONF_ITEM we're searching for.
[in]ident1The first identifier.
[in]ident2The second identifier. Special value CF_IDENT_ANY can be used to match any ident2 value.
Returns
  • The first matching item.
  • NULL if no items matched.

Definition at line 157 of file cf_util.c.

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

◆ cf_ident2_cmp()

static int8_t cf_ident2_cmp ( void const *  one,
void const *  two 
)
inlinestatic

Compare only the second identifier of a child.

For CONF_ITEM_SECTION this is 'name2'. For CONF_ITEM_DATA this is 'name'.

Parameters
[in]oneFirst CONF_ITEM to compare.
[in]twoSecond CONF_ITEM to compare.
Returns
CMP(one,two)

Definition at line 298 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_item_free_children()

void cf_item_free_children ( CONF_ITEM ci)

Definition at line 2322 of file cf_util.c.

+ Here is the call graph for this function:

◆ cf_item_init()

static void cf_item_init ( CONF_ITEM ci,
CONF_ITEM_TYPE  type,
CONF_ITEM parent,
char const *  filename,
int  lineno 
)
static

Initialize a CONF_ITEM, so we don't have repeated code.

Parameters
[in]cithe CONF_ITEM to initialize
[in]typethe type to set
[in]parentthe parent node hosting this one
[in]filenamewhich caused this node to be created
[in]linenowhere in the filename

Definition at line 505 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_item_is_data()

bool cf_item_is_data ( CONF_ITEM const *  ci)

Determine if CONF_ITEM is CONF_DATA.

Parameters
[in]cito check.
Returns
  • true if ci is CONF_DATA.
  • false if ci is another specialisation.

Definition at line 611 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_item_is_pair()

bool cf_item_is_pair ( CONF_ITEM const *  ci)

Determine if CONF_ITEM is a CONF_PAIR.

Parameters
[in]cito check.
Returns
  • true if ci is a CONF_PAIR.
  • false if ci is another specialisation.

Definition at line 597 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_item_is_section()

bool cf_item_is_section ( CONF_ITEM const *  ci)

Determine if CONF_ITEM is a CONF_SECTION.

Parameters
[in]cito check.
Returns
  • true if ci is a CONF_SECTION.
  • false if ci is another specialisation.

Definition at line 583 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_item_to_data()

CONF_DATA* cf_item_to_data ( CONF_ITEM const *  ci)

Cast CONF_ITEM to CONF_DATA performing a type check.

Note
Will assert if ci does not contain CONF_DATA.
Parameters
[in]cito cast.
Returns

Definition at line 669 of file cf_util.c.

+ Here is the call graph for this function:

◆ cf_item_to_pair()

CONF_PAIR* cf_item_to_pair ( CONF_ITEM const *  ci)

Cast a CONF_ITEM to a CONF_PAIR.

Note
Will assert if ci does not contain CONF_PAIR.
Parameters
[in]cito cast.
Returns

Definition at line 629 of file cf_util.c.

+ Here is the call graph for this function:

◆ cf_item_to_section()

CONF_SECTION* cf_item_to_section ( CONF_ITEM const *  ci)

Cast a CONF_ITEM to a CONF_SECTION.

Note
Will assert if ci does not contain CONF_SECTION.
Parameters
[in]cito cast.
Returns

Definition at line 649 of file cf_util.c.

+ Here is the call graph for this function:

◆ cf_next()

static CONF_ITEM* cf_next ( CONF_ITEM const *  parent,
CONF_ITEM const *  prev,
CONF_ITEM_TYPE  type 
)
static

Return the next child that's of the specified type.

Parameters
[in]parentto return children from.
[in]prevchild to start searching from.
[in]typeto search for.
Returns
  • The next CONF_ITEM that's a child of ci matching type.
  • NULL if no CONF_ITEM matches that criteria.

Definition at line 48 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_pair_alloc()

CONF_PAIR* cf_pair_alloc ( CONF_SECTION parent,
char const *  attr,
char const *  value,
fr_token_t  op,
fr_token_t  lhs_quote,
fr_token_t  rhs_quote 
)

Allocate a CONF_PAIR.

Parameters
[in]parentCONF_SECTION to hang this CONF_PAIR off of.
[in]attrname.
[in]valueof CONF_PAIR.
[in]opT_OP_EQ, T_OP_SET etc.
[in]lhs_quoteT_BARE_WORD, T_DOUBLE_QUOTED_STRING, T_BACK_QUOTED_STRING.
[in]rhs_quoteT_BARE_WORD, T_DOUBLE_QUOTED_STRING, T_BACK_QUOTED_STRING.
Returns

Definition at line 1220 of file cf_util.c.

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

◆ cf_pair_attr()

char const* cf_pair_attr ( CONF_PAIR const *  pair)

Return the attr of a CONF_PAIR.

Return the LHS value of a pair (the attribute).

Parameters
[in]pairto return the attribute for.
Returns
  • NULL if the pair was NULL.
  • The attribute name of the pair.

Definition at line 1495 of file cf_util.c.

◆ cf_pair_attr_quote()

fr_token_t cf_pair_attr_quote ( CONF_PAIR const *  pair)

Return the value (lhs) quoting of a pair.

Parameters
pairto extract value type from.
Returns

Definition at line 1540 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_pair_count()

unsigned int cf_pair_count ( CONF_SECTION const *  cs,
char const *  attr 
)

Count the number of times an attribute occurs in a parent section.

Parameters
[in]csto search for items in.
[in]attrto search for.
Returns
The number of pairs of that attribute type.

Definition at line 1437 of file cf_util.c.

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

◆ cf_pair_count_descendents()

unsigned int cf_pair_count_descendents ( CONF_SECTION const *  cs)

Count the number of conf pairs beneath a section.

Parameters
[in]csto search for items in.
Returns
The number of pairs nested within section.

Definition at line 1422 of file cf_util.c.

+ Here is the call graph for this function:

◆ cf_pair_dup()

CONF_PAIR* cf_pair_dup ( CONF_SECTION parent,
CONF_PAIR cp 
)

Duplicate a CONF_PAIR.

Parameters
parentto allocate new pair in.
cpto duplicate.
Returns
  • NULL on error.
  • A duplicate of the input pair.

Definition at line 1261 of file cf_util.c.

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

◆ cf_pair_find()

CONF_PAIR* cf_pair_find ( CONF_SECTION const *  cs,
char const *  attr 
)

Search for a CONF_PAIR with a specific name.

Parameters
[in]csto search in.
[in]attrto find.
Returns
  • The next matching CONF_PAIR.
  • NULL if none matched.

Definition at line 1356 of file cf_util.c.

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

◆ cf_pair_find_in_parent()

CONF_PAIR* cf_pair_find_in_parent ( CONF_SECTION const *  cs,
char const *  attr 
)

Find a pair with a name matching attr in the specified section or one of its parents.

Parameters
[in]csto search in. Will start in the current section and work upwards.
[in]attrto find.
Returns
  • A matching CONF_PAIR.
  • NULL if none matched.

Definition at line 1384 of file cf_util.c.

+ Here is the call graph for this function:

◆ cf_pair_find_next()

CONF_PAIR* cf_pair_find_next ( CONF_SECTION const *  cs,
CONF_PAIR const *  prev,
char const *  attr 
)

Find a pair with a name matching attr, after specified pair.

Parameters
[in]csto search in.
[in]prevPair to search from (may be NULL).
[in]attrto find (may be NULL in which case any attribute matches).
Returns
  • The next matching CONF_PAIR
  • NULL if none matched.

Definition at line 1370 of file cf_util.c.

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

◆ cf_pair_in_table()

int cf_pair_in_table ( int32_t *  out,
fr_table_num_sorted_t const *  table,
size_t  table_len,
CONF_PAIR cp 
)

Check to see if the CONF_PAIR value is present in the specified table.

If it's not present, return an error and produce a helpful log message

Parameters
[out]outThe result of parsing the pair value.
[in]tableto look for string values in.
[in]table_lenLength of the table.
[in]cpto parse.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1886 of file cf_util.c.

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

◆ cf_pair_is_parsed()

bool cf_pair_is_parsed ( CONF_PAIR cp)

Return whether a pair has already been parsed.

Parameters
[in]cpto check.
Returns
  • true if pair has been parsed.
  • false if the pair hasn't been parsed.

Definition at line 1330 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_pair_mark_parsed()

void cf_pair_mark_parsed ( CONF_PAIR cp)

Mark a pair as parsed.

Parameters
[in]cpto mark as parsed.

Definition at line 1318 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_pair_next()

CONF_PAIR* cf_pair_next ( CONF_SECTION const *  cs,
CONF_PAIR const *  prev 
)

Return the next child that's a CONF_PAIR.

Parameters
[in]csto return children from.
[in]prevchild to start searching from.
Returns
  • The next CONF_ITEM that's a child of cs and a CONF_PAIR.
  • NULL if no CONF_ITEM matches that criteria.

Definition at line 1343 of file cf_util.c.

+ Here is the call graph for this function:

◆ cf_pair_operator()

fr_token_t cf_pair_operator ( CONF_PAIR const *  pair)

Return the operator of a pair.

Parameters
[in]pairto return the operator of.
Returns
  • T_INVALID if pair was NULL.
  • T_OP_* (one of the operator constants).

Definition at line 1525 of file cf_util.c.

◆ cf_pair_replace()

int cf_pair_replace ( CONF_SECTION cs,
CONF_PAIR cp,
char const *  value 
)

Replace pair in a given section with a new pair, of the given value.

Note
A new pair with the same metadata as the CONF_PAIR will be added even if the CONF_PAIR can't be found inside the CONF_SECTION.
Parameters
[in]csto replace pair in.
[in]cpto replace.
[in]valueNew value to assign to cp.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1290 of file cf_util.c.

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

◆ cf_pair_to_item()

CONF_ITEM* cf_pair_to_item ( CONF_PAIR const *  cp)

Cast a CONF_PAIR to a CONF_ITEM.

Parameters
[in]cpto cast.
Returns
  • The common CONF_ITEM header.
  • NULL if cp was NULL.

Definition at line 687 of file cf_util.c.

◆ cf_pair_value()

char const* cf_pair_value ( CONF_PAIR const *  pair)

Return the value of a CONF_PAIR.

Return the RHS value of a pair (the value).

Parameters
[in]pairto return the value of.
Returns
  • NULL if pair was NULL or the pair has no value.
  • The string value of the pair.

Definition at line 1511 of file cf_util.c.

◆ cf_pair_value_quote()

fr_token_t cf_pair_value_quote ( CONF_PAIR const *  pair)

Return the value (rhs) quoting of a pair.

Parameters
pairto extract value type from.
Returns

Definition at line 1555 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_pair_values_concat()

fr_slen_t cf_pair_values_concat ( fr_sbuff_t out,
CONF_SECTION const *  cs,
char const *  attr,
char const *  sep 
)

Concatenate the values of any pairs with name attr.

Parameters
[out]outwhere to write the concatenated values.
[in]csto search in.
[in]attrto search for.
[in]septo use to separate values
Returns
  • Length of the data written to out on success.
  • < 0 on failure. Number of additional bytes required in buffer.

Definition at line 1457 of file cf_util.c.

+ Here is the call graph for this function:

◆ cf_section_add_name2_quote()

void cf_section_add_name2_quote ( CONF_SECTION cs,
fr_token_t  token 
)

Set the quoting of the name2 identifier.

Parameters
[in]cscontaining name2.
[in]tokenthe quote token

Definition at line 1183 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_section_argv()

char const* cf_section_argv ( CONF_SECTION const *  cs,
int  argc 
)

Return variadic argument at the specified index.

Parameters
[in]cscontaining the arguments.
[in]argcArgument index. Note name1 and name2 are not counted in this index.
Returns
the argument value or NULL.

Definition at line 1154 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_section_argv_quote()

fr_token_t cf_section_argv_quote ( CONF_SECTION const *  cs,
int  argc 
)

Return the quoting for one of the variadic arguments.

Parameters
[in]cscontaining the arguments.
[in]argcArgument index. Note name1 and name2 are not counted in this index.
Returns

Definition at line 1201 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_section_dup()

CONF_SECTION* cf_section_dup ( TALLOC_CTX *  ctx,
CONF_SECTION parent,
CONF_SECTION const *  cs,
char const *  name1,
char const *  name2,
bool  copy_meta 
)

Duplicate a configuration section.

Note
recursively duplicates any child sections.
does not duplicate any data associated with a section, or its child sections.
Parameters
[in]ctxto allocate memory in.
[in]parentsection (may be NULL).
[in]csto duplicate.
[in]name1of new section.
[in]name2of new section.
[in]copy_metaCopy additional meta data for a section (like template, base, depth and variables).
Returns
  • A duplicate of the existing section.
  • NULL on error.

Definition at line 894 of file cf_util.c.

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

◆ cf_section_find()

CONF_SECTION* cf_section_find ( CONF_SECTION const *  cs,
char const *  name1,
char const *  name2 
)

Find a CONF_SECTION with name1 and optionally name2.

Parameters
[in]csThe section we're searching in.
[in]name1of the section we're searching for. Special value CF_IDENT_ANY can be used to match any name1 value.
[in]name2of the section we're searching for. Special value CF_IDENT_ANY can be used to match any name2 value.
Returns
  • The first matching subsection.
  • NULL if no subsections match.

Definition at line 970 of file cf_util.c.

+ Here is the call graph for this function:

◆ cf_section_find_in_parent()

CONF_SECTION* cf_section_find_in_parent ( CONF_SECTION const *  cs,
char const *  name1,
char const *  name2 
)

Find a section in the lineage of a CONF_SECTION which matches a specific name1 and optionally name2.

Will walk up the configuration tree, searching in each parent until a matching section is found or we hit the root.

Parameters
[in]csThe section we're searching in.
[in]name1of the section we're searching for. Special value CF_IDENT_ANY can be used to match any name1 value.
[in]name2of the section we're searching for. Special value CF_IDENT_ANY can be used to match any name2 value.
Returns
  • The first matching subsection.
  • NULL if no subsections match.

Definition at line 1012 of file cf_util.c.

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

◆ cf_section_find_next()

CONF_SECTION* cf_section_find_next ( CONF_SECTION const *  cs,
CONF_SECTION const *  prev,
char const *  name1,
char const *  name2 
)

Return the next matching section.

Parameters
[in]csThe section we're searching in.
[in]prevsection we found. May be NULL in which case we just return the next section after prev.
[in]name1of the section we're searching for. Special value CF_IDENT_ANY can be used to match any name1 value.
[in]name2of the section we're searching for. Special value CF_IDENT_ANY can be used to match any name2 value.
Returns
  • The next CONF_SECTION.
  • NULL if there are no more CONF_SECTIONs

Definition at line 991 of file cf_util.c.

+ Here is the call graph for this function:

◆ cf_section_find_parent()

CONF_SECTION* cf_section_find_parent ( CONF_SECTION const *  cs,
char const *  name1,
char const *  name2 
)

Find a parent CONF_SECTION with name1 and optionally name2.

Parameters
[in]csThe section we're searching in.
[in]name1of the section we're searching for. Special value CF_IDENT_ANY can be used to match any name1 value.
[in]name2of the section we're searching for. Special value CF_IDENT_ANY can be used to match any name2 value.
Returns
  • The first matching subsection.
  • NULL if no subsections match.

Definition at line 1039 of file cf_util.c.

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

◆ cf_section_name()

char const* cf_section_name ( CONF_SECTION const *  cs)

Return name2 if set, else name1.

Parameters
[in]csto return identifiers for.
Returns
name1 or name2 identifier.

Definition at line 1138 of file cf_util.c.

+ Here is the call graph for this function:

◆ cf_section_name1()

char const* cf_section_name1 ( CONF_SECTION const *  cs)

Return the second identifier of a CONF_SECTION.

Parameters
[in]csto return identifiers for.
Returns
  • The first identifier.
  • NULL if cs was NULL or no name1 set.

Definition at line 1112 of file cf_util.c.

◆ cf_section_name2()

char const* cf_section_name2 ( CONF_SECTION const *  cs)

Return the second identifier of a CONF_SECTION.

Parameters
[in]csto return identifiers for.
Returns
  • The second identifier.
  • NULL if cs was NULL or no name2 set.

Definition at line 1126 of file cf_util.c.

◆ cf_section_name2_quote()

fr_token_t cf_section_name2_quote ( CONF_SECTION const *  cs)

Return the quoting of the name2 identifier.

Parameters
[in]cscontaining name2.
Returns

Definition at line 1171 of file cf_util.c.

+ Here is the caller graph for this function:

◆ cf_section_name_cmp()

int8_t cf_section_name_cmp ( CONF_SECTION const *  cs,
char const *  name1,
char const *  name2 
)

Check if a given section matches the specified name1/name2 identifiers.

Parameters
[in]csto check.
[in]name1identifier. May be CF_IDENT_ANY for wildcard matches.
[in]name2identifier. May be CF_IDENT_ANY for wildcard matches.
Returns
  • >1 if cs is greater than the identifiers.
  • 0 if cs matches the identifiers.
  • <0 if cs is less than the identifiers.

Definition at line 1080 of file cf_util.c.

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

◆ cf_section_next()

CONF_SECTION* cf_section_next ( CONF_SECTION const *  cs,
CONF_SECTION const *  prev 
)

Return the next child that's a CONF_SECTION.

Parameters
[in]csto return children from.
[in]prevchild to start searching from.
Returns
  • The next CONF_ITEM that's a child of cs and a CONF_SECTION.
  • NULL if no CONF_ITEM matches that criteria.

Definition at line 952 of file cf_util.c.

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

◆ cf_section_to_item()

CONF_ITEM* cf_section_to_item ( CONF_SECTION const *  cs)

Cast a CONF_SECTION to a CONF_ITEM.

Parameters
[in]csto cast.
Returns
  • The common CONF_ITEM header.
  • NULL if cs was NULL.

Definition at line 703 of file cf_util.c.

◆ cf_section_value_find()

char const* cf_section_value_find ( CONF_SECTION const *  cs,
char const *  attr 
)

Find a pair in a CONF_SECTION.

Parameters
[in]csthe CONF_SECTION to search in.
[in]attrto search for.
Returns
  • NULL if no pair can be found.
  • The value of the pair found.

Definition at line 1061 of file cf_util.c.

+ Here is the call graph for this function:

◆ truncate_filename()

static void truncate_filename ( char const **  e,
char const **  p,
int *  len,
char const *  filename 
)
inlinestatic

Definition at line 1845 of file cf_util.c.

+ Here is the caller graph for this function: