| 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 // 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ACCEPT, | 82 ACCEPT, |
| 83 INCOMPATIBLE, | 83 INCOMPATIBLE, |
| 84 DECLINE, | 84 DECLINE, |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 class Listener { | 87 class Listener { |
| 88 public: | 88 public: |
| 89 Listener() { } | 89 Listener() { } |
| 90 ~Listener() { } | 90 ~Listener() { } |
| 91 | 91 |
| 92 // Called when the session manager has finished | 92 // Called when the session manager is ready to create outgoing |
| 93 // initialization. May be called from Init() or after Init() | 93 // sessions. May be called from Init() or after Init() |
| 94 // returns. Outgoing connections can be created after this method | 94 // returns. |
| 95 // is called. | 95 virtual void OnSessionManagerReady() = 0; |
| 96 virtual void OnSessionManagerInitialized() = 0; | |
| 97 | 96 |
| 98 // Called when a new session is received. If the host decides to | 97 // Called when a new session is received. If the host decides to |
| 99 // accept the session it should set the |response| to | 98 // accept the session it should set the |response| to |
| 100 // ACCEPT. Otherwise it should set it to DECLINE, or | 99 // ACCEPT. Otherwise it should set it to DECLINE, or |
| 101 // INCOMPATIBLE. INCOMPATIBLE indicates that the session has | 100 // INCOMPATIBLE. INCOMPATIBLE indicates that the session has |
| 102 // incompatible configuration, and cannot be accepted. If the | 101 // incompatible configuration, and cannot be accepted. If the |
| 103 // callback accepts the |session| then it must also set | 102 // callback accepts the |session| then it must also set |
| 104 // configuration for the |session| using Session::set_config(). | 103 // configuration for the |session| using Session::set_config(). |
| 105 // The callback must take ownership of the |session| if it ACCEPTs it. | 104 // The callback must take ownership of the |session| if it ACCEPTs it. |
| 106 virtual void OnIncomingSession(Session* session, | 105 virtual void OnIncomingSession(Session* session, |
| 107 IncomingSessionResponse* response) = 0; | 106 IncomingSessionResponse* response) = 0; |
| 108 }; | 107 }; |
| 109 | 108 |
| 110 // Initializes the session client. Caller retains ownership of the | 109 // Initializes the session client. Caller retains ownership of the |
| 111 // |signal_strategy| and |listener|. |allow_nat_traversal| must be | 110 // |signal_strategy| and |listener|. |allow_nat_traversal| must be |
| 112 // set to true to enable NAT traversal. STUN/Relay servers are not | 111 // set to true to enable NAT traversal. STUN/Relay servers are not |
| 113 // used when NAT traversal is disabled, so P2P connection will work | 112 // used when NAT traversal is disabled, so P2P connection will work |
| 114 // only when both peers are on the same network. If this object is | 113 // only when both peers are on the same network. If this object is |
| 115 // used in server mode, then |private_key| and |certificate| are | 114 // used in server mode, then |private_key| and |certificate| are |
| 116 // used to establish a secured communication with the client. It | 115 // used to establish a secured communication with the client. It |
| 117 // will also take ownership of these objects. On the client side | 116 // will also take ownership of these objects. On the client side |
| 118 // pass in NULL for |private_key| and empty string for | 117 // pass in NULL for |private_key| and empty string for |
| 119 // |certificate|. | 118 // |certificate|. |
| 120 virtual void Init(const std::string& local_jid, | 119 virtual void Init(SignalStrategy* signal_strategy, |
| 121 SignalStrategy* signal_strategy, | |
| 122 Listener* listener, | 120 Listener* listener, |
| 123 bool allow_nat_traversal) = 0; | 121 bool allow_nat_traversal) = 0; |
| 124 | 122 |
| 125 // Tries to create a session to the host |jid|. Must be called only | 123 // Tries to create a session to the host |jid|. Must be called only |
| 126 // after initialization has finished successfully, i.e. after | 124 // after initialization has finished successfully, i.e. after |
| 127 // Listener::OnInitialized() has been called. | 125 // Listener::OnInitialized() has been called. |
| 128 // | 126 // |
| 129 // |host_jid| is the full jid of the host to connect to. | 127 // |host_jid| is the full jid of the host to connect to. |
| 130 // |host_public_key| is used to for authentication. | 128 // |host_public_key| is used to for authentication. |
| 131 // |authenticator| is a client authenticator for the session. | 129 // |authenticator| is a client authenticator for the session. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 151 AuthenticatorFactory* authenticator_factory) = 0; | 149 AuthenticatorFactory* authenticator_factory) = 0; |
| 152 | 150 |
| 153 private: | 151 private: |
| 154 DISALLOW_COPY_AND_ASSIGN(SessionManager); | 152 DISALLOW_COPY_AND_ASSIGN(SessionManager); |
| 155 }; | 153 }; |
| 156 | 154 |
| 157 } // namespace protocol | 155 } // namespace protocol |
| 158 } // namespace remoting | 156 } // namespace remoting |
| 159 | 157 |
| 160 #endif // REMOTING_PROTOCOL_SESSION_MANAGER_H_ | 158 #endif // REMOTING_PROTOCOL_SESSION_MANAGER_H_ |
| OLD | NEW |