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 <tqobject.h> 00025 #include <tqsocketnotifier.h> 00026 #include <tqsignal.h> 00027 #include <config.h> 00028 #ifdef HAVE_DNSSD 00029 #include <avahi-client/client.h> 00030 #else 00031 #define DNSServiceRef void* 00032 #define AvahiClientState void* 00033 #endif 00034 00035 namespace DNSSD 00036 { 00037 00044 class Responder : public TQObject 00045 { 00046 Q_OBJECT 00047 00048 public: 00049 Responder(); 00050 00051 ~Responder(); 00052 00053 static Responder& self(); 00054 #ifdef HAVE_DNSSD 00055 AvahiClientState state() const; 00056 AvahiClient* client() const { return m_client; } 00057 #endif 00058 void process(); 00059 signals: 00060 void stateChanged(AvahiClientState); 00061 private: 00062 #ifdef HAVE_DNSSD 00063 AvahiClient* m_client; 00064 #endif 00065 static Responder* m_self; 00066 #ifdef HAVE_DNSSD 00067 friend void client_callback(AvahiClient*, AvahiClientState, void*); 00068 #endif 00069 00070 }; 00071 00072 /* Utils functions */ 00073 00074 bool domainIsLocal(const TQString& domain); 00075 // Encodes domain name using utf8() or IDN 00076 TQCString domainToDNS(const TQString &domain); 00077 TQString DNSToDomain(const char* domain); 00078 00079 00080 } 00081 00082 #endif