The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions | Variables
proto_load_step.c File Reference

Generic protocol load generator. More...

#include <netdb.h>
#include <fcntl.h>
#include <freeradius-devel/server/protocol.h>
#include <freeradius-devel/server/main_loop.h>
#include <freeradius-devel/io/application.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/io/schedule.h>
#include <freeradius-devel/io/load.h>
#include "proto_load.h"
+ Include dependency graph for proto_load_step.c:

Go to the source code of this file.

Data Structures

struct  proto_load_step_s
 
struct  proto_load_step_thread_t
 

Typedefs

typedef struct proto_load_step_s proto_load_step_t
 

Enumerations

enum  load_step_on_complete_t {
  LOAD_STEP_ON_COMPLETE_EXIT = 0 ,
  LOAD_STEP_ON_COMPLETE_REPEAT ,
  LOAD_STEP_ON_COMPLETE_STOP ,
  LOAD_STEP_ON_COMPLETE_CONTINUE
}
 What to do when the load test is complete. More...
 

Functions

static void load_complete (proto_load_step_thread_t *thread)
 The load test is complete - apply on_complete.
 
static fr_client_tmod_client_find (fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto)
 
static int mod_decode (void const *instance, request_t *request, UNUSED uint8_t *const data, UNUSED size_t data_len)
 Decode the packet.
 
static void mod_event_list_set (fr_listen_t *li, fr_event_list_t *el, void *nr)
 Set the event list for a new socket.
 
static int mod_generate (fr_time_t now, void *uctx)
 Generate traffic.
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static void mod_load_done (void *uctx)
 The generator noticed completion itself, without a final reply.
 
static char const * mod_name (fr_listen_t *li)
 
static int mod_open (fr_listen_t *li)
 Open a load listener.
 
static ssize_t mod_read (fr_listen_t *li, void **packet_ctx, fr_time_t *recv_time_p, uint8_t *buffer, size_t buffer_len, size_t *leftover)
 
static ssize_t mod_write (fr_listen_t *li, UNUSED void *packet_ctx, fr_time_t request_time, UNUSED uint8_t *buffer, size_t buffer_len, UNUSED size_t written)
 
static void write_stats (fr_timer_list_t *tl, fr_time_t now, void *uctx)
 

Variables

static const conf_parser_t load_listen_config []
 
static fr_table_num_sorted_t const load_on_complete_table []
 
static size_t load_on_complete_table_len = NUM_ELEMENTS(load_on_complete_table)
 
fr_app_io_t proto_load_step
 

Detailed Description

Generic protocol load generator.

Id
763d361486fa35dac02fdf0a1ac3f777bede1eee

Definition in file proto_load_step.c.


Data Structure Documentation

◆ proto_load_step_s

struct proto_load_step_s

Definition at line 82 of file proto_load_step.c.

+ Collaboration diagram for proto_load_step_s:
Data Fields
fr_client_t * client static client
int code
CONF_SECTION * cs our configuration
char const * csv where to write CSV stats
fr_dict_t const * dict Our namespace.
char const * filename where to read input packet from
fr_load_config_t load load configuration
uint32_t max_attributes Limit maximum decodable attributes.
load_step_on_complete_t on_complete what to do when the load test completes
fr_pair_list_t pair_list for input packet
proto_load_t * parent

◆ proto_load_step_thread_t

struct proto_load_step_thread_t

Definition at line 61 of file proto_load_step.c.

+ Collaboration diagram for proto_load_step_thread_t:
Data Fields
bool done
fr_event_list_t * el event list
fr_timer_t * ev for writing statistics
int fd for CSV files
proto_load_step_t const * inst
fr_load_t * l load generation handler
fr_load_config_t load load configuration
char const * name socket name
fr_network_t * nr network handler
fr_listen_t * parent master IO handler
fr_time_t recv_time recv time of the last packet
fr_stats_t stats statistics for this socket
bool suspended

Typedef Documentation

◆ proto_load_step_t

Definition at line 38 of file proto_load_step.c.

Enumeration Type Documentation

◆ load_step_on_complete_t

What to do when the load test is complete.

The test is complete when the PPS ramp has passed max_pps, all max_requests packets (if set) have been sent, and every reply has been received.

Enumerator
LOAD_STEP_ON_COMPLETE_EXIT 

make the server exit

LOAD_STEP_ON_COMPLETE_REPEAT 

run the test again from start_pps

LOAD_STEP_ON_COMPLETE_STOP 

stop generating load, leave the server running

LOAD_STEP_ON_COMPLETE_CONTINUE 

never complete, keep sending at max_pps forever

Definition at line 46 of file proto_load_step.c.

Function Documentation

◆ load_complete()

static void load_complete ( proto_load_step_thread_t thread)
static

The load test is complete - apply on_complete.

Definition at line 187 of file proto_load_step.c.

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

◆ mod_client_find()

static fr_client_t * mod_client_find ( fr_listen_t li,
UNUSED fr_ipaddr_t const *  ipaddr,
UNUSED int  ipproto 
)
static

Definition at line 489 of file proto_load_step.c.

◆ mod_decode()

static int mod_decode ( void const *  instance,
request_t request,
UNUSED uint8_t *const  data,
UNUSED size_t  data_len 
)
static

Decode the packet.

Definition at line 328 of file proto_load_step.c.

+ Here is the call graph for this function:

◆ mod_event_list_set()

static void mod_event_list_set ( fr_listen_t li,
fr_event_list_t el,
void *  nr 
)
static

Set the event list for a new socket.

Parameters
[in]lithe listener
[in]elthe event list
[in]nrcontext from the network side

Definition at line 365 of file proto_load_step.c.

+ Here is the call graph for this function:

◆ mod_generate()

static int mod_generate ( fr_time_t  now,
void *  uctx 
)
static

Generate traffic.

Definition at line 294 of file proto_load_step.c.

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

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 405 of file proto_load_step.c.

+ Here is the call graph for this function:

◆ mod_load_done()

static void mod_load_done ( void *  uctx)
static

The generator noticed completion itself, without a final reply.

Definition at line 223 of file proto_load_step.c.

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

◆ mod_name()

static char const * mod_name ( fr_listen_t li)
static

Definition at line 398 of file proto_load_step.c.

◆ mod_open()

static int mod_open ( fr_listen_t li)
static

Open a load listener.

Definition at line 261 of file proto_load_step.c.

+ Here is the call graph for this function:

◆ mod_read()

static ssize_t mod_read ( fr_listen_t li,
void **  packet_ctx,
fr_time_t recv_time_p,
uint8_t buffer,
size_t  buffer_len,
size_t leftover 
)
static

Definition at line 125 of file proto_load_step.c.

◆ mod_write()

static ssize_t mod_write ( fr_listen_t li,
UNUSED void *  packet_ctx,
fr_time_t  request_time,
UNUSED uint8_t buffer,
size_t  buffer_len,
UNUSED size_t  written 
)
static

Definition at line 231 of file proto_load_step.c.

+ Here is the call graph for this function:

◆ write_stats()

static void write_stats ( fr_timer_list_t tl,
fr_time_t  now,
void *  uctx 
)
static

Definition at line 310 of file proto_load_step.c.

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

Variable Documentation

◆ load_listen_config

const conf_parser_t load_listen_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("max_attributes", proto_load_step_t, max_attributes), .dflt = STRINGIFY(RADIUS_MAX_ATTRIBUTES) } ,
{ FR_CONF_OFFSET("start_pps", proto_load_step_t, load.start_pps) },
{ FR_CONF_OFFSET("max_pps", proto_load_step_t, load.max_pps) },
{ FR_CONF_OFFSET("duration", proto_load_step_t, load.duration) },
{ FR_CONF_OFFSET("max_backlog", proto_load_step_t, load.milliseconds) },
{ FR_CONF_OFFSET("parallel", proto_load_step_t, load.parallel) },
{ FR_CONF_OFFSET("max_requests", proto_load_step_t, load.max_requests) },
{ FR_CONF_OFFSET("on_complete", proto_load_step_t, on_complete),
.dflt = "exit" },
}
#define load(_var)
#define STRINGIFY(x)
Definition build.h:216
int cf_table_parse_int(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
Generic function for parsing conf pair values as int.
Definition cf_parse.c:1724
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:669
#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:280
#define FR_CONF_OFFSET_FLAGS(_name, _flags, _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
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition cf_parse.h:429
@ CONF_FLAG_NOT_EMPTY
CONF_PAIR is required to have a non zero length value.
Definition cf_parse.h:447
@ CONF_FLAG_FILE_READABLE
File matching value must exist, and must be readable.
Definition cf_parse.h:435
static size_t load_on_complete_table_len
static fr_table_num_sorted_t const load_on_complete_table[]
#define RADIUS_MAX_ATTRIBUTES
Definition radius.h:39

Definition at line 103 of file proto_load_step.c.

◆ load_on_complete_table

fr_table_num_sorted_t const load_on_complete_table[]
static
Initial value:
= {
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition build.h:228
@ LOAD_STEP_ON_COMPLETE_REPEAT
run the test again from start_pps
@ LOAD_STEP_ON_COMPLETE_STOP
stop generating load, leave the server running
@ LOAD_STEP_ON_COMPLETE_EXIT
make the server exit
@ LOAD_STEP_ON_COMPLETE_CONTINUE
never complete, keep sending at max_pps forever

Definition at line 53 of file proto_load_step.c.

◆ load_on_complete_table_len

size_t load_on_complete_table_len = NUM_ELEMENTS(load_on_complete_table)
static

Definition at line 59 of file proto_load_step.c.

◆ proto_load_step

fr_app_io_t proto_load_step
Initial value:
= {
.common = {
.name = "load_step",
.config = load_listen_config,
.inst_size = sizeof(proto_load_step_t),
.thread_inst_size = sizeof(proto_load_step_thread_t),
.instantiate = mod_instantiate
},
.default_message_size = 4096,
.track_duplicates = false,
.open = mod_open,
.read = mod_read,
.write = mod_write,
.event_list_set = mod_event_list_set,
.client_find = mod_client_find,
.get_name = mod_name,
.decode = mod_decode,
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition dl_module.h:63
static ssize_t mod_read(fr_listen_t *li, void **packet_ctx, fr_time_t *recv_time_p, uint8_t *buffer, size_t buffer_len, size_t *leftover)
static const conf_parser_t load_listen_config[]
static int mod_decode(void const *instance, request_t *request, UNUSED uint8_t *const data, UNUSED size_t data_len)
Decode the packet.
struct proto_load_step_s proto_load_step_t
static ssize_t mod_write(fr_listen_t *li, UNUSED void *packet_ctx, fr_time_t request_time, UNUSED uint8_t *buffer, size_t buffer_len, UNUSED size_t written)
static void mod_event_list_set(fr_listen_t *li, fr_event_list_t *el, void *nr)
Set the event list for a new socket.
static int mod_open(fr_listen_t *li)
Open a load listener.
static char const * mod_name(fr_listen_t *li)
static int mod_instantiate(module_inst_ctx_t const *mctx)
static fr_client_t * mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto)

Definition at line 496 of file proto_load_step.c.