} while (0)
typedef struct {
- fr_value_box_list_t result; //!< result of expansion
+ fr_value_box_list_t list; //!< output data
tmpl_t const *vpt; //!< expanded tmpl
tmpl_t *to_free; //!< tmpl to free.
bool create; //!< whether we need to create the VP
- unlang_result_t success; //!< did the xlat succeed?
+ unlang_result_t result; //!< result of the xlat expansion
fr_pair_t *vp; //!< VP referenced by tmpl.
fr_pair_t *vp_parent; //!< parent of the current VP
fr_pair_list_t pair_list; //!< for structural attributes
static int tmpl_attr_from_result(TALLOC_CTX *ctx, map_t const *map, edit_result_t *out, request_t *request)
{
ssize_t slen;
- fr_value_box_t *box = fr_value_box_list_head(&out->result);
+ fr_value_box_t *box = fr_value_box_list_head(&out->list);
if (!box) {
RWDEBUG("%s %s ... - Assignment failed - No value on right-hand side", map->lhs->name, fr_tokens[map->op]);
/*
* Mash all of the results together.
*/
- if (fr_value_box_list_concat_in_place(box, box, &out->result, FR_TYPE_STRING, FR_VALUE_BOX_LIST_FREE, true, SIZE_MAX) < 0) {
+ if (fr_value_box_list_concat_in_place(box, box, &out->list, FR_TYPE_STRING, FR_VALUE_BOX_LIST_FREE, true, SIZE_MAX) < 0) {
RWDEBUG("Failed converting result to string");
return -1;
}
}
out->vpt = out->to_free;
- fr_value_box_list_talloc_free(&out->result);
+ fr_value_box_list_talloc_free(&out->list);
return 0;
}
return 0;
case TMPL_TYPE_EXEC:
- if (unlang_tmpl_push(ctx, &out->success, &out->result, request, vpt, NULL) < 0) return -1;
+ if (unlang_tmpl_push(ctx, &out->result, &out->list, request, vpt, NULL) < 0) return -1;
return 1;
case TMPL_TYPE_XLAT:
- if (unlang_xlat_push(ctx, &out->success, &out->result, request, tmpl_xlat(vpt), false) < 0) return -1;
+ if (unlang_xlat_push(ctx, &out->result, &out->list, request, tmpl_xlat(vpt), false) < 0) return -1;
return 1;
default:
}
} else {
- box = fr_value_box_list_head(¤t->rhs.result);
+ box = fr_value_box_list_head(¤t->rhs.list);
/*
* Can't concatenate empty results.
/*
* Mash all of the results together.
*/
- if (fr_value_box_list_concat_in_place(box, box, ¤t->rhs.result, FR_TYPE_STRING, FR_VALUE_BOX_LIST_FREE, true, SIZE_MAX) < 0) {
+ if (fr_value_box_list_concat_in_place(box, box, ¤t->rhs.list, FR_TYPE_STRING, FR_VALUE_BOX_LIST_FREE, true, SIZE_MAX) < 0) {
RWDEBUG("Failed converting result to string");
return -1;
}
*
* @todo - we should really push the quote into the xlat, too.
*/
- box = fr_value_box_list_head(¤t->rhs.result);
+ box = fr_value_box_list_head(¤t->rhs.list);
if (!box) {
MEM(box = fr_value_box_alloc(state, FR_TYPE_STRING, NULL));
fr_value_box_strdup(box, box, NULL, "", false);
- fr_value_box_list_insert_tail(¤t->rhs.result, box);
+ fr_value_box_list_insert_tail(¤t->rhs.list, box);
- } else if (fr_value_box_list_concat_in_place(box, box, ¤t->rhs.result, FR_TYPE_STRING,
+ } else if (fr_value_box_list_concat_in_place(box, box, ¤t->rhs.list, FR_TYPE_STRING,
FR_VALUE_BOX_LIST_FREE_BOX, true, 8192) < 0) {
RWDEBUG("Failed converting result to string");
return -1;
}
- box = fr_value_box_list_head(¤t->rhs.result);
+ box = fr_value_box_list_head(¤t->rhs.list);
single = true;
} else {
rhs_list:
- if (fr_value_box_list_num_elements(¤t->rhs.result) == 1) {
- box = fr_value_box_list_head(¤t->rhs.result);
+ if (fr_value_box_list_num_elements(¤t->rhs.list) == 1) {
+ box = fr_value_box_list_head(¤t->rhs.list);
single = true;
} else {
- box = fr_dcursor_init(&cursor, fr_value_box_list_dlist_head(¤t->rhs.result));
+ box = fr_dcursor_init(&cursor, fr_value_box_list_dlist_head(¤t->rhs.list));
}
}
} else {
done:
if (pair) tmpl_dcursor_clear(&cc);
- fr_value_box_list_talloc_free(¤t->rhs.result);
+ fr_value_box_list_talloc_free(¤t->rhs.list);
return 0;
}
{
map_t const *map = current->map;
- if (current->rhs.success.rcode == RLM_MODULE_FAIL) {
+ if (current->rhs.result.rcode == RLM_MODULE_FAIL) {
if (map->rhs) {
RDEBUG("Failed expanding ... %s", map->rhs->name);
} else {
memset(&child->rhs, 0, sizeof(child->rhs));
fr_pair_list_init(&child->rhs.pair_list);
- fr_value_box_list_init(&child->lhs.result);
- fr_value_box_list_init(&child->rhs.result);
+ fr_value_box_list_init(&child->lhs.list);
+ fr_value_box_list_init(&child->rhs.list);
/*
* Continue back with the RHS when we're done processing the
MEM(box = fr_value_box_alloc_null(state));
if (fr_value_box_copy(box, box, tmpl_value(vpt)) < 0) return -1;
- fr_value_box_list_insert_tail(¤t->parent->rhs.result, box);
+ fr_value_box_list_insert_tail(¤t->parent->rhs.list, box);
return next_map(request, state, current);
}
MEM(box = fr_value_box_alloc_null(state));
if (fr_value_box_copy(box, box, &vp->data) < 0) return -1;
- fr_value_box_list_insert_tail(¤t->parent->rhs.result, box);
+ fr_value_box_list_insert_tail(¤t->parent->rhs.list, box);
vp = fr_dcursor_next(&cursor);
}
{
fr_dict_attr_t const *da;
fr_type_t type;
- fr_value_box_t *box = fr_value_box_list_head(¤t->lhs.result);
+ fr_value_box_t *box = fr_value_box_list_head(¤t->lhs.list);
fr_value_box_t *dst;
fr_sbuff_unescape_rules_t *erules = NULL;
* There's only one value-box, just use it as-is. We let the parent handler complain about being
* able to parse (or not) the value.
*/
- if (!fr_value_box_list_next(¤t->lhs.result, box)) goto done;
+ if (!fr_value_box_list_next(¤t->lhs.list, box)) goto done;
/*
* Figure out how to parse the string.
/*
* Mash all of the results together.
*/
- if (fr_value_box_list_concat_in_place(box, box, ¤t->lhs.result, type, FR_VALUE_BOX_LIST_FREE, true, SIZE_MAX) < 0) {
+ if (fr_value_box_list_concat_in_place(box, box, ¤t->lhs.list, type, FR_VALUE_BOX_LIST_FREE, true, SIZE_MAX) < 0) {
RWDEBUG("Failed converting result to '%s' - no memory", fr_type_to_str(type));
return -1;
}
*/
if (!fr_type_is_fixed_size(da->type)) {
done:
- fr_value_box_list_move(¤t->parent->rhs.result, ¤t->lhs.result);
+ fr_value_box_list_move(¤t->parent->rhs.list, ¤t->lhs.list);
return next_map(request, state, current);
}
}
fr_value_box_safety_copy_changed(dst, box);
- fr_value_box_list_talloc_free(¤t->lhs.result);
- fr_value_box_list_insert_tail(¤t->parent->rhs.result, dst);
+ fr_value_box_list_talloc_free(¤t->lhs.list);
+ fr_value_box_list_insert_tail(¤t->parent->rhs.list, dst);
return next_map(request, state, current);
}
tmpl_dcursor_ctx_t cc;
fr_dcursor_t cursor;
- if (current->lhs.success.rcode == RLM_MODULE_FAIL) {
+ if (current->lhs.result.rcode == RLM_MODULE_FAIL) {
RDEBUG("Failed expanding %s ...", map->lhs->name);
return -1;
}
XDEBUG("%s map %s %s ...", __FUNCTION__, map->lhs->name, fr_tokens[map->op]);
- fr_assert(fr_value_box_list_empty(¤t->lhs.result)); /* Should have been consumed */
- fr_assert(fr_value_box_list_empty(¤t->rhs.result)); /* Should have been consumed */
+ fr_assert(fr_value_box_list_empty(¤t->lhs.list)); /* Should have been consumed */
+ fr_assert(fr_value_box_list_empty(¤t->rhs.list)); /* Should have been consumed */
rcode = tmpl_to_values(state, ¤t->lhs, request, map->lhs);
if (rcode < 0) return -1;
XDEBUG("MAP %s ... %s", state->current->map->lhs->name, state->current->map->rhs->name);
}
- state->current->lhs.success.rcode = state->current->rhs.success.rcode = RLM_MODULE_OK;
+ state->current->lhs.result.rcode = state->current->rhs.result.rcode = RLM_MODULE_OK;
rcode = state->current->func(request, state, state->current);
if (rcode < 0) {
edit_map_t *current = &state->first;
state->current = current;
- fr_value_box_list_init(¤t->lhs.result);
- fr_value_box_list_init(¤t->rhs.result);
+ fr_value_box_list_init(¤t->lhs.list);
+ fr_value_box_list_init(¤t->rhs.list);
/*
* The edit list creates a local pool which should