File indexing completed on 2024-04-28 15:22:05
0001 /* 0002 This file is part of the KDE project 0003 0004 SPDX-FileCopyrightText: 2004 Jakub Stachowski <qbast@go2.pl> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef AVAHI_REMOTESERVICE_P_H 0010 #define AVAHI_REMOTESERVICE_P_H 0011 0012 #include "avahi_listener_p.h" 0013 #include "avahi_serviceresolver_interface.h" 0014 #include "remoteservice.h" 0015 #include "servicebase_p.h" 0016 #include <QList> 0017 #include <QMap> 0018 #include <QString> 0019 0020 #define KDNSSD_D RemoteServicePrivate *d = static_cast<RemoteServicePrivate *>(this->d.operator->()) 0021 0022 namespace KDNSSD 0023 { 0024 class RemoteServicePrivate : public QObject, public ServiceBasePrivate, public AvahiListener 0025 { 0026 Q_OBJECT 0027 public: 0028 RemoteServicePrivate(RemoteService *parent, const QString &name, const QString &type, const QString &domain) 0029 : QObject() 0030 , ServiceBasePrivate(name, type, domain, QString(), 0) 0031 , m_resolved(false) 0032 , m_running(false) 0033 , m_resolver(nullptr) 0034 , m_parent(parent) 0035 { 0036 } 0037 ~RemoteServicePrivate() override 0038 { 0039 if (m_resolver) { 0040 m_resolver->Free(); 0041 } 0042 delete m_resolver; 0043 } 0044 bool m_resolved = false; 0045 bool m_running = false; 0046 org::freedesktop::Avahi::ServiceResolver *m_resolver = nullptr; 0047 RemoteService *m_parent = nullptr; 0048 void stop(); 0049 0050 private Q_SLOTS: 0051 // NB: The global slots are runtime connected! If their signature changes 0052 // make sure the SLOT() signature gets updated! 0053 void gotGlobalFound(int interface, 0054 int protocol, 0055 const QString &name, 0056 const QString &type, 0057 const QString &domain, 0058 const QString &host, 0059 int aprotocol, 0060 const QString &address, 0061 ushort port, 0062 const QList<QByteArray> &txt, 0063 uint flags, 0064 QDBusMessage msg); 0065 void gotGlobalError(QDBusMessage msg); 0066 0067 void gotFound(int interface, 0068 int protocol, 0069 const QString &name, 0070 const QString &type, 0071 const QString &domain, 0072 const QString &host, 0073 int aprotocol, 0074 const QString &address, 0075 ushort port, 0076 const QList<QByteArray> &txt, 0077 uint flags); 0078 void gotError(); 0079 }; 0080 0081 } 0082 0083 #endif