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.
5 #ifndef CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_
6 #define CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "content/common/content_export.h"
11 #include "third_party/libjingle/source/talk/p2p/base/packetsocketfactory.h"
15 class P2PSocketDispatcher
;
17 // IpcPacketSocketFactory implements rtc::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 // rtc::Thread) and also has associated base::MessageLoop. Each
21 // socket created by the factory must be used on the thread it was
23 class IpcPacketSocketFactory
: public rtc::PacketSocketFactory
{
25 CONTENT_EXPORT
explicit IpcPacketSocketFactory(
26 P2PSocketDispatcher
* socket_dispatcher
);
27 virtual ~IpcPacketSocketFactory();
29 virtual rtc::AsyncPacketSocket
* CreateUdpSocket(
30 const rtc::SocketAddress
& local_address
,
31 int min_port
, int max_port
) OVERRIDE
;
32 virtual rtc::AsyncPacketSocket
* CreateServerTcpSocket(
33 const rtc::SocketAddress
& local_address
,
37 virtual rtc::AsyncPacketSocket
* CreateClientTcpSocket(
38 const rtc::SocketAddress
& local_address
,
39 const rtc::SocketAddress
& remote_address
,
40 const rtc::ProxyInfo
& proxy_info
,
41 const std::string
& user_agent
,
43 virtual rtc::AsyncResolverInterface
* CreateAsyncResolver() OVERRIDE
;
46 P2PSocketDispatcher
* socket_dispatcher_
;
48 DISALLOW_COPY_AND_ASSIGN(IpcPacketSocketFactory
);
51 } // namespace content
53 #endif // CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_