| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "crypto/rsa_private_key.h" | 10 #include "crypto/rsa_private_key.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // Session interface. | 29 // Session interface. |
| 30 virtual void SetStateChangeCallback( | 30 virtual void SetStateChangeCallback( |
| 31 const StateChangeCallback& callback) OVERRIDE; | 31 const StateChangeCallback& callback) OVERRIDE; |
| 32 virtual Error error() OVERRIDE; | 32 virtual Error error() OVERRIDE; |
| 33 virtual void CreateStreamChannel( | 33 virtual void CreateStreamChannel( |
| 34 const std::string& name, | 34 const std::string& name, |
| 35 const StreamChannelCallback& callback) OVERRIDE; | 35 const StreamChannelCallback& callback) OVERRIDE; |
| 36 virtual void CreateDatagramChannel( | 36 virtual void CreateDatagramChannel( |
| 37 const std::string& name, | 37 const std::string& name, |
| 38 const DatagramChannelCallback& callback) OVERRIDE; | 38 const DatagramChannelCallback& callback) OVERRIDE; |
| 39 virtual void CancelChannelCreation(const std::string& name) OVERRIDE; |
| 39 virtual net::Socket* control_channel() OVERRIDE; | 40 virtual net::Socket* control_channel() OVERRIDE; |
| 40 virtual net::Socket* event_channel() OVERRIDE; | 41 virtual net::Socket* event_channel() OVERRIDE; |
| 41 virtual const std::string& jid() OVERRIDE; | 42 virtual const std::string& jid() OVERRIDE; |
| 42 virtual const CandidateSessionConfig* candidate_config() OVERRIDE; | 43 virtual const CandidateSessionConfig* candidate_config() OVERRIDE; |
| 43 virtual const SessionConfig& config() OVERRIDE; | 44 virtual const SessionConfig& config() OVERRIDE; |
| 44 virtual void set_config(const SessionConfig& config) OVERRIDE; | 45 virtual void set_config(const SessionConfig& config) OVERRIDE; |
| 45 virtual const std::string& initiator_token() OVERRIDE; | 46 virtual const std::string& initiator_token() OVERRIDE; |
| 46 virtual void set_initiator_token(const std::string& initiator_token) OVERRIDE; | 47 virtual void set_initiator_token(const std::string& initiator_token) OVERRIDE; |
| 47 virtual const std::string& receiver_token() OVERRIDE; | 48 virtual const std::string& receiver_token() OVERRIDE; |
| 48 virtual void set_receiver_token(const std::string& receiver_token) OVERRIDE; | 49 virtual void set_receiver_token(const std::string& receiver_token) OVERRIDE; |
| 49 virtual void set_shared_secret(const std::string& secret) OVERRIDE; | 50 virtual void set_shared_secret(const std::string& secret) OVERRIDE; |
| 50 virtual const std::string& shared_secret() OVERRIDE; | 51 virtual const std::string& shared_secret() OVERRIDE; |
| 51 virtual void Close() OVERRIDE; | 52 virtual void Close() OVERRIDE; |
| 52 | 53 |
| 53 private: | 54 private: |
| 54 friend class JingleDatagramConnector; | 55 friend class JingleDatagramConnector; |
| 55 friend class JingleSessionManager; | 56 friend class JingleSessionManager; |
| 56 friend class JingleStreamConnector; | 57 friend class JingleStreamConnector; |
| 57 | 58 |
| 59 typedef std::map<std::string, JingleChannelConnector*> ChannelConnectorsMap; |
| 60 |
| 58 // Create a JingleSession used in client mode. A server certificate is | 61 // Create a JingleSession used in client mode. A server certificate is |
| 59 // required. | 62 // required. |
| 60 static JingleSession* CreateClientSession(JingleSessionManager* manager, | 63 static JingleSession* CreateClientSession(JingleSessionManager* manager, |
| 61 const std::string& host_public_key); | 64 const std::string& host_public_key); |
| 62 | 65 |
| 63 // Create a JingleSession used in server mode. A server certificate and | 66 // Create a JingleSession used in server mode. A server certificate and |
| 64 // private key is provided. |key| is copied in the constructor. | 67 // private key is provided. |key| is copied in the constructor. |
| 65 // | 68 // |
| 66 // TODO(sergeyu): Remove |certificate| and |key| when we stop using TLS. | 69 // TODO(sergeyu): Remove |certificate| and |key| when we stop using TLS. |
| 67 static JingleSession* CreateServerSession( | 70 static JingleSession* CreateServerSession( |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 SessionConfig config_; | 171 SessionConfig config_; |
| 169 bool config_set_; | 172 bool config_set_; |
| 170 | 173 |
| 171 std::string initiator_token_; | 174 std::string initiator_token_; |
| 172 std::string receiver_token_; | 175 std::string receiver_token_; |
| 173 | 176 |
| 174 // These data members are only set on the receiving side. | 177 // These data members are only set on the receiving side. |
| 175 scoped_ptr<const CandidateSessionConfig> candidate_config_; | 178 scoped_ptr<const CandidateSessionConfig> candidate_config_; |
| 176 | 179 |
| 177 // Channels that are currently being connected. | 180 // Channels that are currently being connected. |
| 178 std::map<std::string, JingleChannelConnector*> channel_connectors_; | 181 ChannelConnectorsMap channel_connectors_; |
| 179 | 182 |
| 180 scoped_ptr<net::Socket> control_channel_socket_; | 183 scoped_ptr<net::Socket> control_channel_socket_; |
| 181 scoped_ptr<net::Socket> event_channel_socket_; | 184 scoped_ptr<net::Socket> event_channel_socket_; |
| 182 | 185 |
| 183 ScopedRunnableMethodFactory<JingleSession> task_factory_; | 186 ScopedRunnableMethodFactory<JingleSession> task_factory_; |
| 184 | 187 |
| 185 DISALLOW_COPY_AND_ASSIGN(JingleSession); | 188 DISALLOW_COPY_AND_ASSIGN(JingleSession); |
| 186 }; | 189 }; |
| 187 | 190 |
| 188 } // namespace protocol | 191 } // namespace protocol |
| 189 | 192 |
| 190 } // namespace remoting | 193 } // namespace remoting |
| 191 | 194 |
| 192 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ | 195 #endif // REMOTING_PROTOCOL_JINGLE_SESSION_H_ |
| OLD | NEW |