blob: 9c20fbbddcafcf0a2ba1ae038321b418a6012f8d [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]8d128d62011-09-13 22:11:579#include "content/common/content_export.h"
[email protected]25762d82011-03-04 16:26:2710#include "third_party/libjingle/source/talk/base/packetsocketfactory.h"
11
[email protected]b3f8f9722011-08-25 20:56:0712namespace content {
13
[email protected]25762d82011-03-04 16:26:2714class 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.
22class IpcPacketSocketFactory : public talk_base::PacketSocketFactory {
23 public:
[email protected]8d128d62011-09-13 22:11:5724 CONTENT_EXPORT explicit IpcPacketSocketFactory(
25 P2PSocketDispatcher* socket_dispatcher);
[email protected]25762d82011-03-04 16:26:2726 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]501b9ba2011-05-10 03:23:1332 const talk_base::SocketAddress& local_address,
33 int min_port,
34 int max_port,
35 bool ssl);
[email protected]25762d82011-03-04 16:26:2736 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]b3f8f9722011-08-25 20:56:0749} // namespace content
50
[email protected]ccc70d8e2011-03-16 20:40:3751#endif // CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_