2019-05-27 15:32:00 +00:00
|
|
|
#pragma once
|
2019-05-28 12:21:06 +00:00
|
|
|
#define _GNU_SOURCE
|
|
|
|
|
2019-05-27 15:32:00 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2019-05-27 16:14:21 +00:00
|
|
|
#include <glib-2.0/glib.h>
|
|
|
|
#include <glib-2.0/gmodule.h>
|
|
|
|
#include <glib-2.0/glib-object.h>
|
2019-05-27 15:32:00 +00:00
|
|
|
#include <errno.h>
|
2019-05-28 09:45:20 +00:00
|
|
|
#include "packet.h"
|
2019-05-27 15:32:00 +00:00
|
|
|
#include "evt_core.h"
|
|
|
|
|
2019-05-28 09:45:20 +00:00
|
|
|
#define KILOBYTE 1024l
|
|
|
|
#define MEGABYTE 1024l * KILOBYTE
|
|
|
|
#define GIGABYTE 1024l * MEGABYTE
|
|
|
|
|
2019-05-27 16:14:21 +00:00
|
|
|
struct captured_packet {
|
|
|
|
struct timeval* captured_time;
|
|
|
|
char* pkt;
|
|
|
|
};
|
2019-05-27 15:32:00 +00:00
|
|
|
|
2019-05-28 09:45:20 +00:00
|
|
|
struct dynbuf {
|
|
|
|
char* content;
|
|
|
|
size_t written;
|
|
|
|
size_t alloced;
|
|
|
|
};
|
|
|
|
|
2019-05-27 16:14:21 +00:00
|
|
|
struct capture_ctx {
|
|
|
|
uint8_t activated;
|
|
|
|
char* filename;
|
|
|
|
struct timeval* start_time;
|
2019-05-28 09:45:20 +00:00
|
|
|
struct dynbuf in;
|
|
|
|
struct dynbuf out;
|
2019-05-27 15:32:00 +00:00
|
|
|
};
|
|
|
|
|
2019-05-27 16:14:21 +00:00
|
|
|
void traffic_capture_init(struct capture_ctx* ctx, char* filename);
|
|
|
|
void traffic_capture_stop(struct capture_ctx* ctx);
|
2019-05-28 09:45:20 +00:00
|
|
|
void traffic_capture_notify(struct capture_ctx* ctx, struct buffer_packet *bp, char* dest);
|