qt/ledset/pcapwin.h
2022-08-25 18:43:03 +08:00

39 lines
694 B
C++

#ifndef PCAPWIN_H
#define PCAPWIN_H
#include "basewin.h"
#define HAVE_REMOTE
#include "pcapthread.h"
class PcapThread : public QThread {
Q_OBJECT
public:
explicit PcapThread(pcap *pcap);
~PcapThread() {
pcap_close(pcap);
}
pcap *pcap;
std::atomic<char> status{0};
protected:
void run();
signals:
void onMsg(const QString &);
void onError(char *);
};
class PcapWin : public BaseWin {
Q_OBJECT
public:
static PcapWin *newIns(QWidget *);
explicit PcapWin(pcap *, pcap *, QWidget *parent = nullptr);
~PcapWin() {
pcap_close(pcap);
thd->status = 2;
}
PcapThread *thd{0};
pcap *pcap;
};
#endif // PCAPWIN_H