26 RCSID(
"$Id: 4477a947db040f398f29b21d866e4493e7dfbbbd $")
28 #include "unlang_priv.h"
51 .debug_name =
"function",
94 caller = request->module;
95 request->module = NULL;
98 request->module = caller;
119 caller = request->module;
120 request->module = NULL;
146 request->module = caller;
167 RERROR(
"Can't clear function on non-function frame");
201 RERROR(
"Can't set repeat function on non-function frame");
239 RERROR(
"Can't set repeat function on non-function frame");
283 bool top_frame,
void *
uctx)
306 state = frame->
state;
345 .debug_braces =
false,
347 .frame_state_type =
"unlang_frame_state_func_t",
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
@ UNLANG_ACTION_PUSHED_CHILD
unlang_t pushed a new child onto the stack, execute it instead of continuing.
@ UNLANG_ACTION_STOP_PROCESSING
Break out of processing the current request (unwind).
@ UNLANG_ACTION_FAIL
Encountered an unexpected error.
@ UNLANG_ACTION_CALCULATE_RESULT
Calculate a new section rlm_rcode_t value.
fr_dcursor_eval_t void const * uctx
static void unlang_function_dump(request_t *request, unlang_stack_frame_t *frame)
Custom frame state dumper.
char const * repeat_name
Debug name for the repeat function.
int unlang_function_clear(request_t *request)
Clear pending repeat function calls, and remove the signal handler.
static unlang_t function_instruction
Static instruction for allowing modules/xlats to call functions within themselves,...
unlang_function_t repeat
To call when going back up the stack.
unlang_function_signal_t signal
Signal function to call.
unlang_function_t func
To call when going down the stack.
void * uctx
Uctx to pass to function.
static unlang_action_t unlang_function_call_repeat(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
char const * func_name
Debug name for the function.
fr_signal_t sigmask
Signals to block.
void unlang_function_init(void)
static void unlang_function_signal(request_t *request, unlang_stack_frame_t *frame, fr_signal_t action)
Generic signal handler.
char const * signal_name
Debug name for the signal function.
static unlang_action_t unlang_function_call(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
Call a generic function.
Declarations for generic unlang functions.
void(* unlang_function_signal_t)(request_t *request, fr_signal_t action, void *uctx)
Function to call if the request was signalled.
unlang_action_t(* unlang_function_t)(rlm_rcode_t *p_result, int *priority, request_t *request, void *uctx)
A generic function pushed by a module or xlat to functions deeper in the C call stack to create resum...
int _unlang_function_signal_set(request_t *request, unlang_function_signal_t signal, fr_signal_t sigmask, char const *name)
Set a new signal function for an existing function frame.
int _unlang_function_repeat_set(request_t *request, unlang_function_t repeat, char const *name)
Set a new repeat function for an existing function frame.
unlang_action_t _unlang_function_push(request_t *request, unlang_function_t func, char const *func_name, unlang_function_t repeat, char const *repeat_name, unlang_function_signal_t signal, fr_signal_t sigmask, char const *signal_name, bool top_frame, void *uctx)
Push a generic function onto the unlang stack.
int unlang_interpret_push(request_t *request, unlang_t const *instruction, rlm_rcode_t default_rcode, bool do_next_sibling, bool top_frame)
Push a new frame onto the stack.
void unlang_register(int type, unlang_op_t *op)
Register an operation with the interpreter.
static char * stack[MAX_STACK]
rlm_rcode_t
Return codes indicating the result of the module call.
@ RLM_MODULE_INVALID
The module considers the request invalid.
@ RLM_MODULE_OK
The module is OK, continue.
@ RLM_MODULE_FAIL
Module failed, don't reply.
@ RLM_MODULE_DISALLOW
Reject the request (user is locked out).
@ RLM_MODULE_REJECT
Immediately reject the request.
@ RLM_MODULE_NOTFOUND
User not found.
@ RLM_MODULE_UPDATED
OK (pairs modified).
@ RLM_MODULE_NOOP
Module succeeded without doing anything.
@ RLM_MODULE_HANDLED
The module handled the request, so stop.
static void repeatable_clear(unlang_stack_frame_t *frame)
void * state
Stack frame specialisations.
int priority
Result priority.
@ UNLANG_TYPE_FUNCTION
Internal call to a function or submodule.
static void frame_repeat(unlang_stack_frame_t *frame, unlang_process_t process)
Mark the current stack frame up for repeat, and set a new process function.
unlang_t const * instruction
The unlang node we're evaluating.
static void repeatable_set(unlang_stack_frame_t *frame)
unlang_process_t process
function to call for interpreting this stack frame
unlang_type_t type
The specialisation of this node.
A node in a graph of unlang_op_t (s) that we execute.
Our interpreter stack, as distinct from the C stack.
An unlang stack associated with a request.