]> git.tdb.fi Git - netvis.git/blob - source/resolver.h
Resolve IP addresses to hostnames
[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         Msp::Mutex mutex;
31         bool done;
32
33 public:
34         Resolver();
35         ~Resolver();
36
37         void push(Host *);
38         void tick();
39 private:
40         void main();
41 };
42
43 #endif