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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 PPAPI_THUNK_EXPORT const PPB_NetAddress_Private_1_1* | 389 PPAPI_THUNK_EXPORT const PPB_NetAddress_Private_1_1* |
390 GetPPB_NetAddress_Private_1_1_Thunk() { | 390 GetPPB_NetAddress_Private_1_1_Thunk() { |
391 return &net_address_private_interface_1_1; | 391 return &net_address_private_interface_1_1; |
392 } | 392 } |
393 | 393 |
394 } // namespace thunk | 394 } // namespace thunk |
395 | 395 |
396 // For the NaCl target, all we need are the API functions and the thunk. | 396 // For the NaCl target, all we need are the API functions and the thunk. |
397 #if !defined(OS_NACL) | 397 #if !defined(OS_NACL) |
398 // static | |
399 const PP_NetAddress_Private NetAddressPrivateImpl::kInvalidNetAddress = { 0 }; | |
400 | 398 |
401 // static | 399 // static |
402 bool NetAddressPrivateImpl::ValidateNetAddress( | 400 bool NetAddressPrivateImpl::ValidateNetAddress( |
403 const PP_NetAddress_Private& addr) { | 401 const PP_NetAddress_Private& addr) { |
404 return IsValid(ToNetAddress(&addr)); | 402 return IsValid(ToNetAddress(&addr)); |
405 } | 403 } |
406 | 404 |
407 // static | 405 // static |
408 bool NetAddressPrivateImpl::SockaddrToNetAddress( | 406 bool NetAddressPrivateImpl::SockaddrToNetAddress( |
409 const sockaddr* sa, | 407 const sockaddr* sa, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 // On Windows, |NetAddressToString()| doesn't work in the sandbox. On Mac, | 503 // On Windows, |NetAddressToString()| doesn't work in the sandbox. On Mac, |
506 // the output isn't consistent with RFC 5952, at least on Mac OS 10.6: | 504 // the output isn't consistent with RFC 5952, at least on Mac OS 10.6: |
507 // |getnameinfo()| collapses length-one runs of zeros (and also doesn't | 505 // |getnameinfo()| collapses length-one runs of zeros (and also doesn't |
508 // display the scope). | 506 // display the scope). |
509 if (net_addr->is_ipv6) | 507 if (net_addr->is_ipv6) |
510 return ConvertIPv6AddressToString(net_addr, include_port); | 508 return ConvertIPv6AddressToString(net_addr, include_port); |
511 return ConvertIPv4AddressToString(net_addr, include_port); | 509 return ConvertIPv4AddressToString(net_addr, include_port); |
512 } | 510 } |
513 | 511 |
514 } // namespace ppapi | 512 } // namespace ppapi |
OLD | NEW |