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

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

Issue 8619011: Use Authenticator interface in Session and SessionManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittests Created 9 years 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
« no previous file with comments | « remoting/protocol/session.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #ifndef REMOTING_PROTOCOL_SESSION_MANAGER_H_ 45 #ifndef REMOTING_PROTOCOL_SESSION_MANAGER_H_
46 #define REMOTING_PROTOCOL_SESSION_MANAGER_H_ 46 #define REMOTING_PROTOCOL_SESSION_MANAGER_H_
47 47
48 #include <string> 48 #include <string>
49 49
50 #include "base/callback.h" 50 #include "base/callback.h"
51 #include "base/memory/ref_counted.h" 51 #include "base/memory/ref_counted.h"
52 #include "base/threading/non_thread_safe.h" 52 #include "base/threading/non_thread_safe.h"
53 #include "remoting/protocol/session.h" 53 #include "remoting/protocol/session.h"
54 54
55 namespace crypto {
56 class RSAPrivateKey;
57 } // namespace base
58
59 namespace remoting { 55 namespace remoting {
60 56
61 class SignalStrategy; 57 class SignalStrategy;
62 58
63 namespace protocol { 59 namespace protocol {
64 60
61 class Authenticator;
62 class AuthenticatorFactory;
63
65 // Generic interface for Chromoting session manager. 64 // Generic interface for Chromoting session manager.
66 // 65 //
67 // TODO(sergeyu): Split this into two separate interfaces: one for the 66 // TODO(sergeyu): Split this into two separate interfaces: one for the
68 // client side and one for the host side. 67 // client side and one for the host side.
69 class SessionManager : public base::NonThreadSafe { 68 class SessionManager : public base::NonThreadSafe {
70 public: 69 public:
71 SessionManager() { } 70 SessionManager() { }
72 virtual ~SessionManager() { } 71 virtual ~SessionManager() { }
73 72
74 enum IncomingSessionResponse { 73 enum IncomingSessionResponse {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // used when NAT traversal is disabled, so P2P connection will work 105 // used when NAT traversal is disabled, so P2P connection will work
107 // only when both peers are on the same network. If this object is 106 // only when both peers are on the same network. If this object is
108 // used in server mode, then |private_key| and |certificate| are 107 // used in server mode, then |private_key| and |certificate| are
109 // used to establish a secured communication with the client. It 108 // used to establish a secured communication with the client. It
110 // will also take ownership of these objects. On the client side 109 // will also take ownership of these objects. On the client side
111 // pass in NULL for |private_key| and empty string for 110 // pass in NULL for |private_key| and empty string for
112 // |certificate|. 111 // |certificate|.
113 virtual void Init(const std::string& local_jid, 112 virtual void Init(const std::string& local_jid,
114 SignalStrategy* signal_strategy, 113 SignalStrategy* signal_strategy,
115 Listener* listener, 114 Listener* listener,
116 crypto::RSAPrivateKey* private_key,
117 const std::string& certificate,
118 bool allow_nat_traversal) = 0; 115 bool allow_nat_traversal) = 0;
119 116
120 // Tries to create a session to the host |jid|. Must be called only 117 // Tries to create a session to the host |jid|. Must be called only
121 // after initialization has finished successfully, i.e. after 118 // after initialization has finished successfully, i.e. after
122 // Listener::OnInitialized() has been called. 119 // Listener::OnInitialized() has been called.
123 // 120 //
124 // |host_jid| is the full jid of the host to connect to. 121 // |host_jid| is the full jid of the host to connect to.
125 // |host_public_key| is used to for authentication. 122 // |host_public_key| is used to for authentication.
126 // |client_oauth_token| is a short-lived OAuth token identify the client. 123 // |authenticator| is a client authenticator for the session.
127 // |config| contains the session configurations that the client supports. 124 // |config| contains the session configurations that the client supports.
128 // |state_change_callback| is called when the connection state changes. 125 // |state_change_callback| is called when the connection state changes.
129 // 126 //
130 // Ownership of the |config| is passed to the new session. 127 // Ownership of the |config| is passed to the new session.
131 virtual Session* Connect( 128 virtual Session* Connect(
132 const std::string& host_jid, 129 const std::string& host_jid,
133 const std::string& host_public_key, 130 Authenticator* authenticator,
134 const std::string& client_token,
135 CandidateSessionConfig* config, 131 CandidateSessionConfig* config,
136 const Session::StateChangeCallback& state_change_callback) = 0; 132 const Session::StateChangeCallback& state_change_callback) = 0;
137 133
138 // Close session manager. Can be called only after all corresponding 134 // Close session manager. Can be called only after all corresponding
139 // sessions are destroyed. No callbacks are called after this method 135 // sessions are destroyed. No callbacks are called after this method
140 // returns. 136 // returns.
141 virtual void Close() = 0; 137 virtual void Close() = 0;
142 138
139 // Set authenticator factory that should be used to authenticate
140 // incoming connection. No connections will be accepted if
141 // authenticator factory isn't set.
142 virtual void set_authenticator_factory(
143 AuthenticatorFactory* authenticator_factory) = 0;
144
143 private: 145 private:
144 DISALLOW_COPY_AND_ASSIGN(SessionManager); 146 DISALLOW_COPY_AND_ASSIGN(SessionManager);
145 }; 147 };
146 148
147 } // namespace protocol 149 } // namespace protocol
148 } // namespace remoting 150 } // namespace remoting
149 151
150 #endif // REMOTING_PROTOCOL_SESSION_MANAGER_H_ 152 #endif // REMOTING_PROTOCOL_SESSION_MANAGER_H_
OLDNEW
« no previous file with comments | « remoting/protocol/session.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698