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/errors.h" | 10 #include "remoting/protocol/errors.h" |
11 #include "remoting/protocol/session_config.h" | 11 #include "remoting/protocol/session_config.h" |
12 | 12 |
13 namespace net { | |
14 class IPEndPoint; | |
15 } // namespace net | |
16 | |
17 namespace remoting { | 13 namespace remoting { |
18 namespace protocol { | 14 namespace protocol { |
19 | 15 |
20 class StreamChannelFactory; | 16 class StreamChannelFactory; |
| 17 class TransportSession; |
21 struct TransportRoute; | 18 struct TransportRoute; |
22 | 19 |
23 // Generic interface for Chromotocol connection used by both client and host. | 20 // Generic interface for Chromotocol connection used by both client and host. |
24 // Provides access to the connection channels, but doesn't depend on the | 21 // Provides access to the connection channels, but doesn't depend on the |
25 // protocol used for each channel. | 22 // protocol used for each channel. |
26 class Session { | 23 class Session { |
27 public: | 24 public: |
28 enum State { | 25 enum State { |
29 // Created, but not connecting yet. | 26 // Created, but not connecting yet. |
30 INITIALIZING, | 27 INITIALIZING, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // Returns error code for a failed session. | 75 // Returns error code for a failed session. |
79 virtual ErrorCode error() = 0; | 76 virtual ErrorCode error() = 0; |
80 | 77 |
81 // JID of the other side. | 78 // JID of the other side. |
82 virtual const std::string& jid() = 0; | 79 virtual const std::string& jid() = 0; |
83 | 80 |
84 // Protocol configuration. Can be called only after session has been accepted. | 81 // Protocol configuration. Can be called only after session has been accepted. |
85 // Returned pointer is valid until connection is closed. | 82 // Returned pointer is valid until connection is closed. |
86 virtual const SessionConfig& config() = 0; | 83 virtual const SessionConfig& config() = 0; |
87 | 84 |
88 // GetTransportChannelFactory() returns a factory that creates a new transport | 85 // Returns TransportSession that can be used to create transport channels. |
89 // channel for each logical channel. GetMultiplexedChannelFactory() channels | 86 virtual TransportSession* GetTransportSession() = 0; |
90 // share a single underlying transport channel | 87 |
91 virtual StreamChannelFactory* GetTransportChannelFactory() = 0; | 88 // Channel factory for QUIC-based channels. Returns nullptr when QUIC is |
92 virtual StreamChannelFactory* GetMultiplexedChannelFactory() = 0; | 89 // disabled for the session. |
93 virtual StreamChannelFactory* GetQuicChannelFactory() = 0; | 90 virtual StreamChannelFactory* GetQuicChannelFactory() = 0; |
94 | 91 |
95 // Closes connection. Callbacks are guaranteed not to be called | 92 // Closes connection. Callbacks are guaranteed not to be called |
96 // after this method returns. Must be called before the object is | 93 // after this method returns. Must be called before the object is |
97 // destroyed, unless the state is set to FAILED or CLOSED. | 94 // destroyed, unless the state is set to FAILED or CLOSED. |
98 virtual void Close() = 0; | 95 virtual void Close() = 0; |
99 | 96 |
100 private: | 97 private: |
101 DISALLOW_COPY_AND_ASSIGN(Session); | 98 DISALLOW_COPY_AND_ASSIGN(Session); |
102 }; | 99 }; |
103 | 100 |
104 } // namespace protocol | 101 } // namespace protocol |
105 } // namespace remoting | 102 } // namespace remoting |
106 | 103 |
107 #endif // REMOTING_PROTOCOL_SESSION_H_ | 104 #endif // REMOTING_PROTOCOL_SESSION_H_ |
OLD | NEW |