#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/rad_assert.h>
#include <ctype.h>
Go to the source code of this file.
Macros | |
#define | DEBUG_OVERWRITE(_old, _new) |
Functions | |
int | map_afrom_attr_str (TALLOC_CTX *ctx, vp_map_t **out, char const *vp_str, request_refs_t dst_request_def, pair_lists_t dst_list_def, request_refs_t src_request_def, pair_lists_t src_list_def) |
Convert a value pair string to valuepair map. More... | |
int | map_afrom_cp (TALLOC_CTX *ctx, vp_map_t **out, CONF_PAIR *cp, request_refs_t dst_request_def, pair_lists_t dst_list_def, request_refs_t src_request_def, pair_lists_t src_list_def) |
Convert CONFIG_PAIR (which may contain refs) to vp_map_t. More... | |
int | map_afrom_cs (vp_map_t **out, CONF_SECTION *cs, pair_lists_t dst_list_def, pair_lists_t src_list_def, map_validate_t validate, void *ctx, unsigned int max) |
Convert an 'update' config section into an attribute map. More... | |
int | map_afrom_fields (TALLOC_CTX *ctx, vp_map_t **out, char const *lhs, FR_TOKEN lhs_type, FR_TOKEN op, char const *rhs, FR_TOKEN rhs_type, request_refs_t dst_request_def, pair_lists_t dst_list_def, request_refs_t src_request_def, pair_lists_t src_list_def) |
Convert strings to vp_map_t. More... | |
bool | map_cast_from_hex (vp_map_t *map, FR_TOKEN rhs_type, char const *rhs) |
re-parse a map where the lhs is an unknown attribute. More... | |
int8_t | map_cmp_by_lhs_attr (void const *a, void const *b) |
Compare map where LHS is TMPL_TYPE_ATTR. More... | |
void | map_debug_log (REQUEST *request, vp_map_t const *map, VALUE_PAIR const *vp) |
bool | map_dst_valid (REQUEST *request, vp_map_t const *map) |
Check whether the destination of a map is currently valid. More... | |
static int | map_exec_to_vp (TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, vp_map_t const *map) |
Process map which has exec as a src. More... | |
size_t | map_snprint (char *out, size_t outlen, vp_map_t const *map) |
Print a map to a string. More... | |
void | map_sort (vp_map_t **maps, fr_cmp_t cmp) |
Sort a linked list of vp_map_t using merge sort. More... | |
static vp_map_t * | map_sort_merge (vp_map_t *a, vp_map_t *b, fr_cmp_t cmp) |
static void | map_sort_split (vp_map_t *source, vp_map_t **front, vp_map_t **back) |
int | map_to_request (REQUEST *request, vp_map_t const *map, radius_map_getvalue_t func, void *ctx) |
Convert vp_map_t to VALUE_PAIR (s) and add them to a REQUEST. More... | |
int | map_to_vp (TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, vp_map_t const *map, UNUSED void *uctx) |
Convert a map to a VALUE_PAIR. More... | |
#define DEBUG_OVERWRITE | ( | _old, | |
_new | |||
) |
int map_afrom_attr_str | ( | TALLOC_CTX * | ctx, |
vp_map_t ** | out, | ||
char const * | vp_str, | ||
request_refs_t | dst_request_def, | ||
pair_lists_t | dst_list_def, | ||
request_refs_t | src_request_def, | ||
pair_lists_t | src_list_def | ||
) |
Convert a value pair string to valuepair map.
Takes a valuepair string with list and request qualifiers and converts it into a vp_map_t.
ctx | where to allocate the map. |
out | Where to write the new map (must be freed with talloc_free()). |
vp_str | string to parse. |
dst_request_def | to use if attribute isn't qualified. |
dst_list_def | to use if attribute isn't qualified. |
src_request_def | to use if attribute isn't qualified. |
src_list_def | to use if attribute isn't qualified. |
Definition at line 487 of file map.c.
int map_afrom_cp | ( | TALLOC_CTX * | ctx, |
vp_map_t ** | out, | ||
CONF_PAIR * | cp, | ||
request_refs_t | dst_request_def, | ||
pair_lists_t | dst_list_def, | ||
request_refs_t | src_request_def, | ||
pair_lists_t | src_list_def | ||
) |
Convert CONFIG_PAIR (which may contain refs) to vp_map_t.
Treats the left operand as an attribute reference
<request>.<list>.<attribute>
Treatment of left operand depends on quotation, barewords are treated as attribute references, double quoted values are treated as expandable strings, single quoted values are treated as literal strings.
Return must be freed with talloc_free
[in] | ctx | for talloc. |
[in] | out | Where to write the pointer to the new vp_map_t. |
[in] | cp | to convert to map. |
[in] | dst_request_def | The default request to insert unqualified attributes into. |
[in] | dst_list_def | The default list to insert unqualified attributes into. |
[in] | src_request_def | The default request to resolve attribute references in. |
[in] | src_list_def | The default list to resolve unqualified attributes in. |
Definition at line 207 of file map.c.
int map_afrom_cs | ( | vp_map_t ** | out, |
CONF_SECTION * | cs, | ||
pair_lists_t | dst_list_def, | ||
pair_lists_t | src_list_def, | ||
map_validate_t | validate, | ||
void * | ctx, | ||
unsigned int | max | ||
) |
Convert an 'update' config section into an attribute map.
Uses 'name2' of section to set default request and lists.
[in] | cs | the update section |
[out] | out | Where to store the head of the map. |
[in] | dst_list_def | The default destination list, usually dictated by the section the module is being called in. |
[in] | src_list_def | The default source list, usually dictated by the section the module is being called in. |
[in] | validate | map using this callback (may be NULL). |
[in] | ctx | to pass to callback. |
[in] | max | number of mappings to process. |
Definition at line 331 of file map.c.
int map_afrom_fields | ( | TALLOC_CTX * | ctx, |
vp_map_t ** | out, | ||
char const * | lhs, | ||
FR_TOKEN | lhs_type, | ||
FR_TOKEN | op, | ||
char const * | rhs, | ||
FR_TOKEN | rhs_type, | ||
request_refs_t | dst_request_def, | ||
pair_lists_t | dst_list_def, | ||
request_refs_t | src_request_def, | ||
pair_lists_t | src_list_def | ||
) |
Convert strings to vp_map_t.
Treatment of operands depends on quotation, barewords are treated as attribute references, double quoted values are treated as expandable strings, single quoted values are treated as literal strings.
Return must be freed with talloc_free
[in] | ctx | for talloc |
[out] | out | Where to store the head of the map. |
[in] | lhs | of the operation |
[in] | lhs_type | type of the LHS string |
[in] | op | the operation to perform |
[in] | rhs | of the operation |
[in] | rhs_type | type of the RHS string |
[in] | dst_request_def | The default request to insert unqualified attributes into. |
[in] | dst_list_def | The default list to insert unqualified attributes into. |
[in] | src_request_def | The default request to resolve attribute references in. |
[in] | src_list_def | The default list to resolve unqualified attributes in. |
Definition at line 434 of file map.c.
int8_t map_cmp_by_lhs_attr | ( | void const * | a, |
void const * | b | ||
) |
Compare map where LHS is TMPL_TYPE_ATTR.
Compares maps by lhs->tmpl_da, lhs->tmpl_tag, lhs->tmpl_num
a | first map. |
b | second map. |
Definition at line 543 of file map.c.
void map_debug_log | ( | REQUEST * | request, |
vp_map_t const * | map, | ||
VALUE_PAIR const * | vp | ||
) |
|
static |
Process map which has exec as a src.
Evaluate maps which specify exec as a src. This may be used by various sorts of update sections, and so has been broken out into it's own function.
[in,out] | ctx | to allocate new VALUE_PAIR (s) in. |
[out] | out | Where to write the VALUE_PAIR (s). |
[in] | request | structure (used only for talloc). |
[in] | map | the map. The LHS (dst) must be TMPL_TYPE_ATTR or TMPL_TYPE_LIST. The RHS (src) must be TMPL_TYPE_EXEC. |
Definition at line 668 of file map.c.
size_t map_snprint | ( | char * | out, |
size_t | outlen, | ||
vp_map_t const * | map | ||
) |
Print a map to a string.
[out] | out | Buffer to write string to. |
[in] | outlen | Size of the output buffer. |
[in] | map | to print. |
Definition at line 1494 of file map.c.
int map_to_request | ( | REQUEST * | request, |
vp_map_t const * | map, | ||
radius_map_getvalue_t | func, | ||
void * | ctx | ||
) |
Convert vp_map_t to VALUE_PAIR (s) and add them to a REQUEST.
Takes a single vp_map_t, resolves request and list identifiers to pointers in the current request, then attempts to retrieve module specific value(s) using callback, and adds the resulting values to the correct request/list.
request | The current request. |
map | specifying destination attribute and location and src identifier. |
func | to retrieve module specific values and convert them to VALUE_PAIR. |
ctx | to be passed to func. |
Definition at line 1019 of file map.c.
int map_to_vp | ( | TALLOC_CTX * | ctx, |
VALUE_PAIR ** | out, | ||
REQUEST * | request, | ||
vp_map_t const * | map, | ||
UNUSED void * | uctx | ||
) |
Convert a map to a VALUE_PAIR.
[in,out] | ctx | to allocate VALUE_PAIR (s) in. |
[out] | out | Where to write the VALUE_PAIR (s), which may be NULL if not found |
[in] | request | The current request. |
[in] | map | the map. The LHS (dst) has to be TMPL_TYPE_ATTR or TMPL_TYPE_LIST. |
[in] | uctx | unused. |
Definition at line 748 of file map.c.