00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _SOCKETS_Ipv6Address_H
00024 #define _SOCKETS_Ipv6Address_H
00025 #include "sockets-config.h"
00026 #ifdef ENABLE_IPV6
00027
00028 #include "SocketAddress.h"
00029 #ifdef IPPROTO_IPV6
00030 #if defined( _WIN32) && !defined(__CYGWIN__)
00031 typedef unsigned __int32 uint32_t;
00032 #endif
00033
00034 #ifdef SOCKETS_NAMESPACE
00035 namespace SOCKETS_NAMESPACE {
00036 #endif
00037
00038
00041 class Ipv6Address : public SocketAddress
00042 {
00043 public:
00046 Ipv6Address(port_t port = 0);
00050 Ipv6Address(struct in6_addr& a,port_t port);
00054 Ipv6Address(const std::string& host,port_t port);
00055 Ipv6Address(struct sockaddr_in6&);
00056 ~Ipv6Address();
00057
00058
00059
00060 operator struct sockaddr *();
00061 operator socklen_t();
00062 bool operator==(SocketAddress&);
00063
00064 void SetPort(port_t port);
00065 port_t GetPort();
00066
00067 void SetAddress(struct sockaddr *sa);
00068 int GetFamily();
00069
00070 bool IsValid();
00071 std::auto_ptr<SocketAddress> GetCopy();
00072
00074 std::string Convert(bool include_port = false);
00075 std::string Reverse();
00076
00078 static bool Resolve(const std::string& hostname,struct in6_addr& a);
00080 static bool Reverse(struct in6_addr& a,std::string& name);
00082 static std::string Convert(struct in6_addr& a,bool mixed = false);
00083
00084 void SetFlowinfo(uint32_t);
00085 uint32_t GetFlowinfo();
00086 #ifndef _WIN32
00087 void SetScopeId(uint32_t);
00088 uint32_t GetScopeId();
00089 #endif
00090
00091 private:
00092 Ipv6Address(const Ipv6Address& ) {}
00093 Ipv6Address& operator=(const Ipv6Address& ) { return *this; }
00094 struct sockaddr_in6 m_addr;
00095 bool m_valid;
00096 };
00097
00098
00099
00100
00101 #ifdef SOCKETS_NAMESPACE
00102 }
00103 #endif
00104 #endif // IPPROTO_IPV6
00105 #endif // ENABLE_IPV6
00106 #endif // _SOCKETS_Ipv6Address_H