}
-static void mod_radius_signal(module_ctx_t const *mctx, request_t *request, fr_signal_t action)
-{
- rlm_radius_t const *inst = talloc_get_type_abort_const(mctx->mi->data, rlm_radius_t);
- rlm_radius_io_t const *io = (rlm_radius_io_t const *)inst->io_submodule->exported; /* Public symbol exported by the module */
-
- /*
- * We received a duplicate packet, but we're not doing
- * synchronous proxying. Ignore the dup, and rely on the
- * IO submodule to time it's own retransmissions.
- */
- if ((action == FR_SIGNAL_DUP) && !inst->synchronous) return;
-
- if (!io->signal) return;
-
- io->signal(MODULE_CTX(inst->io_submodule,
- module_thread(inst->io_submodule)->data, mctx->env_data,
- mctx->rctx), request, action);
-}
-
/** Do any RADIUS-layer fixups for proxying.
*
*/
{
rlm_radius_t const *inst = talloc_get_type_abort_const(mctx->mi->data, rlm_radius_t);
rlm_rcode_t rcode;
- unlang_action_t ua;
fr_client_t *client;
- void *rctx = NULL;
-
if (!request->packet->code) {
REDEBUG("You MUST specify a packet code");
RETURN_MODULE_FAIL;
* return another code which indicates what happened to
* the request...
*/
- ua = inst->io->enqueue(&rcode, &rctx, inst->io_submodule->data,
- module_thread(inst->io_submodule)->data, request);
- if (ua != UNLANG_ACTION_YIELD) {
- fr_assert(rctx == NULL);
- RETURN_MODULE_RCODE(rcode);
- }
-
- return unlang_module_yield(request, inst->io->resume, mod_radius_signal, 0, rctx);
+ return inst->io->enqueue(&rcode, inst->io_submodule->data,
+ module_thread(inst->io_submodule)->data, request);
}
static int mod_instantiate(module_inst_ctx_t const *mctx)
/** Enqueue a request_t to an IO submodule
*
*/
-typedef unlang_action_t (*rlm_radius_io_enqueue_t)(rlm_rcode_t *p_result, void **rctx, void *instance, void *thread, request_t *request);
+typedef unlang_action_t (*rlm_radius_io_enqueue_t)(rlm_rcode_t *p_result, void *instance, void *thread, request_t *request);
/** Public structure describing an I/O path for an outgoing socket.
*
struct rlm_radius_io_s {
module_t common; //!< Common fields to all loadable modules.
rlm_radius_io_enqueue_t enqueue; //!< Enqueue a request_t with an IO submodule.
- unlang_module_signal_t signal; //!< Send a signal to an IO module.
- module_method_t resume; //!< Resume a request, and get rcode.
};
static void mod_signal(module_ctx_t const *mctx, UNUSED request_t *request, fr_signal_t action)
{
- udp_thread_t *t = talloc_get_type_abort(mctx->thread, udp_thread_t);
+ rlm_radius_t const *inst = talloc_get_type_abort_const(mctx->mi->data, rlm_radius_t);
+
+ udp_thread_t *t = talloc_get_type_abort(module_thread(inst->io_submodule)->data, udp_thread_t);
udp_result_t *r = talloc_get_type_abort(mctx->rctx, udp_result_t);
+ /*
+ * We received a duplicate packet, but we're not doing
+ * synchronous proxying. Ignore the dup, and rely on the
+ * IO submodule to time it's own retransmissions.
+ */
+ if ((action == FR_SIGNAL_DUP) && !inst->synchronous) return;
+
/*
* If we don't have a treq associated with the
* rctx it's likely because the request was
return 0;
}
-static unlang_action_t mod_enqueue(rlm_rcode_t *p_result, void **rctx_out, void *instance, void *thread, request_t *request)
+static unlang_action_t mod_enqueue(rlm_rcode_t *p_result, void *instance, void *thread, request_t *request)
{
rlm_radius_udp_t *inst = talloc_get_type_abort(instance, rlm_radius_udp_t);
udp_thread_t *t = talloc_get_type_abort(thread, udp_thread_t);
talloc_set_destructor(u, _udp_request_free);
- *rctx_out = r;
-
- return UNLANG_ACTION_YIELD;
+ return unlang_module_yield(request, mod_resume, mod_signal, 0, r);
}
/** Instantiate thread data for the submodule.
.thread_instantiate = mod_thread_instantiate,
},
.enqueue = mod_enqueue,
- .signal = mod_signal,
- .resume = mod_resume,
};