+wxString wxIPV6address::IPAddress() const
+{
+ unsigned char addr[16];
+ GAddress_INET6_GetHostAddress(m_address,(in6_addr*)addr);
+
+ wxUint16 words[8];
+ int i,
+ prefix_zero_count = 0;
+ for ( i = 0; i < 8; ++i )
+ {
+ words[i] = addr[i*2];
+ words[i] <<= 8;
+ words[i] |= addr[i*2+1];
+ if ( i == prefix_zero_count && words[i] == 0 )
+ ++prefix_zero_count;
+ }
+
+ wxString result;
+ if ( prefix_zero_count == 8 )
+ {
+ result = wxT( "::" );
+ }
+ else if ( prefix_zero_count == 6 && words[5] == 0xFFFF )
+ {
+ // IPv4 mapped
+ result.Printf("::ffff:%d.%d.%d.%d",
+ addr[12], addr[13], addr[14], addr[15]);
+ }
+ else // general case
+ {
+ result = ":";
+ for ( i = prefix_zero_count; i < 8; ++i )
+ {
+ result += wxString::Format(":%x", words[i]);
+ }
+ }
+
+ return result;
+}
+
+wxString wxIPV6address::Hostname() const
+{
+ char hostname[1024];
+ hostname[0] = 0;