KDECore
k3resolverstandardworkers_p.h
Go to the documentation of this file.
00001 /* -*- C++ -*- 00002 * Copyright (C) 2003,2005 Thiago Macieira <thiago@kde.org> 00003 * 00004 * 00005 * Permission is hereby granted, free of charge, to any person obtaining 00006 * a copy of this software and associated documentation files (the 00007 * "Software"), to deal in the Software without restriction, including 00008 * without limitation the rights to use, copy, modify, merge, publish, 00009 * distribute, sublicense, and/or sell copies of the Software, and to 00010 * permit persons to whom the Software is furnished to do so, subject to 00011 * the following conditions: 00012 * 00013 * The above copyright notice and this permission notice shall be included 00014 * in all copies or substantial portions of the Software. 00015 * 00016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00017 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00018 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00019 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00020 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00021 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00022 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00023 */ 00024 00025 #ifndef KRESOLVERSTANDARDWORKERS_P_H 00026 #define KRESOLVERSTANDARDWORKERS_P_H 00027 00028 #include <sys/types.h> 00029 #include <netdb.h> 00030 00031 #include <QList> 00032 #include <QByteArray> 00033 #include <QStringList> 00034 00035 #include "k3resolver.h" 00036 #include "k3resolverworkerbase.h" 00037 00038 #include <config.h> 00039 #include <config-network.h> 00040 00041 namespace KNetwork { namespace Internal 00042 { 00043 extern void initStandardWorkers() KDE_NO_EXPORT; 00044 00049 class KBlacklistWorker: public KNetwork::KResolverWorkerBase 00050 { 00051 public: 00052 static QStringList blacklist; 00053 00054 static void loadBlacklist(); 00055 static void init(); 00056 static bool isBlacklisted(const QString&); 00057 00058 virtual bool preprocess(); 00059 virtual bool run(); 00060 virtual bool postprocess() { return true; } 00061 }; 00062 00066 class KStandardWorker: public KNetwork::KResolverWorkerBase 00067 { 00068 protected: 00069 mutable QByteArray m_encodedName; 00070 quint16 port; 00071 int scopeid; 00072 QList<KNetwork::KResolverResults*> resultList; 00073 00074 public: 00075 virtual ~KStandardWorker(); 00076 bool sanityCheck(); 00077 00078 virtual bool preprocess(); 00079 virtual bool run(); 00080 virtual bool postprocess(); 00081 00082 bool resolveScopeId(); 00083 bool resolveService(); 00084 bool resolveNumerically(); 00085 00086 KNetwork::KResolver::ErrorCodes addUnix(); 00087 }; 00088 00089 #if defined(HAVE_GETADDRINFO) 00090 00095 class KGetAddrinfoWorker: public KStandardWorker 00096 { 00097 public: 00098 KGetAddrinfoWorker() 00099 { } 00100 00101 virtual ~KGetAddrinfoWorker(); 00102 virtual bool preprocess(); 00103 virtual bool run(); 00104 virtual bool postprocess() { return true; } 00105 00106 bool wantThis(int family); 00107 }; 00108 #endif // HAVE_GETADDRINFO 00109 00110 } } // namespace KNetwork::Internal 00111 00112 00113 #endif
KDE 4.6 API Reference