24 RCSID(
"$Id: ad9d3d30eb6c59602522740c5a7900b161406657 $")
28 #include <freeradius-devel/server/cf_file.h>
29 #include <freeradius-devel/server/cf_priv.h>
30 #include <freeradius-devel/server/cf_util.h>
31 #include <freeradius-devel/server/log.h>
32 #include <freeradius-devel/util/debug.h>
33 #include <freeradius-devel/util/atexit.h>
35 static inline int8_t
cf_ident2_cmp(
void const *a,
void const *b);
51 if (ci->type ==
type)
return ci;
66 static inline CC_HINT(always_inline)
70 if (ci->type ==
type)
return ci;
76 #define IS_WILDCARD(_ident) (_ident == CF_IDENT_ANY)
103 memset(&cs_find, 0,
sizeof(cs_find));
105 cs_find.
name1 = ident1;
114 memset(&cp_find, 0,
sizeof(cp_find));
116 cp_find.
attr = ident1;
122 memset(&cd_find, 0,
sizeof(cd_find));
124 cd_find.
type = ident1;
140 if (find->
type != ci->type)
continue;
194 memset(&cs_find, 0,
sizeof(cs_find));
196 cs_find.
name1 = ident1;
205 memset(&cp_find, 0,
sizeof(cp_find));
207 cp_find.
attr = ident1;
213 memset(&cd_find, 0,
sizeof(cd_find));
215 cd_find.
type = ident1;
372 if (ret != 0)
return ret;
386 if (!
parent || !child)
return;
417 if (!
parent || !child)
return;
451 bool in_ident1, in_ident2;
463 if (!found)
return NULL;
486 if (!in_ident1 && !in_ident2)
break;
512 if (!ci)
return NULL;
527 if (!ci)
return NULL;
562 if (!ci)
return NULL;
578 if (!ci)
return NULL;
606 if (!ci)
return NULL;
620 if (!ci)
return false;
634 if (!ci)
return false;
648 if (!ci)
return false;
666 if (ci == NULL)
return NULL;
686 if (ci == NULL)
return NULL;
706 if (ci == NULL)
return NULL;
724 if (cp == NULL)
return NULL;
740 if (cs == NULL)
return NULL;
756 if (cd == NULL)
return NULL;
788 char const *name1,
char const *name2,
789 char const *filename,
int lineno)
794 if (!name1)
return NULL;
799 p = strchr(name2,
'$');
800 if (p && (p[1] !=
'{')) p = NULL;
809 ERROR(
"Failed expanding section name");
816 if (!cs)
return NULL;
843 rule->
on_read && rule->subcs) {
846 for (rule_p = rule->subcs; rule_p->
name1; rule_p++) {
849 (strcmp(rule_p->
name1, name1) == 0)) {
857 if (rule_p->
on_read(ctx, NULL, NULL,
929 char const *name1,
char const *name2,
bool copy_meta)
939 new->depth = cs->
depth;
1029 char const *name1,
char const *name2)
1050 char const *name1,
char const *name2)
1073 char const *name1,
char const *name2)
1097 char const *name1,
char const *name2)
1126 return (cp ? cp->
value : NULL);
1145 if (ret != 0)
return ret;
1152 if (!name2)
return 0;
1156 return CMP(strcmp(cs_name2, name2), 0);
1173 return (cs ? cs->
name1 : NULL);
1187 return (cs ? cs->
name2 : NULL);
1215 if (!cs || !cs->
argv || (argc < 0) || (argc >= cs->
argc))
return NULL;
1217 return cs->
argv[argc];
1285 if (!attr)
return NULL;
1288 if (!cp)
return NULL;
1305 if (!cp->
value)
goto error;
1329 if (!
new)
return NULL;
1331 if (copy_meta)
new->parsed = cp->
parsed;
1354 if (!cs || !cp || !
value)
return -1;
1546 .name = __FUNCTION__,
1550 if (sep) e_rules.subs[(
uint8_t)*sep] = *sep;
1555 if (slen < 0)
return slen;
1560 if (slen < 0)
return slen;
1580 return (pair ? pair->
attr : NULL);
1596 return (pair ? pair->
value : NULL);
1652 memcpy(&to_free, &cd->
data,
sizeof(to_free));
1675 if (!cd)
return NULL;
1692 talloc_set_destructor(cd,
_cd_free);
1767 if (!cd)
return NULL;
1769 memcpy(&to_return, &cd->
data,
sizeof(to_return));
1787 char const *filename,
int lineno)
1791 char const *
type = NULL;
1793 if (!ci)
return NULL;
1829 char const *filename,
int lineno)
1842 if (strcmp(
type,
"conf_parser_t") == 0)
return NULL;
1844 cf_log_err(ci,
"Data of type %s with name \"%s\" already exists. Existing data added %s[%i]",
type,
1876 if (!cd)
return NULL;
1880 talloc_set_destructor(cd, NULL);
1903 if (!ci->
ident2)
return 0;
1930 #define FILENAME_TRUNCATE 60
1935 flen = talloc_array_length(filename) - 1;
1944 q = strchr(*p, FR_DIR_SEP);
1978 for (i = 0; i < table_len; i++)
MEM(list = talloc_asprintf_append_buffer(list,
"'%s', ", table[i].
name.str));
2086 TALLOC_CTX *thread_log_pool;
2091 our_f_rules = *f_rules;
2100 pool = talloc_new(thread_log_pool);
2252 char const *
fmt, ...)
2285 DEBUG(
"SECTION - %p", cs);
2291 for (i = 0; i < cs->
argc; i++) {
2293 DEBUG(
" argv[%i] : %s%s%s", i, quote, cs->
argv[i], quote);
2302 DEBUG(
"PAIR - %p", cp);
2308 DEBUG(
" pass2 : %s", cp->
pass2 ?
"yes" :
"no");
2317 DEBUG(
"DATA - %p", cd);
2321 DEBUG(
" free wth prnt : %s", cd->
free ?
"yes" :
"no");
2326 DEBUG(
"INVALID - %p", ci);
2346 char const *in_ident1, *in_ident2;
2356 switch (child->type) {
2362 in_ident1, in_ident2);
2372 DEBUG(
" PAIR %p (%s%s%s %s %s%s%s) %s%s", child,
2373 lhs_quote, cp->
attr, lhs_quote,
2375 rhs_quote, cp->
value, rhs_quote,
2376 in_ident1, in_ident2);
2384 DEBUG(
" DATA %p (%s *)%s = %p %s%s", child,
2386 in_ident1, in_ident2);
2391 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.
CONF_ITEM * _cf_item_prev(CONF_ITEM const *ci, CONF_ITEM const *curr)
Return the next child of cs.
CONF_ITEM * _cf_item_remove(CONF_ITEM *parent, CONF_ITEM *child)
Remove item from parent and fixup trees.
bool cf_item_is_pair(CONF_ITEM const *ci)
Determine if CONF_ITEM is a CONF_PAIR.
CONF_PAIR * cf_item_to_pair(CONF_ITEM const *ci)
Cast a CONF_ITEM to 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.
CONF_ITEM * cf_section_to_item(CONF_SECTION const *cs)
Cast a CONF_SECTION to a CONF_ITEM.
fr_token_t cf_pair_attr_quote(CONF_PAIR const *pair)
Return the value (lhs) quoting of a pair.
char const * cf_pair_attr(CONF_PAIR const *pair)
Return the attr of a CONF_PAIR.
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.
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.
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.
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.
CONF_PAIR * cf_pair_prev(CONF_SECTION const *cs, CONF_PAIR const *curr)
Return the next child that's a CONF_PAIR.
void cf_section_debug(CONF_SECTION *cs)
Ease of use from debugger.
CONF_SECTION * cf_section_find(CONF_SECTION const *cs, char const *name1, char const *name2)
Find a CONF_SECTION with name1 and optionally name2.
fr_token_t cf_section_argv_quote(CONF_SECTION const *cs, int argc)
Return the quoting for one of the variadic arguments.
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.
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.
void _cf_item_insert_after(CONF_ITEM *parent, CONF_ITEM *prev, CONF_ITEM *child)
Insert a child after a given one.
CONF_PAIR * cf_pair_find(CONF_SECTION const *cs, char const *attr)
Search for a CONF_PAIR with a specific name.
static int8_t _cf_ident1_cmp(void const *a, void const *b)
Compare the first identifier of a child.
#define FILENAME_TRUNCATE
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)
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_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.
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.
char const * cf_section_name2(CONF_SECTION const *cs)
Return the second identifier of a CONF_SECTION.
CONF_SECTION * cf_section_first(CONF_SECTION const *cs)
Return the first child in a CONF_SECTION.
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.
char const * cf_pair_value(CONF_PAIR const *pair)
Return the value of a CONF_PAIR.
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.
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_ITEM * _cf_item_next(CONF_ITEM const *ci, CONF_ITEM const *curr)
Return the next child of the CONF_ITEM.
void cf_pair_mark_parsed(CONF_PAIR *cp)
Mark a pair as parsed.
static void _pair_count(int *count, CONF_SECTION const *cs)
Callback to determine the number of pairs in a section.
void _cf_filename_set(CONF_ITEM *ci, char const *filename)
Set the filename of a CONF_ITEM.
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_SECTION * cf_section_next(CONF_SECTION const *cs, CONF_SECTION const *curr)
Return the next child that's a CONF_SECTION.
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.
void * cf_data_value(CONF_DATA const *cd)
Return the user assigned value of CONF_DATA.
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.
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.
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.
CONF_SECTION * _cf_root(CONF_ITEM const *ci)
Return the top level CONF_SECTION holding all other CONF_ITEM.
CONF_PAIR * cf_pair_next(CONF_SECTION const *cs, CONF_PAIR const *curr)
Return the next child that's a CONF_PAIR.
void cf_section_add_name2_quote(CONF_SECTION *cs, fr_token_t token)
Set the quoting of the name2 identifier.
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.
CONF_ITEM * cf_pair_to_item(CONF_PAIR const *cp)
Cast a CONF_PAIR to a CONF_ITEM.
bool cf_pair_is_parsed(CONF_PAIR *cp)
Return whether a pair has already been parsed.
char const * _cf_filename(CONF_ITEM const *ci)
Return the filename the CONF_ITEM was parsed in.
#define IS_WILDCARD(_ident)
CONF_SECTION * cf_item_to_section(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_SECTION.
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.
static void truncate_filename(char const **e, char const **p, int *len, char const *filename)
void * _cf_data_remove(CONF_ITEM *parent, CONF_DATA const *cd)
Remove data from a configuration section.
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.
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.
void _cf_canonicalize_error(CONF_ITEM *ci, ssize_t slen, char const *msg, char const *str)
CONF_ITEM * cf_data_to_item(CONF_DATA const *cd)
Cast CONF_DATA to a CONF_ITEM.
CONF_DATA const * _cf_data_find(CONF_ITEM const *ci, char const *type, char const *name)
Find user data in a config section.
bool cf_item_is_section(CONF_ITEM const *ci)
Determine if CONF_ITEM is a CONF_SECTION.
CONF_DATA * cf_item_to_data(CONF_ITEM const *ci)
Cast CONF_ITEM to CONF_DATA performing a type check.
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.
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.
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_PAIR * cf_pair_first(CONF_SECTION const *cs)
Return the next child that's a CONF_PAIR.
CONF_PAIR * cf_pair_dup(CONF_SECTION *parent, CONF_PAIR *cp, bool copy_meta)
Duplicate a CONF_PAIR.
fr_token_t cf_section_name2_quote(CONF_SECTION const *cs)
Return the quoting of the name2 identifier.
CONF_ITEM * _cf_parent(CONF_ITEM const *ci)
Return the parent of a CONF_ITEM.
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.
char const * cf_section_name1(CONF_SECTION const *cs)
Return the second identifier of a CONF_SECTION.
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_SECTION * cf_section_prev(CONF_SECTION const *cs, CONF_SECTION const *curr)
Return the previous child that's a CONF_SECTION.
char const * cf_section_name(CONF_SECTION const *cs)
Return name2 if set, else name1.
char const * cf_section_value_find(CONF_SECTION const *cs, char const *attr)
Find a pair in a CONF_SECTION.
char const * cf_section_argv(CONF_SECTION const *cs, int argc)
Return variadic argument at the specified index.
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.
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.
#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_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_next(_ci, _curr)
#define cf_item_debug(_cf)
int(* cf_walker_t)(void *data, void *ctx)
static fr_atomic_queue_t * aq
fr_dcursor_iter_t void * current
#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_talloc_free_item(fr_dlist_head_t *list_head, void *ptr)
Free the item specified.
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_tail(fr_dlist_head_t *list_head, void *ptr)
Insert an item into the tail of a 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 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.
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_iter_init_inorder(fr_rb_iter_inorder_t *iter, fr_rb_tree_t *tree)
Initialise an in-order iterator.
uint32_t fr_rb_num_elements(fr_rb_tree_t *tree)
#define fr_rb_inline_alloc(_ctx, _type, _field, _data_cmp, _data_free)
Allocs a red black tree.
bool fr_rb_insert(fr_rb_tree_t *tree, void const *data)
void * fr_rb_find(fr_rb_tree_t const *tree, void const *data)
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(_sbuff_or_marker)
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
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_typed_strdup(TALLOC_CTX *ctx, char const *p)
Call talloc_strdup, setting the type on the new chunk correctly.
char * talloc_buffer_append_buffer(TALLOC_CTX *ctx, char *to, char const *from)
Concatenate to + from.
char * talloc_bstr_realloc(TALLOC_CTX *ctx, char *in, size_t inlen)
Trim a bstr (char) buffer.
int talloc_decrease_ref_count(void const *ptr)
Decrease the reference count on a ptr.
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.
FR_SBUFF_SET_RETURN(sbuff, &our_sbuff)
static size_t char ** out