The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Functions | Variables
proto_detail_work.c File Reference

Detail handler for files. More...

#include <netdb.h>
#include <freeradius-devel/server/protocol.h>
#include <freeradius-devel/server/pair.h>
#include <freeradius-devel/server/main_loop.h>
#include <freeradius-devel/io/application.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/util/syserror.h>
#include "proto_detail.h"
#include <fcntl.h>
#include <sys/stat.h>
+ Include dependency graph for proto_detail_work.c:

Go to the source code of this file.

Data Structures

struct  fr_detail_entry_t
 

Macros

#define MPRINT   DEBUG3
 

Functions

static int mod_bootstrap (module_inst_ctx_t const *mctx)
 
static int mod_close (fr_listen_t *li)
 Close a detail listener. More...
 
static int mod_close_internal (proto_detail_work_thread_t *thread)
 
static int mod_decode (void const *instance, request_t *request, UNUSED uint8_t *const data, UNUSED size_t data_len)
 
static void mod_event_list_set (fr_listen_t *li, fr_event_list_t *el, void *nr)
 Set the event list for a new IO instance. More...
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static char const * mod_name (fr_listen_t *li)
 
static int mod_open (fr_listen_t *li)
 Open a detail listener. More...
 
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, void *packet_ctx, UNUSED fr_time_t request_time, uint8_t *buffer, size_t buffer_len, UNUSED size_t written)
 
static void work_retransmit (UNUSED fr_event_list_t *el, UNUSED fr_time_t now, void *uctx)
 

Variables

static fr_dict_attr_t const * attr_packet_transmit_counter
 
static fr_dict_t const * dict_freeradius
 
static const conf_parser_t file_listen_config []
 
static conf_parser_t limit_config []
 
static fr_event_update_t pause_read []
 
fr_app_io_t proto_detail_work
 Private interface for use by proto_detail_file. More...
 
fr_dict_autoload_t proto_detail_work_dict []
 
fr_dict_attr_autoload_t proto_detail_work_dict_attr []
 
static fr_event_update_t resume_read []
 

Detailed Description

Detail handler for files.

Id
1db3139246e97dfa4062dd2e7714b691a1af2d64

Definition in file proto_detail_work.c.


Data Structure Documentation

◆ fr_detail_entry_t

struct fr_detail_entry_t

Definition at line 52 of file proto_detail_work.c.

+ Collaboration diagram for fr_detail_entry_t:
Data Fields
off_t done_offset where we're tracking the status
fr_dlist_t entry for the retransmission list
fr_event_timer_t const * ev retransmission timer
int id for retransmission counters
uint8_t * packet for retransmissions
size_t packet_len for retransmissions
proto_detail_work_thread_t * parent talloc_parent is SLOW!
fr_retry_t retry our retry timers
fr_time_t timestamp when we read the entry.

Macro Definition Documentation

◆ MPRINT

#define MPRINT   DEBUG3

Definition at line 45 of file proto_detail_work.c.

Function Documentation

◆ mod_bootstrap()

static int mod_bootstrap ( module_inst_ctx_t const *  mctx)
static

Definition at line 861 of file proto_detail_work.c.

+ Here is the call graph for this function:

◆ mod_close()

static int mod_close ( fr_listen_t li)
static

Close a detail listener.

Definition at line 788 of file proto_detail_work.c.

+ Here is the call graph for this function:

◆ mod_close_internal()

static int mod_close_internal ( proto_detail_work_thread_t thread)
static

Definition at line 735 of file proto_detail_work.c.

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

◆ mod_decode()

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

Definition at line 115 of file proto_detail_work.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 IO instance.

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

Definition at line 816 of file proto_detail_work.c.

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 843 of file proto_detail_work.c.

◆ mod_name()

static char const* mod_name ( fr_listen_t li)
static

Definition at line 836 of file proto_detail_work.c.

◆ mod_open()

static int mod_open ( fr_listen_t li)
static

Open a detail listener.

Definition at line 676 of file proto_detail_work.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 144 of file proto_detail_work.c.

+ Here is the call graph for this function:

◆ mod_write()

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

Definition at line 570 of file proto_detail_work.c.

+ Here is the call graph for this function:

◆ work_retransmit()

static void work_retransmit ( UNUSED fr_event_list_t el,
UNUSED fr_time_t  now,
void *  uctx 
)
static

Definition at line 540 of file proto_detail_work.c.

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

Variable Documentation

◆ attr_packet_transmit_counter

fr_dict_attr_t const* attr_packet_transmit_counter
static

Definition at line 104 of file proto_detail_work.c.

◆ dict_freeradius

fr_dict_t const* dict_freeradius
static

Definition at line 95 of file proto_detail_work.c.

◆ file_listen_config

const conf_parser_t file_listen_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET_FLAGS("filename", CONF_FLAG_REQUIRED, proto_detail_work_t, filename_work ) },
{ FR_CONF_OFFSET("track", proto_detail_work_t, track_progress ) },
{ FR_CONF_OFFSET("retransmit", proto_detail_work_t, retransmit ), .dflt = "yes" },
{ FR_CONF_POINTER("limit", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) limit_config },
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:626
#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
#define FR_CONF_POINTER(_name, _type, _flags, _res_p)
conf_parser_t which parses a single CONF_PAIR producing a single global result
Definition: cf_parse.h:310
#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:256
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition: cf_parse.h:406
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
Definition: cf_parse.h:400
static conf_parser_t limit_config[]

Definition at line 84 of file proto_detail_work.c.

◆ limit_config

conf_parser_t limit_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("initial_rtx_time", proto_detail_work_t, retry_config.irt), .dflt = STRINGIFY(2) },
{ FR_CONF_OFFSET("max_rtx_time", proto_detail_work_t, retry_config.mrt), .dflt = STRINGIFY(16) },
{ FR_CONF_OFFSET("max_rtx_count", proto_detail_work_t, retry_config.mrc), .dflt = STRINGIFY(0) },
{ FR_CONF_OFFSET("max_rtx_duration", proto_detail_work_t, retry_config.mrd), .dflt = STRINGIFY(0) },
{ FR_CONF_OFFSET("max_outstanding", proto_detail_work_t, max_outstanding), .dflt = STRINGIFY(1) },
}
#define STRINGIFY(x)
Definition: build.h:195
static int max_outstanding
Definition: channel_test.c:51
static conf_parser_t retry_config[]
Definition: rlm_tacacs.c:38

Definition at line 67 of file proto_detail_work.c.

◆ pause_read

fr_event_update_t pause_read[]
static
Initial value:
= {
{ 0 }
}
#define FR_EVENT_SUSPEND(_s, _f)
Temporarily remove the filter for a func from kevent.
Definition: event.h:94
Callbacks for the FR_EVENT_FILTER_IO filter.
Definition: event.h:173

Definition at line 134 of file proto_detail_work.c.

◆ proto_detail_work

fr_app_io_t proto_detail_work
Initial value:
= {
.common = {
.name = "detail_work",
.config = file_listen_config,
.inst_size = sizeof(proto_detail_work_t),
.thread_inst_size = sizeof(proto_detail_work_thread_t),
.bootstrap = mod_bootstrap,
.instantiate = mod_instantiate
},
.default_message_size = 65536,
.default_reply_size = 32,
.open = mod_open,
.close = mod_close,
.read = mod_read,
.decode = mod_decode,
.write = mod_write,
.event_list_set = mod_event_list_set,
.get_name = mod_name,
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:65
struct proto_detail_work_s proto_detail_work_t
Definition: proto_detail.h:76
static const conf_parser_t file_listen_config[]
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 int mod_decode(void const *instance, request_t *request, UNUSED uint8_t *const data, UNUSED size_t data_len)
static int mod_bootstrap(module_inst_ctx_t const *mctx)
static void mod_event_list_set(fr_listen_t *li, fr_event_list_t *el, void *nr)
Set the event list for a new IO instance.
static int mod_open(fr_listen_t *li)
Open a detail listener.
static char const * mod_name(fr_listen_t *li)
static int mod_close(fr_listen_t *li)
Close a detail listener.
static ssize_t mod_write(fr_listen_t *li, void *packet_ctx, UNUSED fr_time_t request_time, uint8_t *buffer, size_t buffer_len, UNUSED size_t written)
static int mod_instantiate(module_inst_ctx_t const *mctx)

Private interface for use by proto_detail_file.

Definition at line 911 of file proto_detail_work.c.

◆ proto_detail_work_dict

fr_dict_autoload_t proto_detail_work_dict
Initial value:
= {
{ .out = &dict_freeradius, .proto = "freeradius" },
{ NULL }
}
static fr_dict_t const * dict_freeradius

Definition at line 98 of file proto_detail_work.c.

◆ proto_detail_work_dict_attr

fr_dict_attr_autoload_t proto_detail_work_dict_attr
Initial value:
= {
{ .out = &attr_packet_transmit_counter, .name = "Packet-Transmit-Counter", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
{ NULL }
}
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition: merged_model.c:99
static fr_dict_attr_t const * attr_packet_transmit_counter

Definition at line 107 of file proto_detail_work.c.

◆ resume_read

fr_event_update_t resume_read[]
static
Initial value:
= {
{ 0 }
}
#define FR_EVENT_RESUME(_s, _f)
Re-add the filter for a func from kevent.
Definition: event.h:110

Definition at line 139 of file proto_detail_work.c.