#ifndef PCAPRETHREAD_H #define PCAPRETHREAD_H #include #define HAVE_REMOTE #include "pcap.h" struct Resp { int id; std::function callback; }; class PcapReThread : public QThread { Q_OBJECT public: explicit PcapReThread(pcap *pcap); ~PcapReThread() { pcap_close(pcap); } void addResp(const Resp &resp) { std::lock_guard lock(mtx); resps.append(resp); } std::atomic status{0}; QList resps; std::mutex mtx; pcap *pcap; signals: void onMsg(Resp resp, const QByteArray data); void onError(char *); protected: void run(); }; #endif // PCAPRETHREAD_H