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_SESSION_H_ | 5 #ifndef REMOTING_PROTOCOL_SESSION_H_ |
6 #define REMOTING_PROTOCOL_SESSION_H_ | 6 #define REMOTING_PROTOCOL_SESSION_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "remoting/protocol/errors.h" | 12 #include "remoting/protocol/errors.h" |
12 #include "remoting/protocol/session_config.h" | 13 #include "remoting/protocol/session_config.h" |
13 #include "remoting/protocol/transport.h" | 14 #include "remoting/protocol/transport.h" |
14 | 15 |
15 namespace remoting { | 16 namespace remoting { |
16 namespace protocol { | 17 namespace protocol { |
17 | 18 |
| 19 class SessionPlugin; |
18 class Transport; | 20 class Transport; |
19 | 21 |
20 // Session is responsible for initializing and authenticating both incoming and | 22 // Session is responsible for initializing and authenticating both incoming and |
21 // outgoing connections. It uses TransportInfoSink interface to pass | 23 // outgoing connections. It uses TransportInfoSink interface to pass |
22 // transport-info messages to the transport. | 24 // transport-info messages to the transport. |
23 class Session { | 25 class Session { |
24 public: | 26 public: |
25 enum State { | 27 enum State { |
26 // Created, but not connecting yet. | 28 // Created, but not connecting yet. |
27 INITIALIZING, | 29 INITIALIZING, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 80 |
79 // Sets Transport to be used by the session. Must be called before the | 81 // Sets Transport to be used by the session. Must be called before the |
80 // session becomes AUTHENTICATED. The transport must outlive the session. | 82 // session becomes AUTHENTICATED. The transport must outlive the session. |
81 virtual void SetTransport(Transport* transport) = 0; | 83 virtual void SetTransport(Transport* transport) = 0; |
82 | 84 |
83 // Closes connection. EventHandler is guaranteed not to be called after this | 85 // Closes connection. EventHandler is guaranteed not to be called after this |
84 // method returns. |error| specifies the error code in case when the session | 86 // method returns. |error| specifies the error code in case when the session |
85 // is being closed due to an error. | 87 // is being closed due to an error. |
86 virtual void Close(ErrorCode error) = 0; | 88 virtual void Close(ErrorCode error) = 0; |
87 | 89 |
| 90 // Attaches a SessionPlugin to handle attachments. |plugin| should not be an |
| 91 // empty std::unique_ptr. |
| 92 virtual void Attach(std::unique_ptr<SessionPlugin> plugin) = 0; |
| 93 |
88 private: | 94 private: |
89 DISALLOW_COPY_AND_ASSIGN(Session); | 95 DISALLOW_COPY_AND_ASSIGN(Session); |
90 }; | 96 }; |
91 | 97 |
92 } // namespace protocol | 98 } // namespace protocol |
93 } // namespace remoting | 99 } // namespace remoting |
94 | 100 |
95 #endif // REMOTING_PROTOCOL_SESSION_H_ | 101 #endif // REMOTING_PROTOCOL_SESSION_H_ |
OLD | NEW |