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