]> git.tdb.fi Git - netvis.git/blob - source/resolver.h
Support IPv6
[netvis.git] / source / resolver.h
1 /* $Id$
2
3 This file is part of NetVis
4 Copyright @ 2008 Mikko Rasa, Mikkosoft Productions
5 Distributed unter the GPL
6 */
7
8 #ifndef RESOLVER_H_
9 #define RESOLVER_H_
10
11 #include <list>
12 #include <msp/core/mutex.h>
13 #include <msp/core/thread.h>
14
15 class Host;
16
17 class Resolver: public Msp::Thread
18 {
19 private:
20         struct Result
21         {
22                 Host *host;
23                 std::string name;
24
25                 Result(Host *h, const std::string &n): host(h), name(n) { }
26         };
27
28         std::list<Host *> in_queue;
29         std::list<Result> out_queue;
30         Host *current;
31         Msp::Mutex mutex;
32         bool done;
33
34 public:
35         Resolver();
36         ~Resolver();
37
38         void push(Host *);
39         void cancel(Host *);
40         void tick();
41 private:
42         void main();
43 };
44
45 #endif