responder.h
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 00029 #include <avahi-client/client.h> 00030 namespace DNSSD 00031 { 00032 00039 class Responder : public QObject 00040 { 00041 Q_OBJECT 00042 00043 public: 00044 Responder(); 00045 00046 ~Responder(); 00047 00048 static Responder& self(); 00049 AvahiClientState state() const; 00050 AvahiClient* client() const { return m_client; } 00051 void process(); 00052 signals: 00053 void stateChanged(AvahiClientState); 00054 private: 00055 AvahiClient* m_client; 00056 static Responder* m_self; 00057 friend void client_callback(AvahiClient*, AvahiClientState, void*); 00058 00059 }; 00060 00061 /* Utils functions */ 00062 00063 bool domainIsLocal(const QString& domain); 00064 // Encodes domain name using utf8() or IDN 00065 QCString domainToDNS(const QString &domain); 00066 QString DNSToDomain(const char* domain); 00067 00068 00069 } 00070 00071 #endif