| 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 // A QuicSession, which demuxes a single connection to individual streams. | 5 // A QuicSession, which demuxes a single connection to individual streams. |
| 6 | 6 |
| 7 #ifndef NET_QUIC_CORE_QUIC_SESSION_H_ | 7 #ifndef NET_QUIC_CORE_QUIC_SESSION_H_ |
| 8 #define NET_QUIC_CORE_QUIC_SESSION_H_ | 8 #define NET_QUIC_CORE_QUIC_SESSION_H_ |
| 9 | 9 |
| 10 #include <cstddef> | 10 #include <cstddef> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 QuicStreamOffset bytes_written); | 131 QuicStreamOffset bytes_written); |
| 132 | 132 |
| 133 // Called when the session wants to go away and not accept any new streams. | 133 // Called when the session wants to go away and not accept any new streams. |
| 134 void SendGoAway(QuicErrorCode error_code, const std::string& reason); | 134 void SendGoAway(QuicErrorCode error_code, const std::string& reason); |
| 135 | 135 |
| 136 // Removes the stream associated with 'stream_id' from the active stream map. | 136 // Removes the stream associated with 'stream_id' from the active stream map. |
| 137 virtual void CloseStream(QuicStreamId stream_id); | 137 virtual void CloseStream(QuicStreamId stream_id); |
| 138 | 138 |
| 139 // Returns true if outgoing packets will be encrypted, even if the server | 139 // Returns true if outgoing packets will be encrypted, even if the server |
| 140 // hasn't confirmed the handshake yet. | 140 // hasn't confirmed the handshake yet. |
| 141 virtual bool IsEncryptionEstablished(); | 141 virtual bool IsEncryptionEstablished() const; |
| 142 | 142 |
| 143 // For a client, returns true if the server has confirmed our handshake. For | 143 // For a client, returns true if the server has confirmed our handshake. For |
| 144 // a server, returns true if a full, valid client hello has been received. | 144 // a server, returns true if a full, valid client hello has been received. |
| 145 virtual bool IsCryptoHandshakeConfirmed(); | 145 virtual bool IsCryptoHandshakeConfirmed() const; |
| 146 | 146 |
| 147 // Called by the QuicCryptoStream when a new QuicConfig has been negotiated. | 147 // Called by the QuicCryptoStream when a new QuicConfig has been negotiated. |
| 148 virtual void OnConfigNegotiated(); | 148 virtual void OnConfigNegotiated(); |
| 149 | 149 |
| 150 // Called by the QuicCryptoStream when the handshake enters a new state. | 150 // Called by the QuicCryptoStream when the handshake enters a new state. |
| 151 // | 151 // |
| 152 // Clients will call this function in the order: | 152 // Clients will call this function in the order: |
| 153 // ENCRYPTION_FIRST_ESTABLISHED | 153 // ENCRYPTION_FIRST_ESTABLISHED |
| 154 // zero or more ENCRYPTION_REESTABLISHED | 154 // zero or more ENCRYPTION_REESTABLISHED |
| 155 // HANDSHAKE_CONFIRMED | 155 // HANDSHAKE_CONFIRMED |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // Caller does not own the returned stream. | 260 // Caller does not own the returned stream. |
| 261 // Returns nullptr and does error handling if the stream can not be created. | 261 // Returns nullptr and does error handling if the stream can not be created. |
| 262 virtual QuicStream* CreateIncomingDynamicStream(QuicStreamId id) = 0; | 262 virtual QuicStream* CreateIncomingDynamicStream(QuicStreamId id) = 0; |
| 263 | 263 |
| 264 // Create a new stream to handle a locally-initiated stream. | 264 // Create a new stream to handle a locally-initiated stream. |
| 265 // Caller does not own the returned stream. | 265 // Caller does not own the returned stream. |
| 266 // Returns nullptr if max streams have already been opened. | 266 // Returns nullptr if max streams have already been opened. |
| 267 virtual QuicStream* CreateOutgoingDynamicStream(SpdyPriority priority) = 0; | 267 virtual QuicStream* CreateOutgoingDynamicStream(SpdyPriority priority) = 0; |
| 268 | 268 |
| 269 // Return the reserved crypto stream. | 269 // Return the reserved crypto stream. |
| 270 virtual QuicCryptoStream* GetCryptoStream() = 0; | 270 virtual QuicCryptoStream* GetMutableCryptoStream() = 0; |
| 271 |
| 272 // Return the reserved crypto stream as a constant pointer. |
| 273 virtual const QuicCryptoStream* GetCryptoStream() const = 0; |
| 271 | 274 |
| 272 // Adds |stream| to the dynamic stream map. | 275 // Adds |stream| to the dynamic stream map. |
| 273 virtual void ActivateStream(std::unique_ptr<QuicStream> stream); | 276 virtual void ActivateStream(std::unique_ptr<QuicStream> stream); |
| 274 | 277 |
| 275 // Returns the stream ID for a new outgoing stream, and increments the | 278 // Returns the stream ID for a new outgoing stream, and increments the |
| 276 // underlying counter. | 279 // underlying counter. |
| 277 QuicStreamId GetNextOutgoingStreamId(); | 280 QuicStreamId GetNextOutgoingStreamId(); |
| 278 | 281 |
| 279 // Returns existing stream with id = |stream_id|. If no such stream exists, | 282 // Returns existing stream with id = |stream_id|. If no such stream exists, |
| 280 // and |stream_id| is a peer-created id, then a new stream is created and | 283 // and |stream_id| is a peer-created id, then a new stream is created and |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 // The stream id which was last popped in OnCanWrite, or 0, if not under the | 441 // The stream id which was last popped in OnCanWrite, or 0, if not under the |
| 439 // call stack of OnCanWrite. | 442 // call stack of OnCanWrite. |
| 440 QuicStreamId currently_writing_stream_id_; | 443 QuicStreamId currently_writing_stream_id_; |
| 441 | 444 |
| 442 DISALLOW_COPY_AND_ASSIGN(QuicSession); | 445 DISALLOW_COPY_AND_ASSIGN(QuicSession); |
| 443 }; | 446 }; |
| 444 | 447 |
| 445 } // namespace net | 448 } // namespace net |
| 446 | 449 |
| 447 #endif // NET_QUIC_CORE_QUIC_SESSION_H_ | 450 #endif // NET_QUIC_CORE_QUIC_SESSION_H_ |
| OLD | NEW |