| 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 <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.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 JingleSessionManager; | 28 class JingleSessionManager; |
| 29 class QuicChannelFactory; | |
| 30 | 29 |
| 31 // JingleSessionManager and JingleSession implement the subset of the | 30 // JingleSessionManager and JingleSession implement the subset of the |
| 32 // Jingle protocol used in Chromoting. Instances of this class are | 31 // Jingle protocol used in Chromoting. Instances of this class are |
| 33 // created by the JingleSessionManager. | 32 // created by the JingleSessionManager. |
| 34 class JingleSession : public base::NonThreadSafe, | 33 class JingleSession : public base::NonThreadSafe, |
| 35 public Session, | 34 public Session, |
| 36 public Transport::EventHandler { | 35 public Transport::EventHandler { |
| 37 public: | 36 public: |
| 38 ~JingleSession() override; | 37 ~JingleSession() override; |
| 39 | 38 |
| 40 // Session interface. | 39 // Session interface. |
| 41 void SetEventHandler(Session::EventHandler* event_handler) override; | 40 void SetEventHandler(Session::EventHandler* event_handler) override; |
| 42 ErrorCode error() override; | 41 ErrorCode error() override; |
| 43 const std::string& jid() override; | 42 const std::string& jid() override; |
| 44 const SessionConfig& config() override; | 43 const SessionConfig& config() override; |
| 45 Transport* GetTransport() override; | 44 Transport* GetTransport() override; |
| 46 StreamChannelFactory* GetQuicChannelFactory() override; | |
| 47 void Close(protocol::ErrorCode error) override; | 45 void Close(protocol::ErrorCode error) override; |
| 48 | 46 |
| 49 private: | 47 private: |
| 50 friend class JingleSessionManager; | 48 friend class JingleSessionManager; |
| 51 | 49 |
| 52 typedef base::Callback<void(JingleMessageReply::ErrorType)> ReplyCallback; | 50 typedef base::Callback<void(JingleMessageReply::ErrorType)> ReplyCallback; |
| 53 | 51 |
| 54 explicit JingleSession(JingleSessionManager* session_manager); | 52 explicit JingleSession(JingleSessionManager* session_manager); |
| 55 | 53 |
| 56 // Start connection by sending session-initiate message. | 54 // Start connection by sending session-initiate message. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 scoped_ptr<Authenticator> authenticator_; | 131 scoped_ptr<Authenticator> authenticator_; |
| 134 | 132 |
| 135 scoped_ptr<Transport> transport_; | 133 scoped_ptr<Transport> transport_; |
| 136 | 134 |
| 137 // Pending Iq requests. Used for all messages except transport-info. | 135 // Pending Iq requests. Used for all messages except transport-info. |
| 138 std::set<IqRequest*> pending_requests_; | 136 std::set<IqRequest*> pending_requests_; |
| 139 | 137 |
| 140 // Pending transport-info requests. | 138 // Pending transport-info requests. |
| 141 std::list<IqRequest*> transport_info_requests_; | 139 std::list<IqRequest*> transport_info_requests_; |
| 142 | 140 |
| 143 scoped_ptr<QuicChannelFactory> quic_channel_factory_; | |
| 144 | |
| 145 base::WeakPtrFactory<JingleSession> weak_factory_; | 141 base::WeakPtrFactory<JingleSession> weak_factory_; |
| 146 | 142 |
| 147 DISALLOW_COPY_AND_ASSIGN(JingleSession); | 143 DISALLOW_COPY_AND_ASSIGN(JingleSession); |
| 148 }; | 144 }; |
| 149 | 145 |
| 150 } // namespace protocol | 146 } // namespace protocol |
| 151 } // namespace remoting | 147 } // namespace remoting |
| 152 | 148 |
| 153 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ | 149 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ |
| OLD | NEW |