All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
rlm_sqlcounter.c File Reference

Tracks data usage and other counters using SQL. More...

#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/modules.h>
#include <freeradius-devel/rad_assert.h>
#include <ctype.h>
+ Include dependency graph for rlm_sqlcounter.c:

Go to the source code of this file.

Data Structures

struct  rlm_sqlcounter_t
 

Macros

#define MAX_QUERY_LEN   1024
 

Typedefs

typedef struct rlm_sqlcounter_t rlm_sqlcounter_t
 

Functions

static rlm_rcode_t CC_HINT (nonnull)
 
static int counter_cmp (void *instance, REQUEST *request, UNUSED VALUE_PAIR *req, VALUE_PAIR *check, UNUSED VALUE_PAIR *check_pairs, UNUSED VALUE_PAIR **reply_pairs)
 
static int find_next_reset (rlm_sqlcounter_t *inst, time_t timeval)
 
static int find_prev_reset (rlm_sqlcounter_t *inst, time_t timeval)
 
static int mod_bootstrap (CONF_SECTION *conf, void *instance)
 
static int mod_instantiate (CONF_SECTION *conf, void *instance)
 
static size_t sqlcounter_expand (char *out, int outlen, rlm_sqlcounter_t *inst, REQUEST *request, char const *fmt)
 

Variables

static const CONF_PARSER module_config []
 
module_t rlm_sqlcounter
 

Detailed Description

Tracks data usage and other counters using SQL.

Id:
90f9bc1feac97015c3ee3533683a7c994adadf07

Definition in file rlm_sqlcounter.c.


Data Structure Documentation

struct rlm_sqlcounter_t

Definition at line 60 of file rlm_sqlcounter.c.

+ Collaboration diagram for rlm_sqlcounter_t:
Data Fields
vp_tmpl_t * key_attr User-Name.
time_t last_reset
vp_tmpl_t * limit_attr Max-Daily-Session.
vp_tmpl_t * paircmp_attr Daily-Session-Time.
char const * query SQL query to retrieve current session time.
vp_tmpl_t * reply_attr Session-Timeout.
char const * reset Daily, weekly, monthly, never or user defined.
time_t reset_time
char const * sqlmod_inst Instance of SQL module to use, usually just 'sql'.

Macro Definition Documentation

#define MAX_QUERY_LEN   1024

Definition at line 33 of file rlm_sqlcounter.c.

Typedef Documentation

Function Documentation

static rlm_rcode_t CC_HINT ( nonnull  )
static

Definition at line 388 of file rlm_sqlcounter.c.

+ Here is the call graph for this function:

static int counter_cmp ( void *  instance,
REQUEST request,
UNUSED VALUE_PAIR req,
VALUE_PAIR check,
UNUSED VALUE_PAIR check_pairs,
UNUSED VALUE_PAIR **  reply_pairs 
)
static

Definition at line 342 of file rlm_sqlcounter.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int find_next_reset ( rlm_sqlcounter_t inst,
time_t  timeval 
)
static

Definition at line 101 of file rlm_sqlcounter.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int find_prev_reset ( rlm_sqlcounter_t inst,
time_t  timeval 
)
static

Definition at line 170 of file rlm_sqlcounter.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int mod_bootstrap ( CONF_SECTION conf,
void *  instance 
)
static

Definition at line 573 of file rlm_sqlcounter.c.

+ Here is the call graph for this function:

static int mod_instantiate ( CONF_SECTION conf,
void *  instance 
)
static

Definition at line 545 of file rlm_sqlcounter.c.

+ Here is the call graph for this function:

static size_t sqlcounter_expand ( char *  out,
int  outlen,
rlm_sqlcounter_t inst,
REQUEST request,
char const *  fmt 
)
static

Definition at line 244 of file rlm_sqlcounter.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const CONF_PARSER module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("sql_module_instance", PW_TYPE_STRING | PW_TYPE_REQUIRED, rlm_sqlcounter_t, sqlmod_inst) },
{ FR_CONF_OFFSET("key", PW_TYPE_TMPL | PW_TYPE_ATTRIBUTE, rlm_sqlcounter_t, key_attr), .dflt = "&request:User-Name", .quote = T_BARE_WORD },
}
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
#define PW_TYPE_XLAT
string will be dynamically expanded.
Definition: conffile.h:207
#define FR_CONF_OFFSET(_n, _t, _s, _f)
Definition: conffile.h:168
#define PW_TYPE_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition: conffile.h:200
#define PW_TYPE_ATTRIBUTE
Value must resolve to attribute in dict (deprecated, use PW_TYPE_TMPL).
Definition: conffile.h:201
String of printable characters.
Definition: radius.h:33
#define PW_TYPE_TMPL
CONF_PAIR should be parsed as a template.
Definition: conffile.h:208

Definition at line 83 of file rlm_sqlcounter.c.

module_t rlm_sqlcounter
Initial value:
= {
.magic = RLM_MODULE_INIT,
.name = "sqlcounter",
.inst_size = sizeof(rlm_sqlcounter_t),
.config = module_config,
.bootstrap = mod_bootstrap,
.instantiate = mod_instantiate,
.methods = {
},
}
static rlm_rcode_t mod_authorize(void *instance, REQUEST *request)
Handle authorization requests using Couchbase document data.
#define RLM_TYPE_THREAD_SAFE
Module is threadsafe.
Definition: modules.h:75
#define RLM_MODULE_INIT
Definition: modules.h:86
struct rlm_sqlcounter_t rlm_sqlcounter_t
static const CONF_PARSER module_config[]
static int mod_bootstrap(CONF_SECTION *conf, void *instance)
static int mod_instantiate(CONF_SECTION *conf, void *instance)
1 methods index for authorize section.
Definition: modules.h:42

Definition at line 628 of file rlm_sqlcounter.c.