summaryrefslogtreecommitdiffstats
path: root/tdednssd/ioslave/dnssd.h
diff options
context:
space:
mode:
Diffstat (limited to 'tdednssd/ioslave/dnssd.h')
-rw-r--r--tdednssd/ioslave/dnssd.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/tdednssd/ioslave/dnssd.h b/tdednssd/ioslave/dnssd.h
new file mode 100644
index 00000000..f06b0427
--- /dev/null
+++ b/tdednssd/ioslave/dnssd.h
@@ -0,0 +1,88 @@
+/***************************************************************************
+ * Copyright (C) 2004, 2005 by Jakub Stachowski *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifndef _dnssd_H_
+#define _dnssd_H_
+
+#include <tqstring.h>
+#include <tqcstring.h>
+#include <tqobject.h>
+
+#include <kurl.h>
+#include <kio/global.h>
+#include <kio/slavebase.h>
+#include <dnssd/servicebrowser.h>
+#include <dnssd/remoteservice.h>
+#include <tqstringlist.h>
+
+
+class TQCString;
+using namespace TDEIO;
+using namespace DNSSD;
+
+enum UrlType { RootDir, ServiceDir, Service, HelperProtocol, Invalid };
+
+class ZeroConfProtocol : public TQObject, public TDEIO::SlaveBase
+{
+ Q_OBJECT
+
+public:
+ ZeroConfProtocol(const TQCString& protocol, const TQCString &pool_socket, const TQCString &app_socket);
+ ~ZeroConfProtocol();
+ virtual void get(const KURL& url);
+ virtual void mimetype(const KURL& url);
+ virtual void stat(const KURL& url);
+ virtual void listDir(const KURL& url );
+private:
+ // Create UDSEntry for zeroconf:/ or zeroconf:/type/ paths
+ void buildDirEntry(UDSEntry& entry,const TQString& name,const TQString& type=TQString(),
+ const TQString& host=TQString());
+ // Create UDSEntry for single services: dnssd:/type/service
+ void buildServiceEntry(UDSEntry& entry,const TQString& name,const TQString& type,
+ const TQString& domain);
+ // Returns root dir, service dir, service or invalid
+ UrlType checkURL(const KURL& url);
+ // extract name, type and domain from URL
+ void dissect(const KURL& url,TQString& name,TQString& type,TQString& domain);
+ // resolve given service and redirect() to it or use KRun on it (used for helper protocols)
+ void resolveAndRedirect(const KURL& url, bool useKRun = false);
+ bool dnssdOK();
+ TQString getAttribute(const TQString& name);
+ TQString getProtocol(const TQString& type);
+ // try to load config file for given service type (or just return if already loaded)
+ bool setConfig(const TQString& type);
+
+ ServiceBrowser* browser;
+ // service types merged from all domains - to avoid duplicates
+ TQStringList mergedtypes;
+ // last resolved or still being resolved services - acts as one-entry cache
+ RemoteService *toResolve;
+ // Config file for service - also acts as one-entry cache
+ TDEConfig *configData;
+ // listDir for all domains (zeroconf:/) or one specified (zeroconf://domain/)
+ bool allDomains;
+private slots:
+ void newType(DNSSD::RemoteService::Ptr);
+ void newService(DNSSD::RemoteService::Ptr);
+ void allReported();
+
+};
+
+#endif