All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions | Variables
map_proc.c File Reference
#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/rad_assert.h>
#include <freeradius-devel/map_proc.h>
+ Include dependency graph for map_proc.c:

Go to the source code of this file.

Data Structures

struct  map_proc
 Map processor registration. More...
 
struct  map_proc_inst
 Map processor instance. More...
 

Functions

static int _map_proc_unregister (map_proc_t *proc)
 Unregister a map processor. More...
 
rlm_rcode_t map_proc (REQUEST *request, map_proc_inst_t const *inst)
 Evaluate a set of maps using the specified map processor. More...
 
static int 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)
 
map_proc_inst_tmap_proc_instantiate (TALLOC_CTX *ctx, map_proc_t const *proc, vp_tmpl_t const *src, vp_map_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, xlat_escape_t escape, map_proc_instantiate_t instantiate, size_t inst_size)
 Register a map processor. More...
 

Variables

static rbtree_tmap_proc_root = NULL
 

Data Structure Documentation

struct map_proc

Map processor registration.

Definition at line 37 of file map_proc.c.

+ Collaboration diagram for map_proc:
Data Fields
xlat_escape_t escape Escape function to apply to expansions in the map query string.
map_proc_func_t evaluate Module's map processor function.
size_t inst_size Size of map_proc instance data to allocate.
map_proc_instantiate_t instantiate Callback to create new instance struct.
int length Length of name.
void * mod_inst Module instance.
char name[MAX_STRING_LEN] Name of the map function.
struct map_proc_inst

Map processor instance.

Definition at line 51 of file map_proc.c.

+ Collaboration diagram for map_proc_inst:
Data Fields
void * data Instance data created by map_proc_instantiate.
vp_map_t const * maps Head of the map list.
map_proc_t const * proc Map processor.
vp_tmpl_t const * src Evaluated to provide source value for map processor.

Function Documentation

static int _map_proc_unregister ( map_proc_t proc)
static

Unregister a map processor.

Parameters
[in]procto unregister.

Definition at line 78 of file map_proc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

rlm_rcode_t map_proc ( REQUEST request,
map_proc_inst_t const *  inst 
)

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
requestThe current request.
instof a map processor.

Definition at line 225 of file map_proc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int 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 64 of file map_proc.c.

+ Here is the caller graph for this function:

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 101 of file map_proc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void map_proc_free ( void  )

Definition at line 113 of file map_proc.c.

+ Here is the caller graph for this function:

map_proc_inst_t* map_proc_instantiate ( TALLOC_CTX *  ctx,
map_proc_t const *  proc,
vp_tmpl_t const *  src,
vp_map_t const *  maps 
)

Create a new map proc instance.

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

Parameters
ctxto allocate proc instance in.
procresolved with map_proc_find.
srctemplate.
mapsHead of the list of maps.
Returns

Definition at line 192 of file map_proc.c.

+ Here is the caller graph for this function:

int map_proc_register ( void *  mod_inst,
char const *  name,
map_proc_func_t  evaluate,
xlat_escape_t  escape,
map_proc_instantiate_t  instantiate,
size_t  inst_size 
)

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]escapefunction to sanitize any sub expansions in the map source query.
[in]instantiatefunction (optional).
[in]inst_sizeof talloc chunk to allocate for instance data (optional).
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 132 of file map_proc.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

rbtree_t* map_proc_root = NULL
static

Definition at line 33 of file map_proc.c.