xlat_t *x;
x = xlat_register(NULL, xlat_foreach_names[i],
- unlang_foreach_xlat, FR_TYPE_VOID, XLAT_FLAG_NEEDS_ASYNC);
+ unlang_foreach_xlat, FR_TYPE_VOID, 0);
fr_assert(x);
x->uctx = &xlat_foreach_inst[i];
xlat_internal(x);
*/
typedef struct {
bool needs_resolving;//!< Needs pass2 resolution.
- bool needs_async; //!< Node and all child nodes are guaranteed to not
- ///< require asynchronous expansion.
bool pure; //!< has no external side effects, true for BOX, LITERAL, and some functions
bool can_purify; //!< if the xlat has a pure function with pure arguments.
*
* We can't set "needs_resolving" here, and async functions can't be pure.
*/
-#define XLAT_FLAG_NEEDS_ASYNC &(xlat_flags_t) { .needs_async = true, }
#define XLAT_FLAG_PURE &(xlat_flags_t) { .pure = true, }
extern fr_table_num_sorted_t const xlat_action_table[];
return NULL;
}
- if (c->flags.needs_async != flags->needs_async) {
- ERROR("%s: Cannot change async capability of %s", __FUNCTION__, name);
- return NULL;
- }
-
if (c->func != func) {
ERROR("%s: Cannot change callback function for %s", __FUNCTION__, name);
return NULL;
* If the function is async, it can't be pure. But
* non-pure functions don't need to be async.
*/
- fr_assert(!flags->needs_async || !flags->pure);
fr_assert(!flags->needs_resolving);
return c;
}
/** Set global instantiation/detach callbacks
- *
- * All functions registered must be needs_async.
*
* @param[in] xlat to set instantiation callbacks for.
* @param[in] instantiate Instantiation function. Called whenever a xlat is
/** Register an async xlat
*
- * All functions registered must be needs_async.
+ * All functions registered must be !pure
*
* @param[in] xlat to set instantiation callbacks for.
* @param[in] thread_instantiate Instantiation function. Called for every compiled xlat
*
* For pass2, if either the parent or child is marked up for pass2, then the parent
* is marked up for pass2.
- *
- * For needs_async, if both the parent and the child are needs_async, the parent is
- * needs_async.
*/
static inline CC_HINT(nonnull) void xlat_flags_merge(xlat_flags_t *parent, xlat_flags_t const *child)
{
- parent->needs_async |= child->needs_async;
parent->needs_resolving |= child->needs_resolving;
parent->pure &= child->pure; /* purity can only be removed, never added */
- parent->pure &= !parent->needs_async; /* things needing async cannot be pure */
parent->can_purify |= child->can_purify;
parent->constant &= child->constant;
}
node = xlat_exp_alloc(head, XLAT_REGEX, fr_sbuff_current(&m_s), fr_sbuff_behind(&m_s));
node->regex_index = num;
- node->flags.needs_async = false;
fr_sbuff_marker_release(&m_s);
fr_sbuff_next(in); /* Skip '}' */
* %% is pure. Everything else is not.
*/
node->flags.pure = (node->fmt[0] == '%');
- node->flags.needs_async = false;
xlat_exp_insert_tail(head, node);
continue;
fr_assert(head != NULL);
- INFO_INDENT("head flags = { %s %s %s %s }",
+ INFO_INDENT("head flags = { %s %s %s }",
head->flags.needs_resolving ? "need_resolving" : "",
- head->flags.needs_async ? "need_async" : "",
head->flags.pure ? "pure" : "",
head->flags.can_purify ? "can_purify" : "");
xlat_exp_foreach(head, node) {
- INFO_INDENT("[%d] flags = { %s %s %s %s }", i++,
+ INFO_INDENT("[%d] flags = { %s %s %s }", i++,
node->flags.needs_resolving ? "need_resolving" : "",
- node->flags.needs_async ? "need_async" : "",
node->flags.pure ? "pure" : "",
node->flags.can_purify ? "can_purify" : "");
/*
* Register the cache xlat function
*/
- xlat = xlat_register_module(inst, mctx, mctx->inst->name, cache_xlat, FR_TYPE_VOID, XLAT_FLAG_NEEDS_ASYNC);
+ xlat = xlat_register_module(inst, mctx, mctx->inst->name, cache_xlat, FR_TYPE_VOID, 0);
xlat_func_args(xlat, cache_xlat_args);
return 0;
rlm_delay_t *inst = talloc_get_type_abort(mctx->inst->data, rlm_delay_t);
xlat_t *xlat;
- xlat = xlat_register_module(inst, mctx, mctx->inst->name, xlat_delay, FR_TYPE_TIME_DELTA, XLAT_FLAG_NEEDS_ASYNC);
+ xlat = xlat_register_module(inst, mctx, mctx->inst->name, xlat_delay, FR_TYPE_TIME_DELTA, 0);
xlat_func_args(xlat, xlat_delay_args);
return 0;
}
xlat_t *xlat;
char const *p;
- xlat = xlat_register_module(NULL, mctx, mctx->inst->name, exec_xlat, FR_TYPE_STRING, XLAT_FLAG_NEEDS_ASYNC);
+ xlat = xlat_register_module(NULL, mctx, mctx->inst->name, exec_xlat, FR_TYPE_STRING, 0);
xlat_func_args(xlat, exec_xlat_args);
if (inst->input) {
rlm_icmp_t *inst = talloc_get_type_abort(mctx->inst->data, rlm_icmp_t);
xlat_t *xlat;
- xlat = xlat_register_module(inst, mctx, mctx->inst->name, xlat_icmp, FR_TYPE_BOOL, XLAT_FLAG_NEEDS_ASYNC);
+ xlat = xlat_register_module(inst, mctx, mctx->inst->name, xlat_icmp, FR_TYPE_BOOL, 0);
xlat_func_args(xlat, xlat_icmp_args);
FR_TIME_DELTA_BOUND_CHECK("timeout", inst->timeout, >=, fr_time_delta_from_msec(100)); /* 1/10s minimum timeout */
rlm_rest_t *inst = talloc_get_type_abort(mctx->inst->data, rlm_rest_t);
xlat_t *xlat;
- xlat = xlat_register_module(inst, mctx, mctx->inst->name, rest_xlat, FR_TYPE_STRING, XLAT_FLAG_NEEDS_ASYNC);
+ xlat = xlat_register_module(inst, mctx, mctx->inst->name, rest_xlat, FR_TYPE_STRING, 0);
xlat_func_args(xlat, rest_xlat_args);
return 0;
return -1;
}
- if(!(xlat = xlat_register_module(NULL, mctx, mctx->inst->name, xlat_unbound, FR_TYPE_VOID, XLAT_FLAG_NEEDS_ASYNC))) return -1;
+ if(!(xlat = xlat_register_module(NULL, mctx, mctx->inst->name, xlat_unbound, FR_TYPE_VOID, 0))) return -1;
xlat_func_args(xlat, xlat_unbound_args);
return 0;