The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
child_request.c File Reference

Common child request management code. More...

#include <freeradius-devel/server/state.h>
#include <freeradius-devel/server/request.h>
#include <freeradius-devel/server/signal.h>
#include "lib/server/rcode.h"
#include "lib/util/talloc.h"
#include "unlang_priv.h"
#include "child_request_priv.h"
+ Include dependency graph for child_request.c:

Go to the source code of this file.

Data Structures

struct  unlang_frame_state_child_request_t
 

Functions

static unlang_action_t unlang_child_request_done (rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
 When the child is done, tell the parent that we've exited.
 
int unlang_child_request_init (TALLOC_CTX *ctx, unlang_child_request_t *out, request_t *child, rlm_rcode_t *p_result, unsigned int *sibling_count, void const *unique_session_ptr, bool free_child)
 Initialize a child request.
 
int unlang_child_request_op_init (void)
 
static void unlang_child_request_signal (request_t *request, UNUSED unlang_stack_frame_t *frame, fr_signal_t action)
 Process a detach signal in the child.
 
static int unlang_child_request_stack_init (unlang_child_request_t *cr)
 Push a resumption frame onto a child's stack.
 

Variables

fr_table_num_ordered_t const unlang_child_states_table []
 
size_t unlang_child_states_table_len = NUM_ELEMENTS(unlang_child_states_table)
 

Detailed Description

Common child request management code.

Id
bea7c6cf3a5e53ae71ccbd4dd500112d12483888

Definition in file child_request.c.


Data Structure Documentation

◆ unlang_frame_state_child_request_t

struct unlang_frame_state_child_request_t

Definition at line 34 of file child_request.c.

+ Collaboration diagram for unlang_frame_state_child_request_t:
Data Fields
unlang_child_request_t * cr A pointer to memory in the parent's frame state allocated for this child to write results to.

Function Documentation

◆ unlang_child_request_done()

static unlang_action_t unlang_child_request_done ( rlm_rcode_t p_result,
request_t request,
unlang_stack_frame_t frame 
)
static

When the child is done, tell the parent that we've exited.

This is pushed as a frame at the top of the child's stack, so when the child is done executing, it runs this to inform the parent that its done.

Definition at line 128 of file child_request.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unlang_child_request_init()

int unlang_child_request_init ( TALLOC_CTX *  ctx,
unlang_child_request_t out,
request_t child,
rlm_rcode_t p_result,
unsigned int *  sibling_count,
void const *  unique_session_ptr,
bool  free_child 
)

Initialize a child request.

This initializes the child request result and configuration structure, and pushes a resumption frame onto the child's stack.

Parameters
[in]ctxMemory to use for any additional memory allocated to the unlang_child_request_t.
[out]outChild request to initialize.
[in]childThe child request to initialize.
[in]p_resultWhere to write out the rcode from the child.
[in,out]sibling_countIf non-null the bumber of siblings. This is incremented for each child created.
[in]unique_session_ptrUnique session pointer for this child. If NULL session data won't be stored/restored for the child.
[in]free_childFree the child when done?
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 265 of file child_request.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unlang_child_request_op_init()

int unlang_child_request_op_init ( void  )

Definition at line 287 of file child_request.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unlang_child_request_signal()

static void unlang_child_request_signal ( request_t request,
UNUSED unlang_stack_frame_t frame,
fr_signal_t  action 
)
static

Process a detach signal in the child.

This processes any detach signals the child receives The child doesn't actually do the detaching

Definition at line 54 of file child_request.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unlang_child_request_stack_init()

static int unlang_child_request_stack_init ( unlang_child_request_t cr)
static

Push a resumption frame onto a child's stack.

Push a frame onto the stack of the child to inform the parent when it's complete. An additional frame is pushed onto the child's stack by the 'run' function which executes in the context of the parent.

Parameters
[in]crstate for this child request. This is a pointer to a structure in the parent's frame state.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 207 of file child_request.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ unlang_child_states_table

fr_table_num_ordered_t const unlang_child_states_table[]
Initial value:
= {
{ L("CANCELLED"), CHILD_CANCELLED },
{ L("DETACH"), CHILD_DETACHED },
{ L("DONE"), CHILD_DONE },
{ L("EXITED"), CHILD_EXITED },
{ L("INIT"), CHILD_INIT },
{ L("RUNNABLE"), CHILD_RUNNABLE }
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition build.h:209
@ CHILD_RUNNABLE
Running/runnable.
@ CHILD_DETACHED
Child has detached, we can't signal it or communicate with it anymore.
@ CHILD_INIT
Initial state, has no request allocated.
@ CHILD_EXITED
Child has run to completion, and is waiting to be reaped.
@ CHILD_CANCELLED
Child was cancelled.
@ CHILD_DONE
The child has been processed by the parent the request should still exist, and should be freed.

Definition at line 39 of file child_request.c.

◆ unlang_child_states_table_len

size_t unlang_child_states_table_len = NUM_ELEMENTS(unlang_child_states_table)

Definition at line 47 of file child_request.c.