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_PEPPER_SESSION_MANAGER_H_ | 5 #ifndef REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ |
6 #define REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ | 6 #define REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 class JingleSession; | 39 class JingleSession; |
40 | 40 |
41 // JingleSessionManager and JingleSession implement the subset of the | 41 // JingleSessionManager and JingleSession implement the subset of the |
42 // Jingle protocol used in Chromoting. JingleSessionManager provides | 42 // Jingle protocol used in Chromoting. JingleSessionManager provides |
43 // the protocol::SessionManager interface for accepting incoming and | 43 // the protocol::SessionManager interface for accepting incoming and |
44 // creating outgoing sessions. | 44 // creating outgoing sessions. |
45 class JingleSessionManager : public SessionManager, | 45 class JingleSessionManager : public SessionManager, |
46 public SignalStrategy::Listener { | 46 public SignalStrategy::Listener { |
47 public: | 47 public: |
| 48 // When |fetch_stun_relay_config| is set to true then |
| 49 // JingleSessionManager will also try to query configuration of STUN |
| 50 // and Relay servers from the signaling server. |
| 51 // |
| 52 // TODO(sergeyu): Move NAT-traversal config fetching to a separate |
| 53 // class. |
48 explicit JingleSessionManager( | 54 explicit JingleSessionManager( |
49 scoped_ptr<TransportFactory> transport_factory); | 55 scoped_ptr<TransportFactory> transport_factory, |
| 56 bool fetch_stun_relay_config); |
50 virtual ~JingleSessionManager(); | 57 virtual ~JingleSessionManager(); |
51 | 58 |
52 // SessionManager interface. | 59 // SessionManager interface. |
53 virtual void Init(SignalStrategy* signal_strategy, | 60 virtual void Init(SignalStrategy* signal_strategy, |
54 SessionManager::Listener* listener, | 61 SessionManager::Listener* listener) OVERRIDE; |
55 const NetworkSettings& network_settings) OVERRIDE; | |
56 virtual scoped_ptr<Session> Connect( | 62 virtual scoped_ptr<Session> Connect( |
57 const std::string& host_jid, | 63 const std::string& host_jid, |
58 scoped_ptr<Authenticator> authenticator, | 64 scoped_ptr<Authenticator> authenticator, |
59 scoped_ptr<CandidateSessionConfig> config, | 65 scoped_ptr<CandidateSessionConfig> config, |
60 const Session::StateChangeCallback& state_change_callback) OVERRIDE; | 66 const Session::StateChangeCallback& state_change_callback) OVERRIDE; |
61 virtual void Close() OVERRIDE; | 67 virtual void Close() OVERRIDE; |
62 virtual void set_authenticator_factory( | 68 virtual void set_authenticator_factory( |
63 scoped_ptr<AuthenticatorFactory> authenticator_factory) OVERRIDE; | 69 scoped_ptr<AuthenticatorFactory> authenticator_factory) OVERRIDE; |
64 | 70 |
65 // SignalStrategy::Listener interface. | 71 // SignalStrategy::Listener interface. |
(...skipping 13 matching lines...) Expand all Loading... |
79 const std::vector<talk_base::SocketAddress>& stun_hosts); | 85 const std::vector<talk_base::SocketAddress>& stun_hosts); |
80 | 86 |
81 IqSender* iq_sender() { return iq_sender_.get(); } | 87 IqSender* iq_sender() { return iq_sender_.get(); } |
82 void SendReply(const buzz::XmlElement* original_stanza, | 88 void SendReply(const buzz::XmlElement* original_stanza, |
83 JingleMessageReply::ErrorType error); | 89 JingleMessageReply::ErrorType error); |
84 | 90 |
85 // Called by JingleSession when it is being destroyed. | 91 // Called by JingleSession when it is being destroyed. |
86 void SessionDestroyed(JingleSession* session); | 92 void SessionDestroyed(JingleSession* session); |
87 | 93 |
88 scoped_ptr<TransportFactory> transport_factory_; | 94 scoped_ptr<TransportFactory> transport_factory_; |
| 95 bool fetch_stun_relay_config_; |
89 | 96 |
90 SignalStrategy* signal_strategy_; | 97 SignalStrategy* signal_strategy_; |
91 scoped_ptr<AuthenticatorFactory> authenticator_factory_; | 98 scoped_ptr<AuthenticatorFactory> authenticator_factory_; |
92 scoped_ptr<IqSender> iq_sender_; | 99 scoped_ptr<IqSender> iq_sender_; |
93 SessionManager::Listener* listener_; | 100 SessionManager::Listener* listener_; |
94 | 101 |
95 bool ready_; | 102 bool ready_; |
96 | 103 |
97 TransportConfig transport_config_; | 104 TransportConfig transport_config_; |
98 | 105 |
99 scoped_ptr<JingleInfoRequest> jingle_info_request_; | 106 scoped_ptr<JingleInfoRequest> jingle_info_request_; |
100 | 107 |
101 SessionsMap sessions_; | 108 SessionsMap sessions_; |
102 | 109 |
103 DISALLOW_COPY_AND_ASSIGN(JingleSessionManager); | 110 DISALLOW_COPY_AND_ASSIGN(JingleSessionManager); |
104 }; | 111 }; |
105 | 112 |
106 } // namespace protocol | 113 } // namespace protocol |
107 } // namespace remoting | 114 } // namespace remoting |
108 | 115 |
109 #endif // REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ | 116 #endif // REMOTING_PROTOCOL_PEPPER_SESSION_MANAGER_H_ |
OLD | NEW |