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

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

#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/util/rand.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 xlat_exp_txlat_exp_func_alloc (TALLOC_CTX *ctx, xlat_t *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 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
efc200b7a8b88541760d2370d0ec7d3a3b790ca1

Definition in file xlat_redundant.c.


Data Structure Documentation

◆ xlat_redundant_func_t

struct xlat_redundant_func_t

Definition at line 51 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 * func Resolved xlat function.

◆ xlat_redundant_inst_t

struct xlat_redundant_inst_t

Definition at line 62 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 70 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 56 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 37 of file xlat_redundant.c.

Function Documentation

◆ xlat_exp_func_alloc()

static xlat_exp_t* xlat_exp_func_alloc ( TALLOC_CTX *  ctx,
xlat_t 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 196 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 123 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 222 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 81 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 363 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 },
}
@ FR_TYPE_VOID
User data.
Definition: merged_model.c:127
#define XLAT_ARG_PARSER_TERMINATOR
Definition: xlat.h:166

Definition at line 348 of file xlat_redundant.c.