| 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 "content/renderer/p2p/ipc_socket_factory.h" | 5 #include "content/renderer/p2p/ipc_socket_factory.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 if (!socket->Init(P2P_SOCKET_UDP, socket_client, | 392 if (!socket->Init(P2P_SOCKET_UDP, socket_client, |
| 393 local_address, talk_base::SocketAddress())) { | 393 local_address, talk_base::SocketAddress())) { |
| 394 return NULL; | 394 return NULL; |
| 395 } | 395 } |
| 396 return socket.release(); | 396 return socket.release(); |
| 397 } | 397 } |
| 398 | 398 |
| 399 talk_base::AsyncPacketSocket* IpcPacketSocketFactory::CreateServerTcpSocket( | 399 talk_base::AsyncPacketSocket* IpcPacketSocketFactory::CreateServerTcpSocket( |
| 400 const talk_base::SocketAddress& local_address, int min_port, int max_port, | 400 const talk_base::SocketAddress& local_address, int min_port, int max_port, |
| 401 int opts) { | 401 int opts) { |
| 402 // TODO(sergeyu): Implement SSL support. | 402 P2PSocketType type; |
| 403 if (opts & talk_base::PacketSocketFactory::OPT_SSLTCP) | 403 if (opts & talk_base::PacketSocketFactory::OPT_SSLTCP) { |
| 404 return NULL; | 404 type = (opts & talk_base::PacketSocketFactory::OPT_STUN) ? |
| 405 | 405 P2P_SOCKET_STUN_SSLTCP_SERVER : P2P_SOCKET_SSLTCP_SERVER; |
| 406 P2PSocketType type = (opts & talk_base::PacketSocketFactory::OPT_STUN) ? | 406 } else { |
| 407 P2P_SOCKET_STUN_TCP_SERVER : P2P_SOCKET_TCP_SERVER; | 407 type = (opts & talk_base::PacketSocketFactory::OPT_STUN) ? |
| 408 P2P_SOCKET_STUN_TCP_SERVER : P2P_SOCKET_TCP_SERVER; |
| 409 } |
| 408 P2PSocketClient* socket_client = new P2PSocketClient(socket_dispatcher_); | 410 P2PSocketClient* socket_client = new P2PSocketClient(socket_dispatcher_); |
| 409 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); | 411 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); |
| 410 if (!socket->Init(type, socket_client, local_address, | 412 if (!socket->Init(type, socket_client, local_address, |
| 411 talk_base::SocketAddress())) { | 413 talk_base::SocketAddress())) { |
| 412 return NULL; | 414 return NULL; |
| 413 } | 415 } |
| 414 return socket.release(); | 416 return socket.release(); |
| 415 } | 417 } |
| 416 | 418 |
| 417 talk_base::AsyncPacketSocket* IpcPacketSocketFactory::CreateClientTcpSocket( | 419 talk_base::AsyncPacketSocket* IpcPacketSocketFactory::CreateClientTcpSocket( |
| 418 const talk_base::SocketAddress& local_address, | 420 const talk_base::SocketAddress& local_address, |
| 419 const talk_base::SocketAddress& remote_address, | 421 const talk_base::SocketAddress& remote_address, |
| 420 const talk_base::ProxyInfo& proxy_info, | 422 const talk_base::ProxyInfo& proxy_info, |
| 421 const std::string& user_agent, int opts) { | 423 const std::string& user_agent, int opts) { |
| 422 // TODO(sergeyu): Implement SSL support. | 424 P2PSocketType type; |
| 423 if (opts & talk_base::PacketSocketFactory::OPT_SSLTCP) | 425 if (opts & talk_base::PacketSocketFactory::OPT_SSLTCP) { |
| 424 return NULL; | 426 type = (opts & talk_base::PacketSocketFactory::OPT_STUN) ? |
| 425 | 427 P2P_SOCKET_STUN_SSLTCP_CLIENT : P2P_SOCKET_SSLTCP_CLIENT; |
| 426 P2PSocketType type = (opts & talk_base::PacketSocketFactory::OPT_STUN) ? | 428 } else { |
| 427 P2P_SOCKET_STUN_TCP_CLIENT : P2P_SOCKET_TCP_CLIENT; | 429 type = (opts & talk_base::PacketSocketFactory::OPT_STUN) ? |
| 430 P2P_SOCKET_STUN_TCP_CLIENT : P2P_SOCKET_TCP_CLIENT; |
| 431 } |
| 428 P2PSocketClient* socket_client = new P2PSocketClient(socket_dispatcher_); | 432 P2PSocketClient* socket_client = new P2PSocketClient(socket_dispatcher_); |
| 429 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); | 433 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); |
| 430 if (!socket->Init(type, socket_client, local_address, | 434 if (!socket->Init(type, socket_client, local_address, |
| 431 remote_address)) | 435 remote_address)) |
| 432 return NULL; | 436 return NULL; |
| 433 return socket.release(); | 437 return socket.release(); |
| 434 } | 438 } |
| 435 | 439 |
| 436 } // namespace content | 440 } // namespace content |
| OLD | NEW |