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

Register xlat functions for calling redundant xlats. More...

#include <talloc.h>
#include <freeradius-devel/unlang/interpret.h>
#include <freeradius-devel/unlang/xlat_redundant.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include <freeradius-devel/unlang/xlat_priv.h>
#include <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/server/module.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/unlang/xlat.h>
#include <freeradius-devel/util/dlist.h>
#include <freeradius-devel/util/rand.h>
#include <freeradius-devel/util/rb.h>
#include <freeradius-devel/util/sbuff.h>
+ Include dependency graph for xlat_redundant.c:

Go to the source code of this file.

Data Structures

struct  xlat_redundant_func_t
 
struct  xlat_redundant_inst_t
 
struct  xlat_redundant_rctx_t
 
struct  xlat_redundant_t
 

Enumerations

enum  xlat_redundant_type_t {
  XLAT_REDUNDANT_INVALID = 0 ,
  XLAT_REDUNDANT ,
  XLAT_LOAD_BALANCE ,
  XLAT_REDUNDANT_LOAD_BALANCE
}
 

Functions

static int8_t module_qualified_xlat_cmp (void const *a, void const *b)
 
static int8_t module_xlat_cmp (void const *a, void const *b)
 Compare two module_rlm_xlat_t based on whether they have the same name. More...
 
static xlat_exp_txlat_exp_func_alloc (TALLOC_CTX *ctx, xlat_t const *func, xlat_exp_head_t const *args)
 Allocate an xlat node to call an xlat function. More...
 
static xlat_action_t xlat_load_balance_resume (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *in)
 Pass back the result from a single redundant child call. More...
 
static xlat_action_t xlat_redundant (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, UNUSED fr_value_box_list_t *in)
 xlat "redundant", "load-balance" and "redundant-load-balance" processing More...
 
static void xlat_redundant_add_xlat (xlat_redundant_t *xr, xlat_t const *x)
 
static int xlat_redundant_instantiate (xlat_inst_ctx_t const *xctx)
 Allocate additional nodes for evaluation. More...
 
static xlat_action_t xlat_redundant_resume (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, UNUSED fr_value_box_list_t *in)
 Pass back the result from a single redundant child call. More...
 
int xlat_register_redundant (CONF_SECTION *cs)
 Registers a redundant xlat. More...
 

Variables

static xlat_arg_parser_t const xlat_redundant_args []
 

Detailed Description

Register xlat functions for calling redundant xlats.

Id
8dfe66b78d94cc6aca27a7a0091967ff98781eae

Definition in file xlat_redundant.c.


Data Structure Documentation

◆ xlat_redundant_func_t

struct xlat_redundant_func_t

Definition at line 62 of file xlat_redundant.c.

+ Collaboration diagram for xlat_redundant_func_t:
Data Fields
fr_dlist_t entry Entry in the redundant function list.
xlat_t const * func Resolved xlat function.

◆ xlat_redundant_inst_t

struct xlat_redundant_inst_t

Definition at line 73 of file xlat_redundant.c.

+ Collaboration diagram for xlat_redundant_inst_t:
Data Fields
xlat_exp_head_t ** ex Array of xlat expressions created by tokenizing the arguments to the redundant xlat, then duplicating them multiple times, one for each xlat function that may be called.
xlat_redundant_t * xr Information about the redundant xlat.

◆ xlat_redundant_rctx_t

struct xlat_redundant_rctx_t

Definition at line 81 of file xlat_redundant.c.

+ Collaboration diagram for xlat_redundant_rctx_t:
Data Fields
xlat_exp_head_t ** current Last function called, used for redundant xlats.
xlat_exp_head_t ** first First function called.

Used for redundant-load-balance.

bool last_success Did the last call succeed?

◆ xlat_redundant_t

struct xlat_redundant_t

Definition at line 67 of file xlat_redundant.c.

+ Collaboration diagram for xlat_redundant_t:
Data Fields
CONF_SECTION * cs That this redundant xlat list was created from.
fr_dlist_head_t funcs List of redundant xlat functions.
xlat_redundant_type_t type Type of redundant xlat expression.

Enumeration Type Documentation

◆ xlat_redundant_type_t

Enumerator
XLAT_REDUNDANT_INVALID 

Not a valid redundant type.

XLAT_REDUNDANT 

Use the first xlat function first, then go through in sequence, using the next function after each failure.

XLAT_LOAD_BALANCE 

Pick a random xlat, and if that fails then the call as a whole fails.

XLAT_REDUNDANT_LOAD_BALANCE 

Pick a random xlat to start, then fail between the other xlats in the redundant group.

Definition at line 48 of file xlat_redundant.c.

Function Documentation

◆ module_qualified_xlat_cmp()

static int8_t module_qualified_xlat_cmp ( void const *  a,
void const *  b 
)
static

Definition at line 383 of file xlat_redundant.c.

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

◆ module_xlat_cmp()

static int8_t module_xlat_cmp ( void const *  a,
void const *  b 
)
static

Compare two module_rlm_xlat_t based on whether they have the same name.

Note
If the two xlats both have the same name as the module that registered them, then they are considered equal.

Definition at line 360 of file xlat_redundant.c.

+ Here is the caller graph for this function:

◆ xlat_exp_func_alloc()

static xlat_exp_t* xlat_exp_func_alloc ( TALLOC_CTX *  ctx,
xlat_t const *  func,
xlat_exp_head_t const *  args 
)
static

Allocate an xlat node to call an xlat function.

Parameters
[in]ctxto allocate the new node in.
[in]functo call.
[in]argsArguments to the function. Will be copied, and freed when the new xlat node is freed.

Definition at line 207 of file xlat_redundant.c.

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

◆ xlat_load_balance_resume()

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

Pass back the result from a single redundant child call.

Definition at line 134 of file xlat_redundant.c.

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

◆ xlat_redundant_add_xlat()

static void xlat_redundant_add_xlat ( xlat_redundant_t xr,
xlat_t const *  x 
)
inlinestatic

Definition at line 346 of file xlat_redundant.c.

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

◆ xlat_redundant_instantiate()

static int xlat_redundant_instantiate ( xlat_inst_ctx_t const *  xctx)
static

Allocate additional nodes for evaluation.

Definition at line 253 of file xlat_redundant.c.

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

◆ xlat_redundant_resume()

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

Pass back the result from a single redundant child call.

Definition at line 92 of file xlat_redundant.c.

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

◆ xlat_register_redundant()

int xlat_register_redundant ( CONF_SECTION cs)

Registers a redundant xlat.

These xlats wrap the xlat methods of the modules in a redundant section, emulating the behaviour of a redundant section, but over xlats.

Returns
  • 0 on success.
  • -1 on error.
  • 1 if the modules in the section do not have an xlat method.

Definition at line 406 of file xlat_redundant.c.

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

Variable Documentation

◆ xlat_redundant_args

xlat_arg_parser_t const xlat_redundant_args[]
static
Initial value:
= {
{ .type = FR_TYPE_VOID, .variadic = XLAT_ARG_VARIADIC_EMPTY_KEEP },
}
@ FR_TYPE_VOID
User data.
Definition: merged_model.c:127
@ XLAT_ARG_VARIADIC_EMPTY_KEEP
Empty argument groups are left alone, and either passed through as empty groups or null boxes.
Definition: xlat.h:137
#define XLAT_ARG_PARSER_TERMINATOR
Definition: xlat.h:166

Definition at line 340 of file xlat_redundant.c.