ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/HostUpdate/Host.hpp
(Generate patch)

Comparing HostUpdate/Host.hpp (file contents):
Revision 11 by Douglas Thrift, 2003-11-06T20:37:52-08:00 vs.
Revision 900 by douglas, 2007-04-29T02:26:40-07:00

# Line 4 | Line 4
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  
21 < #include <Winsock2.h>
21 < #include <Ws2tcpip.h>
21 > #include <winsock2.h>
22  
23   typedef unsigned long in_addr_t;
24  
# Line 31 | Line 31 | private:
31          static unsigned count;
32          static WSADATA data;
33   #endif
34 <        string host;
35 <        string name;
36 <        struct in_addr* address;
34 >        std::string host;
35 >        std::string name;
36 >        struct ::in_addr address;
37 >        std::string platform;
38   public:
39 <        Host(const string& host = "", const string& name = "",
39 <                const string& address = "");
39 >        Host(const std::string& host, const std::string& name = "", const std::string& address = "", const std::string& platform = "Unknown");
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++(); }
41 >        void setHost(const std::string& host) { this->host = host; }
42 >        void setName(const std::string& name, bool lookup = false);
43 >        void setAddress(const std::string& address, bool lookup = false);
44 >        void setPlatform(const std::string& platform) { this->platform = platform; }
45 >        std::string getHost() const { return host; }
46 >        std::string getName() const { return name; }
47 >        std::string getAddress() const { return inet_ntoa(address); }
48 >        std::string getPlatform() const { return platform; }
49 >        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   };
58  
59 < #endif // _Host_h_
59 > #endif // _Host_hpp_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines