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> | 10 #include <vector> |
11 | 11 |
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 std::vector<uint8_t>* address, |
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 |
(...skipping 18 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 |