mirror of
https://github.com/pavel-odintsov/fastnetmon
synced 2024-06-08 12:36:07 +02:00
Moved simple_packet into separate file to break include cycle.
This commit is contained in:
parent
a2ebfac80d
commit
c542eebe5f
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
enum direction { INCOMING = 0, OUTGOING, INTERNAL, OTHER };
|
||||
|
||||
// simplified packet struct for lightweight save into memory
|
||||
class simple_packet {
|
||||
public:
|
||||
simple_packet()
|
||||
: sample_ratio(1), src_ip(0), dst_ip(0), source_port(0), destination_port(0), protocol(0),
|
||||
length(0), flags(0), number_of_packets(1), ip_fragmented(false), ip_protocol_version(4),
|
||||
ttl(0), packet_payload_pointer(NULL), packet_payload_length(0), packet_direction(OTHER) {
|
||||
|
||||
ts.tv_usec = 0;
|
||||
ts.tv_sec = 0;
|
||||
}
|
||||
uint32_t sample_ratio;
|
||||
/* IPv4 */
|
||||
uint32_t src_ip;
|
||||
uint32_t dst_ip;
|
||||
/* IPv6 */
|
||||
struct in6_addr src_ipv6;
|
||||
struct in6_addr dst_ipv6;
|
||||
uint8_t ip_protocol_version; /* IPv4 or IPv6 */
|
||||
uint8_t ttl;
|
||||
uint16_t source_port;
|
||||
uint16_t destination_port;
|
||||
unsigned int protocol;
|
||||
uint64_t length;
|
||||
uint64_t number_of_packets; /* for netflow */
|
||||
uint8_t flags; /* tcp flags */
|
||||
bool ip_fragmented; /* If IP packet fragmented */
|
||||
struct timeval ts;
|
||||
void* packet_payload_pointer;
|
||||
int packet_payload_length;
|
||||
// We store packet direction here because direction calculation is very difficult task for cpu
|
||||
direction packet_direction;
|
||||
};
|
||||
|
|
@ -12,41 +12,7 @@
|
|||
|
||||
#include "packet_storage.h"
|
||||
|
||||
enum direction { INCOMING = 0, OUTGOING, INTERNAL, OTHER };
|
||||
|
||||
// simplified packet struct for lightweight save into memory
|
||||
class simple_packet {
|
||||
public:
|
||||
simple_packet()
|
||||
: sample_ratio(1), src_ip(0), dst_ip(0), source_port(0), destination_port(0), protocol(0),
|
||||
length(0), flags(0), number_of_packets(1), ip_fragmented(false), ip_protocol_version(4),
|
||||
ttl(0), packet_payload_pointer(NULL), packet_payload_length(0), packet_direction(OTHER) {
|
||||
|
||||
ts.tv_usec = 0;
|
||||
ts.tv_sec = 0;
|
||||
}
|
||||
uint32_t sample_ratio;
|
||||
/* IPv4 */
|
||||
uint32_t src_ip;
|
||||
uint32_t dst_ip;
|
||||
/* IPv6 */
|
||||
struct in6_addr src_ipv6;
|
||||
struct in6_addr dst_ipv6;
|
||||
uint8_t ip_protocol_version; /* IPv4 or IPv6 */
|
||||
uint8_t ttl;
|
||||
uint16_t source_port;
|
||||
uint16_t destination_port;
|
||||
unsigned int protocol;
|
||||
uint64_t length;
|
||||
uint64_t number_of_packets; /* for netflow */
|
||||
uint8_t flags; /* tcp flags */
|
||||
bool ip_fragmented; /* If IP packet fragmented */
|
||||
struct timeval ts;
|
||||
void* packet_payload_pointer;
|
||||
int packet_payload_length;
|
||||
// We store packet direction here because direction calculation is very difficult task for cpu
|
||||
direction packet_direction;
|
||||
};
|
||||
#include "fastnetmon_simple_packet.h"
|
||||
|
||||
class logging_configuration_t {
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue