The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Functions | Variables
foreach.c File Reference

Unlang "foreach" keyword evaluation. More...

#include <freeradius-devel/server/request_data.h>
#include <freeradius-devel/server/tmpl_dcursor.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include "foreach_priv.h"
#include "return_priv.h"
#include "xlat_priv.h"
+ Include dependency graph for foreach.c:

Go to the source code of this file.

Data Structures

struct  unlang_frame_state_foreach_t
 State of a foreach loop. More...
 

Macros

#define BUFFER_SIZE   (256)
 
#define FOREACH_REQUEST_DATA   (void *)unlang_foreach_xlat_func
 

Functions

static int _free_unlang_frame_state_foreach (unlang_frame_state_foreach_t *state)
 Ensure request data is pulled out of the request if the frame is popped. More...
 
static unlang_action_t unlang_break (rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
 
static unlang_action_t unlang_foreach (rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
 
static unlang_action_t unlang_foreach_attr_init (rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame, unlang_frame_state_foreach_t *state)
 
static void unlang_foreach_attr_key_update (UNUSED request_t *request, unlang_frame_state_foreach_t *state)
 
static unlang_action_t unlang_foreach_attr_next (rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
 
void unlang_foreach_init (TALLOC_CTX *ctx)
 
static unlang_action_t unlang_foreach_next_old (rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
 
static int unlang_foreach_pair_copy (fr_pair_t *to, fr_pair_t *from, fr_dict_attr_t const *from_parent)
 
static unlang_action_t unlang_foreach_xlat_expanded (rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
 
static xlat_action_t unlang_foreach_xlat_func (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, UNUSED fr_value_box_list_t *in)
 Implements the Foreach-Variable-X. More...
 
static unlang_action_t unlang_foreach_xlat_init (rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame, unlang_frame_state_foreach_t *state)
 
static int unlang_foreach_xlat_key_update (request_t *request, unlang_frame_state_foreach_t *state)
 
static unlang_action_t unlang_foreach_xlat_next (rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
 

Variables

static int xlat_foreach_inst [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
 
static char const *const xlat_foreach_names []
 

Detailed Description

Unlang "foreach" keyword evaluation.

Id
ae1abd172f1c138f3a209e97cb6fb630feeca3db

Definition in file foreach.c.


Data Structure Documentation

◆ unlang_frame_state_foreach_t

struct unlang_frame_state_foreach_t

State of a foreach loop.

Definition at line 53 of file foreach.c.

+ Collaboration diagram for unlang_frame_state_foreach_t:
Data Fields
char * buffer for key values
tmpl_dcursor_ctx_t cc tmpl cursor state

we're iterating over.

fr_dcursor_t cursor Used to track our place in the list.
int depth Level of nesting of this foreach loop.
int indent for catching indentation issues
uint32_t index for xlat results
fr_pair_t * key local variable which contains the key
fr_value_box_list_t list value box list for looping over xlats
request_t * request The current request.
bool success for xlat expansion
fr_pair_t * value local variable which contains the value
fr_pair_list_t vps List containing the attribute(s) we're iterating over.
tmpl_t const * vpt pointer to the vpt

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE   (256)

Definition at line 48 of file foreach.c.

◆ FOREACH_REQUEST_DATA

#define FOREACH_REQUEST_DATA   (void *)unlang_foreach_xlat_func

Definition at line 148 of file foreach.c.

Function Documentation

◆ _free_unlang_frame_state_foreach()

static int _free_unlang_frame_state_foreach ( unlang_frame_state_foreach_t state)
static

Ensure request data is pulled out of the request if the frame is popped.

Definition at line 153 of file foreach.c.

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

◆ unlang_break()

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

Definition at line 655 of file foreach.c.

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

◆ unlang_foreach()

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

Definition at line 519 of file foreach.c.

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

◆ unlang_foreach_attr_init()

static unlang_action_t unlang_foreach_attr_init ( rlm_rcode_t p_result,
request_t request,
unlang_stack_frame_t frame,
unlang_frame_state_foreach_t state 
)
static

Definition at line 433 of file foreach.c.

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

◆ unlang_foreach_attr_key_update()

static void unlang_foreach_attr_key_update ( UNUSED request_t request,
unlang_frame_state_foreach_t state 
)
static

Definition at line 337 of file foreach.c.

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

◆ unlang_foreach_attr_next()

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

Definition at line 347 of file foreach.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 693 of file foreach.c.

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

◆ unlang_foreach_next_old()

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

Definition at line 180 of file foreach.c.

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

◆ unlang_foreach_pair_copy()

static int unlang_foreach_pair_copy ( fr_pair_t to,
fr_pair_t from,
fr_dict_attr_t const *  from_parent 
)
static

Definition at line 108 of file foreach.c.

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

◆ unlang_foreach_xlat_expanded()

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

Definition at line 273 of file foreach.c.

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

◆ unlang_foreach_xlat_init()

static unlang_action_t unlang_foreach_xlat_init ( rlm_rcode_t p_result,
request_t request,
unlang_stack_frame_t frame,
unlang_frame_state_foreach_t state 
)
static

Definition at line 315 of file foreach.c.

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

◆ unlang_foreach_xlat_key_update()

static int unlang_foreach_xlat_key_update ( request_t request,
unlang_frame_state_foreach_t state 
)
static

Definition at line 223 of file foreach.c.

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

◆ unlang_foreach_xlat_next()

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

Definition at line 242 of file foreach.c.

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

Variable Documentation

◆ xlat_foreach_inst

int xlat_foreach_inst[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
static

Definition at line 46 of file foreach.c.

◆ xlat_foreach_names

char const* const xlat_foreach_names[]
static
Initial value:
= {"Foreach-Variable-0",
"Foreach-Variable-1",
"Foreach-Variable-2",
"Foreach-Variable-3",
"Foreach-Variable-4",
"Foreach-Variable-5",
"Foreach-Variable-6",
"Foreach-Variable-7",
"Foreach-Variable-8",
"Foreach-Variable-9"}

Definition at line 35 of file foreach.c.