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 <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 | 646 |
647 IpcPacketSocketFactory::IpcPacketSocketFactory( | 647 IpcPacketSocketFactory::IpcPacketSocketFactory( |
648 P2PSocketDispatcher* socket_dispatcher) | 648 P2PSocketDispatcher* socket_dispatcher) |
649 : socket_dispatcher_(socket_dispatcher) { | 649 : socket_dispatcher_(socket_dispatcher) { |
650 } | 650 } |
651 | 651 |
652 IpcPacketSocketFactory::~IpcPacketSocketFactory() { | 652 IpcPacketSocketFactory::~IpcPacketSocketFactory() { |
653 } | 653 } |
654 | 654 |
655 rtc::AsyncPacketSocket* IpcPacketSocketFactory::CreateUdpSocket( | 655 rtc::AsyncPacketSocket* IpcPacketSocketFactory::CreateUdpSocket( |
656 const rtc::SocketAddress& local_address, int min_port, int max_port) { | 656 const rtc::SocketAddress& local_address, uint16 min_port, uint16 max_port) { |
657 rtc::SocketAddress crome_address; | 657 rtc::SocketAddress crome_address; |
658 P2PSocketClientImpl* socket_client = | 658 P2PSocketClientImpl* socket_client = |
659 new P2PSocketClientImpl(socket_dispatcher_); | 659 new P2PSocketClientImpl(socket_dispatcher_); |
660 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); | 660 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); |
661 // TODO(sergeyu): Respect local_address and port limits here (need | 661 // TODO(sergeyu): Respect local_address and port limits here (need |
662 // to pass them over IPC channel to the browser). | 662 // to pass them over IPC channel to the browser). |
663 if (!socket->Init(P2P_SOCKET_UDP, socket_client, | 663 if (!socket->Init(P2P_SOCKET_UDP, socket_client, |
664 local_address, rtc::SocketAddress())) { | 664 local_address, rtc::SocketAddress())) { |
665 return NULL; | 665 return NULL; |
666 } | 666 } |
667 return socket.release(); | 667 return socket.release(); |
668 } | 668 } |
669 | 669 |
670 rtc::AsyncPacketSocket* IpcPacketSocketFactory::CreateServerTcpSocket( | 670 rtc::AsyncPacketSocket* IpcPacketSocketFactory::CreateServerTcpSocket( |
671 const rtc::SocketAddress& local_address, int min_port, int max_port, | 671 const rtc::SocketAddress& local_address, uint16 min_port, uint16 max_port, |
672 int opts) { | 672 int opts) { |
673 // TODO(sergeyu): Implement SSL support. | 673 // TODO(sergeyu): Implement SSL support. |
674 if (opts & rtc::PacketSocketFactory::OPT_SSLTCP) | 674 if (opts & rtc::PacketSocketFactory::OPT_SSLTCP) |
675 return NULL; | 675 return NULL; |
676 | 676 |
677 P2PSocketType type = (opts & rtc::PacketSocketFactory::OPT_STUN) ? | 677 P2PSocketType type = (opts & rtc::PacketSocketFactory::OPT_STUN) ? |
678 P2P_SOCKET_STUN_TCP_SERVER : P2P_SOCKET_TCP_SERVER; | 678 P2P_SOCKET_STUN_TCP_SERVER : P2P_SOCKET_TCP_SERVER; |
679 P2PSocketClientImpl* socket_client = | 679 P2PSocketClientImpl* socket_client = |
680 new P2PSocketClientImpl(socket_dispatcher_); | 680 new P2PSocketClientImpl(socket_dispatcher_); |
681 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); | 681 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); |
(...skipping 29 matching lines...) Expand all Loading... |
711 } | 711 } |
712 | 712 |
713 rtc::AsyncResolverInterface* | 713 rtc::AsyncResolverInterface* |
714 IpcPacketSocketFactory::CreateAsyncResolver() { | 714 IpcPacketSocketFactory::CreateAsyncResolver() { |
715 scoped_ptr<AsyncAddressResolverImpl> resolver( | 715 scoped_ptr<AsyncAddressResolverImpl> resolver( |
716 new AsyncAddressResolverImpl(socket_dispatcher_)); | 716 new AsyncAddressResolverImpl(socket_dispatcher_)); |
717 return resolver.release(); | 717 return resolver.release(); |
718 } | 718 } |
719 | 719 |
720 } // namespace content | 720 } // namespace content |
OLD | NEW |