31 lines
No EOL
800 B
C++
31 lines
No EOL
800 B
C++
#ifndef NETLINKMONITOR_H
|
|
#define NETLINKMONITOR_H
|
|
|
|
#include <QObject>
|
|
#include <QSocketNotifier>
|
|
|
|
class NetlinkMonitor : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit NetlinkMonitor(QObject *parent = nullptr);
|
|
~NetlinkMonitor();
|
|
|
|
// Call this to open and configure the netlink socket.
|
|
// Returns true on success, false on failure.
|
|
Q_INVOKABLE bool setupNetlink();
|
|
|
|
Q_SIGNALS:
|
|
// Emitted whenever a new netlink message arrives.
|
|
void messageReceived(const QString &msg);
|
|
|
|
private Q_SLOTS:
|
|
// Called automatically by QSocketNotifier when netlink data is available.
|
|
void handleReadyRead();
|
|
|
|
private:
|
|
int m_sockFd; // The netlink socket file descriptor
|
|
QSocketNotifier *m_socketNotifier;
|
|
};
|
|
|
|
#endif // NETLINKMONITOR_H
|