DNSSD
responder.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2004 Jakub Stachowski <qbast@go2.pl> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef DNSSDRESPONDER_H 00022 #define DNSSDRESPONDER_H 00023 00024 #include <qobject.h> 00025 #include <qsocketnotifier.h> 00026 #include <qsignal.h> 00027 #include <config.h> 00028 #ifdef HAVE_DNSSD 00029 #include <dns_sd.h> 00030 #else 00031 #define DNSServiceRef void* 00032 #endif 00033 00034 namespace DNSSD 00035 { 00036 00043 class Responder : public QObject 00044 { 00045 Q_OBJECT 00046 00047 public: 00048 Responder(DNSServiceRef ref=0,QObject *parent = 0, const char *name = 0); 00049 00050 ~Responder(); 00051 00056 bool isRunning() const; 00057 void setRef(DNSServiceRef ref); 00058 void stop(); 00059 public slots: 00060 void process(); 00061 protected: 00062 DNSServiceRef m_ref; 00063 bool m_running; 00064 QSocketNotifier *m_socket; 00065 }; 00066 00067 /* Utils functions */ 00068 00069 bool domainIsLocal(const QString& domain); 00070 // Encodes domain name using utf8() or IDN 00071 QCString domainToDNS(const QString &domain); 00072 QString DNSToDomain(const char* domain); 00073 00074 } 00075 00076 #endif