27 RCSIDH(map_h,
"$Id: cb19772b01ddb2110203d35c80118ac2c86d2d9e $")
40 #include <freeradius-devel/server/cf_util.h>
41 #include <freeradius-devel/server/tmpl.h>
42 #include <freeradius-devel/util/dlist.h>
51 #define MAP_LHS_TERMINALS \
107 #ifndef WITH_VERIFY_PTR
108 # define MAP_VERIFY(_x) fr_assert((_x)->lhs)
110 # define MAP_VERIFY(_x) do { \
111 TMPL_VERIFY((_x)->lhs); \
112 if ((_x)->rhs) TMPL_VERIFY((_x)->rhs); \
150 fr_sbuff_parse_rules_t
const *p_rules);
153 char const *lhs,
char const *op,
char const *rhs,
163 fr_value_box_list_t *lhs_result, fr_value_box_list_t *rhs_result);
Common header for all CONF_* types.
Configuration AVP similar to a fr_pair_t.
A section grouping multiple CONF_PAIR.
fr_dcursor_eval_t void const * uctx
#define FR_DLIST_TYPES(_name)
Define type specific wrapper structs for dlists.
#define FR_DLIST_FUNCS(_name, _element_type, _element_entry)
Define type specific wrapper functions for dlists.
Entry in a doubly linked list.
int map_afrom_cp(TALLOC_CTX *ctx, map_t **out, map_t *parent, CONF_PAIR *cp, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules, bool edit)
Convert CONFIG_PAIR (which may contain refs) to map_t.
fr_dlist_t entry
Entry into dlist.
int map_afrom_value_box(TALLOC_CTX *ctx, map_t **out, char const *lhs, fr_token_t lhs_type, tmpl_rules_t const *lhs_rules, fr_token_t op, fr_value_box_t *rhs, bool steal_rhs_buffs)
Convert a value box to a map.
map_t const * map
Original map describing the change to be made.
fr_table_num_sorted_t const map_assignment_op_table[]
int(* radius_map_getvalue_t)(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, map_t const *map, void *uctx)
fr_sbuff_parse_rules_t const map_parse_rules_bareword_quoted
ssize_t map_afrom_substr(TALLOC_CTX *ctx, map_t **out, map_t **parent_p, fr_sbuff_t *in, fr_table_num_sorted_t const *op_table, size_t op_table_len, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules, fr_sbuff_parse_rules_t const *p_rules)
Parse sbuff into (which may contain refs) to map_t.
int map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm)
Apply the output of map_to_list_mod to a request.
typedef FR_DLIST_HEAD(map_list) map_list_t
Given these are used in so many places, it's more friendly to have a proper type.
int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out, request_t *request, map_t const *map, fr_value_box_list_t *lhs_result, fr_value_box_list_t *rhs_result)
Evaluate a map creating a new map with TMPL_TYPE_ATTR LHS and TMPL_TYPE_DATA RHS.
int map_to_vp(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, map_t const *map, void *uctx))
int map_afrom_vp(TALLOC_CTX *ctx, map_t **out, fr_pair_t *vp, tmpl_rules_t const *rules)
Convert a fr_pair_t into a map.
void map_debug_log(request_t *request, map_t const *map, fr_pair_t const *vp))
int map_to_request(request_t *request, map_t const *map, radius_map_getvalue_t func, void *ctx)
Convert map_t to fr_pair_t (s) and add them to a request_t.
int map_afrom_cs_edit(TALLOC_CTX *ctx, map_list_t *out, CONF_SECTION *cs, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules, map_validate_t validate, void *uctx, unsigned int max))
Convert a config section into an attribute map for editing.
int map_afrom_fields(TALLOC_CTX *ctx, map_t **out, map_t **parent_p, request_t *request, char const *lhs, char const *op, char const *rhs, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules)
Convert a fr_pair_t into a map.
int map_afrom_attr_str(TALLOC_CTX *ctx, map_t **out, char const *raw, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules)
Convert a value pair string to valuepair map.
int map_list_afrom_cs(TALLOC_CTX *ctx, map_list_t *out, CONF_SECTION *cs, tmpl_rules_t const *t_rules, map_validate_t validate, void *uctx, unsigned int max)
Convert a config section into a list of { a, b, c, d, ...
int(* map_validate_t)(map_t *map, void *ctx)
int map_afrom_cs(TALLOC_CTX *ctx, map_list_t *out, CONF_SECTION *cs, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules, map_validate_t validate, void *uctx, unsigned int max))
Convert a config section into an attribute map.
map_list_t mod
New map containing the destination (LHS) and values (RHS).
ssize_t map_print(fr_sbuff_t *out, map_t const *map)
Print a map to a string.
size_t map_assignment_op_table_len
fr_sbuff_parse_rules_t const * map_parse_rules_quoted[T_TOKEN_LAST]
Optional arguments passed to vp_tmpl functions.
fr_token_t op
The operator that controls insertion of the dst attribute.
tmpl_t * lhs
Typically describes the attribute to add, modify or compare.
map_list_t child
parent map, for nested ones
FR_DLIST_ENTRY(map_list) entry
List entry.
tmpl_t * rhs
Typically describes a literal value or a src attribute to copy or compare.
CONF_ITEM * ci
Config item that the map was created from.
fr_type_t cast
Cast value to this type.
Stores an attribute, a value and various bits of other data.
An element in a lexicographically sorted array of name to num mappings.
static size_t char ** out