diff options
Diffstat (limited to 'remoting/protocol/transport_context.h')
-rw-r--r-- | remoting/protocol/transport_context.h | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/remoting/protocol/transport_context.h b/remoting/protocol/transport_context.h index 0cc6241..1c434f6 100644 --- a/remoting/protocol/transport_context.h +++ b/remoting/protocol/transport_context.h @@ -5,6 +5,7 @@ #ifndef REMOTING_PROTOCOL_TRANSPORT_CONTEXT_H_ #define REMOTING_PROTOCOL_TRANSPORT_CONTEXT_H_ +#include <array> #include <list> #include <string> #include <vector> @@ -31,6 +32,14 @@ class IceConfigRequest; // TURN configuration. class TransportContext : public base::RefCountedThreadSafe<TransportContext> { public: + enum RelayMode { + GTURN, + TURN, + + LAST_RELAYMODE = TURN + }; + static const int kNumRelayModes = RelayMode::LAST_RELAYMODE + 1; + typedef base::Callback<void(const IceConfig& ice_config)> GetIceConfigCallback; @@ -42,11 +51,14 @@ class TransportContext : public base::RefCountedThreadSafe<TransportContext> { const NetworkSettings& network_settings, TransportRole role); - // Enables standard TURN servers. - void UseTurn(const std::string& ice_config_url) { + void set_ice_config_url(const std::string& ice_config_url) { ice_config_url_ = ice_config_url; } + // Sets relay mode for all future calls of GetIceConfig(). Doesn't affect + // previous GetIceConfig() requests. + void set_relay_mode(RelayMode relay_mode) { relay_mode_ = relay_mode; } + // Prepares fresh JingleInfo. It may be called while connection is being // negotiated to minimize the chance that the following GetIceConfig() will // be blocking. @@ -69,8 +81,8 @@ class TransportContext : public base::RefCountedThreadSafe<TransportContext> { ~TransportContext(); - void EnsureFreshJingleInfo(); - void OnIceConfig(const IceConfig& ice_config); + void EnsureFreshIceConfig(); + void OnIceConfig(RelayMode relay_mode, const IceConfig& ice_config); SignalStrategy* signal_strategy_; scoped_ptr<PortAllocatorFactory> port_allocator_factory_; @@ -79,14 +91,15 @@ class TransportContext : public base::RefCountedThreadSafe<TransportContext> { TransportRole role_; std::string ice_config_url_; + RelayMode relay_mode_ = RelayMode::GTURN; - scoped_ptr<IceConfigRequest> ice_config_request_; - - IceConfig ice_config_; + std::array<scoped_ptr<IceConfigRequest>, kNumRelayModes> ice_config_request_; + std::array<IceConfig, kNumRelayModes> ice_config_; - // When there is an active |jingle_info_request_| stores list of callbacks to + // When there is an active |ice_config_request_| stores list of callbacks to // be called once the request is finished. - std::list<GetIceConfigCallback> pending_ice_config_callbacks_; + std::array<std::list<GetIceConfigCallback>, kNumRelayModes> + pending_ice_config_callbacks_; DISALLOW_COPY_AND_ASSIGN(TransportContext); }; |