-
Notifications
You must be signed in to change notification settings - Fork 0
/
pcap_analyse.h
83 lines (68 loc) · 1.78 KB
/
pcap_analyse.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef PCAP_ANALYSE_H
#define PCAP_ANALYSE_H
//#include <vector>
//#include <pcap.h>
//#include <pcap/pcap.h>
//#include <stdlib.h>
//#include <netinet/ip.h>
//#include <arpa/inet.h>
//#include <QString>
//#include <QDateTime>
//#include <QWaitCondition>
//#include <QObject>
//#include <QMutex>
//#include <QDebug>
//#include <QTimer>
//#include <QThread>
//#include <QEventLoop>
#include <vector>
#include <paquet.h>
//#include <mainwindow.h>
#include <QEventLoop>
//#include <QThread>
//#include <QTimer>
#include <QWaitCondition>
#include <QObject>
#include <QMutex>
#include "paquet.h"
#define ETHER_TYPE_IP (0x0800)
#define ETHER_TYPE_8021Q (0x8100)
class MainWindow;
class pcap_analyse : public QObject
{
Q_OBJECT
public:
explicit pcap_analyse(QObject *parent = 0);
void abort();
// static struct pcap_pkthdr header;
unsigned int pkt_counter;
unsigned long byte_counter;
unsigned long cur_counter;
unsigned long max_volume;
unsigned long current_ts;
// const u_char *packet;
// pcap_t *handle;
char errbuf[PCAP_ERRBUF_SIZE]; //not sure what to do with this, oh well
// The header that pcap gives us
const u_char *packet; // The actual packet
static pcap_t *handle;
static struct pcap_pkthdr header;
QWaitCondition condition;
bool _abort;
bool _interrupt;
QMutex mutex;
void requestPaquet(QString filename);
MainWindow* window;
// pcap_analyse(QString filename, QObject *parent = 0);
// std::vector<paquet> getPaquets() const;
// void setPaquets(const std::vector<paquet> &value);
signals:
void tvalueChanged(unsigned char *, pcap_pkthdr);
void finished();
public slots:
void run();
private:
// mutable std::vector<paquet> paquets;
QString fileName;
};
#endif // PCAP_ANALYSE_H