The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Functions | Variables
map_proc.c File Reference
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/map_proc_priv.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/value.h>
+ Include dependency graph for map_proc.c:

Go to the source code of this file.

Functions

static int _map_proc_talloc_free (map_proc_t *proc)
 Unregister a map processor. More...
 
static void _map_proc_tree_free (void *proc)
 
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. More...
 
static int8_t map_proc_cmp (void const *one, void const *two)
 Compare two map_proc_t structs, based ONLY on the name. More...
 
map_proc_tmap_proc_find (char const *name)
 Find a map processor by name. More...
 
void map_proc_free (void)
 Free all map_processors unregistering them. More...
 
map_proc_inst_tmap_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. More...
 
int map_proc_register (void *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. More...
 

Variables

static fr_rb_tree_tmap_proc_root = NULL
 

Function Documentation

◆ _map_proc_talloc_free()

static int _map_proc_talloc_free ( map_proc_t proc)
static

Unregister a map processor.

Parameters
[in]procto unregister.

Definition at line 55 of file map_proc.c.

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

◆ _map_proc_tree_free()

static void _map_proc_tree_free ( void *  proc)
static

Definition at line 73 of file map_proc.c.

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

◆ map_proc()

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.

Evaluate the map processor src template, then call a map processor function to do something with the expanded src template and map the result to attributes in the request.

Parameters
[out]p_resultResult code of evaluating the map.
[in]requestThe current request.
[in]instof a map processor.
[in,out]resultResult of expanding the map input. May be consumed by the map processor.
Returns
one of UNLANG_ACTION_*

Definition at line 206 of file map_proc.c.

+ Here is the caller graph for this function:

◆ map_proc_cmp()

static int8_t map_proc_cmp ( void const *  one,
void const *  two 
)
static

Compare two map_proc_t structs, based ONLY on the name.

Parameters
[in]oneFirst map struct.
[in]twoSecond map struct.
Returns
Integer specifying order of map func instances.

Definition at line 43 of file map_proc.c.

+ Here is the caller graph for this function:

◆ map_proc_find()

map_proc_t* map_proc_find ( char const *  name)

Find a map processor by name.

Parameters
[in]nameof map processor.
Returns
  • map_proc matching name.
  • NULL if none was found.

Definition at line 85 of file map_proc.c.

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

◆ map_proc_free()

void map_proc_free ( void  )

Free all map_processors unregistering them.

Definition at line 214 of file map_proc.c.

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

◆ map_proc_instantiate()

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.

This should be called for every map {} section in the configuration.

Parameters
[in]ctxto allocate proc instance in.
[in]procresolved with map_proc_find.
[in]csCONF_SECTION representing this instance of a map processor.
[in]srctemplate.
[in]mapsHead of the list of maps.
Returns

Definition at line 169 of file map_proc.c.

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

◆ map_proc_register()

int map_proc_register ( void *  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.

This should be called by every module that provides a map processing function.

Parameters
[in]mod_instof module registering the map_proc.
[in]nameof map processor. If processor already exists, it is replaced.
[in]evaluateModule's map processor function.
[in]instantiatefunction (optional).
[in]inst_sizeof talloc chunk to allocate for instance data (optional).
[in]literals_safe_forWhat safe_for value to assign to literals.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 111 of file map_proc.c.

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

Variable Documentation

◆ map_proc_root

fr_rb_tree_t* map_proc_root = NULL
static

Definition at line 35 of file map_proc.c.