break;
case TMPL_TYPE_ATTR_UNPARSED:
- cf_log_err(map->ci, "Unknown attribute %s", tmpl_unknown_name(map->lhs));
+ cf_log_err(map->ci, "Unknown attribute %s", tmpl_attr_unparsed(map->lhs));
return -1;
default:
break;
case TMPL_TYPE_ATTR_UNPARSED:
- cf_log_err(map->ci, "Unknown attribute %s", tmpl_unknown_name(map->rhs));
+ cf_log_err(map->ci, "Unknown attribute %s", tmpl_attr_unparsed(map->rhs));
return -1;
default:
* All attributes should have been defined by this point.
*/
case TMPL_TYPE_ATTR_UNPARSED:
- cf_log_err(cp, "Unknown attribute '%s'", tmpl_unknown_name(vpt));
+ cf_log_err(cp, "Unknown attribute '%s'", tmpl_attr_unparsed(vpt));
talloc_free(vpt); /* Free last (vpt needed for log) */
return -1;
if (map->op == T_OP_REG_EQ) {
cast_type = FR_TYPE_STRING;
- if (tmpl_is_xlat_struct(map->rhs)) escape = regex_escape;
+ if (tmpl_is_xlat(map->rhs)) escape = regex_escape;
}
else
#endif
}
#ifdef HAVE_REGEX
- if (tmpl_is_regex(c->data.map->rhs)) {
+ if (tmpl_is_regex_unparsed(c->data.map->rhs)) {
*error = "Cannot use cast with regex comparison";
return -(rhs - start);
}
* there, too.
*/
if (tmpl_is_attr(c->data.map->lhs) &&
- (tmpl_is_xlat(c->data.map->rhs) ||
- tmpl_is_xlat_struct(c->data.map->rhs) ||
+ (tmpl_is_xlat_unparsed(c->data.map->rhs) ||
+ tmpl_is_xlat(c->data.map->rhs) ||
tmpl_is_exec(c->data.map->rhs))) {
if (tmpl_da(c->data.map->lhs)->type == FR_TYPE_IPV4_ADDR) {
c->cast = fr_dict_attr_child_by_num(fr_dict_root(fr_dict_internal()),
return_P(fr_strerror());
}
- fr_assert(!tmpl_is_regex(c->data.vpt));
+ fr_assert(!tmpl_is_regex_unparsed(c->data.vpt));
if (tmpl_define_unknown_attr(c->data.vpt) < 0) {
p = lhs - tlen;
memset(®ex_flags, 0, sizeof(regex_flags));
- if (!tmpl_is_regex(c->data.map->rhs)) {
+ if (!tmpl_is_regex_unparsed(c->data.map->rhs)) {
return_rhs("Expected regex");
}
fr_assert(tmpl_is_list(original->lhs) ||
tmpl_is_attr(original->lhs) ||
- tmpl_is_xlat_struct(original->lhs));
+ tmpl_is_xlat(original->lhs));
*out = NULL;
slen = -(p - name);
goto error;
}
- tmpl_unknown_name_set(vpt, talloc_strndup(vpt, p, q - p));
+ tmpl_attr_unparsed_set(vpt, talloc_strndup(vpt, p, q - p));
p = q;
goto do_num;
* are identical.
*
* @param[in] dict_def Default dictionary to use if none is
- * specified by the tmpl_unknown_name.
+ * specified by the tmpl_attr_unparsed.
* @param[in] vpt specifying undefined attribute to add.
* ``tmpl_da`` pointer will be updated to
* point to the #fr_dict_attr_t inserted
if (!tmpl_is_attr_unparsed(vpt)) return 1;
- if (fr_dict_attr_add(dict_def, fr_dict_root(fr_dict_internal()), tmpl_unknown_name(vpt), -1, type, flags) < 0) {
+ if (fr_dict_attr_add(dict_def, fr_dict_root(fr_dict_internal()), tmpl_attr_unparsed(vpt), -1, type, flags) < 0) {
return -1;
}
- da = fr_dict_attr_by_name(dict_def, tmpl_unknown_name(vpt));
+ da = fr_dict_attr_by_name(dict_def, tmpl_attr_unparsed(vpt));
if (!da) return -1;
if (type != da->type) {
goto inst_and_tag;
case TMPL_TYPE_ATTR_UNPARSED:
- p = tmpl_unknown_name(vpt);
+ p = tmpl_attr_unparsed(vpt);
goto print_name;
case TMPL_TYPE_ATTR:
{
fr_assert(vpt);
- if (tmpl_is_unknown(vpt)) {
+ if (tmpl_is_uninitialised(vpt)) {
fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: vp_tmpl_t type was "
"TMPL_TYPE_UNINITIALISED (uninitialised)", file, line);
}
/** Helpers to verify the type of #vp_tmpl_t
*/
-#define tmpl_is_unknown(vpt) (vpt->type == TMPL_TYPE_UNINITIALISED)
-#define tmpl_is_unparsed(vpt) (vpt->type == TMPL_TYPE_UNPARSED)
-#define tmpl_is_xlat(vpt) (vpt->type == TMPL_TYPE_XLAT_UNPARSED)
+#define tmpl_is_uninitialised(vpt) (vpt->type == TMPL_TYPE_UNINITIALISED)
+
+#define tmpl_is_null(vpt) (vpt->type == TMPL_TYPE_NULL)
+#define tmpl_is_data(vpt) (vpt->type == TMPL_TYPE_DATA)
+
#define tmpl_is_attr(vpt) (vpt->type == TMPL_TYPE_ATTR)
-#define tmpl_is_attr_unparsed(vpt) (vpt->type == TMPL_TYPE_ATTR_UNPARSED)
#define tmpl_is_list(vpt) (vpt->type == TMPL_TYPE_LIST)
-#define tmpl_is_regex(vpt) (vpt->type == TMPL_TYPE_REGEX_UNPARSED)
+
+#define tmpl_is_xlat(vpt) (vpt->type == TMPL_TYPE_XLAT)
#define tmpl_is_exec(vpt) (vpt->type == TMPL_TYPE_EXEC)
-#define tmpl_is_data(vpt) (vpt->type == TMPL_TYPE_DATA)
-#define tmpl_is_xlat_struct(vpt) (vpt->type == TMPL_TYPE_XLAT)
-#define tmpl_is_regex_struct(vpt) (vpt->type == TMPL_TYPE_REGEX)
-#define tmpl_is_null(vpt) (vpt->type == TMPL_TYPE_NULL)
+
+#define tmpl_is_regex(vpt) (vpt->type == TMPL_TYPE_REGEX)
+
+#define tmpl_is_unparsed(vpt) (vpt->type == TMPL_TYPE_UNPARSED)
+#define tmpl_is_attr_unparsed(vpt) (vpt->type == TMPL_TYPE_ATTR_UNPARSED)
+#define tmpl_is_xlat_unparsed(vpt) (vpt->type == TMPL_TYPE_XLAT_UNPARSED)
+#define tmpl_is_regex_unparsed(vpt) (vpt->type == TMPL_TYPE_REGEX_UNPARSED)
extern fr_table_num_sorted_t const tmpl_type_table[];
extern size_t tmpl_type_table_len;
#define tmpl_list(_tmpl) (_tmpl)->data.attribute.list
#define tmpl_da(_tmpl) (_tmpl)->data.attribute.da
#define tmpl_unknown(_tmpl) (_tmpl)->data.attribute.unknown.da
-#define tmpl_unknown_name(_tmpl) (_tmpl)->data.attribute.unknown.name
+#define tmpl_attr_unparsed(_tmpl) (_tmpl)->data.attribute.unknown.name
#define tmpl_num(_tmpl) (_tmpl)->data.attribute.num
#define tmpl_tag(_tmpl) (_tmpl)->data.attribute.tag
*/
#define tmpl_request_set(_tmpl, _request) (_tmpl)->data.attribute.request = (_request)
#define tmpl_list_set(_tmpl, _list) (_tmpl)->data.attribute.list = (_list)
-#define tmpl_unknown_name_set(_tmpl, _name) (_tmpl)->data.attribute.unknown.name = (_name)
+#define tmpl_attr_unparsed_set(_tmpl, _name) (_tmpl)->data.attribute.unknown.name = (_name)
#define tmpl_tag_set(_tmpl, _tag) (_tmpl)->data.attribute.tag = (_tag)
#define tmpl_num_set(_tmpl, _num) (_tmpl)->data.attribute.num = (_num)
#define tmpl_da_set(_tmpl, _da) (_tmpl)->data.attribute.da = (_da)
vpt = *pvpt;
- fr_assert(tmpl_is_xlat(vpt));
+ fr_assert(tmpl_is_xlat_unparsed(vpt));
slen = xlat_tokenize(vpt, &head, vpt->name, talloc_array_length(vpt->name) - 1, rules);
ssize_t slen;
regex_t *preg;
- fr_assert(tmpl_is_regex(vpt));
+ fr_assert(tmpl_is_regex_unparsed(vpt));
/*
* It's a dynamic expansion. We can't expand the string,
{
vp_tmpl_t *vpt = *pvpt;
- if (tmpl_is_xlat(vpt)) {
+ if (tmpl_is_xlat_unparsed(vpt)) {
return pass2_fixup_xlat(ci, pvpt, convert, NULL, rules);
}
/*
* Precompile xlat's
*/
- if (tmpl_is_xlat(map->lhs)) {
+ if (tmpl_is_xlat_unparsed(map->lhs)) {
/*
* Compile the LHS to an attribute reference only
* if the RHS is a literal.
}
}
- if (tmpl_is_xlat(map->rhs)) {
+ if (tmpl_is_xlat_unparsed(map->rhs)) {
/*
* Convert the RHS to an attribute reference only
* if the LHS is an attribute reference, AND is
}
#ifdef HAVE_REGEX
- if (tmpl_is_regex(map->rhs)) {
+ if (tmpl_is_regex_unparsed(map->rhs)) {
if (!pass2_fixup_regex(map->ci, map->rhs, rules)) {
return false;
}
}
- fr_assert(!tmpl_is_regex(map->lhs));
+ fr_assert(!tmpl_is_regex_unparsed(map->lhs));
#endif
/*
if (!paircmp_find(tmpl_da(map->lhs))) return true;
- if (tmpl_is_regex(map->rhs)) {
+ if (tmpl_is_regex_unparsed(map->rhs)) {
cf_log_err(map->ci, "Cannot compare virtual attribute %s via a regex", map->lhs->name);
return false;
}
* Fix up the template.
*/
case COND_TYPE_EXISTS:
- fr_assert(!tmpl_is_regex(c->data.vpt));
+ fr_assert(!tmpl_is_regex_unparsed(c->data.vpt));
return pass2_fixup_tmpl(c->ci, &c->data.vpt, unlang_ctx->rules, true);
/*
static bool pass2_fixup_update_map(vp_map_t *map, vp_tmpl_rules_t const *rules, fr_dict_attr_t const *parent)
{
- if (tmpl_is_xlat(map->lhs)) {
+ if (tmpl_is_xlat_unparsed(map->lhs)) {
fr_assert(tmpl_xlat(map->lhs) == NULL);
/*
}
if (map->rhs) {
- if (tmpl_is_xlat(map->rhs)) {
+ if (tmpl_is_xlat_unparsed(map->rhs)) {
fr_assert(tmpl_xlat(map->rhs) == NULL);
/*
}
}
- fr_assert(!tmpl_is_regex(map->rhs));
+ fr_assert(!tmpl_is_regex_unparsed(map->rhs));
if (tmpl_is_attr_unparsed(map->rhs)) {
if (!pass2_fixup_undefined(map->ci, map->rhs, rules)) return false;
* Compile and sanity check xlat
* expansions.
*/
- if (tmpl_is_xlat(vpt)) {
+ if (tmpl_is_xlat_unparsed(vpt)) {
fr_dict_attr_t const *da = NULL;
if (tmpl_is_attr(f->vpt)) da = tmpl_da(f->vpt);
* is evaluated once instead of for each 'case'
* statement.
*/
- if (tmpl_is_xlat_struct(g->vpt) ||
- tmpl_is_xlat(g->vpt) ||
+ if (tmpl_is_xlat(g->vpt) ||
+ tmpl_is_xlat_unparsed(g->vpt) ||
tmpl_is_exec(g->vpt)) {
char *p;
ssize_t len;
/*
* Use the pre-expanded string.
*/
- } else if (tmpl_is_xlat_struct(g->vpt) ||
- tmpl_is_xlat(g->vpt) ||
+ } else if (tmpl_is_xlat(g->vpt) ||
+ tmpl_is_xlat_unparsed(g->vpt) ||
tmpl_is_exec(g->vpt)) {
map.rhs = h->vpt;
map.lhs = &vpt;
break;
case TMPL_TYPE_ATTR_UNPARSED:
- cf_log_err(map->ci, "Unknown attribute %s", tmpl_unknown_name(map->lhs));
+ cf_log_err(map->ci, "Unknown attribute %s", tmpl_attr_unparsed(map->lhs));
return -1;
default:
break;
case TMPL_TYPE_ATTR_UNPARSED:
- cf_log_err(map->ci, "Unknown attribute %s", tmpl_unknown_name(map->rhs));
+ cf_log_err(map->ci, "Unknown attribute %s", tmpl_attr_unparsed(map->rhs));
return -1;
default: