4 |
|
// |
5 |
|
// $Id$ |
6 |
|
|
7 |
< |
#ifndef _Host_h_ |
8 |
< |
#define _Host_h_ |
7 |
> |
#ifndef _Host_hpp_ |
8 |
> |
#define _Host_hpp_ |
9 |
|
|
10 |
|
#include "HostUpdate.hpp" |
11 |
|
|
12 |
|
#ifndef _WIN32 |
13 |
|
|
14 |
– |
#include <sys/types.h> |
14 |
|
#include <sys/socket.h> |
15 |
|
#include <netdb.h> |
16 |
+ |
#include <netinet/in.h> |
17 |
+ |
#include <arpa/inet.h> |
18 |
|
|
19 |
|
#else |
20 |
|
|
34 |
|
#endif |
35 |
|
string host; |
36 |
|
string name; |
37 |
< |
struct in_addr* address; |
37 |
> |
struct in_addr address; |
38 |
> |
string platform; |
39 |
|
public: |
40 |
< |
Host(const string& host = "", const string& name = "", |
41 |
< |
const string& address = ""); |
40 |
> |
Host(const string& host, const string& name = "", const string& address = |
41 |
> |
"", const string& platform = "Unknown"); |
42 |
|
~Host(); |
43 |
|
void setHost(const string& host) { this->host = host; } |
44 |
|
void setName(const string& name, bool lookup = false); |
45 |
|
void setAddress(const string& address, bool lookup = false); |
46 |
+ |
void setPlatform(const string& platform) { this->platform = platform; } |
47 |
|
string getHost() const { return host; } |
48 |
|
string getName() const { return name; } |
49 |
< |
string getAddress() const { return inet_ntoa(*address); } |
50 |
< |
void operator++(); |
51 |
< |
void operator++(int) { operator++(); } |
52 |
< |
void operator--(); |
53 |
< |
void operator--(int) { operator++(); } |
49 |
> |
string getAddress() const { return inet_ntoa(address); } |
50 |
> |
string getPlatform() const { return platform; } |
51 |
> |
bool operator==(const Host& host) const; |
52 |
> |
bool operator!=(const Host& host) const { return !(*this == host); } |
53 |
> |
bool operator<(const Host& host) const { return this->host < host.host; } |
54 |
> |
bool operator>(const Host& host) const { return this->host > host.host; } |
55 |
> |
Host operator++(); |
56 |
> |
Host operator++(int); |
57 |
> |
Host operator--(); |
58 |
> |
Host operator--(int); |
59 |
|
}; |
60 |
|
|
61 |
< |
#endif // _Host_h_ |
61 |
> |
#endif // _Host_hpp_ |