Read and map CSV files.
More...
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/util/htrie.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/server/map_proc.h>
Go to the source code of this file.
|
static bool | buf2entry (rlm_csv_t *inst, char *buf, char **out) |
|
static int8_t | csv_cmp (void const *one, void const *two) |
|
static uint32_t | csv_hash (void const *data) |
|
static int | csv_map_getvalue (TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, map_t const *map, void *uctx) |
|
static int | csv_map_verify (map_t *map, void *instance) |
|
static int | csv_maps_verify (CONF_SECTION *cs, void const *mod_inst, UNUSED void *proc_inst, tmpl_t const *src, map_list_t const *maps) |
|
static int | csv_to_key (uint8_t **out, size_t *outlen, void const *data) |
|
static bool | duplicate_entry (CONF_SECTION *conf, rlm_csv_t *inst, rlm_csv_entry_t *old, char *p, int lineno) |
|
static int | fieldname2offset (rlm_csv_t const *inst, char const *field_name, int *array_offset) |
|
static bool | file2csv (CONF_SECTION *conf, rlm_csv_t *inst, int lineno, char *buffer) |
|
static bool | insert_entry (CONF_SECTION *conf, rlm_csv_t *inst, rlm_csv_entry_t *e, int lineno) |
|
static int | mod_bootstrap (module_inst_ctx_t const *mctx) |
|
static int | mod_instantiate (module_inst_ctx_t const *mctx) |
| Instantiate the module. More...
|
|
static rlm_rcode_t | mod_map_apply (rlm_csv_t const *inst, request_t *request, fr_value_box_t const *key, map_list_t const *maps) |
| Perform a search and map the result of the search to server attributes. More...
|
|
static unlang_action_t | mod_map_proc (rlm_rcode_t *p_result, void const *mod_inst, UNUSED void *proc_inst, request_t *request, fr_value_box_list_t *key, map_list_t const *maps) |
| Perform a search and map the result of the search to server attributes. More...
|
|
static unlang_action_t | mod_process (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
|
Read and map CSV files.
- Id
- 853bde97c05416d2b4df74c6f09b3a019a81517e
- Copyright
- 2019 The FreeRADIUS server project
-
2019 Alan DeKok (aland.nosp@m.@fre.nosp@m.eradi.nosp@m.us.o.nosp@m.rg)
Definition in file rlm_csv.c.
◆ rlm_csv_entry_s
◆ rlm_csv_t
Definition at line 44 of file rlm_csv.c.
Data Fields |
bool |
allow_multiple_keys |
|
char const * |
delimiter |
|
char const ** |
field_names |
|
int * |
field_offsets |
|
fr_type_t * |
field_types |
|
char const * |
fields |
|
char const * |
filename |
|
bool |
header |
|
int |
index_field |
|
char const * |
index_field_name |
|
tmpl_t * |
key |
|
fr_type_t |
key_data_type |
|
map_list_t |
map |
if there is an "update" section in the configuration. |
bool |
multiple_index_fields |
|
int |
num_fields |
|
fr_rb_tree_t * |
tree |
|
fr_htrie_t * |
trie |
|
int |
used_fields |
|
◆ CSV_MAX_ATTRMAP
◆ rlm_csv_entry_t
◆ buf2entry()
static bool buf2entry |
( |
rlm_csv_t * |
inst, |
|
|
char * |
buf, |
|
|
char ** |
out |
|
) |
| |
|
static |
◆ csv_cmp()
static int8_t csv_cmp |
( |
void const * |
one, |
|
|
void const * |
two |
|
) |
| |
|
static |
◆ csv_hash()
static uint32_t csv_hash |
( |
void const * |
data | ) |
|
|
static |
◆ csv_map_getvalue()
◆ csv_map_verify()
static int csv_map_verify |
( |
map_t * |
map, |
|
|
void * |
instance |
|
) |
| |
|
static |
◆ csv_maps_verify()
static int csv_maps_verify |
( |
CONF_SECTION * |
cs, |
|
|
void const * |
mod_inst, |
|
|
UNUSED void * |
proc_inst, |
|
|
tmpl_t const * |
src, |
|
|
map_list_t const * |
maps |
|
) |
| |
|
static |
◆ csv_to_key()
static int csv_to_key |
( |
uint8_t ** |
out, |
|
|
size_t * |
outlen, |
|
|
void const * |
data |
|
) |
| |
|
static |
◆ duplicate_entry()
◆ fieldname2offset()
static int fieldname2offset |
( |
rlm_csv_t const * |
inst, |
|
|
char const * |
field_name, |
|
|
int * |
array_offset |
|
) |
| |
|
static |
◆ file2csv()
◆ insert_entry()
◆ mod_bootstrap()
◆ mod_instantiate()
Instantiate the module.
Creates a new instance of the module reading parameters from a configuration section.
- Parameters
-
[in] | mctx | configuration data. |
- Returns
- 0 on success.
- < 0 on failure.
Definition at line 754 of file rlm_csv.c.
◆ mod_map_apply()
Perform a search and map the result of the search to server attributes.
- Parameters
-
[in] | inst | rlm_csv_t. |
[in,out] | request | The current request. |
[in] | key | key to look for |
[in] | maps | Head of the map list. |
- Returns
-
Definition at line 898 of file rlm_csv.c.
◆ mod_map_proc()
Perform a search and map the result of the search to server attributes.
- Parameters
-
[out] | p_result | Result of applying map:
|
[in] | mod_inst | rlm_csv_t. |
[in] | proc_inst | mapping map entries to field numbers. |
[in,out] | request | The current request. |
[in] | key | key to look for |
[in] | maps | Head of the map list. |
- Returns
- UNLANG_ACTION_CALCULATE_RESULT
Definition at line 978 of file rlm_csv.c.
◆ mod_process()
◆ module_config
Initial value:= {
}
#define CONF_PARSER_TERMINATOR
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
#define FR_CONF_OFFSET_FLAGS(_name, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
@ CONF_FLAG_NOT_EMPTY
CONF_PAIR is required to have a non zero length value.
Definition at line 81 of file rlm_csv.c.
◆ rlm_csv
Initial value:= {
.common = {
.name = "csv",
},
.method_group = {
}
}
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
static const conf_parser_t config[]
static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
static int mod_bootstrap(module_inst_ctx_t const *mctx)
static const conf_parser_t module_config[]
static int mod_instantiate(module_inst_ctx_t const *mctx)
Instantiate the module.
static int instantiate(module_inst_ctx_t const *mctx)
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
@ MODULE_TYPE_DYNAMIC_UNSAFE
Instances of this module cannot be created at runtime.
#define MODULE_BINDING_TERMINATOR
Terminate a module binding list.
Named methods exported by a module.
Definition at line 1051 of file rlm_csv.c.