int rcode;
char const *name1, *name2;
CONF_SECTION *cs;
- fr_map_list_t list;
+ map_list_t list;
map_t *map = NULL;
char buffer[8192];
.allow_foreign = false, /* tests are in the RADIUS dictionary */
};
- fr_dlist_map_init(&list);
+ map_list_init(&list);
/*
* Must be called first, so the handler is called last
*/
cf_log_perr(cs, "map_afrom_cs failed");
return EXIT_FAILURE; /* message already printed */
}
- if (fr_dlist_map_empty(&list)) {
+ if (map_list_empty(&list)) {
cf_log_err(cs, "'update' sections cannot be empty");
return EXIT_FAILURE;
}
printf("%s %s {\n", name1, name2);
}
- while ((map = fr_dlist_map_next(&list, map))) {
+ while ((map = map_list_next(&list, map))) {
map_print(&FR_SBUFF_OUT(buffer + 1, sizeof(buffer) - 1), map);
puts(buffer);
}
* Verify the result of the map.
*/
static int map_proc_verify(CONF_SECTION *cs, UNUSED void *mod_inst, UNUSED void *proc_inst,
- tmpl_t const *src, UNUSED fr_map_list_t const *maps)
+ tmpl_t const *src, UNUSED map_list_t const *maps)
{
if (!src) {
cf_log_err(cs, "Missing source");
}
static rlm_rcode_t mod_map_proc(UNUSED void *mod_inst, UNUSED void *proc_inst, UNUSED request_t *request,
- UNUSED fr_value_box_list_t *src, UNUSED fr_map_list_t const *maps)
+ UNUSED fr_value_box_list_t *src, UNUSED map_list_t const *maps)
{
return RLM_MODULE_FAIL;
}
* Used to store the array of attributes we'll be querying for.
*/
typedef struct {
- fr_map_list_t const *maps; //!< Head of list of maps we expanded the RHS of.
+ map_list_t const *maps; //!< Head of list of maps we expanded the RHS of.
char const *attrs[LDAP_MAX_ATTRMAP + LDAP_MAP_RESERVED + 1]; //!< Reserve some space for access attributes
//!< and NULL termination.
TALLOC_CTX *ctx; //!< Context to allocate new attributes in.
int fr_ldap_map_verify(map_t *map, void *instance);
-int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, fr_map_list_t const *maps);
+int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, map_list_t const *maps);
int fr_ldap_map_do(request_t *request, LDAP *handle,
char const *valuepair_attr, fr_ldap_map_exp_t const *expanded, LDAPMessage *entry);
* - 0 on success.
* - -1 on failure.
*/
-int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, fr_map_list_t const *maps)
+int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, map_list_t const *maps)
{
map_t const *map = NULL;
unsigned int total = 0;
char const *attr;
char attr_buff[1024 + 1]; /* X.501 says we need to support at least 1024 chars for attr names */
- while ((map = fr_dlist_map_next(maps, map))) {
+ while ((map = map_list_next(maps, map))) {
if (tmpl_expand(&attr, attr_buff, sizeof(attr_buff), request, map->rhs, NULL, NULL) < 0) {
REDEBUG("Expansion of LDAP attribute \"%s\" failed", map->rhs->name);
TALLOC_FREE(ctx);
fr_ldap_result_t result;
char const *name;
- while ((map = fr_dlist_map_next(expanded->maps, map))) {
+ while ((map = map_list_next(expanded->maps, map))) {
int ret;
name = expanded->attrs[total++];
fr_type_t dst_type, fr_dict_attr_t const *dst_enumv,
bool box_error, bool shallow);
-int fr_redis_reply_to_map(TALLOC_CTX *ctx, fr_map_list_t *out,
+int fr_redis_reply_to_map(TALLOC_CTX *ctx, map_list_t *out,
request_t *request, redisReply *key, redisReply *op, redisReply *value);
int fr_redis_tuple_from_map(TALLOC_CTX *pool, char const *out[], size_t out_len[], map_t *map);
* - 0 on success.
* - -1 on failure.
*/
-int fr_redis_reply_to_map(TALLOC_CTX *ctx, fr_map_list_t *out, request_t *request,
+int fr_redis_reply_to_map(TALLOC_CTX *ctx, map_list_t *out, request_t *request,
redisReply *key, redisReply *op, redisReply *value)
{
map_t *map = NULL;
}
MAP_VERIFY(map);
- fr_dlist_map_insert_tail(out, map);
+ map_list_insert_tail(out, map);
return 0;
}
}
map->parent = parent;
- fr_dlist_map_init(&map->child);
+ map_list_init(&map->child);
return map;
}
* caller will have to check for this!
*/
if (is_child && parent) {
- fr_dlist_map_insert_tail(&parent->child, map);
+ map_list_insert_tail(&parent->child, map);
}
if (parent_p) *parent_p = new_parent;
}
-static int _map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, map_t *parent, CONF_SECTION *cs,
+static int _map_afrom_cs(TALLOC_CTX *ctx, map_list_t *out, map_t *parent, CONF_SECTION *cs,
tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules,
map_validate_t validate, void *uctx,
unsigned int max);
* - 0 on success.
* - -1 on failure.
*/
-int map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, CONF_SECTION *cs,
+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)
return _map_afrom_cs(ctx, out, NULL, cs, lhs_rules, rhs_rules, validate, uctx, max);
}
-static int _map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, map_t *parent, CONF_SECTION *cs,
+static int _map_afrom_cs(TALLOC_CTX *ctx, map_list_t *out, map_t *parent, CONF_SECTION *cs,
tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules,
map_validate_t validate, void *uctx,
unsigned int max)
* Free in reverse as successive entries have their
* prececessors as talloc parent contexts
*/
- fr_dlist_map_talloc_reverse_free(out);
+ map_list_talloc_reverse_free(out);
return -1;
}
fr_token_t token;
ssize_t slen;
bool qualifiers = our_lhs_rules.disallow_qualifiers;
- fr_map_list_t child_list;
+ map_list_t child_list;
- fr_dlist_map_init(&child_list);
+ map_list_init(&child_list);
subcs = cf_item_to_section(ci);
token = cf_section_name2_quote(subcs);
*/
if (_map_afrom_cs(map, &child_list, map, cf_item_to_section(ci),
&our_lhs_rules, rhs_rules, validate, uctx, max) < 0) {
- fr_dlist_map_talloc_free(&child_list);
+ map_list_talloc_free(&child_list);
talloc_free(map);
goto error;
}
- fr_dlist_map_move(&map->child, &child_list);
+ map_list_move(&map->child, &child_list);
our_lhs_rules.disallow_qualifiers = qualifiers;
MAP_VERIFY(map);
next:
parent_ctx = map;
- fr_dlist_map_insert_tail(out, map);
+ map_list_insert_tail(out, map);
}
return 0;
MEM(n = fr_pair_afrom_da(ctx, tmpl_da(map->lhs)));
n->op = map->op;
- for (child = fr_dlist_map_next(&map->child, NULL);
+ for (child = map_list_next(&map->child, NULL);
child != NULL;
- child = fr_dlist_map_next(&map->child, child)) {
+ child = map_list_next(&map->child, child)) {
fr_pair_list_t list;
/*
* If there's no child and no RHS then the
* map was invalid.
*/
- if (fr_dlist_map_empty(&map->child) && !fr_cond_assert(map->rhs != NULL)) {
+ if (map_list_empty(&map->child) && !fr_cond_assert(map->rhs != NULL)) {
fr_sbuff_terminate(out);
return 0;
}
extern "C" {
#endif
-typedef struct vp_map_s map_t;
+typedef struct map_s map_t;
typedef struct vp_list_mod_s vp_list_mod_t;
#ifdef __cplusplus
['>'] = true, \
['~'] = true
-FR_DLIST_TYPES(map)
+FR_DLIST_TYPES(map_list)
/** Given these are used in so many places, it's more friendly to have a proper type
*
*/
-typedef FR_DLIST_HEAD_TYPE(map) fr_map_list_t;
+typedef FR_DLIST_HEAD(map_list) map_list_t;
/** Value pair map
*
*
* @see tmpl_t
*/
-struct vp_map_s {
+struct map_s {
tmpl_t *lhs; //!< Typically describes the attribute to add, modify or compare.
tmpl_t *rhs; //!< Typically describes a literal value or a src attribute
///< to copy or compare.
//!< logging validation errors.
map_t *parent; //! parent map, for nested ones
- fr_map_list_t child; //!< a child map. If it exists, `rhs` MUST be NULL
- FR_DLIST_ENTRY_TYPE(map) entry; //!< List entry.
+ map_list_t child; //!< a child map. If it exists, `rhs` MUST be NULL
+
+ FR_DLIST_ENTRY(map_list) entry; //!< List entry.
};
-FR_DLIST_FUNCS(map, map_t, entry)
+FR_DLIST_FUNCS(map_list, map_t, entry)
/** A list modification
*
struct vp_list_mod_s {
map_t const *map; //!< Original map describing the change to be made.
- fr_map_list_t mod; //!< New map containing the destination (LHS) and
+ map_list_t mod; //!< New map containing the destination (LHS) and
///< values (RHS).
fr_dlist_t entry; //!< Entry into dlist
};
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);
-int map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, CONF_SECTION *cs,
+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) CC_HINT(nonnull(2, 3));
{
vp_list_mod_t *mod;
mod = talloc_zero(ctx, vp_list_mod_t);
- fr_dlist_map_init(&mod->mod);
+ map_list_init(&mod->mod);
return mod;
}
{
map_t *map;
map = talloc_zero(ctx, map_t);
- fr_dlist_map_init(&map->child);
+ map_list_init(&map->child);
return map;
}
talloc_free(n);
return NULL;
}
- fr_dlist_map_insert_tail(&n->mod, mod);
+ map_list_insert_tail(&n->mod, mod);
return n;
}
talloc_free(n);
return NULL;
}
- fr_dlist_map_insert_tail(&n->mod, mod);
+ map_list_insert_tail(&n->mod, mod);
return n;
}
talloc_free(n);
return NULL;
}
- fr_dlist_map_insert_tail(&n->mod, mod);
+ map_list_insert_tail(&n->mod, mod);
return n;
}
mod->lhs = mutated->lhs;
mod->op = mutated->op;
mod->rhs = mutated->rhs;
- fr_dlist_map_insert_tail(&n->mod, mod);
+ map_list_insert_tail(&n->mod, mod);
goto finish;
}
* before this map is applied.
*/
if (fr_value_box_copy(n_mod->rhs, tmpl_value(n_mod->rhs), &vp->data) < 0) goto error;
- fr_dlist_map_insert_tail(&n->mod, n_mod);
+ map_list_insert_tail(&n->mod, n_mod);
MAP_VERIFY(n_mod);
} while ((vp = fr_pair_list_next(list, vp)));
fr_dcursor_init(&values, &head);
- if (fr_value_box_from_str(fr_dlist_map_head(&n->mod),
- tmpl_value(fr_dlist_map_head(&n->mod)->rhs), type,
+ if (fr_value_box_from_str(map_list_head(&n->mod),
+ tmpl_value(map_list_head(&n->mod)->rhs), type,
tmpl_da(mutated->lhs),
mutated->rhs->name, mutated->rhs->len,
fr_value_unescape_by_quote[(uint8_t)mutated->rhs->quote], false)) {
(void)fr_dcursor_init(&from, rhs_result);
while ((vb = fr_dcursor_remove(&from))) {
if (vb->type != tmpl_da(mutated->lhs)->type) {
- n_vb = fr_value_box_alloc_null(fr_dlist_map_head(&n->mod)->rhs);
+ n_vb = fr_value_box_alloc_null(map_list_head(&n->mod)->rhs);
if (!n_vb) {
fr_dcursor_head(&from);
fr_dcursor_free_list(&from);
vp = fr_dcursor_current(&from);
fr_assert(vp); /* Should have errored out */
do {
- n_vb = fr_value_box_alloc_null(fr_dlist_map_head(&n->mod)->rhs);
+ n_vb = fr_value_box_alloc_null(map_list_head(&n->mod)->rhs);
if (!n_vb) {
attr_error:
fr_dcursor_head(&values);
vb = tmpl_value(mutated->rhs);
- n_vb = fr_value_box_alloc_null(fr_dlist_map_head(&n->mod)->rhs);
+ n_vb = fr_value_box_alloc_null(map_list_head(&n->mod)->rhs);
if (!n_vb) {
data_error:
fr_dcursor_head(&values);
}
mod->op = vp->op;
- fr_dlist_map_insert_tail(&n->mod, mod);
+ map_list_insert_tail(&n->mod, mod);
}
}
* If tmpl_value were a pointer we could
* assign values directly.
*/
- fr_value_box_copy(fr_dlist_map_head(&n->mod)->rhs, tmpl_value(fr_dlist_map_head(&n->mod)->rhs), fr_dlist_head(&head));
+ fr_value_box_copy(map_list_head(&n->mod)->rhs, tmpl_value(map_list_head(&n->mod)->rhs), fr_dlist_head(&head));
/*
* value boxes in tmpls cannot now be the head of a list
*
- *tmpl_value(fr_dlist_map_head(&n->mod)->rhs)->next = head->next;
+ *tmpl_value(map_list_head(&n->mod)->rhs)->next = head->next;
*/
fr_dlist_talloc_free(&head);
{
map_t *mod;
- fr_assert(!fr_dlist_map_empty(&vlm->mod));
+ fr_assert(!map_list_empty(&vlm->mod));
/*
* Fast path...
*/
- mod = fr_dlist_map_head(&vlm->mod);
- if (fr_dlist_map_num_elements(&vlm->mod) == 1) {
+ mod = map_list_head(&vlm->mod);
+ if (map_list_num_elements(&vlm->mod) == 1) {
fr_pair_t *vp;
vp = map_list_mod_to_vp(ctx, mod->lhs, tmpl_value(mod->rhs));
fr_pair_append(list, vp);
*/
for (;
mod;
- mod = fr_dlist_map_next(&vlm->mod, mod)) {
+ mod = map_list_next(&vlm->mod, mod)) {
fr_pair_t *vp;
vp = map_list_mod_to_vp(ctx, mod->lhs, tmpl_value(mod->rhs));
memset(&cc, 0, sizeof(cc));
MAP_VERIFY(map);
- fr_assert(!fr_dlist_map_empty(&vlm->mod));
+ fr_assert(!map_list_empty(&vlm->mod));
/*
* Print debug information for the mods being applied
*/
- while ((mod = fr_dlist_map_next(&vlm->mod, mod))) {
+ while ((mod = map_list_next(&vlm->mod, mod))) {
fr_value_box_t *vb;
MAP_VERIFY(mod);
map_list_mod_debug(request, map, mod, vb->type != FR_TYPE_NULL ? vb : NULL);
}
}
- mod = fr_dlist_map_head(&vlm->mod); /* Reset */
+ mod = map_list_head(&vlm->mod); /* Reset */
/*
* All this has been checked by #map_to_list_mod
}
}
- fr_assert(!fr_dlist_map_next(&vlm->mod, mod));
+ fr_assert(!map_list_next(&vlm->mod, mod));
/*
* Find the destination attribute. We leave with either
* any of these values.
*/
if (tmpl_num(map->lhs) != NUM_ALL) {
- fr_value_box_t *vb = tmpl_value(fr_dlist_map_head(&vlm->mod)->rhs);
+ fr_value_box_t *vb = tmpl_value(map_list_head(&vlm->mod)->rhs);
if (fr_value_box_cmp(vb, &found->data) == 0) {
fr_dcursor_free_item(&list);
* matches any of these values.
*/
do {
- fr_value_box_t *vb = tmpl_value(fr_dlist_map_head(&vlm->mod)->rhs);
+ fr_value_box_t *vb = tmpl_value(map_list_head(&vlm->mod)->rhs);
if (fr_value_box_cmp(vb, &found->data) == 0) {
fr_dcursor_free_item(&list);
* - NULL on error.
*/
map_proc_inst_t *map_proc_instantiate(TALLOC_CTX *ctx, map_proc_t const *proc,
- CONF_SECTION *cs, tmpl_t const *src, fr_map_list_t const *maps)
+ CONF_SECTION *cs, tmpl_t const *src, map_list_t const *maps)
{
map_proc_inst_t *inst;
* - #RLM_MODULE_FAIL - If an error occurred performing the mapping.
*/
typedef rlm_rcode_t (*map_proc_func_t)(void *mod_inst, void *proc_inst, request_t *request,
- fr_value_box_list_t *result, fr_map_list_t const *maps);
+ fr_value_box_list_t *result, map_list_t const *maps);
/** Allocate new instance data for a map processor
*
* - -1 on failure.
*/
typedef int (*map_proc_instantiate_t)(CONF_SECTION *cs, void *mod_inst, void *proc_inst,
- tmpl_t const *src, fr_map_list_t const *maps);
+ tmpl_t const *src, map_list_t const *maps);
map_proc_t *map_proc_find(char const *name);
map_proc_instantiate_t instantiate, size_t inst_size);
map_proc_inst_t *map_proc_instantiate(TALLOC_CTX *ctx, map_proc_t const *proc,
- CONF_SECTION *cs, tmpl_t const *src, fr_map_list_t const *maps);
+ CONF_SECTION *cs, tmpl_t const *src, map_list_t const *maps);
rlm_rcode_t map_proc(request_t *request, map_proc_inst_t const *inst, fr_value_box_list_t *src);
struct map_proc_inst {
map_proc_t const *proc; //!< Map processor.
tmpl_t const *src; //!< Evaluated to provide source value for map processor.
- fr_map_list_t const *maps; //!< Head of the map list.
+ map_list_t const *maps; //!< Head of the map list.
void *data; //!< Instance data created by #map_proc_instantiate
};
/** Define entry and head types for attribute reference lists
*
*/
-FR_DLIST_TYPES(tmpl_attr)
+FR_DLIST_TYPES(tmpl_attr_list)
/** An element in a list of nested attribute references
*
*/
typedef struct {
- FR_DLIST_ENTRY_TYPE(tmpl_attr) _CONST entry; //!< Entry in the doubly linked list
+ FR_DLIST_ENTRY(tmpl_attr_list) _CONST entry; //!< Entry in the doubly linked list
///< of attribute references.
fr_dict_attr_t const * _CONST da; //!< Resolved dictionary attribute.
/** Define manipulation functions for the attribute reference list
*
*/
-FR_DLIST_FUNCS(tmpl_attr, tmpl_attr_t, entry)
+FR_DLIST_FUNCS(tmpl_attr_list, tmpl_attr_t, entry)
/** Define entry and head types for tmpl request references
*
*/
-FR_DLIST_TYPES(tmpl_request)
+FR_DLIST_TYPES(tmpl_request_list)
/** An element in a list of request references
*
*/
typedef struct {
- FR_DLIST_ENTRY_TYPE(tmpl_request) _CONST entry; //!< Entry in the doubly linked list
+ FR_DLIST_ENTRY(tmpl_request_list) _CONST entry; //!< Entry in the doubly linked list
///< of request references.
tmpl_request_ref_t _CONST request;
/** Define manipulation functions for the attribute reference list
*
*/
-FR_DLIST_FUNCS(tmpl_request, tmpl_request_t, entry)
+FR_DLIST_FUNCS(tmpl_request_list, tmpl_request_t, entry)
/** How many additional headers to allocate in a pool for a tmpl_t
*
tmpl_pair_list_t list; //!< List to search or insert in.
///< deprecated.
- FR_DLIST_HEAD_TYPE(tmpl_request) rr; //!< Request to search or insert in.
- FR_DLIST_HEAD_TYPE(tmpl_attr) ar; //!< Head of the attribute reference list.
+ FR_DLIST_HEAD(tmpl_request_list) rr; //!< Request to search or insert in.
+ FR_DLIST_HEAD(tmpl_attr_list) ar; //!< Head of the attribute reference list.
bool was_oid; //!< Was originally a numeric OID.
} attribute;
tmpl_is_attr_unresolved(vpt) ||
tmpl_is_list(vpt));
- return ((tmpl_request_t *)fr_dlist_tmpl_request_tail(&vpt->data.attribute.rr))->request;
+ return ((tmpl_request_t *)tmpl_request_list_tail(&vpt->data.attribute.rr))->request;
}
/** The number of request references contained within a tmpl
tmpl_is_attr_unresolved(vpt) ||
tmpl_is_list(vpt));
- return fr_dlist_tmpl_request_num_elements(&vpt->data.attribute.rr);
+ return tmpl_request_list_num_elements(&vpt->data.attribute.rr);
}
/**
{
tmpl_assert_type(tmpl_is_attr(vpt));
- return ((tmpl_attr_t *)fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))->ar_da;
+ return ((tmpl_attr_t *)tmpl_attr_list_tail(&vpt->data.attribute.ar))->ar_da;
}
static inline fr_dict_attr_t const *tmpl_unknown(tmpl_t const *vpt)
{
tmpl_assert_type(tmpl_is_attr(vpt));
- return ((tmpl_attr_t *)fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))->ar_unknown;
+ return ((tmpl_attr_t *)tmpl_attr_list_tail(&vpt->data.attribute.ar))->ar_unknown;
}
static inline char const *tmpl_attr_unresolved(tmpl_t const *vpt)
{
tmpl_assert_type(vpt->type == TMPL_TYPE_ATTR_UNRESOLVED);
- return ((tmpl_attr_t *)fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))->ar_unresolved;
+ return ((tmpl_attr_t *)tmpl_attr_list_tail(&vpt->data.attribute.ar))->ar_unresolved;
}
/** The number of attribute references contained within a tmpl
tmpl_assert_type(tmpl_is_attr(vpt) ||
tmpl_is_attr_unresolved(vpt));
- return fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar);
+ return tmpl_attr_list_num_elements(&vpt->data.attribute.ar);
}
static inline int16_t tmpl_num(tmpl_t const *vpt)
tmpl_is_attr_unresolved(vpt) ||
tmpl_is_list(vpt));
- if (tmpl_is_list(vpt) && (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) == 0)) return NUM_ALL;
+ if (tmpl_is_list(vpt) && (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) == 0)) return NUM_ALL;
- return ((tmpl_attr_t *)fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))->ar_num;
+ return ((tmpl_attr_t *)tmpl_attr_list_tail(&vpt->data.attribute.ar))->ar_num;
}
static inline tmpl_pair_list_t tmpl_list(tmpl_t const *vpt)
void tmpl_attr_ref_debug(const tmpl_attr_t *ar, int idx);
-void tmpl_attr_ref_list_debug(FR_DLIST_HEAD_TYPE(tmpl_attr) const *ar_head) CC_HINT(nonnull);
+void tmpl_attr_ref_list_debug(FR_DLIST_HEAD(tmpl_attr_list) const *ar_head) CC_HINT(nonnull);
void tmpl_attr_debug(tmpl_t const *vpt) CC_HINT(nonnull);
static inline CC_HINT(always_inline)
void _tmpl_cursor_pair_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_dcursor_ctx_t *cc)
{
- if (fr_dlist_next(&cc->vpt->data.attribute.ar, ar)) switch (ar->ar_da->type) {
+ if (tmpl_attr_list_next(&cc->vpt->data.attribute.ar, ar)) switch (ar->ar_da->type) {
case FR_TYPE_STRUCTURAL:
_tmpl_cursor_child_init(list_ctx, list, ar, cc);
break;
vp = _tmpl_cursor_eval(list, curr, cc);
if (!vp) continue;
- ar = fr_dlist_next(&vpt->data.attribute.ar, ar);
+ ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar);
if (ar) {
list_head = &vp->vp_group;
_tmpl_cursor_pair_init(vp, list_head, ar, cc);
/*
* Navigate to the correct request context
*/
- while ((rr = fr_dlist_next(&vpt->data.attribute.rr, rr))) {
+ while ((rr = tmpl_request_list_next(&vpt->data.attribute.rr, rr))) {
if (tmpl_request_ptr(&request, rr->request) < 0) {
if (err) {
*err = -3;
*/
switch (vpt->type) {
case TMPL_TYPE_ATTR:
- _tmpl_cursor_pair_init(list_ctx, cc->list, fr_dlist_head(&vpt->data.attribute.ar), cc);
+ _tmpl_cursor_pair_init(list_ctx, cc->list, tmpl_attr_list_head(&vpt->data.attribute.ar), cc);
break;
case TMPL_TYPE_LIST:
- _tmpl_cursor_list_init(list_ctx, cc->list, fr_dlist_head(&vpt->data.attribute.ar), cc);
+ _tmpl_cursor_list_init(list_ctx, cc->list, tmpl_attr_list_head(&vpt->data.attribute.ar), cc);
break;
default:
/*
* Navigate to the correct request context
*/
- while ((rr = fr_dlist_next(&vpt->data.attribute.rr, rr))) {
+ while ((rr = tmpl_request_list_next(&vpt->data.attribute.rr, rr))) {
if (tmpl_request_ptr(&request, rr->request) < 0) {
fr_strerror_printf("Request context \"%s\" not available",
fr_table_str_by_value(tmpl_request_ref_table, rr->request, "<INVALID>"));
* treated specially. Once lists are groups
* this can be removed.
*/
- ar = fr_dlist_head(&vpt->data.attribute.ar);
+ ar = tmpl_attr_list_head(&vpt->data.attribute.ar);
switch (ar->ar_da->type) {
case FR_TYPE_STRUCTURAL:
break;
/*
* Prime the stack!
*/
- _tmpl_cursor_pair_init(list_ctx, cc.list, fr_dlist_head(&vpt->data.attribute.ar), &cc);
+ _tmpl_cursor_pair_init(list_ctx, cc.list, tmpl_attr_list_head(&vpt->data.attribute.ar), &cc);
/*
* - Continue until there are no evaluation contexts
/*
* Evaluate the next reference
*/
- n_ar = fr_dlist_next(&vpt->data.attribute.ar, ar);
+ n_ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar);
if (n_ar) {
ar = n_ar;
list_head = &curr->vp_group;
*/
for (ar = extent->ar, list = extent->list, list_ctx = extent->list_ctx;
ar;
- ar = fr_dlist_next(&vpt->data.attribute.ar, ar)) {
+ ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar)) {
switch (ar->type) {
case TMPL_ATTR_TYPE_NORMAL:
case TMPL_ATTR_TYPE_UNKNOWN:
}
}
-void tmpl_attr_ref_list_debug(FR_DLIST_HEAD_TYPE(tmpl_attr) const *ar_head)
+void tmpl_attr_ref_list_debug(FR_DLIST_HEAD(tmpl_attr_list) const *ar_head)
{
tmpl_attr_t *ar = NULL;
unsigned int i = 0;
/*
* Print all the attribute references
*/
- while ((ar = fr_dlist_tmpl_attr_next(ar_head, ar))) {
+ while ((ar = tmpl_attr_list_next(ar_head, ar))) {
tmpl_attr_ref_debug(ar, i);
i++;
}
/*
* Print all the request references
*/
- while ((rr = fr_dlist_tmpl_request_next(&vpt->data.attribute.rr, rr))) {
+ while ((rr = tmpl_request_list_next(&vpt->data.attribute.rr, rr))) {
FR_FAULT_LOG("\t[%u] %s (%u)", i,
fr_table_str_by_value(tmpl_request_ref_table, rr->request, "<INVALID>"), rr->request);
i++;
case TMPL_TYPE_ATTR:
case TMPL_TYPE_ATTR_UNRESOLVED:
case TMPL_TYPE_LIST:
- fr_dlist_tmpl_attr_talloc_init(&vpt->data.attribute.ar);
- fr_dlist_tmpl_request_talloc_init(&vpt->data.attribute.rr);
+ tmpl_attr_list_talloc_init(&vpt->data.attribute.ar);
+ tmpl_request_list_talloc_init(&vpt->data.attribute.rr);
break;
default:
tmpl_request_t *rr;
TALLOC_CTX *ctx;
- if (fr_dlist_tmpl_request_num_elements(&vpt->data.attribute.rr) == 0) {
+ if (tmpl_request_list_num_elements(&vpt->data.attribute.rr) == 0) {
ctx = vpt;
} else {
- ctx = fr_dlist_tmpl_request_tail(&vpt->data.attribute.rr);
+ ctx = tmpl_request_list_tail(&vpt->data.attribute.rr);
}
MEM(rr = talloc(ctx, tmpl_request_t));
*rr = (tmpl_request_t){
.request = request
};
- fr_dlist_tmpl_request_insert_tail(&vpt->data.attribute.rr, rr);
+ tmpl_request_list_insert_tail(&vpt->data.attribute.rr, rr);
return rr;
}
tmpl_attr_t *ar;
TALLOC_CTX *ctx;
- if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) == 0) {
+ if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) == 0) {
ctx = vpt;
} else {
- ctx = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar);
+ ctx = tmpl_attr_list_tail(&vpt->data.attribute.ar);
}
MEM(ar = talloc(ctx, tmpl_attr_t));
.type = type,
.num = NUM_ANY
};
- fr_dlist_tmpl_attr_insert_tail(&vpt->data.attribute.ar, ar);
+ tmpl_attr_list_insert_tail(&vpt->data.attribute.ar, ar);
return ar;
}
/*
* Clear any existing attribute references
*/
- if (fr_dlist_tmpl_attr_num_elements(&dst->data.attribute.ar) > 0) fr_dlist_tmpl_attr_talloc_reverse_free(&dst->data.attribute.ar);
+ if (tmpl_attr_list_num_elements(&dst->data.attribute.ar) > 0) tmpl_attr_list_talloc_reverse_free(&dst->data.attribute.ar);
- while ((src_ar = fr_dlist_tmpl_attr_next(&src->data.attribute.ar, src_ar))) {
+ while ((src_ar = tmpl_attr_list_next(&src->data.attribute.ar, src_ar))) {
dst_ar = tmpl_attr_add(dst, src_ar->type);
switch (src_ar->type) {
/*
* Clear any existing request references
*/
- if (fr_dlist_tmpl_request_num_elements(&dst->data.attribute.rr) > 0) {
- fr_dlist_tmpl_request_talloc_reverse_free(&dst->data.attribute.rr);
+ if (tmpl_request_list_num_elements(&dst->data.attribute.rr) > 0) {
+ tmpl_request_list_talloc_reverse_free(&dst->data.attribute.rr);
}
- while ((src_rr = fr_dlist_tmpl_request_next(&src->data.attribute.rr, src_rr))) {
+ while ((src_rr = tmpl_request_list_next(&src->data.attribute.rr, src_rr))) {
MEM(dst_rr = tmpl_req_ref_add(dst, src_rr->request));
}
/*
* Clear any existing references
*/
- if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) > 0) {
- fr_dlist_tmpl_attr_talloc_reverse_free(&vpt->data.attribute.ar);
+ if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) > 0) {
+ tmpl_attr_list_talloc_reverse_free(&vpt->data.attribute.ar);
}
/*
/*
* Clear any existing references
*/
- if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) > 0) {
- if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) > 1) {
- ref = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar);
- parent = fr_dlist_tmpl_attr_prev(&vpt->data.attribute.ar, ref);
+ if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) > 0) {
+ if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) > 1) {
+ ref = tmpl_attr_list_tail(&vpt->data.attribute.ar);
+ parent = tmpl_attr_list_prev(&vpt->data.attribute.ar, ref);
if (!fr_dict_attr_common_parent(parent->ar_da, da, true)) {
fr_strerror_const("New leaf da and old leaf da do not share the same ancestor");
return -1;
}
} else {
- ref = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar);
+ ref = tmpl_attr_list_tail(&vpt->data.attribute.ar);
}
/*
tmpl_assert_type(tmpl_is_attr(vpt) || tmpl_is_list(vpt) || tmpl_is_attr_unresolved(vpt));
- if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) == 0) {
+ if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) == 0) {
ref = tmpl_attr_add(vpt, TMPL_ATTR_TYPE_UNKNOWN);
} else {
- ref = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar);
+ ref = tmpl_attr_list_tail(&vpt->data.attribute.ar);
}
ref->num = num;
tmpl_assert_type(tmpl_is_attr(vpt) || tmpl_is_list(vpt) || tmpl_is_attr_unresolved(vpt));
- if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) == 0) return;
+ if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) == 0) return;
- ref = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar);
+ ref = tmpl_attr_list_tail(&vpt->data.attribute.ar);
if (ref->ar_num == from) ref->ar_num = to;
TMPL_ATTR_VERIFY(vpt);
tmpl_assert_type(tmpl_is_attr(vpt) || tmpl_is_list(vpt) || tmpl_is_attr_unresolved(vpt));
- while ((ref = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ref))) if (ref->ar_num == from) ref->ar_num = to;
+ while ((ref = tmpl_attr_list_next(&vpt->data.attribute.ar, ref))) if (ref->ar_num == from) ref->ar_num = to;
TMPL_ATTR_VERIFY(vpt);
}
fr_assert_msg(tmpl_is_attr(vpt), "Expected tmpl type 'attr', got '%s'",
fr_table_str_by_value(tmpl_type_table, vpt->type, "<INVALID>"));
- if (fr_dlist_tmpl_request_num_elements(&vpt->data.attribute.rr) > 0) fr_dlist_tmpl_request_talloc_reverse_free(&vpt->data.attribute.rr);
+ if (tmpl_request_list_num_elements(&vpt->data.attribute.rr) > 0) tmpl_request_list_talloc_reverse_free(&vpt->data.attribute.rr);
tmpl_req_ref_add(vpt, request);
/*
* Insert the reference into the list.
*/
- fr_dlist_tmpl_attr_insert_tail(&vpt->data.attribute.ar, ar);
+ tmpl_attr_list_insert_tail(&vpt->data.attribute.ar, ar);
switch (ar->num) {
case 0:
default:
ar->resolve_only = true;
- while ((ar = fr_dlist_tmpl_attr_prev(&vpt->data.attribute.ar, ar))) ar->resolve_only = true;
+ while ((ar = tmpl_attr_list_prev(&vpt->data.attribute.ar, ar))) ar->resolve_only = true;
break;
}
}
if (fr_sbuff_next_if_char(name, '.')) {
ret = tmpl_attr_afrom_attr_unresolved_substr(ctx, err, vpt, NULL, NULL, name, t_rules, depth + 1);
if (ret < 0) {
- fr_dlist_tmpl_attr_talloc_free_tail(&vpt->data.attribute.ar); /* Remove and free ar */
+ tmpl_attr_list_talloc_free_tail(&vpt->data.attribute.ar); /* Remove and free ar */
return -1;
}
}
* useful to have the original.
*/
if (!da && !vpt->rules.disallow_internal &&
- (ar = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar)) &&
+ (ar = tmpl_attr_list_tail(&vpt->data.attribute.ar)) &&
(ar->type == TMPL_ATTR_TYPE_NORMAL) && (ar->ar_da->type == FR_TYPE_GROUP)) {
(void)fr_dict_attr_by_name_substr(NULL,
&da, fr_dict_root(fr_dict_internal()),
if (ar) tmpl_attr_insert(vpt, ar);
if (tmpl_attr_afrom_attr_substr(ctx, err, vpt, our_parent, namespace, name, p_rules, t_rules, depth + 1) < 0) {
- if (ar) fr_dlist_tmpl_attr_talloc_free_tail(&vpt->data.attribute.ar); /* Remove and free ar */
+ if (ar) tmpl_attr_list_talloc_free_tail(&vpt->data.attribute.ar); /* Remove and free ar */
goto error;
}
/*
tmpl_request_ref_t ref;
size_t ref_len;
tmpl_request_t *rr;
- FR_DLIST_HEAD_TYPE(tmpl_request) *list = &vpt->data.attribute.rr;
+ FR_DLIST_HEAD(tmpl_request_list) *list = &vpt->data.attribute.rr;
fr_sbuff_marker_t s_m;
tmpl_rules_t const *t_rules = *pt_rules;
*rr = (tmpl_request_t){
.request = ref
};
- fr_dlist_tmpl_request_insert_tail(list, rr);
+ tmpl_request_list_insert_tail(list, rr);
}
return 0;
*rr = (tmpl_request_t){
.request = ref
};
- fr_dlist_tmpl_request_insert_tail(list, rr);
+ tmpl_request_list_insert_tail(list, rr);
/*
* Update the parsing rules if we go to the parent.
*/
if (fr_sbuff_next_if_char(name, '.')) {
if (tmpl_request_ref_afrom_attr_substr(ctx, err, vpt, name, p_rules, pt_rules, depth + 1) < 0) {
- fr_dlist_tmpl_request_talloc_free_tail(list); /* Remove and free rr */
+ tmpl_request_list_talloc_free_tail(list); /* Remove and free rr */
return -1;
}
}
if (t_rules->list_as_attr) {
tmpl_attr_t *ar;
- ar = fr_dlist_tmpl_attr_head(&vpt->data.attribute.ar);
+ ar = tmpl_attr_list_head(&vpt->data.attribute.ar);
fr_assert(ar != NULL);
if ((ar->ar_type != TMPL_ATTR_TYPE_NORMAL) ||
* Prepend the list ref so it gets evaluated
* first.
*/
- fr_dlist_tmpl_attr_insert_head(&vpt->data.attribute.ar, ar);
+ tmpl_attr_list_insert_head(&vpt->data.attribute.ar, ar);
}
}
}
*
* Eventually we'll remove TMPL_TYPE_LIST
*/
- if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) == 0) {
+ if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar) == 0) {
tmpl_attr_t *ar;
MEM(ar = talloc_zero(vpt, tmpl_attr_t));
break;
case 1: /* Found a filter */
- fr_dlist_tmpl_attr_insert_tail(&vpt->data.attribute.ar, ar);
+ tmpl_attr_list_insert_tail(&vpt->data.attribute.ar, ar);
break;
default: /* Parse error */
* This emulates what's done in the initial
* tokenizer function.
*/
- ar = fr_dlist_tmpl_attr_head(&vpt->data.attribute.ar);
+ ar = tmpl_attr_list_head(&vpt->data.attribute.ar);
if (ar->type == TMPL_ATTR_TYPE_UNRESOLVED) {
(void)fr_dict_attr_search_by_name_substr(NULL,
&da,
* and correct its parent and
* namespace.
*/
- next = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar);
+ next = tmpl_attr_list_next(&vpt->data.attribute.ar, ar);
if (next) {
next->ar_parent = da;
next->ar_unresolved_namespace = da;
/*
* Loop, resolving each unresolved attribute in turn
*/
- while ((ar = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar))) {
+ while ((ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar))) {
switch (ar->type) {
case TMPL_ATTR_TYPE_NORMAL:
continue; /* Don't need to resolve */
* in the internal dictionary.
*/
if (!da) {
- prev = fr_dlist_tmpl_attr_prev(&vpt->data.attribute.ar, ar);
+ prev = tmpl_attr_list_prev(&vpt->data.attribute.ar, ar);
if (!vpt->rules.disallow_internal && prev && (prev->ar_da->type == FR_TYPE_GROUP)) {
(void)fr_dict_attr_by_name_substr(NULL,
&da,
* Reach into the next reference
* and correct its parent.
*/
- next = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar);
+ next = tmpl_attr_list_next(&vpt->data.attribute.ar, ar);
if (next) {
next->ar_parent = da;
next->ar_unresolved_namespace = da;
* an index, the ar is redundant and should
* be removed.
*/
- prev = fr_dlist_tmpl_attr_prev(&vpt->data.attribute.ar, ar);
+ prev = tmpl_attr_list_prev(&vpt->data.attribute.ar, ar);
if (prev && (prev->ar_da->type != FR_TYPE_GROUP) && (prev->ar_num == NUM_ANY)) {
- fr_dlist_tmpl_attr_remove(&vpt->data.attribute.ar, prev);
+ tmpl_attr_list_remove(&vpt->data.attribute.ar, prev);
ar->ar_parent = prev->ar_parent;
talloc_free(prev);
}
case TMPL_TYPE_LIST:
case TMPL_TYPE_ATTR:
case TMPL_TYPE_ATTR_UNRESOLVED:
- fr_dlist_tmpl_attr_talloc_free(&vpt->data.attribute.ar);
- fr_dlist_tmpl_request_talloc_free(&vpt->data.attribute.rr);
+ tmpl_attr_list_talloc_free(&vpt->data.attribute.ar);
+ tmpl_request_list_talloc_free(&vpt->data.attribute.rr);
break;
/*
*/
void tmpl_attr_to_raw(tmpl_t *vpt)
{
- attr_to_raw(vpt, fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar));
+ attr_to_raw(vpt, tmpl_attr_list_tail(&vpt->data.attribute.ar));
}
/** Add an unknown #fr_dict_attr_t specified by a #tmpl_t to the main dictionary
if (!tmpl_da(vpt)->flags.is_unknown) return 1; /* Ensure at least the leaf is unknown */
- while ((ar = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar))) {
+ while ((ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar))) {
fr_dict_attr_t const *unknown, *known;
switch (ar->type) {
* Fixup the parent of the next unknown
* now it's known.
*/
- next = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar);
+ next = tmpl_attr_list_next(&vpt->data.attribute.ar, ar);
if (next && (next->type == TMPL_ATTR_TYPE_UNKNOWN) &&
(next->ar_da->parent == unknown)) {
if (fr_dict_attr_unknown_parent_to_known(fr_dict_attr_unconst(next->ar_da),
/*
* Print request references
*/
- while ((rr = fr_dlist_tmpl_request_next(&vpt->data.attribute.rr, rr))) {
+ while ((rr = tmpl_request_list_next(&vpt->data.attribute.rr, rr))) {
if (rr->request == REQUEST_CURRENT) continue; /* Don't print the default request */
FR_SBUFF_IN_TABLE_STR_RETURN(&our_out, tmpl_request_ref_table, rr->request, "<INVALID>");
if (printed_rr) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.');
FR_SBUFF_IN_TABLE_STR_RETURN(&our_out, pair_list_table, tmpl_list(vpt), "<INVALID>");
- if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar)) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.');
+ if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar)) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.');
/*
* Request qualifier with no list qualifier
*/
} else if (printed_rr) {
- if (fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar)) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.');
+ if (tmpl_attr_list_num_elements(&vpt->data.attribute.ar)) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.');
}
/*
* we add the .unknown prefix.
*
*/
- if (!tmpl_is_list(vpt) && (ar = fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))) {
+ if (!tmpl_is_list(vpt) && (ar = tmpl_attr_list_tail(&vpt->data.attribute.ar))) {
switch (ar->type) {
case TMPL_ATTR_TYPE_NORMAL:
case TMPL_ATTR_TYPE_UNKNOWN:
* Print attribute identifiers
*/
ar = NULL;
- while ((ar = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar))) {
+ while ((ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar))) {
if (!tmpl_is_list(vpt)) switch(ar->type) {
case TMPL_ATTR_TYPE_NORMAL:
case TMPL_ATTR_TYPE_UNKNOWN:
/*
* First component in the list has everything built
*/
- if (ar == fr_dlist_tmpl_attr_head(&vpt->data.attribute.ar)) {
+ if (ar == tmpl_attr_list_head(&vpt->data.attribute.ar)) {
depth = ar->ar_parent->depth - 1; /* Adjust for array index */
/*
* Everything else skips the first component
break;
}
- if (fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar)) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.');
+ if (tmpl_attr_list_next(&vpt->data.attribute.ar, ar)) FR_SBUFF_IN_CHAR_RETURN(&our_out, '.');
}
return fr_sbuff_set(out, &our_out);
}
/*
* Loop detection
*/
- while ((slow = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, slow)) &&
- (fast = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, fast))) {
+ while ((slow = tmpl_attr_list_next(&vpt->data.attribute.ar, slow)) &&
+ (fast = tmpl_attr_list_next(&vpt->data.attribute.ar, fast))) {
/*
* Advances twice as fast as slow...
*/
- fast = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, fast);
+ fast = tmpl_attr_list_next(&vpt->data.attribute.ar, fast);
fr_fatal_assert_msg(fast != slow,
"CONSISTENCY CHECK FAILED %s[%u]: Looping reference list found. "
"Fast pointer hit slow pointer at \"%s\"",
* Known attribute cannot come after unresolved or unknown attributes
* Unknown attributes cannot come after unresolved attributes
*/
- if (!tmpl_is_list(vpt)) while ((ar = fr_dlist_tmpl_attr_next(&vpt->data.attribute.ar, ar))) {
+ if (!tmpl_is_list(vpt)) while ((ar = tmpl_attr_list_next(&vpt->data.attribute.ar, ar))) {
switch (ar->type) {
case TMPL_ATTR_TYPE_NORMAL:
if (seen_unknown) {
break;
case TMPL_TYPE_ATTR_UNRESOLVED:
- if ((fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) > 0) &&
- ((tmpl_attr_t *)fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))->da) {
+ if ((tmpl_attr_list_num_elements(&vpt->data.attribute.ar) > 0) &&
+ ((tmpl_attr_t *)tmpl_attr_list_tail(&vpt->data.attribute.ar))->da) {
#ifndef NDEBUG
tmpl_attr_debug(vpt);
#endif
fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_ATTR_UNRESOLVED contains %u "
- "references", file, line, fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar));
+ "references", file, line, tmpl_attr_list_num_elements(&vpt->data.attribute.ar));
}
break;
file, line);
}
- if ((fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar) > 0) &&
- ((tmpl_attr_t *)fr_dlist_tmpl_attr_tail(&vpt->data.attribute.ar))->da) {
+ if ((tmpl_attr_list_num_elements(&vpt->data.attribute.ar) > 0) &&
+ ((tmpl_attr_t *)tmpl_attr_list_tail(&vpt->data.attribute.ar))->da) {
#ifndef NDEBUG
tmpl_attr_debug(vpt);
#endif
fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_LIST contains %u "
- "references", file, line, fr_dlist_tmpl_attr_num_elements(&vpt->data.attribute.ar));
+ "references", file, line, tmpl_attr_list_num_elements(&vpt->data.attribute.ar));
}
break;
* We MUST be either at a valid entry, OR at EOF.
*/
MEM(t = talloc_zero(ctx, PAIR_LIST));
- fr_dlist_map_init(&t->check);
- fr_dlist_map_init(&t->reply);
+ map_list_init(&t->check);
+ map_list_init(&t->reply);
t->filename = filename;
t->lineno = lineno;
t->order = order++;
do_insert:
fr_assert(!new_map->parent);
- fr_dlist_map_insert_tail(&t->check, new_map);
+ map_list_insert_tail(&t->check, new_map);
/*
* There can be spaces before any comma.
fr_assert(tmpl_list(new_map->lhs) == PAIR_LIST_REPLY);
- if (!new_map->parent) fr_dlist_map_insert_tail(&t->reply, new_map);
+ if (!new_map->parent) map_list_insert_tail(&t->reply, new_map);
(void) fr_sbuff_adv_past_blank(&sbuff, SIZE_MAX, NULL);
typedef struct pair_list {
char const *name; //!< Key for matching entry.
- fr_map_list_t check; //!< List of maps for comparison / modifying control list
- fr_map_list_t reply; //!< List of maps for modifying reply list
+ map_list_t check; //!< List of maps for comparison / modifying control list
+ map_list_t reply; //!< List of maps for modifying reply list
int order; //!< Sequence of entry in source file
char const *filename; //!< Filename entry read from
int lineno; //!< Line number entry read from
/*
* Sanity check sublists.
*/
- if (!fr_dlist_map_empty(&map->child)) {
+ if (!map_list_empty(&map->child)) {
fr_dict_attr_t const *da;
if (!tmpl_is_attr(map->lhs)) {
return false;
}
- return pass2_fixup_map(fr_dlist_map_head(&map->child), rules, da);
+ return pass2_fixup_map(map_list_head(&map->child), rules, da);
}
return true;
RULES_VERIFY(rules);
- while ((map = fr_dlist_map_next(&gext->map, map))) {
+ while ((map = map_list_next(&gext->map, map))) {
/*
* Mostly fixup the map, but maybe leave the RHS
* unresolved.
* the RHS as a reference to a json string, SQL column
* name, etc.
*/
- while ((map = fr_dlist_map_next(&gext->map, map))) {
+ while ((map = map_list_next(&gext->map, map))) {
if (!pass2_fixup_map(map, rules, NULL)) return false;
}
*/
if (!gext->vpt) return true;
- return pass2_fixup_tmpl(fr_dlist_map_head(&gext->map)->ci, &gext->vpt,
+ return pass2_fixup_tmpl(map_list_head(&gext->map)->ci, &gext->vpt,
cf_section_to_item(g->cs), rules->dict_def);
}
g = unlang_generic_to_group(c);
gext = unlang_group_to_map(g);
map = NULL;
- while ((map = fr_dlist_map_next(&gext->map, map))) {
+ while ((map = map_list_next(&gext->map, map))) {
map_print(&FR_SBUFF_OUT(buffer, sizeof(buffer)), map);
DEBUG("%.*s%s", depth + 1, unlang_spaces, buffer);
}
edit = unlang_generic_to_edit(c);
map = NULL;
- while ((map = fr_dlist_map_next(&edit->maps, map))) {
+ while ((map = map_list_next(&edit->maps, map))) {
map_print(&FR_SBUFF_OUT(buffer, sizeof(buffer)), map);
DEBUG("%.*s%s", depth + 1, unlang_spaces, buffer);
}
/*
* This looks at cs->name2 to determine which list to update
*/
- fr_dlist_map_init(&gext->map);
+ map_list_init(&gext->map);
rcode = map_afrom_cs(gext, &gext->map, cs, &t_rules, &t_rules, unlang_fixup_map, NULL, 256);
if (rcode < 0) return NULL; /* message already printed */
- if (fr_dlist_map_empty(&gext->map)) {
+ if (map_list_empty(&gext->map)) {
cf_log_err(cs, "'map' sections cannot be empty");
goto error;
}
/*
* This looks at cs->name2 to determine which list to update
*/
- fr_dlist_map_init(&gext->map);
+ map_list_init(&gext->map);
rcode = map_afrom_cs(gext, &gext->map, cs, &t_rules, &t_rules, unlang_fixup_update, NULL, 128);
if (rcode < 0) return NULL; /* message already printed */
- if (fr_dlist_map_empty(&gext->map)) {
+ if (map_list_empty(&gext->map)) {
cf_log_err(cs, "'update' sections cannot be empty");
error:
talloc_free(g);
/*
* This looks at cs->name2 to determine which list to update
*/
- fr_dlist_map_init(&gext->map);
+ map_list_init(&gext->map);
rcode = map_afrom_cs(gext, &gext->map, cs, &t_rules, &t_rules, unlang_fixup_filter, NULL, 128);
if (rcode < 0) return NULL; /* message already printed */
- if (fr_dlist_map_empty(&gext->map)) {
+ if (map_list_empty(&gext->map)) {
cf_log_err(cs, "'filter' sections cannot be empty");
return NULL;
}
c->debug_name = c->name;
c->type = UNLANG_TYPE_EDIT;
- fr_dlist_map_init(&edit->maps);
+ map_list_init(&edit->maps);
edit_free = edit;
compile_action_defaults(c, unlang_ctx);
MEM(map = talloc_zero(parent, map_t));
map->op = op;
map->ci = cf_section_to_item(cs);
- fr_dlist_map_init(&map->child);
+ map_list_init(&map->child);
name = cf_section_name1(cs);
*/
// if (unlang_fixup_update(map, NULL) < 0) goto fail;
- fr_dlist_map_insert_tail(&edit->maps, map);
+ map_list_insert_tail(&edit->maps, map);
*prev = c;
return out;
c->debug_name = c->name;
c->type = UNLANG_TYPE_EDIT;
- fr_dlist_map_init(&edit->maps);
+ map_list_init(&edit->maps);
edit_free = edit;
compile_action_defaults(c, unlang_ctx);
/*
* Convert this particular map.
*/
- if (map_afrom_cp(edit, &map, fr_dlist_map_tail(&edit->maps), cp, &t_rules, &t_rules) < 0) {
+ if (map_afrom_cp(edit, &map, map_list_tail(&edit->maps), cp, &t_rules, &t_rules) < 0) {
fail:
talloc_free(edit_free);
return NULL;
*/
if (unlang_fixup_update(map, NULL) < 0) goto fail;
- fr_dlist_map_insert_tail(&edit->maps, map);
+ map_list_insert_tail(&edit->maps, map);
*prev = c;
return out;
fr_edit_list_t *el; //!< edit list
unlang_edit_state_t state; //!< What we're currently doing.
- fr_map_list_t const *map_head;
+ map_list_t const *map_head;
map_t const *map; //!< the map to evaluate
edit_result_t lhs; //!< LHS child entries
return -1;
}
- if (!fr_dlist_map_empty(&map->child)) {
+ if (!map_list_empty(&map->child)) {
REDEBUG("In-place lists not yet implemented");
return -1;
}
*/
for (map = state->map;
map != NULL;
- map = state->map = fr_dlist_map_next(state->map_head, map)) {
+ map = state->map = map_list_next(state->map_head, map)) {
repeatable_set(frame); /* Call us again when done */
switch (state->state) {
* The edit list creates a local pool which should
* generally be large enough for most edits.
*/
- MEM(state->el = fr_edit_list_alloc(state, fr_dlist_map_num_elements(&edit->maps)));
+ MEM(state->el = fr_edit_list_alloc(state, map_list_num_elements(&edit->maps)));
state->map_head = &edit->maps;
- state->map = fr_dlist_map_head(state->map_head);
+ state->map = map_list_head(state->map_head);
fr_pair_list_init(&state->rhs.pair_list);
/*
typedef struct {
unlang_t self;
- fr_map_list_t maps; //!< Head of the map list
+ map_list_t maps; //!< Head of the map list
} unlang_edit_t;
/** Cast a generic structure to the edit extension
typedef struct {
unlang_group_t group;
tmpl_t *vpt;
- fr_map_list_t map; //!< Head of the map list
+ map_list_t map; //!< Head of the map list
map_proc_inst_t *proc_inst;
} unlang_map_t;
* @param[in] _name Prefix we add to type-specific structures.
* @return fr_dlist_<name>_entry_t
*/
-#define FR_DLIST_ENTRY_TYPE(_name) fr_dlist_ ## _name ## _entry_t
+#define FR_DLIST_ENTRY(_name) _name ## _entry_t
/** Expands to the type name used for the head wrapper structure
*
* @param[in] _name Prefix we add to type-specific structures.
* @return fr_dlist_<name>_head_t
*/
-#define FR_DLIST_HEAD_TYPE(_name) fr_dlist_ ## _name ## _head_t
+#define FR_DLIST_HEAD(_name) _name ## _head_t
/** Define type specific wrapper structs for dlists
*
* which will use type specific functions.
*/
#define FR_DLIST_TYPES(_name) \
- typedef struct { fr_dlist_t entry; } FR_DLIST_ENTRY_TYPE(_name); \
- typedef struct { fr_dlist_head_t head; } FR_DLIST_HEAD_TYPE(_name); \
+ typedef struct { fr_dlist_t entry; } FR_DLIST_ENTRY(_name); \
+ typedef struct { fr_dlist_head_t head; } FR_DLIST_HEAD(_name); \
/** Define type specific wrapper functions for dlists
*
*/
#define FR_DLIST_FUNCS(_name, _element_type, _element_entry) \
DIAG_OFF(unused-function) \
- _Static_assert(IS_FIELD_COMPATIBLE(_element_type, _element_entry, FR_DLIST_ENTRY_TYPE(_name)) == 1, "Bad dlist entry field type");\
- static inline fr_dlist_head_t *fr_dlist_ ## _name ## _list_head(FR_DLIST_HEAD_TYPE(_name) const *list) \
+ _Static_assert(IS_FIELD_COMPATIBLE(_element_type, _element_entry, FR_DLIST_ENTRY(_name)) == 1, "Bad dlist entry field type");\
+ static inline fr_dlist_head_t *_name ## _list_head(FR_DLIST_HEAD(_name) const *list) \
{ return UNCONST(fr_dlist_head_t *, &list->head); } \
- static inline void fr_dlist_ ## _name ## _entry_init(_element_type *entry) \
+\
+ static inline void _name ## _entry_init(_element_type *entry) \
{ \
_Generic((&entry->_element_entry), \
- FR_DLIST_ENTRY_TYPE(_name) *: fr_dlist_entry_init(UNCONST(fr_dlist_t *, &entry->_element_entry.entry)), \
- FR_DLIST_ENTRY_TYPE(_name) const *: fr_dlist_noop()\
+ FR_DLIST_ENTRY(_name) *: fr_dlist_entry_init(UNCONST(fr_dlist_t *, &entry->_element_entry.entry)), \
+ FR_DLIST_ENTRY(_name) const *: fr_dlist_noop()\
); \
} \
\
- static inline void fr_dlist_ ## _name ## _init(FR_DLIST_HEAD_TYPE(_name) *list) \
+ static inline void _name ## _init(FR_DLIST_HEAD(_name) *list) \
{ _fr_dlist_init(&list->head, offsetof(_element_type, _element_entry), NULL); } \
\
- static inline void fr_dlist_ ## _name ## _talloc_init(FR_DLIST_HEAD_TYPE(_name) *list) \
+ static inline void _name ## _talloc_init(FR_DLIST_HEAD(_name) *list) \
{ _fr_dlist_init(&list->head, offsetof(_element_type, _element_entry), #_element_type); } \
\
- static inline void fr_dlist_ ## _name ## _clear(FR_DLIST_HEAD_TYPE(_name) *list) \
+ static inline void _name ## _clear(FR_DLIST_HEAD(_name) *list) \
{ fr_dlist_clear(&list->head); } \
\
- static inline bool fr_dlist_ ## _name ## _in_list(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *ptr) \
+ static inline bool _name ## _in_list(FR_DLIST_HEAD(_name) *list, _element_type *ptr) \
{ return fr_dlist_in_list(&list->head, ptr); } \
\
- static inline int fr_dlist_ ## _name ## _insert_head(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *ptr) \
+ static inline int _name ## _insert_head(FR_DLIST_HEAD(_name) *list, _element_type *ptr) \
{ return fr_dlist_insert_head(&list->head, ptr); } \
\
- static inline int fr_dlist_ ## _name ## _insert_tail(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *ptr) \
+ static inline int _name ## _insert_tail(FR_DLIST_HEAD(_name) *list, _element_type *ptr) \
{ return fr_dlist_insert_tail(&list->head, ptr); } \
\
- static inline int fr_dlist_ ## _name ## _insert_after(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *pos, _element_type *ptr) \
+ static inline int _name ## _insert_after(FR_DLIST_HEAD(_name) *list, _element_type *pos, _element_type *ptr) \
{ return fr_dlist_insert_after(&list->head, pos, ptr); } \
\
- static inline int fr_dlist_ ## _name ## _insert_before(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *pos, _element_type *ptr) \
+ static inline int _name ## _insert_before(FR_DLIST_HEAD(_name) *list, _element_type *pos, _element_type *ptr) \
{ return fr_dlist_insert_before(&list->head, pos, ptr); } \
\
- static inline _element_type *fr_dlist_ ## _name ## _head(FR_DLIST_HEAD_TYPE(_name) const *list) \
+ static inline _element_type *_name ## _head(FR_DLIST_HEAD(_name) const *list) \
{ return fr_dlist_head(&list->head); } \
\
- static inline bool fr_dlist_ ## _name ## _empty(FR_DLIST_HEAD_TYPE(_name) const *list) \
+ static inline bool _name ## _empty(FR_DLIST_HEAD(_name) const *list) \
{ return fr_dlist_empty(&list->head); } \
\
- static inline bool fr_dlist_ ## _name ## _initialised(FR_DLIST_HEAD_TYPE(_name) const *list) \
+ static inline bool _name ## _initialised(FR_DLIST_HEAD(_name) const *list) \
{ return fr_dlist_initialised(&list->head); } \
\
- static inline _element_type *fr_dlist_ ## _name ## _tail(FR_DLIST_HEAD_TYPE(_name) const *list) \
+ static inline _element_type *_name ## _tail(FR_DLIST_HEAD(_name) const *list) \
{ return fr_dlist_tail(&list->head); } \
\
- static inline _element_type *fr_dlist_ ## _name ## _next(FR_DLIST_HEAD_TYPE(_name) const *list, _element_type const *ptr) \
+ static inline _element_type *_name ## _next(FR_DLIST_HEAD(_name) const *list, _element_type const *ptr) \
{ return fr_dlist_next(&list->head, ptr); } \
\
- static inline _element_type *fr_dlist_ ## _name ## _prev(FR_DLIST_HEAD_TYPE(_name) const *list, _element_type const *ptr) \
+ static inline _element_type *_name ## _prev(FR_DLIST_HEAD(_name) const *list, _element_type const *ptr) \
{ return fr_dlist_prev(&list->head, ptr); } \
\
- static inline _element_type *fr_dlist_ ## _name ## _remove(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *ptr) \
+ static inline _element_type *_name ## _remove(FR_DLIST_HEAD(_name) *list, _element_type *ptr) \
{ return fr_dlist_remove(&list->head, ptr); } \
\
- static inline _element_type *fr_dlist_ ## _name ## _pop_head(FR_DLIST_HEAD_TYPE(_name) *list) \
+ static inline _element_type *_name ## _pop_head(FR_DLIST_HEAD(_name) *list) \
{ return fr_dlist_pop_head(&list->head); } \
\
- static inline _element_type *fr_dlist_ ## _name ## _pop_tail(FR_DLIST_HEAD_TYPE(_name) *list) \
+ static inline _element_type *_name ## _pop_tail(FR_DLIST_HEAD(_name) *list) \
{ return fr_dlist_pop_tail(&list->head); } \
\
- static inline _element_type *fr_dlist_ ## _name ## _replace(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *item, _element_type *ptr) \
+ static inline _element_type *_name ## _replace(FR_DLIST_HEAD(_name) *list, _element_type *item, _element_type *ptr) \
{ return fr_dlist_replace(&list->head, item, ptr); } \
\
- static inline int fr_dlist_ ## _name ## _move(FR_DLIST_HEAD_TYPE(_name) *dst, FR_DLIST_HEAD_TYPE(_name) *src) \
+ static inline int _name ## _move(FR_DLIST_HEAD(_name) *dst, FR_DLIST_HEAD(_name) *src) \
{ return fr_dlist_move(&dst->head, &src->head); } \
\
- static inline int fr_dlist_ ## _name ## _move_head(FR_DLIST_HEAD_TYPE(_name) *dst, FR_DLIST_HEAD_TYPE(_name) *src) \
+ static inline int _name ## _move_head(FR_DLIST_HEAD(_name) *dst, FR_DLIST_HEAD(_name) *src) \
{ return fr_dlist_move_head(&dst->head, &src->head); } \
\
- static inline void fr_dlist_ ## _name ## _talloc_free_head(FR_DLIST_HEAD_TYPE(_name) *list) \
+ static inline void _name ## _talloc_free_head(FR_DLIST_HEAD(_name) *list) \
{ fr_dlist_talloc_free_head(&list->head); } \
\
- static inline void fr_dlist_ ## _name ## _talloc_free_tail(FR_DLIST_HEAD_TYPE(_name) *list) \
+ static inline void _name ## _talloc_free_tail(FR_DLIST_HEAD(_name) *list) \
{ fr_dlist_talloc_free_tail(&list->head); } \
\
- static inline void fr_dlist_ ## _name ## _talloc_free_item(FR_DLIST_HEAD_TYPE(_name) *list, _element_type *ptr) \
+ static inline void _name ## _talloc_free_item(FR_DLIST_HEAD(_name) *list, _element_type *ptr) \
{ fr_dlist_talloc_free_item(&list->head, ptr); } \
\
- static inline void fr_dlist_ ## _name ## _talloc_free(FR_DLIST_HEAD_TYPE(_name) *list) \
+ static inline void _name ## _talloc_free(FR_DLIST_HEAD(_name) *list) \
{ fr_dlist_talloc_free(&list->head); } \
\
- static inline void fr_dlist_ ## _name ## _talloc_reverse_free(FR_DLIST_HEAD_TYPE(_name) *list) \
+ static inline void _name ## _talloc_reverse_free(FR_DLIST_HEAD(_name) *list) \
{ fr_dlist_talloc_reverse_free(&list->head); } \
\
- static inline unsigned int fr_dlist_ ## _name ## _num_elements(FR_DLIST_HEAD_TYPE(_name) const *list) \
+ static inline unsigned int _name ## _num_elements(FR_DLIST_HEAD(_name) const *list) \
{ return fr_dlist_num_elements(&list->head); } \
\
- static inline void fr_dlist_ ## _name ## _sort(FR_DLIST_HEAD_TYPE(_name) *list, fr_cmp_t cmp) \
+ static inline void _name ## _sort(FR_DLIST_HEAD(_name) *list, fr_cmp_t cmp) \
{ fr_dlist_sort(&list->head, cmp); } \
DIAG_ON(unused-function)
#include <freeradius-devel/util/proto.h>
#include <freeradius-devel/util/regex.h>
-FR_DLIST_FUNCS(pair, fr_pair_t, order_entry)
+FR_DLIST_FUNCS(fr_pair_order_list, fr_pair_t, order_entry)
/** Initialise a pair list header
*
* in the list and allows us to iterate over
* all of them.
*/
- fr_dlist_pair_talloc_init(&list->order);
+ fr_pair_order_list_talloc_init(&list->order);
}
/** Free a fr_pair_t
*/
static inline CC_HINT(always_inline) void pair_init_null(fr_pair_t *vp)
{
- fr_dlist_pair_entry_init(vp);
+ fr_pair_order_list_entry_init(vp);
/*
* Legacy cruft
*/
int fr_pair_steal_append(TALLOC_CTX *list_ctx, fr_pair_list_t *list, fr_pair_t *vp)
{
- if (fr_dlist_pair_in_list(&list->order, vp)) {
+ if (fr_pair_order_list_in_list(&list->order, vp)) {
fr_strerror_printf("Pair %pV is a list member, cannot be moved", vp);
return -1;
}
*/
int fr_pair_steal_prepend(TALLOC_CTX *list_ctx, fr_pair_list_t *list, fr_pair_t *vp)
{
- if (fr_dlist_pair_in_list(&list->order, vp)) {
+ if (fr_pair_order_list_in_list(&list->order, vp)) {
fr_strerror_printf("Pair %pV is a list member, cannot be moved", vp);
return -1;
}
*/
void fr_pair_list_free(fr_pair_list_t *list)
{
- fr_dlist_pair_talloc_free(&list->order);
+ fr_pair_order_list_talloc_free(&list->order);
}
/** Is a valuepair list empty
*/
bool fr_pair_list_empty(fr_pair_list_t const *list)
{
- return fr_dlist_pair_empty(&list->order);
+ return fr_pair_order_list_empty(&list->order);
}
/** Mark malformed or unrecognised attributed as unknown
fr_pair_t *vp = NULL;
unsigned int count = 0;
- if (fr_dlist_pair_empty(&list->order)) return 0;
+ if (fr_pair_order_list_empty(&list->order)) return 0;
- while ((vp = fr_dlist_pair_next(&list->order, vp))) if (da == vp->da) count++;
+ while ((vp = fr_pair_order_list_next(&list->order, vp))) if (da == vp->da) count++;
return count;
}
{
fr_pair_t *vp = UNCONST(fr_pair_t *, prev);
- if (fr_dlist_pair_empty(&list->order)) return NULL;
+ if (fr_pair_order_list_empty(&list->order)) return NULL;
PAIR_LIST_VERIFY(list);
- while ((vp = fr_dlist_pair_next(&list->order, vp))) if (da == vp->da) return vp;
+ while ((vp = fr_pair_order_list_next(&list->order, vp))) if (da == vp->da) return vp;
return NULL;
}
{
fr_pair_t *vp = NULL;
- if (fr_dlist_pair_empty(&list->order)) return NULL;
+ if (fr_pair_order_list_empty(&list->order)) return NULL;
PAIR_LIST_VERIFY(list);
fr_dict_attr_t const *da;
/* List head may be NULL if it contains no VPs */
- if (fr_dlist_pair_empty(&list->order)) return NULL;
+ if (fr_pair_order_list_empty(&list->order)) return NULL;
PAIR_LIST_VERIFY(list);
fr_dict_attr_t const *da;
/* List head may be NULL if it contains no VPs */
- if (fr_dlist_pair_empty(&list->order)) return NULL;
+ if (fr_pair_order_list_empty(&list->order)) return NULL;
PAIR_LIST_VERIFY(list);
fr_dcursor_iter_t iter, void const *uctx,
bool is_const)
{
- return _fr_dcursor_init(cursor, fr_dlist_pair_list_head(&list->order),
+ return _fr_dcursor_init(cursor, fr_pair_order_list_list_head(&list->order),
iter, uctx,
_pair_list_dcursor_insert, _pair_list_dcursor_remove, list, is_const);
}
fr_pair_t *_fr_pair_dcursor_init(fr_dcursor_t *cursor, fr_pair_list_t const *list,
bool is_const)
{
- return _fr_dcursor_init(cursor, fr_dlist_pair_list_head(&list->order),
+ return _fr_dcursor_init(cursor, fr_pair_order_list_list_head(&list->order),
NULL, NULL,
_pair_list_dcursor_insert, _pair_list_dcursor_remove, list, is_const);
}
fr_pair_list_t const *list, fr_dict_attr_t const *da,
bool is_const)
{
- return _fr_dcursor_init(cursor, fr_dlist_pair_list_head(&list->order),
+ return _fr_dcursor_init(cursor, fr_pair_order_list_list_head(&list->order),
fr_pair_iter_next_by_da, da,
_pair_list_dcursor_insert, _pair_list_dcursor_remove, list, is_const);
}
fr_pair_list_t const *list, fr_dict_attr_t const *da,
bool is_const)
{
- return _fr_dcursor_init(cursor, fr_dlist_pair_list_head(&list->order),
+ return _fr_dcursor_init(cursor, fr_pair_order_list_list_head(&list->order),
fr_pair_iter_next_by_ancestor, da,
_pair_list_dcursor_insert, _pair_list_dcursor_remove, list, is_const);
}
*/
fr_pair_t *fr_pair_list_head(fr_pair_list_t const *list)
{
- return fr_dlist_pair_head(&list->order);
+ return fr_pair_order_list_head(&list->order);
}
/** Get the next item in a valuepair list after a specific entry
*/
fr_pair_t *fr_pair_list_next(fr_pair_list_t const *list, fr_pair_t const *item)
{
- return fr_dlist_pair_next(&list->order, item);
+ return fr_pair_order_list_next(&list->order, item);
}
/** Get the previous item in a valuepair list before a specific entry
*/
fr_pair_t *fr_pair_list_prev(fr_pair_list_t const *list, fr_pair_t const *item)
{
- return fr_dlist_pair_prev(&list->order, item);
+ return fr_pair_order_list_prev(&list->order, item);
}
/** Get the tail of a valuepair list
*/
fr_pair_t *fr_pair_list_tail(fr_pair_list_t const *list)
{
- return fr_dlist_pair_tail(&list->order);
+ return fr_pair_order_list_tail(&list->order);
}
/** Add a VP to the start of the list.
{
PAIR_VERIFY(to_add);
- if (fr_dlist_pair_in_list(&list->order, to_add)) {
+ if (fr_pair_order_list_in_list(&list->order, to_add)) {
fr_strerror_printf("Pair %pV already inserted into list", to_add);
return -1;
}
- fr_dlist_pair_insert_head(&list->order, to_add);
+ fr_pair_order_list_insert_head(&list->order, to_add);
return 0;
}
{
PAIR_VERIFY(to_add);
- if (fr_dlist_pair_in_list(&list->order, to_add)) {
+ if (fr_pair_order_list_in_list(&list->order, to_add)) {
fr_strerror_printf("Pair %pV already inserted into list", to_add);
return -1;
}
- fr_dlist_pair_insert_tail(&list->order, to_add);
+ fr_pair_order_list_insert_tail(&list->order, to_add);
return 0;
}
{
PAIR_VERIFY(to_add);
- if (fr_dlist_pair_in_list(&list->order, to_add)) {
+ if (fr_pair_order_list_in_list(&list->order, to_add)) {
fr_strerror_printf("Pair %pV already inserted into list", to_add);
return -1;
}
- if (pos && !fr_dlist_pair_in_list(&list->order, pos)) {
+ if (pos && !fr_pair_order_list_in_list(&list->order, pos)) {
fr_strerror_printf("Pair %pV not in list", pos);
return -1;
}
- fr_dlist_pair_insert_after(&list->order, pos, to_add);
+ fr_pair_order_list_insert_after(&list->order, pos, to_add);
return 0;
}
{
PAIR_VERIFY(to_add);
- if (fr_dlist_pair_in_list(&list->order, to_add)) {
+ if (fr_pair_order_list_in_list(&list->order, to_add)) {
fr_strerror_printf("Pair %pV already inserted into list", to_add);
return -1;
}
- if (pos && !fr_dlist_pair_in_list(&list->order, pos)) {
+ if (pos && !fr_pair_order_list_in_list(&list->order, pos)) {
fr_strerror_printf("Pair %pV not in list", pos);
return -1;
}
- fr_dlist_pair_insert_before(&list->order, pos, to_add);
+ fr_pair_order_list_insert_before(&list->order, pos, to_add);
return 0;
}
{
fr_pair_t *prev;
- prev = fr_dlist_pair_prev(&list->order, vp);
- fr_dlist_pair_remove(&list->order, vp);
+ prev = fr_pair_order_list_prev(&list->order, vp);
+ fr_pair_order_list_remove(&list->order, vp);
return prev;
}
{
fr_pair_t *prev;
- prev = fr_dlist_pair_prev(&list->order, vp);
- fr_dlist_pair_remove(&list->order, vp);
+ prev = fr_pair_order_list_prev(&list->order, vp);
+ fr_pair_order_list_remove(&list->order, vp);
talloc_free(vp);
return prev;
*/
void fr_pair_list_sort(fr_pair_list_t *list, fr_cmp_t cmp)
{
- fr_dlist_pair_sort(&list->order, cmp);
+ fr_pair_order_list_sort(&list->order, cmp);
}
/** Write an error to the library errorbuff detailing the mismatch
{
fr_pair_t *check, *match;
- if (fr_dlist_pair_empty(&filter->order) && fr_dlist_pair_empty(&list->order)) return true;
+ if (fr_pair_order_list_empty(&filter->order) && fr_pair_order_list_empty(&list->order)) return true;
/*
* This allows us to verify the sets of validate and reply are equal
{
fr_pair_t *check, *last_check = NULL, *match = NULL;
- if (fr_dlist_pair_empty(&filter->order) && fr_dlist_pair_empty(&list->order)) return true;
+ if (fr_pair_order_list_empty(&filter->order) && fr_pair_order_list_empty(&list->order)) return true;
/*
* This allows us to verify the sets of validate and reply are equal
break;
case FR_TYPE_STRUCTURAL:
- if (!fr_dlist_pair_empty(&vp->vp_group.order)) return;
+ if (!fr_pair_order_list_empty(&vp->vp_group.order)) return;
- while ((child = fr_dlist_pair_pop_tail(&vp->vp_group.order))) {
+ while ((child = fr_pair_order_list_pop_tail(&vp->vp_group.order))) {
fr_pair_value_clear(child);
talloc_free(child);
}
*/
void fr_pair_list_append(fr_pair_list_t *dst, fr_pair_list_t *src)
{
- fr_dlist_pair_move(&dst->order, &src->order);
+ fr_pair_order_list_move(&dst->order, &src->order);
}
/** Move a list of fr_pair_t from a temporary list to the head of a destination list
*/
void fr_pair_list_prepend(fr_pair_list_t *dst, fr_pair_list_t *src)
{
- fr_dlist_pair_move_head(&dst->order, &src->order);
+ fr_pair_order_list_move_head(&dst->order, &src->order);
}
/** Evaluation function for matching if vp matches a given da
*/
size_t fr_pair_list_len(fr_pair_list_t const *list)
{
- return fr_dlist_pair_num_elements(&list->order);
+ return fr_pair_order_list_num_elements(&list->order);
}
/** Parse a list of VPs from a value box.
typedef struct value_pair_s fr_pair_t;
-FR_DLIST_TYPES(pair)
+FR_DLIST_TYPES(fr_pair_order_list)
typedef struct {
- FR_DLIST_HEAD_TYPE(pair) order; //!< Maintains the relative order of pairs in a list.
+ FR_DLIST_HEAD(fr_pair_order_list) order; //!< Maintains the relative order of pairs in a list.
} fr_pair_list_t;
/** Stores an attribute, a value and various bits of other data
///< Note: This should not be modified outside
///< of pair.c except via #fr_pair_reinit_from_da.
- FR_DLIST_ENTRY_TYPE(pair) _CONST order_entry; //!< Entry to maintain relative order within a list
+ FR_DLIST_ENTRY(fr_pair_order_list) _CONST order_entry; //!< Entry to maintain relative order within a list
///< of pairs. This ensures pairs within the list
///< are encoded in the same order as they were
///< received or inserted.
/*
* LDAP attribute to RADIUS map
*/
- fr_map_list_t entry_map; //!< How to convert attributes in entries
+ map_list_t entry_map; //!< How to convert attributes in entries
//!< to FreeRADIUS attributes.
/*
/*
* We apply the rules in the reply items.
*/
- if (!fr_dlist_map_empty(&entry->check)) {
+ if (!map_list_empty(&entry->check)) {
WARN("%s[%d] Check list is not empty for entry \"%s\".\n",
filename, entry->lineno, entry->name);
}
map = NULL;
- while ((map = fr_dlist_map_next(&entry->reply, map))) {
+ while ((map = map_list_next(&entry->reply, map))) {
fr_dict_attr_t const *da;
if (!tmpl_is_attr(map->lhs)) {
fr_pair_list_init(&check_list);
- while ((map = fr_dlist_map_next(&pl->reply, map))) {
+ while ((map = map_list_next(&pl->reply, map))) {
if (map_to_vp(packet, &tmp_list, request, map, NULL) < 0) {
RPWARN("Failed parsing map %s for check item, skipping it", map->lhs->name);
continue;
redisReply *reply = NULL;
int s_ret;
- fr_map_list_t head;
+ map_list_t head;
#ifdef HAVE_TALLOC_ZERO_POOLED_OBJECT
size_t pool_size = 0;
#endif
rlm_cache_entry_t *c;
- fr_dlist_map_init(&head);
+ map_list_init(&head);
for (s_ret = fr_redis_cluster_state_init(&state, &conn, driver->cluster, request, key, key_len, false);
s_ret == REDIS_RCODE_TRY_AGAIN; /* Continue */
s_ret = fr_redis_cluster_state_next(&state, &conn, driver->cluster, request, status, &reply)) {
#else
c = talloc_zero(NULL, rlm_cache_entry_t);
#endif
- fr_dlist_map_init(&c->maps);
+ map_list_init(&c->maps);
/*
* Convert the key/value pairs back into maps
*/
/*
* Pull out the cache created date
*/
- if (tmpl_da(fr_dlist_map_head(&head)->lhs) == attr_cache_created) {
+ if (tmpl_da(map_list_head(&head)->lhs) == attr_cache_created) {
map_t *map;
- c->created = tmpl_value(fr_dlist_map_head(&head)->rhs)->vb_date;
+ c->created = tmpl_value(map_list_head(&head)->rhs)->vb_date;
- map = fr_dlist_map_pop_head(&head);
+ map = map_list_pop_head(&head);
talloc_free(map);
}
/*
* Pull out the cache expires date
*/
- if (tmpl_da(fr_dlist_map_head(&head)->lhs) == attr_cache_expires) {
+ if (tmpl_da(map_list_head(&head)->lhs) == attr_cache_expires) {
map_t *map;
- c->expires = tmpl_value(fr_dlist_map_head(&head)->rhs)->vb_date;
+ c->expires = tmpl_value(map_list_head(&head)->rhs)->vb_date;
- map = fr_dlist_map_pop_head(&head);
+ map = map_list_pop_head(&head);
talloc_free(map);
}
c->key = talloc_memdup(c, key, key_len);
c->key_len = key_len;
- fr_dlist_map_move(&c->maps, &head);
+ map_list_move(&c->maps, &head);
*out = c;
return CACHE_OK;
fr_value_box_init(&expires_value.data.literal, FR_TYPE_DATE, NULL, true);
tmpl_value(&expires_value)->vb_date = c->expires;
- cnt = fr_dlist_map_num_elements(&c->maps) + 2;
+ cnt = map_list_num_elements(&c->maps) + 2;
/*
* The majority of serialized entries should be under 1k.
}
argv_p += 3;
argv_len_p += 3;
- while ((map = fr_dlist_map_next(&c->maps, map))) {
+ while ((map = map_list_next(&c->maps, map))) {
if (fr_redis_tuple_from_map(pool, argv_p, argv_len_p, map) < 0) {
REDEBUG("Failed encoding map as Redis K/V pair");
talloc_free(pool);
RDEBUG2("Merging cache entry into request");
RINDENT();
- while ((map = fr_dlist_map_next(&c->maps, map))) {
+ while ((map = map_list_next(&c->maps, map))) {
/*
* The only reason that the application of a map entry
* can fail, is if the destination list or request
if (!c) {
RETURN_MODULE_FAIL;
}
- fr_dlist_map_init(&c->maps);
+ map_list_init(&c->maps);
c->key = talloc_memdup(c, key, key_len);
c->key_len = key_len;
* gathering fr_pair_ts to cache.
*/
pool = talloc_pool(NULL, 2048);
- while ((map = fr_dlist_map_next(&inst->maps, map))) {
+ while ((map = map_list_next(&inst->maps, map))) {
fr_pair_list_t to_cache;
fr_pair_list_init(&to_cache);
MEM(c_map = talloc_zero(c, map_t));
c_map->op = map->op;
- fr_dlist_map_init(&c_map->child);
+ map_list_init(&c_map->child);
/*
* Now we turn the fr_pair_ts into maps.
fr_assert(0);
}
MAP_VERIFY(c_map);
- fr_dlist_map_insert_tail(&c->maps, c_map);
+ map_list_insert_tail(&c->maps, c_map);
}
talloc_free_children(pool); /* reset pool state */
}
return XLAT_ACTION_FAIL;
}
- while ((map = fr_dlist_map_next(&c->maps, map))) {
+ while ((map = map_list_next(&c->maps, map))) {
if ((tmpl_da(map->lhs) != tmpl_da(target)) ||
(tmpl_list(map->lhs) != tmpl_list(target))) continue;
.allow_foreign = true /* Because we don't know where we'll be called */
};
- fr_dlist_map_init(&inst->maps);
+ map_list_init(&inst->maps);
if (map_afrom_cs(inst, &inst->maps, update,
&parse_rules, &parse_rules, cache_verify, NULL, MAX_ATTRMAP) < 0) {
return -1;
}
}
- if (fr_dlist_map_empty(&inst->maps)) {
+ if (map_list_empty(&inst->maps)) {
cf_log_err(conf, "Cache config must contain an update section, and "
"that section must not be empty");
return -1;
module_instance_t *driver_inst; //!< Driver's instance data.
rlm_cache_driver_t const *driver; //!< Driver's exported interface.
- fr_map_list_t maps; //!< Attribute map applied to users.
+ map_list_t maps; //!< Attribute map applied to users.
//!< and profiles.
} rlm_cache_t;
fr_unix_time_t created; //!< When the entry was created.
fr_unix_time_t expires; //!< When the entry expires.
- fr_map_list_t maps; //!< Head of the maps list.
+ map_list_t maps; //!< Head of the maps list.
} rlm_cache_entry_t;
/** Allocate a new cache entry
/*
* It's valid to have an empty cache entry (save allocing the pairs pool)
*/
- if (fr_dlist_map_empty(&c->maps)) goto finish;
+ if (map_list_empty(&c->maps)) goto finish;
value_pool = talloc_pool(ctx, 512);
if (!value_pool) {
return -1;
}
- while ((map = fr_dlist_map_next(&c->maps, map))) {
+ while ((map = map_list_next(&c->maps, map))) {
char *value;
ssize_t slen;
MAP_VERIFY(map);
/* It's not a special attribute, add it to the map list */
- fr_dlist_map_insert_tail(&c->maps, map);
+ map_list_insert_tail(&c->maps, map);
next:
p = q + 1;
* - #RLM_MODULE_FAIL if an error occurred.
*/
static rlm_rcode_t map_proc_client(UNUSED void *mod_inst, UNUSED void *proc_inst, request_t *request,
- fr_value_box_list_t *client_override, fr_map_list_t const *maps)
+ fr_value_box_list_t *client_override, map_list_t const *maps)
{
rlm_rcode_t rcode = RLM_MODULE_OK;
map_t const *map = NULL;
uctx.cs = client->cs;
RINDENT();
- while ((map = fr_dlist_map_next(maps, map))) {
+ while ((map = map_list_next(maps, map))) {
char *field = NULL;
if (tmpl_aexpand(request, &field, request, map->rhs, NULL, NULL) < 0) {
TALLOC_CTX *pool = talloc_pool(request, 1024); /* We need to do lots of allocs */
fr_dcursor_t maps;
map_t *map = NULL;
- fr_map_list_t map_head;
+ map_list_t map_head;
vp_list_mod_t *vlm;
fr_dlist_head_t vlm_head;
- fr_dlist_map_init(&map_head);
+ map_list_init(&map_head);
fr_dcursor_init(&maps, &map_head);
/*
#include <freeradius-devel/server/map_proc.h>
static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_t *request,
- fr_value_box_list_t *key, fr_map_list_t const *maps);
+ fr_value_box_list_t *key, map_list_t const *maps);
/*
* Define a structure for our module configuration.
tmpl_t *key;
fr_type_t key_data_type;
- fr_map_list_t map; //!< if there is an "update" section in the configuration.
+ map_list_t map; //!< if there is an "update" section in the configuration.
} rlm_csv_t;
typedef struct rlm_csv_entry_s rlm_csv_entry_t;
* Verify the result of the map.
*/
static int csv_maps_verify(CONF_SECTION *cs, void *mod_inst, UNUSED void *proc_inst,
- tmpl_t const *src, fr_map_list_t const *maps)
+ tmpl_t const *src, map_list_t const *maps)
{
map_t const *map = NULL;
return -1;
}
- while ((map = fr_dlist_map_next(maps, map))) {
+ while ((map = map_list_next(maps, map))) {
/*
* This function doesn't change the map, so it's OK.
*/
};
char buffer[8192];
- fr_dlist_map_init(&inst->map);
+ map_list_init(&inst->map);
/*
* "update" without "key" is invalid, as we can't run the
* module.
* - #RLM_MODULE_FAIL if an error occurred.
*/
static rlm_rcode_t mod_map_apply(rlm_csv_t const *inst, request_t *request,
- fr_value_box_t const *key, fr_map_list_t const *maps)
+ fr_value_box_t const *key, map_list_t const *maps)
{
rlm_rcode_t rcode = RLM_MODULE_UPDATED;
rlm_csv_entry_t *e;
redo:
RINDENT();
- while ((map = fr_dlist_map_next(maps, map))) {
+ while ((map = map_list_next(maps, map))) {
int field;
char *field_name;
* - #RLM_MODULE_FAIL if an error occurred.
*/
static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_t *request,
- fr_value_box_list_t *key, fr_map_list_t const *maps)
+ fr_value_box_list_t *key, map_list_t const *maps)
{
rlm_csv_t *inst = talloc_get_type_abort(mod_inst, rlm_csv_t);
fr_value_box_t *key_head = fr_dlist_head(key);
ssize_t slen;
fr_value_box_t *key;
- if (fr_dlist_map_empty(&inst->map) || !inst->key) RETURN_MODULE_NOOP;
+ if (map_list_empty(&inst->map) || !inst->key) RETURN_MODULE_NOOP;
/*
* Expand the key to whatever it is. For attributes,
* and probably ':=' for server
* configuration items.
*/
- while ((map = fr_dlist_map_next(&entry->check, map))) {
+ while ((map = map_list_next(&entry->check, map))) {
if (!tmpl_is_attr(map->lhs)) {
ERROR("%s[%d] Left side of check item %s is not an attribute",
entry->filename, entry->lineno, map->lhs->name);
* worth doing.
*/
map = NULL;
- while ((map = fr_dlist_map_next(&entry->reply, map))) {
+ while ((map = map_list_next(&entry->reply, map))) {
if (!tmpl_is_attr(map->lhs)) {
ERROR("%s[%d] Left side of reply item %s is not an attribute",
entry->filename, entry->lineno, map->lhs->name);
/*
* Realize the map to a list of VPs
*/
- while ((map = fr_dlist_map_next(&pl->check, map))) {
+ while ((map = map_list_next(&pl->check, map))) {
fr_pair_list_t tmp_list;
/*
fr_pair_list_free(&list);
/* ctx may be reply */
- if (!fr_dlist_map_empty(&pl->reply)) {
+ if (!map_list_empty(&pl->reply)) {
map = NULL;
- while ((map = fr_dlist_map_next(&pl->reply, map))) {
+ while ((map = map_list_next(&pl->reply, map))) {
fr_pair_list_t tmp_list;
fr_pair_list_init(&tmp_list);
if (map->op == T_OP_CMP_FALSE) continue;
* - -1 on failure.
*/
static int mod_map_proc_instantiate(CONF_SECTION *cs, UNUSED void *mod_inst, void *proc_inst,
- tmpl_t const *src, fr_map_list_t const *maps)
+ tmpl_t const *src, map_list_t const *maps)
{
rlm_json_jpath_cache_t *cache_inst = proc_inst;
map_t const *map = NULL;
return -1;
}
- while ((map = fr_dlist_map_next(maps, map))) {
+ while ((map = map_list_next(maps, map))) {
CONF_PAIR *cp = cf_item_to_pair(map->ci);
char const *p;
* list member was pre-allocated and passed to the
* instantiation callback.
*/
- if (fr_dlist_map_next(maps, map)) {
+ if (map_list_next(maps, map)) {
*tail = cache = talloc_zero(cache, rlm_json_jpath_cache_t);
tail = &cache->next;
}
* - #RLM_MODULE_FAIL if a fault occurred.
*/
static rlm_rcode_t mod_map_proc(UNUSED void *mod_inst, void *proc_inst, request_t *request,
- fr_value_box_list_t *json, fr_map_list_t const *maps)
+ fr_value_box_list_t *json, map_list_t const *maps)
{
rlm_rcode_t rcode = RLM_MODULE_UPDATED;
struct json_tokener *tok;
goto finish;
}
- while ((map = fr_dlist_map_next(maps, map))) {
+ while ((map = map_list_next(maps, map))) {
switch (map->rhs->type) {
/*
* Cached types
* Verify the result of the map.
*/
static int ldap_map_verify(CONF_SECTION *cs, UNUSED void *mod_inst, UNUSED void *proc_inst,
- tmpl_t const *src, UNUSED fr_map_list_t const *maps)
+ tmpl_t const *src, UNUSED map_list_t const *maps)
{
if (!src) {
cf_log_err(cs, "Missing LDAP URI");
* - #RLM_MODULE_FAIL if an error occurred.
*/
static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_t *request,
- fr_value_box_list_t *url, fr_map_list_t const *maps)
+ fr_value_box_list_t *url, map_list_t const *maps)
{
rlm_rcode_t rcode = RLM_MODULE_UPDATED;
rlm_ldap_t *inst = talloc_get_type_abort(mod_inst, rlm_ldap_t);
}
RINDENT();
- for (map = fr_dlist_map_head(maps), i = 0;
+ for (map = map_list_head(maps), i = 0;
map != NULL;
- map = fr_dlist_map_next(maps, map), i++) {
+ map = map_list_next(maps, map), i++) {
int ret;
fr_ldap_result_t attr;
}
}
- if (!fr_dlist_map_empty(&inst->user_map) || inst->valuepair_attr) {
+ if (!map_list_empty(&inst->user_map) || inst->valuepair_attr) {
RDEBUG2("Processing user attributes");
RINDENT();
if (fr_ldap_map_do(request, handle, inst->valuepair_attr,
rlm_ldap_t *inst = talloc_get_type_abort(mctx->inst->data, rlm_ldap_t);
CONF_SECTION *conf = mctx->inst->conf;
- fr_dlist_map_init(&inst->user_map);
+ map_list_init(&inst->user_map);
options = cf_section_find(conf, "options", NULL);
if (!options || !cf_pair_find(options, "chase_referrals")) {
/*
* RADIUS attribute to LDAP attribute maps
*/
- fr_map_list_t user_map; //!< Attribute map applied to users and profiles.
+ map_list_t user_map; //!< Attribute map applied to users and profiles.
/*
* Options
int rcode;
CONF_SECTION *cs;
char const *name2;
- fr_map_list_t *head = (fr_map_list_t *)out;
+ map_list_t *head = (map_list_t *)out;
fr_assert(cf_item_is_section(ci));
- fr_dlist_map_init(head);
+ map_list_init(head);
cs = cf_item_to_section(ci);
name2 = cf_section_name2(cs);
rcode = map_afrom_cs(ctx, head, cs, &parse_rules, &parse_rules, unlang_fixup_update, NULL, 128);
if (rcode < 0) return -1; /* message already printed */
- if (fr_dlist_map_empty(head)) {
+ if (map_list_empty(head)) {
cf_log_err(cs, "'update' sections cannot be empty");
return -1;
}
uint32_t proxy_state; //!< Unique ID (mostly) of this module.
uint32_t *types; //!< array of allowed packet types
uint32_t status_check; //!< code of status-check type
- fr_map_list_t status_check_map; //!< attributes for the status-server checks
+ map_list_t status_check_map; //!< attributes for the status-server checks
uint32_t num_answers_to_alive; //!< How many status check responses we need to
///< mark the connection as alive.
* Create the VPs, and ignore any errors
* creating them.
*/
- while ((map = fr_dlist_map_next(&inst->parent->status_check_map, map))) {
+ while ((map = map_list_next(&inst->parent->status_check_map, map))) {
/*
* Skip things which aren't attributes.
*/
char const *name; //!< Auth-Type value for this module instance.
fr_dict_enum_value_t *auth_type;
- fr_map_list_t header_maps; //!< Attribute map used to process header elements
+ map_list_t header_maps; //!< Attribute map used to process header elements
bool set_date;
} rlm_smtp_t;
* Initialize the sbuff for writing the config elements as header attributes
*/
fr_sbuff_init_talloc(uctx, &conf_buffer, &conf_ctx, 256, SIZE_MAX);
- conf_map = fr_dlist_map_head(&inst->header_maps);
+ conf_map = map_list_head(&inst->header_maps);
/*
* Load in all of the header elements supplied in the config
next:
/* Check if there are more values to parse */
- if (!fr_dlist_map_next(&inst->header_maps, conf_map)) break;
+ if (!map_list_next(&inst->header_maps, conf_map)) break;
/* reinitialize the buffer and move to the next value */
fr_sbuff_init_talloc(uctx, &conf_buffer, &conf_ctx, 256, SIZE_MAX);
- conf_map = fr_dlist_map_next(&inst->header_maps, conf_map);
+ conf_map = map_list_next(&inst->header_maps, conf_map);
}
/* Add the FROM: line */
CONF_SECTION *conf = mctx->inst->conf;
CONF_SECTION *header;
- fr_dlist_map_init(&inst->header_maps);
+ map_list_init(&inst->header_maps);
header = cf_section_find(conf, "header", NULL);
if (!header) return 0;
* Verify the result of the map.
*/
static int sql_map_verify(CONF_SECTION *cs, UNUSED void *mod_inst, UNUSED void *proc_inst,
- tmpl_t const *src, UNUSED fr_map_list_t const *maps)
+ tmpl_t const *src, UNUSED map_list_t const *maps)
{
if (!src) {
cf_log_err(cs, "Missing SQL query");
* - #RLM_MODULE_FAIL if a fault occurred.
*/
static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_t *request,
- fr_value_box_list_t *query, fr_map_list_t const *maps)
+ fr_value_box_list_t *query, map_list_t const *maps)
{
rlm_sql_t *inst = talloc_get_type_abort(mod_inst, rlm_sql_t);
rlm_sql_handle_t *handle = NULL;
* faster than building a radix tree each time the
* map set is evaluated (map->rhs can be dynamic).
*/
- for (map = fr_dlist_map_head(maps), i = 0;
+ for (map = map_list_head(maps), i = 0;
map && (i < MAX_SQL_FIELD_INDEX);
- map = fr_dlist_map_next(maps, map), i++) {
+ map = map_list_next(maps, map), i++) {
/*
* Expand the RHS to get the name of the SQL field
*/
*/
while (((ret = rlm_sql_fetch_row(&row, inst, request, &handle)) == RLM_SQL_OK)) {
rows++;
- for (map = fr_dlist_map_head(maps), j = 0;
+ for (map = map_list_head(maps), j = 0;
map && (j < MAX_SQL_FIELD_INDEX);
- map = fr_dlist_map_next(maps, map), j++) {
+ map = map_list_next(maps, map), j++) {
if (field_index[j] < 0) continue; /* We didn't find the map RHS in the field set */
if (map_to_request(request, map, _sql_map_proc_get_value, row[field_index[j]]) < 0) goto error;
}