/
/
/
1#ifndef ICMP_SOCKET_HPP
2#define ICMP_SOCKET_HPP
3
4#include <QString>
5#include <QObject>
6#include <QMutex>
7#include <QWaitCondition>
8
9class ICMPSocket : public QObject {
10 Q_OBJECT
11public:
12 ICMPSocket();
13 ~ICMPSocket();
14
15 // Sends an ICMP Echo request (ping) to the specified IP address
16 void sendPing(const QString& ipAddress, quint16 id, quint16 sequence);
17
18public slots:
19 void listenForPackets();
20 void stopListening();
21
22signals:
23 void pongReceived(const QString& ipAddress);
24
25private:
26 int sockfd_;
27
28private:
29 bool stopRequested;
30 QMutex mutex;
31};
32
33#endif // ICMP_SOCKET_HPP
34