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

Allocates an IPv4 address from pools stored in SQL. More...

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

Go to the source code of this file.

Data Structures

struct  rlm_sqlippool_t
 

Macros

#define DO(_x)   sqlippool_command(inst->_x, handle, inst, request, NULL, 0)
 
#define MAX_QUERY_LEN   4096
 

Typedefs

typedef struct rlm_sqlippool_t rlm_sqlippool_t
 

Functions

static int CC_HINT (nonnull(1, 3, 4, 5))
 
static rlm_rcode_t CC_HINT (nonnull)
 
static int do_logging (REQUEST *request, char const *str, int rcode)
 
static int mod_accounting_alive (rlm_sql_handle_t *handle, rlm_sqlippool_t *inst, REQUEST *request)
 
static int mod_accounting_off (rlm_sql_handle_t *handle, rlm_sqlippool_t *inst, REQUEST *request)
 
static int mod_accounting_on (rlm_sql_handle_t *handle, rlm_sqlippool_t *inst, REQUEST *request)
 
static int mod_accounting_start (rlm_sql_handle_t *handle, rlm_sqlippool_t *inst, REQUEST *request)
 
static int mod_accounting_stop (rlm_sql_handle_t *handle, rlm_sqlippool_t *inst, REQUEST *request)
 
static int mod_instantiate (CONF_SECTION *conf, void *instance)
 
static int sqlippool_command (char const *fmt, rlm_sql_handle_t *handle, rlm_sqlippool_t *data, REQUEST *request, char *param, int param_len)
 Perform a single sqlippool query. More...
 
static int sqlippool_expand (char *out, int outlen, char const *fmt, rlm_sqlippool_t *data, char *param, int param_len)
 

Variables

static CONF_PARSER message_config []
 
static CONF_PARSER module_config []
 
module_t rlm_sqlippool
 

Detailed Description

Allocates an IPv4 address from pools stored in SQL.

Id:
5c24a61dec4bd03f8ea9c06b89f07c30b01b99e7

Definition in file rlm_sqlippool.c.


Data Structure Documentation

struct rlm_sqlippool_t

Definition at line 40 of file rlm_sqlippool.c.

+ Collaboration diagram for rlm_sqlippool_t:
Data Fields
char const * alive_begin SQL query to begin.
char const * alive_commit SQL query to commit.
char const * alive_update SQL query to update an IP entry.
char const * allocate_begin SQL query to begin.
char const * allocate_clear SQL query to clear an IP.
char const * allocate_commit SQL query to commit.
char const * allocate_find SQL query to find an unused IP.
char const * allocate_update SQL query to mark an IP as used.
char const * defaultpool Default Pool-Name if there is none in the check items.
int framed_ip_address the attribute number for Framed-IP(v6)-Address
bool ipv6 Whether or not we do IPv6 pools.
time_t last_clear So we only do it once a second.
uint32_t lease_duration
char const * log_clear We successfully deallocated ip address from pool.
char const * log_exists There was an ip address already assigned.
char const * log_failed Failed to allocate ip from the pool.
char const * log_nopool There was no Framed-IP-Address but also no Pool-Name.
char const * log_success We successfully allocated ip address from pool.
char const * off_begin SQL query to begin.
char const * off_clear SQL query to clear an entire NAS.
char const * off_commit SQL query to commit.
char const * on_begin SQL query to begin.
char const * on_clear SQL query to clear an entire NAS.
char const * on_commit SQL query to commit.
char const * pool_check Query to check for the existence of the pool.
char const * pool_name
rlm_sql_t * sql_inst
char const * sql_instance_name
char const * start_begin SQL query to begin.
char const * start_commit SQL query to commit.
char const * start_update SQL query to update an IP entry.
char const * stop_begin SQL query to begin.
char const * stop_clear SQL query to clear an IP.
char const * stop_commit SQL query to commit.

Macro Definition Documentation

#define DO (   _x)    sqlippool_command(inst->_x, handle, inst, request, NULL, 0)

Definition at line 306 of file rlm_sqlippool.c.

#define MAX_QUERY_LEN   4096

Definition at line 35 of file rlm_sqlippool.c.

Typedef Documentation

Function Documentation

static int CC_HINT ( nonnull(1, 3, 4, 5)  )
static

Definition at line 311 of file rlm_sqlippool.c.

+ Here is the call graph for this function:

static rlm_rcode_t CC_HINT ( nonnull  )
static

Definition at line 445 of file rlm_sqlippool.c.

+ Here is the call graph for this function:

static int do_logging ( REQUEST request,
char const *  str,
int  rcode 
)
static

Definition at line 424 of file rlm_sqlippool.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int mod_accounting_alive ( rlm_sql_handle_t handle,
rlm_sqlippool_t inst,
REQUEST request 
)
static

Definition at line 593 of file rlm_sqlippool.c.

static int mod_accounting_off ( rlm_sql_handle_t handle,
rlm_sqlippool_t inst,
REQUEST request 
)
static

Definition at line 622 of file rlm_sqlippool.c.

static int mod_accounting_on ( rlm_sql_handle_t handle,
rlm_sqlippool_t inst,
REQUEST request 
)
static

Definition at line 612 of file rlm_sqlippool.c.

static int mod_accounting_start ( rlm_sql_handle_t handle,
rlm_sqlippool_t inst,
REQUEST request 
)
static

Definition at line 583 of file rlm_sqlippool.c.

static int mod_accounting_stop ( rlm_sql_handle_t handle,
rlm_sqlippool_t inst,
REQUEST request 
)
static

Definition at line 602 of file rlm_sqlippool.c.

+ Here is the call graph for this function:

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

Definition at line 382 of file rlm_sqlippool.c.

+ Here is the call graph for this function:

static int sqlippool_command ( char const *  fmt,
rlm_sql_handle_t handle,
rlm_sqlippool_t data,
REQUEST request,
char *  param,
int  param_len 
)
static

Perform a single sqlippool query.

Mostly wrapper around sql_query which does some special sqlippool sequence substitutions and expands the format string.

Parameters
fmtsql query to expand.
handlesql connection handle.
dataInstance of rlm_sqlippool.
requestCurrent request.
paramip address string.
param_lenip address string len.
Returns
  • 0 on success.
  • < 0 on error.

Definition at line 269 of file rlm_sqlippool.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int sqlippool_expand ( char *  out,
int  outlen,
char const *  fmt,
rlm_sqlippool_t data,
char *  param,
int  param_len 
)
static

Definition at line 187 of file rlm_sqlippool.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

CONF_PARSER message_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("success", PW_TYPE_STRING | PW_TYPE_XLAT, rlm_sqlippool_t, log_success) },
}
#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
String of printable characters.
Definition: radius.h:33

Definition at line 97 of file rlm_sqlippool.c.

CONF_PARSER module_config[]
static

Definition at line 115 of file rlm_sqlippool.c.

module_t rlm_sqlippool
Initial value:
= {
.magic = RLM_MODULE_INIT,
.name = "sqlippool",
.inst_size = sizeof(rlm_sqlippool_t),
.config = module_config,
.instantiate = mod_instantiate,
.methods = {
},
}
static rlm_rcode_t mod_accounting(void *instance, REQUEST *request)
Write accounting data to Couchbase documents.
static rlm_rcode_t mod_post_auth(void *instance, REQUEST *request) CC_HINT(nonnull)
7 methods index for postauth section.
Definition: modules.h:48
#define RLM_TYPE_THREAD_SAFE
Module is threadsafe.
Definition: modules.h:75
#define RLM_MODULE_INIT
Definition: modules.h:86
static CONF_PARSER module_config[]
3 methods index for accounting section.
Definition: modules.h:44
static int mod_instantiate(CONF_SECTION *conf, void *instance)
struct rlm_sqlippool_t rlm_sqlippool_t

Definition at line 712 of file rlm_sqlippool.c.