cleanups. mainly memory leak fixes
This commit is contained in:
25
packet.h
25
packet.h
@@ -9,11 +9,6 @@
|
||||
#include <arpa/inet.h>
|
||||
#include "nethogs.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <pcap.h>
|
||||
}
|
||||
|
||||
enum direction {
|
||||
dir_unknown,
|
||||
dir_incoming,
|
||||
@@ -33,12 +28,21 @@ public:
|
||||
in_addr dip;
|
||||
unsigned short sport;
|
||||
unsigned short dport;
|
||||
bpf_u_int32 len;
|
||||
u_int32_t 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, direction dir = dir_unknown);
|
||||
Packet (in6_addr m_sip, unsigned short m_sport, in6_addr m_dip, unsigned short m_dport, bpf_u_int32 m_len, timeval m_time, direction dir = dir_unknown);
|
||||
/* using default copy constructor */
|
||||
Packet (in_addr m_sip, unsigned short m_sport, in_addr m_dip, unsigned short m_dport, u_int32_t m_len, timeval m_time, direction dir = dir_unknown);
|
||||
Packet (in6_addr m_sip, unsigned short m_sport, in6_addr m_dip, unsigned short m_dport, u_int32_t m_len, timeval m_time, direction dir = dir_unknown);
|
||||
/* copy constructor */
|
||||
Packet (const Packet &old);
|
||||
~Packet ()
|
||||
{
|
||||
if (hashstring != NULL)
|
||||
{
|
||||
free (hashstring);
|
||||
hashstring = NULL;
|
||||
}
|
||||
}
|
||||
/* Packet (const Packet &old_packet); */
|
||||
/* copy constructor that turns the packet around */
|
||||
Packet * newInverted ();
|
||||
@@ -53,8 +57,7 @@ public:
|
||||
private:
|
||||
direction dir;
|
||||
short int sa_family;
|
||||
char * hashstring;
|
||||
};
|
||||
|
||||
//Packet * getPacket (const struct pcap_pkthdr * header, const u_char * packet, packet_type packettype);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user