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

Functions to convert configuration sections into unlang structures. More...

#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
#include <freeradius-devel/server/virtual_servers.h>
#include <freeradius-devel/server/cf_file.h>
#include <freeradius-devel/server/main_config.h>
#include <freeradius-devel/server/map_proc.h>
#include <freeradius-devel/server/modpriv.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/server/tmpl.h>
#include <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/util/time.h>
#include <freeradius-devel/util/dict.h>
#include "catch_priv.h"
#include "call_priv.h"
#include "caller_priv.h"
#include "condition_priv.h"
#include "foreach_priv.h"
#include "load_balance_priv.h"
#include "map_priv.h"
#include "module_priv.h"
#include "parallel_priv.h"
#include "subrequest_priv.h"
#include "switch_priv.h"
#include "edit_priv.h"
#include "timeout_priv.h"
#include "limit_priv.h"
#include "transaction_priv.h"
#include "try_priv.h"
#include "mod_action.h"
+ Include dependency graph for compile.c:

Go to the source code of this file.

Data Structures

struct  unlang_compile_t
 

Macros

#define RULES_VERIFY(_rules)   do { if (unlang_rules_verify(_rules) < 0) return NULL; } while (0)
 
#define T(_x)   [T_OP_ ## _x] = true
 
#define UNLANG_IGNORE   ((unlang_t *) -1)
 
#define UPDATE_CTX2   compile_copy_context(&unlang_ctx2, unlang_ctx)
 

Typedefs

typedef unlang_t *(* unlang_op_compile_t) (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 

Functions

static int8_t case_cmp (void const *one, void const *two)
 
static uint32_t case_hash (void const *data)
 
static int case_to_key (uint8_t **out, size_t *outlen, void const *data)
 
static int catch_argv (CONF_SECTION *cs, unlang_catch_t *ca, char const *name)
 
static void compile_action_defaults (unlang_t *c, unlang_compile_t *unlang_ctx)
 
static int compile_action_pair (unlang_mod_actions_t *actions, CONF_PAIR *cp)
 
static bool compile_action_subsection (unlang_t *c, CONF_SECTION *cs, CONF_SECTION *subcs)
 
static unlang_tcompile_break (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_call (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_caller (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_case (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_catch (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_children (unlang_group_t *g, unlang_compile_t *unlang_ctx_in, bool set_action_defaults)
 
static void compile_copy_context (unlang_compile_t *dst, unlang_compile_t const *src)
 
static unlang_tcompile_detach (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_edit_pair (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_PAIR *cp)
 Compile one edit pair. More...
 
static unlang_tcompile_edit_section (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs)
 Compile one edit section. More...
 
static unlang_tcompile_else (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_elsif (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_empty (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs, unlang_ext_t const *ext)
 
static unlang_tcompile_foreach (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_function (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM *ci, CONF_SECTION *subcs, bool policy)
 
static unlang_tcompile_group (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_if (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_if_subsection (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs, unlang_ext_t const *ext)
 
static unlang_tcompile_item (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM *ci)
 
static unlang_tcompile_limit (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_load_balance (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_load_balance_subsection (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs, unlang_ext_t const *ext)
 
static unlang_tcompile_map (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static int compile_map_name (unlang_group_t *g)
 
static unlang_tcompile_module (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM *ci, char const *name)
 
static unlang_tcompile_parallel (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_redundant (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_redundant_load_balance (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static bool compile_retry_section (unlang_mod_actions_t *actions, CONF_ITEM *ci)
 
static unlang_tcompile_return (unlang_t *parent, unlang_compile_t *unlang_ctx, UNUSED CONF_ITEM const *ci)
 
static unlang_tcompile_section (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs, unlang_ext_t const *ext)
 
static unlang_tcompile_subrequest (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_switch (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_timeout (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_tmpl (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM *ci)
 
static unlang_tcompile_transaction (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_try (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_update (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
 
static unlang_tcompile_update_to_edit (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs)
 
static int compile_variable (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_PAIR *cp, tmpl_rules_t *t_rules)
 Compile a variable definition. More...
 
static int define_local_variable (CONF_ITEM *ci, unlang_variable_t *var, tmpl_rules_t *t_rules, fr_type_t type, char const *name, fr_dict_attr_t const *ref)
 
int dict_attr_acopy_children (fr_dict_t *dict, fr_dict_attr_t *dst, fr_dict_attr_t const *src)
 Copy the children of an existing attribute. More...
 
static int edit_pair_alloc (CONF_SECTION *cs, CONF_PAIR *original, char const *attr, fr_token_t op, char const *value, fr_token_t list_op)
 
static int edit_section_alloc (CONF_SECTION *parent, CONF_SECTION **child, char const *name1, fr_token_t op)
 
static unlang_group_tgroup_allocate (unlang_t *parent, CONF_SECTION *cs, unlang_ext_t const *ext)
 
static int8_t instruction_cmp (void const *one, void const *two)
 
static bool pass2_fixup_map (map_t *map, tmpl_rules_t const *rules, fr_dict_attr_t const *parent)
 Fixup ONE map (recursively) More...
 
static bool pass2_fixup_map_rhs (unlang_group_t *g, tmpl_rules_t const *rules)
 
static bool pass2_fixup_tmpl (UNUSED TALLOC_CTX *ctx, tmpl_t **vpt_p, CONF_ITEM const *ci, fr_dict_t const *dict)
 
static bool pass2_fixup_update (unlang_group_t *g, tmpl_rules_t const *rules)
 
static bool transaction_ok (CONF_SECTION *cs)
 Limit the operations which can appear in a transaction. More...
 
static int unlang_attr_rules_verify (tmpl_attr_rules_t const *rules)
 
int unlang_compile (virtual_server_t const *vs, CONF_SECTION *cs, unlang_mod_actions_t const *actions, tmpl_rules_t const *rules, void **instruction)
 Compile an unlang section for a virtual server. More...
 
bool unlang_compile_actions (unlang_mod_actions_t *actions, CONF_SECTION *action_cs, bool module_retry)
 
void unlang_compile_init (TALLOC_CTX *ctx)
 
bool unlang_compile_is_keyword (const char *name)
 Check if name is an unlang keyword. More...
 
static void unlang_dump (unlang_t *instruction, int depth)
 
static int unlang_fixup_edit (map_t *map, void *ctx)
 Validate and fixup a map that's part of an edit section. More...
 
static int unlang_fixup_map (map_t *map, UNUSED void *ctx)
 Validate and fixup a map that's part of an map section. More...
 
int unlang_fixup_update (map_t *map, void *ctx)
 Validate and fixup a map that's part of an update section. More...
 
static int unlang_rules_verify (tmpl_rules_t const *rules)
 
void * unlang_thread_instance (unlang_t const *instruction)
 Get the thread-instance data for an instruction. More...
 
int unlang_thread_instantiate (TALLOC_CTX *ctx)
 Create thread-specific data structures for unlang. More...
 
static bool validate_limited_subsection (CONF_SECTION *cs, char const *name)
 
static CONF_SECTIONvirtual_module_find_cs (CONF_ITEM *ci, UNUSED char const *real_name, char const *virtual_name, char const *method_name, bool *policy)
 Load a named module from the virtual module list, or from the "policy" subsection. More...
 

Variables

static const bool edit_list_sub_op [T_TOKEN_LAST]
 
static const fr_sbuff_term_t if_terminals
 
fr_table_num_sorted_t const mod_rcode_table []
 
size_t mod_rcode_table_len = NUM_ELEMENTS(mod_rcode_table)
 
bool tmpl_require_enum_prefix
 
static fr_table_num_sorted_t transaction_keywords []
 
static int transaction_keywords_len = NUM_ELEMENTS(transaction_keywords)
 
static fr_rb_tree_tunlang_instruction_tree = NULL
 
static unsigned int unlang_number = 1
 
static fr_table_ptr_sorted_t unlang_pair_keywords []
 
static int unlang_pair_keywords_len = NUM_ELEMENTS(unlang_pair_keywords)
 
static fr_table_ptr_sorted_t unlang_section_keywords []
 
static int unlang_section_keywords_len = NUM_ELEMENTS(unlang_section_keywords)
 
static char const unlang_spaces [] = " "
 
static _Thread_local unlang_thread_tunlang_thread_array
 

Detailed Description

Functions to convert configuration sections into unlang structures.

Id
ac5f9abfae5c0c48830ad680f22468ad84fa49d8

Definition in file compile.c.


Data Structure Documentation

◆ unlang_compile_t

struct unlang_compile_t

Definition at line 96 of file compile.c.

+ Collaboration diagram for unlang_compile_t:
Data Fields
unlang_mod_actions_t actions
tmpl_rules_t const * rules
char const * section_name1
char const * section_name2
virtual_server_t const * vs Virtual server we're compiling in the context of.

This shouldn't change during the compilation of a single unlang section.

Macro Definition Documentation

◆ RULES_VERIFY

#define RULES_VERIFY (   _rules)    do { if (unlang_rules_verify(_rules) < 0) return NULL; } while (0)

Definition at line 151 of file compile.c.

◆ T

#define T (   _x)    [T_OP_ ## _x] = true

Definition at line 1251 of file compile.c.

◆ UNLANG_IGNORE

#define UNLANG_IGNORE   ((unlang_t *) -1)

Definition at line 60 of file compile.c.

◆ UPDATE_CTX2

#define UPDATE_CTX2   compile_copy_context(&unlang_ctx2, unlang_ctx)

Definition at line 126 of file compile.c.

Typedef Documentation

◆ unlang_op_compile_t

typedef unlang_t*(* unlang_op_compile_t) (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)

Definition at line 4678 of file compile.c.

Function Documentation

◆ case_cmp()

static int8_t case_cmp ( void const *  one,
void const *  two 
)
static

Definition at line 2598 of file compile.c.

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

◆ case_hash()

static uint32_t case_hash ( void const *  data)
static

Definition at line 2606 of file compile.c.

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

◆ case_to_key()

static int case_to_key ( uint8_t **  out,
size_t outlen,
void const *  data 
)
static

Definition at line 2613 of file compile.c.

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

◆ catch_argv()

static int catch_argv ( CONF_SECTION cs,
unlang_catch_t ca,
char const *  name 
)
static

Definition at line 2523 of file compile.c.

+ Here is the caller graph for this function:

◆ compile_action_defaults()

static void compile_action_defaults ( unlang_t c,
unlang_compile_t unlang_ctx 
)
static

Definition at line 625 of file compile.c.

+ Here is the caller graph for this function:

◆ compile_action_pair()

static int compile_action_pair ( unlang_mod_actions_t actions,
CONF_PAIR cp 
)
static

Definition at line 1711 of file compile.c.

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

◆ compile_action_subsection()

static bool compile_action_subsection ( unlang_t c,
CONF_SECTION cs,
CONF_SECTION subcs 
)
static

Definition at line 1996 of file compile.c.

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

◆ compile_break()

static unlang_t* compile_break ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 3417 of file compile.c.

+ Here is the call graph for this function:

◆ compile_call()

static unlang_t* compile_call ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 4263 of file compile.c.

+ Here is the call graph for this function:

◆ compile_caller()

static unlang_t* compile_caller ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 4343 of file compile.c.

+ Here is the call graph for this function:

◆ compile_case()

static unlang_t * compile_case ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 2842 of file compile.c.

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

◆ compile_catch()

static unlang_t* compile_catch ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 2543 of file compile.c.

+ Here is the call graph for this function:

◆ compile_children()

static unlang_t* compile_children ( unlang_group_t g,
unlang_compile_t unlang_ctx_in,
bool  set_action_defaults 
)
static

Definition at line 2047 of file compile.c.

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

◆ compile_copy_context()

static void compile_copy_context ( unlang_compile_t dst,
unlang_compile_t const *  src 
)
inlinestatic

Definition at line 111 of file compile.c.

+ Here is the caller graph for this function:

◆ compile_detach()

static unlang_t* compile_detach ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 3450 of file compile.c.

+ Here is the call graph for this function:

◆ compile_edit_pair()

static unlang_t* compile_edit_pair ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_PAIR cp 
)
static

Compile one edit pair.

Definition at line 1531 of file compile.c.

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

◆ compile_edit_section()

static unlang_t* compile_edit_section ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_SECTION cs 
)
static

Compile one edit section.

Definition at line 1366 of file compile.c.

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

◆ compile_else()

static unlang_t* compile_else ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 3668 of file compile.c.

+ Here is the call graph for this function:

◆ compile_elsif()

static unlang_t* compile_elsif ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 3655 of file compile.c.

+ Here is the call graph for this function:

◆ compile_empty()

static unlang_t * compile_empty ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_SECTION cs,
unlang_ext_t const *  ext 
)
static

Definition at line 1955 of file compile.c.

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

◆ compile_foreach()

static unlang_t* compile_foreach ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 3180 of file compile.c.

+ Here is the call graph for this function:

◆ compile_function()

static unlang_t* compile_function ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM ci,
CONF_SECTION subcs,
bool  policy 
)
static

Definition at line 4434 of file compile.c.

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

◆ compile_group()

static unlang_t* compile_group ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 2332 of file compile.c.

+ Here is the call graph for this function:

◆ compile_if()

static unlang_t* compile_if ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 3642 of file compile.c.

+ Here is the call graph for this function:

◆ compile_if_subsection()

static unlang_t* compile_if_subsection ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_SECTION cs,
unlang_ext_t const *  ext 
)
static

Definition at line 3549 of file compile.c.

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

◆ compile_item()

static unlang_t * compile_item ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM ci 
)
static

Definition at line 4813 of file compile.c.

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

◆ compile_limit()

static unlang_t* compile_limit ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 3074 of file compile.c.

+ Here is the call graph for this function:

◆ compile_load_balance()

static unlang_t* compile_load_balance ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 3862 of file compile.c.

+ Here is the call graph for this function:

◆ compile_load_balance_subsection()

static unlang_t* compile_load_balance_subsection ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_SECTION cs,
unlang_ext_t const *  ext 
)
static

Definition at line 3767 of file compile.c.

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

◆ compile_map()

static unlang_t* compile_map ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 717 of file compile.c.

+ Here is the call graph for this function:

◆ compile_map_name()

static int compile_map_name ( unlang_group_t g)
static

Definition at line 670 of file compile.c.

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

◆ compile_module()

static unlang_t* compile_module ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM ci,
char const *  name 
)
static

Definition at line 4602 of file compile.c.

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

◆ compile_parallel()

static unlang_t* compile_parallel ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 3885 of file compile.c.

+ Here is the call graph for this function:

◆ compile_redundant()

static unlang_t* compile_redundant ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 3740 of file compile.c.

+ Here is the call graph for this function:

◆ compile_redundant_load_balance()

static unlang_t* compile_redundant_load_balance ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 3874 of file compile.c.

+ Here is the call graph for this function:

◆ compile_retry_section()

static bool compile_retry_section ( unlang_mod_actions_t actions,
CONF_ITEM ci 
)
static

Definition at line 1769 of file compile.c.

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

◆ compile_return()

static unlang_t* compile_return ( unlang_t parent,
unlang_compile_t unlang_ctx,
UNUSED CONF_ITEM const *  ci 
)
static

Definition at line 3483 of file compile.c.

+ Here is the call graph for this function:

◆ compile_section()

static unlang_t* compile_section ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_SECTION cs,
unlang_ext_t const *  ext 
)
static

Definition at line 2289 of file compile.c.

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

◆ compile_subrequest()

static unlang_t* compile_subrequest ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 3945 of file compile.c.

+ Here is the call graph for this function:

◆ compile_switch()

static unlang_t* compile_switch ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 2622 of file compile.c.

+ Here is the call graph for this function:

◆ compile_timeout()

static unlang_t* compile_timeout ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 2969 of file compile.c.

+ Here is the call graph for this function:

◆ compile_tmpl()

static unlang_t* compile_tmpl ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM ci 
)
static

Definition at line 3508 of file compile.c.

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

◆ compile_transaction()

static unlang_t* compile_transaction ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 2426 of file compile.c.

+ Here is the call graph for this function:

◆ compile_try()

static unlang_t* compile_try ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 2482 of file compile.c.

+ Here is the call graph for this function:

◆ compile_update()

static unlang_t* compile_update ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_ITEM const *  ci 
)
static

Definition at line 1177 of file compile.c.

+ Here is the call graph for this function:

◆ compile_update_to_edit()

static unlang_t* compile_update_to_edit ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_SECTION cs 
)
static

Definition at line 918 of file compile.c.

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

◆ compile_variable()

static int compile_variable ( unlang_t parent,
unlang_compile_t unlang_ctx,
CONF_PAIR cp,
tmpl_rules_t t_rules 
)
static

Compile a variable definition.

Definitions which are adjacent to one another are automatically merged into one larger variable definition.

Definition at line 1624 of file compile.c.

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

◆ define_local_variable()

static int define_local_variable ( CONF_ITEM ci,
unlang_variable_t var,
tmpl_rules_t t_rules,
fr_type_t  type,
char const *  name,
fr_dict_attr_t const *  ref 
)
static

Definition at line 4714 of file compile.c.

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

◆ dict_attr_acopy_children()

int dict_attr_acopy_children ( fr_dict_t dict,
fr_dict_attr_t dst,
fr_dict_attr_t const *  src 
)

Copy the children of an existing attribute.

Parameters
[in]dictto allocate the children in
[in]dstwhere to copy the children to
[in]srcwhere to copy the children from
Returns
  • 0 on success
  • <0 on error

Definition at line 1087 of file dict_util.c.

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

◆ edit_pair_alloc()

static int edit_pair_alloc ( CONF_SECTION cs,
CONF_PAIR original,
char const *  attr,
fr_token_t  op,
char const *  value,
fr_token_t  list_op 
)
static

Definition at line 872 of file compile.c.

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

◆ edit_section_alloc()

static int edit_section_alloc ( CONF_SECTION parent,
CONF_SECTION **  child,
char const *  name1,
fr_token_t  op 
)
static

Definition at line 858 of file compile.c.

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

◆ group_allocate()

static unlang_group_t* group_allocate ( unlang_t parent,
CONF_SECTION cs,
unlang_ext_t const *  ext 
)
static

Definition at line 597 of file compile.c.

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

◆ instruction_cmp()

static int8_t instruction_cmp ( void const *  one,
void const *  two 
)
static

Definition at line 5104 of file compile.c.

+ Here is the caller graph for this function:

◆ pass2_fixup_map()

static bool pass2_fixup_map ( map_t map,
tmpl_rules_t const *  rules,
fr_dict_attr_t const *  parent 
)
static

Fixup ONE map (recursively)

This function resolves most things. Most notable it CAN leave the RHS unresolved, for use in map sections.

Definition at line 181 of file compile.c.

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

◆ pass2_fixup_map_rhs()

static bool pass2_fixup_map_rhs ( unlang_group_t g,
tmpl_rules_t const *  rules 
)
static

Definition at line 272 of file compile.c.

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

◆ pass2_fixup_tmpl()

static bool pass2_fixup_tmpl ( UNUSED TALLOC_CTX *  ctx,
tmpl_t **  vpt_p,
CONF_ITEM const *  ci,
fr_dict_t const *  dict 
)
static

Definition at line 153 of file compile.c.

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

◆ pass2_fixup_update()

static bool pass2_fixup_update ( unlang_group_t g,
tmpl_rules_t const *  rules 
)
static

Definition at line 245 of file compile.c.

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

◆ transaction_ok()

static bool transaction_ok ( CONF_SECTION cs)
static

Limit the operations which can appear in a transaction.

Definition at line 2364 of file compile.c.

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

◆ unlang_attr_rules_verify()

static int unlang_attr_rules_verify ( tmpl_attr_rules_t const *  rules)
inlinestatic

Definition at line 133 of file compile.c.

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

◆ unlang_compile()

int unlang_compile ( virtual_server_t const *  vs,
CONF_SECTION cs,
unlang_mod_actions_t const *  actions,
tmpl_rules_t const *  rules,
void **  instruction 
)

Compile an unlang section for a virtual server.

Parameters
[in]vsVirtual server to compile section for.
[in]cscontaining the unlang calls to compile.
[in]actionsActions to use for the unlang section.
[in]rulesRules to use for the unlang section.
[out]instructionPointer to store the compiled unlang section.
Returns
  • 0 on success.
  • -1 on error.

Definition at line 5022 of file compile.c.

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

◆ unlang_compile_actions()

bool unlang_compile_actions ( unlang_mod_actions_t actions,
CONF_SECTION action_cs,
bool  module_retry 
)

Definition at line 1847 of file compile.c.

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

◆ unlang_compile_init()

void unlang_compile_init ( TALLOC_CTX *  ctx)

Definition at line 5113 of file compile.c.

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

◆ unlang_compile_is_keyword()

bool unlang_compile_is_keyword ( const char *  name)

Check if name is an unlang keyword.

Parameters
[in]nameto check.
Returns
  • true if it is a keyword.
  • false if it's not a keyword.

Definition at line 5092 of file compile.c.

+ Here is the caller graph for this function:

◆ unlang_dump()

static void unlang_dump ( unlang_t instruction,
int  depth 
)
static

Definition at line 298 of file compile.c.

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

◆ unlang_fixup_edit()

static int unlang_fixup_edit ( map_t map,
void *  ctx 
)
static

Validate and fixup a map that's part of an edit section.

Parameters
mapto validate.
ctxdata to pass to fixup function (currently unused).
Returns
0 if valid else -1.
Todo:
  • this is only called for CONF_PAIR maps, not for CONF_SECTION. So when we parse nested maps, there's no validation done of the CONF_SECTION. In order to fix this, we need to have map_afrom_cs() call the validation function for the CONF_SECTION before recursing.

Definition at line 1274 of file compile.c.

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

◆ unlang_fixup_map()

static int unlang_fixup_map ( map_t map,
UNUSED void *  ctx 
)
static

Validate and fixup a map that's part of an map section.

Parameters
mapto validate.
ctxdata to pass to fixup function (currently unused).
Returns
0 if valid else -1.

Definition at line 404 of file compile.c.

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

◆ unlang_fixup_update()

int unlang_fixup_update ( map_t map,
void *  ctx 
)

Validate and fixup a map that's part of an update section.

Parameters
mapto validate.
ctxdata to pass to fixup function (currently unused).
Returns
  • 0 if valid.
  • -1 not valid.

Definition at line 470 of file compile.c.

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

◆ unlang_rules_verify()

static int unlang_rules_verify ( tmpl_rules_t const *  rules)
inlinestatic

Definition at line 142 of file compile.c.

+ Here is the call 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 5168 of file compile.c.

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

◆ unlang_thread_instantiate()

int unlang_thread_instantiate ( TALLOC_CTX *  ctx)

Create thread-specific data structures for unlang.

Definition at line 5122 of file compile.c.

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

◆ validate_limited_subsection()

static bool validate_limited_subsection ( CONF_SECTION cs,
char const *  name 
)
static

Definition at line 3690 of file compile.c.

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

◆ virtual_module_find_cs()

static CONF_SECTION* virtual_module_find_cs ( CONF_ITEM ci,
UNUSED char const *  real_name,
char const *  virtual_name,
char const *  method_name,
bool policy 
)
static

Load a named module from the virtual module list, or from the "policy" subsection.

If it's "foo.method", look for "foo", and return "method" as the method we wish to use, instead of the input component.

Parameters
[in]ciConfiguration item to check
[in]real_nameComplete name string e.g. foo.authorize.
[in]virtual_nameVirtual module name e.g. foo.
[in]method_nameMethod override (may be NULL) or the method name e.g. authorize.
[out]policywhether or not this thing was a policy
Returns
the CONF_SECTION specifying the virtual module.

Definition at line 4522 of file compile.c.

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

Variable Documentation

◆ edit_list_sub_op

const bool edit_list_sub_op[T_TOKEN_LAST]
static
Initial value:
= {
T(NE),
T(GE),
T(GT),
T(LE),
T(LT),
T(CMP_EQ),
}
#define T(_x)
Definition: compile.c:1251

Definition at line 1253 of file compile.c.

◆ if_terminals

const fr_sbuff_term_t if_terminals
static
Initial value:
L(""),
L("{"),
)
#define L(_str)
Helper for initialising arrays of string literals.
Definition: build.h:207
#define FR_SBUFF_TERMS(...)
Initialise a terminal structure with a list of sorted strings.
Definition: sbuff.h:167

Definition at line 3544 of file compile.c.

◆ mod_rcode_table

fr_table_num_sorted_t const mod_rcode_table[]
Initial value:
= {
{ L("..."), RLM_MODULE_NOT_SET },
{ L("disallow"), RLM_MODULE_DISALLOW },
{ L("fail"), RLM_MODULE_FAIL },
{ L("handled"), RLM_MODULE_HANDLED },
{ L("invalid"), RLM_MODULE_INVALID },
{ L("noop"), RLM_MODULE_NOOP },
{ L("notfound"), RLM_MODULE_NOTFOUND },
{ L("ok"), RLM_MODULE_OK },
{ L("reject"), RLM_MODULE_REJECT },
{ L("updated"), RLM_MODULE_UPDATED }
}
@ RLM_MODULE_INVALID
The module considers the request invalid.
Definition: rcode.h:45
@ RLM_MODULE_OK
The module is OK, continue.
Definition: rcode.h:43
@ RLM_MODULE_FAIL
Module failed, don't reply.
Definition: rcode.h:42
@ RLM_MODULE_DISALLOW
Reject the request (user is locked out).
Definition: rcode.h:46
@ RLM_MODULE_REJECT
Immediately reject the request.
Definition: rcode.h:41
@ RLM_MODULE_NOTFOUND
User not found.
Definition: rcode.h:47
@ RLM_MODULE_UPDATED
OK (pairs modified).
Definition: rcode.h:49
@ RLM_MODULE_NOT_SET
Error resolving rcode (should not be returned by modules).
Definition: rcode.h:51
@ RLM_MODULE_NOOP
Module succeeded without doing anything.
Definition: rcode.h:48
@ RLM_MODULE_HANDLED
The module handled the request, so stop.
Definition: rcode.h:44

Definition at line 82 of file compile.c.

◆ mod_rcode_table_len

size_t mod_rcode_table_len = NUM_ELEMENTS(mod_rcode_table)

Definition at line 94 of file compile.c.

◆ tmpl_require_enum_prefix

bool tmpl_require_enum_prefix
extern

Definition at line 49 of file tmpl_tokenize.c.

◆ transaction_keywords

fr_table_num_sorted_t transaction_keywords[]
static
Initial value:
= {
{ L("case"), 1 },
{ L("else"), 1 },
{ L("elsif"), 1 },
{ L("foreach"), 1 },
{ L("group"), 1 },
{ L("if"), 1 },
{ L("limit"), 1 },
{ L("load-balance"), 1 },
{ L("redundant"), 1 },
{ L("redundant-load-balance"), 1 },
{ L("switch"), 1 },
{ L("timeout"), 1 },
{ L("transaction"), 1 },
}

Definition at line 2345 of file compile.c.

◆ transaction_keywords_len

int transaction_keywords_len = NUM_ELEMENTS(transaction_keywords)
static

Definition at line 2360 of file compile.c.

◆ unlang_instruction_tree

fr_rb_tree_t* unlang_instruction_tree = NULL
static

Definition at line 78 of file compile.c.

◆ unlang_number

unsigned int unlang_number = 1
static

Definition at line 64 of file compile.c.

◆ unlang_pair_keywords

fr_table_ptr_sorted_t unlang_pair_keywords[]
static
Initial value:
= {
{ L("break"), (void *) compile_break },
{ L("detach"), (void *) compile_detach },
{ L("return"), (void *) compile_return },
}
static unlang_t * compile_break(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:3417
static unlang_t * compile_return(unlang_t *parent, unlang_compile_t *unlang_ctx, UNUSED CONF_ITEM const *ci)
Definition: compile.c:3483
static unlang_t * compile_detach(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:3450

Definition at line 4705 of file compile.c.

◆ unlang_pair_keywords_len

int unlang_pair_keywords_len = NUM_ELEMENTS(unlang_pair_keywords)
static

Definition at line 4710 of file compile.c.

◆ unlang_section_keywords

fr_table_ptr_sorted_t unlang_section_keywords[]
static
Initial value:
= {
{ L("call"), (void *) compile_call },
{ L("caller"), (void *) compile_caller },
{ L("case"), (void *) compile_case },
{ L("catch"), (void *) compile_catch },
{ L("else"), (void *) compile_else },
{ L("elsif"), (void *) compile_elsif },
{ L("foreach"), (void *) compile_foreach },
{ L("group"), (void *) compile_group },
{ L("if"), (void *) compile_if },
{ L("limit"), (void *) compile_limit },
{ L("load-balance"), (void *) compile_load_balance },
{ L("map"), (void *) compile_map },
{ L("parallel"), (void *) compile_parallel },
{ L("redundant"), (void *) compile_redundant },
{ L("redundant-load-balance"), (void *) compile_redundant_load_balance },
{ L("subrequest"), (void *) compile_subrequest },
{ L("switch"), (void *) compile_switch },
{ L("timeout"), (void *) compile_timeout },
{ L("transaction"), (void *) compile_transaction },
{ L("try"), (void *) compile_try },
{ L("update"), (void *) compile_update },
}
static unlang_t * compile_caller(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:4343
static unlang_t * compile_foreach(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:3180
static unlang_t * compile_catch(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:2543
static unlang_t * compile_else(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:3668
static unlang_t * compile_case(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:2842
static unlang_t * compile_subrequest(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:3945
static unlang_t * compile_elsif(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:3655
static unlang_t * compile_call(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:4263
static unlang_t * compile_transaction(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:2426
static unlang_t * compile_redundant(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:3740
static unlang_t * compile_group(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:2332
static unlang_t * compile_update(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:1177
static unlang_t * compile_limit(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:3074
static unlang_t * compile_timeout(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:2969
static unlang_t * compile_redundant_load_balance(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:3874
static unlang_t * compile_try(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:2482
static unlang_t * compile_load_balance(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:3862
static unlang_t * compile_parallel(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:3885
static unlang_t * compile_switch(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:2622
static unlang_t * compile_if(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:3642
static unlang_t * compile_map(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition: compile.c:717

Definition at line 4680 of file compile.c.

◆ unlang_section_keywords_len

int unlang_section_keywords_len = NUM_ELEMENTS(unlang_section_keywords)
static

Definition at line 4703 of file compile.c.

◆ unlang_spaces

char const unlang_spaces[] = " "
static

Definition at line 131 of file compile.c.

◆ unlang_thread_array

_Thread_local unlang_thread_t* unlang_thread_array
static

Definition at line 71 of file compile.c.