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

# Content
1 // 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
14 #include <sys/types.h>
15 #include <sys/socket.h>
16 #include <netdb.h>
17
18 #else
19
20 #include <Winsock2.h>
21 #include <Ws2tcpip.h>
22
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 struct in_addr* address;
37 public:
38 Host(const string& host = "", const string& name = "",
39 const string& address = "");
40 ~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 string getHost() const { return host; }
45 string getName() const { return name; }
46 string getAddress() const { return inet_ntoa(*address); }
47 void operator++();
48 void operator++(int) { operator++(); }
49 void operator--();
50 void operator--(int) { operator++(); }
51 };
52
53 #endif // _Host_h_