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