The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Typedefs | Functions | Variables
network.h File Reference
#include <freeradius-devel/io/worker.h>
#include <freeradius-devel/util/log.h>
+ Include dependency graph for network.h:

Go to the source code of this file.

Data Structures

struct  fr_network_config_t
 

Typedefs

typedef struct fr_network_s fr_network_t
 

Functions

void fr_network (fr_network_t *nr)
 The main network worker function. More...
 
fr_network_tfr_network_create (TALLOC_CTX *ctx, fr_event_list_t *el, char const *nr, fr_log_t const *logger, fr_log_lvl_t lvl, fr_network_config_t const *config))
 Create a network. More...
 
int fr_network_destroy (fr_network_t *nr)
 Stop a network thread in an orderly way. More...
 
int fr_network_directory_add (fr_network_t *nr, fr_listen_t *li)
 Add a "watch directory" call to a network. More...
 
int fr_network_exit (fr_network_t *nr)
 Signal a network thread to exit. More...
 
int fr_network_listen_add (fr_network_t *nr, fr_listen_t *li)
 Add a fr_listen_t to a network. More...
 
int fr_network_listen_delete (fr_network_t *nr, fr_listen_t *li)
 Delete a socket from a network. More...
 
int fr_network_listen_inject (fr_network_t *nr, fr_listen_t *li, uint8_t const *packet, size_t packet_len, fr_time_t recv_time)
 Inject a packet for a listener to read. More...
 
size_t fr_network_listen_outstanding (fr_network_t *nr, fr_listen_t *li)
 Get the number of outstanding packets. More...
 
void fr_network_listen_read (fr_network_t *nr, fr_listen_t *li)
 Signal the network to read from a listener. More...
 
int fr_network_listen_send_packet (fr_network_t *nr, fr_listen_t *parent, fr_listen_t *li, const uint8_t *buffer, size_t buflen, fr_time_t recv_time, void *packet_ctx))
 Send a packet to the worker. More...
 
void fr_network_listen_write (fr_network_t *nr, fr_listen_t *li, uint8_t const *packet, size_t packet_len, void *packet_ctx, fr_time_t request_time)
 Inject a packet for a listener to write. More...
 
int fr_network_sendto_worker (fr_network_t *nr, fr_listen_t *li, void *packet_ctx, uint8_t const *data, size_t data_len, fr_time_t recv_time)
 
int fr_network_stats (fr_network_t const *nr, int num, uint64_t *stats)
 
void fr_network_stats_log (fr_network_t const *nr, fr_log_t const *log)
 
int fr_network_worker_add (fr_network_t *nr, fr_worker_t *worker)
 Add a worker to a network in a different thread. More...
 
void fr_network_worker_add_self (fr_network_t *nr, fr_worker_t *worker)
 Add a worker to a network in the same thread. More...
 

Variables

fr_cmd_table_t cmd_network_table []
 

Data Structure Documentation

◆ fr_network_config_t

struct fr_network_config_t

Definition at line 45 of file network.h.

Data Fields
uint32_t max_outstanding

Typedef Documentation

◆ fr_network_t

typedef struct fr_network_s fr_network_t

Definition at line 1 of file network.h.

Function Documentation

◆ fr_network()

void fr_network ( fr_network_t nr)

The main network worker function.

Parameters
[in]nrthe network data structure to run.

Definition at line 1794 of file network.c.

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

◆ fr_network_create()

fr_network_t* fr_network_create ( TALLOC_CTX *  ctx,
fr_event_list_t el,
char const *  name,
fr_log_t const *  logger,
fr_log_lvl_t  lvl,
fr_network_config_t const *  config 
)

Create a network.

Parameters
[in]ctxThe talloc ctx
[in]elThe event list
[in]nameNetworker identifier.
[in]loggerThe destination for all logging messages
[in]lvlLog level
[in]configconfiguration structure.
Returns
  • NULL on error
  • fr_network_t on success

Definition at line 1882 of file network.c.

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

◆ fr_network_destroy()

int fr_network_destroy ( fr_network_t nr)

Stop a network thread in an orderly way.

Parameters
[in]nrthe network to stop

Definition at line 1681 of file network.c.

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

◆ fr_network_directory_add()

int fr_network_directory_add ( fr_network_t nr,
fr_listen_t li 
)

Add a "watch directory" call to a network.

Parameters
nrthe network
lithe listener

Definition at line 278 of file network.c.

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

◆ fr_network_exit()

int fr_network_exit ( fr_network_t nr)

Signal a network thread to exit.

Note
Request to exit will be processed asynchronously.
Parameters
[in]nrthe network data structure to manage
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1849 of file network.c.

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

◆ fr_network_listen_add()

int fr_network_listen_add ( fr_network_t nr,
fr_listen_t li 
)

Add a fr_listen_t to a network.

Parameters
nrthe network
lithe listener

Definition at line 236 of file network.c.

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

◆ fr_network_listen_delete()

int fr_network_listen_delete ( fr_network_t nr,
fr_listen_t li 
)

Delete a socket from a network.

MUST be called only by the listener itself!.

Parameters
nrthe network
lithe listener

Definition at line 259 of file network.c.

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

◆ fr_network_listen_inject()

int fr_network_listen_inject ( fr_network_t nr,
fr_listen_t li,
uint8_t const *  packet,
size_t  packet_len,
fr_time_t  recv_time 
)

Inject a packet for a listener to read.

Parameters
nrthe network
lithe listener where the packet is being injected
packetthe packet to be injected
packet_lenthe length of the packet
recv_timewhen the packet was received.
Returns
  • <0 on error
  • 0 on success

Definition at line 398 of file network.c.

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

◆ fr_network_listen_outstanding()

size_t fr_network_listen_outstanding ( fr_network_t nr,
fr_listen_t li 
)

Get the number of outstanding packets.

Parameters
nrthe network
lithe listener that the packet was "read" from
Returns
  • <0 on error
  • the number of outstanding packets

Definition at line 805 of file network.c.

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

◆ fr_network_listen_read()

void fr_network_listen_read ( fr_network_t nr,
fr_listen_t li 
)

Signal the network to read from a listener.

Parameters
nrthe network
lithe listener to read from

Definition at line 324 of file network.c.

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

◆ fr_network_listen_send_packet()

int fr_network_listen_send_packet ( fr_network_t nr,
fr_listen_t parent,
fr_listen_t li,
const uint8_t buffer,
size_t  buflen,
fr_time_t  recv_time,
void *  packet_ctx 
)

Send a packet to the worker.

MUST only be called from the network thread.

Parameters
nrthe network
parentthe parent listener
lithe listener that the packet was "read" from. Can be "parent"
bufferthe packet to send
buflensize of the packet to send
recv_timeof the packet
packet_ctxfor the packet
Returns
  • <0 on error
  • 0 on success

Definition at line 763 of file network.c.

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

◆ fr_network_listen_write()

void fr_network_listen_write ( fr_network_t nr,
fr_listen_t li,
uint8_t const *  packet,
size_t  packet_len,
void *  packet_ctx,
fr_time_t  request_time 
)

Inject a packet for a listener to write.

Parameters
nrthe network
lithe listener where the packet is being injected
packetthe packet to be written
packet_lenthe length of the packet
packet_ctxThe packet context to write
request_timewhen the packet was received.

Definition at line 350 of file network.c.

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

◆ fr_network_sendto_worker()

int fr_network_sendto_worker ( fr_network_t nr,
fr_listen_t li,
void *  packet_ctx,
uint8_t const *  data,
size_t  data_len,
fr_time_t  recv_time 
)

Definition at line 1030 of file network.c.

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

◆ fr_network_stats()

int fr_network_stats ( fr_network_t const *  nr,
int  num,
uint64_t *  stats 
)

Definition at line 2007 of file network.c.

◆ fr_network_stats_log()

void fr_network_stats_log ( fr_network_t const *  nr,
fr_log_t const *  log 
)

Definition at line 2023 of file network.c.

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

◆ fr_network_worker_add()

int fr_network_worker_add ( fr_network_t nr,
fr_worker_t worker 
)

Add a worker to a network in a different thread.

Parameters
nrthe network
workerthe worker

Definition at line 293 of file network.c.

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

◆ fr_network_worker_add_self()

void fr_network_worker_add_self ( fr_network_t nr,
fr_worker_t worker 
)

Add a worker to a network in the same thread.

Parameters
nrthe network
workerthe worker

Definition at line 313 of file network.c.

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

Variable Documentation

◆ cmd_network_table

fr_cmd_table_t cmd_network_table[]
extern

Definition at line 2090 of file network.c.