| 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 <vector> |
| 9 |
| 8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 9 #include "ppapi/c/pp_stdint.h" | 11 #include "ppapi/c/pp_stdint.h" |
| 10 #include "ppapi/shared_impl/ppapi_shared_export.h" | 12 #include "ppapi/shared_impl/ppapi_shared_export.h" |
| 11 | 13 |
| 12 struct PP_NetAddress_Private; | 14 struct PP_NetAddress_Private; |
| 13 struct sockaddr; | 15 struct sockaddr; |
| 14 | 16 |
| 15 namespace net { | |
| 16 class AddressList; | |
| 17 class IPEndPoint; | |
| 18 } | |
| 19 | |
| 20 namespace ppapi { | 17 namespace ppapi { |
| 21 | 18 |
| 22 class PPAPI_SHARED_EXPORT NetAddressPrivateImpl { | 19 class PPAPI_SHARED_EXPORT NetAddressPrivateImpl { |
| 23 public: | 20 public: |
| 24 static bool ValidateNetAddress(const PP_NetAddress_Private& addr); | 21 static bool ValidateNetAddress(const PP_NetAddress_Private& addr); |
| 25 | 22 |
| 26 static bool SockaddrToNetAddress(const sockaddr* sa, | 23 static bool SockaddrToNetAddress(const sockaddr* sa, |
| 27 uint32_t sa_length, | 24 uint32_t sa_length, |
| 28 PP_NetAddress_Private* net_addr); | 25 PP_NetAddress_Private* net_addr); |
| 29 | 26 |
| 30 static bool IPEndPointToNetAddress(const net::IPEndPoint& ip, | 27 static bool IPEndPointToNetAddress(const std::vector<unsigned char>& address, |
| 28 int port, |
| 31 PP_NetAddress_Private* net_addr); | 29 PP_NetAddress_Private* net_addr); |
| 32 | 30 |
| 33 // Converts the first address to a PP_NetAddress_Private. | |
| 34 static bool AddressListToNetAddress(const net::AddressList& address_list, | |
| 35 PP_NetAddress_Private* net_addr); | |
| 36 | |
| 37 static bool NetAddressToIPEndPoint(const PP_NetAddress_Private& net_addr, | 31 static bool NetAddressToIPEndPoint(const PP_NetAddress_Private& net_addr, |
| 38 net::IPEndPoint* ip_end_point); | 32 std::vector<unsigned char>* address, |
| 39 | 33 int* port); |
| 40 static bool NetAddressToAddressList(const PP_NetAddress_Private& net_addr, | |
| 41 net::AddressList* address_list); | |
| 42 | 34 |
| 43 static const PP_NetAddress_Private kInvalidNetAddress; | 35 static const PP_NetAddress_Private kInvalidNetAddress; |
| 44 | 36 |
| 45 private: | 37 private: |
| 46 DISALLOW_IMPLICIT_CONSTRUCTORS(NetAddressPrivateImpl); | 38 DISALLOW_IMPLICIT_CONSTRUCTORS(NetAddressPrivateImpl); |
| 47 }; | 39 }; |
| 48 | 40 |
| 49 } // namespace ppapi | 41 } // namespace ppapi |
| 50 | 42 |
| 51 #endif // PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_ | 43 #endif // PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_ |
| OLD | NEW |