1/* This file is part of the KDE project
2 *
3 * Copyright (C) 2004 Jakub Stachowski <qbast@go2.pl>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifndef AVAHI_PUBLICSERVICE_P_H
22#define AVAHI_PUBLICSERVICE_P_H
23
24#include <QtCore/QStringList>
25#include "servicebase_p.h"
26#include <avahi-common/defs.h>
27#include "publicservice.h"
28#include "avahi_server_interface.h"
29#include "avahi_entrygroup_interface.h"
30
31#define K_D PublicServicePrivate* d=static_cast<PublicServicePrivate*>(this->d)
32
33namespace DNSSD
34{
35
36class PublicServicePrivate : public QObject, public ServiceBasePrivate
37{
38Q_OBJECT
39public:
40 PublicServicePrivate(PublicService* parent, const QString& name, const QString& type, const QString& domain, unsigned int port) :
41 QObject(), ServiceBasePrivate(name, type, domain, QString(), port), m_published(false), m_running(false), m_group(0),
42 m_server(0), m_collision(false), m_parent(parent)
43 {}
44 ~PublicServicePrivate() {
45 if (m_group) m_group->Free();
46 delete m_group;
47 delete m_server;
48 }
49
50 bool m_published;
51 bool m_running;
52 org::freedesktop::Avahi::EntryGroup* m_group;
53 org::freedesktop::Avahi::Server* m_server;
54 bool m_collision;
55 QStringList m_subtypes;
56 PublicService* m_parent;
57
58 void commit()
59 {
60 if (!m_collision) m_group->Commit();
61 }
62 void stop();
63 bool fillEntryGroup();
64 void tryApply();
65
66public Q_SLOTS:
67 void serverStateChanged(int,const QString&);
68 void groupStateChanged(int,const QString&);
69};
70
71}
72
73#endif
74