/*
* xlat_tokenize.c
*/
+xlat_exp_t *xlat_exp_func_alloc(TALLOC_CTX *ctx, xlat_t *func, xlat_exp_t const *args);
+
void xlat_exp_free(xlat_exp_t **head);
tmpl_t *xlat_to_tmpl_attr(TALLOC_CTX *ctx, xlat_exp_t *xlat);
return node;
}
+/** Allocate an xlat node to call an xlat function
+ *
+ * @param[in] ctx to allocate the new node in.
+ * @param[in] func to call.
+ * @param[in] args Arguments to the function. Will be copied,
+ * and freed when the new xlat node is freed.
+ */
+xlat_exp_t *xlat_exp_func_alloc(TALLOC_CTX *ctx, xlat_t *func, xlat_exp_t const *args)
+{
+ xlat_exp_t *node;
+
+ MEM(node = xlat_exp_alloc(ctx, XLAT_FUNC, func->name, strlen(func->name)));
+ node->call.func = func;
+ if (unlikely(xlat_copy(node, &node->child, args) < 0)) {
+ talloc_free(node);
+ return -1;
+ }
+ node->flags = func->flags;
+
+ return node;
+}
+
/** Set the type of an xlat node
*
* @param[in] node to set type for.