The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Functions | Variables
radius1_test.c File Reference
#include <freeradius-devel/io/control.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/io/worker.h>
#include <freeradius-devel/radius/defs.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/inet.h>
#include <freeradius-devel/util/log.h>
#include <freeradius-devel/util/md5.h>
#include <freeradius-devel/util/syserror.h>
#include <pthread.h>
#include <signal.h>
#include <sys/event.h>
+ Include dependency graph for radius1_test.c:

Go to the source code of this file.

Data Structures

struct  fr_packet_ctx_t
 
struct  fr_schedule_worker_t
 Scheduler specific information for worker threads. More...
 

Macros

#define MAX_CONTROL_PLANE   (1024)
 
#define MAX_KEVENTS   (10)
 
#define MAX_MESSAGES   (2048)
 
#define MAX_WORKERS   (1024)
 
#define MPRINT1   if (debug_lvl) printf
 
#define MPRINT2   if (debug_lvl > 1) printf
 

Functions

int main (int argc, char *argv[])
 
static void master_process (TALLOC_CTX *ctx)
 
static void send_reply (int sockfd, fr_channel_data_t *reply)
 
static void sig_ignore (int sig)
 
static int test_decode (UNUSED void const *instance, request_t *request, uint8_t *const data, size_t data_len)
 
static ssize_t test_encode (UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
 
static size_t test_nak (void const *instance, UNUSED void *packet_ctx, uint8_t *const packet, size_t packet_len, UNUSED uint8_t *reply, UNUSED size_t reply_len)
 
static rlm_rcode_t test_process (UNUSED void const *instance, request_t *request, fr_io_action_t action)
 
static NEVER_RETURNS void usage (void)
 
static void * worker_thread (void *arg)
 

Variables

static fr_app_io_t app_io
 
static int debug_lvl = 0
 
static int max_control_plane = 0
 
static fr_ipaddr_t my_ipaddr
 
static uint16_t my_port
 
static int num_workers = 1
 
static bool quiet = false
 
static char const * secret = "testing123"
 
static fr_schedule_worker_t workers [MAX_WORKERS]
 

Data Structure Documentation

◆ fr_packet_ctx_t

struct fr_packet_ctx_t

Definition at line 60 of file radius1_test.c.

Data Fields
uint8_t id
socklen_t salen
struct sockaddr_storage src
uint8_t vector[16]

◆ fr_schedule_worker_t

struct fr_schedule_worker_t

Scheduler specific information for worker threads.

Wraps a fr_worker_t, tracking additional information that the scheduler uses.

Definition at line 83 of file schedule.c.

+ Collaboration diagram for fr_schedule_worker_t:
Data Fields
fr_channel_t * ch channel for communicating with the worker
fr_time_t cpu_time how much CPU time this worker has used
TALLOC_CTX * ctx our allocation ctx
fr_event_list_t * el our event list
fr_dlist_t entry our entry into the linked list of workers
unsigned int id a unique ID

ID of the worker 0..N.

int id ID of the worker 0..N.
pthread_t pthread_id the thread of this worker

pthread ID of the worker

fr_schedule_t * sc the scheduler we are running under
fr_schedule_child_status_t status status of the worker
int uses how many network threads are using it
fr_worker_t * worker the worker data structure

pointer to the worker

Macro Definition Documentation

◆ MAX_CONTROL_PLANE

#define MAX_CONTROL_PLANE   (1024)

Definition at line 45 of file radius1_test.c.

◆ MAX_KEVENTS

#define MAX_KEVENTS   (10)

Definition at line 46 of file radius1_test.c.

◆ MAX_MESSAGES

#define MAX_MESSAGES   (2048)

Definition at line 44 of file radius1_test.c.

◆ MAX_WORKERS

#define MAX_WORKERS   (1024)

Definition at line 47 of file radius1_test.c.

◆ MPRINT1

#define MPRINT1   if (debug_lvl) printf

Definition at line 49 of file radius1_test.c.

◆ MPRINT2

#define MPRINT2   if (debug_lvl > 1) printf

Definition at line 50 of file radius1_test.c.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 521 of file radius1_test.c.

+ Here is the call graph for this function:

◆ master_process()

static void master_process ( TALLOC_CTX *  ctx)
static

Definition at line 207 of file radius1_test.c.

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

◆ send_reply()

static void send_reply ( int  sockfd,
fr_channel_data_t reply 
)
static

Definition at line 190 of file radius1_test.c.

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

◆ sig_ignore()

static void sig_ignore ( int  sig)
static

Definition at line 516 of file radius1_test.c.

+ Here is the caller graph for this function:

◆ test_decode()

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

Definition at line 99 of file radius1_test.c.

+ Here is the call graph for this function:

◆ test_encode()

static ssize_t test_encode ( UNUSED void const *  instance,
request_t request,
uint8_t buffer,
size_t  buffer_len 
)
static

Definition at line 114 of file radius1_test.c.

+ Here is the call graph for this function:

◆ test_nak()

static size_t test_nak ( void const *  instance,
UNUSED void *  packet_ctx,
uint8_t *const  packet,
size_t  packet_len,
UNUSED uint8_t reply,
UNUSED size_t  reply_len 
)
static

Definition at line 139 of file radius1_test.c.

◆ test_process()

static rlm_rcode_t test_process ( UNUSED void const *  instance,
request_t request,
fr_io_action_t  action 
)
static

Definition at line 92 of file radius1_test.c.

+ Here is the caller graph for this function:

◆ usage()

static NEVER_RETURNS void usage ( void  )
static

Definition at line 79 of file radius1_test.c.

+ Here is the caller graph for this function:

◆ worker_thread()

static void* worker_thread ( void *  arg)
static

Definition at line 154 of file radius1_test.c.

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

Variable Documentation

◆ app_io

fr_app_io_t app_io
static
Initial value:
= {
.name = "worker-test",
.default_message_size = 4096,
.nak = test_nak,
.encode = test_encode,
.decode = test_decode
}
static int test_decode(UNUSED void const *instance, request_t *request, uint8_t *const data, size_t data_len)
Definition: radius1_test.c:99
static ssize_t test_encode(UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
Definition: radius1_test.c:114
static size_t test_nak(void const *instance, UNUSED void *packet_ctx, uint8_t *const packet, size_t packet_len, UNUSED uint8_t *reply, UNUSED size_t reply_len)
Definition: radius1_test.c:139

Definition at line 146 of file radius1_test.c.

◆ debug_lvl

int debug_lvl = 0
static

Definition at line 68 of file radius1_test.c.

◆ max_control_plane

int max_control_plane = 0
static

Definition at line 69 of file radius1_test.c.

◆ my_ipaddr

fr_ipaddr_t my_ipaddr
static

Definition at line 73 of file radius1_test.c.

◆ my_port

uint16_t my_port
static

Definition at line 74 of file radius1_test.c.

◆ num_workers

int num_workers = 1
static

Definition at line 70 of file radius1_test.c.

◆ quiet

bool quiet = false
static

Definition at line 71 of file radius1_test.c.

◆ secret

char const* secret = "testing123"
static

Definition at line 75 of file radius1_test.c.

◆ workers

Definition at line 77 of file radius1_test.c.