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,2007 Jakub Stachowski <qbast@go2.pl>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef AVAHI_SERVICETYPEBROWSER_P_H
0010 #define AVAHI_SERVICETYPEBROWSER_P_H
0011 
0012 #include "avahi_listener_p.h"
0013 #include "avahi_servicetypebrowser_interface.h"
0014 #include "servicetypebrowser.h"
0015 #include <QStringList>
0016 #include <QTimer>
0017 
0018 namespace KDNSSD
0019 {
0020 class ServiceTypeBrowserPrivate : public QObject, public AvahiListener
0021 {
0022     Q_OBJECT
0023 public:
0024     ServiceTypeBrowserPrivate(ServiceTypeBrowser *parent)
0025         : m_browser(nullptr)
0026         , m_parent(parent)
0027         , m_started(false)
0028     {
0029     }
0030     ~ServiceTypeBrowserPrivate() override
0031     {
0032         if (m_browser) {
0033             m_browser->Free();
0034         }
0035     }
0036 
0037     org::freedesktop::Avahi::ServiceTypeBrowser *m_browser = nullptr;
0038     ServiceTypeBrowser *m_parent = nullptr;
0039     bool m_started = false;
0040     QStringList m_servicetypes;
0041     QString m_domain;
0042     QTimer m_timer;
0043 
0044 private Q_SLOTS:
0045     // NB: The global slots are runtime connected! If their signature changes
0046     // make sure the SLOT() signature gets updated!
0047     void gotGlobalItemNew(int interface, int protocol, const QString &type, const QString &domain, uint flags, QDBusMessage msg);
0048     void gotGlobalItemRemove(int interface, int protocol, const QString &type, const QString &domain, uint flags, QDBusMessage msg);
0049     void gotGlobalAllForNow(QDBusMessage msg);
0050 
0051     void gotNewServiceType(int, int, const QString &, const QString &, uint);
0052     void gotRemoveServiceType(int, int, const QString &, const QString &, uint);
0053     void finished();
0054 };
0055 
0056 }
0057 #endif