1 // Copyright (c) 2012 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 REMOTING_PROTOCOL_LIBJINGLE_TRANSPORT_FACTORY_H_
6 #define REMOTING_PROTOCOL_LIBJINGLE_TRANSPORT_FACTORY_H_
8 #include "remoting/protocol/transport.h"
11 class HttpPortAllocatorBase
;
13 } // namespace cricket
16 class URLRequestContextGetter
;
21 class PacketSocketFactory
;
22 } // namespace talk_base
26 struct NetworkSettings
;
30 class LibjingleTransportFactory
: public TransportFactory
{
32 // Creates an instance of the class using ChromiumPortAllocator.
33 // Must be called from an IO thread.
34 static scoped_ptr
<LibjingleTransportFactory
> Create(
35 const NetworkSettings
& network_settings
,
36 const scoped_refptr
<net::URLRequestContextGetter
>&
37 url_request_context_getter
);
39 // Need to use cricket::HttpPortAllocatorBase pointer for the
40 // |port_allocator|, so that it is possible to configure
41 // |port_allocator| with STUN/Relay addresses.
42 // TODO(sergeyu): Reconsider this design.
43 LibjingleTransportFactory(
44 scoped_ptr
<cricket::HttpPortAllocatorBase
> port_allocator
,
47 // Creates BasicNetworkManager, ChromiumPacketSocketFactory and
48 // BasicPortAllocator.
49 LibjingleTransportFactory();
51 virtual ~LibjingleTransportFactory();
53 // TransportFactory interface.
54 virtual void SetTransportConfig(const TransportConfig
& config
) OVERRIDE
;
55 virtual scoped_ptr
<StreamTransport
> CreateStreamTransport() OVERRIDE
;
56 virtual scoped_ptr
<DatagramTransport
> CreateDatagramTransport() OVERRIDE
;
59 scoped_ptr
<talk_base::NetworkManager
> network_manager_
;
60 scoped_ptr
<talk_base::PacketSocketFactory
> socket_factory_
;
61 // Points to the same port allocator as |port_allocator_| or NULL if
62 // |port_allocator_| is not HttpPortAllocatorBase.
63 cricket::HttpPortAllocatorBase
* http_port_allocator_
;
64 scoped_ptr
<cricket::PortAllocator
> port_allocator_
;
67 DISALLOW_COPY_AND_ASSIGN(LibjingleTransportFactory
);
70 } // namespace protocol
71 } // namespace remoting
73 #endif // REMOTING_PROTOCOL_LIBJINGLE_TRANSPORT_FACTORY_H_