The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Typedefs | Functions
map_proc.h File Reference

Structures and prototypes for map functions. More...

#include <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/server/tmpl.h>
#include <freeradius-devel/server/map.h>
#include <freeradius-devel/util/value.h>
+ Include dependency graph for map_proc.h:

Go to the source code of this file.

Typedefs

typedef unlang_action_t(* map_proc_func_t) (rlm_rcode_t *p_result, void *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. More...
 
typedef struct map_proc_inst map_proc_inst_t
 
typedef int(* map_proc_instantiate_t) (CONF_SECTION *cs, void *mod_inst, void *proc_inst, tmpl_t const *src, map_list_t const *maps)
 Allocate new instance data for a map processor. More...
 
typedef struct map_proc map_proc_t
 

Functions

unlang_action_t map_proc (rlm_rcode_t *p_result, request_t *request, map_proc_inst_t const *inst, fr_value_box_list_t *src)
 Evaluate a set of maps using the specified map processor. 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 safe_for)
 Register a map processor. More...
 

Detailed Description

Structures and prototypes for map functions.

Id
c75c3d72039fe10d04f1b1e3a4ab0fef99d5b4a5

Definition in file map_proc.h.

Typedef Documentation

◆ map_proc_func_t

typedef unlang_action_t(* map_proc_func_t) (rlm_rcode_t *p_result, void *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.

Parameters
[out]p_resultResult of applying the map:
[in]mod_instInstance of the module that registered the map_proc.
[in]proc_instMap proc data created by map_proc_instantiate_t.
[in]requestThe current request.
[in,out]resultInput data for the map processor. May be consumed by the map processor.
[in]mapsHead of the list of maps to process.
Returns
one of UNLANG_ACTION_*

Definition at line 63 of file map_proc.h.

◆ map_proc_inst_t

Definition at line 1 of file map_proc.h.

◆ map_proc_instantiate_t

typedef int(* map_proc_instantiate_t) (CONF_SECTION *cs, void *mod_inst, void *proc_inst, tmpl_t const *src, map_list_t const *maps)

Allocate new instance data for a map processor.

Parameters
[in]csCONF_SECTION representing this instance of a map processor.
[in]mod_instModule instance that registered the map_proc_t.
[in]proc_instStructure to populate. Allocated by map_proc_instantiate.
[in]srctemplate.
[in]mapsHead of the list of maps to process.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 77 of file map_proc.h.

◆ map_proc_t

typedef struct map_proc map_proc_t

Definition at line 1 of file map_proc.h.

Function Documentation

◆ 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_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: