The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
unlang_priv.h File Reference

Private interpreter structures and functions. More...

#include <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/server/map_proc.h>
#include <freeradius-devel/server/modpriv.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/unlang/base.h>
#include <freeradius-devel/io/listen.h>
+ Include dependency graph for unlang_priv.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  unlang_ext_t
 Describes how to allocate an unlang_group_t with additional memory keyword specific data. More...
 
struct  unlang_group_t
 Generic representation of a grouping. More...
 
struct  unlang_op_t
 An unlang operation. More...
 
struct  unlang_retry_t
 
struct  unlang_s
 A node in a graph of unlang_op_t (s) that we execute. More...
 
struct  unlang_stack_frame_s
 Our interpreter stack, as distinct from the C stack. More...
 
struct  unlang_stack_t
 An unlang stack associated with a request. More...
 
struct  unlang_thread_t
 
struct  unlang_tmpl_t
 A naked xlat. More...
 
struct  unlang_variable_t
 

Macros

#define MOD_ACTION_REJECT   (-2)
 
#define MOD_ACTION_RETRY   (-3)
 
#define MOD_ACTION_RETURN   (-1)
 
#define MOD_NUM_TYPES   (UNLANG_TYPE_XLAT + 1)
 
#define MOD_PRIORITY_MAX   (64)
 
#define UNLANG_DETACHABLE   (true)
 
#define unlang_frame_perf_cleanup(_x)
 
#define unlang_frame_perf_init(_x)
 
#define unlang_frame_perf_resume(_x)
 
#define unlang_frame_perf_yield(_x)
 
#define UNLANG_NEXT_SIBLING   (true)
 
#define UNLANG_NEXT_STOP   (false)
 
#define UNLANG_NORMAL_CHILD   (false)
 
#define UNWIND_FLAG_BREAK_POINT   0x04
 'break' stops here. More...
 
#define UNWIND_FLAG_NO_CLEAR   0x10
 Keep unwinding, don't clear the unwind flag. More...
 
#define UNWIND_FLAG_NONE   0x00
 No flags. More...
 
#define UNWIND_FLAG_REPEAT   0x01
 Repeat the frame on the way up the stack. More...
 
#define UNWIND_FLAG_RETURN_POINT   0x08
 'return' stops here. More...
 
#define UNWIND_FLAG_TOP_FRAME   0x02
 are we the top frame of the stack? More...
 
#define UNWIND_FLAG_YIELDED   0x20
 frame has yielded More...
 

Typedefs

typedef void(* unlang_dump_t) (request_t *request, unlang_stack_frame_t *frame)
 Custom callback for dumping information about frame state. More...
 
typedef unlang_action_t(* unlang_process_t) (rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
 Function to call when interpreting a frame. More...
 
typedef void(* unlang_signal_t) (request_t *request, unlang_stack_frame_t *frame, fr_signal_t action)
 Function to call if the request was signalled. More...
 
typedef struct unlang_stack_frame_s unlang_stack_frame_t
 
typedef struct unlang_s unlang_t
 
typedef int(* unlang_thread_instantiate_t) (unlang_t const *instruction, void *thread_inst)
 

Enumerations

enum  unlang_frame_action_t {
  UNLANG_FRAME_ACTION_POP = 1 ,
  UNLANG_FRAME_ACTION_RETRY ,
  UNLANG_FRAME_ACTION_NEXT ,
  UNLANG_FRAME_ACTION_YIELD
}
 Allows the frame evaluator to signal the interpreter. More...
 
enum  unlang_type_t {
  UNLANG_TYPE_NULL = 0 ,
  UNLANG_TYPE_MODULE = 1 ,
  UNLANG_TYPE_FUNCTION ,
  UNLANG_TYPE_GROUP ,
  UNLANG_TYPE_REDUNDANT ,
  UNLANG_TYPE_LOAD_BALANCE ,
  UNLANG_TYPE_REDUNDANT_LOAD_BALANCE ,
  UNLANG_TYPE_PARALLEL ,
  UNLANG_TYPE_IF ,
  UNLANG_TYPE_ELSE ,
  UNLANG_TYPE_ELSIF ,
  UNLANG_TYPE_UPDATE ,
  UNLANG_TYPE_SWITCH ,
  UNLANG_TYPE_CASE ,
  UNLANG_TYPE_FOREACH ,
  UNLANG_TYPE_BREAK ,
  UNLANG_TYPE_RETURN ,
  UNLANG_TYPE_MAP ,
  UNLANG_TYPE_SUBREQUEST ,
  UNLANG_TYPE_DETACH ,
  UNLANG_TYPE_CALL ,
  UNLANG_TYPE_CALLER ,
  UNLANG_TYPE_TIMEOUT ,
  UNLANG_TYPE_LIMIT ,
  UNLANG_TYPE_TRANSACTION ,
  UNLANG_TYPE_TRY ,
  UNLANG_TYPE_CATCH ,
  UNLANG_TYPE_POLICY ,
  UNLANG_TYPE_XLAT ,
  UNLANG_TYPE_TMPL ,
  UNLANG_TYPE_EDIT ,
  UNLANG_TYPE_MAX
}
 Types of unlang_t nodes. More...
 

Functions

static void break_point_clear (unlang_stack_frame_t *frame)
 
static void break_point_set (unlang_stack_frame_t *frame)
 
static void frame_cleanup (unlang_stack_frame_t *frame)
 Cleanup any lingering frame state. More...
 
static unlang_stack_frame_tframe_current (request_t *request)
 
static void frame_next (unlang_stack_t *stack, unlang_stack_frame_t *frame)
 Advance to the next sibling instruction. More...
 
static void frame_pop (request_t *request, unlang_stack_t *stack)
 Pop a stack frame, removing any associated dynamically allocated state. More...
 
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. More...
 
static void frame_state_init (unlang_stack_t *stack, unlang_stack_frame_t *frame)
 
static bool is_break_point (unlang_stack_frame_t const *frame)
 
static bool is_repeatable (unlang_stack_frame_t const *frame)
 
static bool is_return_point (unlang_stack_frame_t const *frame)
 
static bool is_stack_unwinding_to_break (unlang_stack_t *stack)
 
static bool is_stack_unwinding_to_return (unlang_stack_t *stack)
 
static bool is_stack_unwinding_to_top_frame (unlang_stack_t *stack)
 
static bool is_top_frame (unlang_stack_frame_t const *frame)
 
static bool is_yielded (unlang_stack_frame_t const *frame)
 
static void repeatable_clear (unlang_stack_frame_t *frame)
 
static void repeatable_set (unlang_stack_frame_t *frame)
 
static void return_point_clear (unlang_stack_frame_t *frame)
 
static void return_point_set (unlang_stack_frame_t *frame)
 
static int stack_depth_current (request_t *request)
 
static void stack_unwind_break_clear (unlang_stack_t *stack)
 
static void stack_unwind_return_clear (unlang_stack_t *stack)
 
static void stack_unwind_top_frame_clear (unlang_stack_t *stack)
 
static void top_frame_clear (unlang_stack_frame_t *frame)
 
static void top_frame_set (unlang_stack_frame_t *frame)
 
void unlang_frame_signal (request_t *request, fr_signal_t action, int limit)
 Send a signal (usually stop) to a request. More...
 
void * unlang_thread_instance (unlang_t const *instruction)
 Get the thread-instance data for an instruction. More...
 
static unlang_action_t unwind_all (unlang_stack_t *stack)
 
static unlang_action_t unwind_to_break (unlang_stack_t *stack)
 
static unlang_action_t unwind_to_return (unlang_stack_t *stack)
 
static void yielded_clear (unlang_stack_frame_t *frame)
 
static void yielded_set (unlang_stack_frame_t *frame)
 

Variables

fr_table_num_sorted_t const mod_rcode_table []
 
size_t mod_rcode_table_len
 
unlang_op_t unlang_ops []
 Different operations the interpreter can execute. More...
 

Conversion functions for converting #unlang_t to its specialisations

Simple conversions: unlang_module_t and unlang_group_t are subclasses of unlang_t, so we often want to go back and forth between them.

static unlang_group_tunlang_generic_to_group (unlang_t const *p)
 
static unlang_tmpl_tunlang_generic_to_tmpl (unlang_t const *p)
 
static unlang_tunlang_group_to_generic (unlang_group_t const *p)
 
static unlang_tunlang_tmpl_to_generic (unlang_tmpl_t const *p)
 

Internal interpreter functions needed by ops

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. More...
 
unlang_action_t unlang_interpret_push_children (rlm_rcode_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. More...
 
void unlang_op_free (void)
 
int unlang_op_init (void)
 

io shims

Functions to simulate a 'proto' module when we're running 'fake' requests.

i.e. those created by parallel and subrequest.

request_tunlang_io_subrequest_alloc (request_t *parent, fr_dict_t const *namespace, bool detachable)
 Allocate a child request based on the parent. More...
 

op init functions

Functions to trigger registration of the various unlang ops.

void unlang_call_init (void)
 
void unlang_caller_init (void)
 
void unlang_catch_init (void)
 
void unlang_condition_init (void)
 
void unlang_detach_init (void)
 Initialise subrequest ops. More...
 
void unlang_edit_init (void)
 
void unlang_foreach_init (TALLOC_CTX *ctx)
 
void unlang_function_init (void)
 
void unlang_group_init (void)
 
void unlang_limit_init (void)
 
void unlang_load_balance_init (void)
 
void unlang_map_init (void)
 
void unlang_module_init (void)
 
void unlang_parallel_init (void)
 
void unlang_register (int type, unlang_op_t *op)
 Register an operation with the interpreter. More...
 
void unlang_return_init (void)
 
void unlang_subrequest_op_free (void)
 
int unlang_subrequest_op_init (void)
 Initialise subrequest ops. More...
 
void unlang_switch_init (void)
 
void unlang_timeout_init (void)
 
void unlang_tmpl_init (void)
 
void unlang_transaction_init (void)
 
void unlang_try_init (void)
 

Detailed Description

Private interpreter structures and functions.

Id
96e2988aba29389960b1d0c4e52e463bd03bae06
Author
Alan DeKok (aland.nosp@m.@fre.nosp@m.eradi.nosp@m.us.o.nosp@m.rg)

Definition in file unlang_priv.h.


Data Structure Documentation

◆ unlang_ext_t

struct unlang_ext_t

Describes how to allocate an unlang_group_t with additional memory keyword specific data.

Definition at line 137 of file unlang_priv.h.

Data Fields
size_t len Total length of the unlang_group_t + specialisation struct.
unsigned pool_headers How much additional space to allocate for chunk headers.
size_t pool_len How much additional space to allocate for extensions.
unlang_type_t type Keyword.
char const * type_name Talloc type name.

◆ unlang_group_t

struct unlang_group_t

Generic representation of a grouping.

Can represent IF statements, maps, update sections etc...

Definition at line 155 of file unlang_priv.h.

+ Collaboration diagram for unlang_group_t:
Data Fields
unlang_t * children Children beneath this group.

The body of an if section for example.

CONF_SECTION * cs
int num_children
unlang_t self
unlang_t ** tail pointer to the tail which gets updated
unlang_variable_t * variables rarely used, so we don't usually need it

◆ unlang_op_t

struct unlang_op_t

An unlang operation.

These are like the opcodes in other interpreters. Each operation, when executed will return an unlang_action_t, which determines what the interpreter does next.

Definition at line 214 of file unlang_priv.h.

+ Collaboration diagram for unlang_op_t:
Data Fields
bool debug_braces Whether the operation needs to print braces in debug mode.
unlang_dump_t dump Dump additional information about the frame state.
size_t frame_state_pool_objects How many sub-allocations we expect.
size_t frame_state_pool_size The total size of the pool to alloc.
size_t frame_state_size size of instance data in the stack frame
char const * frame_state_type talloc name of the frame instance data
unlang_process_t interpret Function to interpret the keyword.
char const * name Name of the operation.
unlang_signal_t signal Function to signal stop / dup / whatever.
size_t thread_inst_size
char const * thread_inst_type
unlang_thread_instantiate_t thread_instantiate per-thread instantiation function

◆ unlang_retry_t

struct unlang_retry_t

Definition at line 267 of file unlang_priv.h.

+ Collaboration diagram for unlang_retry_t:
Data Fields
uint32_t count
int depth of this retry structure
fr_event_timer_t const * ev
request_t * request
fr_retry_state_t state
fr_time_t timeout

◆ unlang_s

struct unlang_s

A node in a graph of unlang_op_t (s) that we execute.

The interpreter acts like a turing machine, with unlang_t nodes forming the tape and the unlang_action_t the instructions.

This is the parent 'class' for multiple unlang_t node specialisations. The unlang_t struct is listed first in the specialisation so that we can cast between parent/child classes without knowledge of the layout of the structures.

The specialisations of the nodes describe additional details of the operation to be performed.

Definition at line 122 of file unlang_priv.h.

+ Collaboration diagram for unlang_s:
Data Fields
unlang_actions_t actions Priorities, etc. for the various return codes.
CONF_ITEM * ci used to generate this item
bool closed whether or not this section is closed to new statements
char const * debug_name Printed in log messages when the node is executed.
char const * name Unknown...
unlang_t * next Next node (executed on UNLANG_ACTION_EXECUTE_NEXT et al).
unsigned int number unique node number
unlang_t * parent Previous node.
unlang_type_t type The specialisation of this node.

◆ unlang_stack_frame_s

struct unlang_stack_frame_s

Our interpreter stack, as distinct from the C stack.

We don't call the modules recursively. Instead we iterate over a list of unlang_t and and manage the call stack ourselves.

After looking at various green thread implementations, it was decided that using the existing unlang interpreter stack was the best way to perform async I/O.

Each request as an unlang interpreter stack associated with it, which represents its progress through the server. Because the interpreter stack is distinct from the C stack, we can have a single system thread with many thousands of pending requests.

Definition at line 288 of file unlang_priv.h.

+ Collaboration diagram for unlang_stack_frame_s:
Data Fields
unlang_t const * instruction The unlang node we're evaluating.
unlang_t const * next The next unlang node we will evaluate.
int priority Result priority.

When we pop this stack frame this priority will be compared with the one of the frame lower in the stack to determine if the result stored in the lower stack frame should

unlang_process_t process function to call for interpreting this stack frame
rlm_rcode_t result The result from executing the instruction.
unlang_retry_t * retry if the frame is being retried.
unlang_signal_t signal function to call when signalling this stack frame
void * state Stack frame specialisations.

These store extra (mutable) state data, for the immutable (unlang_t) instruction. Instructions can't be used to store data because they might be shared between multiple threads.

Which stack_entry specialisation to use is determined by the instruction->type.

uint8_t uflags Unwind markers.

◆ unlang_stack_t

struct unlang_stack_t

An unlang stack associated with a request.

Definition at line 322 of file unlang_priv.h.

+ Collaboration diagram for unlang_stack_t:
Data Fields
int depth Current depth we're executing at.
unlang_stack_frame_t frame[UNLANG_STACK_MAX] The stack...
unlang_interpret_t * intp Interpreter that the request is currently associated with.
int priority Current priority.
rlm_rcode_t result The current stack rcode.
uint8_t unwind Unwind to this frame if it exists.

This is used for break and return.

◆ unlang_thread_t

struct unlang_thread_t

Definition at line 240 of file unlang_priv.h.

+ Collaboration diagram for unlang_thread_t:
Data Fields
unlang_t const * instruction instruction which we're executing
void * thread_inst thread-specific instance data

◆ unlang_tmpl_t

struct unlang_tmpl_t

A naked xlat.

Note
These are vestigial and may be removed in future.

Definition at line 170 of file unlang_priv.h.

+ Collaboration diagram for unlang_tmpl_t:
Data Fields
unlang_t self
tmpl_t const * tmpl

◆ unlang_variable_t

struct unlang_variable_t

Definition at line 145 of file unlang_priv.h.

+ Collaboration diagram for unlang_variable_t:
Data Fields
fr_dict_t * dict our dictionary
int max_attr 1..N local attributes have been defined
fr_dict_attr_t const * root the root of our dictionary

Macro Definition Documentation

◆ MOD_ACTION_REJECT

#define MOD_ACTION_REJECT   (-2)

Definition at line 45 of file unlang_priv.h.

◆ MOD_ACTION_RETRY

#define MOD_ACTION_RETRY   (-3)

Definition at line 46 of file unlang_priv.h.

◆ MOD_ACTION_RETURN

#define MOD_ACTION_RETURN   (-1)

Definition at line 44 of file unlang_priv.h.

◆ MOD_NUM_TYPES

#define MOD_NUM_TYPES   (UNLANG_TYPE_XLAT + 1)

Definition at line 337 of file unlang_priv.h.

◆ MOD_PRIORITY_MAX

#define MOD_PRIORITY_MAX   (64)

Definition at line 47 of file unlang_priv.h.

◆ UNLANG_DETACHABLE

#define UNLANG_DETACHABLE   (true)

Definition at line 105 of file unlang_priv.h.

◆ unlang_frame_perf_cleanup

#define unlang_frame_perf_cleanup (   _x)

Definition at line 262 of file unlang_priv.h.

◆ unlang_frame_perf_init

#define unlang_frame_perf_init (   _x)

Definition at line 259 of file unlang_priv.h.

◆ unlang_frame_perf_resume

#define unlang_frame_perf_resume (   _x)

Definition at line 261 of file unlang_priv.h.

◆ unlang_frame_perf_yield

#define unlang_frame_perf_yield (   _x)

Definition at line 260 of file unlang_priv.h.

◆ UNLANG_NEXT_SIBLING

#define UNLANG_NEXT_SIBLING   (true)

Definition at line 103 of file unlang_priv.h.

◆ UNLANG_NEXT_STOP

#define UNLANG_NEXT_STOP   (false)

Definition at line 102 of file unlang_priv.h.

◆ UNLANG_NORMAL_CHILD

#define UNLANG_NORMAL_CHILD   (false)

Definition at line 106 of file unlang_priv.h.

◆ UNWIND_FLAG_BREAK_POINT

#define UNWIND_FLAG_BREAK_POINT   0x04

'break' stops here.

Definition at line 348 of file unlang_priv.h.

◆ UNWIND_FLAG_NO_CLEAR

#define UNWIND_FLAG_NO_CLEAR   0x10

Keep unwinding, don't clear the unwind flag.

Definition at line 350 of file unlang_priv.h.

◆ UNWIND_FLAG_NONE

#define UNWIND_FLAG_NONE   0x00

No flags.

Definition at line 342 of file unlang_priv.h.

◆ UNWIND_FLAG_REPEAT

#define UNWIND_FLAG_REPEAT   0x01

Repeat the frame on the way up the stack.

Definition at line 343 of file unlang_priv.h.

◆ UNWIND_FLAG_RETURN_POINT

#define UNWIND_FLAG_RETURN_POINT   0x08

'return' stops here.

Definition at line 349 of file unlang_priv.h.

◆ UNWIND_FLAG_TOP_FRAME

#define UNWIND_FLAG_TOP_FRAME   0x02

are we the top frame of the stack?

If true, causes the interpreter to stop interpreting and return, control then passes to whatever called the interpreter.

Definition at line 347 of file unlang_priv.h.

◆ UNWIND_FLAG_YIELDED

#define UNWIND_FLAG_YIELDED   0x20

frame has yielded

Definition at line 351 of file unlang_priv.h.

Typedef Documentation

◆ unlang_dump_t

typedef void(* unlang_dump_t) (request_t *request, unlang_stack_frame_t *frame)

Custom callback for dumping information about frame state.

Parameters
[in]requestThe current request.
[in]frameto provide additional information for.

Definition at line 205 of file unlang_priv.h.

◆ unlang_process_t

typedef unlang_action_t(* unlang_process_t) (rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)

Function to call when interpreting a frame.

Parameters
[in,out]p_resultPointer to the current rcode, may be modified by the function.
[in]requestThe current request.
[in]framebeing executed.
Returns
an action for the interpreter to perform.

Definition at line 183 of file unlang_priv.h.

◆ unlang_signal_t

typedef void(* unlang_signal_t) (request_t *request, unlang_stack_frame_t *frame, fr_signal_t action)

Function to call if the request was signalled.

This is the instruction specific cancellation function. This function will usually either call a more specialised cancellation function set when something like a module yielded, or just cleanup the state of the original unlang_process_t.

Parameters
[in]requestThe current request.
[in]framebeing signalled.
[in]actionWe're being signalled with.

Definition at line 197 of file unlang_priv.h.

◆ unlang_stack_frame_t

Definition at line 1 of file unlang_priv.h.

◆ unlang_t

typedef struct unlang_s unlang_t

Definition at line 1 of file unlang_priv.h.

◆ unlang_thread_instantiate_t

typedef int(* unlang_thread_instantiate_t) (unlang_t const *instruction, void *thread_inst)

Definition at line 207 of file unlang_priv.h.

Enumeration Type Documentation

◆ unlang_frame_action_t

Allows the frame evaluator to signal the interpreter.

Enumerator
UNLANG_FRAME_ACTION_POP 

Pop the current frame, and check the next one further up in the stack for what to do next.

UNLANG_FRAME_ACTION_RETRY 

retry the current frame

UNLANG_FRAME_ACTION_NEXT 

Process the next instruction at this level.

UNLANG_FRAME_ACTION_YIELD 

Temporarily return control back to the caller on the C stack.

Definition at line 93 of file unlang_priv.h.

◆ unlang_type_t

Types of unlang_t nodes.

Here are our basic types: unlang_t, unlang_group_t, and unlang_module_t. For an explanation of what they are all about, see doc/unlang/configurable_failover.adoc

Enumerator
UNLANG_TYPE_NULL 

unlang type not set.

UNLANG_TYPE_MODULE 

Module method.

UNLANG_TYPE_FUNCTION 

Internal call to a function or submodule.

UNLANG_TYPE_GROUP 

Grouping section.

UNLANG_TYPE_REDUNDANT 

exactly like group, but with different default return codes

UNLANG_TYPE_LOAD_BALANCE 

Load balance section.

UNLANG_TYPE_REDUNDANT_LOAD_BALANCE 

Redundant load balance section.

UNLANG_TYPE_PARALLEL 

execute statements in parallel

UNLANG_TYPE_IF 

Condition.

UNLANG_TYPE_ELSE 

!Condition.

UNLANG_TYPE_ELSIF 

!Condition && Condition.

UNLANG_TYPE_UPDATE 

Update block.

UNLANG_TYPE_SWITCH 

Switch section.

UNLANG_TYPE_CASE 

Case section (within a UNLANG_TYPE_SWITCH).

UNLANG_TYPE_FOREACH 

Foreach section.

UNLANG_TYPE_BREAK 

Break statement (within a UNLANG_TYPE_FOREACH).

UNLANG_TYPE_RETURN 

Return statement.

UNLANG_TYPE_MAP 

Mapping section (like UNLANG_TYPE_UPDATE, but uses values from a map_proc_t call).

UNLANG_TYPE_SUBREQUEST 

create a child subrequest

UNLANG_TYPE_DETACH 

detach a child

UNLANG_TYPE_CALL 

call another virtual server

UNLANG_TYPE_CALLER 

conditionally check parent dictionary type

UNLANG_TYPE_TIMEOUT 

time-based timeouts.

UNLANG_TYPE_LIMIT 

limit number of requests in a section

UNLANG_TYPE_TRANSACTION 

transactions for editing lists

UNLANG_TYPE_TRY 

try / catch blocks

UNLANG_TYPE_CATCH 

catch a previous try

UNLANG_TYPE_POLICY 

Policy section.

UNLANG_TYPE_XLAT 

Represents one level of an xlat expansion.

UNLANG_TYPE_TMPL 

asynchronously expand a tmpl_t

UNLANG_TYPE_EDIT 

edit VPs in place. After 20 years!

UNLANG_TYPE_MAX 

Definition at line 54 of file unlang_priv.h.

Function Documentation

◆ break_point_clear()

static void break_point_clear ( unlang_stack_frame_t frame)
inlinestatic

Definition at line 361 of file unlang_priv.h.

◆ break_point_set()

static void break_point_set ( unlang_stack_frame_t frame)
inlinestatic

Definition at line 355 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ frame_cleanup()

static void frame_cleanup ( unlang_stack_frame_t frame)
inlinestatic

Cleanup any lingering frame state.

Definition at line 456 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ frame_current()

static unlang_stack_frame_t* frame_current ( request_t request)
inlinestatic

Definition at line 394 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ frame_next()

static void frame_next ( unlang_stack_t stack,
unlang_stack_frame_t frame 
)
inlinestatic

Advance to the next sibling instruction.

Definition at line 473 of file unlang_priv.h.

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

◆ frame_pop()

static void frame_pop ( request_t request,
unlang_stack_t stack 
)
inlinestatic

Pop a stack frame, removing any associated dynamically allocated state.

Parameters
[in]requestThe current request.
[in]stackframe to pop.

Definition at line 490 of file unlang_priv.h.

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

◆ frame_repeat()

static void frame_repeat ( unlang_stack_frame_t frame,
unlang_process_t  process 
)
inlinestatic

Mark the current stack frame up for repeat, and set a new process function.

Definition at line 526 of file unlang_priv.h.

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

◆ frame_state_init()

static void frame_state_init ( unlang_stack_t stack,
unlang_stack_frame_t frame 
)
inlinestatic

Definition at line 408 of file unlang_priv.h.

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

◆ is_break_point()

static bool is_break_point ( unlang_stack_frame_t const *  frame)
inlinestatic

Definition at line 367 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ is_repeatable()

static bool is_repeatable ( unlang_stack_frame_t const *  frame)
inlinestatic

Definition at line 365 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ is_return_point()

static bool is_return_point ( unlang_stack_frame_t const *  frame)
inlinestatic

Definition at line 368 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ is_stack_unwinding_to_break()

static bool is_stack_unwinding_to_break ( unlang_stack_t stack)
inlinestatic

Definition at line 388 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ is_stack_unwinding_to_return()

static bool is_stack_unwinding_to_return ( unlang_stack_t stack)
inlinestatic

Definition at line 389 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ is_stack_unwinding_to_top_frame()

static bool is_stack_unwinding_to_top_frame ( unlang_stack_t stack)
inlinestatic

Definition at line 387 of file unlang_priv.h.

◆ is_top_frame()

static bool is_top_frame ( unlang_stack_frame_t const *  frame)
inlinestatic

Definition at line 366 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ is_yielded()

static bool is_yielded ( unlang_stack_frame_t const *  frame)
inlinestatic

Definition at line 369 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ repeatable_clear()

static void repeatable_clear ( unlang_stack_frame_t frame)
inlinestatic

Definition at line 359 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ repeatable_set()

static void repeatable_set ( unlang_stack_frame_t frame)
inlinestatic

Definition at line 353 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ return_point_clear()

static void return_point_clear ( unlang_stack_frame_t frame)
inlinestatic

Definition at line 362 of file unlang_priv.h.

◆ return_point_set()

static void return_point_set ( unlang_stack_frame_t frame)
inlinestatic

Definition at line 356 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ stack_depth_current()

static int stack_depth_current ( request_t request)
inlinestatic

Definition at line 401 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ stack_unwind_break_clear()

static void stack_unwind_break_clear ( unlang_stack_t stack)
inlinestatic

Definition at line 391 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ stack_unwind_return_clear()

static void stack_unwind_return_clear ( unlang_stack_t stack)
inlinestatic

Definition at line 392 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ stack_unwind_top_frame_clear()

static void stack_unwind_top_frame_clear ( unlang_stack_t stack)
inlinestatic

Definition at line 390 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ top_frame_clear()

static void top_frame_clear ( unlang_stack_frame_t frame)
inlinestatic

Definition at line 360 of file unlang_priv.h.

◆ top_frame_set()

static void top_frame_set ( unlang_stack_frame_t frame)
inlinestatic

Definition at line 354 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ unlang_call_init()

void unlang_call_init ( void  )

Definition at line 249 of file call.c.

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

◆ unlang_caller_init()

void unlang_caller_init ( void  )

Definition at line 55 of file caller.c.

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

◆ unlang_catch_init()

void unlang_catch_init ( void  )

Definition at line 113 of file catch.c.

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

◆ unlang_condition_init()

void unlang_condition_init ( void  )

Definition at line 110 of file condition.c.

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

◆ unlang_detach_init()

void unlang_detach_init ( void  )

Initialise subrequest ops.

Definition at line 54 of file detach.c.

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

◆ unlang_edit_init()

void unlang_edit_init ( void  )

Definition at line 1700 of file edit.c.

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

◆ unlang_foreach_init()

void unlang_foreach_init ( TALLOC_CTX *  ctx)

Definition at line 260 of file foreach.c.

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

◆ unlang_frame_signal()

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

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.

If there is no unlang_module_signal_t callback defined, the action is ignored.

The 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.

Parameters
[in]requestThe current request.
[in]actionto signal.
[in]limitthe frame at which to stop signaling.

Definition at line 1130 of file interpret.c.

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

◆ unlang_function_init()

void unlang_function_init ( void  )

Definition at line 337 of file function.c.

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

◆ unlang_generic_to_group()

static unlang_group_t* unlang_generic_to_group ( unlang_t const *  p)
inlinestatic

Definition at line 539 of file unlang_priv.h.

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

◆ unlang_generic_to_tmpl()

static unlang_tmpl_t* unlang_generic_to_tmpl ( unlang_t const *  p)
inlinestatic

Definition at line 551 of file unlang_priv.h.

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

◆ unlang_group_init()

void unlang_group_init ( void  )

Definition at line 46 of file group.c.

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

◆ unlang_group_to_generic()

static unlang_t* unlang_group_to_generic ( unlang_group_t const *  p)
inlinestatic

Definition at line 546 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ unlang_interpret_push()

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.

Parameters
[in]requestto push the frame onto.
[in]instructionOne or more unlang_t nodes describing the operations to execute.
[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.
[in]top_frameReturn out of the unlang interpret when popping this frame. Hands execution back to whatever called the interpret.
Returns
  • 0 on success.
  • -1 on call stack too deep.

Definition at line 161 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 ( rlm_rcode_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 243 of file interpret.c.

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

◆ unlang_io_subrequest_alloc()

request_t* unlang_io_subrequest_alloc ( request_t parent,
fr_dict_t const *  namespace,
bool  detachable 
)

Allocate a child request based on the parent.

Parameters
[in]parentspawning the child request.
[in]namespacethe child request operates in. If NULL the parent's namespace is used.
[in]detachableAllow/disallow the child to be detached.
Returns
  • The new child request.
  • NULL on error.

Definition at line 39 of file io.c.

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

◆ unlang_limit_init()

void unlang_limit_init ( void  )

Definition at line 124 of file limit.c.

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

◆ unlang_load_balance_init()

void unlang_load_balance_init ( void  )

Definition at line 248 of file load_balance.c.

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

◆ unlang_map_init()

void unlang_map_init ( void  )

Definition at line 374 of file map.c.

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

◆ unlang_module_init()

void unlang_module_init ( void  )

Definition at line 1067 of file module.c.

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

◆ unlang_op_free()

void unlang_op_free ( void  )

◆ unlang_op_init()

int unlang_op_init ( void  )

◆ unlang_parallel_init()

void unlang_parallel_init ( void  )

Definition at line 493 of file parallel.c.

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

◆ unlang_register()

void unlang_register ( int  type,
unlang_op_t op 
)

Register an operation with the interpreter.

The main purpose of this registration API is to avoid intermixing the xlat, condition, map APIs with the interpreter, i.e. the callbacks needed for that functionality can be in their own source files, and we don't need to include supporting types and function declarations in the interpreter.

Later, this could potentially be used to register custom operations for modules.

The reason why there's a function instead of accessing the unlang_op array directly, is because 'type' really needs to go away, as needing to add ops to the unlang_type_t enum breaks the pluggable module model. If there's no explicit/consistent type values we need to enumerate the operations ourselves.

Parameters
[in]typeOperation identifier. Used to map compiled unlang code to operations.
[in]opunlang_op to register.

Definition at line 65 of file base.c.

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

◆ unlang_return_init()

void unlang_return_init ( void  )

Definition at line 43 of file return.c.

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

◆ unlang_subrequest_op_free()

void unlang_subrequest_op_free ( void  )

Definition at line 291 of file subrequest.c.

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

◆ unlang_subrequest_op_init()

int unlang_subrequest_op_init ( void  )

Initialise subrequest ops.

Definition at line 274 of file subrequest.c.

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

◆ unlang_switch_init()

void unlang_switch_init ( void  )

Definition at line 142 of file switch.c.

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

◆ unlang_thread_instance()

void* unlang_thread_instance ( unlang_t const *  instruction)

Get the thread-instance data for an instruction.

Parameters
[in]instructionthe instruction to use
Returns
a pointer to thread-local data

Definition at line 5011 of file compile.c.

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

◆ unlang_timeout_init()

void unlang_timeout_init ( void  )

Definition at line 140 of file timeout.c.

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

◆ unlang_tmpl_init()

void unlang_tmpl_init ( void  )

Definition at line 327 of file tmpl.c.

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

◆ unlang_tmpl_to_generic()

static unlang_t* unlang_tmpl_to_generic ( unlang_tmpl_t const *  p)
inlinestatic

Definition at line 557 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ unlang_transaction_init()

void unlang_transaction_init ( void  )

Definition at line 123 of file transaction.c.

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

◆ unlang_try_init()

void unlang_try_init ( void  )

Definition at line 42 of file try.c.

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

◆ unwind_all()

static unlang_action_t unwind_all ( unlang_stack_t stack)
inlinestatic

Definition at line 381 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ unwind_to_break()

static unlang_action_t unwind_to_break ( unlang_stack_t stack)
inlinestatic

Definition at line 371 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ unwind_to_return()

static unlang_action_t unwind_to_return ( unlang_stack_t stack)
inlinestatic

Definition at line 376 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ yielded_clear()

static void yielded_clear ( unlang_stack_frame_t frame)
inlinestatic

Definition at line 363 of file unlang_priv.h.

+ Here is the caller graph for this function:

◆ yielded_set()

static void yielded_set ( unlang_stack_frame_t frame)
inlinestatic

Definition at line 357 of file unlang_priv.h.

+ Here is the caller graph for this function:

Variable Documentation

◆ mod_rcode_table

fr_table_num_sorted_t const mod_rcode_table[]
extern

Definition at line 72 of file compile.c.

◆ mod_rcode_table_len

size_t mod_rcode_table_len
extern

Definition at line 84 of file compile.c.

◆ unlang_ops

unlang_op_t unlang_ops[]
extern

Different operations the interpreter can execute.

Definition at line 33 of file base.c.