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 // The purpose of SessionManager is to facilitate creation of chromotocol | 5 // The purpose of SessionManager is to facilitate creation of chromotocol |
6 // sessions. Both host and client use it to establish chromotocol | 6 // sessions. Both host and client use it to establish chromotocol |
7 // sessions. JingleChromotocolServer implements this inteface using | 7 // sessions. JingleChromotocolServer implements this inteface using |
8 // libjingle. | 8 // libjingle. |
9 // | 9 // |
10 // OUTGOING SESSIONS | 10 // OUTGOING SESSIONS |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // INCOMPATIBLE. INCOMPATIBLE indicates that the session has | 121 // INCOMPATIBLE. INCOMPATIBLE indicates that the session has |
122 // incompatible configuration, and cannot be accepted. If the | 122 // incompatible configuration, and cannot be accepted. If the |
123 // callback accepts the |session| then it must also set | 123 // callback accepts the |session| then it must also set |
124 // configuration for the |session| using Session::set_config(). | 124 // configuration for the |session| using Session::set_config(). |
125 // The callback must take ownership of the |session| if it ACCEPTs it. | 125 // The callback must take ownership of the |session| if it ACCEPTs it. |
126 virtual void OnIncomingSession(Session* session, | 126 virtual void OnIncomingSession(Session* session, |
127 IncomingSessionResponse* response) = 0; | 127 IncomingSessionResponse* response) = 0; |
128 }; | 128 }; |
129 | 129 |
130 // Initializes the session client. Caller retains ownership of the | 130 // Initializes the session client. Caller retains ownership of the |
131 // |signal_strategy| and |listener|. |allow_nat_traversal| must be | 131 // |signal_strategy| and |listener|. |
132 // set to true to enable NAT traversal. STUN/Relay servers are not | |
133 // used when NAT traversal is disabled, so P2P connection will work | |
134 // only when both peers are on the same network. If this object is | |
135 // used in server mode, then |private_key| and |certificate| are | |
136 // used to establish a secured communication with the client. It | |
137 // will also take ownership of these objects. On the client side | |
138 // pass in NULL for |private_key| and empty string for | |
139 // |certificate|. | |
140 virtual void Init(SignalStrategy* signal_strategy, | 132 virtual void Init(SignalStrategy* signal_strategy, |
141 Listener* listener, | 133 Listener* listener, |
142 const NetworkSettings& network_settings) = 0; | 134 const NetworkSettings& network_settings) = 0; |
143 | 135 |
144 // Tries to create a session to the host |jid|. Must be called only | 136 // Tries to create a session to the host |jid|. Must be called only |
145 // after initialization has finished successfully, i.e. after | 137 // after initialization has finished successfully, i.e. after |
146 // Listener::OnInitialized() has been called. | 138 // Listener::OnInitialized() has been called. |
147 // | 139 // |
148 // |host_jid| is the full jid of the host to connect to. | 140 // |host_jid| is the full jid of the host to connect to. |
149 // |host_public_key| is used to for authentication. | |
150 // |authenticator| is a client authenticator for the session. | 141 // |authenticator| is a client authenticator for the session. |
151 // |config| contains the session configurations that the client supports. | 142 // |config| contains the session configurations that the client supports. |
152 // |state_change_callback| is called when the connection state changes. | 143 // |state_change_callback| is called when the connection state changes. |
153 // | 144 virtual scoped_ptr<Session> Connect( |
154 // Ownership of the |config| is passed to the new session. | |
155 virtual Session* Connect( | |
156 const std::string& host_jid, | 145 const std::string& host_jid, |
157 Authenticator* authenticator, | 146 scoped_ptr<Authenticator> authenticator, |
158 CandidateSessionConfig* config, | 147 scoped_ptr<CandidateSessionConfig> config, |
159 const Session::StateChangeCallback& state_change_callback) = 0; | 148 const Session::StateChangeCallback& state_change_callback) = 0; |
160 | 149 |
161 // Close session manager. Can be called only after all corresponding | 150 // Close session manager. Can be called only after all corresponding |
162 // sessions are destroyed. No callbacks are called after this method | 151 // sessions are destroyed. No callbacks are called after this method |
163 // returns. | 152 // returns. |
164 virtual void Close() = 0; | 153 virtual void Close() = 0; |
165 | 154 |
166 // Set authenticator factory that should be used to authenticate | 155 // Set authenticator factory that should be used to authenticate |
167 // incoming connection. No connections will be accepted if | 156 // incoming connection. No connections will be accepted if |
168 // authenticator factory isn't set. Must not be called more than | 157 // authenticator factory isn't set. Must not be called more than |
169 // once per SessionManager because it may not be safe to delete | 158 // once per SessionManager because it may not be safe to delete |
170 // factory before all authenticators it created are deleted. | 159 // factory before all authenticators it created are deleted. |
171 virtual void set_authenticator_factory( | 160 virtual void set_authenticator_factory( |
172 scoped_ptr<AuthenticatorFactory> authenticator_factory) = 0; | 161 scoped_ptr<AuthenticatorFactory> authenticator_factory) = 0; |
173 | 162 |
174 private: | 163 private: |
175 DISALLOW_COPY_AND_ASSIGN(SessionManager); | 164 DISALLOW_COPY_AND_ASSIGN(SessionManager); |
176 }; | 165 }; |
177 | 166 |
178 } // namespace protocol | 167 } // namespace protocol |
179 } // namespace remoting | 168 } // namespace remoting |
180 | 169 |
181 #endif // REMOTING_PROTOCOL_SESSION_MANAGER_H_ | 170 #endif // REMOTING_PROTOCOL_SESSION_MANAGER_H_ |
OLD | NEW |