Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_PROTOCOL_JINGLE_SESSION_H_ | 5 #ifndef REMOTING_PROTOCOL_JINGLE_SESSION_H_ |
| 6 #define REMOTING_PROTOCOL_JINGLE_SESSION_H_ | 6 #define REMOTING_PROTOCOL_JINGLE_SESSION_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 15 #include "crypto/rsa_private_key.h" | 15 #include "crypto/rsa_private_key.h" |
| 16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
| 17 #include "remoting/protocol/authenticator.h" | 17 #include "remoting/protocol/authenticator.h" |
| 18 #include "remoting/protocol/datagram_channel_factory.h" | 18 #include "remoting/protocol/datagram_channel_factory.h" |
| 19 #include "remoting/protocol/jingle_messages.h" | 19 #include "remoting/protocol/jingle_messages.h" |
| 20 #include "remoting/protocol/session.h" | 20 #include "remoting/protocol/session.h" |
| 21 #include "remoting/protocol/session_config.h" | 21 #include "remoting/protocol/session_config.h" |
| 22 #include "remoting/protocol/transport.h" | 22 #include "remoting/protocol/transport.h" |
| 23 #include "remoting/signaling/iq_sender.h" | 23 #include "remoting/signaling/iq_sender.h" |
| 24 | 24 |
| 25 namespace remoting { | 25 namespace remoting { |
| 26 namespace protocol { | 26 namespace protocol { |
| 27 | 27 |
| 28 class SecureChannelFactory; | |
| 29 class ChannelMultiplexer; | 28 class ChannelMultiplexer; |
| 30 class JingleSessionManager; | 29 class JingleSessionManager; |
| 31 class PseudoTcpChannelFactory; | 30 class PseudoTcpChannelFactory; |
| 31 class QuicChannelFactory; | |
| 32 class SecureChannelFactory; | |
| 32 | 33 |
| 33 // JingleSessionManager and JingleSession implement the subset of the | 34 // JingleSessionManager and JingleSession implement the subset of the |
| 34 // Jingle protocol used in Chromoting. Instances of this class are | 35 // Jingle protocol used in Chromoting. Instances of this class are |
| 35 // created by the JingleSessionManager. | 36 // created by the JingleSessionManager. |
| 36 class JingleSession : public base::NonThreadSafe, | 37 class JingleSession : public base::NonThreadSafe, |
| 37 public Session, | 38 public Session, |
| 38 public DatagramChannelFactory, | 39 public DatagramChannelFactory, |
| 39 public Transport::EventHandler { | 40 public Transport::EventHandler { |
| 40 public: | 41 public: |
| 41 ~JingleSession() override; | 42 ~JingleSession() override; |
| 42 | 43 |
| 43 // Session interface. | 44 // Session interface. |
| 44 void SetEventHandler(Session::EventHandler* event_handler) override; | 45 void SetEventHandler(Session::EventHandler* event_handler) override; |
| 45 ErrorCode error() override; | 46 ErrorCode error() override; |
| 46 const std::string& jid() override; | 47 const std::string& jid() override; |
| 47 const SessionConfig& config() override; | 48 const SessionConfig& config() override; |
| 48 StreamChannelFactory* GetTransportChannelFactory() override; | 49 StreamChannelFactory* GetTransportChannelFactory() override; |
| 49 StreamChannelFactory* GetMultiplexedChannelFactory() override; | 50 StreamChannelFactory* GetMultiplexedChannelFactory() override; |
| 51 StreamChannelFactory* GetQuicChannelFactory() override; | |
| 50 void Close() override; | 52 void Close() override; |
| 51 | 53 |
| 52 // DatagramChannelFactory interface. | 54 // DatagramChannelFactory interface. |
| 53 void CreateChannel(const std::string& name, | 55 void CreateChannel(const std::string& name, |
| 54 const ChannelCreatedCallback& callback) override; | 56 const ChannelCreatedCallback& callback) override; |
| 55 void CancelChannelCreation(const std::string& name) override; | 57 void CancelChannelCreation(const std::string& name) override; |
| 56 | 58 |
| 57 // Transport::EventHandler interface. | 59 // Transport::EventHandler interface. |
| 58 void OnTransportIceCredentials(Transport* transport, | 60 void OnTransportIceCredentials(Transport* transport, |
| 59 const std::string& ufrag, | 61 const std::string& ufrag, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 // session is being closed due to an error. | 145 // session is being closed due to an error. |
| 144 void CloseInternal(ErrorCode error); | 146 void CloseInternal(ErrorCode error); |
| 145 | 147 |
| 146 // Sets |state_| to |new_state| and calls state change callback. | 148 // Sets |state_| to |new_state| and calls state change callback. |
| 147 void SetState(State new_state); | 149 void SetState(State new_state); |
| 148 | 150 |
| 149 // Returns true if the state of the session is not CLOSED or FAILED | 151 // Returns true if the state of the session is not CLOSED or FAILED |
| 150 bool is_session_active(); | 152 bool is_session_active(); |
| 151 | 153 |
| 152 JingleSessionManager* session_manager_; | 154 JingleSessionManager* session_manager_; |
| 155 bool is_server_; | |
|
dcaiafa
2015/08/11 22:40:06
Not used. Delete?
Sergey Ulanov
2015/08/14 18:44:25
Done.
| |
| 153 std::string peer_jid_; | 156 std::string peer_jid_; |
| 154 Session::EventHandler* event_handler_; | 157 Session::EventHandler* event_handler_; |
| 155 | 158 |
| 156 std::string session_id_; | 159 std::string session_id_; |
| 157 State state_; | 160 State state_; |
| 158 ErrorCode error_; | 161 ErrorCode error_; |
| 159 | 162 |
| 160 scoped_ptr<SessionConfig> config_; | 163 scoped_ptr<SessionConfig> config_; |
| 161 | 164 |
| 162 scoped_ptr<Authenticator> authenticator_; | 165 scoped_ptr<Authenticator> authenticator_; |
| 163 | 166 |
| 164 // Pending Iq requests. Used for all messages except transport-info. | 167 // Pending Iq requests. Used for all messages except transport-info. |
| 165 std::set<IqRequest*> pending_requests_; | 168 std::set<IqRequest*> pending_requests_; |
| 166 | 169 |
| 167 // Pending transport-info requests. | 170 // Pending transport-info requests. |
| 168 std::list<IqRequest*> transport_info_requests_; | 171 std::list<IqRequest*> transport_info_requests_; |
| 169 | 172 |
| 170 ChannelsMap channels_; | 173 ChannelsMap channels_; |
| 171 scoped_ptr<PseudoTcpChannelFactory> pseudotcp_channel_factory_; | 174 scoped_ptr<PseudoTcpChannelFactory> pseudotcp_channel_factory_; |
| 172 scoped_ptr<SecureChannelFactory> secure_channel_factory_; | 175 scoped_ptr<SecureChannelFactory> secure_channel_factory_; |
| 173 scoped_ptr<ChannelMultiplexer> channel_multiplexer_; | 176 scoped_ptr<ChannelMultiplexer> channel_multiplexer_; |
| 177 scoped_ptr<QuicChannelFactory> quic_adapter_; | |
|
dcaiafa
2015/08/11 22:40:06
This is not really an adapter, so why not quic_cha
Sergey Ulanov
2015/08/14 18:44:25
Done.
| |
| 174 | 178 |
| 175 scoped_ptr<JingleMessage> pending_transport_info_message_; | 179 scoped_ptr<JingleMessage> pending_transport_info_message_; |
| 176 base::OneShotTimer<JingleSession> transport_info_timer_; | 180 base::OneShotTimer<JingleSession> transport_info_timer_; |
| 177 | 181 |
| 178 // Pending remote transport info received before the local channels were | 182 // Pending remote transport info received before the local channels were |
| 179 // created. | 183 // created. |
| 180 std::list<JingleMessage::IceCredentials> pending_remote_ice_credentials_; | 184 std::list<JingleMessage::IceCredentials> pending_remote_ice_credentials_; |
| 181 std::list<JingleMessage::NamedCandidate> pending_remote_candidates_; | 185 std::list<JingleMessage::NamedCandidate> pending_remote_candidates_; |
| 182 | 186 |
| 183 base::WeakPtrFactory<JingleSession> weak_factory_; | 187 base::WeakPtrFactory<JingleSession> weak_factory_; |
| 184 | 188 |
| 185 DISALLOW_COPY_AND_ASSIGN(JingleSession); | 189 DISALLOW_COPY_AND_ASSIGN(JingleSession); |
| 186 }; | 190 }; |
| 187 | 191 |
| 188 } // namespace protocol | 192 } // namespace protocol |
| 189 } // namespace remoting | 193 } // namespace remoting |
| 190 | 194 |
| 191 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ | 195 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ |
| OLD | NEW |