The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Typedefs | Functions | Variables
worker.h File Reference

Functions and data structures for worker threads. More...

#include <freeradius-devel/io/base.h>
#include <freeradius-devel/server/command.h>
#include <freeradius-devel/util/event.h>
#include <freeradius-devel/util/heap.h>
#include <freeradius-devel/util/log.h>
#include <freeradius-devel/util/talloc.h>
#include <pthread.h>
#include <freeradius-devel/server/module.h>
+ Include dependency graph for worker.h:

Go to the source code of this file.

Data Structures

struct  fr_worker_config_t
 

Typedefs

typedef struct fr_worker_s fr_worker_t
 A data structure to track the worker. More...
 

Functions

void fr_worker (fr_worker_t *worker)
 The main loop and entry point of the stand-alone worker thread. More...
 
fr_channel_tfr_worker_channel_create (fr_worker_t *worker, TALLOC_CTX *ctx, fr_control_t *master)
 Create a channel to the worker. More...
 
fr_worker_tfr_worker_create (TALLOC_CTX *ctx, fr_event_list_t *el, char const *name, fr_log_t const *logger, fr_log_lvl_t lvl, fr_worker_config_t *config))
 Create a worker. More...
 
void fr_worker_debug (fr_worker_t *worker, FILE *fp)
 Print debug information about the worker structure. More...
 
void fr_worker_destroy (fr_worker_t *worker)
 Destroy a worker. More...
 
int fr_worker_listen_cancel (fr_worker_t *worker, fr_listen_t const *li)
 
void fr_worker_post_event (fr_event_list_t *el, fr_time_t now, void *uctx)
 
int fr_worker_pre_event (fr_time_t now, fr_time_delta_t wake, void *uctx)
 
int fr_worker_stats (fr_worker_t const *worker, int num, uint64_t *stats)
 
int fr_worker_subrequest_add (request_t *request)
 

Variables

fr_cmd_table_t cmd_worker_table []
 

Detailed Description

Functions and data structures for worker threads.

Id
fb138f84a4068ba2ddc45f1acbf97afa8d06bf2d

Definition in file worker.h.


Data Structure Documentation

◆ fr_worker_config_t

struct fr_worker_config_t

Definition at line 58 of file worker.h.

+ Collaboration diagram for fr_worker_config_t:
Data Fields
int max_channels maximum number of channels
fr_time_delta_t max_request_time maximum time a request can be processed
int max_requests max requests this worker will handle
int message_set_size default start number of messages
int ring_buffer_size default start size for the ring buffers
size_t talloc_pool_size for each request

Typedef Documentation

◆ fr_worker_t

typedef struct fr_worker_s fr_worker_t

A data structure to track the worker.

Once spawned, workers exist until they choose to exit.

Definition at line 1 of file worker.h.

Function Documentation

◆ fr_worker()

void fr_worker ( fr_worker_t worker)

The main loop and entry point of the stand-alone worker thread.

Where there is only one thread, the event loop runs fr_worker_pre_event() and fr_worker_post_event() instead, And then fr_worker_post_event() takes care of calling worker_run_request() to actually run the request.

Parameters
[in]workerthe worker data structure to manage

Definition at line 1493 of file worker.c.

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

◆ fr_worker_channel_create()

fr_channel_t* fr_worker_channel_create ( fr_worker_t worker,
TALLOC_CTX *  ctx,
fr_control_t master 
)

Create a channel to the worker.

Called by the master (i.e. network) thread when it needs to create a new channel to a particuler worker.

Parameters
[in]workerthe worker
[in]masterthe control plane of the master
[in]ctxthe context in which the channel will be created

Definition at line 1605 of file worker.c.

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

◆ fr_worker_create()

fr_worker_t* fr_worker_create ( TALLOC_CTX *  ctx,
fr_event_list_t el,
char const *  name,
fr_log_t const *  logger,
fr_log_lvl_t  lvl,
fr_worker_config_t config 
)

Create a worker.

Parameters
[in]ctxthe talloc context
[in]namethe name of this worker
[in]elthe event list
[in]loggerthe destination for all logging messages
[in]lvllog level
[in]configvarious configuration parameters
Returns
  • NULL on error
  • fr_worker_t on success

Definition at line 1356 of file worker.c.

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

◆ fr_worker_debug()

void fr_worker_debug ( fr_worker_t worker,
FILE *  fp 
)

Print debug information about the worker structure.

Parameters
[in]workerthe worker
[in]fpthe file where the debug output is printed.

Definition at line 1580 of file worker.c.

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

◆ fr_worker_destroy()

void fr_worker_destroy ( fr_worker_t worker)

Destroy a worker.

The input channels are signaled, and local messages are cleaned up.

This should be called to EXPLICITLY destroy a worker, when some fatal error has occurred on the worker side, and we need to destroy it.

We signal all pending requests in the backlog to stop, and tell the network side that it should not send us any more requests.

Parameters
[in]workerthe worker to destroy.

Definition at line 1012 of file worker.c.

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

◆ fr_worker_listen_cancel()

int fr_worker_listen_cancel ( fr_worker_t worker,
fr_listen_t const *  li 
)

Definition at line 1632 of file worker.c.

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

◆ fr_worker_post_event()

void fr_worker_post_event ( fr_event_list_t el,
fr_time_t  now,
void *  uctx 
)

◆ fr_worker_pre_event()

int fr_worker_pre_event ( fr_time_t  now,
fr_time_delta_t  wake,
void *  uctx 
)

◆ fr_worker_stats()

int fr_worker_stats ( fr_worker_t const *  worker,
int  num,
uint64_t *  stats 
)

Definition at line 1681 of file worker.c.

◆ fr_worker_subrequest_add()

int fr_worker_subrequest_add ( request_t request)

Variable Documentation

◆ cmd_worker_table

fr_cmd_table_t cmd_worker_table[]
extern

Definition at line 1734 of file worker.c.