Initial import.
This commit is contained in:
45
packet.h
Normal file
45
packet.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef __PACKET_H
|
||||
#define __PACKET_H
|
||||
|
||||
#define _BSD_SOURCE 1
|
||||
#include <net/ethernet.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <pcap.h>
|
||||
}
|
||||
|
||||
/* To initialise this module, call getLocal with the currently
|
||||
* monitored device (e.g. "eth0:1") */
|
||||
void getLocal (const char *device);
|
||||
|
||||
class Packet
|
||||
{
|
||||
public:
|
||||
in_addr sip;
|
||||
in_addr dip;
|
||||
unsigned short sport;
|
||||
unsigned short dport;
|
||||
bpf_u_int32 len;
|
||||
timeval time;
|
||||
|
||||
Packet (in_addr m_sip, unsigned short m_sport, in_addr m_dip, unsigned short m_dport, bpf_u_int32 m_len, timeval m_time);
|
||||
/* copy constructor */
|
||||
Packet * newPacket ();
|
||||
|
||||
bool isOlderThan(timeval t);
|
||||
/* is this packet coming from here? */
|
||||
bool Outgoing ();
|
||||
|
||||
bool match (Packet * other);
|
||||
/* returns '1.2.3.4:5-1.2.3.4:6'-style string */
|
||||
char * gethashstring();
|
||||
};
|
||||
|
||||
Packet * getPacket (const struct pcap_pkthdr * header, const u_char * packet);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user