25 RCSID(
"$Id: f3ec4650a1b416fee4686f8e66c35f41b26b1727 $")
83 RDEBUG3(
"parallel - child %s (%d/%d) CANCELLED",
94 static void unlang_parallel_cancel_siblings(
request_t *request)
122 RDEBUG3(
"parallel - child %s (%d/%d) DETACHED",
134 RDEBUG3(
"Signalling parent %s that all children have EXITED or DETACHED", request->parent->name);
165 RDEBUG3(
"parallel - child %s (%d/%d) EXITED",
176 RDEBUG3(
"Signalling parent %s that all children have EXITED or DETACHED", request->parent->name);
200 RDEBUG3(
"parallel - child %s (%d/%d) DONE",
229 RDEBUG4(
"** [%i] %s - over-riding result from higher priority to (%s %d)",
246 *p_result = state->
result;
278 request->dict, state->
detach);
279 child->packet->code = request->packet->code;
281 RDEBUG3(
"parallel - child %s (%d/%d) INIT",
293 &child->request_pairs,
294 &request->request_pairs) < 0) ||
297 &request->reply_pairs) < 0) ||
299 &child->control_pairs,
300 &request->control_pairs) < 0)) {
301 REDEBUG(
"failed copying lists to clone");
337 RDEBUG3(
"parallel - child %s (%d/%d) DETACHED",
351 RPEDEBUG(
"Failed detaching request");
371 &state->
children[i]) < 0)
goto error;
427 if (action == FR_SIGNAL_CANCEL) {
463 MEM(frame->
state = state = _talloc_zero_pooled_object(request,
466 "unlang_parallel_state_t",
468 (talloc_array_length(request->name) * 2)));
484 for (i = 0, instruction = g->
children; instruction != NULL; i++, instruction = instruction->
next) {
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
@ UNLANG_ACTION_CALCULATE_RESULT
Calculate a new section rlm_rcode_t value.
@ UNLANG_ACTION_YIELD
Temporarily pause execution until an event occurs.
fr_table_num_sorted_t const mod_rcode_table[]
fr_dcursor_eval_t void const * uctx
#define unlang_function_push(_request, _func, _repeat, _signal, _sigmask, _top_frame, _uctx)
Push a generic function onto the unlang stack.
static bool fr_heap_entry_inserted(fr_heap_index_t heap_idx)
Check if an entry is inserted into a heap.
void unlang_interpret_request_done(request_t *request)
Indicate to the caller of the interpreter that this request is complete.
void unlang_interpret_mark_runnable(request_t *request)
Mark a request as resumable.
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_interpret_signal(request_t *request, fr_signal_t action)
Send a signal (usually stop) to a request.
Private declarations for the unlang interpreter.
static void interpret_child_init(request_t *request)
#define RDEBUG_ENABLED3
True if request debug level 1-3 messages are enabled.
#define RPEDEBUG(fmt,...)
void unlang_register(int type, unlang_op_t *op)
Register an operation with the interpreter.
request_t * unlang_io_subrequest_alloc(request_t *parent, fr_dict_t const *namespace, bool detachable)
Allocate a child request based on the parent.
static char * stack[MAX_STACK]
Declarations for the unlang module interface.
int fr_pair_list_copy(TALLOC_CTX *ctx, fr_pair_list_t *to, fr_pair_list_t const *from)
Duplicate a list of pairs.
static unlang_action_t unlang_parallel(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
void unlang_parallel_init(void)
static unlang_action_t unlang_parallel_resume(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
static unlang_action_t unlang_parallel_child_done(UNUSED rlm_rcode_t *p_result, UNUSED int *p_priority, request_t *request, void *uctx)
When the chld is done, tell the parent that we've exited.
static void unlang_parallel_signal(UNUSED request_t *request, unlang_stack_frame_t *frame, fr_signal_t action)
Send a signal from parent request to all of it's children.
static unlang_action_t unlang_parallel_process(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
Run one or more sub-sections from the parallel section.
static void unlang_parallel_child_signal(request_t *request, UNUSED fr_signal_t action, void *uctx)
Signal handler to deal with UNLANG_ACTION_DETACH.
static void unlang_parallel_cancel_child(unlang_parallel_state_t *state, int i)
Cancel a specific child.
Declarations for the unlang "parallel" keyword.
bool detach
are we creating the child detached
char * name
Cache the request name.
unlang_parallel_child_t children[]
Array of children.
int num_complete
How many children are complete.
int num_children
How many children are executing.
request_t * request
Child request.
bool clone
are the children cloned
unlang_t const * instruction
broken out of g->children
bool detach
are we creating the child detached
static unlang_parallel_t * unlang_group_to_parallel(unlang_group_t *g)
Cast a group structure to the parallel keyword extension.
@ CHILD_RUNNABLE
Running/runnable.
@ CHILD_DETACHED
Child has detached.
@ CHILD_INIT
Initial state.
@ CHILD_EXITED
Child has exited.
@ CHILD_CANCELLED
Child was cancelled.
@ CHILD_DONE
The child has completed.
unlang_parallel_child_state_t state
State of the child.
Each parallel child has a state, and an associated request.
rlm_rcode_t
Return codes indicating the result of the module call.
@ RLM_MODULE_FAIL
Module failed, don't reply.
@ RLM_MODULE_REJECT
Immediately reject the request.
@ RLM_MODULE_NOOP
Module succeeded without doing anything.
int request_detach(request_t *child)
Unlink a subrequest from its parent.
#define REQUEST_VERIFY(_x)
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
int unlang_subrequest_lifetime_set(request_t *request)
Initialize a detached child.
#define fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
char * talloc_bstrdup(TALLOC_CTX *ctx, char const *in)
Binary safe strdup function.
unlang_t * next
Next node (executed on UNLANG_ACTION_EXECUTE_NEXT et al).
void * state
Stack frame specialisations.
static unlang_group_t * unlang_generic_to_group(unlang_t const *p)
static void return_point_set(unlang_stack_frame_t *frame)
static int stack_depth_current(request_t *request)
@ UNLANG_TYPE_PARALLEL
execute statements in parallel
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.
unlang_process_t process
function to call for interpreting this stack frame
unlang_t * children
Children beneath this group.
static unlang_stack_frame_t * frame_current(request_t *request)
Generic representation of a grouping.
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.