ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/HostUpdate/Host.hpp
Revision: 13
Committed: 2003-11-07T12:17:57-08:00 (21 years, 7 months ago) by Douglas Thrift
File size: 1376 byte(s)
Log Message:
Goodbye, cruel world, goodbye, cruel lamp...

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    
17     #else
18    
19     #include <Winsock2.h>
20     #include <Ws2tcpip.h>
21    
22     typedef unsigned long in_addr_t;
23    
24     #endif
25    
26     class Host
27     {
28     private:
29     #ifdef _WIN32
30     static unsigned count;
31     static WSADATA data;
32     #endif
33     string host;
34     string name;
35     struct in_addr* address;
36 Douglas Thrift 12 string platform;
37 Douglas Thrift 11 public:
38 Douglas Thrift 12 Host(const string& host, const string& name = "", const string& address =
39     "", const string& platform = "Unknown");
40 Douglas Thrift 11 ~Host();
41     void setHost(const string& host) { this->host = host; }
42     void setName(const string& name, bool lookup = false);
43     void setAddress(const string& address, bool lookup = false);
44 Douglas Thrift 12 void setPlatform(const string& platform) { this->platform = platform; }
45 Douglas Thrift 11 string getHost() const { return host; }
46     string getName() const { return name; }
47     string getAddress() const { return inet_ntoa(*address); }
48 Douglas Thrift 12 string getPlatform() const { return platform; }
49 Douglas Thrift 13 bool operator==(const Host& host) const;
50     bool operator!=(const Host& host) const { return !(*this == host); }
51     bool operator<(const Host& host) const { return this->host < host.host; }
52     bool operator>(const Host& host) const { return this->host > host.host; }
53     Host operator++();
54     Host operator++(int);
55     Host operator--();
56     Host operator--(int);
57 Douglas Thrift 11 };
58    
59 Douglas Thrift 12 #endif // _Host_hpp_

Properties

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