/** Maximum string length for the log entries */
#define MAX_LOG_BUFFER_LEN 1024

#define DUMP_METRIC(value, time, fmt, ...)                                     \
  do {                                                                         \
    fprintf(stdout, fmt " %" PRIu32 " %" PRIu32 "\n", __VA_ARGS__, value,      \
            time);                                                             \
  } while (0)

/** Common plugin information across all instances */
static bgpcorsaro_plugin_t bgpcorsaro_asmonitor_plugin = {
  PLUGIN_NAME,                                           /* name */
  PLUGIN_VERSION,                                        /* version */
  BGPCORSARO_PLUGIN_ID_ASMONITOR,                        /* id */
  BGPCORSARO_PLUGIN_GENERATE_PTRS(bgpcorsaro_asmonitor), /* func ptrs */
  BGPCORSARO_PLUGIN_GENERATE_TAIL,
};

/** Data structure associated with each prefix
 *  in the patricia tree (attached to the user
 *  pointer */
typedef struct perpfx_info {

  /** last ts the prefix was observed */
  uint32_t last_observed;

} perpfx_info_t;

/** A set that contains a unique set of path segments */
KHASH_INIT(path_segments, bgpstream_as_path_seg_t *, char, 0,
Example #2
0
    of an interval. If the wandio buffers are large enough that it takes more
    than 1 interval to drain the buffers, consider increasing this number */
#define OUTFILE_POINTERS 2

/** The name of this plugin */
#define PLUGIN_NAME "pacifier"

/** The version of this plugin */
#define PLUGIN_VERSION "0.1"

/** Common plugin information across all instances */
static bgpcorsaro_plugin_t bgpcorsaro_pacifier_plugin = {
  PLUGIN_NAME,                                  /* name */
  PLUGIN_VERSION,                               /* version */
  BGPCORSARO_PLUGIN_ID_PACIFIER,                 /* id */
  BGPCORSARO_PLUGIN_GENERATE_PTRS(bgpcorsaro_pacifier), /* func ptrs */
  BGPCORSARO_PLUGIN_GENERATE_TAIL,
};


/** Holds the state for an instance of this plugin */
struct bgpcorsaro_pacifier_state_t {
  /** The outfile for the plugin */
  iow_t *outfile;
  /** A set of pointers to outfiles to support non-blocking close */
  iow_t *outfile_p[OUTFILE_POINTERS];
  /** The current outfile */
  int outfile_n;

  // first time
  int tv_first_time;