Dummy implementation in RemoteView for scaleResize, so there will be no 'slot not...
[kdenetwork.git] / kdnssd / ioslave / dnssd.h
blob8ce030149da8c92c0b070fc7fadfd51ee08655ab
1 /***************************************************************************
2 * Copyright (C) 2004, 2005 by Jakub Stachowski *
3 * qbast@go2.pl *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program 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 *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef _dnssd_H_
22 #define _dnssd_H_
24 #include <qstring.h>
25 #include <qobject.h>
27 #include <kurl.h>
28 #include <kio/global.h>
29 #include <kio/slavebase.h>
30 #include <dnssd/servicebrowser.h>
31 #include <dnssd/servicetypebrowser.h>
32 #include <dnssd/remoteservice.h>
33 #include <qstringlist.h>
36 using namespace KIO;
37 using namespace DNSSD;
39 enum UrlType { RootDir, ServiceDir, Service, Invalid };
41 struct ProtocolData {
42 ProtocolData() {}
43 ProtocolData(const QString& _name, const QString& proto, const QString& path=QString(),
44 const QString& user=QString(), const QString& passwd=QString()) : pathEntry(path),
45 name(_name), userEntry(user), passwordEntry(passwd), protocol(proto) {}
47 QString pathEntry;
48 QString name;
49 QString userEntry;
50 QString passwordEntry;
51 QString protocol;
54 class ZeroConfProtocol : public QObject, public KIO::SlaveBase
56 Q_OBJECT
57 public:
58 ZeroConfProtocol(const QByteArray& protocol, const QByteArray &pool_socket, const QByteArray &app_socket);
59 ~ZeroConfProtocol();
60 virtual void get(const KUrl& url);
61 virtual void mimetype(const KUrl& url);
62 virtual void stat(const KUrl& url);
63 virtual void listDir(const KUrl& url );
64 signals:
65 void leaveModality();
66 private:
67 // Create UDSEntry for zeroconf:/ or zeroconf:/type/ paths
68 void buildDirEntry(UDSEntry& entry,const QString& name,const QString& type=QString());
69 // Returns root dir, service dir, service or invalid
70 UrlType checkURL(const KUrl& url);
71 // extract name and type from URL
72 void dissect(const KUrl& url,QString& name,QString& type);
73 // resolve given service and redirect() to it
74 void resolveAndRedirect(const KUrl& url);
75 bool dnssdOK();
77 void enterLoop();
79 ServiceBrowser* browser;
80 ServiceTypeBrowser* typebrowser;
81 // service types merged from all domains - to avoid duplicates
82 QStringList mergedtypes;
84 RemoteService *toResolve;
85 QHash<QString,ProtocolData> knownProtocols;
87 private slots:
88 void newType(const QString&);
89 void newService(DNSSD::RemoteService::Ptr);
90 void allReported();
94 #endif