case TMPL_TYPE_ATTR:
{
- fr_cursor_t from;
+ fr_dcursor_t from;
tmpl_cursor_ctx_t cc_attr;
fr_pair_t *vp;
fr_value_box_t *n_vb;
goto error;
}
- vp = fr_cursor_current(&from);
+ vp = fr_dcursor_current(&from);
fr_assert(vp); /* Should have errored out */
do {
n_vb = fr_value_box_alloc_null(n->mod->rhs);
fr_value_box_copy(n_vb, n_vb, &vp->data);
}
fr_cursor_append(&values, n_vb);
- } while ((vp = fr_cursor_next(&from)));
+ } while ((vp = fr_dcursor_next(&from)));
tmpl_cursor_clear(&cc_attr);
}
*/
case TMPL_TYPE_EXEC:
{
- fr_cursor_t to, from;
+ fr_cursor_t to;
+ fr_dcursor_t from;
fr_pair_list_t vp_head;
fr_pair_t *vp;
return 0; /* No pairs returned */
}
- (void)fr_cursor_init(&from, &vp_head);
- while ((vp = fr_cursor_remove(&from))) {
+ (void)fr_dcursor_init(&from, &vp_head);
+ while ((vp = fr_dcursor_remove(&from))) {
map_t *mod;
tmpl_rules_t rules;
if (map_afrom_vp(n, &mod, vp, &rules) < 0) {
RPEDEBUG("Failed converting VP to map");
- fr_cursor_head(&from);
- fr_cursor_free_item(&from);
+ fr_dcursor_head(&from);
+ fr_dcursor_free_item(&from);
goto error;
}
if (tmpl_is_exec(mod->lhs) || tmpl_is_exec(mod->rhs)) {
RPEDEBUG("Program output cannot request execution of another program for attribute %s", vp->da->name);
- fr_cursor_head(&from);
- fr_cursor_free_item(&from);
+ fr_dcursor_head(&from);
+ fr_dcursor_free_item(&from);
goto error;
}
if ((vp->op == T_OP_REG_EQ) || (vp->op == T_OP_REG_NE)) {
RPEDEBUG("Program output cannot request regular expression matching for attribute %s", vp->da->name);
- fr_cursor_head(&from);
- fr_cursor_free_item(&from);
+ fr_dcursor_head(&from);
+ fr_dcursor_free_item(&from);
goto error;
}
request_t *context;
TALLOC_CTX *parent;
- fr_cursor_t list;
+ fr_dcursor_t list;
tmpl_cursor_ctx_t cc;
memset(&cc, 0, sizeof(cc));
case T_OP_EQ:
{
bool exists = false;
- fr_cursor_t from, to, to_insert;
+ fr_dcursor_t from, to, to_insert;
fr_pair_list_t vp_from, vp_to_insert;
fr_pair_t *vp, *vp_to = NULL;
vp_from = map_list_mod_to_vps(parent, vlm);
if (fr_pair_list_empty(&vp_from)) goto finish;
- fr_cursor_init(&from, &vp_from);
- fr_cursor_init(&to_insert, &vp_to_insert);
- fr_cursor_init(&to, vp_list);
+ fr_dcursor_init(&from, &vp_from);
+ fr_dcursor_init(&to_insert, &vp_to_insert);
+ fr_dcursor_init(&to, vp_list);
- while ((vp = fr_cursor_remove(&from))) {
- for (vp_to = fr_cursor_head(&to);
+ while ((vp = fr_dcursor_remove(&from))) {
+ for (vp_to = fr_dcursor_head(&to);
vp_to;
- vp_to = fr_cursor_next(&to)) {
+ vp_to = fr_dcursor_next(&to)) {
if (fr_pair_cmp_by_da(vp_to, vp) == 0) exists = true;
}
if (exists) {
talloc_free(vp); /* Don't overwrite */
} else {
- fr_cursor_insert(&to_insert, vp);
+ fr_dcursor_insert(&to_insert, vp);
}
}
- fr_cursor_tail(&to);
- fr_cursor_merge(&to, &to_insert); /* Do this last so we don't expand the 'to' set */
+ fr_dcursor_tail(&to);
+ fr_dcursor_merge(&to, &to_insert); /* Do this last so we don't expand the 'to' set */
}
goto finish;
* The cursor was set to the Nth one. Delete it, and only it.
*/
if (tmpl_num(map->lhs) != NUM_ALL) {
- fr_cursor_free_item(&list);
+ fr_dcursor_free_item(&list);
/*
* Wildcard: delete all of the matching ones
*/
} else {
- fr_cursor_free_list(&list); /* Remember, we're using a custom iterator */
+ fr_dcursor_free_list(&list); /* Remember, we're using a custom iterator */
}
/*
do {
if (fr_value_box_cmp(vb, &found->data) == 0) {
- fr_cursor_free_item(&list);
+ fr_dcursor_free_item(&list);
goto finish;
}
} while ((vb = vb->next));
do {
if (fr_value_box_cmp(vb, &found->data) == 0) {
- fr_cursor_free_item(&list);
+ fr_dcursor_free_item(&list);
break;
}
} while ((vb = vb->next));
- } while ((found = fr_cursor_next(&list)));
+ } while ((found = fr_dcursor_next(&list)));
}
goto finish;
* Instance specific[n] overwrite
*/
if (tmpl_num(map->lhs) != NUM_ALL) {
- fr_cursor_t from;
+ fr_dcursor_t from;
fr_pair_list_t vp_from;
vp_from = map_list_mod_to_vps(parent, vlm);
if (fr_pair_list_empty(&vp_from)) goto finish;
- fr_cursor_init(&from, &vp_from);
+ fr_dcursor_init(&from, &vp_from);
- fr_cursor_merge(&list, &from); /* Merge first (insert after current attribute) */
- fr_cursor_free_item(&list); /* Then free the current attribute */
+ fr_dcursor_merge(&list, &from); /* Merge first (insert after current attribute) */
+ fr_dcursor_free_item(&list); /* Then free the current attribute */
goto finish;
}
/*
* All instances[*] overwrite
*/
- fr_cursor_free_list(&list); /* Remember, we're using a custom iterator */
+ fr_dcursor_free_list(&list); /* Remember, we're using a custom iterator */
goto do_add;
/*
if (fr_value_box_cmp_op(mod->op, &found->data, vb) == 1) remove = false;
} while ((vb = vb->next));
- if (remove) fr_cursor_free_item(&list);
+ if (remove) fr_dcursor_free_item(&list);
goto finish;
}
} while ((vb = vb->next));
if (remove) {
- fr_cursor_free_item(&list);
+ fr_dcursor_free_item(&list);
} else {
- fr_cursor_next(&list);
+ fr_dcursor_next(&list);
}
- } while ((found = fr_cursor_current(&list)));
+ } while ((found = fr_dcursor_current(&list)));
}
goto finish;