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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 return net_addr; | 126 return net_addr; |
127 } | 127 } |
128 | 128 |
129 bool IsValid(const NetAddress* net_addr) { | 129 bool IsValid(const NetAddress* net_addr) { |
130 return net_addr && net_addr->is_valid; | 130 return net_addr && net_addr->is_valid; |
131 } | 131 } |
132 | 132 |
133 PP_NetAddressFamily_Private GetFamily(const PP_NetAddress_Private* addr) { | 133 PP_NetAddressFamily_Private GetFamily(const PP_NetAddress_Private* addr) { |
134 const NetAddress* net_addr = ToNetAddress(addr); | 134 const NetAddress* net_addr = ToNetAddress(addr); |
135 if (!IsValid(net_addr)) | 135 if (!IsValid(net_addr)) |
136 return PP_NETADDRESSFAMILY_UNSPECIFIED; | 136 return PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED; |
137 return net_addr->is_ipv6 ? | 137 return net_addr->is_ipv6 ? |
138 PP_NETADDRESSFAMILY_IPV6 : PP_NETADDRESSFAMILY_IPV4; | 138 PP_NETADDRESSFAMILY_PRIVATE_IPV6 : PP_NETADDRESSFAMILY_PRIVATE_IPV4; |
139 } | 139 } |
140 | 140 |
141 uint16_t GetPort(const PP_NetAddress_Private* addr) { | 141 uint16_t GetPort(const PP_NetAddress_Private* addr) { |
142 const NetAddress* net_addr = ToNetAddress(addr); | 142 const NetAddress* net_addr = ToNetAddress(addr); |
143 if (!IsValid(net_addr)) | 143 if (!IsValid(net_addr)) |
144 return 0; | 144 return 0; |
145 return net_addr->port; | 145 return net_addr->port; |
146 } | 146 } |
147 | 147 |
148 PP_Bool GetAddress(const PP_NetAddress_Private* addr, | 148 PP_Bool GetAddress(const PP_NetAddress_Private* addr, |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 ipv6_addr->port = ConvertToNetEndian16(net_addr->port); | 577 ipv6_addr->port = ConvertToNetEndian16(net_addr->port); |
578 | 578 |
579 COMPILE_ASSERT(sizeof(ipv6_addr->addr) == kIPv6AddressSize, | 579 COMPILE_ASSERT(sizeof(ipv6_addr->addr) == kIPv6AddressSize, |
580 mismatched_IPv6_address_size); | 580 mismatched_IPv6_address_size); |
581 memcpy(ipv6_addr->addr, net_addr->address, kIPv6AddressSize); | 581 memcpy(ipv6_addr->addr, net_addr->address, kIPv6AddressSize); |
582 | 582 |
583 return true; | 583 return true; |
584 } | 584 } |
585 | 585 |
586 } // namespace ppapi | 586 } // namespace ppapi |
OLD | NEW |