Skip to Content
[CAIDA - Center for Applied Internet Data Analysis logo]
The Center for Applied Internet Data Analysis
corsaro_anon.c File Reference

Corsaro IP anonymization plugin. More...

Go to the source code of this file.

Macros

#define CORSARO_ANON_MAGIC   0x414E4F4E
 The magic number for this plugin - "ANON". More...
 
#define PLUGIN_NAME   "anon"
 The name of this plugin. More...
 
#define ANON_ENC_TYPE   CORSARO_ANON_ENC_CRYPTOPAN
 The default anonymization type. More...
 
#define ENC_TYPE_CRYPTOPAN   "cryptopan"
 The configuration string for the CORSARO_ANON_ENC_CRYPTOPAN type. More...
 
#define ENC_TYPE_PREFIX   "prefix"
 The configuration string for the CORSARO_ANON_ENC_PREFIX type. More...
 
#define ANON_SOURCE   0
 Anonymize the Source IP by default? More...
 
#define ANON_DEST   0
 Anonymize the Destination IP by default? More...
 
#define STATE(corsaro)   (CORSARO_PLUGIN_STATE(corsaro, anon, CORSARO_PLUGIN_ID_ANON))
 Extends the generic plugin state convenience macro in corsaro_plugin.h. More...
 
#define PLUGIN(corsaro)   (CORSARO_PLUGIN_PLUGIN(corsaro, CORSARO_PLUGIN_ID_ANON))
 Extends the generic plugin plugin convenience macro in corsaro_plugin.h. More...
 

Functions

static void usage (corsaro_plugin_t *plugin)
 Print usage information to stderr. More...
 
static int parse_args (corsaro_t *corsaro)
 Parse the arguments given to the plugin. More...
 
corsaro_plugin_tcorsaro_anon_alloc (corsaro_t *corsaro)
 Implements the alloc function of the plugin API. More...
 
int corsaro_anon_probe_filename (const char *fname)
 Implements the probe_filename function of the plugin API. More...
 
int corsaro_anon_probe_magic (corsaro_in_t *corsaro, corsaro_file_in_t *file)
 Implements the probe_magic function of the plugin API. More...
 
int corsaro_anon_init_output (corsaro_t *corsaro)
 Implements the init_output function of the plugin API. More...
 
int corsaro_anon_init_input (corsaro_in_t *corsaro)
 Implements the init_input function of the plugin API. More...
 
int corsaro_anon_close_input (corsaro_in_t *corsaro)
 Implements the close_input function of the plugin API. More...
 
int corsaro_anon_close_output (corsaro_t *corsaro)
 Implements the close_output function of the plugin API. More...
 
off_t corsaro_anon_read_record (struct corsaro_in *corsaro, corsaro_in_record_type_t *record_type, corsaro_in_record_t *record)
 Implements the read_record function of the plugin API. More...
 
off_t corsaro_anon_read_global_data_record (struct corsaro_in *corsaro, enum corsaro_in_record_type *record_type, struct corsaro_in_record *record)
 Implements the read_global_data_record function of the plugin API. More...
 
int corsaro_anon_start_interval (corsaro_t *corsaro, corsaro_interval_t *int_start)
 Implements the start_interval function of the plugin API. More...
 
int corsaro_anon_end_interval (corsaro_t *corsaro, corsaro_interval_t *int_end)
 Implements the end_interval function of the plugin API. More...
 
int corsaro_anon_process_packet (corsaro_t *corsaro, corsaro_packet_t *packet)
 Implements the process_packet function of the plugin API. More...
 

Variables

static corsaro_plugin_t corsaro_anon_plugin
 Common plugin information across all instances. More...
 

Detailed Description

Corsaro IP anonymization plugin.

Author
Alistair King

Definition in file corsaro_anon.c.

Macro Definition Documentation

#define ANON_DEST   0

Anonymize the Destination IP by default?

Definition at line 77 of file corsaro_anon.c.

Referenced by corsaro_anon_init_output().

#define ANON_ENC_TYPE   CORSARO_ANON_ENC_CRYPTOPAN

The default anonymization type.

Definition at line 65 of file corsaro_anon.c.

#define ANON_SOURCE   0

Anonymize the Source IP by default?

Definition at line 74 of file corsaro_anon.c.

Referenced by corsaro_anon_init_output().

#define CORSARO_ANON_MAGIC   0x414E4F4E

The magic number for this plugin - "ANON".

Definition at line 59 of file corsaro_anon.c.

#define ENC_TYPE_CRYPTOPAN   "cryptopan"

The configuration string for the CORSARO_ANON_ENC_CRYPTOPAN type.

Definition at line 68 of file corsaro_anon.c.

Referenced by parse_args(), and usage().

#define ENC_TYPE_PREFIX   "prefix"

The configuration string for the CORSARO_ANON_ENC_PREFIX type.

Definition at line 71 of file corsaro_anon.c.

Referenced by parse_args(), and usage().

Extends the generic plugin plugin convenience macro in corsaro_plugin.h.

Definition at line 109 of file corsaro_anon.c.

Referenced by corsaro_anon_init_output(), and parse_args().

#define PLUGIN_NAME   "anon"

The name of this plugin.

Definition at line 62 of file corsaro_anon.c.

#define STATE (   corsaro)    (CORSARO_PLUGIN_STATE(corsaro, anon, CORSARO_PLUGIN_ID_ANON))

Extends the generic plugin state convenience macro in corsaro_plugin.h.

Definition at line 105 of file corsaro_anon.c.

Referenced by corsaro_anon_process_packet(), and parse_args().

Function Documentation

corsaro_plugin_t* corsaro_anon_alloc ( corsaro_t corsaro)

Implements the alloc function of the plugin API.

Definition at line 197 of file corsaro_anon.c.

References corsaro_anon_plugin.

int corsaro_anon_close_input ( corsaro_in_t corsaro)

Implements the close_input function of the plugin API.

Definition at line 261 of file corsaro_anon.c.

int corsaro_anon_close_output ( corsaro_t corsaro)

Implements the close_output function of the plugin API.

Definition at line 268 of file corsaro_anon.c.

Referenced by corsaro_anon_init_output().

int corsaro_anon_end_interval ( corsaro_t corsaro,
corsaro_interval_t int_end 
)

Implements the end_interval function of the plugin API.

Definition at line 300 of file corsaro_anon.c.

int corsaro_anon_init_input ( corsaro_in_t corsaro)

Implements the init_input function of the plugin API.

Definition at line 254 of file corsaro_anon.c.

int corsaro_anon_init_output ( corsaro_t corsaro)

Implements the init_output function of the plugin API.

Definition at line 217 of file corsaro_anon.c.

References ANON_DEST, ANON_SOURCE, corsaro_anon_close_output(), corsaro_log(), corsaro_plugin_register_state(), malloc_zero(), parse_args(), PLUGIN, and corsaro::plugin_manager.

int corsaro_anon_probe_filename ( const char *  fname)

Implements the probe_filename function of the plugin API.

Definition at line 203 of file corsaro_anon.c.

int corsaro_anon_probe_magic ( corsaro_in_t corsaro,
corsaro_file_in_t file 
)

Implements the probe_magic function of the plugin API.

Definition at line 210 of file corsaro_anon.c.

int corsaro_anon_process_packet ( corsaro_t corsaro,
corsaro_packet_t packet 
)

Implements the process_packet function of the plugin API.

Definition at line 308 of file corsaro_anon.c.

References LT_PKT, and STATE.

off_t corsaro_anon_read_global_data_record ( struct corsaro_in corsaro,
enum corsaro_in_record_type record_type,
struct corsaro_in_record record 
)

Implements the read_global_data_record function of the plugin API.

Definition at line 283 of file corsaro_anon.c.

off_t corsaro_anon_read_record ( struct corsaro_in corsaro,
corsaro_in_record_type_t record_type,
corsaro_in_record_t record 
)

Implements the read_record function of the plugin API.

Definition at line 274 of file corsaro_anon.c.

int corsaro_anon_start_interval ( corsaro_t corsaro,
corsaro_interval_t int_start 
)

Implements the start_interval function of the plugin API.

Definition at line 292 of file corsaro_anon.c.

static int parse_args ( corsaro_t corsaro)
static

Parse the arguments given to the plugin.

Definition at line 128 of file corsaro_anon.c.

References corsaro_plugin::argc, corsaro_plugin::argv, ENC_TYPE_CRYPTOPAN, ENC_TYPE_PREFIX, PLUGIN, STATE, and usage().

Referenced by corsaro_anon_init_output().

static void usage ( corsaro_plugin_t plugin)
static

Print usage information to stderr.

Definition at line 113 of file corsaro_anon.c.

References corsaro_plugin::argv, ENC_TYPE_CRYPTOPAN, and ENC_TYPE_PREFIX.

Referenced by parse_args().

Variable Documentation

corsaro_plugin_t corsaro_anon_plugin
static
Initial value:
= {
}
#define CORSARO_PLUGIN_GENERATE_PTRS(plugin)
Convenience macro that defines all the function pointers for the corsaro plugin API.
#define CORSARO_PLUGIN_GENERATE_TAIL
Convenience macro that defines all the 'remaining' blank fields in a corsaro plugin object...
IP address anonymization plugin.
#define CORSARO_ANON_MAGIC
The magic number for this plugin - "ANON".
Definition: corsaro_anon.c:59
#define PLUGIN_NAME
The name of this plugin.
Definition: corsaro_anon.c:62

Common plugin information across all instances.

Definition at line 80 of file corsaro_anon.c.

Referenced by corsaro_anon_alloc().