[email protected] | 25762d8 | 2011-03-04 16:26:27 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | ccc70d8e | 2011-03-16 20:40:37 | [diff] [blame] | 5 | #ifndef CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_ |
6 | #define CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_ | ||||
[email protected] | 25762d8 | 2011-03-04 16:26:27 | [diff] [blame] | 7 | |
8 | #include "base/basictypes.h" | ||||
[email protected] | 8bb74637 | 2012-04-26 04:20:12 | [diff] [blame] | 9 | #include "base/compiler_specific.h" |
[email protected] | 8d128d6 | 2011-09-13 22:11:57 | [diff] [blame] | 10 | #include "content/common/content_export.h" |
[email protected] | f7b8158c | 2013-05-07 03:54:36 | [diff] [blame] | 11 | #include "third_party/libjingle/source/talk/p2p/base/packetsocketfactory.h" |
[email protected] | 25762d8 | 2011-03-04 16:26:27 | [diff] [blame] | 12 | |
[email protected] | b3f8f972 | 2011-08-25 20:56:07 | [diff] [blame] | 13 | namespace content { |
14 | |||||
[email protected] | 25762d8 | 2011-03-04 16:26:27 | [diff] [blame] | 15 | class P2PSocketDispatcher; |
16 | |||||
17 | // IpcPacketSocketFactory implements talk_base::PacketSocketFactory | ||||
18 | // interface for libjingle using IPC-based P2P sockets. The class must | ||||
19 | // be used on a thread that is a libjingle thread (implements | ||||
20 | // talk_base::Thread) and also has associated base::MessageLoop. Each | ||||
21 | // socket created by the factory must be used on the thread it was | ||||
22 | // created on. | ||||
23 | class IpcPacketSocketFactory : public talk_base::PacketSocketFactory { | ||||
24 | public: | ||||
[email protected] | 8d128d6 | 2011-09-13 22:11:57 | [diff] [blame] | 25 | CONTENT_EXPORT explicit IpcPacketSocketFactory( |
26 | P2PSocketDispatcher* socket_dispatcher); | ||||
[email protected] | 25762d8 | 2011-03-04 16:26:27 | [diff] [blame] | 27 | virtual ~IpcPacketSocketFactory(); |
28 | |||||
29 | virtual talk_base::AsyncPacketSocket* CreateUdpSocket( | ||||
30 | const talk_base::SocketAddress& local_address, | ||||
[email protected] | edc64de | 2011-11-17 20:07:38 | [diff] [blame] | 31 | int min_port, int max_port) OVERRIDE; |
[email protected] | 25762d8 | 2011-03-04 16:26:27 | [diff] [blame] | 32 | virtual talk_base::AsyncPacketSocket* CreateServerTcpSocket( |
[email protected] | 501b9ba | 2011-05-10 03:23:13 | [diff] [blame] | 33 | const talk_base::SocketAddress& local_address, |
34 | int min_port, | ||||
35 | int max_port, | ||||
[email protected] | f7b8158c | 2013-05-07 03:54:36 | [diff] [blame] | 36 | int opts) OVERRIDE; |
[email protected] | 25762d8 | 2011-03-04 16:26:27 | [diff] [blame] | 37 | virtual talk_base::AsyncPacketSocket* CreateClientTcpSocket( |
38 | const talk_base::SocketAddress& local_address, | ||||
39 | const talk_base::SocketAddress& remote_address, | ||||
40 | const talk_base::ProxyInfo& proxy_info, | ||||
41 | const std::string& user_agent, | ||||
[email protected] | f7b8158c | 2013-05-07 03:54:36 | [diff] [blame] | 42 | int opts) OVERRIDE; |
[email protected] | 25762d8 | 2011-03-04 16:26:27 | [diff] [blame] | 43 | |
44 | private: | ||||
45 | P2PSocketDispatcher* socket_dispatcher_; | ||||
46 | |||||
47 | DISALLOW_COPY_AND_ASSIGN(IpcPacketSocketFactory); | ||||
48 | }; | ||||
49 | |||||
[email protected] | b3f8f972 | 2011-08-25 20:56:07 | [diff] [blame] | 50 | } // namespace content |
51 | |||||
[email protected] | ccc70d8e | 2011-03-16 20:40:37 | [diff] [blame] | 52 | #endif // CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_ |