]> git.tdb.fi Git - libs/net.git/blobdiff - source/inet6.h
Add IPv6 support
[libs/net.git] / source / inet6.h
diff --git a/source/inet6.h b/source/inet6.h
new file mode 100644 (file)
index 0000000..02ec450
--- /dev/null
@@ -0,0 +1,49 @@
+/* $Id$
+
+This file is part of libmspnet
+Copyright © 2011  Mikkosoft Productions, Mikko Rasa
+Distributed under the LGPL
+*/
+
+#ifndef MSP_NET_INET6_H_
+#define NSP_NET_INET6_H_
+
+#ifdef WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#else
+#include <netinet/in.h>
+#endif
+#include "sockaddr.h"
+
+namespace Msp {
+namespace Net {
+
+class Inet6Addr: public SockAddr
+{
+private:
+#ifdef WIN32
+       typedef u_short in_port_t;
+#endif
+
+       in6_addr addr;
+       in_port_t port;
+
+public:
+       Inet6Addr();
+       Inet6Addr(const sockaddr_in6 &);
+       Inet6Addr(unsigned char [16], in_port_t);
+
+       virtual Family get_family() const { return INET6; }
+       virtual std::string str() const;
+
+       virtual unsigned fill_sockaddr(sockaddr &) const;
+       virtual unsigned fill_sockaddr(sockaddr_storage &) const;
+
+       virtual Inet6Addr *copy() const { return new Inet6Addr(*this); }
+};
+
+} // namespace Net
+} // namespace Msp
+
+#endif