fix logic
[personal-kdelibs.git] / kdecore / network / k3resolverstandardworkers_p.h
blob57f7d1bd177c3292eae214160dd9c7f8671213ce
1 /* -*- C++ -*-
2 * Copyright (C) 2003,2005 Thiago Macieira <thiago@kde.org>
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef KRESOLVERSTANDARDWORKERS_P_H
26 #define KRESOLVERSTANDARDWORKERS_P_H
28 #include <sys/types.h>
29 #include <netdb.h>
31 #include <QList>
32 #include <QByteArray>
33 #include <QStringList>
35 #include "k3resolver.h"
36 #include "k3resolverworkerbase.h"
38 #include <config.h>
39 #include <config-network.h>
41 namespace KNetwork { namespace Internal
43 extern void initStandardWorkers() KDE_NO_EXPORT;
45 /**
46 * @internal
47 * The blacklist worker.
49 class KBlacklistWorker: public KNetwork::KResolverWorkerBase
51 public:
52 static QStringList blacklist;
54 static void loadBlacklist();
55 static void init();
56 static bool isBlacklisted(const QString&);
58 virtual bool preprocess();
59 virtual bool run();
60 virtual bool postprocess() { return true; }
63 /** @internal
64 * Standard worker.
66 class KStandardWorker: public KNetwork::KResolverWorkerBase
68 protected:
69 mutable QByteArray m_encodedName;
70 quint16 port;
71 int scopeid;
72 QList<KNetwork::KResolverResults*> resultList;
74 public:
75 virtual ~KStandardWorker();
76 bool sanityCheck();
78 virtual bool preprocess();
79 virtual bool run();
80 virtual bool postprocess();
82 bool resolveScopeId();
83 bool resolveService();
84 bool resolveNumerically();
86 KNetwork::KResolver::ErrorCodes addUnix();
89 #if defined(HAVE_GETADDRINFO)
90 /** @internal
91 * Worker class based on getaddrinfo(3).
93 * This class does not do post-processing.
95 class KGetAddrinfoWorker: public KStandardWorker
97 public:
98 KGetAddrinfoWorker()
99 { }
101 virtual ~KGetAddrinfoWorker();
102 virtual bool preprocess();
103 virtual bool run();
104 virtual bool postprocess() { return true; }
106 bool wantThis(int family);
108 #endif // HAVE_GETADDRINFO
110 } } // namespace KNetwork::Internal
113 #endif