Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: ppapi/shared_impl/private/net_address_private_impl.cc

Issue 704133005: Pepper: Add support for multicast in PPB_UDPSocket API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Properly check for permissions, restore check for API version 1.2 so all trybots are happy Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698