The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Functions | Variables
map_proc.c File Reference
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/map_proc.h>
#include <freeradius-devel/server/map_proc_priv.h>
#include <freeradius-devel/util/atexit.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/value.h>
#include <freeradius-devel/util/talloc.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 int _map_proc_tree_free (UNUSED void *uctx)
 
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. 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...
 
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...
 
fr_value_box_safe_for_t map_proc_literals_safe_for (map_proc_t const *proc)
 
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. More...
 
int map_proc_unregister (char const *name)
 Unregister a map processor by name. 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 57 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 int _map_proc_tree_free ( UNUSED void *  uctx)
static

Definition at line 105 of file map_proc.c.

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

◆ _map_proc_tree_init()

static int _map_proc_tree_init ( UNUSED void *  uctx)
static

Definition at line 99 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 247 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 45 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 87 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 210 of file map_proc.c.

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

◆ map_proc_literals_safe_for()

fr_value_box_safe_for_t map_proc_literals_safe_for ( map_proc_t const *  proc)

Definition at line 75 of file map_proc.c.

+ Here is the caller graph for this function:

◆ map_proc_register()

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.

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

Parameters
[in]ctxif non-null, the ctx to bind this map processor to.
[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 131 of file map_proc.c.

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

◆ map_proc_unregister()

int map_proc_unregister ( char const *  name)

Unregister a map processor by name.

Parameters
[in]nameof map processor to unregister.
Returns
  • 0 if map processor was found and unregistered.
  • -1 if map processor was not found.

Definition at line 183 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 37 of file map_proc.c.