OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/shared_impl/private/net_address_private_impl.h" | 5 #include "ppapi/shared_impl/private/net_address_private_impl.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <winsock2.h> | 9 #include <winsock2.h> |
10 #include <ws2tcpip.h> | 10 #include <ws2tcpip.h> |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 // On Windows, |NetAddressToString()| doesn't work in the sandbox. On Mac, | 511 // On Windows, |NetAddressToString()| doesn't work in the sandbox. On Mac, |
512 // the output isn't consistent with RFC 5952, at least on Mac OS 10.6: | 512 // the output isn't consistent with RFC 5952, at least on Mac OS 10.6: |
513 // |getnameinfo()| collapses length-one runs of zeros (and also doesn't | 513 // |getnameinfo()| collapses length-one runs of zeros (and also doesn't |
514 // display the scope). | 514 // display the scope). |
515 if (net_addr->is_ipv6) | 515 if (net_addr->is_ipv6) |
516 return ConvertIPv6AddressToString(net_addr, include_port); | 516 return ConvertIPv6AddressToString(net_addr, include_port); |
517 return ConvertIPv4AddressToString(net_addr, include_port); | 517 return ConvertIPv4AddressToString(net_addr, include_port); |
518 } | 518 } |
519 | 519 |
520 // static | 520 // static |
| 521 void NetAddressPrivateImpl::GetAnyAddress(PP_Bool is_ipv6, |
| 522 PP_NetAddress_Private* addr) { |
| 523 ppapi::GetAnyAddress(is_ipv6, addr); |
| 524 } |
| 525 |
| 526 // static |
521 void NetAddressPrivateImpl::CreateNetAddressPrivateFromIPv4Address( | 527 void NetAddressPrivateImpl::CreateNetAddressPrivateFromIPv4Address( |
522 const PP_NetAddress_IPv4& ipv4_addr, | 528 const PP_NetAddress_IPv4& ipv4_addr, |
523 PP_NetAddress_Private* addr) { | 529 PP_NetAddress_Private* addr) { |
524 CreateFromIPv4Address(ipv4_addr.addr, ConvertFromNetEndian16(ipv4_addr.port), | 530 CreateFromIPv4Address(ipv4_addr.addr, ConvertFromNetEndian16(ipv4_addr.port), |
525 addr); | 531 addr); |
526 } | 532 } |
527 | 533 |
528 // static | 534 // static |
529 void NetAddressPrivateImpl::CreateNetAddressPrivateFromIPv6Address( | 535 void NetAddressPrivateImpl::CreateNetAddressPrivateFromIPv6Address( |
530 const PP_NetAddress_IPv6& ipv6_addr, | 536 const PP_NetAddress_IPv6& ipv6_addr, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 ipv6_addr->port = ConvertToNetEndian16(net_addr->port); | 583 ipv6_addr->port = ConvertToNetEndian16(net_addr->port); |
578 | 584 |
579 static_assert(sizeof(ipv6_addr->addr) == kIPv6AddressSize, | 585 static_assert(sizeof(ipv6_addr->addr) == kIPv6AddressSize, |
580 "mismatched IPv6 address size"); | 586 "mismatched IPv6 address size"); |
581 memcpy(ipv6_addr->addr, net_addr->address, kIPv6AddressSize); | 587 memcpy(ipv6_addr->addr, net_addr->address, kIPv6AddressSize); |
582 | 588 |
583 return true; | 589 return true; |
584 } | 590 } |
585 | 591 |
586 } // namespace ppapi | 592 } // namespace ppapi |
OLD | NEW |