496 if (!a || !tmpl_request_list_initialised(a) || tmpl_request_list_empty(a)) a = &tmpl_request_def_current;
497 if (!b || !tmpl_request_list_initialised(b) || tmpl_request_list_empty(b)) b = &tmpl_request_def_current;
502 if (a == b)
return 0;
505 a_rr = tmpl_request_list_next(a, a_rr);
506 b_rr = tmpl_request_list_next(b, b_rr);
508 if (!a_rr || !b_rr)
return CMP(tmpl_request_list_num_elements(a), tmpl_request_list_num_elements(b));
530 fr_sbuff_parse_rules_t
const *p_rules,
539 unsigned int depth = 0;
545 at_rules = &default_rules.attr;
547 at_rules = &t_rules->
attr;
558 if (at_rules->namespace) {
559 *
namespace = at_rules->namespace;
570 if (!tmpl_request_list_initialised(
out)) tmpl_request_list_talloc_init(
out);
572 fr_sbuff_marker(&m, &our_in);
592 if ((
depth == 0) && at_rules->request_def) {
613 tmpl_request_list_talloc_free_to_tail(
out, tail);
621 if (
namespace && t_rules && t_rules->
parent) {
622 t_rules = t_rules->
parent;
630 if (t_rules->
attr.namespace) {
631 *
namespace = t_rules->attr.namespace;
651 tmpl_request_list_insert_tail(
out, rr);
1043 if (tmpl_attr_list_num_elements(
tmpl_attr(dst)) > 0) tmpl_attr_list_talloc_reverse_free(
tmpl_attr(dst));
1045 while ((src_ar = tmpl_attr_list_next(
tmpl_attr(src), src_ar))) {
1048 switch (src_ar->
type) {
1050 dst_ar->ar_da = src_ar->ar_da;
1061 dst_ar->ar_unresolved =
talloc_bstrdup(dst_ar, src_ar->ar_unresolved);
1067 dst_ar->ar_num = src_ar->ar_num;
1068 dst_ar->ar_filter_type = src_ar->ar_filter_type;
1076 tmpl_request_list_talloc_reverse_free(&dst->data.attribute.rr);
1346 fr_sbuff_set_to_start(&our_name);
1354 fr_sbuff_next(&our_name);
1359 fr_sbuff_next(&our_name);
1383 if ((ar->ar_num > 1000) || (ar->ar_num < 0)) {
1384 fr_strerror_printf(
"Invalid array index '%hi' (should be between 0-1000)", ar->ar_num);
1413 fr_sbuff_parse_rules_t p_rules;
1450 t_rules.
attr = *at_rules;
1451 t_rules.
attr.namespace = ar->ar_da;
1453 p_rules = (fr_sbuff_parse_rules_t) {
1454 .terminals = &filter_terminals,
1462 if (slen < 0)
goto error;
1476 fr_sbuff_parse_rules_t p_rules;
1479 if (!fr_sbuff_is_str(&our_name,
"%{", 2)) {
1486 t_rules.
attr = *at_rules;
1488 p_rules = (fr_sbuff_parse_rules_t) {
1489 .terminals = &filter_terminals,
1497 if (slen < 0)
goto error;
1500 fr_strerror_const(
"Expression in attribute index cannot depend on functions which call external databases");
1516 if (fr_sbuff_is_str(&our_name,
"n]", 2)) {
1518 fr_sbuff_next(&our_name);
1529 fr_sbuff_parse_rules_t p_rules;
1534 t_rules.
attr = *at_rules;
1541 p_rules = (fr_sbuff_parse_rules_t) {
1542 .terminals = &filter_terminals,
1552 if (slen <= 0)
goto error;
1776 fr_sbuff_marker(&m_s,
name);
1783 fr_sbuff_marker_release(&m_s);
1811 name, p_rules ? p_rules->terminals : NULL,
1822 our_parent = da->parent;
1824 if (!our_parent->flags.is_root) {
1845 p_rules ? p_rules->terminals : NULL);
1856 ar = tmpl_attr_list_tail(&
vpt->data.attribute.ar);
1863 p_rules ? p_rules->terminals : NULL);
1866 our_parent = internal_root;
1876 if (!da->flags.local && namespace->flags.local)
namespace = our_parent =
fr_dict_root(da->dict);
1882 if (da->parent != our_parent) {
1895 if (our_parent->flags.is_unknown)
break;
1926 our_parent =
namespace =
fr_dict_root(at_rules->dict_def);
1942 namespace = fr_dict_unlocal(namespace);
1954 if (da)
goto alloc_ar;
1973 switch (namespace->type) {
1994 .ar_parent = our_parent,
2013 fr_sbuff_marker_release(&m_s);
2034 .ar_parent = our_parent,
2056 if (da->flags.local && (ar->ar_num > 0)) {
2068 fr_sbuff_marker_release(&m_s);
2069 fr_sbuff_marker(&m_s,
name);
2098 our_parent =
namespace = ref;
2101 our_parent =
namespace =
parent;
2104 our_parent =
namespace =
fr_dict_root(at_rules->dict_def);
2107 our_parent =
namespace = NULL;
2119 namespace = our_parent = da;
2130 "\"struct\", \"tlv\", \"vendor\", \"vsa\" or \"group\", got \"%s\"",
2141 tmpl_attr_list_talloc_free_tail(&
vpt->data.attribute.ar);
2166 fr_sbuff_marker_release(&m_s);
2213 fr_sbuff_parse_rules_t
const *p_rules,
2219 bool is_raw =
false;
2225 if (!t_rules) t_rules = &default_rules;
2226 at_rules = &t_rules->
attr;
2239 switch (at_rules->
prefix) {
2286 &
vpt->data.attribute.rr,
2298 fr_sbuff_marker(&m_l, &our_name);
2305 namespace,
namespace,
2306 &our_name, p_rules, at_rules, 0);
2307 if (ret < 0)
goto error;
2325 bool is_local = ar->ar_da->flags.local;
2329 if (!ar->ar_da->flags.local ||
2330 (ar->ar_da->flags.local && is_local))
continue;
2404 vpt->rules = *t_rules;
2413 if (t_rules->
attr.request_def) {
2453 fr_sbuff_set_to_start(&our_name);
2662 fr_sbuff_parse_rules_t
const *p_rules)
3179 fr_sbuff_parse_rules_t
const *p_rules,
3191 if (!t_rules) t_rules = &default_rules;
3232 t_rules,
true, p_rules);
3243 my_t_rules.
cast = my_t_rules.
enumv->type;
3264 if (slen > 0)
goto done_bareword;
3275 if (slen > 0)
goto done_bareword;
3282 if (slen > 0)
goto done_bareword;
3289 if (slen > 0)
goto done_bareword;
3293 if (slen > 0)
goto done_bareword;
3300 if (slen > 0)
goto done_bareword;
3307 if (slen > 0)
goto done_bareword;
3318 if (slen > 0)
goto done_bareword;
3326 if (slen > 0)
goto done_bareword;
3348 "'quoted literal', \"%{expansion}\", or enum value");
3366 vpt->data.unescaped = str;
3381 slen = fr_sbuff_out_aunescape_until(
vpt, &str, &our_in, SIZE_MAX,
3382 p_rules ? p_rules->terminals : NULL,
3383 p_rules ? p_rules->escapes : NULL);
3385 vpt->data.unescaped = str;
3409 t_rules,
false, p_rules);
3422 vpt->data.unescaped = str;
3454 if ((slen <= 0) || !
head) {
3482 fr_sbuff_set_to_start(&our_in);
3504 vpt->data.unescaped = str;
3979 dict_def =
vpt->rules.attr.dict_def;
3995 talloc_array_length(ar->ar_unresolved) - 1),
3998 vpt->rules.attr.allow_foreign);
4018 next->ar_parent = da;
4019 next->ar_unresolved_namespace = da;
4026 while ((ar = tmpl_attr_list_next(
tmpl_attr(
vpt), ar))) {
4050 talloc_array_length(ar->ar_unresolved) - 1),
4067 talloc_array_length(ar->ar_unresolved) - 1),
4083 fr_assert(ar->ar_parent && !ar->ar_parent->flags.is_unknown);
4091 next->ar_parent = da;
4092 next->ar_unresolved_namespace = da;
4105 ar->ar_parent = prev->ar_parent;
4637 switch (
vpt->type) {
4661 if (slen < 0)
return slen;
4678 while ((ar = tmpl_attr_list_next(
tmpl_attr(
vpt), ar))) {
4696 depth = ar->ar_parent->depth - 1;
4701 depth = ar->ar_parent->depth;
4722 for (i =
depth; (
unsigned int)i < ar->
ar_da->depth; i++) {
4740 unsigned int i,
depth;
4747 if (ar->ar_parent && !ar->ar_parent->flags.is_root) {
4749 if (ar->ar_parent->flags.is_root) {
4752 depth = ar->ar_parent->depth - 1;
4755 for (i =
depth; i < ar->ar_parent->depth; i++) {
4772 switch (ar->ar_num) {
4795 (void)
xlat_print(&our_out, ar->ar_cond, NULL);