Skip to Content
[CAIDA - Center for Applied Internet Data Analysis logo]
The Center for Applied Internet Data Analysis
corsaro_smee.c
Go to the documentation of this file.
1 /*
2  * corsaro
3  *
4  * Alistair King, CAIDA, UC San Diego
5  * corsaro-info@caida.org
6  *
7  * Copyright (C) 2012 The Regents of the University of California.
8  *
9  * This file is part of corsaro.
10  *
11  * corsaro is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * corsaro is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with corsaro. If not, see <http://www.gnu.org/licenses/>.
23  *
24  */
25 
26 #include "config.h"
27 #include "corsaro_int.h"
28 
29 #include <arpa/inet.h>
30 #include <assert.h>
31 #include <inttypes.h>
32 #include <stdarg.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36 #include <unistd.h>
37 
38 #include "libtrace.h"
39 
40 #include "iat-smee.h"
41 
42 #include "utils.h"
43 
44 #include "corsaro_io.h"
45 #include "corsaro_file.h"
46 #include "corsaro_log.h"
47 #include "corsaro_plugin.h"
48 
49 #include "corsaro_smee.h"
50 
60 #define CORSARO_SMEE_MAGIC 0x534D4545
61 
63 #define PLUGIN_NAME "smee"
64 
66 #define CORSARO_SMEE_STATFILE PLUGIN_NAME"-stat"
67 
68 #define CORSARO_SMEE_SUMFILE PLUGIN_NAME"-sum"
69 
70 #define CORSARO_SMEE_SRCFILE PLUGIN_NAME"-sources"
71 
73 #define CORSARO_SMEE_MX_LIFETIME 3600
74 
75 #define CORSARO_SMEE_MX_SOURCES 4000000
76 
77 #define CORSARO_SMEE_TIME_REC_INTERVAL 3600
78 
81  PLUGIN_NAME, /* name */
82  CORSARO_PLUGIN_ID_SMEE, /* id */
83  CORSARO_SMEE_MAGIC, /* magic */
84  CORSARO_PLUGIN_GENERATE_PTRS(corsaro_smee), /* func ptrs */
86 };
87 
89 struct corsaro_smee_state_t {
91  int rotate;
93  corsaro_file_t *statfile;
94  corsaro_file_t *sumfile;
95  corsaro_file_t *srcfile;
96 
98  int smee_started;
99 
100  /* some options */
102  struct ip_address *local_addresses;
104  int local_addresses_cnt;
106  const char *meter_location;
108  int max_lifetime;
110  int max_sources;
112  int time_rec_interval;
114  int save_distributions;
115 };
116 
118 #define STATE(corsaro) \
119  (CORSARO_PLUGIN_STATE(corsaro, smee, CORSARO_PLUGIN_ID_SMEE))
120 
121 #define PLUGIN(corsaro) \
122  (CORSARO_PLUGIN_PLUGIN(corsaro, CORSARO_PLUGIN_ID_SMEE))
123 
125 static int parse_local_address(corsaro_t *corsaro, char *address_str)
126 {
127  struct corsaro_smee_state_t *state = STATE(corsaro);
128  struct ip_address *la = NULL;
129 
130  char *tok = NULL;
131 
132  /* re-alloc the prefix list to hold it */
133  if((state->local_addresses =
134  realloc(state->local_addresses,
135  sizeof(struct ip_address) * (state->local_addresses_cnt+1))
136  ) == NULL)
137  {
138  fprintf(stderr, "ERROR: could not re-alloc address list\n");
139  return -1;
140  }
141 
142 la = &(state->local_addresses[state->local_addresses_cnt++]);
143  la->ver = 4;
144 
145  if((tok = strsep(&address_str, "/")) == NULL)
146  {
147  fprintf(stderr, "ERROR: Invalid local address (%s)\n", address_str);
148  return -1;
149  }
150 
151  /* tok should be the address */
152  if((la->a.v4 = inet_addr(tok)) == -1)
153  {
154  /* this sanity check will cause problems the day someone needs to use
155  255.255.255.255, but for now it is useful. */
156  fprintf(stderr, "ERROR: Invalid local address (%s)\n", tok);
157  return -1;
158  }
159 
160  /* address_str should be the prefix length */
161  if((la->len = atoi(address_str)) > 32)
162  {
163  fprintf(stderr, "ERROR: Invalid local address mask (%s)\n", address_str);
164  return -1;
165  }
166  if(la->len == 0)
167  {
168  fprintf(stderr, "WARNING: Local address mask of 0 (%s)\n", address_str);
169  }
170 
171  return 0;
172 }
173 
175 static void usage(corsaro_t *corsaro)
176 {
177  fprintf(stderr,
178  "plugin usage: %s [-s] [-i interval] [-l meter_loc] [-L max_src_life] -a prefix\n"
179  " -a local prefix "
180  "(-a can be specified multiple times)\n"
181  " -i interval between writing summary files (secs) "
182  "(default: %d)\n"
183  " -l meter location (default: %s)\n"
184 
185  " -L max lifetime for source to stay in hashtable "
186  "(secs) (default: %d)\n"
187  " -m memory size allocated for source hash table "
188  "(in KB) (default: %d)\n"
189  " -s write the source tables to a file "
190  "(disables summary tables)\n",
191  PLUGIN(corsaro)->argv[0],
193  corsaro_get_monitorname(corsaro),
196  );
197 }
198 
203 {
204  corsaro_plugin_t *plugin = PLUGIN(corsaro);
205  struct corsaro_smee_state_t *state = STATE(corsaro);
206  int opt;
207 
208  assert(plugin->argc > 0 && plugin->argv != NULL);
209 
210  /* NB: remember to reset optind to 1 before using getopt! */
211  optind = 1;
212 
213  while((opt = getopt(plugin->argc, plugin->argv, ":a:i:l:L:m:s?")) >= 0)
214  {
215  switch(opt)
216  {
217  case 'a':
218  /* add this prefix to the list */
219  if(parse_local_address(corsaro, optarg) != 0)
220  {
221  usage(corsaro);
222  return -1;
223  }
224  break;
225 
226  case 'i':
227  state->time_rec_interval = atoi(optarg);
228  break;
229 
230  case 'l':
231  state->meter_location = strdup(optarg);
232  break;
233 
234  case 'L':
235  state->max_lifetime = atoi(optarg);
236  break;
237 
238  case 'm':
239  state->max_sources = atoi(optarg);
240  break;
241 
242  case 's':
243  state->save_distributions = 1;
244  break;
245 
246  case '?':
247  case ':':
248  default:
249  usage(corsaro);
250  return -1;
251  }
252  }
253 
254  if(state->local_addresses_cnt == 0)
255  {
256  fprintf(stderr,
257  "ERROR: At least one local prefix must be specified using -a\n");
258  usage(corsaro);
259  return -1;
260  }
261 
262  return 0;
263 }
264 
266 static void smee_log_callback(void *user_data, int priority, int die,
267  const char *fmt, ...)
268 {
269  va_list ap;
270  va_start(ap, fmt);
271  corsaro_log_va("libsmee", (corsaro_t*)user_data, fmt, ap);
272  va_end(ap);
273 
274  if(die == 1)
275  {
276  abort();
277  }
278 }
279 
281 #define CORSARO_SMEE_FPRINTF(outfile) \
282  va_list ap; \
283  corsaro_t *corsaro = (corsaro_t*)user_data; \
284  va_start(ap, fmt); \
285  corsaro_file_vprintf(corsaro, (outfile), fmt, ap); \
286  /* smee expects a newline to be written. \
287  this is a little hacky, but... */ \
288  corsaro_file_printf(corsaro, (outfile), "\n"); \
289  va_end(ap); \
290  return 0;
291 
293 static int smee_stat_callback(void *user_data, const char *fmt, ...)
294 {
296 }
297 
299 static int smee_sum_callback(void *user_data, const char *fmt, ...)
300 {
302 }
303 
305 static int smee_sources_callback(void *user_data, const char *fmt, ...)
306 {
308 }
309 
311 static uint64_t smee_pkt_drops(void *user_data)
312 {
313  return corsaro_get_dropped_packets((corsaro_t*)user_data);
314  return 0;
315 }
316 
317 /* == PUBLIC PLUGIN FUNCS BELOW HERE == */
318 
321 {
322  return &corsaro_smee_plugin;
323 }
324 
326 int corsaro_smee_probe_filename(const char *fname)
327 {
328  /* look for 'corsaro_smee' in the name */
329  return corsaro_plugin_probe_filename(fname, &corsaro_smee_plugin);
330 }
331 
334 {
335  /* once we know what the binary output will look like...*/
336  return -1;
337 }
338 
341 {
342  struct corsaro_smee_state_t *state;
343  corsaro_plugin_t *plugin = PLUGIN(corsaro);
344 
345  assert(plugin != NULL);
346 
347  if((state = malloc_zero(sizeof(struct corsaro_smee_state_t))) == NULL)
348  {
349  corsaro_log(__func__, corsaro,
350  "could not malloc corsaro_smee_state_t");
351  goto err;
352  }
353  corsaro_plugin_register_state(corsaro->plugin_manager, plugin, state);
354 
355  /* set some sane default values (for ucsd-nt anyway) */
356  state->meter_location = corsaro_get_monitorname(corsaro);
357  state->max_lifetime = CORSARO_SMEE_MX_LIFETIME;
358  state->max_sources = CORSARO_SMEE_MX_SOURCES;
359  state->time_rec_interval = CORSARO_SMEE_TIME_REC_INTERVAL;
360  state->save_distributions = 0;
361 
362  /* parse the arguments */
363  if(parse_args(corsaro) != 0)
364  {
365  return -1;
366  }
367 
368  /* files opened at first interval */
369 
370  /*
371  Parameter values:
372 
373  c_meter_loc
374  'SAN' or 'AKL'
375 
376  c_mx_life
377  Max lifetime for a source to stay in hash table.
378  -m option to iat-monitor.rb.
379  = mx_lifetime = 3600 (SAN) or 172800 (AKL, seconds in two days)
380 
381  c_mx_sources = 4000000 or 800000 # 4M on thor, 800k on nevil-res3
382  Specifies size of memory chunks allocated by iatmon for
383  its source hash table. MX_EXTRA_BLOCKS (defined 2 in iat.h)
384  may be allocated each time the available space is used up.
385 
386  c_time_rec_interval
387  Interval time in seconds to write summary files
388  -c option to iat-monitor.rb, = Hours_reqd*3600 from iat-config.rb
389 
390  c_local_addrs, c_n_local_addrs = 'XX.0.0.0/8' # (CAIDA) or
391  '130.216/16, 202.36.245/24, 2001:0df0::/47' # (U Auckland)
392 
393 
394  [ STATS_RECORDING_INTERVAL
395  Intervals to write statistics (#Stats: ) lines
396  defined 60 s in iat.h ]
397 
398  save_distributions
399  true to write iat distributions to a file
400  (so that one can analyse their statistics offline).
401  */
402 
403  /* there is a 'feature' in libsmee which means that if smee_sources_callback
404  is given, then smee_sum_callback will never be called. We should detect if
405  this is the case and not open the sum file. */
406 
407  iat_init(corsaro_get_traceuri(corsaro), /* traceuri */
408  state->meter_location, /* meterloc */
409  state->max_lifetime, /* mx_lifetime */
410  state->max_sources, /*c_mx_sources */
411  state->time_rec_interval, /* c_time_rec_interval */
412  state->local_addresses,
413  state->local_addresses_cnt,
414  corsaro, /* c_user_data */
415  smee_log_callback, /* c_log_msg */
416  smee_stat_callback, /* c_stat_printf */
417  (state->save_distributions == 0 ? smee_sum_callback : NULL),
418  (state->save_distributions == 0 ? NULL : smee_sources_callback),
419  smee_pkt_drops /* c_pkt_drops */
420  );
421 
422  return 0;
423 
424  err:
425  corsaro_smee_close_output(corsaro);
426  return -1;
427 }
428 
431 {
432  return -1;
433 }
434 
437 {
438  return -1;
439 }
440 
443 {
444  struct corsaro_smee_state_t *state = STATE(corsaro);
445 
446  /* smee is not smart enough to ignore this if it hasn't been init'd yet */
447  if(state->smee_started != 0)
448  {
449  iat_process_packet(NULL, SM_DUMMY);
450  state->smee_started = 0;
451  }
452 
453  if(state != NULL)
454  {
455  if(state->statfile != NULL)
456  {
457  corsaro_file_close(corsaro, state->statfile);
458  state->statfile = NULL;
459  }
460  if(state->sumfile != NULL)
461  {
462  corsaro_file_close(corsaro, state->sumfile);
463  state->sumfile = NULL;
464  }
465  if(state->srcfile != NULL)
466  {
467  corsaro_file_close(corsaro, state->srcfile);
468  state->srcfile = NULL;
469  }
470 
471  if(state->local_addresses_cnt > 0 && state->local_addresses != NULL)
472  {
473  free(state->local_addresses);
474  state->local_addresses = NULL;
475  state->local_addresses_cnt = 0;
476  }
477 
478  corsaro_plugin_free_state(corsaro->plugin_manager, PLUGIN(corsaro));
479  }
480 
481  return 0;
482 }
483 
486  corsaro_in_record_type_t *record_type,
488 {
489  corsaro_log_in(__func__, corsaro, "not yet implemented");
490  return -1;
491 }
492 
495  enum corsaro_in_record_type *record_type,
496  struct corsaro_in_record *record)
497 {
498  /* we write nothing to the global file. someone messed up */
499  return -1;
500 }
501 
504 {
505  struct corsaro_smee_state_t *state = STATE(corsaro);
506 
507  if(state->rotate == 1)
508  {
509  if(state->statfile != NULL)
510  {
511  corsaro_file_close(corsaro, state->statfile);
512  state->statfile = NULL;
513  }
514  if(state->sumfile != NULL)
515  {
516  corsaro_file_close(corsaro, state->sumfile);
517  state->sumfile = NULL;
518  }
519  if(state->srcfile != NULL)
520  {
521  corsaro_file_close(corsaro, state->srcfile);
522  state->srcfile = NULL;
523  }
524 
525  state->rotate = 0;
526  }
527 
528  /* open the stats output file */
529  if(state->statfile == NULL &&
530  (state->statfile = corsaro_io_prepare_file(corsaro, CORSARO_SMEE_STATFILE,
531  int_start))
532  == NULL)
533  {
534  corsaro_log(__func__, corsaro, "could not open %s output file",
536  goto err;
537  }
538 
539  /* open the sum output file (only if save_distributions is disabled) */
540  if(state->save_distributions == 0 &&
541  state->sumfile == NULL &&
542  (state->sumfile = corsaro_io_prepare_file(corsaro, CORSARO_SMEE_SUMFILE,
543  int_start))
544  == NULL)
545  {
546  corsaro_log(__func__, corsaro, "could not open %s output file",
548  goto err;
549  }
550 
551  /* open the srcs output file */
552  if(state->save_distributions != 0 &&
553  state->srcfile == NULL &&
554  (state->srcfile = corsaro_io_prepare_file(corsaro, CORSARO_SMEE_SRCFILE,
555  int_start))
556  == NULL)
557  {
558  corsaro_log(__func__, corsaro, "could not open %s output file",
560  goto err;
561  }
562 
563  /* now smee is fully started and can be used */
564  state->smee_started = 1;
565 
566  return 0;
567 
568  err:
569  corsaro_smee_close_output(corsaro);
570  return -1;
571 }
572 
575 {
576  /* smee only supports ascii output right now, so be a little rude and
577  ignore the corsaro output mode */
578  iat_process_packet(NULL, SM_RECORD_REQ);
579 
580  /* because of how smee dumps the summary file, we cant close our output
581  files here, it will try and write to them once we start shutting down.
582 
583  go look in _start_interval to see where we rotate the files
584  */
585  if(corsaro_is_rotate_interval(corsaro) == 1)
586  {
587  STATE(corsaro)->rotate = 1;
588  }
589 
590  return 0;
591 }
592 
596 {
597  libtrace_packet_t *ltpacket = LT_PKT(packet);
598  int rc;
599 
600  assert(STATE(corsaro)->smee_started != 0);
601 
602  /* pass the packet on to smee */
603  rc = iat_process_packet(ltpacket, SM_PACKET);
604 
605  if(rc != SM_OK && rc != SM_RECORD_INTERVAL)
606  {
607  corsaro_log(__func__, corsaro, "iat_process_packet returned %d", rc);
608  return -1;
609  }
610  return 0;
611 }
Structure representing the start or end of an interval.
Definition: corsaro_int.h:156
int corsaro_smee_end_interval(corsaro_t *corsaro, corsaro_interval_t *int_end)
Implements the end_interval function of the plugin API.
Definition: corsaro_smee.c:574
An opaque structure defining an corsaro input file.
Definition: corsaro_file.h:86
Header file dealing with the corsaro plugin manager.
Header file dealing with the corsaro logging sub-system.
const char * corsaro_get_monitorname(corsaro_t *corsaro)
Accessor function to get the monitor name string.
Definition: corsaro.c:1241
An opaque structure defining an corsaro output file.
Definition: corsaro_file.h:60
int corsaro_smee_init_input(corsaro_in_t *corsaro)
Implements the init_input function of the plugin API.
Definition: corsaro_smee.c:430
#define CORSARO_SMEE_MAGIC
The magic number for this plugin - "SMEE".
Definition: corsaro_smee.c:60
A reusable opaque structure for corsaro to read an input record into.
Definition: corsaro_int.h:350
#define CORSARO_SMEE_TIME_REC_INTERVAL
Default interval in seconds to write summary files.
Definition: corsaro_smee.c:77
char ** argv
Array of plugin arguments This is populated by the plugin manager in corsaro_plugin_enable_plugin.
static uint64_t smee_pkt_drops(void *user_data)
Called by smee to determine the number of dropped packets.
Definition: corsaro_smee.c:311
#define LT_PKT(corsaro_packet)
Convenience macro to get to the libtrace packet inside an corsaro packet.
Definition: corsaro_int.h:227
void corsaro_log_va(const char *func, corsaro_t *corsaro, const char *format, va_list args)
Write a formatted string to the logfile associated with an corsaro object.
Definition: corsaro_log.c:106
static corsaro_plugin_t corsaro_smee_plugin
Common plugin information across all instances.
Definition: corsaro_smee.c:80
int corsaro_smee_close_output(corsaro_t *corsaro)
Implements the close_output function of the plugin API.
Definition: corsaro_smee.c:442
static int smee_sources_callback(void *user_data, const char *fmt,...)
Called by smee to populate the sources file.
Definition: corsaro_smee.c:305
static int parse_local_address(corsaro_t *corsaro, char *address_str)
Parse a local address prefix.
Definition: corsaro_smee.c:125
static int smee_stat_callback(void *user_data, const char *fmt,...)
Called by smee to write stats lines.
Definition: corsaro_smee.c:293
#define CORSARO_SMEE_SUMFILE
The name for the sum file.
Definition: corsaro_smee.c:68
void corsaro_file_close(struct corsaro *corsaro, corsaro_file_t *file)
Closes an corsaro output file and frees the writer structure.
Definition: corsaro_file.c:230
static libtrace_packet_t * packet
A pointer to a libtrace packet.
Definition: corsaro_main.c:67
void corsaro_plugin_free_state(corsaro_plugin_manager_t *manager, corsaro_plugin_t *plugin)
Free the state for a plugin.
int corsaro_smee_start_interval(corsaro_t *corsaro, corsaro_interval_t *int_start)
Implements the start_interval function of the plugin API.
Definition: corsaro_smee.c:503
#define STATE(corsaro)
Extends the generic plugin state convenience macro in corsaro_plugin.h.
Definition: corsaro_smee.c:118
Header file for common utility functions.
A lightweight wrapper around a libtrace packet.
Definition: corsaro_int.h:211
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: corsaro_smee.c:494
corsaro_plugin_manager_t * plugin_manager
A pointer to the corsaro plugin manager state.
Definition: corsaro_int.h:273
#define CORSARO_PLUGIN_GENERATE_PTRS(plugin)
Convenience macro that defines all the function pointers for the corsaro plugin API.
corsaro_in_record_type
Corsaro input record types.
Definition: corsaro.h:97
corsaro_file_t * corsaro_io_prepare_file(corsaro_t *corsaro, const char *plugin_name, corsaro_interval_t *interval)
Uses the current settings to open an corsaro file for the given plugin.
Definition: corsaro_io.c:688
void corsaro_plugin_register_state(corsaro_plugin_manager_t *manager, corsaro_plugin_t *plugin, void *state)
Register the state for a plugin.
int corsaro_plugin_probe_filename(const char *fname, corsaro_plugin_t *plugin)
Check a filename to see if it contains a plugin's name.
#define CORSARO_SMEE_SRCFILE
The name for the src file.
Definition: corsaro_smee.c:70
#define CORSARO_PLUGIN_GENERATE_TAIL
Convenience macro that defines all the 'remaining' blank fields in a corsaro plugin object...
void * malloc_zero(const size_t size)
Allocate memory and set it to zero.
Definition: utils.c:78
int corsaro_smee_close_input(corsaro_in_t *corsaro)
Implements the close_input function of the plugin API.
Definition: corsaro_smee.c:436
Header file dealing with the low-level file IO.
static corsaro_in_record_t * record
A pointer to a corsaro record.
Definition: corsaro_main.c:76
int argc
Count of arguments in argv.
#define CORSARO_SMEE_STATFILE
The name for the stat file.
Definition: corsaro_smee.c:66
void corsaro_log_in(const char *func, corsaro_in_t *corsaro, const char *format,...)
Write a formatted string to the logfile associated with an corsaro input object.
Definition: corsaro_log.c:121
int corsaro_is_rotate_interval(corsaro_t *corsaro)
Convenience function to determine if the output files should be rotated.
Definition: corsaro.c:1041
int corsaro_smee_process_packet(corsaro_t *corsaro, corsaro_packet_t *packet)
Implements the process_packet function of the plugin API.
Definition: corsaro_smee.c:594
static int smee_sum_callback(void *user_data, const char *fmt,...)
Called by smee to populate the summary file.
Definition: corsaro_smee.c:299
#define CORSARO_SMEE_MX_LIFETIME
Default max lifetime for source to stay in hashtable.
Definition: corsaro_smee.c:73
Corsaro input state.
Definition: corsaro_int.h:323
static void smee_log_callback(void *user_data, int priority, int die, const char *fmt,...)
Called by smee to log messages.
Definition: corsaro_smee.c:266
const char * corsaro_get_traceuri(corsaro_t *corsaro)
Accessor function to get the trace uri string.
Definition: corsaro.c:1202
int corsaro_smee_init_output(corsaro_t *corsaro)
Implements the init_output function of the plugin API.
Definition: corsaro_smee.c:340
static int parse_args(corsaro_t *corsaro)
Parse the arguments given to the plugin.
Definition: corsaro_smee.c:202
Header file dealing with the corsaro file IO.
corsaro_plugin_t * corsaro_smee_alloc(corsaro_t *corsaro)
Implements the alloc function of the plugin API.
Definition: corsaro_smee.c:320
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: corsaro_smee.c:485
#define PLUGIN_NAME
The name of this plugin.
Definition: corsaro_smee.c:63
uint64_t corsaro_get_dropped_packets(corsaro_t *corsaro)
Accessor function to get the number of dropped packets in this interval.
Definition: corsaro.c:1195
static void usage(corsaro_t *corsaro)
Print plugin usage to stderr.
Definition: corsaro_smee.c:175
Corsaro output state.
Definition: corsaro_int.h:230
int corsaro_smee_probe_filename(const char *fname)
Implements the probe_filename function of the plugin API.
Definition: corsaro_smee.c:326
#define PLUGIN(corsaro)
Extends the generic plugin plugin convenience macro in corsaro_plugin.h.
Definition: corsaro_smee.c:121
#define CORSARO_SMEE_MX_SOURCES
Default memory size allocated for source hash table (in KB)
Definition: corsaro_smee.c:75
void corsaro_log(const char *func, corsaro_t *corsaro, const char *format,...)
Write a formatted string to the logfile associated with an corsaro object.
Definition: corsaro_log.c:113
int corsaro_smee_probe_magic(corsaro_in_t *corsaro, corsaro_file_in_t *file)
Implements the probe_magic function of the plugin API.
Definition: corsaro_smee.c:333
#define CORSARO_SMEE_FPRINTF(outfile)
Helper macro for IO callbacks to write to a Corsaro file.
Definition: corsaro_smee.c:281
enum corsaro_in_record_type corsaro_in_record_type_t
Corsaro input record types.
An corsaro packet processing plugin.
Header file dealing with the internal corsaro functions.