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_retry_t
 
struct  rlm_delay_t
 

Functions

static void _delay_done (module_ctx_t const *mctx, request_t *request, fr_retry_t const *retry)
 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 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
c3a48b2342b9c7f7c9ae703f60904b63ab6d62ce

Definition in file rlm_delay.c.


Data Structure Documentation

◆ rlm_delay_retry_t

struct rlm_delay_retry_t

Definition at line 50 of file rlm_delay.c.

+ Collaboration diagram for rlm_delay_retry_t:
Data Fields
fr_retry_config_t retry_cfg
fr_time_t when

◆ 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_retry_t const *  retry 
)
static

Called when the timeout has expired.

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

Definition at line 59 of file rlm_delay.c.

+ 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 72 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 87 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 264 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 134 of file rlm_delay.c.

+ Here is the call 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 121 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 201 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 180 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:627
#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_group = {
.bindings = (module_method_binding_t[]){
{ .section = SECTION_NAME(CF_IDENT_ANY, 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:63
static const conf_parser_t config[]
Definition: base.c:183
static int mod_bootstrap(module_inst_ctx_t const *mctx)
Definition: rlm_delay.c:264
static unlang_action_t mod_delay(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_delay.c:134
static const conf_parser_t module_config[]
Definition: rlm_delay.c:43
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
Definition: section.h:40
#define MODULE_BINDING_TERMINATOR
Terminate a module binding list.
Definition: module.h:151
Named methods exported by a module.
Definition: module.h:173

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 206 of file rlm_delay.c.