Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: remoting/jingle_glue/ssl_socket_adapter.cc

Issue 10309002: Reimplements net::AddressList without struct addrinfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get_canonical_name -> canonical_name. iterator to indexing Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/shared_impl/private/ppb_host_resolver_shared.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "remoting/jingle_glue/ssl_socket_adapter.h" 5 #include "remoting/jingle_glue/ssl_socket_adapter.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "jingle/glue/utils.h" 10 #include "jingle/glue/utils.h"
11 #include "net/base/address_list.h" 11 #include "net/base/address_list.h"
12 #include "net/base/cert_verifier.h" 12 #include "net/base/cert_verifier.h"
13 #include "net/base/host_port_pair.h" 13 #include "net/base/host_port_pair.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/base/ssl_config_service.h" 15 #include "net/base/ssl_config_service.h"
16 #include "net/base/sys_addrinfo.h"
17 #include "net/socket/client_socket_factory.h" 16 #include "net/socket/client_socket_factory.h"
18 #include "net/url_request/url_request_context.h" 17 #include "net/url_request/url_request_context.h"
19 18
20 namespace remoting { 19 namespace remoting {
21 20
22 SSLSocketAdapter* SSLSocketAdapter::Create(AsyncSocket* socket) { 21 SSLSocketAdapter* SSLSocketAdapter::Create(AsyncSocket* socket) {
23 return new SSLSocketAdapter(socket); 22 return new SSLSocketAdapter(socket);
24 } 23 }
25 24
26 SSLSocketAdapter::SSLSocketAdapter(AsyncSocket* socket) 25 SSLSocketAdapter::SSLSocketAdapter(AsyncSocket* socket)
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 212 }
214 213
215 bool TransportSocket::IsConnectedAndIdle() const { 214 bool TransportSocket::IsConnectedAndIdle() const {
216 // Not implemented. 215 // Not implemented.
217 NOTREACHED(); 216 NOTREACHED();
218 return false; 217 return false;
219 } 218 }
220 219
221 int TransportSocket::GetPeerAddress(net::AddressList* address) const { 220 int TransportSocket::GetPeerAddress(net::AddressList* address) const {
222 talk_base::SocketAddress socket_address = socket_->GetRemoteAddress(); 221 talk_base::SocketAddress socket_address = socket_->GetRemoteAddress();
223 222 net::IPEndPoint endpoint;
224 // libjingle supports only IPv4 addresses. 223 if (jingle_glue::SocketAddressToIPEndPoint(socket_address, &endpoint)) {
225 sockaddr_in ipv4addr; 224 *address = net::AddressList(endpoint);
226 socket_address.ToSockAddr(&ipv4addr); 225 return net::OK;
227 226 } else {
228 struct addrinfo ai; 227 return net::ERR_FAILED;
229 memset(&ai, 0, sizeof(ai)); 228 }
230 ai.ai_family = ipv4addr.sin_family;
231 ai.ai_socktype = SOCK_STREAM;
232 ai.ai_protocol = IPPROTO_TCP;
233 ai.ai_addr = reinterpret_cast<struct sockaddr*>(&ipv4addr);
234 ai.ai_addrlen = sizeof(ipv4addr);
235
236 *address = net::AddressList::CreateByCopyingFirstAddress(&ai);
237 return net::OK;
238 } 229 }
239 230
240 int TransportSocket::GetLocalAddress(net::IPEndPoint* address) const { 231 int TransportSocket::GetLocalAddress(net::IPEndPoint* address) const {
241 talk_base::SocketAddress socket_address = socket_->GetLocalAddress(); 232 talk_base::SocketAddress socket_address = socket_->GetLocalAddress();
242 if (jingle_glue::SocketAddressToIPEndPoint(socket_address, address)) { 233 if (jingle_glue::SocketAddressToIPEndPoint(socket_address, address)) {
243 return net::OK; 234 return net::OK;
244 } else { 235 } else {
245 return net::ERR_FAILED; 236 return net::ERR_FAILED;
246 } 237 }
247 } 238 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 write_buffer_len_ = buffer_len; 368 write_buffer_len_ = buffer_len;
378 return; 369 return;
379 } 370 }
380 } 371 }
381 was_used_to_convey_data_ = true; 372 was_used_to_convey_data_ = true;
382 callback.Run(result); 373 callback.Run(result);
383 } 374 }
384 } 375 }
385 376
386 } // namespace remoting 377 } // namespace remoting
OLDNEW
« no previous file with comments | « ppapi/shared_impl/private/ppb_host_resolver_shared.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698