24RCSID(
"$Id: 3728f71db9a8a1e50acbe2a3d02f8d13cd3459b3 $")
 
   28#include <freeradius-devel/server/cf_file.h> 
   29#include <freeradius-devel/server/cf_priv.h> 
   30#include <freeradius-devel/server/log.h> 
   31#include <freeradius-devel/util/debug.h> 
   32#include <freeradius-devel/util/atexit.h> 
   34static inline int8_t 
cf_ident2_cmp(
void const *a, 
void const *b);
 
   50                if (ci->type == 
type) 
return ci;
 
 
   65static inline CC_HINT(always_inline)
 
   69                if (ci->type == 
type) 
return ci;
 
 
   75#define IS_WILDCARD(_ident) (_ident == CF_IDENT_ANY) 
  102                memset(&cs_find, 0, 
sizeof(cs_find));
 
  104                cs_find.
name1 = ident1;
 
  113                memset(&cp_find, 0, 
sizeof(cp_find));
 
  115                cp_find.
attr = ident1;
 
  121                memset(&cd_find, 0, 
sizeof(cd_find));
 
  123                cd_find.
type = ident1;
 
  139                        if (find->
type != ci->type) 
continue;
 
 
  193                memset(&cs_find, 0, 
sizeof(cs_find));
 
  195                cs_find.
name1 = ident1;
 
  204                memset(&cp_find, 0, 
sizeof(cp_find));
 
  206                cp_find.
attr = ident1;
 
  212                memset(&cd_find, 0, 
sizeof(cd_find));
 
  214                cd_find.
type = ident1;
 
 
  371        if (ret != 0) 
return ret;
 
 
  385        if (!
parent || !child) 
return;
 
 
  416        if (!
parent || !child) 
return;
 
 
  450        bool            in_ident1, in_ident2;
 
  462        if (!found) 
return NULL;
 
  485                if (!in_ident1 && !in_ident2) 
break;
 
 
  526        if (!ci) 
return NULL;
 
 
  561        if (!ci) 
return NULL;
 
 
  577        if (!ci) 
return NULL;
 
 
  605        if (!ci) 
return NULL;
 
 
  619        if (!ci) 
return false;
 
 
  633        if (!ci) 
return false;
 
 
  647        if (!ci) 
return false;
 
 
  665        if (ci == NULL) 
return NULL;
 
 
  685        if (ci == NULL) 
return NULL;
 
 
  705        if (ci == NULL) 
return NULL;
 
 
  723        if (cp == NULL) 
return NULL;
 
 
  739        if (cs == NULL) 
return NULL;
 
 
  755        if (cd == NULL) 
return NULL;
 
 
  787                                char const *name1, 
char const *name2,
 
  788                                char const *filename, 
int lineno)
 
  793        if (!name1) 
return NULL;
 
  798                p = strchr(name2, 
'$');
 
  799                if (p && (p[1] != 
'{')) p = NULL;
 
  808                                ERROR(
"Failed expanding section name");
 
  815        if (!cs) 
return NULL;
 
  842                            rule->
on_read && rule->subcs) {
 
  845                                for (rule_p = rule->subcs; rule_p->
name1; rule_p++) {
 
  848                                            (strcmp(rule_p->
name1, name1) == 0)) {
 
  856                                                if (rule_p->
on_read(ctx, NULL, NULL,
 
 
  928                             char const *name1, 
char const *name2, 
bool copy_meta)
 
  938                new->depth = cs->
depth;
 
 
 1028                              char const *name1, 
char const *name2)
 
 
 1049                                   char const *name1, 
char const *name2)
 
 
 1072                                         char const *name1, 
char const *name2)
 
 
 1096                                      char const *name1, 
char const *name2)
 
 
 1125        return (cp ? cp->
value : NULL);
 
 
 1144                if (ret != 0) 
return ret;
 
 1151                        if (!name2) 
return 0;
 
 1155                return CMP(strcmp(cs_name2, name2), 0);
 
 
 1172        return (cs ? cs->
name1 : NULL);
 
 
 1186        return (cs ? cs->
name2 : NULL);
 
 
 1214        if (!cs || !cs->
argv || (argc < 0) || (argc >= cs->
argc)) 
return NULL;
 
 1216        return cs->
argv[argc];
 
 
 1272        if (!attr) 
return NULL;
 
 1275        if (!cp) 
return NULL;
 
 1292                if (!cp->
value) 
goto error;
 
 
 1316        if (!
new) 
return NULL;
 
 1318        if (copy_meta) 
new->parsed = cp->
parsed;
 
 
 1341        if (!cs || !cp || !
value) 
return -1;
 
 
 1533                                        .name = __FUNCTION__,
 
 1537        if (sep) e_rules.subs[(
uint8_t)*sep] = *sep;
 
 1542                if (slen < 0) 
return slen;
 
 1547                        if (slen < 0) 
return slen;
 
 
 1567        return (pair ? pair->
attr : NULL);
 
 
 1583        return (pair ? pair->
value : NULL);
 
 
 1639        memcpy(&to_free, &cd->
data, 
sizeof(to_free));
 
 
 1662        if (!cd) 
return NULL;
 
 1679                talloc_set_destructor(cd, 
_cd_free);
 
 
 1754        if (!cd) 
return NULL;
 
 1756        memcpy(&to_return, &cd->
data, 
sizeof(to_return));
 
 
 1774                              char const *filename, 
int lineno)
 
 1778        char const      *
type = NULL;
 
 1780        if (!ci) 
return NULL;
 
 
 1816                                     char const *filename, 
int lineno)
 
 1829                if (strcmp(
type, 
"conf_parser_t") == 0) 
return NULL;
 
 1831                cf_log_err(ci, 
"Data of type %s with name \"%s\" already exists.  Existing data added %s[%i]", 
type,
 
 
 1863        if (!cd) 
return NULL;
 
 1867        talloc_set_destructor(cd, NULL);        
 
 
 1890        if (!ci->
ident2) 
return 0;
 
 
 1917        #define FILENAME_TRUNCATE       60 
 1922        flen = talloc_array_length(filename) - 1;
 
 1931        q = strchr(*p, FR_DIR_SEP);
 
 
 1965        for (i = 0; i < table_len; i++) 
MEM(list = talloc_asprintf_append_buffer(list, 
"'%s', ", table[i].
name.str));
 
 
 2073                TALLOC_CTX              *thread_log_pool;
 
 2078                        our_f_rules = *f_rules;
 
 2087                pool = talloc_new(thread_log_pool);
 
 
 2239                           char const *
fmt, ...)
 
 
 2272                DEBUG(
"SECTION - %p", cs);
 
 2278                for (i = 0; i < cs->
argc; i++) {
 
 2280                        DEBUG(
"  argv[%i]      : %s%s%s", i, quote, cs->
argv[i], quote);
 
 2289                DEBUG(
"PAIR - %p", cp);
 
 2295                DEBUG(
"  pass2         : %s", cp->
pass2 ? 
"yes" : 
"no");
 
 2304                DEBUG(
"DATA - %p", cd);
 
 2308                DEBUG(
"  free wth prnt : %s", cd->
free ? 
"yes" : 
"no");
 
 2313                DEBUG(
"INVALID - %p", ci);
 
 2333                char const *in_ident1, *in_ident2;
 
 2343                switch (child->type) {
 
 2349                              in_ident1, in_ident2);
 
 2359                        DEBUG(
"  PAIR %p (%s%s%s %s %s%s%s) %s%s", child,
 
 2360                              lhs_quote, cp->
attr, lhs_quote,
 
 2362                              rhs_quote, cp->
value, rhs_quote,
 
 2363                              in_ident1, in_ident2);
 
 2371                        DEBUG(
"  DATA %p (%s *)%s = %p %s%s", child,
 
 2373                              in_ident1, in_ident2);
 
 2378                        DEBUG(
"  INVALID - %p", child);
 
 
static int const char char buffer[256]
static int const char * fmt
#define UNCONST(_type, _ptr)
Remove const qualification from a pointer.
#define CMP_RETURN(_a, _b, _field)
Return if the comparison is not 0 (is unequal)
#define CMP(_a, _b)
Same as CMP_PREFER_SMALLER use when you don't really care about ordering, you just want an ordering.
char const * cf_expand_variables(char const *cf, int lineno, CONF_SECTION *outer_cs, char *output, size_t outsize, char const *input, ssize_t inlen, bool *soft_fail)
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.
conf_parser_flags_t flags
Flags which control parsing behaviour.
#define cf_section_rules_push(_cs, _rule)
char const  * name1
Name of the CONF_ITEM to parse.
cf_parse_t on_read
Function to call as the item is being read, just after it has been allocated and initialized.
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
Defines a CONF_PAIR to C data type mapping.
fr_rb_node_t ident2_node
Entry in the ident2 tree.
CONF_ITEM item
Common set of fields.
CONF_ITEM * parent
Parent.
fr_token_t name2_quote
The type of quoting around name2.
char const  * name2
Second name token. Given foo bar {} would be bar.
int argc
number of additional arguments
char const  * attr
Attribute name.
char const  * name
Additional qualification of type.
#define cf_item_foreach_prev(_ci, _iter, _prev)
Iterate over the contents of a list in reverse order.
fr_rb_tree_t * ident2
Tree to store the second identifier (name2 || name).
fr_token_t rhs_quote
Value Quoting style T_(DOUBLE|SINGLE|BACK)_QUOTE_STRING or T_BARE_WORD.
char const  * value
Attribute value.
#define cf_item_foreach(_ci, _iter)
Iterate over the contents of a list.
char const  * name1
First name token. Given foo bar {} would be foo.
void const  * data
User data.
static bool cf_item_has_no_children(CONF_ITEM const *ci)
Check if the CONF_ITEM has no children.
fr_dlist_head_t children
The head of the ordered list of children.
fr_token_t op
Operator e.g. =, :=.
CONF_ITEM item
Common set of fields.
bool pass2
do expansion in pass2.
char const  * filename
The file the config item was parsed from.
fr_rb_tree_t * ident1
Tree to store the first identifier (name1 || type || attr).
bool is_talloced
If true we can do extra checks.
fr_rb_node_t ident1_node
Entry in the ident1 tree.
#define cf_item_foreach_next(_ci, _iter, _prev)
Iterate over the contents of a list.
enum conf_type CONF_ITEM_TYPE
char const  ** argv
additional arguments
char const  * type
C type of data being stored.
CONF_ITEM item
Common set of fields.
bool parsed
Was this item used during parsing?
fr_token_t lhs_quote
Name quoting style T_(DOUBLE|SINGLE|BACK)_QUOTE_STRING or T_BARE_WORD.
bool free
If true, free data with talloc if parent node is freed.
int lineno
The line number the config item began on.
CONF_ITEM_TYPE type
Whether the config item is a config_pair, conf_section or cf_data.
Internal data that is associated with a configuration section.
Common header for all CONF_* types.
Configuration AVP similar to a fr_pair_t.
A section grouping multiple CONF_PAIR.
bool cf_item_is_pair(CONF_ITEM const *ci)
Determine if CONF_ITEM is a CONF_PAIR.
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.
fr_token_t cf_pair_attr_quote(CONF_PAIR const *pair)
Return the value (lhs) quoting of a pair.
void * _cf_data_remove(CONF_ITEM *parent, CONF_DATA const *cd)
Remove data from a configuration section.
CONF_SECTION * _cf_section_find_parent(CONF_ITEM const *ci, char const *name1, char const *name2)
Find a parent CONF_SECTION with name1 and optionally name2.
int _cf_data_walk(CONF_ITEM *ci, char const *type, cf_walker_t cb, void *ctx)
Walk over a specific type of CONF_DATA.
unsigned int cf_pair_count_descendents(CONF_SECTION const *cs)
Count the number of conf pairs beneath a section.
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.
void cf_section_debug(CONF_SECTION *cs)
Ease of use from debugger.
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.
CONF_ITEM * cf_data_to_item(CONF_DATA const *cd)
Cast CONF_DATA to a CONF_ITEM.
CONF_ITEM * _cf_item_remove(CONF_ITEM *parent, CONF_ITEM *child)
Remove item from parent and fixup trees.
CONF_DATA const * _cf_data_find(CONF_ITEM const *ci, char const *type, char const *name)
Find user data in a config section.
fr_token_t cf_section_argv_quote(CONF_SECTION const *cs, int argc)
Return the quoting for one of the variadic arguments.
unsigned int cf_pair_count(CONF_SECTION const *cs, char const *attr)
Count the number of times an attribute occurs in a parent section.
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.
CONF_PAIR * cf_pair_dup(CONF_SECTION *parent, CONF_PAIR *cp, bool copy_meta)
Duplicate a CONF_PAIR.
void _cf_item_insert_after(CONF_ITEM *parent, CONF_ITEM *prev, CONF_ITEM *child)
Insert a child after a given one.
static int8_t _cf_ident1_cmp(void const *a, void const *b)
Compare the first identifier of a child.
#define FILENAME_TRUNCATE
static CONF_DATA * cf_data_alloc(CONF_ITEM *parent, void const *data, char const *type, char const *name, bool do_free)
Allocate a new user data container.
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.
void cf_item_free_children(CONF_ITEM *ci)
char const * cf_section_name2(CONF_SECTION const *cs)
Return the second identifier of a CONF_SECTION.
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.
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.
void * cf_data_value(CONF_DATA const *cd)
Return the user assigned value of CONF_DATA.
CONF_ITEM * cf_section_to_item(CONF_SECTION const *cs)
Cast a CONF_SECTION to a CONF_ITEM.
static int8_t _cf_ident2_cmp(void const *a, void const *b)
Compare the first and second identifiers of a child.
static int8_t cf_ident2_cmp(void const *a, void const *b)
Compare only the second identifier of a child.
CONF_ITEM * _cf_parent(CONF_ITEM const *ci)
Return the parent of a CONF_ITEM.
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.
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.
CONF_SECTION * cf_section_next(CONF_SECTION const *cs, CONF_SECTION const *curr)
Return the next child that's a CONF_SECTION.
void cf_pair_mark_parsed(CONF_PAIR *cp)
Mark a pair as parsed.
char const * cf_section_name1(CONF_SECTION const *cs)
Return the second identifier of a CONF_SECTION.
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.
CONF_ITEM * _cf_item_next(CONF_ITEM const *parent, CONF_ITEM const *curr)
Return the next child of the CONF_ITEM.
static void _pair_count(int *count, CONF_SECTION const *cs)
Callback to determine the number of pairs in a section.
CONF_SECTION * cf_section_find(CONF_SECTION const *cs, char const *name1, char const *name2)
Find a CONF_SECTION with name1 and optionally name2.
CONF_SECTION * cf_item_to_section(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_SECTION.
CONF_ITEM * _cf_item_prev(CONF_ITEM const *ci, CONF_ITEM const *curr)
Return the next child of cs.
CONF_PAIR * cf_pair_find(CONF_SECTION const *cs, char const *attr)
Search for a CONF_PAIR with a specific name.
CONF_DATA * cf_item_to_data(CONF_ITEM const *ci)
Cast CONF_ITEM to CONF_DATA performing a type check.
void _cf_filename_set(CONF_ITEM *ci, char const *filename)
Set the filename of a CONF_ITEM.
char const * cf_section_value_find(CONF_SECTION const *cs, char const *attr)
Find a pair in a CONF_SECTION.
CONF_SECTION * _cf_root(CONF_ITEM const *ci)
Return the top level CONF_SECTION holding all other CONF_ITEM.
void _cf_lineno_set(CONF_ITEM *ci, int lineno)
Set the line number of a CONF_ITEM.
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.
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.
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.
static int _cd_free(CONF_DATA *cd)
Free user data associated with CONF_DATA.
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.
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.
static CONF_ITEM * cf_next(CONF_ITEM const *parent, CONF_ITEM const *current, CONF_ITEM_TYPE type)
Return the next child that's of the specified type.
char const * cf_section_name(CONF_SECTION const *cs)
Return name2 if set, else name1.
char const * _cf_filename(CONF_ITEM const *ci)
Return the filename the CONF_ITEM was parsed in.
bool cf_item_is_data(CONF_ITEM const *ci)
Determine if CONF_ITEM is CONF_DATA.
void _cf_item_debug(CONF_ITEM const *ci)
Print out debugging information about a CONFIG_ITEM.
fr_token_t cf_pair_operator(CONF_PAIR const *pair)
Return the operator of a pair.
bool cf_pair_is_parsed(CONF_PAIR *cp)
Return whether a pair has already been parsed.
#define IS_WILDCARD(_ident)
static CONF_ITEM * cf_prev(CONF_ITEM const *parent, CONF_ITEM const *current, CONF_ITEM_TYPE type)
Return the previos child that's of the specified type.
fr_token_t cf_pair_value_quote(CONF_PAIR const *pair)
Return the value (rhs) quoting of a pair.
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.
CONF_PAIR * cf_pair_first(CONF_SECTION const *cs)
Return the first child that's a CONF_PAIR.
static CONF_ITEM * cf_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.
static void truncate_filename(char const **e, char const **p, int *len, char const *filename)
CONF_PAIR * cf_pair_next(CONF_SECTION const *cs, CONF_PAIR const *curr)
Return the next child that's a CONF_PAIR.
void _cf_canonicalize_error(CONF_ITEM *ci, ssize_t slen, char const *msg, char const *str)
CONF_SECTION * _cf_section_find_in_parent(CONF_ITEM const *ci, char const *name1, char const *name2)
Find an ancestor of the passed CONF_ITEM which has a child matching a specific name1 and optionally n...
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.
static CONF_ITEM * cf_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.
bool cf_item_is_section(CONF_ITEM const *ci)
Determine if CONF_ITEM is a CONF_SECTION.
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.
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.
char const * cf_section_argv(CONF_SECTION const *cs, int argc)
Return variadic argument at the specified index.
CONF_PAIR * cf_pair_prev(CONF_SECTION const *cs, CONF_PAIR const *curr)
Return the previous child that's a CONF_PAIR.
int _cf_lineno(CONF_ITEM const *ci)
Return the lineno the CONF_ITEM was parsed at.
static int _cf_section_free(CONF_SECTION *cs)
Free a section and associated trees.
CONF_SECTION * cf_section_first(CONF_SECTION const *cs)
Return the first child in a CONF_SECTION.
CONF_PAIR * cf_item_to_pair(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_PAIR.
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.
fr_token_t cf_section_name2_quote(CONF_SECTION const *cs)
Return the quoting of the name2 identifier.
char const * cf_pair_value(CONF_PAIR const *pair)
Return the value of a CONF_PAIR.
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.
void _cf_item_add(CONF_ITEM *parent, CONF_ITEM *child)
Add a child.
void cf_pair_debug(CONF_PAIR *cp)
Ease of use from debugger.
CONF_ITEM * cf_pair_to_item(CONF_PAIR const *cp)
Cast a CONF_PAIR to a CONF_ITEM.
CONF_SECTION * cf_section_prev(CONF_SECTION const *cs, CONF_SECTION const *curr)
Return the previous child that's a CONF_SECTION.
char const * cf_pair_attr(CONF_PAIR const *pair)
Return the attr of a CONF_PAIR.
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.
#define cf_item_add(_parent, _child)
#define cf_log_err(_cf, _fmt,...)
#define cf_data_find(_cf, _type, _name)
#define cf_lineno_set(_ci, _lineno)
#define cf_item_remove(_parent, _child)
#define cf_item_next(_parent, _curr)
#define cf_log_perr(_cf, _fmt,...)
#define cf_section_alloc(_ctx, _parent, _name1, _name2)
#define CF_TO_ITEM(_cf)
Auto cast from the input type to CONF_ITEM (which is the base type)
#define cf_filename_set(_ci, _filename)
#define cf_item_debug(_cf)
int(* cf_walker_t)(void *data, void *ctx)
static fr_atomic_queue_t ** aq
#define fr_assert_fail(_msg,...)
Calls panic_action ifndef NDEBUG, else logs error.
static char const  * spaces
#define fr_dlist_init(_head, _type, _field)
Initialise the head structure of a doubly linked list.
static void * fr_dlist_remove(fr_dlist_head_t *list_head, void *ptr)
Remove an item from the list.
static void * fr_dlist_prev(fr_dlist_head_t const *list_head, void const *ptr)
Get the previous item in a list.
static void * fr_dlist_talloc_free_item(fr_dlist_head_t *list_head, void *ptr)
Free the item specified.
static int fr_dlist_insert_tail(fr_dlist_head_t *list_head, void *ptr)
Insert an item into the tail of a list.
static void * fr_dlist_next(fr_dlist_head_t const *list_head, void const *ptr)
Get the next item in a list.
static int fr_dlist_insert_after(fr_dlist_head_t *list_head, void *pos, void *ptr)
Insert an item after an item already in the list.
#define DEBUG_ENABLED4
True if global debug level 1-3 messages are enabled.
#define DEBUG_ENABLED
True if global debug level 1 messages are enabled.
TALLOC_CTX * fr_log_pool_init(void)
talloc ctx to use when composing log messages
void fr_vlog_perror(fr_log_t const *log, fr_log_type_t type, char const *file, int line, fr_log_perror_format_t const *f_rules, char const *fmt, va_list ap)
Drain any outstanding messages from the fr_strerror buffers.
void fr_vlog(fr_log_t const *log, fr_log_type_t type, char const *file, int line, char const *fmt, va_list ap)
Send a server log message to its destination.
void fr_canonicalize_error(TALLOC_CTX *ctx, char **sp, char **text, ssize_t slen, char const *fmt)
Canonicalize error strings, removing tabs, and generate spaces for error marker.
void fr_log(fr_log_t const *log, fr_log_type_t type, char const *file, int line, char const *fmt,...)
Send a server log message to its destination.
char const  * first_prefix
Prefix for the first line printed.
char const  * subsq_prefix
Prefix for subsequent lines.
@ L_INFO
Informational message.
@ L_DBG
Only displayed when debugging is enabled.
char * fr_vasprintf(TALLOC_CTX *ctx, char const *fmt, va_list ap)
char * fr_asprintf(TALLOC_CTX *ctx, char const *fmt,...)
Special version of asprintf which implements custom format specifiers.
static rc_request_t * current
uint32_t fr_rb_num_elements(fr_rb_tree_t *tree)
Return how many nodes there are in a tree.
void * fr_rb_iter_init_inorder(fr_rb_iter_inorder_t *iter, fr_rb_tree_t *tree)
Initialise an in-order iterator.
void * fr_rb_iter_next_inorder(fr_rb_iter_inorder_t *iter)
Return the next node.
void * fr_rb_remove_by_inline_node(fr_rb_tree_t *tree, fr_rb_node_t *node)
Remove an entry from the tree, using the node structure, without freeing the data.
void * fr_rb_find(fr_rb_tree_t const *tree, void const *data)
Find an element in the tree, returning the data, not the node.
bool fr_rb_insert(fr_rb_tree_t *tree, void const *data)
Insert data into a tree.
#define fr_rb_inline_alloc(_ctx, _type, _field, _data_cmp, _data_free)
Allocs a red black tree.
Iterator structure for in-order traversal of an rbtree.
ssize_t fr_sbuff_in_strcpy(fr_sbuff_t *sbuff, char const *str)
Copy bytes into the sbuff up to the first \0.
ssize_t fr_sbuff_in_escape(fr_sbuff_t *sbuff, char const *in, size_t inlen, fr_sbuff_escape_rules_t const *e_rules)
Print an escaped string to an sbuff.
#define FR_SBUFF_SET_RETURN(_dst, _src)
#define FR_SBUFF(_sbuff_or_marker)
fr_aka_sim_id_type_t type
#define fr_table_value_by_str(_table, _name, _def)
Convert a string to a value using a sorted or ordered table.
#define fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
An element in a lexicographically sorted array of name to num mappings.
char * talloc_bstrdup(TALLOC_CTX *ctx, char const *in)
Binary safe strdup function.
char * talloc_bstr_realloc(TALLOC_CTX *ctx, char *in, size_t inlen)
Trim a bstr (char) buffer.
char * talloc_typed_strdup(TALLOC_CTX *ctx, char const *p)
Call talloc_strdup, setting the type on the new chunk correctly.
int talloc_decrease_ref_count(void const *ptr)
Decrease the reference count on a ptr.
char * talloc_buffer_append_buffer(TALLOC_CTX *ctx, char *to, char const *from)
Concatenate to + from.
static int talloc_const_free(void const *ptr)
Free const'd memory.
const bool fr_assignment_op[T_TOKEN_LAST]
fr_table_num_ordered_t const fr_tokens_table[]
fr_table_num_sorted_t const fr_token_quotes_table[]
const bool fr_comparison_op[T_TOKEN_LAST]
const bool fr_binary_op[T_TOKEN_LAST]
#define FR_TABLE_NOT_FOUND
Macro to use as dflt.
static size_t char ** out