blob: cb4188389589535bdb2e277bd89b7a960e4a3360 [file] [log] [blame]
[email protected]25762d82011-03-04 16:26:271// 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]ccc70d8e2011-03-16 20:40:375#ifndef CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_
6#define CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_
[email protected]25762d82011-03-04 16:26:277
8#include "base/basictypes.h"
[email protected]8bb746372012-04-26 04:20:129#include "base/compiler_specific.h"
[email protected]8d128d62011-09-13 22:11:5710#include "content/common/content_export.h"
[email protected]f7b8158c2013-05-07 03:54:3611#include "third_party/libjingle/source/talk/p2p/base/packetsocketfactory.h"
[email protected]25762d82011-03-04 16:26:2712
[email protected]b3f8f9722011-08-25 20:56:0713namespace content {
14
[email protected]25762d82011-03-04 16:26:2715class 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.
23class IpcPacketSocketFactory : public talk_base::PacketSocketFactory {
24 public:
[email protected]8d128d62011-09-13 22:11:5725 CONTENT_EXPORT explicit IpcPacketSocketFactory(
26 P2PSocketDispatcher* socket_dispatcher);
[email protected]25762d82011-03-04 16:26:2727 virtual ~IpcPacketSocketFactory();
28
29 virtual talk_base::AsyncPacketSocket* CreateUdpSocket(
30 const talk_base::SocketAddress& local_address,
[email protected]edc64de2011-11-17 20:07:3831 int min_port, int max_port) OVERRIDE;
[email protected]25762d82011-03-04 16:26:2732 virtual talk_base::AsyncPacketSocket* CreateServerTcpSocket(
[email protected]501b9ba2011-05-10 03:23:1333 const talk_base::SocketAddress& local_address,
34 int min_port,
35 int max_port,
[email protected]f7b8158c2013-05-07 03:54:3636 int opts) OVERRIDE;
[email protected]25762d82011-03-04 16:26:2737 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]f7b8158c2013-05-07 03:54:3642 int opts) OVERRIDE;
[email protected]25762d82011-03-04 16:26:2743
44 private:
45 P2PSocketDispatcher* socket_dispatcher_;
46
47 DISALLOW_COPY_AND_ASSIGN(IpcPacketSocketFactory);
48};
49
[email protected]b3f8f9722011-08-25 20:56:0750} // namespace content
51
[email protected]ccc70d8e2011-03-16 20:40:3752#endif // CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_