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

Interface to the RADIUS module system. More...

#include <freeradius-devel/conffile.h>
#include <freeradius-devel/features.h>
#include <freeradius-devel/connection.h>
+ Include dependency graph for modules.h:

Go to the source code of this file.

Data Structures

struct  module_t
 Metadata exported by the module. More...
 
struct  section_type_value_t
 Map a section name, to a section typename, to an attribute number. More...
 

Macros

#define MODULE_NULL_COA_FUNCS   ,NULL,NULL
 
#define RLM_MODULE_INIT   RADIUSD_MAGIC_NUMBER
 
#define RLM_TYPE_HUP_SAFE   (1 << 2)
 Will be restarted on HUP. More...
 
#define RLM_TYPE_THREAD_SAFE   (0 << 0)
 Module is threadsafe. More...
 
#define RLM_TYPE_THREAD_UNSAFE   (1 << 0)
 Module is not threadsafe. More...
 

Typedefs

typedef int(* detach_t )(void *instance)
 Module detach callback. More...
 
typedef int(* instantiate_t )(CONF_SECTION *mod_cs, void *instance)
 Module instantiation callback. More...
 
typedef struct module_t module_t
 Metadata exported by the module. More...
 
typedef rlm_rcode_t(* packetmethod )(void *instance, REQUEST *request)
 Module section callback. More...
 
typedef enum rlm_components rlm_components_t
 The different section components of the server. More...
 
typedef struct section_type_value_t section_type_value_t
 Map a section name, to a section typename, to an attribute number. More...
 

Enumerations

enum  rlm_components {
  MOD_AUTHENTICATE = 0,
  MOD_AUTHORIZE,
  MOD_PREACCT,
  MOD_ACCOUNTING,
  MOD_SESSION,
  MOD_PRE_PROXY,
  MOD_POST_PROXY,
  MOD_POST_AUTH,
  MOD_RECV_COA,
  MOD_SEND_COA,
  MOD_COUNT
}
 The different section components of the server. More...
 

Functions

rlm_rcode_t indexed_modcall (rlm_components_t comp, int idx, REQUEST *request)
 
fr_connection_pool_tmodule_connection_pool_init (CONF_SECTION *module, void *opaque, fr_connection_create_t c, fr_connection_alive_t a, char const *prefix)
 Initialise a module specific connection pool. More...
 
rlm_rcode_t module_preacct (REQUEST *request)
 
int modules_bootstrap (CONF_SECTION *)
 
int modules_free (void)
 
int modules_hup (CONF_SECTION *modules)
 
int modules_init (CONF_SECTION *)
 Instantiate the modules. More...
 
rlm_rcode_t process_accounting (int type, REQUEST *request)
 
rlm_rcode_t process_authenticate (int type, REQUEST *request)
 
rlm_rcode_t process_authorize (int type, REQUEST *request)
 
int process_checksimul (int type, REQUEST *request, int maxsimul)
 
rlm_rcode_t process_post_auth (int type, REQUEST *request)
 
rlm_rcode_t process_post_proxy (int type, REQUEST *request)
 
rlm_rcode_t process_pre_proxy (int type, REQUEST *request)
 
rlm_rcode_t process_recv_coa (int type, REQUEST *request)
 
rlm_rcode_t process_send_coa (int type, REQUEST *request)
 
int virtual_servers_bootstrap (CONF_SECTION *config)
 
int virtual_servers_init (CONF_SECTION *config)
 

Variables

const FR_NAME_NUMBER mod_rcode_table []
 
const section_type_value_t section_type_value []
 Mappings between section names, typenames and control attributes. More...
 

Detailed Description

Interface to the RADIUS module system.

Id:
04e1618633db734ed80fb9f89782cf2056fbf84e

Definition in file modules.h.


Data Structure Documentation

struct module_t

Metadata exported by the module.

This determines the capabilities of the module, and maps internal functions within the module to different sections.

Definition at line 134 of file modules.h.

+ Collaboration diagram for module_t:
Data Fields
instantiate_t bootstrap register dynamic attrs, etc.
CONF_PARSER const * config Configuration information.
detach_t detach Function to use to free module instance.
size_t inst_size Size of the instance data.
instantiate_t instantiate Function to use for instantiation.
uint64_t magic Used to validate module struct.
packetmethod methods[MOD_COUNT] Pointers to the various section functions.
char const * name The name of the module (without rlm_ prefix).
int type One or more of the RLM_TYPE_* constants.
struct section_type_value_t

Map a section name, to a section typename, to an attribute number.

Used by modules.c to define the mappings between names, types and control attributes.

Definition at line 63 of file modules.h.

Data Fields
int attr Attribute number.
char const * section Section name e.g. "Authorize".
char const * typename Type name e.g. "Auth-Type".

Macro Definition Documentation

#define MODULE_NULL_COA_FUNCS   ,NULL,NULL

Definition at line 179 of file modules.h.

#define RLM_MODULE_INIT   RADIUSD_MAGIC_NUMBER

Definition at line 86 of file modules.h.

#define RLM_TYPE_HUP_SAFE   (1 << 2)

Will be restarted on HUP.

Server will instantiated new instance, and then destroy old instance.

Definition at line 79 of file modules.h.

#define RLM_TYPE_THREAD_SAFE   (0 << 0)

Module is threadsafe.

Definition at line 75 of file modules.h.

#define RLM_TYPE_THREAD_UNSAFE   (1 << 0)

Module is not threadsafe.

Server will protect calls with mutex.

Definition at line 76 of file modules.h.

Typedef Documentation

typedef int(* detach_t)(void *instance)

Module detach callback.

Is called just before the server exits, and after re-instantiation on HUP, to free the old module instance.

Detach should close all handles associated with the module instance, and free any memory allocated during instantiate.

Parameters
[in]instanceto free.
Returns
  • 0 on success.
  • -1 if detach failed.

Definition at line 127 of file modules.h.

typedef int(* instantiate_t)(CONF_SECTION *mod_cs, void *instance)

Module instantiation callback.

Is called once per module instance. Is not called when new threads are spawned. Modules that require separate thread contexts should use the connection pool API.

Parameters
[in]mod_csModule instance's configuration section.
[out]instanceModule instance's configuration structure, should be alloced by by callback and freed by detach.
Returns
  • 0 on success.
  • -1 if instantiation failed.

Definition at line 112 of file modules.h.

typedef struct module_t module_t

Metadata exported by the module.

This determines the capabilities of the module, and maps internal functions within the module to different sections.

typedef rlm_rcode_t(* packetmethod)(void *instance, REQUEST *request)

Module section callback.

Is called when the module is listed in a particular section of a virtual server, and the request has reached the module call.

Parameters
[in]instancecreated in instantiated, holds module config.
[in,out]requestbeing processed.
Returns
the appropriate rcode.

Definition at line 97 of file modules.h.

The different section components of the server.

Used as indexes in the methods array in the module_t struct.

Map a section name, to a section typename, to an attribute number.

Used by modules.c to define the mappings between names, types and control attributes.

Enumeration Type Documentation

The different section components of the server.

Used as indexes in the methods array in the module_t struct.

Enumerator
MOD_AUTHENTICATE 

0 methods index for authenticate section.

MOD_AUTHORIZE 

1 methods index for authorize section.

MOD_PREACCT 

2 methods index for preacct section.

MOD_ACCOUNTING 

3 methods index for accounting section.

MOD_SESSION 

4 methods index for checksimul section.

MOD_PRE_PROXY 

5 methods index for preproxy section.

MOD_POST_PROXY 

6 methods index for postproxy section.

MOD_POST_AUTH 

7 methods index for postauth section.

MOD_RECV_COA 

8 methods index for recvcoa section.

MOD_SEND_COA 

9 methods index for sendcoa section.

MOD_COUNT 

10 how many components there are.

Definition at line 40 of file modules.h.

Function Documentation

rlm_rcode_t indexed_modcall ( rlm_components_t  comp,
int  idx,
REQUEST request 
)

Definition at line 908 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

fr_connection_pool_t* module_connection_pool_init ( CONF_SECTION module,
void *  opaque,
fr_connection_create_t  c,
fr_connection_alive_t  a,
char const *  log_prefix 
)

Initialise a module specific connection pool.

See Also
fr_connection_pool_init
Parameters
[in]modulesection.
[in]opaquedata pointer to pass to callbacks.
[in]cCallback to create new connections.
[in]aCallback to check the status of connections.
[in]log_prefixoverride, if NULL will be set automatically from the module CONF_SECTION.
Returns
  • New connection pool.
  • NULL on error.

Definition at line 1759 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

rlm_rcode_t module_preacct ( REQUEST request)

Definition at line 2115 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int modules_bootstrap ( CONF_SECTION )

Definition at line 1866 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int modules_free ( void  )

Definition at line 413 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int modules_hup ( CONF_SECTION modules)

Definition at line 1691 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int modules_init ( CONF_SECTION )

Instantiate the modules.

Definition at line 2064 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

rlm_rcode_t process_accounting ( int  type,
REQUEST request 
)

Definition at line 2123 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

rlm_rcode_t process_authenticate ( int  type,
REQUEST request 
)

Definition at line 2106 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

rlm_rcode_t process_authorize ( int  type,
REQUEST request 
)

Definition at line 2098 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int process_checksimul ( int  type,
REQUEST request,
int  maxsimul 
)

Definition at line 2135 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

rlm_rcode_t process_post_auth ( int  type,
REQUEST request 
)

Definition at line 2178 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

rlm_rcode_t process_post_proxy ( int  type,
REQUEST request 
)

Definition at line 2169 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

rlm_rcode_t process_pre_proxy ( int  type,
REQUEST request 
)

Definition at line 2161 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

rlm_rcode_t process_recv_coa ( int  type,
REQUEST request 
)

Definition at line 2184 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

rlm_rcode_t process_send_coa ( int  type,
REQUEST request 
)

Definition at line 2189 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int virtual_servers_bootstrap ( CONF_SECTION config)

Definition at line 1457 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int virtual_servers_init ( CONF_SECTION config)

Definition at line 1577 of file modules.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const FR_NAME_NUMBER mod_rcode_table[]

Definition at line 186 of file modcall.c.

const section_type_value_t section_type_value[]

Mappings between section names, typenames and control attributes.

Defined in modules.c.

Definition at line 64 of file modules.c.