Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_ |
| 6 #define PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_ | 6 #define PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | |
| 11 | 10 |
| 11 #include "base/containers/stack_container.h" | |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "net/base/ip_address.h" | |
| 13 #include "ppapi/c/pp_stdint.h" | 14 #include "ppapi/c/pp_stdint.h" |
| 14 #include "ppapi/c/ppb_net_address.h" | 15 #include "ppapi/c/ppb_net_address.h" |
| 15 #include "ppapi/shared_impl/ppapi_shared_export.h" | 16 #include "ppapi/shared_impl/ppapi_shared_export.h" |
| 16 | 17 |
| 17 struct PP_NetAddress_Private; | 18 struct PP_NetAddress_Private; |
| 18 struct sockaddr; | 19 struct sockaddr; |
| 19 | 20 |
| 20 namespace ppapi { | 21 namespace ppapi { |
| 21 | 22 |
| 22 class PPAPI_SHARED_EXPORT NetAddressPrivateImpl { | 23 class PPAPI_SHARED_EXPORT NetAddressPrivateImpl { |
| 23 public: | 24 public: |
| 24 static bool ValidateNetAddress(const PP_NetAddress_Private& addr); | 25 static bool ValidateNetAddress(const PP_NetAddress_Private& addr); |
| 25 | 26 |
| 26 static bool SockaddrToNetAddress(const sockaddr* sa, | 27 static bool SockaddrToNetAddress(const sockaddr* sa, |
| 27 uint32_t sa_length, | 28 uint32_t sa_length, |
| 28 PP_NetAddress_Private* net_addr); | 29 PP_NetAddress_Private* net_addr); |
| 29 | 30 |
| 30 static bool IPEndPointToNetAddress(const std::vector<uint8_t>& address, | 31 static bool IPEndPointToNetAddress( |
| 31 uint16_t port, | 32 const net::IPAddress::IPAddressBytes& address, |
| 32 PP_NetAddress_Private* net_addr); | 33 uint16_t port, |
| 34 PP_NetAddress_Private* net_addr); | |
| 33 | 35 |
| 34 static bool NetAddressToIPEndPoint(const PP_NetAddress_Private& net_addr, | 36 static bool NetAddressToIPEndPoint(const PP_NetAddress_Private& net_addr, |
| 35 std::vector<uint8_t>* address, | 37 base::StackVector<uint8_t, 16>* address, |
|
eroman
2017/05/19 22:00:07
Can this be changed to a IPAddressBytes? That woul
Ryan Hamilton
2017/05/20 03:21:44
Done.
| |
| 36 uint16_t* port); | 38 uint16_t* port); |
| 37 | 39 |
| 38 static std::string DescribeNetAddress(const PP_NetAddress_Private& addr, | 40 static std::string DescribeNetAddress(const PP_NetAddress_Private& addr, |
| 39 bool include_port); | 41 bool include_port); |
| 40 | 42 |
| 41 static void GetAnyAddress(PP_Bool is_ipv6, PP_NetAddress_Private* addr); | 43 static void GetAnyAddress(PP_Bool is_ipv6, PP_NetAddress_Private* addr); |
| 42 | 44 |
| 43 // Conversion methods to make PPB_NetAddress resource work with | 45 // Conversion methods to make PPB_NetAddress resource work with |
| 44 // PP_NetAddress_Private. | 46 // PP_NetAddress_Private. |
| 45 // TODO(yzshen): Remove them once PPB_NetAddress resource doesn't use | 47 // TODO(yzshen): Remove them once PPB_NetAddress resource doesn't use |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 61 | 63 |
| 62 static const PP_NetAddress_Private kInvalidNetAddress; | 64 static const PP_NetAddress_Private kInvalidNetAddress; |
| 63 | 65 |
| 64 private: | 66 private: |
| 65 DISALLOW_IMPLICIT_CONSTRUCTORS(NetAddressPrivateImpl); | 67 DISALLOW_IMPLICIT_CONSTRUCTORS(NetAddressPrivateImpl); |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 } // namespace ppapi | 70 } // namespace ppapi |
| 69 | 71 |
| 70 #endif // PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_ | 72 #endif // PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_ |
| OLD | NEW |