27 RCSID(
"$Id: d4a94dbe3aeecd3e04bee4184f2f50c611706d65 $")
29 #include <freeradius-devel/server/base.h>
30 #include <freeradius-devel/server/map_proc.h>
31 #include <freeradius-devel/server/map_proc_priv.h>
32 #include <freeradius-devel/util/atexit.h>
33 #include <freeradius-devel/util/debug.h>
34 #include <freeradius-devel/util/value.h>
35 #include <freeradius-devel/util/talloc.h>
223 if (!
inst->data)
return NULL;
249 return inst->proc->evaluate(p_result,
inst->proc->mod_inst,
inst->data, request, result,
inst->maps);
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
#define fr_atexit_global_once(_init, _free, _uctx)
#define MEMCMP_RETURN(_a, _b, _field, _len_field)
Return if the contents of the specified field is not identical between the specified structures.
A section grouping multiple CONF_PAIR.
fr_dcursor_eval_t void const * uctx
#define fr_assert_msg(_x, _msg,...)
Calls panic_action ifndef NDEBUG, else logs error and causes the server to exit immediately with code...
static int _map_proc_tree_init(UNUSED void *uctx)
unlang_action_t map_proc(rlm_rcode_t *p_result, request_t *request, map_proc_inst_t const *inst, fr_value_box_list_t *result)
Evaluate a set of maps using the specified map processor.
map_proc_t * map_proc_find(char const *name)
Find a map processor by name.
static int _map_proc_talloc_free(map_proc_t *proc)
Unregister a map processor.
static int _map_proc_tree_free(UNUSED void *uctx)
int map_proc_unregister(char const *name)
Unregister a map processor by name.
map_proc_inst_t * map_proc_instantiate(TALLOC_CTX *ctx, map_proc_t const *proc, CONF_SECTION *cs, tmpl_t const *src, map_list_t const *maps)
Create a new map proc instance.
static fr_rb_tree_t * map_proc_root
int map_proc_register(TALLOC_CTX *ctx, void const *mod_inst, char const *name, map_proc_func_t evaluate, map_proc_instantiate_t instantiate, size_t inst_size, fr_value_box_safe_for_t literals_safe_for)
Register a map processor.
static int8_t map_proc_cmp(void const *one, void const *two)
Compare two map_proc_t structs, based ONLY on the name.
fr_value_box_safe_for_t map_proc_literals_safe_for(map_proc_t const *proc)
int(* map_proc_instantiate_t)(CONF_SECTION *cs, void const *mod_inst, void *proc_inst, tmpl_t const *src, map_list_t const *maps)
Allocate new instance data for a map processor.
unlang_action_t(* map_proc_func_t)(rlm_rcode_t *p_result, void const *mod_inst, void *proc_inst, request_t *request, fr_value_box_list_t *result, map_list_t const *maps)
Function to evaluate the src string and map the result to server attributes.
char name[FR_MAX_STRING_LEN]
Name of the map function.
int length
Length of name.
void const * mod_inst
Module instance.
fr_value_box_safe_for_t literals_safe_for
Safe for values to be set for literals in the map source.
size_t inst_size
Size of map_proc instance data to allocate.
map_proc_func_t evaluate
Module's map processor function.
map_proc_instantiate_t instantiate
Callback to create new instance struct.
Map processor registration.
uint32_t fr_rb_num_elements(fr_rb_tree_t *tree)
#define fr_rb_inline_talloc_alloc(_ctx, _type, _field, _data_cmp, _data_free)
Allocs a red black that verifies elements are of a specific talloc type.
int fr_rb_replace(void **old, fr_rb_tree_t *tree, void const *data))
bool fr_rb_delete(fr_rb_tree_t *tree, void const *data)
void * fr_rb_find(fr_rb_tree_t const *tree, void const *data)
The main red black tree structure.
rlm_rcode_t
Return codes indicating the result of the module call.
static int instantiate(module_inst_ctx_t const *mctx)
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
eap_aka_sim_process_conf_t * inst
size_t strlcpy(char *dst, char const *src, size_t siz)
int talloc_link_ctx(TALLOC_CTX *parent, TALLOC_CTX *child)
Link two different parent and child contexts, so the child is freed before the parent.
uintptr_t fr_value_box_safe_for_t
Escaping that's been applied to a value box.