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

Read and map CSV files. More...

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

Go to the source code of this file.

Data Structures

struct  rlm_csv_entry_t
 
struct  rlm_csv_t
 

Typedefs

typedef struct rlm_csv_entry_t rlm_csv_entry_t
 
typedef struct rlm_csv_t rlm_csv_t
 

Functions

static bool buf2entry (rlm_csv_t *inst, char *buf, char **out)
 
static int csv_entry_cmp (void const *one, void const *two)
 
static int csv_map_getvalue (TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, vp_map_t const *map, void *uctx)
 
static int csv_map_verify (UNUSED void *proc_inst, void *mod_inst, UNUSED vp_tmpl_t const *src, vp_map_t const *maps)
 
static int fieldname2offset (rlm_csv_t *inst, char const *field_name)
 
static rlm_csv_entry_tfile2csv (CONF_SECTION *conf, rlm_csv_t *inst, int lineno, char *buffer)
 
static int mod_bootstrap (CONF_SECTION *conf, void *instance)
 
static rlm_rcode_t mod_map_proc (void *mod_inst, UNUSED void *proc_inst, REQUEST *request, char const *key, vp_map_t const *maps)
 Perform a search and map the result of the search to server attributes. More...
 

Variables

static const CONF_PARSER module_config []
 
module_t rlm_csv
 

Detailed Description

Read and map CSV files.

Id:
c53c827422b264f43057d5928740abd18228a4af

Definition in file rlm_csv.c.


Data Structure Documentation

struct rlm_csv_entry_t

Definition at line 59 of file rlm_csv.c.

+ Collaboration diagram for rlm_csv_entry_t:
Data Fields
char * data[]
char const * key
struct rlm_csv_entry_t * next
struct rlm_csv_t

Definition at line 43 of file rlm_csv.c.

+ Collaboration diagram for rlm_csv_t:
Data Fields
char const * delimiter
char const ** field_names
int * field_offsets
char const * filename
char const * header
char const * key
int key_field
char const * name
int num_fields
rbtree_t * tree
int used_fields

Typedef Documentation

typedef struct rlm_csv_t rlm_csv_t

Function Documentation

static bool buf2entry ( rlm_csv_t inst,
char *  buf,
char **  out 
)
static

Definition at line 87 of file rlm_csv.c.

+ Here is the caller graph for this function:

static int csv_entry_cmp ( void const *  one,
void const *  two 
)
static

Definition at line 76 of file rlm_csv.c.

+ Here is the caller graph for this function:

static int csv_map_getvalue ( TALLOC_CTX *  ctx,
VALUE_PAIR **  out,
REQUEST request,
vp_map_t const *  map,
void *  uctx 
)
static

Definition at line 406 of file rlm_csv.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int csv_map_verify ( UNUSED void *  proc_inst,
void *  mod_inst,
UNUSED vp_tmpl_t const *  src,
vp_map_t const *  maps 
)
static

Definition at line 240 of file rlm_csv.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int fieldname2offset ( rlm_csv_t inst,
char const *  field_name 
)
static

Definition at line 217 of file rlm_csv.c.

+ Here is the caller graph for this function:

static rlm_csv_entry_t* file2csv ( CONF_SECTION conf,
rlm_csv_t inst,
int  lineno,
char *  buffer 
)
static

Definition at line 158 of file rlm_csv.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 270 of file rlm_csv.c.

+ Here is the call graph for this function:

static rlm_rcode_t mod_map_proc ( void *  mod_inst,
UNUSED void *  proc_inst,
REQUEST request,
char const *  key,
vp_map_t const *  maps 
)
static

Perform a search and map the result of the search to server attributes.

Parameters
[in]mod_instrlm_csv_t
[in]proc_instmapping map entries to field numbers.
[in,out]requestThe current request.
[in]keykey to look for
[in]mapsHead of the map list.
Returns

Definition at line 474 of file rlm_csv.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("delimiter", PW_TYPE_STRING | PW_TYPE_REQUIRED | PW_TYPE_NOT_EMPTY, rlm_csv_t, delimiter), .dflt = "," },
}
#define PW_TYPE_FILE_INPUT
File matching value must exist, and must be readable.
Definition: conffile.h:204
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
#define PW_TYPE_NOT_EMPTY
CONF_PAIR is required to have a non zero length value.
Definition: conffile.h:211
#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
String of printable characters.
Definition: radius.h:33

Definition at line 68 of file rlm_csv.c.

module_t rlm_csv
Initial value:
= {
.magic = RLM_MODULE_INIT,
.name = "csv",
.type = 0,
.inst_size = sizeof(rlm_csv_t),
.config = module_config,
.bootstrap = mod_bootstrap,
}
static const CONF_PARSER module_config[]
Definition: rlm_csv.c:68
#define RLM_MODULE_INIT
Definition: modules.h:86
static int mod_bootstrap(CONF_SECTION *conf, void *instance)
Definition: rlm_csv.c:270
struct rlm_csv_t rlm_csv_t

Definition at line 527 of file rlm_csv.c.