| 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_QUIC_SESSION_H_ | 7 #ifndef NET_QUIC_QUIC_SESSION_H_ |
| 8 #define NET_QUIC_QUIC_SESSION_H_ | 8 #define NET_QUIC_QUIC_SESSION_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // connection should resend any packets that were sent under | 47 // connection should resend any packets that were sent under |
| 48 // ENCRYPTION_INITIAL. (Client only.) | 48 // ENCRYPTION_INITIAL. (Client only.) |
| 49 ENCRYPTION_REESTABLISHED, | 49 ENCRYPTION_REESTABLISHED, |
| 50 // HANDSHAKE_CONFIRMED, in a client, indicates the the server has accepted | 50 // HANDSHAKE_CONFIRMED, in a client, indicates the the server has accepted |
| 51 // our handshake. In a server it indicates that a full, valid client hello | 51 // our handshake. In a server it indicates that a full, valid client hello |
| 52 // has been received. (Client and server.) | 52 // has been received. (Client and server.) |
| 53 HANDSHAKE_CONFIRMED, | 53 HANDSHAKE_CONFIRMED, |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 QuicSession(QuicConnection* connection, | 56 QuicSession(QuicConnection* connection, |
| 57 const QuicConfig& config, | 57 const QuicConfig& config); |
| 58 bool is_server); | |
| 59 | 58 |
| 60 virtual ~QuicSession(); | 59 virtual ~QuicSession(); |
| 61 | 60 |
| 62 // QuicConnectionVisitorInterface methods: | 61 // QuicConnectionVisitorInterface methods: |
| 63 virtual bool OnStreamFrames( | 62 virtual bool OnStreamFrames( |
| 64 const std::vector<QuicStreamFrame>& frames) OVERRIDE; | 63 const std::vector<QuicStreamFrame>& frames) OVERRIDE; |
| 65 virtual void OnRstStream(const QuicRstStreamFrame& frame) OVERRIDE; | 64 virtual void OnRstStream(const QuicRstStreamFrame& frame) OVERRIDE; |
| 66 virtual void OnGoAway(const QuicGoAwayFrame& frame) OVERRIDE; | 65 virtual void OnGoAway(const QuicGoAwayFrame& frame) OVERRIDE; |
| 67 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; | 66 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; |
| 68 virtual void OnSuccessfulVersionNegotiation( | 67 virtual void OnSuccessfulVersionNegotiation( |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 165 } |
| 167 | 166 |
| 168 QuicSpdyDecompressor* decompressor() { return &decompressor_; } | 167 QuicSpdyDecompressor* decompressor() { return &decompressor_; } |
| 169 QuicSpdyCompressor* compressor() { return &compressor_; } | 168 QuicSpdyCompressor* compressor() { return &compressor_; } |
| 170 | 169 |
| 171 // Gets the SSL connection information. | 170 // Gets the SSL connection information. |
| 172 virtual bool GetSSLInfo(SSLInfo* ssl_info); | 171 virtual bool GetSSLInfo(SSLInfo* ssl_info); |
| 173 | 172 |
| 174 QuicErrorCode error() const { return error_; } | 173 QuicErrorCode error() const { return error_; } |
| 175 | 174 |
| 176 bool is_server() const { return is_server_; } | 175 bool is_server() const { return connection_->is_server(); } |
| 177 | 176 |
| 178 protected: | 177 protected: |
| 179 typedef base::hash_map<QuicStreamId, QuicDataStream*> DataStreamMap; | 178 typedef base::hash_map<QuicStreamId, QuicDataStream*> DataStreamMap; |
| 180 | 179 |
| 181 // Creates a new stream, owned by the caller, to handle a peer-initiated | 180 // Creates a new stream, owned by the caller, to handle a peer-initiated |
| 182 // stream. Returns NULL and does error handling if the stream can not be | 181 // stream. Returns NULL and does error handling if the stream can not be |
| 183 // created. | 182 // created. |
| 184 virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) = 0; | 183 virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) = 0; |
| 185 | 184 |
| 186 // Create a new stream, owned by the caller, to handle a locally-initiated | 185 // Create a new stream, owned by the caller, to handle a locally-initiated |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 QuicSpdyCompressor compressor_; | 266 QuicSpdyCompressor compressor_; |
| 268 | 267 |
| 269 QuicConfig config_; | 268 QuicConfig config_; |
| 270 | 269 |
| 271 // Returns the maximum number of streams this connection can open. | 270 // Returns the maximum number of streams this connection can open. |
| 272 size_t max_open_streams_; | 271 size_t max_open_streams_; |
| 273 | 272 |
| 274 // Map from StreamId to pointers to streams that are owned by the caller. | 273 // Map from StreamId to pointers to streams that are owned by the caller. |
| 275 DataStreamMap stream_map_; | 274 DataStreamMap stream_map_; |
| 276 QuicStreamId next_stream_id_; | 275 QuicStreamId next_stream_id_; |
| 277 bool is_server_; | |
| 278 | 276 |
| 279 // Set of stream ids that have been "implicitly created" by receipt | 277 // Set of stream ids that have been "implicitly created" by receipt |
| 280 // of a stream id larger than the next expected stream id. | 278 // of a stream id larger than the next expected stream id. |
| 281 base::hash_set<QuicStreamId> implicitly_created_streams_; | 279 base::hash_set<QuicStreamId> implicitly_created_streams_; |
| 282 | 280 |
| 283 // A list of streams which need to write more data. | 281 // A list of streams which need to write more data. |
| 284 WriteBlockedList<QuicStreamId> write_blocked_streams_; | 282 WriteBlockedList<QuicStreamId> write_blocked_streams_; |
| 285 | 283 |
| 286 // A map of headers waiting to be compressed, and the streams | 284 // A map of headers waiting to be compressed, and the streams |
| 287 // they are associated with. | 285 // they are associated with. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 299 | 297 |
| 300 // Indicate if there is pending data for the crypto stream. | 298 // Indicate if there is pending data for the crypto stream. |
| 301 bool has_pending_handshake_; | 299 bool has_pending_handshake_; |
| 302 | 300 |
| 303 DISALLOW_COPY_AND_ASSIGN(QuicSession); | 301 DISALLOW_COPY_AND_ASSIGN(QuicSession); |
| 304 }; | 302 }; |
| 305 | 303 |
| 306 } // namespace net | 304 } // namespace net |
| 307 | 305 |
| 308 #endif // NET_QUIC_QUIC_SESSION_H_ | 306 #endif // NET_QUIC_QUIC_SESSION_H_ |
| OLD | NEW |