/* * SPDX-FileCopyrightText: 2020 David Redondo * SPDX-FileCopyrightText: 2021 Alessio Bonfiglio * * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL */ #pragma once #include "NetworkBackend.h" #include "NetworkDevice.h" #include #include #include struct rtnl_addr; struct rtnl_link; class RtNetlinkDevice : public NetworkDevice { Q_OBJECT public: RtNetlinkDevice(const QString &id); void update(rtnl_link *link, nl_cache *address_cache, nl_cache *route_cache, qint64 elapsedTime); Q_SIGNALS: void connected(); void disconnected(); private: bool m_connected = false; }; class RtNetlinkBackend : public NetworkBackend { public: RtNetlinkBackend(QObject *parent); ~RtNetlinkBackend() override; bool isSupported() override; void start() override; void stop() override; void update() override; private: QHash m_devices; std::unique_ptr m_socket; QElapsedTimer m_updateTimer; };