The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
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>
Go to the source code of this file.
Typedefs | |
typedef 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. More... | |
typedef struct map_proc_inst | map_proc_inst_t |
typedef 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. 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_t * | map_proc_find (char const *name) |
Find a map processor by name. More... | |
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. 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 safe_for) |
Register a map processor. More... | |
int | map_proc_unregister (char const *name) |
Unregister a map processor by name. More... | |
Structures and prototypes for map functions.
Definition in file map_proc.h.
typedef 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.
[out] | p_result | Result of applying the map:
|
[in] | mod_inst | Instance of the module that registered the map_proc. |
[in] | proc_inst | Map proc data created by map_proc_instantiate_t. |
[in] | request | The current request. |
[in,out] | result | Input data for the map processor. May be consumed by the map processor. |
[in] | maps | Head of the list of maps to process. |
Definition at line 63 of file map_proc.h.
typedef struct map_proc_inst map_proc_inst_t |
Definition at line 1 of file map_proc.h.
typedef 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.
[in] | cs | CONF_SECTION representing this instance of a map processor. |
[in] | mod_inst | Module instance that registered the map_proc_t. |
[in] | proc_inst | Structure to populate. Allocated by map_proc_instantiate. |
[in] | src | template. |
[in] | maps | Head of the list of maps to process. |
Definition at line 77 of file map_proc.h.
typedef struct map_proc map_proc_t |
Definition at line 1 of file map_proc.h.
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.
[out] | p_result | Result code of evaluating the map. |
[in] | request | The current request. |
[in] | inst | of a map processor. |
[in,out] | result | Result of expanding the map input. May be consumed by the map processor. |
Definition at line 247 of file map_proc.c.
map_proc_t* map_proc_find | ( | char const * | name | ) |
Find a map processor by name.
[in] | name | of map processor. |
Definition at line 87 of file map_proc.c.
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.
[in] | ctx | to allocate proc instance in. |
[in] | proc | resolved with map_proc_find. |
[in] | cs | CONF_SECTION representing this instance of a map processor. |
[in] | src | template. |
[in] | maps | Head of the list of maps. |
Definition at line 210 of file map_proc.c.
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.
This should be called by every module that provides a map processing function.
[in] | ctx | if non-null, the ctx to bind this map processor to. |
[in] | mod_inst | of module registering the map_proc. |
[in] | name | of map processor. If processor already exists, it is replaced. |
[in] | evaluate | Module's map processor function. |
[in] | instantiate | function (optional). |
[in] | inst_size | of talloc chunk to allocate for instance data (optional). |
[in] | literals_safe_for | What safe_for value to assign to literals. |
Definition at line 131 of file map_proc.c.
int map_proc_unregister | ( | char const * | name | ) |
Unregister a map processor by name.
[in] | name | of map processor to unregister. |
Definition at line 183 of file map_proc.c.