#define RESUME_NO_RCTX(_x) static inline unlang_action_t resume_ ## _x(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request, UNUSED void *rctx)
#define RESUME_NO_MCTX(_x) static inline unlang_action_t resume_ ## _x(rlm_rcode_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request, UNUSED void *rctx)
-
+/** Call a named recv function directly
+ */
#define CALL_RECV(_x) recv_ ## _x(p_result, mctx, request);
+
+/** Call a named send function directly
+ */
#define CALL_SEND(_x) send_ ## _x(p_result, mctx, request, rctx)
+
+/** Call a named resume function directly
+ */
#define CALL_RESUME(_x) resume_ ## _x(p_result, mctx, request, rctx)
+/** Set the current reply code, and call the send function for that state
+ */
+#define CALL_SEND_TYPE(_x) process_state[(request->reply->code = _x)].send(p_result, mctx, request, rctx)
+
+/** Call the send function for the current state
+ */
+#define CALL_SEND_STATE(_state) state->send(p_result, mctx, request, rctx)
+
RECV(generic)
{
CONF_SECTION *cs;
RECV(access_request)
{
process_radius_t const *inst = talloc_get_type_abort_const(mctx->instance, process_radius_t);
+ void *rctx = NULL;
/*
* Only reject if the state has already been thawed.
* for us, and we're just proxying upstream.
*/
if (fr_state_to_request(inst->auth.state_tree, request) < 0) {
- request->reply->code = FR_RADIUS_CODE_ACCESS_REJECT;
- return CALL_SEND(generic);
+ return CALL_SEND_TYPE(FR_RADIUS_CODE_ACCESS_REJECT);
}
return CALL_RECV(generic);
send_reply:
fr_assert(state->send != NULL);
- return unlang_module_yield_to_section(p_result, request,
- cs, state->rcode, state->send,
- NULL, NULL);
+ return CALL_SEND_STATE(state);
}
/*
* If this fails, don't respond to the request.
*/
if (fr_request_to_state(inst->auth.state_tree, request) < 0) {
- request->reply->code = FR_RADIUS_CODE_DO_NOT_RESPOND;
- return CALL_SEND(generic);
+ return CALL_SEND_TYPE(FR_RADIUS_CODE_DO_NOT_RESPOND);
}
fr_assert(request->reply->code == FR_RADIUS_CODE_ACCESS_CHALLENGE);
send_reply:
fr_assert(state->send != NULL);
- return unlang_module_yield_to_section(p_result, request,
- cs, state->rcode, state->send,
- NULL, rctx);
+ return CALL_SEND_STATE(state);
}
/*