if (!map->lhs) goto oom;
tmpl_attr_set_leaf_da(map->lhs, vp->da);
- tmpl_attr_set_leaf_num(map->lhs, NUM_ANY);
+ tmpl_attr_set_leaf_num(map->lhs, NUM_UNSPEC);
tmpl_attr_set_request_ref(map->lhs, rules->attr.request_def);
tmpl_attr_set_list(map->lhs, rules->attr.list_def);
/*
* Wildcard: delete all of the matching ones
*/
- if (tmpl_num(map->lhs) == NUM_ANY) {
+ if (tmpl_num(map->lhs) == NUM_UNSPEC) {
fr_pair_delete_by_child_num(list, tmpl_da(map->lhs)->parent, tmpl_da(map->lhs)->attr);
dst = NULL;
/*
* This operation has two modes:
* - If tmpl_num(map->lhs) > 0, we check each of the src_list attributes against
* the dst attribute, to see if any of their values match.
- * - If tmpl_num(map->lhs) == NUM_ANY, we compare all instances of the dst attribute
+ * - If tmpl_num(map->lhs) == NUM_UNSPEC, we compare all instances of the dst attribute
* against each of the src_list attributes.
*/
case T_OP_SUB_EQ:
/*
* Instance specific[n] delete
*/
- if (tmpl_num(map->lhs) != NUM_ANY) {
+ if (tmpl_num(map->lhs) != NUM_UNSPEC) {
for (vp = fr_pair_list_head(&src_list);
vp;
vp = fr_pair_list_next(&src_list, vp)) {
*/
tmpl_attr_copy(vpt, map->rhs);
tmpl_attr_set_leaf_da(vpt, vp->da);
- tmpl_attr_set_leaf_num(vpt, NUM_ANY);
+ tmpl_attr_set_leaf_num(vpt, NUM_UNSPEC);
/*
* Not appropriate to use map->rhs->quote here, as that's the quoting
* This operation has two modes:
* - If tmpl_num(map->lhs) > 0, we check each of the src_list attributes against
* the found attribute, to see if any of their values match.
- * - If tmpl_num(map->lhs) == NUM_ANY, we compare all instances of the found attribute
+ * - If tmpl_num(map->lhs) == NUM_UNSPEC, we compare all instances of the found attribute
* against each of the src_list attributes.
*/
case T_OP_SUB_EQ:
#define tmpl_attr_is_unresolved(_ar) (_ar->ar_type == TMPL_ATTR_TYPE_UNRESOLVED)
-#define NUM_ANY INT16_MIN
+#define NUM_UNSPEC INT16_MIN
#define NUM_ALL (INT16_MIN + 1)
#define NUM_COUNT (INT16_MIN + 2)
#define NUM_LAST (INT16_MIN + 3)
/*
* Get the first instance
*/
- case NUM_ANY:
+ case NUM_UNSPEC:
vp = ns->func(list_head, curr, ns);
_tmpl_cursor_common_pop(cc);
break;
static fr_table_num_sorted_t const attr_num_table[] = {
{ L("*"), NUM_ALL },
{ L("#"), NUM_COUNT },
- { L("any"), NUM_ANY },
+ { L("u"), NUM_UNSPEC },
{ L("n"), NUM_LAST }
};
static size_t attr_num_table_len = NUM_ELEMENTS(attr_num_table);
FR_FAULT_LOG("\t[%u] %s null%s%s%s",
i,
fr_table_str_by_value(attr_table, ar->type, "<INVALID>"),
- ar->num != NUM_ANY ? "[" : "",
- ar->num != NUM_ANY ? fr_table_str_by_value(attr_num_table, ar->num, buffer) : "",
- ar->num != NUM_ANY ? "]" : "");
+ ar->num != NUM_UNSPEC ? "[" : "",
+ ar->num != NUM_UNSPEC ? fr_table_str_by_value(attr_num_table, ar->num, buffer) : "",
+ ar->num != NUM_UNSPEC ? "]" : "");
return;
}
fr_table_str_by_value(attr_table, ar->type, "<INVALID>"),
fr_type_to_str(ar->da->type),
ar->da->name,
- ar->num != NUM_ANY ? "[" : "",
- ar->num != NUM_ANY ? fr_table_str_by_value(attr_num_table, ar->num, buffer) : "",
- ar->num != NUM_ANY ? "]" : "",
+ ar->num != NUM_UNSPEC ? "[" : "",
+ ar->num != NUM_UNSPEC ? fr_table_str_by_value(attr_num_table, ar->num, buffer) : "",
+ ar->num != NUM_UNSPEC ? "]" : "",
ar->da,
ar->da->attr
);
i,
fr_table_str_by_value(attr_table, ar->type, "<INVALID>"),
ar->ar_unresolved,
- ar->num != NUM_ANY ? "[" : "",
- ar->num != NUM_ANY ? fr_table_str_by_value(attr_num_table, ar->num, buffer) : "",
- ar->num != NUM_ANY ? "]" : "");
+ ar->num != NUM_UNSPEC ? "[" : "",
+ ar->num != NUM_UNSPEC ? fr_table_str_by_value(attr_num_table, ar->num, buffer) : "",
+ ar->num != NUM_UNSPEC ? "]" : "");
if (ar->ar_parent) FR_FAULT_LOG("\t parent : %s", ar->ar_parent->name);
if (ar->ar_unresolved_namespace) FR_FAULT_LOG("\t namespace : %s", ar->ar_unresolved_namespace->name);
break;
MEM(ar = talloc(ctx, tmpl_attr_t));
*ar = (tmpl_attr_t){
.type = type,
- .num = NUM_ANY
+ .num = NUM_UNSPEC
};
tmpl_attr_list_insert_tail(&vpt->data.attribute.ar, ar);
switch (ar->num) {
case 0:
- case NUM_ANY:
+ case NUM_UNSPEC:
break;
default:
}
*ar = (tmpl_attr_t){
- .ar_num = NUM_ANY,
+ .ar_num = NUM_UNSPEC,
.ar_type = TMPL_ATTR_TYPE_UNRESOLVED,
.ar_unresolved = unresolved,
.ar_unresolved_namespace = namespace,
if (da) {
MEM(ar = talloc(ctx, tmpl_attr_t));
*ar = (tmpl_attr_t){
- .ar_num = NUM_ANY,
+ .ar_num = NUM_UNSPEC,
.ar_type = TMPL_ATTR_TYPE_NORMAL,
.ar_da = da,
.ar_parent = our_parent
*/
MEM(ar = talloc(ctx, tmpl_attr_t));
*ar = (tmpl_attr_t){
- .ar_num = NUM_ANY,
+ .ar_num = NUM_UNSPEC,
.ar_type = TMPL_ATTR_TYPE_NORMAL,
.ar_da = da,
.ar_parent = our_parent,
da_unknown->flags.internal = 1;
*ar = (tmpl_attr_t){
- .ar_num = NUM_ANY,
+ .ar_num = NUM_UNSPEC,
.ar_type = TMPL_ATTR_TYPE_UNKNOWN,
.ar_unknown = da_unknown,
.ar_da = da_unknown,
* be removed.
*/
prev = tmpl_attr_list_prev(&vpt->data.attribute.ar, ar);
- if (prev && (prev->ar_da->type != FR_TYPE_GROUP) && (prev->ar_num == NUM_ANY)) {
+ if (prev && (prev->ar_da->type != FR_TYPE_GROUP) && (prev->ar_num == NUM_UNSPEC)) {
tmpl_attr_list_remove(&vpt->data.attribute.ar, prev);
ar->ar_parent = prev->ar_parent;
talloc_free(prev);
* Will later be complex filters.
*/
switch (ar->ar_num) {
- case NUM_ANY:
+ case NUM_UNSPEC:
break;
case NUM_ALL:
}
/*
- * Fixup LHS attribute references to change NUM_ANY to NUM_ALL.
+ * Fixup LHS attribute references to change NUM_UNSPEC to NUM_ALL.
*/
switch (map->lhs->type) {
case TMPL_TYPE_ATTR:
case TMPL_TYPE_LIST:
- tmpl_attr_rewrite_leaf_num(map->lhs, NUM_ANY, NUM_ALL);
+ tmpl_attr_rewrite_leaf_num(map->lhs, NUM_UNSPEC, NUM_ALL);
break;
default:
}
/*
- * Fixup RHS attribute references to change NUM_ANY to NUM_ALL.
+ * Fixup RHS attribute references to change NUM_UNSPEC to NUM_ALL.
*/
switch (map->rhs->type) {
case TMPL_TYPE_ATTR:
case TMPL_TYPE_LIST:
- tmpl_attr_rewrite_leaf_num(map->rhs, NUM_ANY, NUM_ALL);
+ tmpl_attr_rewrite_leaf_num(map->rhs, NUM_UNSPEC, NUM_ALL);
break;
default:
}
/*
- * Fixup LHS attribute references to change NUM_ANY to NUM_ALL.
+ * Fixup LHS attribute references to change NUM_UNSPEC to NUM_ALL.
*/
- if (tmpl_is_attr(map->lhs)) tmpl_attr_rewrite_leaf_num(map->lhs, NUM_ANY, NUM_ALL);
+ if (tmpl_is_attr(map->lhs)) tmpl_attr_rewrite_leaf_num(map->lhs, NUM_UNSPEC, NUM_ALL);
/*
- * Fixup RHS attribute references to change NUM_ANY to NUM_ALL.
+ * Fixup RHS attribute references to change NUM_UNSPEC to NUM_ALL.
*/
- if (tmpl_is_attr(map->rhs)) tmpl_attr_rewrite_leaf_num(map->rhs, NUM_ANY, NUM_ALL);
+ if (tmpl_is_attr(map->rhs)) tmpl_attr_rewrite_leaf_num(map->rhs, NUM_UNSPEC, NUM_ALL);
/*
* Values used by unary operators should be literal ANY
return NULL;
}
- if ((tmpl_num(vpt) != NUM_ALL) && (tmpl_num(vpt) != NUM_ANY)) {
+ if ((tmpl_num(vpt) != NUM_ALL) && (tmpl_num(vpt) != NUM_UNSPEC)) {
cf_log_err(cs, "MUST NOT use instance selectors in 'foreach'");
talloc_free(vpt);
return NULL;
* the attribute. In a perfect consistent world, users would do
* foreach &attr[*], but that's taking the consistency thing a bit far.
*/
- tmpl_attr_rewrite_leaf_num(vpt, NUM_ANY, NUM_ALL);
+ tmpl_attr_rewrite_leaf_num(vpt, NUM_UNSPEC, NUM_ALL);
c = compile_section(parent, unlang_ctx, cs, &foreach_ext);
if (!c) {
if (tmpl_is_attr(node->vpt)) {
fr_assert(!node->flags.pure);
INFO_INDENT("attribute (%s)", tmpl_da(node->vpt)->name);
- if (tmpl_num(node->vpt) != NUM_ANY) {
+ if (tmpl_num(node->vpt) != NUM_UNSPEC) {
FR_DLIST_HEAD(tmpl_request_list) const *list;
tmpl_request_t *rr = NULL;
INFO_INDENT("ref %d", rr->request);
}
INFO_INDENT("list %d", tmpl_list(node->vpt));
- if (tmpl_num(node->vpt) != NUM_ANY) {
+ if (tmpl_num(node->vpt) != NUM_UNSPEC) {
if (tmpl_num(node->vpt) == NUM_COUNT) {
INFO_INDENT("[#]");
} else if (tmpl_num(node->vpt) == NUM_ALL) {