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 "jingle/notifier/base/chrome_async_socket.h" | 5 #include "jingle/notifier/base/chrome_async_socket.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 bool has_pending_read_; | 94 bool has_pending_read_; |
95 | 95 |
96 std::deque<net::MockWrite> writes_; | 96 std::deque<net::MockWrite> writes_; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(AsyncSocketDataProvider); | 98 DISALLOW_COPY_AND_ASSIGN(AsyncSocketDataProvider); |
99 }; | 99 }; |
100 | 100 |
101 // Takes a 32-bit integer in host byte order and converts it to a | 101 // Takes a 32-bit integer in host byte order and converts it to a |
102 // net::IPAddressNumber. | 102 // net::IPAddressNumber. |
103 net::IPAddressNumber Uint32ToIPAddressNumber(uint32 ip) { | 103 net::IPAddressNumber Uint32ToIPAddressNumber(uint32 ip) { |
104 uint32 ip_nbo = htonl(ip); | 104 uint32 ip_nbo = base::HostToNet32(ip); |
105 const unsigned char* const ip_start = | 105 const unsigned char* const ip_start = |
106 reinterpret_cast<const unsigned char*>(&ip_nbo); | 106 reinterpret_cast<const unsigned char*>(&ip_nbo); |
107 return net::IPAddressNumber(ip_start, ip_start + (sizeof ip_nbo)); | 107 return net::IPAddressNumber(ip_start, ip_start + (sizeof ip_nbo)); |
108 } | 108 } |
109 | 109 |
110 net::AddressList SocketAddressToAddressList( | 110 net::AddressList SocketAddressToAddressList( |
111 const talk_base::SocketAddress& address) { | 111 const talk_base::SocketAddress& address) { |
112 DCHECK_NE(address.ip(), 0U); | 112 DCHECK_NE(address.ip(), 0U); |
113 return net::AddressList::CreateFromIPAddress( | 113 return net::AddressList::CreateFromIPAddress( |
114 Uint32ToIPAddressNumber(address.ip()), address.port()); | 114 Uint32ToIPAddressNumber(address.ip()), address.port()); |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 message_loop_.RunAllPending(); | 1067 message_loop_.RunAllPending(); |
1068 | 1068 |
1069 ExpectNoSignal(); | 1069 ExpectNoSignal(); |
1070 | 1070 |
1071 DoSSLCloseOpenedNoError(); | 1071 DoSSLCloseOpenedNoError(); |
1072 } | 1072 } |
1073 | 1073 |
1074 } // namespace | 1074 } // namespace |
1075 | 1075 |
1076 } // namespace notifier | 1076 } // namespace notifier |
OLD | NEW |