The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Function prototypes and datatypes used in the module. More...
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/pool.h>
#include <freeradius-devel/json/base.h>
Go to the source code of this file.
Data Structures | |
struct | rlm_couchbase_handle_t |
Couchbase instance specific information. More... | |
struct | rlm_couchbase_t |
The main module instance. More... | |
Macros | |
#define | MAX_KEY_SIZE 250 |
#define | MAX_VALUE_SIZE 20480 |
Functions | |
int | mod_attribute_to_element (const char *name, json_object *map, void *buf) |
Map attributes to JSON element names. More... | |
int | mod_build_api_opts (CONF_SECTION *conf, rlm_couchbase_t *inst) |
Build a couchbase_opts_t structure from the configuration "couchbase_api" list. More... | |
int | mod_build_attribute_element_map (CONF_SECTION *conf, rlm_couchbase_t *inst) |
Build a JSON object map from the configuration "map" list. More... | |
int | mod_client_map_section (CONF_SECTION *client, CONF_SECTION const *map, json_object *json, char const *docid) |
int | mod_conn_alive (void *opaque, void *connection) |
void * | mod_conn_create (TALLOC_CTX *ctx, UNUSED void *instance, fr_time_delta_t timeout) |
int | mod_ensure_start_timestamp (json_object *json, fr_pair_list_t *vps) |
Ensure accounting documents always contain a valid timestamp. More... | |
int | mod_free_api_opts (rlm_couchbase_t *inst) |
Delete a object built by mod_build_api_opts() More... | |
int | mod_json_object_to_map (TALLOC_CTX *ctx, fr_dcursor_t *out, request_t *request, json_object *json, tmpl_pair_list_t list) |
int | mod_load_client_documents (rlm_couchbase_t *inst, CONF_SECTION *tmpl, CONF_SECTION *map) |
Load client entries from Couchbase client documents on startup. More... | |
json_object * | mod_value_pair_to_json_object (request_t *request, fr_pair_t *vp) |
Convert value pairs to json objects. More... | |
Function prototypes and datatypes used in the module.
Definition in file mod.h.
struct rlm_couchbase_handle_t |
struct rlm_couchbase_t |
The main module instance.
This struct contains the core module configuration.
Data Fields | ||
---|---|---|
tmpl_t * | acct_key | Accounting document key. |
void * | api_opts | Couchbase API internal options. |
char const * | bucket | Couchbase bucket. |
const char * | client_view | Couchbase view that returns client documents. |
char const * | doctype | Value of accounting 'docType' element name. |
uint32_t | expire | Accounting document expire time in seconds. |
json_object * | map | Json object to hold user defined attribute map. |
char const * | name | Module instance name. |
char const * | password | Couchbase bucket password. |
fr_pool_t * | pool | Connection pool. |
bool | read_clients | Toggle for loading client records. |
char const * | server | Couchbase server list. |
char const * | server_raw | Raw server string before parsing. |
tmpl_t * | user_key | User document key. |
char const * | username | Couchbase bucket username. |
int mod_attribute_to_element | ( | const char * | name, |
json_object * | map, | ||
void * | buf | ||
) |
Map attributes to JSON element names.
Attempt to map the passed attribute name to the configured JSON element name using the JSON object map mod_build_attribute_element_map().
name | The character name of the requested attribute. |
map | The JSON object map to use for the lookup. |
buf | The buffer where the given element will be stored if found. |
Definition at line 311 of file mod.c.
int mod_build_api_opts | ( | CONF_SECTION * | conf, |
rlm_couchbase_t * | inst | ||
) |
Build a couchbase_opts_t structure from the configuration "couchbase_api" list.
Parse the "couchbase_api" list from the module configuration file and store this as a couchbase_opts_t object (key/value list).
conf | Configuration list. |
inst | The module instance. |
Definition at line 93 of file mod.c.
int mod_build_attribute_element_map | ( | CONF_SECTION * | conf, |
rlm_couchbase_t * | inst | ||
) |
Build a JSON object map from the configuration "map" list.
Parse the "map" list from the module configuration file and store this as a JSON object (key/value list) in the module instance. This map will be used to lookup and map attributes for all incoming accounting requests.
conf | Configuration list. |
inst | The module instance. |
Definition at line 237 of file mod.c.
int mod_client_map_section | ( | CONF_SECTION * | client, |
CONF_SECTION const * | map, | ||
json_object * | json, | ||
char const * | docid | ||
) |
int mod_conn_alive | ( | void * | opaque, |
void * | connection | ||
) |
void* mod_conn_create | ( | TALLOC_CTX * | ctx, |
UNUSED void * | instance, | ||
fr_time_delta_t | timeout | ||
) |
int mod_ensure_start_timestamp | ( | json_object * | json, |
fr_pair_list_t * | vps | ||
) |
Ensure accounting documents always contain a valid timestamp.
Inspect the given JSON object representation of an accounting document fetched from Couchbase and ensuse it contains a valid (non NULL) timestamp value.
json | JSON object representation of an accounting document. |
vps | The value pairs associated with the current accounting request. |
Definition at line 604 of file mod.c.
int mod_free_api_opts | ( | rlm_couchbase_t * | inst | ) |
Delete a object built by mod_build_api_opts()
Release the underlying mod_build_api_opts() objects
inst | The module instance. |
Definition at line 63 of file mod.c.
int mod_json_object_to_map | ( | TALLOC_CTX * | ctx, |
fr_dcursor_t * | out, | ||
request_t * | request, | ||
json_object * | json, | ||
tmpl_pair_list_t | list | ||
) |
int mod_load_client_documents | ( | rlm_couchbase_t * | inst, |
CONF_SECTION * | tmpl, | ||
CONF_SECTION * | map | ||
) |
Load client entries from Couchbase client documents on startup.
This function executes the view defined in the module configuration and loops through all returned rows. The view is called with "stale=false" to ensure the most accurate data available when the view is called. This will force an index rebuild on this design document in Couchbase. However, since this function is only run once at server startup this should not be a concern.
inst | The module instance. |
tmpl | Default values for new clients. |
map | The client attribute configuration list. |
Definition at line 706 of file mod.c.
Convert value pairs to json objects.
Take the passed value pair and convert it to a json-c JSON object..
request | The request object. |
vp | The value pair to convert. |
Definition at line 510 of file mod.c.