ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/HostUpdate/Host.hpp
Revision: 10
Committed: 2003-11-06T20:35:29-08:00 (21 years, 7 months ago) by Douglas Thrift
File size: 1047 byte(s)
Log Message:
Die!

File Contents

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