qt/ledset/pcapthread.h

36 lines
565 B
C
Raw Normal View History

2022-08-25 18:43:03 +08:00
#ifndef PCAPTHREAD_H
#define PCAPTHREAD_H
#include <QThread>
#include <winsock2.h>
#include "pcap.h"
#include <QVector>
#pragma comment(lib, "wpcap.lib")
#pragma comment(lib, "Ws2_32.lib")
#define LINE_LEN 16
#define MAX_ADDR_LEN 16
struct Packet {
QString time;
u_int len;
u_int caplen;
QString data;
};
class CapThread : public QThread {
Q_OBJECT
public:
explicit CapThread(pcap *pcap, QObject *parent = nullptr);
pcap *pcap{0};
Packet packet;
protected:
void run();
signals:
void onMsg();
};
#endif // PCAPTHREAD_H