Corsaro plugin wrapper for the iat-smee 'library'. More...
Go to the source code of this file.
Macros | |
#define | CORSARO_SMEE_MAGIC 0x534D4545 |
The magic number for this plugin - "SMEE". More... | |
#define | PLUGIN_NAME "smee" |
The name of this plugin. More... | |
#define | CORSARO_SMEE_STATFILE PLUGIN_NAME"-stat" |
The name for the stat file. More... | |
#define | CORSARO_SMEE_SUMFILE PLUGIN_NAME"-sum" |
The name for the sum file. More... | |
#define | CORSARO_SMEE_SRCFILE PLUGIN_NAME"-sources" |
The name for the src file. More... | |
#define | CORSARO_SMEE_MX_LIFETIME 3600 |
Default max lifetime for source to stay in hashtable. More... | |
#define | CORSARO_SMEE_MX_SOURCES 4000000 |
Default memory size allocated for source hash table (in KB) More... | |
#define | CORSARO_SMEE_TIME_REC_INTERVAL 3600 |
Default interval in seconds to write summary files. More... | |
#define | STATE(corsaro) (CORSARO_PLUGIN_STATE(corsaro, smee, CORSARO_PLUGIN_ID_SMEE)) |
Extends the generic plugin state convenience macro in corsaro_plugin.h. More... | |
#define | PLUGIN(corsaro) (CORSARO_PLUGIN_PLUGIN(corsaro, CORSARO_PLUGIN_ID_SMEE)) |
Extends the generic plugin plugin convenience macro in corsaro_plugin.h. More... | |
#define | CORSARO_SMEE_FPRINTF(outfile) |
Helper macro for IO callbacks to write to a Corsaro file. More... | |
Functions | |
static int | parse_local_address (corsaro_t *corsaro, char *address_str) |
Parse a local address prefix. More... | |
static void | usage (corsaro_t *corsaro) |
Print plugin usage to stderr. More... | |
static int | parse_args (corsaro_t *corsaro) |
Parse the arguments given to the plugin. More... | |
static void | smee_log_callback (void *user_data, int priority, int die, const char *fmt,...) |
Called by smee to log messages. More... | |
static int | smee_stat_callback (void *user_data, const char *fmt,...) |
Called by smee to write stats lines. More... | |
static int | smee_sum_callback (void *user_data, const char *fmt,...) |
Called by smee to populate the summary file. More... | |
static int | smee_sources_callback (void *user_data, const char *fmt,...) |
Called by smee to populate the sources file. More... | |
static uint64_t | smee_pkt_drops (void *user_data) |
Called by smee to determine the number of dropped packets. More... | |
corsaro_plugin_t * | corsaro_smee_alloc (corsaro_t *corsaro) |
Implements the alloc function of the plugin API. More... | |
int | corsaro_smee_probe_filename (const char *fname) |
Implements the probe_filename function of the plugin API. More... | |
int | corsaro_smee_probe_magic (corsaro_in_t *corsaro, corsaro_file_in_t *file) |
Implements the probe_magic function of the plugin API. More... | |
int | corsaro_smee_init_output (corsaro_t *corsaro) |
Implements the init_output function of the plugin API. More... | |
int | corsaro_smee_init_input (corsaro_in_t *corsaro) |
Implements the init_input function of the plugin API. More... | |
int | corsaro_smee_close_input (corsaro_in_t *corsaro) |
Implements the close_input function of the plugin API. More... | |
int | corsaro_smee_close_output (corsaro_t *corsaro) |
Implements the close_output function of the plugin API. More... | |
off_t | corsaro_smee_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_smee_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_smee_start_interval (corsaro_t *corsaro, corsaro_interval_t *int_start) |
Implements the start_interval function of the plugin API. More... | |
int | corsaro_smee_end_interval (corsaro_t *corsaro, corsaro_interval_t *int_end) |
Implements the end_interval function of the plugin API. More... | |
int | corsaro_smee_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_smee_plugin |
Common plugin information across all instances. More... | |
Corsaro plugin wrapper for the iat-smee 'library'.
Definition in file corsaro_smee.c.
#define CORSARO_SMEE_FPRINTF | ( | outfile | ) |
Helper macro for IO callbacks to write to a Corsaro file.
Definition at line 281 of file corsaro_smee.c.
Referenced by smee_sources_callback(), smee_stat_callback(), and smee_sum_callback().
#define CORSARO_SMEE_MAGIC 0x534D4545 |
The magic number for this plugin - "SMEE".
Definition at line 60 of file corsaro_smee.c.
#define CORSARO_SMEE_MX_LIFETIME 3600 |
Default max lifetime for source to stay in hashtable.
Definition at line 73 of file corsaro_smee.c.
Referenced by corsaro_smee_init_output(), and usage().
#define CORSARO_SMEE_MX_SOURCES 4000000 |
Default memory size allocated for source hash table (in KB)
Definition at line 75 of file corsaro_smee.c.
Referenced by corsaro_smee_init_output(), and usage().
#define CORSARO_SMEE_SRCFILE PLUGIN_NAME"-sources" |
The name for the src file.
Definition at line 70 of file corsaro_smee.c.
Referenced by corsaro_smee_start_interval().
#define CORSARO_SMEE_STATFILE PLUGIN_NAME"-stat" |
The name for the stat file.
Definition at line 66 of file corsaro_smee.c.
Referenced by corsaro_smee_start_interval().
#define CORSARO_SMEE_SUMFILE PLUGIN_NAME"-sum" |
The name for the sum file.
Definition at line 68 of file corsaro_smee.c.
Referenced by corsaro_smee_start_interval().
#define CORSARO_SMEE_TIME_REC_INTERVAL 3600 |
Default interval in seconds to write summary files.
Definition at line 77 of file corsaro_smee.c.
Referenced by corsaro_smee_init_output(), and usage().
#define PLUGIN | ( | corsaro | ) | (CORSARO_PLUGIN_PLUGIN(corsaro, CORSARO_PLUGIN_ID_SMEE)) |
Extends the generic plugin plugin convenience macro in corsaro_plugin.h.
Definition at line 121 of file corsaro_smee.c.
Referenced by corsaro_smee_close_output(), corsaro_smee_init_output(), parse_args(), and usage().
#define PLUGIN_NAME "smee" |
The name of this plugin.
Definition at line 63 of file corsaro_smee.c.
#define STATE | ( | corsaro | ) | (CORSARO_PLUGIN_STATE(corsaro, smee, CORSARO_PLUGIN_ID_SMEE)) |
Extends the generic plugin state convenience macro in corsaro_plugin.h.
Definition at line 118 of file corsaro_smee.c.
Referenced by corsaro_smee_close_output(), corsaro_smee_end_interval(), corsaro_smee_process_packet(), corsaro_smee_start_interval(), parse_args(), parse_local_address(), smee_sources_callback(), smee_stat_callback(), and smee_sum_callback().
corsaro_plugin_t* corsaro_smee_alloc | ( | corsaro_t * | corsaro | ) |
Implements the alloc function of the plugin API.
Definition at line 320 of file corsaro_smee.c.
References corsaro_smee_plugin.
int corsaro_smee_close_input | ( | corsaro_in_t * | corsaro | ) |
Implements the close_input function of the plugin API.
Definition at line 436 of file corsaro_smee.c.
int corsaro_smee_close_output | ( | corsaro_t * | corsaro | ) |
Implements the close_output function of the plugin API.
Definition at line 442 of file corsaro_smee.c.
References corsaro_file_close(), corsaro_plugin_free_state(), PLUGIN, corsaro::plugin_manager, and STATE.
Referenced by corsaro_smee_init_output(), and corsaro_smee_start_interval().
int corsaro_smee_end_interval | ( | corsaro_t * | corsaro, |
corsaro_interval_t * | int_end | ||
) |
Implements the end_interval function of the plugin API.
Definition at line 574 of file corsaro_smee.c.
References corsaro_is_rotate_interval(), and STATE.
int corsaro_smee_init_input | ( | corsaro_in_t * | corsaro | ) |
Implements the init_input function of the plugin API.
Definition at line 430 of file corsaro_smee.c.
int corsaro_smee_init_output | ( | corsaro_t * | corsaro | ) |
Implements the init_output function of the plugin API.
Definition at line 340 of file corsaro_smee.c.
References corsaro_get_monitorname(), corsaro_get_traceuri(), corsaro_log(), corsaro_plugin_register_state(), corsaro_smee_close_output(), CORSARO_SMEE_MX_LIFETIME, CORSARO_SMEE_MX_SOURCES, CORSARO_SMEE_TIME_REC_INTERVAL, malloc_zero(), parse_args(), PLUGIN, corsaro::plugin_manager, smee_log_callback(), smee_pkt_drops(), smee_sources_callback(), smee_stat_callback(), and smee_sum_callback().
int corsaro_smee_probe_filename | ( | const char * | fname | ) |
Implements the probe_filename function of the plugin API.
Definition at line 326 of file corsaro_smee.c.
References corsaro_plugin_probe_filename().
int corsaro_smee_probe_magic | ( | corsaro_in_t * | corsaro, |
corsaro_file_in_t * | file | ||
) |
Implements the probe_magic function of the plugin API.
Definition at line 333 of file corsaro_smee.c.
int corsaro_smee_process_packet | ( | corsaro_t * | corsaro, |
corsaro_packet_t * | packet | ||
) |
Implements the process_packet function of the plugin API.
Definition at line 594 of file corsaro_smee.c.
References corsaro_log(), LT_PKT, and STATE.
off_t corsaro_smee_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 494 of file corsaro_smee.c.
off_t corsaro_smee_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 485 of file corsaro_smee.c.
References corsaro_log_in().
int corsaro_smee_start_interval | ( | corsaro_t * | corsaro, |
corsaro_interval_t * | int_start | ||
) |
Implements the start_interval function of the plugin API.
Definition at line 503 of file corsaro_smee.c.
References corsaro_file_close(), corsaro_io_prepare_file(), corsaro_log(), corsaro_smee_close_output(), CORSARO_SMEE_SRCFILE, CORSARO_SMEE_STATFILE, CORSARO_SMEE_SUMFILE, and STATE.
|
static |
Parse the arguments given to the plugin.
Definition at line 202 of file corsaro_smee.c.
References corsaro_plugin::argc, corsaro_plugin::argv, parse_local_address(), PLUGIN, STATE, and usage().
Referenced by corsaro_smee_init_output().
|
static |
Parse a local address prefix.
Definition at line 125 of file corsaro_smee.c.
References STATE.
Referenced by parse_args().
|
static |
Called by smee to log messages.
Definition at line 266 of file corsaro_smee.c.
References corsaro_log_va().
Referenced by corsaro_smee_init_output().
|
static |
Called by smee to determine the number of dropped packets.
Definition at line 311 of file corsaro_smee.c.
References corsaro_get_dropped_packets().
Referenced by corsaro_smee_init_output().
|
static |
Called by smee to populate the sources file.
Definition at line 305 of file corsaro_smee.c.
References CORSARO_SMEE_FPRINTF, and STATE.
Referenced by corsaro_smee_init_output().
|
static |
Called by smee to write stats lines.
Definition at line 293 of file corsaro_smee.c.
References CORSARO_SMEE_FPRINTF, and STATE.
Referenced by corsaro_smee_init_output().
|
static |
Called by smee to populate the summary file.
Definition at line 299 of file corsaro_smee.c.
References CORSARO_SMEE_FPRINTF, and STATE.
Referenced by corsaro_smee_init_output().
|
static |
Print plugin usage to stderr.
Definition at line 175 of file corsaro_smee.c.
References corsaro_get_monitorname(), CORSARO_SMEE_MX_LIFETIME, CORSARO_SMEE_MX_SOURCES, CORSARO_SMEE_TIME_REC_INTERVAL, and PLUGIN.
Referenced by parse_args().
|
static |
Common plugin information across all instances.
Definition at line 80 of file corsaro_smee.c.
Referenced by corsaro_smee_alloc().