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

Keep RADIUS statistics. More...

#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/util/dlist.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/radius/radius.h>
#include <freeradius-devel/protocol/radius/freeradius.h>
#include <pthread.h>
+ Include dependency graph for rlm_stats.c:

Go to the source code of this file.

Data Structures

struct  rlm_stats_data_t
 
struct  rlm_stats_mutable_t
 
struct  rlm_stats_t
 
struct  rlm_stats_thread_t
 

Functions

static void coalesce (uint64_t final_stats[FR_RADIUS_CODE_MAX], rlm_stats_thread_t *t, size_t tree_offset, rlm_stats_data_t *mydata)
 
static int8_t data_cmp (const void *one, const void *two)
 
static int mod_detach (module_detach_ctx_t const *mctx)
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static unlang_action_t mod_stats (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 
static int mod_thread_detach (module_thread_inst_ctx_t const *mctx)
 Destroy thread data for the submodule. More...
 
static int mod_thread_instantiate (module_thread_inst_ctx_t const *mctx)
 Instantiate thread data for the submodule. More...
 

Variables

static fr_dict_attr_t const * attr_freeradius_stats4_ipv4_address
 
static fr_dict_attr_t const * attr_freeradius_stats4_ipv6_address
 
static fr_dict_attr_t const * attr_freeradius_stats4_type
 
static fr_dict_t const * dict_radius
 
static const conf_parser_t module_config []
 
module_rlm_t rlm_stats
 
fr_dict_autoload_t rlm_stats_dict []
 
fr_dict_attr_autoload_t rlm_stats_dict_attr []
 

Detailed Description

Keep RADIUS statistics.

Id
4c28094fcf90c1f6056fcc1b0213c9a74a3be38d

Eventually, also non-RADIUS statistics

Definition in file rlm_stats.c.


Data Structure Documentation

◆ rlm_stats_data_t

struct rlm_stats_data_t

Definition at line 64 of file rlm_stats.c.

+ Collaboration diagram for rlm_stats_data_t:
Data Fields
fr_time_t created when it was created
fr_rb_node_t dst_node
fr_ipaddr_t ipaddr IP address of this thing.
fr_time_t last_packet when we last saw a packet
fr_rb_node_t src_node
uint64_t stats[FR_RADIUS_CODE_MAX] actual statistic

◆ rlm_stats_mutable_t

struct rlm_stats_mutable_t

Definition at line 44 of file rlm_stats.c.

+ Collaboration diagram for rlm_stats_mutable_t:
Data Fields
fr_dlist_head_t list for threads to know about each other
pthread_mutex_t mutex
uint64_t stats[FR_RADIUS_CODE_MAX]

◆ rlm_stats_t

struct rlm_stats_t

Definition at line 55 of file rlm_stats.c.

+ Collaboration diagram for rlm_stats_t:
Data Fields
fr_dict_attr_t const * ipv4_da FreeRADIUS-Stats4-IPv4-Address.
fr_dict_attr_t const * ipv6_da FreeRADIUS-Stats4-IPv6-Address.
rlm_stats_mutable_t * mutable
fr_dict_attr_t const * type_da FreeRADIUS-Stats4-Type.

◆ rlm_stats_thread_t

struct rlm_stats_thread_t

Definition at line 73 of file rlm_stats.c.

+ Collaboration diagram for rlm_stats_thread_t:
Data Fields
fr_rb_tree_t * dst stats by destination
fr_dlist_t entry for threads to know about each other
rlm_stats_t * inst
fr_time_t last_global_update
fr_time_t last_manage when we deleted old things
pthread_mutex_t mutex
fr_rb_tree_t * src stats by source
uint64_t stats[FR_RADIUS_CODE_MAX]

Function Documentation

◆ coalesce()

static void coalesce ( uint64_t  final_stats[FR_RADIUS_CODE_MAX],
rlm_stats_thread_t t,
size_t  tree_offset,
rlm_stats_data_t mydata 
)
static

Definition at line 113 of file rlm_stats.c.

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

◆ data_cmp()

static int8_t data_cmp ( const void *  one,
const void *  two 
)
static

Definition at line 355 of file rlm_stats.c.

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

◆ mod_detach()

static int mod_detach ( module_detach_ctx_t const *  mctx)
static

Definition at line 427 of file rlm_stats.c.

+ Here is the call graph for this function:

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 412 of file rlm_stats.c.

+ Here is the call graph for this function:

◆ mod_stats()

static unlang_action_t mod_stats ( rlm_rcode_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Definition at line 169 of file rlm_stats.c.

+ Here is the call graph for this function:

◆ mod_thread_detach()

static int mod_thread_detach ( module_thread_inst_ctx_t const *  mctx)
static

Destroy thread data for the submodule.

Definition at line 395 of file rlm_stats.c.

+ Here is the call graph for this function:

◆ mod_thread_instantiate()

static int mod_thread_instantiate ( module_thread_inst_ctx_t const *  mctx)
static

Instantiate thread data for the submodule.

Definition at line 366 of file rlm_stats.c.

+ Here is the call graph for this function:

Variable Documentation

◆ attr_freeradius_stats4_ipv4_address

fr_dict_attr_t const* attr_freeradius_stats4_ipv4_address
static

Definition at line 101 of file rlm_stats.c.

◆ attr_freeradius_stats4_ipv6_address

fr_dict_attr_t const* attr_freeradius_stats4_ipv6_address
static

Definition at line 102 of file rlm_stats.c.

◆ attr_freeradius_stats4_type

fr_dict_attr_t const* attr_freeradius_stats4_type
static

Definition at line 103 of file rlm_stats.c.

◆ dict_radius

fr_dict_t const* dict_radius
static

Definition at line 93 of file rlm_stats.c.

◆ module_config

const conf_parser_t module_config[]
static
Initial value:
= {
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:627

Definition at line 89 of file rlm_stats.c.

◆ rlm_stats

module_rlm_t rlm_stats
Initial value:
= {
.common = {
.name = "stats",
.inst_size = sizeof(rlm_stats_t),
.thread_inst_size = sizeof(rlm_stats_thread_t),
.config = module_config,
.instantiate = mod_instantiate,
.detach = mod_detach,
.thread_instantiate = mod_thread_instantiate,
.thread_detach = mod_thread_detach
},
.method_group = {
.bindings = (module_method_binding_t[]){
{ .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_stats },
}
}
}
#define CF_IDENT_ANY
Definition: cf_util.h:78
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:63
static int mod_detach(module_detach_ctx_t const *mctx)
Definition: rlm_stats.c:427
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
Instantiate thread data for the submodule.
Definition: rlm_stats.c:366
static const conf_parser_t module_config[]
Definition: rlm_stats.c:89
static int mod_thread_detach(module_thread_inst_ctx_t const *mctx)
Destroy thread data for the submodule.
Definition: rlm_stats.c:395
static int mod_instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_stats.c:412
static unlang_action_t mod_stats(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_stats.c:169
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
Definition: section.h:40
#define MODULE_BINDING_TERMINATOR
Terminate a module binding list.
Definition: module.h:151
Named methods exported by a module.
Definition: module.h:173

Definition at line 449 of file rlm_stats.c.

◆ rlm_stats_dict

fr_dict_autoload_t rlm_stats_dict
Initial value:
= {
{ .out = &dict_radius, .proto = "radius" },
{ NULL }
}
static fr_dict_t const * dict_radius
Definition: rlm_stats.c:93

Definition at line 96 of file rlm_stats.c.

◆ rlm_stats_dict_attr

fr_dict_attr_autoload_t rlm_stats_dict_attr
Initial value:
= {
{ .out = &attr_freeradius_stats4_ipv4_address, .name = "Vendor-Specific.FreeRADIUS.Stats4.Stats4-IPv4-Address", .type = FR_TYPE_IPV4_ADDR, .dict = &dict_radius },
{ .out = &attr_freeradius_stats4_ipv6_address, .name = "Vendor-Specific.FreeRADIUS.Stats4.Stats4-IPv6-Address", .type = FR_TYPE_IPV6_ADDR, .dict = &dict_radius },
{ .out = &attr_freeradius_stats4_type, .name = "Vendor-Specific.FreeRADIUS.Stats4.Stats4-Type", .type = FR_TYPE_UINT32, .dict = &dict_radius },
{ NULL }
}
@ FR_TYPE_IPV4_ADDR
32 Bit IPv4 Address.
Definition: merged_model.c:86
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition: merged_model.c:99
@ FR_TYPE_IPV6_ADDR
128 Bit IPv6 Address.
Definition: merged_model.c:88
static fr_dict_attr_t const * attr_freeradius_stats4_ipv4_address
Definition: rlm_stats.c:101
static fr_dict_attr_t const * attr_freeradius_stats4_ipv6_address
Definition: rlm_stats.c:102
static fr_dict_attr_t const * attr_freeradius_stats4_type
Definition: rlm_stats.c:103

Definition at line 106 of file rlm_stats.c.