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

Write plaintext versions of packets to flatfiles. More...

#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/modules.h>
#include <freeradius-devel/rad_assert.h>
#include <freeradius-devel/detail.h>
#include <freeradius-devel/exfile.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/stat.h>
+ Include dependency graph for rlm_detail.c:

Go to the source code of this file.

Data Structures

struct  detail_instance
 Instance configuration for rlm_detail. More...
 

Macros

#define DIRLEN   8192
 Maximum path length. More...
 
#define WRITE(fmt,...)
 

Typedefs

typedef struct detail_instance rlm_detail_t
 Instance configuration for rlm_detail. More...
 

Functions

static rlm_rcode_t CC_HINT (nonnull)
 
static int detail_cmp (void const *a, void const *b)
 
static void detail_fr_pair_fprint (TALLOC_CTX *ctx, FILE *out, VALUE_PAIR const *stacked)
 
static uint32_t detail_hash (void const *data)
 
static int detail_write (FILE *out, rlm_detail_t *inst, REQUEST *request, RADIUS_PACKET *packet, bool compat)
 Write a single detail entry to file pointer. More...
 
static int mod_detach (void *instance)
 
static int mod_instantiate (CONF_SECTION *conf, void *instance)
 

Variables

static const CONF_PARSER module_config []
 
module_t rlm_detail
 

Detailed Description

Write plaintext versions of packets to flatfiles.

Id:
0ccc8ea28de11438798089e91da51dcd85587257

Definition in file rlm_detail.c.


Data Structure Documentation

struct detail_instance

Instance configuration for rlm_detail.

Holds the configuration and preparsed data for a instance of rlm_detail.

Definition at line 54 of file rlm_detail.c.

+ Collaboration diagram for detail_instance:
Data Fields
exfile_t * ef Log file handler.
bool escape do filename escaping, yes / no
xlat_escape_t escape_func escape function
char const * filename File/path to write to.
char const * group Group to use for new files.
char const * header Header format.
fr_hash_table_t * ht Holds suppressed attributes.
bool locking Whether the file should be locked.
bool log_srcdst Add IP src/dst attributes to entries.
char const * name Instance name.
uint32_t perm Permissions to use for new files.

Macro Definition Documentation

#define DIRLEN   8192

Maximum path length.

Definition at line 48 of file rlm_detail.c.

#define WRITE (   fmt,
  ... 
)
Value:
do {\
if (fprintf(out, fmt, ## __VA_ARGS__) < 0) {\
RERROR("Failed writing to detail file: %s", fr_syserror(errno));\
return -1;\
}\
} while(0)
#define RERROR(fmt,...)
Definition: log.h:207
char const * fr_syserror(int num)
Guaranteed to be thread-safe version of strerror.
Definition: log.c:238

Typedef Documentation

typedef struct detail_instance rlm_detail_t

Instance configuration for rlm_detail.

Holds the configuration and preparsed data for a instance of rlm_detail.

Function Documentation

static rlm_rcode_t CC_HINT ( nonnull  )
static

Definition at line 342 of file rlm_detail.c.

+ Here is the call graph for this function:

static int detail_cmp ( void const *  a,
void const *  b 
)
static

Definition at line 103 of file rlm_detail.c.

+ Here is the caller graph for this function:

static void detail_fr_pair_fprint ( TALLOC_CTX *  ctx,
FILE *  out,
VALUE_PAIR const *  stacked 
)
static

Definition at line 198 of file rlm_detail.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uint32_t detail_hash ( void const *  data)
static

Definition at line 97 of file rlm_detail.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int detail_write ( FILE *  out,
rlm_detail_t inst,
REQUEST request,
RADIUS_PACKET packet,
bool  compat 
)
static

Write a single detail entry to file pointer.

Parameters
[in]outWhere to write entry.
[in]instInstance of rlm_detail.
[in]requestThe current request.
[in]packetassociated with the request (request, reply, proxy-request, proxy-reply...).
[in]compatWrite out entry in compatibility mode.

Definition at line 220 of file rlm_detail.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int mod_detach ( void *  instance)
static

Definition at line 89 of file rlm_detail.c.

+ Here is the call graph for this function:

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

Definition at line 114 of file rlm_detail.c.

+ Here is the call graph for this function:

Variable Documentation

const CONF_PARSER module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("filename", PW_TYPE_FILE_OUTPUT | PW_TYPE_REQUIRED | PW_TYPE_XLAT, rlm_detail_t, filename), .dflt = "%A/%{Client-IP-Address}/detail" },
{ FR_CONF_OFFSET("header", PW_TYPE_STRING | PW_TYPE_XLAT, rlm_detail_t, header), .dflt = "%t" },
{ FR_CONF_OFFSET("permissions", PW_TYPE_INTEGER, rlm_detail_t, perm), .dflt = "0600" },
{ FR_CONF_OFFSET("locking", PW_TYPE_BOOLEAN, rlm_detail_t, locking), .dflt = "no" },
{ FR_CONF_OFFSET("escape_filenames", PW_TYPE_BOOLEAN, rlm_detail_t, escape), .dflt = "no" },
{ FR_CONF_OFFSET("log_packet_header", PW_TYPE_BOOLEAN, rlm_detail_t, log_srcdst), .dflt = "no" },
}
Instance configuration for rlm_detail.
Definition: rlm_detail.c:54
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
#define PW_TYPE_XLAT
string will be dynamically expanded.
Definition: conffile.h:207
A truth value.
Definition: radius.h:56
32 Bit unsigned integer.
Definition: radius.h:34
#define PW_TYPE_FILE_OUTPUT
File matching value must exist, and must be writeable.
Definition: conffile.h:205
#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 74 of file rlm_detail.c.

module_t rlm_detail
Initial value:
= {
.magic = RLM_MODULE_INIT,
.name = "detail",
.inst_size = sizeof(rlm_detail_t),
.config = module_config,
.instantiate = mod_instantiate,
.detach = mod_detach,
.methods = {
[MOD_PRE_PROXY] = mod_pre_proxy,
[MOD_POST_PROXY] = mod_post_proxy,
[MOD_RECV_COA] = mod_recv_coa,
[MOD_SEND_COA] = mod_send_coa
},
}
5 methods index for preproxy section.
Definition: modules.h:46
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
static rlm_rcode_t mod_authorize(void *instance, REQUEST *request)
Handle authorization requests using Couchbase document data.
#define RLM_MODULE_INIT
Definition: modules.h:86
#define RLM_TYPE_HUP_SAFE
Will be restarted on HUP.
Definition: modules.h:79
struct detail_instance rlm_detail_t
Instance configuration for rlm_detail.
3 methods index for accounting section.
Definition: modules.h:44
static int mod_instantiate(CONF_SECTION *conf, void *instance)
Definition: rlm_detail.c:114
static int mod_detach(void *instance)
Definition: rlm_detail.c:89
static const CONF_PARSER module_config[]
Definition: rlm_detail.c:74
6 methods index for postproxy section.
Definition: modules.h:47
2 methods index for preacct section.
Definition: modules.h:43
8 methods index for recvcoa section.
Definition: modules.h:50
9 methods index for sendcoa section.
Definition: modules.h:51
1 methods index for authorize section.
Definition: modules.h:42

Definition at line 527 of file rlm_detail.c.