3485e3aa44
KDNSSD only works with Avahi (so, only on Linux) while mdns.h is a header-only library [1] that implements mdns from scratch and should work on all platforms. [1] https://github.com/mjansson/mdns
44 lines
902 B
C++
44 lines
902 B
C++
/**
|
|
* SPDX-FileCopyrightText: 2023 Albert Vaca Cintora <albertvaka@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
*/
|
|
|
|
#ifndef KDECONNECT_MDNS_DISCOVERY_H
|
|
#define KDECONNECT_MDNS_DISCOVERY_H
|
|
|
|
#include <QObject>
|
|
|
|
#include "kdeconnectcore_export.h"
|
|
|
|
#include "mdns_wrapper.h"
|
|
|
|
class LanLinkProvider;
|
|
|
|
class KDECONNECTCORE_EXPORT MdnsDiscovery : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MdnsDiscovery(LanLinkProvider *parent);
|
|
~MdnsDiscovery();
|
|
|
|
void startDiscovering();
|
|
void stopDiscovering();
|
|
|
|
void stopAnnouncing();
|
|
void startAnnouncing();
|
|
|
|
public Q_SLOTS:
|
|
void onNetworkChange()
|
|
{
|
|
mdnsAnnouncer.onNetworkChange();
|
|
}
|
|
|
|
private:
|
|
LanLinkProvider *lanLinkProvider = nullptr;
|
|
MdnsWrapper::Discoverer mdnsDiscoverer;
|
|
MdnsWrapper::Announcer mdnsAnnouncer;
|
|
};
|
|
|
|
#endif // KDECONNECT_SERVER_H
|