The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
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/unlang/xlat_priv.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 CLAMP(_name, _field, _limit)
 
#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.
 
static unlang_tcompile_edit_section (unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs)
 Compile one edit section.
 
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.
 
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.
 
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)
 
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.
 
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.
 
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.
 
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.
 
static int unlang_fixup_map (map_t *map, UNUSED void *ctx)
 Validate and fixup a map that's part of an map section.
 
int unlang_fixup_update (map_t *map, void *ctx)
 Validate and fixup a map that's part of an update section.
 
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.
 
int unlang_thread_instantiate (TALLOC_CTX *ctx)
 Create thread-specific data structures for unlang.
 
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.
 

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)
 
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
0594558cae66a0b7681cd7c4f4ba00acb016a7ab

Definition in file compile.c.


Data Structure Documentation

◆ unlang_compile_t

struct unlang_compile_t

Definition at line 92 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

◆ CLAMP

#define CLAMP (   _name,
  _field,
  _limit 
)
Value:
do { \
if (!fr_time_delta_ispos(actions->retry._field)) { \
cf_log_err(csi, "Invalid value for '" STRINGIFY(_name) " = %s' - value must be positive", \
value); \
return false; \
} \
if (fr_time_delta_cmp(actions->retry._field, fr_time_delta_from_sec(_limit)) > 0) { \
cf_log_err(csi, "Invalid value for '" STRINGIFY(_name) " = %s' - value must be less than " STRINGIFY(_limit) "s", \
value); \
return false; \
} \
} while (0)
#define STRINGIFY(x)
Definition build.h:197
Test enumeration values.
Definition dict_test.h:92
static int8_t fr_time_delta_cmp(fr_time_delta_t a, fr_time_delta_t b)
Compare two fr_time_delta_t values.
Definition time.h:930
static fr_time_delta_t fr_time_delta_from_sec(int64_t sec)
Definition time.h:590
#define fr_time_delta_ispos(_a)
Definition time.h:290

◆ RULES_VERIFY

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

Definition at line 147 of file compile.c.

◆ T

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

Definition at line 1197 of file compile.c.

◆ UNLANG_IGNORE

#define UNLANG_IGNORE   ((unlang_t *) -1)

Definition at line 58 of file compile.c.

◆ UPDATE_CTX2

#define UPDATE_CTX2   compile_copy_context(&unlang_ctx2, unlang_ctx)

Definition at line 122 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 4720 of file compile.c.

Function Documentation

◆ case_cmp()

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

Definition at line 2593 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 2601 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 2608 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 2466 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 573 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 1642 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 1933 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 3449 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 4291 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 4373 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 2856 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 2486 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 1984 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 107 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 3483 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 1462 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 1297 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 3712 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 3699 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 1892 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 3201 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 4466 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 2269 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 3686 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 3583 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 4855 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 3092 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 3906 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 3811 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 665 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 618 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 4634 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 3929 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 3784 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 3918 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 1700 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 3517 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 2226 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 3990 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 2617 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 2984 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 3542 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 2363 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 2420 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 1123 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 866 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 1555 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 4756 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 
)
extern

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 1104 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 820 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 806 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 545 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 5146 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 177 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 268 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 149 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 241 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 2301 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 129 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 5064 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 1784 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 5155 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 5134 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 294 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 1220 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 400 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 449 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 138 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 5210 of file compile.c.

+ 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 5164 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 3734 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 4554 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:1197

Definition at line 1199 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:209
#define FR_SBUFF_TERMS(...)
Initialise a terminal structure with a list of sorted strings.
Definition sbuff.h:192

Definition at line 3578 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 78 of file compile.c.

◆ mod_rcode_table_len

size_t mod_rcode_table_len = NUM_ELEMENTS(mod_rcode_table)

Definition at line 90 of file compile.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 2282 of file compile.c.

◆ transaction_keywords_len

int transaction_keywords_len = NUM_ELEMENTS(transaction_keywords)
static

Definition at line 2297 of file compile.c.

◆ unlang_instruction_tree

fr_rb_tree_t* unlang_instruction_tree = NULL
static

Definition at line 74 of file compile.c.

◆ unlang_number

unsigned int unlang_number = 1
static

Definition at line 60 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:3449
static unlang_t * compile_return(unlang_t *parent, unlang_compile_t *unlang_ctx, UNUSED CONF_ITEM const *ci)
Definition compile.c:3517
static unlang_t * compile_detach(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:3483

Definition at line 4747 of file compile.c.

◆ unlang_pair_keywords_len

int unlang_pair_keywords_len = NUM_ELEMENTS(unlang_pair_keywords)
static

Definition at line 4752 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_elsif(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:3699
static unlang_t * compile_redundant_load_balance(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:3918
static unlang_t * compile_call(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:4291
static unlang_t * compile_caller(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:4373
static unlang_t * compile_redundant(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:3784
static unlang_t * compile_else(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:3712
static unlang_t * compile_case(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:2856
static unlang_t * compile_subrequest(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:3990
static unlang_t * compile_catch(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:2486
static unlang_t * compile_limit(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:3092
static unlang_t * compile_update(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:1123
static unlang_t * compile_if(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:3686
static unlang_t * compile_group(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:2269
static unlang_t * compile_parallel(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:3929
static unlang_t * compile_foreach(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:3201
static unlang_t * compile_transaction(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:2363
static unlang_t * compile_timeout(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:2984
static unlang_t * compile_switch(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:2617
static unlang_t * compile_try(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:2420
static unlang_t * compile_load_balance(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:3906
static unlang_t * compile_map(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_ITEM const *ci)
Definition compile.c:665

Definition at line 4722 of file compile.c.

◆ unlang_section_keywords_len

int unlang_section_keywords_len = NUM_ELEMENTS(unlang_section_keywords)
static

Definition at line 4745 of file compile.c.

◆ unlang_spaces

char const unlang_spaces[] = " "
static

Definition at line 127 of file compile.c.

◆ unlang_thread_array

_Thread_local unlang_thread_t* unlang_thread_array
static

Definition at line 67 of file compile.c.