]> git.tdb.fi Git - netvis.git/blob - source/host.h
Handle ICMP packets
[netvis.git] / source / host.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 HOST_H_
9 #define HOST_H_
10
11 #include <map>
12 #include <string>
13 #include <msp/time/timedelta.h>
14 #include "activity.h"
15 #include "address.h"
16 #include "vector2.h"
17
18 class NetVis;
19
20 class Host
21 {
22 private:
23         NetVis &netvis;
24         Address addr;
25         std::string name;
26         std::string short_name;
27         bool local;
28         Vector2 pos;
29         bool active;
30         Activity activity;
31         float throttle;
32
33 public:
34         Host(NetVis &, const Address &);
35
36         const Address &get_address() const { return addr; }
37         void set_name(const std::string &);
38         const std::string &get_name() const { return name; }
39         void set_local(bool);
40         bool is_local() const { return local; }
41
42         void set_position(const Vector2 &);
43         const Vector2 &get_position() const { return pos; }
44
45         void set_active(bool);
46         bool get_active() const { return active; }
47         void add_activity(unsigned);
48         float get_activity() const { return activity.get_average(); }
49         float send_packet();
50
51         void tick(const Msp::Time::TimeDelta &);
52         void render() const;
53 };
54
55 #endif