ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/HostUpdate/Host.hpp
Revision: 50
Committed: 2003-12-12T14:10:27-08:00 (21 years, 6 months ago) by Douglas Thrift
File size: 1399 byte(s)
Log Message:
Blorg!

File Contents

# User Rev Content
1 Douglas Thrift 11 // Host Update
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7 Douglas Thrift 12 #ifndef _Host_hpp_
8     #define _Host_hpp_
9 Douglas Thrift 11
10     #include "HostUpdate.hpp"
11    
12     #ifndef _WIN32
13    
14     #include <sys/socket.h>
15     #include <netdb.h>
16 Douglas Thrift 14 #include <netinet/in.h>
17     #include <arpa/inet.h>
18 Douglas Thrift 11
19     #else
20    
21 Douglas Thrift 50 #include <winsock2.h>
22 Douglas Thrift 11
23     typedef unsigned long in_addr_t;
24    
25     #endif
26    
27     class Host
28     {
29     private:
30     #ifdef _WIN32
31     static unsigned count;
32     static WSADATA data;
33     #endif
34     string host;
35     string name;
36 Douglas Thrift 15 struct in_addr address;
37 Douglas Thrift 12 string platform;
38 Douglas Thrift 11 public:
39 Douglas Thrift 12 Host(const string& host, const string& name = "", const string& address =
40     "", const string& platform = "Unknown");
41 Douglas Thrift 11 ~Host();
42     void setHost(const string& host) { this->host = host; }
43     void setName(const string& name, bool lookup = false);
44     void setAddress(const string& address, bool lookup = false);
45 Douglas Thrift 12 void setPlatform(const string& platform) { this->platform = platform; }
46 Douglas Thrift 11 string getHost() const { return host; }
47     string getName() const { return name; }
48 Douglas Thrift 15 string getAddress() const { return inet_ntoa(address); }
49 Douglas Thrift 12 string getPlatform() const { return platform; }
50 Douglas Thrift 13 bool operator==(const Host& host) const;
51     bool operator!=(const Host& host) const { return !(*this == host); }
52     bool operator<(const Host& host) const { return this->host < host.host; }
53     bool operator>(const Host& host) const { return this->host > host.host; }
54     Host operator++();
55     Host operator++(int);
56     Host operator--();
57     Host operator--(int);
58 Douglas Thrift 11 };
59    
60 Douglas Thrift 12 #endif // _Host_hpp_

Properties

Name Value
svn:eol-style native
svn:keywords Id