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

Add an artificial delay to requests. More...

#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/server/map_proc.h>
#include <freeradius-devel/util/time.h>
#include <freeradius-devel/unlang/xlat_func.h>
+ Include dependency graph for rlm_delay.c:

Go to the source code of this file.

Data Structures

struct  rlm_delay_t
 

Functions

static void _delay_done (module_ctx_t const *mctx, request_t *request, fr_time_t fired)
 Called when the timeout has expired. More...
 
static void _xlat_delay_done (xlat_ctx_t const *xctx, request_t *request, fr_time_t fired)
 
static int delay_add (request_t *request, fr_time_t *resume_at, fr_time_t now, fr_time_delta_t delay, bool force_reschedule, bool relative)
 
static int mod_bootstrap (module_inst_ctx_t const *mctx)
 
static unlang_action_t mod_delay (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static void mod_delay_cancel (module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action)
 
static unlang_action_t mod_delay_return (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 Called resume_at the delay is complete, and we're running from the interpreter. More...
 
static xlat_action_t xlat_delay (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 Xlat to delay the request. More...
 
static void xlat_delay_cancel (UNUSED xlat_ctx_t const *xctx, request_t *request, UNUSED fr_signal_t action)
 
static xlat_action_t xlat_delay_resume (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, UNUSED fr_value_box_list_t *in)
 

Variables

static const conf_parser_t module_config []
 
module_rlm_t rlm_delay
 
static xlat_arg_parser_t const xlat_delay_args []
 

Detailed Description

Add an artificial delay to requests.

Id
1025165c01b4bc477061ed609fcf6def0004e1a1

Definition in file rlm_delay.c.


Data Structure Documentation

◆ rlm_delay_t

struct rlm_delay_t

Definition at line 34 of file rlm_delay.c.

+ Collaboration diagram for rlm_delay_t:
Data Fields
tmpl_t * delay How long we delay for.
bool force_reschedule Whether we should force rescheduling of the request.
bool relative Whether the delay is relative to the start of request processing.

Function Documentation

◆ _delay_done()

static void _delay_done ( module_ctx_t const *  mctx,
request_t request,
fr_time_t  fired 
)
static

Called when the timeout has expired.

Marks the request as resumable, and prints the delayed delay time.

Definition at line 54 of file rlm_delay.c.

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

◆ _xlat_delay_done()

static void _xlat_delay_done ( xlat_ctx_t const *  xctx,
request_t request,
fr_time_t  fired 
)
static

Definition at line 69 of file rlm_delay.c.

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

◆ delay_add()

static int delay_add ( request_t request,
fr_time_t resume_at,
fr_time_t  now,
fr_time_delta_t  delay,
bool  force_reschedule,
bool  relative 
)
static

Definition at line 84 of file rlm_delay.c.

+ Here is the caller graph for this function:

◆ mod_bootstrap()

static int mod_bootstrap ( module_inst_ctx_t const *  mctx)
static

Definition at line 263 of file rlm_delay.c.

+ Here is the call graph for this function:

◆ mod_delay()

static unlang_action_t mod_delay ( rlm_rcode_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 138 of file rlm_delay.c.

+ Here is the call graph for this function:

◆ mod_delay_cancel()

static void mod_delay_cancel ( module_ctx_t const *  mctx,
request_t request,
UNUSED fr_signal_t  action 
)
static

Definition at line 131 of file rlm_delay.c.

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

◆ mod_delay_return()

static unlang_action_t mod_delay_return ( rlm_rcode_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Called resume_at the delay is complete, and we're running from the interpreter.

Definition at line 118 of file rlm_delay.c.

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

◆ xlat_delay_cancel()

static void xlat_delay_cancel ( UNUSED xlat_ctx_t const *  xctx,
request_t request,
UNUSED fr_signal_t  action 
)
static

Definition at line 200 of file rlm_delay.c.

+ Here is the caller graph for this function:

◆ xlat_delay_resume()

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

Definition at line 179 of file rlm_delay.c.

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

Variable Documentation

◆ module_config

const conf_parser_t module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("delay", rlm_delay_t, delay) },
{ FR_CONF_OFFSET("relative", rlm_delay_t, relative), .dflt = "no" },
{ FR_CONF_OFFSET("force_reschedule", rlm_delay_t, force_reschedule), .dflt = "no" },
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:626
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:268

Definition at line 43 of file rlm_delay.c.

◆ rlm_delay

module_rlm_t rlm_delay
Initial value:
= {
.common = {
.name = "delay",
.flags = 0,
.inst_size = sizeof(rlm_delay_t),
.bootstrap = mod_bootstrap
},
.method_names = (module_method_name_t[]){
{ .name1 = CF_IDENT_ANY, .name2 = CF_IDENT_ANY, .method = mod_delay },
}
}
#define CF_IDENT_ANY
Definition: cf_util.h:78
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:65
Specifies a module method identifier.
Definition: module_method.c:36
static const conf_parser_t config[]
Definition: base.c:188
static int mod_bootstrap(module_inst_ctx_t const *mctx)
Definition: rlm_delay.c:263
static unlang_action_t mod_delay(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_delay.c:138
static const conf_parser_t module_config[]
Definition: rlm_delay.c:43
#define MODULE_NAME_TERMINATOR
Definition: module.h:135

Definition at line 274 of file rlm_delay.c.

◆ xlat_delay_args

xlat_arg_parser_t const xlat_delay_args[]
static
Initial value:
= {
{ .single = true, .type = FR_TYPE_TIME_DELTA },
}
@ FR_TYPE_TIME_DELTA
A period of time measured in nanoseconds.
Definition: merged_model.c:113
#define XLAT_ARG_PARSER_TERMINATOR
Definition: xlat.h:166

Definition at line 205 of file rlm_delay.c.