* on a registered FD occurs before the timeout event fires.
*
* @param[in] request the request.
- * @param[in] instance the xlat instance.
- * @param[in] thread data specific to this xlat instance.
+ * @param[in] xlat_inst the xlat instance.
+ * @param[in] xlat_thread_inst data specific to this xlat instance.
* @param[in] rctx Resume ctx provided when the xlat last yielded.
* @param[in] fired the time the timeout event actually fired.
*/
-typedef void (*fr_unlang_xlat_timeout_t)(REQUEST *request, void *instance, void *thread, void *rctx,
+typedef void (*fr_unlang_xlat_timeout_t)(REQUEST *request, void *xlat_inst, void *xlat_thread_inst, void *rctx,
struct timeval *fired);
/** A callback when the FD is ready for reading
caller = request->module;
request->module = sp->module_instance->name;
safe_lock(sp->module_instance); /* Noop unless instance->mutex set */
- rcode = sp->method(sp->module_instance->dl_inst->data, ms->thread->data, request);
+ rcode = sp->method(request, sp->module_instance->dl_inst->data, ms->thread->data);
safe_unlock(sp->module_instance);
request->module = caller;
caller = request->module;
request->module = mc->module_instance->name;
- ((fr_unlang_module_signal_t)mr->signal)(request,
- mc->module_instance->dl_inst->data, ms->thread->data,
+ ((fr_unlang_module_signal_t)mr->signal)(mc->module_instance->dl_inst->data, ms->thread->data, request,
rctx, action);
request->module = caller;
}
caller = request->module;
request->module = mc->module_instance->name;
safe_lock(mc->module_instance);
- rcode = request->rcode = ((fr_unlang_module_resume_t)mr->resume)(request,
- mc->module_instance->dl_inst->data,
- ms->thread->data, mr->rctx);
+ rcode = request->rcode = ((fr_unlang_module_resume_t)mr->resume)(mc->module_instance->dl_inst->data,
+ ms->thread->data, request, mr->rctx);
safe_unlock(mc->module_instance);
request->module = caller;
* @note The callback is automatically removed on unlang_interpret_resumable(), i.e. if an event
* on a registered FD occurs before the timeout event fires.
*
- * @param[in] request the request.
* @param[in] instance the module instance.
* @param[in] thread data specific to this module instance.
* @param[in] rctx a local context for the callback.
+ * @param[in] request the request.
* @param[in] fired the time the timeout event actually fired.
*/
-typedef void (*fr_unlang_module_timeout_t)(REQUEST *request, void *instance, void *thread, void *rctx,
+typedef void (*fr_unlang_module_timeout_t)(void *instance, void *thread, REQUEST *request, void *rctx,
struct timeval *fired);
/** A callback when the FD is ready for reading
*
* @note The callback is automatically removed on unlang_interpret_resumable(), so
*
- * @param[in] request the current request.
* @param[in] instance the module instance.
* @param[in] thread data specific to this module instance.
+ * @param[in] request the current request.
* @param[in] rctx a local context for the callback.
* @param[in] fd the file descriptor.
*/
-typedef void (*fr_unlang_module_fd_event_t)(REQUEST *request, void *instance, void *thread, void *rctx, int fd);
+typedef void (*fr_unlang_module_fd_event_t)(void *instance, void *thread, REQUEST *request, void *rctx, int fd);
/** A callback for when the request is resumed.
*
* The resumed request cannot call the normal "authorize", etc. method. It needs a separate callback.
*
- * @param[in] request the current request.
* @param[in] instance The module instance.
* @param[in] thread data specific to this module instance.
+ * @param[in] request the current request.
* @param[in] rctx a local context for the callback.
* @return a normal rlm_rcode_t.
*/
-typedef rlm_rcode_t (*fr_unlang_module_resume_t)(REQUEST *request, void *instance, void *thread, void *rctx);
+typedef rlm_rcode_t (*fr_unlang_module_resume_t)(void *instance, void *thread, REQUEST *request, void *rctx);
/** A callback when the request gets a fr_state_signal_t.
*
*
* @note The callback is automatically removed on unlang_interpret_resumable().
*
- * @param[in] request The current request.
* @param[in] instance The module instance.
* @param[in] thread data specific to this module instance.
* @param[in] rctx Resume ctx for the callback.
+ * @param[in] request The current request.
* @param[in] action which is signalling the request.
*/
-typedef void (*fr_unlang_module_signal_t)(REQUEST *request, void *instance, void *thread,
+typedef void (*fr_unlang_module_signal_t)(void *instance, void *thread, REQUEST *request,
void *rctx, fr_state_signal_t action);
int unlang_module_timeout_add(REQUEST *request, fr_unlang_module_timeout_t callback,
*
* Marks the request as resumable, and prints the delayed delay time.
*
- * @param[in] request The current request.
* @param[in] instance This instance of the delay module.
* @param[in] thread Thread specific module instance.
+ * @param[in] request The current request.
* @param[in] rctx Scheduled end of the delay.
* @param[in] fired When request processing was resumed.
*/
-static void _delay_done(REQUEST *request, UNUSED void *instance, UNUSED void *thread, void *rctx, struct timeval *fired)
+static void _delay_done(UNUSED void *instance, UNUSED void *thread, REQUEST *request, void *rctx, struct timeval *fired)
+{
+ struct timeval *yielded = talloc_get_type_abort(rctx, struct timeval);
+
+ RDEBUG2("Delay done");
+
+ /*
+ * timeout should never be *before* the scheduled time,
+ * if it is, something is very broken.
+ */
+ if (!fr_cond_assert(fr_timeval_cmp(fired, yielded) >= 0)) REDEBUG("Unexpected resume time");
+
+ unlang_interpret_resumable(request);
+}
+
+static void _xlat_delay_done(REQUEST *request,
+ UNUSED void *xlat_inst, UNUSED void *xlat_thread_inst, void *rctx, struct timeval *fired)
{
struct timeval *yielded = talloc_get_type_abort(rctx, struct timeval);
/** Called resume_at the delay is complete, and we're running from the interpreter
*
*/
-static rlm_rcode_t mod_delay_return(REQUEST *request,
- UNUSED void *instance, UNUSED void *thread, void *rctx)
+static rlm_rcode_t mod_delay_return(UNUSED void *instance, UNUSED void *thread, REQUEST *request, void *rctx)
{
struct timeval *yielded = talloc_get_type_abort(rctx, struct timeval);
return RLM_MODULE_OK;
}
-static void mod_delay_cancel(REQUEST *request, UNUSED void *instance, UNUSED void *thread, void *rctx,
+static void mod_delay_cancel(UNUSED void *instance, UNUSED void *thread, REQUEST *request, void *rctx,
fr_state_signal_t action)
{
if (action != FR_SIGNAL_CANCEL) return;
yield:
RDEBUG3("Current time %pV, resume time %pV", fr_box_timeval(*yielded_at), fr_box_timeval(resume_at));
- if (unlang_xlat_event_timeout_add(request, _delay_done, yielded_at, &resume_at) < 0) {
+ if (unlang_xlat_event_timeout_add(request, _xlat_delay_done, yielded_at, &resume_at) < 0) {
RPEDEBUG("Adding event failed");
return XLAT_ACTION_FAIL;
}
* @param[in] rctx the eap_session_t.
* @return The result of this round of authentication.
*/
-static rlm_rcode_t mod_authenticate_result_async(REQUEST *request, void *instance, void *thread, void *rctx)
+static rlm_rcode_t mod_authenticate_result_async(void *instance, void *thread, REQUEST *request, void *rctx)
{
eap_session_t *eap_session = talloc_get_type_abort(rctx, eap_session_t);
* @param[in] rctx the eap_session_t
* @param[in] action to perform.
*/
-static void mod_authenticate_cancel(REQUEST *request, UNUSED void *instance, UNUSED void *thread, void *rctx,
+static void mod_authenticate_cancel(UNUSED void *instance, UNUSED void *thread, REQUEST *request, void *rctx,
fr_state_signal_t action)
{
eap_session_t *eap_session;
/** Continue after unlang_interpret_resumable()
*
*/
-static rlm_rcode_t mod_radius_resume(REQUEST *request, void *instance, void *thread, void *ctx)
+static rlm_rcode_t mod_radius_resume(void *instance, void *thread, REQUEST *request, void *ctx)
{
rlm_radius_t const *inst = talloc_get_type_abort_const(instance, rlm_radius_t);
rlm_radius_thread_t *t = talloc_get_type_abort(thread, rlm_radius_thread_t);
return 0;
}
-static rlm_rcode_t conn_request_resume(UNUSED REQUEST *request, UNUSED void *instance, UNUSED void *thread, void *ctx)
+static rlm_rcode_t conn_request_resume(UNUSED void *instance, UNUSED void *thread, UNUSED REQUEST *request, void *ctx)
{
fr_io_request_t *u = talloc_get_type_abort(ctx, fr_io_request_t);
rlm_rcode_t rcode;
* If we're signalled that the request has been cancelled (FR_SIGNAL_CANCEL).
* Cleanup any pending state and release the connection handle back into the pool.
*
- * @param[in] request being cancelled.
* @param[in] instance of rlm_rest.
* @param[in] thread Thread specific module instance.
+ * @param[in] request being cancelled.
* @param[in] rctx rlm_rest_handle_t currently used by the request.
* @param[in] action What happened.
*/
-void rest_io_module_action(REQUEST *request, void *instance, void *thread, void *rctx, fr_state_signal_t action)
+void rest_io_module_action(void *instance, void *thread, REQUEST *request, void *rctx, fr_state_signal_t action)
{
rlm_rest_handle_t *randle = talloc_get_type_abort(rctx, rlm_rest_handle_t);
rlm_rest_thread_t *t = thread;
rlm_rest_xlat_rctx_t *our_rctx = talloc_get_type_abort(rctx, rlm_rest_xlat_rctx_t);
rlm_rest_handle_t *randle = talloc_get_type_abort(our_rctx->handle, rlm_rest_handle_t);
- rest_io_module_action(request, mod_inst, t, randle, action);
+ rest_io_module_action(mod_inst, t, request, randle, action);
}
/** Sends a REST (HTTP) request.
/*
* Async IO helpers
*/
-void rest_io_module_action(REQUEST *request, void *instance, void *thread, void *rctx, fr_state_signal_t action);
-void rest_io_xlat_action(REQUEST *request, void *instance, void *thread, void *rctx, fr_state_signal_t action);
+void rest_io_module_action(void *instance, void *thread, REQUEST *request, void *rctx, fr_state_signal_t action);
+void rest_io_xlat_action(REQUEST *request, void *xlat_inst, void *xlat_thread_inst, void *rctx, fr_state_signal_t action);
int rest_io_request_enqueue(rlm_rest_thread_t *thread, REQUEST *request, void *handle);
int rest_io_init(rlm_rest_thread_t *thread, bool multiplex);
return unlang_xlat_yield(request, rest_xlat_resume, rest_io_xlat_action, rctx);
}
-static rlm_rcode_t mod_authorize_result(REQUEST *request, void *instance, void *thread, void *ctx)
+static rlm_rcode_t mod_authorize_result(void *instance, void *thread, REQUEST *request, void *ctx)
{
rlm_rest_t const *inst = instance;
rlm_rest_thread_t *t = thread;
return unlang_module_yield(request, mod_authorize_result, rest_io_module_action, handle);
}
-static rlm_rcode_t mod_authenticate_result(REQUEST *request, void *instance, void *thread, void *rctx)
+static rlm_rcode_t mod_authenticate_result(void *instance, void *thread, REQUEST *request, void *rctx)
{
rlm_rest_t const *inst = instance;
rlm_rest_thread_t *t = thread;
return unlang_module_yield(request, mod_authenticate_result, NULL, handle);
}
-static rlm_rcode_t mod_accounting_result(REQUEST *request, void *instance, void *thread, void *rctx)
+static rlm_rcode_t mod_accounting_result(void *instance, void *thread, REQUEST *request, void *rctx)
{
rlm_rest_t const *inst = instance;
rlm_rest_thread_t *t = thread;
return unlang_module_yield(request, mod_accounting_result, NULL, handle);
}
-static rlm_rcode_t mod_post_auth_result(REQUEST *request, void *instance, void *thread, void *rctx)
+static rlm_rcode_t mod_post_auth_result(void *instance, void *thread, REQUEST *request, void *rctx)
{
rlm_rest_t const *inst = instance;
rlm_rest_thread_t *t = thread;