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

Execute compiled unlang structures using an iterative interpret. More...

#include <freeradius-devel/unlang/action.h>
#include <freeradius-devel/unlang/interpret.h>
#include <freeradius-devel/util/timer.h>
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/modpriv.h>
#include <freeradius-devel/server/rcode.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include <freeradius-devel/unlang/mod_action.h>
#include "interpret_priv.h"
#include "unlang_priv.h"
#include "module_priv.h"
#include <freeradius-devel/unlang/module_priv.h>
+ Include dependency graph for interpret.c:

Go to the source code of this file.

Data Structures

struct  unlang_variable_ref_t
 

Macros

#define DUMP_STACK   if (DEBUG_ENABLED5) stack_dump(request)
 

Enumerations

enum  result_p_location_t {
  RESULT_P_LOCATION_UNKNOWN = 0 ,
  RESULT_P_LOCATION_FRAME ,
  RESULT_P_LOCATION_SCRATCH ,
  RESULT_P_LOCATION_STATE ,
  RESULT_P_LOCATION_MODULE_RCTX ,
  RESULT_P_LOCATION_FUNCTION_RCTX
}
 

Functions

static int _local_variables_free (unlang_variable_ref_t *ref)
 
static void actions_dump (request_t *request, unlang_t const *instruction)
 
static int find_result_p_location (result_p_location_t *location, void **chunk, request_t *request, void *ptr)
 Try and figure out where result_p points to.
 
static void frame_dump (request_t *request, unlang_stack_frame_t *frame, bool with_actions)
 
static unlang_frame_action_t frame_eval (request_t *request, unlang_stack_frame_t *frame)
 Evaluates all the unlang nodes in a section.
 
static void instruction_done_debug (request_t *request, unlang_stack_frame_t *frame, unlang_t const *instruction)
 
static void instruction_dump (request_t *request, unlang_t const *instruction)
 
static void instruction_retry_handler (UNUSED fr_timer_list_t *tl, UNUSED fr_time_t now, void *ctx)
 
static void instruction_timeout_handler (UNUSED fr_timer_list_t *tl, UNUSED fr_time_t now, void *ctx)
 
static unlang_frame_action_t result_calculate (request_t *request, unlang_stack_frame_t *frame, unlang_result_t *result)
 Update the current result after each instruction, and after popping each stack frame.
 
static unlang_frame_action_t result_pop (request_t *request, unlang_stack_frame_t *frame, unlang_result_t *result)
 Function called to merge inter-stack-frame results.
 
void stack_dump (request_t *request)
 
static void stack_dump_body (request_t *request, bool with_actions)
 
void stack_dump_with_actions (request_t *request)
 
static void unlang_cancel_event (UNUSED fr_timer_list_t *tl, UNUSED fr_time_t now, void *uctx)
 Signal the request to stop executing.
 
static xlat_action_t unlang_cancel_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Allows a request to dynamically alter its own lifetime.
 
void unlang_interpet_frame_discard (request_t *request)
 Discard the bottom most frame on the request's stack.
 
rlm_rcode_t unlang_interpret (request_t *request, bool running)
 Run the interpreter for a current request.
 
fr_event_list_tunlang_interpret_event_list (request_t *request)
 Get the event list for the current interpreter.
 
TALLOC_CTX * unlang_interpret_frame_talloc_ctx (request_t *request)
 Get a talloc_ctx which is valid only for this frame.
 
unlang_interpret_tunlang_interpret_get (request_t *request)
 Get the interpreter set for a request.
 
unlang_interpret_tunlang_interpret_get_thread_default (void)
 Get the default interpreter for this thread.
 
unlang_interpret_tunlang_interpret_init (TALLOC_CTX *ctx, fr_event_list_t *el, unlang_request_func_t *funcs, void *uctx)
 Initialize a unlang compiler / interpret.
 
int unlang_interpret_init_global (TALLOC_CTX *ctx)
 
bool unlang_interpret_is_resumable (request_t *request)
 Check if a request as resumable.
 
void unlang_interpret_mark_runnable (request_t *request)
 Mark a request as resumable.
 
unlang_mod_action_t unlang_interpret_priority (request_t *request)
 Get the last instruction priority OR the last frame that was popped.
 
int unlang_interpret_push (unlang_result_t *result_p, request_t *request, unlang_t const *instruction, unlang_frame_conf_t const *conf, bool do_next_sibling)
 Push a new frame onto the stack.
 
unlang_action_t unlang_interpret_push_children (unlang_result_t *p_result, request_t *request, rlm_rcode_t default_rcode, bool do_next_sibling)
 Push the children of the current frame onto a new frame onto the stack.
 
int unlang_interpret_push_instruction (unlang_result_t *p_result, request_t *request, void *instruction, unlang_frame_conf_t const *conf)
 Push an instruction onto the request stack for later interpretation.
 
int unlang_interpret_push_section (unlang_result_t *p_result, request_t *request, CONF_SECTION *cs, unlang_frame_conf_t const *conf)
 Push a configuration section onto the request stack for later interpretation.
 
rlm_rcode_t unlang_interpret_rcode (request_t *request)
 Get the last instruction result OR the last frame that was popped.
 
static void unlang_interpret_request_detach (request_t *request)
 Tell the interpreter to detach the request.
 
void unlang_interpret_request_done (request_t *request)
 Indicate to the caller of the interpreter that this request is complete.
 
void unlang_interpret_request_prioritise (request_t *request, uint32_t priority)
 
unlang_result_tunlang_interpret_result (request_t *request)
 Get the last instruction result OR the last frame that was popped.
 
void unlang_interpret_set (request_t *request, unlang_interpret_t *intp)
 Set a specific interpreter for a request.
 
void unlang_interpret_set_thread_default (unlang_interpret_t *intp)
 Set the default interpreter for this thread.
 
int unlang_interpret_set_timeout (request_t *request, fr_time_delta_t timeout)
 Set a timeout for a request.
 
void unlang_interpret_signal (request_t *request, fr_signal_t action)
 Send a signal (usually stop) to a request.
 
void * unlang_interpret_stack_alloc (TALLOC_CTX *ctx)
 Allocate a new unlang stack.
 
int unlang_interpret_stack_depth (request_t *request)
 Return the depth of the request's stack.
 
static xlat_action_t unlang_interpret_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 Get information about the interpreter state.
 
bool unlang_request_is_cancelled (request_t const *request)
 Return whether a request has been cancelled.
 
bool unlang_request_is_done (request_t const *request)
 Return whether a request has been marked done.
 
bool unlang_request_is_scheduled (request_t const *request)
 Return whether a request is currently scheduled.
 
void unlang_stack_signal (request_t *request, fr_signal_t action, int limit)
 Delivers a frame to one or more frames in the stack.
 

Variables

static unlang_group_t empty_group
 
static _Thread_local unlang_interpret_tintp_thread_default
 The default interpreter instance for this thread.
 
static fr_table_num_ordered_t const result_p_location_table []
 
static size_t result_p_location_table_len = NUM_ELEMENTS(result_p_location_table)
 
static fr_table_num_ordered_t const unlang_action_table []
 
static size_t unlang_action_table_len = NUM_ELEMENTS(unlang_action_table)
 
static xlat_arg_parser_t const unlang_cancel_xlat_args []
 
static fr_table_num_ordered_t const unlang_frame_action_table []
 
static size_t unlang_frame_action_table_len = NUM_ELEMENTS(unlang_frame_action_table)
 
static xlat_arg_parser_t const unlang_interpret_xlat_args []
 

Detailed Description

Execute compiled unlang structures using an iterative interpret.

Id
409bfbb8ed0632c557dae94e0bc74c496ef5a72d

Definition in file interpret.c.


Data Structure Documentation

◆ unlang_variable_ref_t

struct unlang_variable_ref_t

Definition at line 348 of file interpret.c.

+ Collaboration diagram for unlang_variable_ref_t:
Data Fields
fr_dict_t const * old_dict the previous dictionary for the request
request_t * request the request

Macro Definition Documentation

◆ DUMP_STACK

#define DUMP_STACK   if (DEBUG_ENABLED5) stack_dump(request)

Definition at line 259 of file interpret.c.

Enumeration Type Documentation

◆ result_p_location_t

Enumerator
RESULT_P_LOCATION_UNKNOWN 
RESULT_P_LOCATION_FRAME 
RESULT_P_LOCATION_SCRATCH 
RESULT_P_LOCATION_STATE 
RESULT_P_LOCATION_MODULE_RCTX 
RESULT_P_LOCATION_FUNCTION_RCTX 

Definition at line 64 of file interpret.c.

Function Documentation

◆ _local_variables_free()

static int _local_variables_free ( unlang_variable_ref_t ref)
static

Definition at line 353 of file interpret.c.

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

◆ actions_dump()

static void actions_dump ( request_t request,
unlang_t const *  instruction 
)
static

Definition at line 161 of file interpret.c.

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

◆ find_result_p_location()

static int find_result_p_location ( result_p_location_t location,
void **  chunk,
request_t request,
void *  ptr 
)
static

Try and figure out where result_p points to.

If it's somewhere other than these three locations, it's probably wrong.

Definition at line 77 of file interpret.c.

+ Here is the caller graph for this function:

◆ frame_dump()

static void frame_dump ( request_t request,
unlang_stack_frame_t frame,
bool  with_actions 
)
static

Definition at line 179 of file interpret.c.

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

◆ frame_eval()

static unlang_frame_action_t frame_eval ( request_t request,
unlang_stack_frame_t frame 
)
inlinestatic

Evaluates all the unlang nodes in a section.

This function interprets a list of unlang instructions at a given level using the same stack frame, and pushes additional frames onto the stack as needed.

This function can be seen as moving horizontally.

Parameters
[in]requestThe current request.
[in]frameThe current stack frame.
Returns
  • UNLANG_FRAME_ACTION_NEXT evaluate more instructions in the current stack frame which may not be the same frame as when this function was called.
  • UNLANG_FRAME_ACTION_POP the final result has been calculated for this frame.

Definition at line 727 of file interpret.c.

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

◆ instruction_done_debug()

static void instruction_done_debug ( request_t request,
unlang_stack_frame_t frame,
unlang_t const *  instruction 
)
inlinestatic

Definition at line 683 of file interpret.c.

+ Here is the caller graph for this function:

◆ instruction_dump()

static void instruction_dump ( request_t request,
unlang_t const *  instruction 
)
static

Definition at line 146 of file interpret.c.

+ Here is the caller graph for this function:

◆ instruction_retry_handler()

static void instruction_retry_handler ( UNUSED fr_timer_list_t tl,
UNUSED fr_time_t  now,
void *  ctx 
)
static

Definition at line 1469 of file interpret.c.

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

◆ instruction_timeout_handler()

static void instruction_timeout_handler ( UNUSED fr_timer_list_t tl,
UNUSED fr_time_t  now,
void *  ctx 
)
static

Definition at line 1485 of file interpret.c.

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

◆ result_calculate()

static unlang_frame_action_t result_calculate ( request_t request,
unlang_stack_frame_t frame,
unlang_result_t result 
)
inlinestatic

Update the current result after each instruction, and after popping each stack frame.

Note
Sets stack->scratch to be the the result of the frame being popped.
Parameters
[in]requestThe current request.
Returns
  • UNLANG_FRAME_ACTION_NEXT evaluate more instructions.
  • UNLANG_FRAME_ACTION_POP the final result has been calculated for this frame.

Definition at line 453 of file interpret.c.

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

◆ result_pop()

static unlang_frame_action_t result_pop ( request_t request,
unlang_stack_frame_t frame,
unlang_result_t result 
)
inlinestatic

Function called to merge inter-stack-frame results.

This function is called whenever a frame is popped from the stack.

'result' is the result from the frame being popped, and 'frame' is the next highest frame in the stack.

The logic here is very similar to result_eval(), with two important differences:

  • The priority of the lower frame is ignored, and the default priority of the higher frame is used. Unless the higher frame's priority is MOD_ACTION_NOT_SET, in which case the lower frame's priority is used.

Definition at line 656 of file interpret.c.

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

◆ stack_dump()

void stack_dump ( request_t request)

Definition at line 250 of file interpret.c.

+ Here is the call graph for this function:

◆ stack_dump_body()

static void stack_dump_body ( request_t request,
bool  with_actions 
)
static

Definition at line 235 of file interpret.c.

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

◆ stack_dump_with_actions()

void stack_dump_with_actions ( request_t request)

Definition at line 255 of file interpret.c.

+ Here is the call graph for this function:

◆ unlang_cancel_event()

static void unlang_cancel_event ( UNUSED fr_timer_list_t tl,
UNUSED fr_time_t  now,
void *  uctx 
)
static

Signal the request to stop executing.

The request can't be running at this point because we're in the event loop. This means the request is always in a consistent state when the timeout event fires, even if that's state is waiting on I/O.

Definition at line 1691 of file interpret.c.

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

◆ unlang_cancel_xlat()

static xlat_action_t unlang_cancel_xlat ( TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  args 
)
static

Allows a request to dynamically alter its own lifetime.

cancel(<timeout>)

If timeout is 0, then the request is immediately cancelled.

Definition at line 1711 of file interpret.c.

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

◆ unlang_interpet_frame_discard()

void unlang_interpet_frame_discard ( request_t request)

Discard the bottom most frame on the request's stack.

This is used for cleaning up after errors. i.e. the caller uses a push function, and experiences an error and needs to remove the frame that was just pushed.

Definition at line 1986 of file interpret.c.

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

◆ unlang_interpret()

rlm_rcode_t unlang_interpret ( request_t request,
bool  running 
)

Run the interpreter for a current request.

This function runs the interpreter for a request. It deals with popping stack frames, and calaculating the final result for the frame.

Parameters
[in]requestto run. If this is an internal request the request may be freed by the interpreter.
[in]runningIs the interpreter already running.
Returns
The final request rcode.

Definition at line 941 of file interpret.c.

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

◆ unlang_interpret_event_list()

fr_event_list_t * unlang_interpret_event_list ( request_t request)

Get the event list for the current interpreter.

Definition at line 2013 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_interpret_frame_talloc_ctx()

TALLOC_CTX * unlang_interpret_frame_talloc_ctx ( request_t request)

Get a talloc_ctx which is valid only for this frame.

Parameters
[in]requestThe current request.
Returns
  • a TALLOC_CTX which is valid only for this stack frame

Definition at line 1661 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_interpret_get()

unlang_interpret_t * unlang_interpret_get ( request_t request)

Get the interpreter set for a request.

Definition at line 2003 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_interpret_get_thread_default()

unlang_interpret_t * unlang_interpret_get_thread_default ( void  )

Get the default interpreter for this thread.

This allows detached requests to be executed asynchronously

Definition at line 2036 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_interpret_init()

unlang_interpret_t * unlang_interpret_init ( TALLOC_CTX *  ctx,
fr_event_list_t el,
unlang_request_func_t funcs,
void *  uctx 
)

Initialize a unlang compiler / interpret.

Parameters
[in]ctxto bind lifetime of the interpret to. Shouldn't be any free order issues here as the interpret itself has no state. But event loop should be stopped before freeing the interpret.
[in]elfor any timer or I/O events.
[in]funcsCallbacks to used to communicate request state to our owner.
[in]uctxData to pass to callbacks.

Definition at line 1953 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_interpret_init_global()

int unlang_interpret_init_global ( TALLOC_CTX *  ctx)

Definition at line 2043 of file interpret.c.

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

◆ unlang_interpret_is_resumable()

bool unlang_interpret_is_resumable ( request_t request)

Check if a request as resumable.

Parameters
[in]requestThe current request.
Returns
  • true if the request is resumable (i.e. has yielded)
  • false if the request is not resumable (i.e. has not yielded)

Definition at line 1598 of file interpret.c.

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

◆ unlang_interpret_mark_runnable()

void unlang_interpret_mark_runnable ( request_t request)

Mark a request as resumable.

It's not called "unlang_interpret", because it doesn't actually resume the request, it just schedules it for resumption.

Note
that this schedules the request for resumption. It does not immediately start running the request.
Parameters
[in]requestThe current request.

Definition at line 1616 of file interpret.c.

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

◆ unlang_interpret_priority()

unlang_mod_action_t unlang_interpret_priority ( request_t request)

Get the last instruction priority OR the last frame that was popped.

Parameters
[in]requestThe current request.
Returns
the current rcode for the frame.

Definition at line 1551 of file interpret.c.

+ Here is the call graph for this function:

◆ unlang_interpret_push()

int unlang_interpret_push ( unlang_result_t result_p,
request_t request,
unlang_t const *  instruction,
unlang_frame_conf_t const *  conf,
bool  do_next_sibling 
)

Push a new frame onto the stack.

Parameters
[in]result_pWhere to write the result of evaluating the section. If NULL, results will be written to frame->section_result and will be automatically merged with the next highest frame when this one is popped.
[in]requestto push the frame onto.
[in]instructionOne or more unlang_t nodes describing the operations to execute.
[in]confConfiguration for the frame. If NULL, the following values areused:
  • default_rcode = RLM_MODULE_NOT_SET
  • default_priority = MOD_ACTION_NOT_SET
  • top_frame = UNLANG_SUB_FRAME
  • no_rcode = false
[in]do_next_siblingWhether to only execute the first node in the unlang_t program or to execute subsequent nodes.
Returns
  • 0 on success.
  • -1 on call stack too deep.

Definition at line 283 of file interpret.c.

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

◆ unlang_interpret_push_children()

unlang_action_t unlang_interpret_push_children ( unlang_result_t p_result,
request_t request,
rlm_rcode_t  default_rcode,
bool  do_next_sibling 
)

Push the children of the current frame onto a new frame onto the stack.

Parameters
[out]p_resultset to RLM_MOULDE_FAIL if pushing the children fails
[in]requestto push the frame onto.
[in]default_rcodeThe default result.
[in]do_next_siblingWhether to only execute the first node in the unlang_t program or to execute subsequent nodes.
Returns
  • UNLANG_ACTION_PUSHED_CHILD on success.
  • UNLANG_ACTION_EXECUTE_NEXT do nothing, but just go to the next sibling instruction
  • UNLANG_ACTION_STOP_PROCESSING, fatal error, usually stack overflow.

Definition at line 389 of file interpret.c.

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

◆ unlang_interpret_push_instruction()

int unlang_interpret_push_instruction ( unlang_result_t p_result,
request_t request,
void *  instruction,
unlang_frame_conf_t const *  conf 
)

Push an instruction onto the request stack for later interpretation.

Definition at line 1166 of file interpret.c.

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

◆ unlang_interpret_push_section()

int unlang_interpret_push_section ( unlang_result_t p_result,
request_t request,
CONF_SECTION cs,
unlang_frame_conf_t const *  conf 
)

Push a configuration section onto the request stack for later interpretation.

Definition at line 1143 of file interpret.c.

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

◆ unlang_interpret_rcode()

rlm_rcode_t unlang_interpret_rcode ( request_t request)

Get the last instruction result OR the last frame that was popped.

Parameters
[in]requestThe current request.
Returns
the current rcode for the frame.

Definition at line 1541 of file interpret.c.

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

◆ unlang_interpret_request_detach()

static void unlang_interpret_request_detach ( request_t request)
inlinestatic

Tell the interpreter to detach the request.

This function should not be called directly use unlang_interpret_signal(request, FR_SIGNAL_DETACH) instead. This will ensure all frames on the request's stack receive the detach signal.

Definition at line 1286 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_interpret_request_done()

void unlang_interpret_request_done ( request_t request)

Indicate to the caller of the interpreter that this request is complete.

Definition at line 1255 of file interpret.c.

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

◆ unlang_interpret_request_prioritise()

void unlang_interpret_request_prioritise ( request_t request,
uint32_t  priority 
)

Definition at line 1300 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_interpret_result()

unlang_result_t * unlang_interpret_result ( request_t request)

Get the last instruction result OR the last frame that was popped.

Parameters
[in]requestThe current request.
Returns
the current result for the frame.

Definition at line 1561 of file interpret.c.

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

◆ unlang_interpret_set()

void unlang_interpret_set ( request_t request,
unlang_interpret_t intp 
)

Set a specific interpreter for a request.

Definition at line 1994 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_interpret_set_thread_default()

void unlang_interpret_set_thread_default ( unlang_interpret_t intp)

Set the default interpreter for this thread.

Definition at line 2025 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_interpret_set_timeout()

int unlang_interpret_set_timeout ( request_t request,
fr_time_delta_t  timeout 
)

Set a timeout for a request.

The timeout is associated with the current stack frame.

Definition at line 1504 of file interpret.c.

+ Here is the call graph for this function:

◆ unlang_interpret_signal()

void unlang_interpret_signal ( request_t request,
fr_signal_t  action 
)

Send a signal (usually stop) to a request.

This is typically called via an "async" action, i.e. an action outside of the normal processing of the request.

Note
This does NOT immediately stop the request, it just deliveres signals, and in the case of a cancel, marks up frames for unwinding and adds it to the runnable queue if it's yielded.
This function should be safe to call anywhere.
Parameters
[in]requestThe current request.
[in]actionto signal.

Definition at line 1396 of file interpret.c.

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

◆ unlang_interpret_stack_alloc()

void * unlang_interpret_stack_alloc ( TALLOC_CTX *  ctx)

Allocate a new unlang stack.

Parameters
[in]ctxto allocate stack in.
Returns
  • A new stack on success.
  • NULL on OOM.

Definition at line 1194 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_interpret_stack_depth()

int unlang_interpret_stack_depth ( request_t request)

Return the depth of the request's stack.

Definition at line 1529 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_request_is_cancelled()

bool unlang_request_is_cancelled ( request_t const *  request)

Return whether a request has been cancelled.

Definition at line 1579 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_request_is_done()

bool unlang_request_is_done ( request_t const *  request)

Return whether a request has been marked done.

Definition at line 1586 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_request_is_scheduled()

bool unlang_request_is_scheduled ( request_t const *  request)

Return whether a request is currently scheduled.

Definition at line 1569 of file interpret.c.

+ Here is the caller graph for this function:

◆ unlang_stack_signal()

void unlang_stack_signal ( request_t request,
fr_signal_t  action,
int  limit 
)

Delivers a frame to one or more frames in the stack.

This is typically called via an "async" action, i.e. an action outside of the normal processing of the request.

For FR_SIGNAL_CANCEL all frames are marked up for cancellation, but the cancellation is handled by the interpret.

Other signal types are delivered immediately, inrrespecitve of whether the request is currently being processed or not.

Signaling stops at the "limit" frame. This is so that keywords such as "timeout" and "limit" can signal frames lower than theirs to stop, but then continue with their own work.

Note
It's better (clearer) to use one of the unwind_* functions unless the entire request is being cancelled.
Parameters
[in]requestThe current request.
[in]actionto signal.
[in]limitthe frame at which to stop signaling.

Definition at line 1336 of file interpret.c.

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

Variable Documentation

◆ empty_group

unlang_group_t empty_group
static
Initial value:
= {
.self = {
.debug_name = "empty-group",
.actions = {
.actions = {
},
.retry = RETRY_INIT,
},
},
}
@ MOD_ACTION_RETURN
Definition mod_action.h:43
@ UNLANG_TYPE_GROUP
Grouping section.
Definition unlang_priv.h:49
#define RETRY_INIT
Definition retry.h:39

Definition at line 1119 of file interpret.c.

◆ intp_thread_default

_Thread_local unlang_interpret_t* intp_thread_default
static

The default interpreter instance for this thread.

Definition at line 43 of file interpret.c.

◆ result_p_location_table

fr_table_num_ordered_t const result_p_location_table[]
static
Initial value:
= {
{ L("frame"), RESULT_P_LOCATION_FRAME },
{ L("module_rctx"), RESULT_P_LOCATION_MODULE_RCTX },
{ L("scratch"), RESULT_P_LOCATION_SCRATCH },
{ L("state"), RESULT_P_LOCATION_STATE },
{ L("unknown"), RESULT_P_LOCATION_UNKNOWN }
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition build.h:209
@ RESULT_P_LOCATION_SCRATCH
Definition interpret.c:67
@ RESULT_P_LOCATION_MODULE_RCTX
Definition interpret.c:69
@ RESULT_P_LOCATION_STATE
Definition interpret.c:68
@ RESULT_P_LOCATION_FRAME
Definition interpret.c:66
@ RESULT_P_LOCATION_UNKNOWN
Definition interpret.c:65

Definition at line 137 of file interpret.c.

◆ result_p_location_table_len

size_t result_p_location_table_len = NUM_ELEMENTS(result_p_location_table)
static

Definition at line 144 of file interpret.c.

◆ unlang_action_table

fr_table_num_ordered_t const unlang_action_table[]
static
Initial value:
= {
{ L("calculate-result"), UNLANG_ACTION_CALCULATE_RESULT },
{ L("pushed-child"), UNLANG_ACTION_PUSHED_CHILD },
{ L("yield"), UNLANG_ACTION_YIELD }
}
@ UNLANG_ACTION_PUSHED_CHILD
unlang_t pushed a new child onto the stack, execute it instead of continuing.
Definition action.h:39
@ UNLANG_ACTION_EXECUTE_NEXT
Execute the next unlang_t.
Definition action.h:38
@ UNLANG_ACTION_STOP_PROCESSING
Break out of processing the current request (unwind).
Definition action.h:42
@ UNLANG_ACTION_CALCULATE_RESULT
Calculate a new section rlm_rcode_t value.
Definition action.h:37
@ UNLANG_ACTION_YIELD
Temporarily pause execution until an event occurs.
Definition action.h:41

Definition at line 45 of file interpret.c.

◆ unlang_action_table_len

size_t unlang_action_table_len = NUM_ELEMENTS(unlang_action_table)
static

Definition at line 52 of file interpret.c.

◆ unlang_cancel_xlat_args

xlat_arg_parser_t const unlang_cancel_xlat_args[]
static
Initial value:
= {
{ .required = false, .single = true, .type = FR_TYPE_TIME_DELTA },
}
@ FR_TYPE_TIME_DELTA
A period of time measured in nanoseconds.
#define XLAT_ARG_PARSER_TERMINATOR
Definition xlat.h:170

Definition at line 1676 of file interpret.c.

◆ unlang_frame_action_table

fr_table_num_ordered_t const unlang_frame_action_table[]
static
Initial value:
= {
}
@ UNLANG_FRAME_ACTION_POP
Pop the current frame, and check the next one further up in the stack for what to do next.
Definition unlang_priv.h:89
@ UNLANG_FRAME_ACTION_YIELD
Temporarily return control back to the caller on the C stack.
Definition unlang_priv.h:93
@ UNLANG_FRAME_ACTION_NEXT
Process the next instruction at this level.
Definition unlang_priv.h:92

Definition at line 54 of file interpret.c.

◆ unlang_frame_action_table_len

size_t unlang_frame_action_table_len = NUM_ELEMENTS(unlang_frame_action_table)
static

Definition at line 59 of file interpret.c.

◆ unlang_interpret_xlat_args

xlat_arg_parser_t const unlang_interpret_xlat_args[]
static
Initial value:
= {
{ .required = true, .single = true, .type = FR_TYPE_STRING },
}
@ FR_TYPE_STRING
String of printable characters.

Definition at line 1785 of file interpret.c.