| 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 527 |
| 528 // static | 528 // static |
| 529 void NetAddressPrivateImpl::CreateNetAddressPrivateFromIPv6Address( | 529 void NetAddressPrivateImpl::CreateNetAddressPrivateFromIPv6Address( |
| 530 const PP_NetAddress_IPv6& ipv6_addr, | 530 const PP_NetAddress_IPv6& ipv6_addr, |
| 531 PP_NetAddress_Private* addr) { | 531 PP_NetAddress_Private* addr) { |
| 532 CreateFromIPv6Address(ipv6_addr.addr, 0, | 532 CreateFromIPv6Address(ipv6_addr.addr, 0, |
| 533 ConvertFromNetEndian16(ipv6_addr.port), addr); | 533 ConvertFromNetEndian16(ipv6_addr.port), addr); |
| 534 } | 534 } |
| 535 | 535 |
| 536 // static | 536 // static |
| 537 void NetAddressPrivateImpl::CreateNetAddressPrivateFromAnyAddress( |
| 538 PP_Bool is_ipv6, |
| 539 PP_NetAddress_Private* addr) { |
| 540 GetAnyAddress(is_ipv6, addr); |
| 541 } |
| 542 |
| 543 // static |
| 537 PP_NetAddress_Family NetAddressPrivateImpl::GetFamilyFromNetAddressPrivate( | 544 PP_NetAddress_Family NetAddressPrivateImpl::GetFamilyFromNetAddressPrivate( |
| 538 const PP_NetAddress_Private& addr) { | 545 const PP_NetAddress_Private& addr) { |
| 539 const NetAddress* net_addr = ToNetAddress(&addr); | 546 const NetAddress* net_addr = ToNetAddress(&addr); |
| 540 if (!IsValid(net_addr)) | 547 if (!IsValid(net_addr)) |
| 541 return PP_NETADDRESS_FAMILY_UNSPECIFIED; | 548 return PP_NETADDRESS_FAMILY_UNSPECIFIED; |
| 542 return net_addr->is_ipv6 ? PP_NETADDRESS_FAMILY_IPV6 : | 549 return net_addr->is_ipv6 ? PP_NETADDRESS_FAMILY_IPV6 : |
| 543 PP_NETADDRESS_FAMILY_IPV4; | 550 PP_NETADDRESS_FAMILY_IPV4; |
| 544 } | 551 } |
| 545 | 552 |
| 546 // static | 553 // static |
| (...skipping 30 matching lines...) Expand all Loading... |
| 577 ipv6_addr->port = ConvertToNetEndian16(net_addr->port); | 584 ipv6_addr->port = ConvertToNetEndian16(net_addr->port); |
| 578 | 585 |
| 579 static_assert(sizeof(ipv6_addr->addr) == kIPv6AddressSize, | 586 static_assert(sizeof(ipv6_addr->addr) == kIPv6AddressSize, |
| 580 "mismatched IPv6 address size"); | 587 "mismatched IPv6 address size"); |
| 581 memcpy(ipv6_addr->addr, net_addr->address, kIPv6AddressSize); | 588 memcpy(ipv6_addr->addr, net_addr->address, kIPv6AddressSize); |
| 582 | 589 |
| 583 return true; | 590 return true; |
| 584 } | 591 } |
| 585 | 592 |
| 586 } // namespace ppapi | 593 } // namespace ppapi |
| OLD | NEW |