| 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 "remoting/client/plugin/pepper_util.h" | 5 #include "remoting/client/plugin/pepper_util.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/sys_byteorder.h" | 9 #include "base/sys_byteorder.h" |
| 10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 address.port()); | 51 address.port()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void PpNetAddressToSocketAddress(const pp::NetAddress& pp_net_address, | 54 void PpNetAddressToSocketAddress(const pp::NetAddress& pp_net_address, |
| 55 talk_base::SocketAddress* address) { | 55 talk_base::SocketAddress* address) { |
| 56 switch (pp_net_address.GetFamily()) { | 56 switch (pp_net_address.GetFamily()) { |
| 57 case PP_NETADDRESS_FAMILY_IPV4: { | 57 case PP_NETADDRESS_FAMILY_IPV4: { |
| 58 PP_NetAddress_IPv4 ipv4_addr; | 58 PP_NetAddress_IPv4 ipv4_addr; |
| 59 CHECK(pp_net_address.DescribeAsIPv4Address(&ipv4_addr)); | 59 CHECK(pp_net_address.DescribeAsIPv4Address(&ipv4_addr)); |
| 60 address->SetIP(talk_base::IPAddress( | 60 address->SetIP(talk_base::IPAddress( |
| 61 *reinterpret_cast<in_addr*>(&ipv4_addr.addr))); | 61 bit_cast<in_addr>(ipv4_addr.addr))); |
| 62 address->SetPort(base::NetToHost16(ipv4_addr.port)); | 62 address->SetPort(base::NetToHost16(ipv4_addr.port)); |
| 63 return; | 63 return; |
| 64 } | 64 } |
| 65 case PP_NETADDRESS_FAMILY_IPV6: { | 65 case PP_NETADDRESS_FAMILY_IPV6: { |
| 66 PP_NetAddress_IPv6 ipv6_addr; | 66 PP_NetAddress_IPv6 ipv6_addr; |
| 67 CHECK(pp_net_address.DescribeAsIPv6Address(&ipv6_addr)); | 67 CHECK(pp_net_address.DescribeAsIPv6Address(&ipv6_addr)); |
| 68 address->SetIP(talk_base::IPAddress( | 68 address->SetIP(talk_base::IPAddress( |
| 69 *reinterpret_cast<in6_addr*>(&ipv6_addr.addr))); | 69 bit_cast<in6_addr>(ipv6_addr.addr))); |
| 70 address->SetPort(base::NetToHost16(ipv6_addr.port)); | 70 address->SetPort(base::NetToHost16(ipv6_addr.port)); |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 case PP_NETADDRESS_FAMILY_UNSPECIFIED: { | 73 case PP_NETADDRESS_FAMILY_UNSPECIFIED: { |
| 74 break; | 74 break; |
| 75 } | 75 } |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 NOTREACHED(); | 78 NOTREACHED(); |
| 79 address->Clear(); | 79 address->Clear(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace remoting | 82 } // namespace remoting |
| OLD | NEW |