]> git.tdb.fi Git - libs/net.git/blobdiff - source/inet.h
Add function to check if handshake is done
[libs/net.git] / source / inet.h
index 1092bc1a8372fbd6e473ebcb4b8007d1079efc52..be67dee56bd71db14c8fef146d6b487fa77c352c 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of libmspnet
-Copyright © 2008  Mikkosoft Productions, Mikko Rasa
+Copyright © 2008, 2011  Mikkosoft Productions, Mikko Rasa
 Distributed under the LGPL
 */
 
@@ -13,35 +13,36 @@ Distributed under the LGPL
 #else
 #include <netinet/in.h>
 #endif
-#include <string>
 #include "sockaddr.h"
 
 namespace Msp {
 namespace Net {
 
-#ifdef WIN32
-typedef u_long in_addr_t;
-typedef u_short in_port_t;
-#endif
-
 /**
 Address class for IPv4 sockets.
 */
 class InetAddr: public SockAddr
 {
+private:
+#ifdef WIN32
+       typedef u_long in_addr_t;
+       typedef u_short in_port_t;
+#endif
+
+       in_addr_t   addr;
+       in_port_t   port;
+
 public:
        InetAddr();
-       InetAddr(sockaddr_in &);
+       InetAddr(const sockaddr_in &);
        InetAddr(in_addr_t, in_port_t);
+
        Family      get_family() const { return INET; }
        in_addr_t   get_addr() const { return ntohl(addr); }
        in_port_t   get_port() const { return ntohs(port); }
        std::string str() const;
-       unsigned    fill_sockaddr(sockaddr &) const;
-       InetAddr    *copy() const { return new InetAddr(*this); }
-private:
-       in_addr_t   addr;
-       in_port_t   port;
+       virtual unsigned fill_sockaddr(sockaddr &) const;
+       virtual InetAddr *copy() const { return new InetAddr(*this); }
 };
 
 } // namespace Net