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 <string> | 8 #include <string> |
9 | 9 |
10 #include "remoting/protocol/channel_factory.h" | |
11 #include "remoting/protocol/errors.h" | 10 #include "remoting/protocol/errors.h" |
12 #include "remoting/protocol/session_config.h" | 11 #include "remoting/protocol/session_config.h" |
13 | 12 |
14 namespace net { | 13 namespace net { |
15 class IPEndPoint; | 14 class IPEndPoint; |
16 } // namespace net | 15 } // namespace net |
17 | 16 |
18 namespace remoting { | 17 namespace remoting { |
19 namespace protocol { | 18 namespace protocol { |
20 | 19 |
| 20 class ChannelFactory; |
21 struct TransportRoute; | 21 struct TransportRoute; |
22 | 22 |
23 // Generic interface for Chromotocol connection used by both client and host. | 23 // Generic interface for Chromotocol connection used by both client and host. |
24 // Provides access to the connection channels, but doesn't depend on the | 24 // Provides access to the connection channels, but doesn't depend on the |
25 // protocol used for each channel. | 25 // protocol used for each channel. |
26 class Session : public ChannelFactory { | 26 class Session { |
27 public: | 27 public: |
28 enum State { | 28 enum State { |
29 // Created, but not connecting yet. | 29 // Created, but not connecting yet. |
30 INITIALIZING, | 30 INITIALIZING, |
31 | 31 |
32 // Sent or received session-initiate, but haven't sent or received | 32 // Sent or received session-initiate, but haven't sent or received |
33 // session-accept. | 33 // session-accept. |
34 // TODO(sergeyu): Do we really need this state? | 34 // TODO(sergeyu): Do we really need this state? |
35 CONNECTING, | 35 CONNECTING, |
36 | 36 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 // Protocol configuration. Can be called only after session has been accepted. | 92 // Protocol configuration. Can be called only after session has been accepted. |
93 // Returned pointer is valid until connection is closed. | 93 // Returned pointer is valid until connection is closed. |
94 virtual const SessionConfig& config() = 0; | 94 virtual const SessionConfig& config() = 0; |
95 | 95 |
96 // Set protocol configuration for an incoming session. Must be | 96 // Set protocol configuration for an incoming session. Must be |
97 // called on the host before the connection is accepted, from | 97 // called on the host before the connection is accepted, from |
98 // ChromotocolServer::IncomingConnectionCallback. | 98 // ChromotocolServer::IncomingConnectionCallback. |
99 virtual void set_config(const SessionConfig& config) = 0; | 99 virtual void set_config(const SessionConfig& config) = 0; |
100 | 100 |
| 101 // GetTransportChannelFactory() returns a factory that creates a new transport |
| 102 // channel for each logical channel. GetMultiplexedChannelFactory() channels |
| 103 // share a single underlying transport channel |
| 104 virtual ChannelFactory* GetTransportChannelFactory() = 0; |
| 105 virtual ChannelFactory* GetMultiplexedChannelFactory() = 0; |
| 106 |
101 // Closes connection. Callbacks are guaranteed not to be called | 107 // Closes connection. Callbacks are guaranteed not to be called |
102 // after this method returns. Must be called before the object is | 108 // after this method returns. Must be called before the object is |
103 // destroyed, unless the state is set to FAILED or CLOSED. | 109 // destroyed, unless the state is set to FAILED or CLOSED. |
104 virtual void Close() = 0; | 110 virtual void Close() = 0; |
105 | 111 |
106 private: | 112 private: |
107 DISALLOW_COPY_AND_ASSIGN(Session); | 113 DISALLOW_COPY_AND_ASSIGN(Session); |
108 }; | 114 }; |
109 | 115 |
110 } // namespace protocol | 116 } // namespace protocol |
111 } // namespace remoting | 117 } // namespace remoting |
112 | 118 |
113 #endif // REMOTING_PROTOCOL_SESSION_H_ | 119 #endif // REMOTING_PROTOCOL_SESSION_H_ |
OLD | NEW |