예제 #1
0
 /// Create an IPv4-compatible IPv6 address.
 static address_v6 v4_compatible(const address_v4& addr)
 {
   address_v4::bytes_type v4_bytes = addr.to_bytes();
   bytes_type v6_bytes = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     v4_bytes[0], v4_bytes[1], v4_bytes[2], v4_bytes[3] } };
   return address_v6(v6_bytes);
 }
예제 #2
0
 /// Create an IPv4-mapped IPv6 address.
 static address_v6 v4_mapped(const address_v4& addr)
 {
   address_v4::bytes_type v4_bytes = addr.to_bytes();
   bytes_type v6_bytes = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF,
     v4_bytes[0], v4_bytes[1], v4_bytes[2], v4_bytes[3] } };
   return address_v6(v6_bytes);
 }