Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Side by Side Diff: remoting/protocol/session_manager.h

Issue 7312013: Minor cleanups in JingleSession and JingleSessionManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // The purprose of SessionManager is to facilitate creation of chromotocol 5 // The purprose of SessionManager is to facilitate creation of chromotocol
Wez 2011/07/06 21:24:25 nit: Typo "purprose" -> "purpose".
Sergey Ulanov 2011/07/06 23:15:01 Done.
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
11 // Connect() must be used to create new session to a remote host. The 11 // Connect() must be used to create new session to a remote host. The
12 // returned sessionion is initially in INITIALIZING state. Later state is 12 // returned sessionion is initially in INITIALIZING state. Later state is
13 // changed to CONNECTED if the session is accepted by the host or CLOSED 13 // changed to CONNECTED if the session is accepted by the host or CLOSED
14 // if the session is rejected. 14 // if the session is rejected.
15 // 15 //
16 // INCOMING SESSIONS 16 // INCOMING SESSIONS
17 // The IncomingSessionCallback is called when a client attempts to connect. 17 // The IncomingSessionCallback is called when a client attempts to connect.
18 // The callback function decides whether the session should be accepted or 18 // The callback function decides whether the session should be accepted or
19 // rejected. 19 // rejected.
20 // 20 //
21 // SESSION OWNERSHIP AND SHUTDOWN 21 // SESSION OWNERSHIP AND SHUTDOWN
22 // SessionManager owns all Chromotocol Session it creates. The server 22 // SessionManager owns all sessions it creates. The server must not be
Wez 2011/07/06 21:24:25 nit: "sessions" -> "Sessions". nit: "server" -> "m
Sergey Ulanov 2011/07/06 23:15:01 Done.
23 // must not be closed while sessions created by the server are still in use. 23 // closed while sessions created by the server are still in use. When
24 // When shutting down the Close() method for the sessionion and the server 24 // shutting down object must be destroyed in the following order:
Wez 2011/07/06 21:24:25 nit: Isn't this generally true, not just when shut
Sergey Ulanov 2011/07/06 23:15:01 Done.
25 // objects must be called in the following order: Session, 25 // Session, SessionManager, JingleClient. The same order must be
26 // SessionManager, JingleClient. The same order must be followed in the case 26 // followed in the case of failed sessions. Rejected sessions are
27 // of rejected and failed sessions. 27 // destroyed by the session manager.
28 // 28 //
29 // PROTOCOL VERSION NEGOTIATION 29 // PROTOCOL VERSION NEGOTIATION
30 // When client connects to a host it sends a session-initiate stanza with list 30 // When client connects to a host it sends a session-initiate stanza with list
31 // of supported configurations for each channel. If the host decides to accept 31 // of supported configurations for each channel. If the host decides to accept
32 // session, then it selects configuration that is supported by both sides 32 // session, then it selects configuration that is supported by both sides
33 // and then replies with the session-accept stanza that contans selected 33 // and then replies with the session-accept stanza that contans selected
34 // configuration. The configuration specified in the session-accept is used 34 // configuration. The configuration specified in the session-accept is used
35 // for the session. 35 // for the session.
36 // 36 //
37 // The CandidateSessionConfig class represents list of configurations 37 // The CandidateSessionConfig class represents list of configurations
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 DECLINE, 81 DECLINE,
82 }; 82 };
83 83
84 // IncomingSessionCallback is called when a new session is 84 // IncomingSessionCallback is called when a new session is
85 // received. If the callback decides to accept the session it should 85 // received. If the callback decides to accept the session it should
86 // set the second argument to ACCEPT. Otherwise it should set it to 86 // set the second argument to ACCEPT. Otherwise it should set it to
87 // DECLINE, or INCOMPATIBLE. INCOMPATIBLE indicates that the session 87 // DECLINE, or INCOMPATIBLE. INCOMPATIBLE indicates that the session
88 // has incompatible configuration, and cannot be accepted. If the 88 // has incompatible configuration, and cannot be accepted. If the
89 // callback accepts session then it must also set configuration for 89 // callback accepts session then it must also set configuration for
90 // the new session using Session::set_config(). The callback must 90 // the new session using Session::set_config(). The callback must
91 // take ownership of the session if it accepts connection. 91 // take ownership of the session if it ACCEPTs connection.
Wez 2011/07/06 21:24:25 nit: "connection" -> "it" (the callback is ACCEPTi
Sergey Ulanov 2011/07/06 23:15:01 Done.
92 typedef Callback2<Session*, IncomingSessionResponse*>::Type 92 typedef Callback2<Session*, IncomingSessionResponse*>::Type
93 IncomingSessionCallback; 93 IncomingSessionCallback;
94 94
95 // Initializes the session client. Doesn't accept ownership of the 95 // Initializes the session client. Doesn't accept ownership of the
96 // |signal_strategy|. Close() must be called _before_ the |session_manager| 96 // |signal_strategy|. If this object is used in server mode, then
97 // is destroyed. 97 // |private_key| and |certificate| are used to establish a secured
98 // If this object is used in server mode, then |private_key| and 98 // communication with the client. It will also take ownership of
99 // |certificate| are used to establish a secured communication with the 99 // these objects. In case this is used in client mode, pass in NULL
100 // client. It will also take ownership of these objects. 100 // for both private key and certificate.
Wez 2011/07/06 21:24:25 nit: "Doesn't accept..." -> "Caller retains owners
Sergey Ulanov 2011/07/06 23:15:01 Done
101 // In case this is used in client mode, pass in NULL for both private key and
102 // certificate.
103 virtual void Init(const std::string& local_jid, 101 virtual void Init(const std::string& local_jid,
104 SignalStrategy* signal_strategy, 102 SignalStrategy* signal_strategy,
105 IncomingSessionCallback* incoming_session_callback, 103 IncomingSessionCallback* incoming_session_callback,
106 crypto::RSAPrivateKey* private_key, 104 crypto::RSAPrivateKey* private_key,
107 scoped_refptr<net::X509Certificate> certificate) = 0; 105 scoped_refptr<net::X509Certificate> certificate) = 0;
108 106
109 // Tries to create a session to the host |jid|. 107 // Tries to create a session to the host |jid|.
110 // 108 //
111 // |host_jid| is the full jid of the host to connect to. 109 // |host_jid| is the full jid of the host to connect to.
112 // |host_public_key| is used to for authentication. 110 // |host_public_key| is used to for authentication.
113 // |client_oauth_token| is a short-lived OAuth token identify the client. 111 // |client_oauth_token| is a short-lived OAuth token identify the client.
114 // |config| contains the session configurations that the client supports. 112 // |config| contains the session configurations that the client supports.
115 // |state_change_callback| is called when the connection state changes. 113 // |state_change_callback| is called when the connection state changes.
116 // 114 //
117 // This function may be called from any thread. The |state_change_callback|
118 // is invoked on the network thread.
119 //
120 // Ownership of the |config| is passed to the new session. 115 // Ownership of the |config| is passed to the new session.
121 virtual Session* Connect( 116 virtual Session* Connect(
122 const std::string& host_jid, 117 const std::string& host_jid,
123 const std::string& host_public_key, 118 const std::string& host_public_key,
124 const std::string& client_token, 119 const std::string& client_token,
125 CandidateSessionConfig* config, 120 CandidateSessionConfig* config,
126 Session::StateChangeCallback* state_change_callback) = 0; 121 Session::StateChangeCallback* state_change_callback) = 0;
127 122
128 // Close session manager and all current sessions. No callbacks are 123 // Close session manager and all current sessions. No callbacks are
129 // called after this method returns. 124 // called after this method returns.
130 virtual void Close() = 0; 125 virtual void Close() = 0;
131 126
132 private: 127 private:
133 DISALLOW_COPY_AND_ASSIGN(SessionManager); 128 DISALLOW_COPY_AND_ASSIGN(SessionManager);
134 }; 129 };
135 130
136 } // namespace protocol 131 } // namespace protocol
137 } // namespace remoting 132 } // namespace remoting
138 133
139 #endif // REMOTING_PROTOCOL_SESSION_MANAGER_H_ 134 #endif // REMOTING_PROTOCOL_SESSION_MANAGER_H_
OLDNEW
« remoting/protocol/jingle_session_manager.cc ('K') | « remoting/protocol/jingle_session_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698