}
}
- if (xlat_instantiate_ephemeral(trigger->xlat,
- (intp ? unlang_interpret_event_list(request) : main_loop_event_list())) < 0) {
+ if (xlat_bootstrap(trigger->xlat, &(tmpl_rules_t ) {
+ .xlat = {
+ .runtime_el = intp ? unlang_interpret_event_list(request) : main_loop_event_list(),
+ },
+ .at_runtime = true
+ }) < 0) {
fr_strerror_const("Failed performing ephemeral instantiation for xlat");
talloc_free(request);
return -1;
/*
* xlat_inst.c
*/
-int xlat_instantiate_ephemeral(xlat_exp_head_t *head, fr_event_list_t *el) CC_HINT(nonnull(1));
-
xlat_thread_inst_t *xlat_thread_instance_find(xlat_exp_t const *node);
int xlat_thread_instantiate(TALLOC_CTX *ctx, fr_event_list_t *el);
int xlat_bootstrap_func(xlat_exp_t *node);
-int xlat_bootstrap(xlat_exp_head_t *root);
+int xlat_bootstrap(xlat_exp_head_t *root, tmpl_rules_t const *t_rules);
void xlat_instances_free(void);
-int xlat_finalize(xlat_exp_head_t *head, tmpl_rules_t const *t_rules); /* xlat_bootstrap() or xlat_instantiate_ephemeral() */
-
/*
* xlat_purify.c
*/
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/heap.h>
+static int xlat_instantiate_ephemeral(xlat_exp_head_t *head, fr_event_list_t *el);
+
/** Holds instance data created by xlat_instantiate
*/
static fr_heap_t *xlat_inst_tree;
}
-/** Bootstrap static xlats, or instantiate ephemeral ones.
- *
- * @note - this function should be called when we have a
- * #tmpl_rules_t. i.e. instead of calling xlat_bootstrap() or
- * xlat_instantiate_ephemeral()
- *
- * @param[in] head of xlat tree to create instance data for.
- * @param[in] t_rules parsing rules with #fr_event_list_t
- */
-int xlat_finalize(xlat_exp_head_t *head, tmpl_rules_t const *t_rules)
-{
- if (!t_rules || !t_rules->xlat.runtime_el) {
- fr_assert(!t_rules || !t_rules->at_runtime);
- return xlat_bootstrap(head);
- }
-
- fr_assert(t_rules && t_rules->at_runtime);
- return xlat_instantiate_ephemeral(head, t_rules->xlat.runtime_el);
-}
-
/** Create instance data for "ephemeral" xlats
*
* @note This function should only be called from routines which get
* @param[in] head of xlat tree to create instance data for.
* @param[in] el event list used to run any instantiate data
*/
-int xlat_instantiate_ephemeral(xlat_exp_head_t *head, fr_event_list_t *el)
+static int xlat_instantiate_ephemeral(xlat_exp_head_t *head, fr_event_list_t *el)
{
int ret;
* If the caller has a #tmpl_rules_t, it should call xlat_finalize() instead.
*
* @param[in] head of xlat tree to create instance data for.
+ * @param[in] t_rules parsing rules with #fr_event_list_t
*/
-int xlat_bootstrap(xlat_exp_head_t *head)
+int xlat_bootstrap(xlat_exp_head_t *head, tmpl_rules_t const *t_rules)
{
int ret;
+ /*
+ * Runtime xlats get ephemeral instantiation
+ */
+ if (t_rules && t_rules->xlat.runtime_el) return xlat_instantiate_ephemeral(head, t_rules->xlat.runtime_el);
+
/*
* If thread instantiate has been called, it's too late to
* bootstrap new xlats.