25 #include <freeradius-devel/util/hash.h>
26 #include <freeradius-devel/util/rand.h>
31 #define unlang_redundant_load_balance unlang_load_balance
39 #ifdef STATIC_ANALYZER
40 if (!redundant->
found) {
48 if (!redundant->
child) {
124 redundant = talloc_get_type_abort(frame->
state,
127 if (gext && gext->
vpt) {
130 char const *p = NULL;
146 REDEBUG(
"Failed finding attribute %s", gext->
vpt->name);
147 goto randomly_choose;
168 goto randomly_choose;
174 REDEBUG(
"Failed expanding template");
175 goto randomly_choose;
183 RDEBUG3(
"load-balance starting at child %d", (
int) start);
187 redundant->
child != NULL;
190 if (
count == start) {
215 redundant->
child != NULL;
242 redundant->
child = NULL;
252 .name =
"load-balance group",
255 .debug_braces =
true,
257 .frame_state_type =
"unlang_frame_state_redundant_t",
262 .name =
"redundant-load-balance group",
265 .debug_braces =
true,
267 .frame_state_type =
"unlang_frame_state_redundant_t",
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
@ UNLANG_ACTION_PUSHED_CHILD
unlang_t pushed a new child onto the stack, execute it instead of continuing.
@ UNLANG_ACTION_STOP_PROCESSING
Break out of processing the current request (unwind).
@ UNLANG_ACTION_CALCULATE_RESULT
Calculate a new section rlm_rcode_t value.
static int const char char buffer[256]
uint32_t fr_hash(void const *data, size_t size)
int unlang_interpret_push(request_t *request, unlang_t const *instruction, rlm_rcode_t default_rcode, bool do_next_sibling, bool top_frame)
Push a new frame onto the stack.
void unlang_register(int type, unlang_op_t *op)
Register an operation with the interpreter.
static unlang_action_t unlang_load_balance_next(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
static unlang_action_t unlang_load_balance(rlm_rcode_t *p_result, request_t *request, unlang_stack_frame_t *frame)
void unlang_load_balance_init(void)
#define unlang_redundant_load_balance
static unlang_load_balance_t * unlang_group_to_load_balance(unlang_group_t *g)
Cast a group structure to the load_balance keyword extension.
State of a redundant operation.
@ FR_TYPE_UINT16
16 Bit unsigned integer.
@ FR_TYPE_UINT8
8 Bit unsigned integer.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_UINT64
64 Bit unsigned integer.
unlang_mod_action_t actions[RLM_MODULE_NUMCODES]
Declarations for the unlang module interface.
uint32_t fr_rand(void)
Return a 32-bit random number.
rlm_rcode_t
Return codes indicating the result of the module call.
@ RLM_MODULE_FAIL
Module failed, don't reply.
@ RLM_MODULE_NOOP
Module succeeded without doing anything.
static unsigned int hash(char const *username, unsigned int tablesize)
int tmpl_find_vp(fr_pair_t **out, request_t *request, tmpl_t const *vpt))
Returns the first VP matching a tmpl_t.
static fr_dict_attr_t const * tmpl_attr_tail_da(tmpl_t const *vpt)
Return the last attribute reference da.
#define tmpl_is_attr(vpt)
#define tmpl_expand(_out, _buff, _buff_len, _request, _vpt, _escape, _escape_ctx)
Expand a tmpl to a C type, using existing storage to hold variably sized types.
Stores an attribute, a value and various bits of other data.
unlang_t * next
Next node (executed on UNLANG_ACTION_EXECUTE_NEXT et al).
char const * debug_name
Printed in log messages when the node is executed.
void * state
Stack frame specialisations.
unlang_mod_actions_t actions
Priorities, etc. for the various return codes.
static unlang_group_t * unlang_generic_to_group(unlang_t const *p)
@ UNLANG_TYPE_LOAD_BALANCE
Load balance section.
@ UNLANG_TYPE_REDUNDANT_LOAD_BALANCE
Redundant load balance section.
unlang_t const * instruction
The unlang node we're evaluating.
rlm_rcode_t result
The result from executing the instruction.
static void repeatable_set(unlang_stack_frame_t *frame)
unlang_process_t process
function to call for interpreting this stack frame
unlang_type_t type
The specialisation of this node.
unlang_t * children
Children beneath this group.
Generic representation of a grouping.
Our interpreter stack, as distinct from the C stack.