blob: 1fd8855d98983ffee42dee97a74bd6f045e1e87e [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <list>
#include "base/callback_forward.h"
#include "remoting/protocol/network_settings.h"
#include "remoting/protocol/transport.h"
namespace cricket {
class HttpPortAllocatorBase;
class PortAllocator;
} // namespace cricket
namespace net {
class URLRequestContextGetter;
} // namespace net
namespace rtc {
class NetworkManager;
class PacketSocketFactory;
class SocketAddress;
} // namespace rtc
namespace remoting {
class SignalStrategy;
class JingleInfoRequest;
namespace protocol {
class LibjingleTransportFactory : public TransportFactory {
// |signal_strategy| must outlive LibjingleTransportFactory. Need to use
// cricket::HttpPortAllocatorBase pointer for the |port_allocator|, so that it
// is possible to configure |port_allocator| with STUN/Relay addresses.
SignalStrategy* signal_strategy,
scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator,
const NetworkSettings& network_settings,
TransportRole role);
~LibjingleTransportFactory() override;
// TransportFactory interface.
void PrepareTokens() override;
scoped_ptr<Transport> CreateTransport() override;
void EnsureFreshJingleInfo();
void OnJingleInfo(const std::string& relay_token,
const std::vector<std::string>& relay_hosts,
const std::vector<rtc::SocketAddress>& stun_hosts);
SignalStrategy* signal_strategy_;
scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator_;
NetworkSettings network_settings_;
TransportRole role_;
base::TimeTicks last_jingle_info_update_time_;
scoped_ptr<JingleInfoRequest> jingle_info_request_;
// When there is an active |jingle_info_request_| stores list of callbacks to
// be called once the |jingle_info_request_| is finished.
std::list<base::Closure> on_jingle_info_callbacks_;
} // namespace protocol
} // namespace remoting