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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // the server and thus the encryption key has been updated. Therefore the | 45 // the server and thus the encryption key has been updated. Therefore the |
46 // connection should resend any packets that were sent under | 46 // connection should resend any packets that were sent under |
47 // ENCRYPTION_INITIAL. (Client only.) | 47 // ENCRYPTION_INITIAL. (Client only.) |
48 ENCRYPTION_REESTABLISHED, | 48 ENCRYPTION_REESTABLISHED, |
49 // HANDSHAKE_CONFIRMED, in a client, indicates the the server has accepted | 49 // HANDSHAKE_CONFIRMED, in a client, indicates the the server has accepted |
50 // our handshake. In a server it indicates that a full, valid client hello | 50 // our handshake. In a server it indicates that a full, valid client hello |
51 // has been received. (Client and server.) | 51 // has been received. (Client and server.) |
52 HANDSHAKE_CONFIRMED, | 52 HANDSHAKE_CONFIRMED, |
53 }; | 53 }; |
54 | 54 |
55 QuicSession(QuicConnection* connection, const QuicConfig& config); | 55 QuicSession(QuicConnection* connection, |
| 56 const QuicConfig& config, |
| 57 bool is_secure); |
56 void InitializeSession(); | 58 void InitializeSession(); |
57 | 59 |
58 ~QuicSession() override; | 60 ~QuicSession() override; |
59 | 61 |
60 // QuicConnectionVisitorInterface methods: | 62 // QuicConnectionVisitorInterface methods: |
61 void OnStreamFrames(const std::vector<QuicStreamFrame>& frames) override; | 63 void OnStreamFrames(const std::vector<QuicStreamFrame>& frames) override; |
62 void OnRstStream(const QuicRstStreamFrame& frame) override; | 64 void OnRstStream(const QuicRstStreamFrame& frame) override; |
63 void OnGoAway(const QuicGoAwayFrame& frame) override; | 65 void OnGoAway(const QuicGoAwayFrame& frame) override; |
64 void OnWindowUpdateFrames( | 66 void OnWindowUpdateFrames( |
65 const std::vector<QuicWindowUpdateFrame>& frames) override; | 67 const std::vector<QuicWindowUpdateFrame>& frames) override; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 bool is_server() const { return connection_->is_server(); } | 204 bool is_server() const { return connection_->is_server(); } |
203 | 205 |
204 QuicFlowController* flow_controller() { return flow_controller_.get(); } | 206 QuicFlowController* flow_controller() { return flow_controller_.get(); } |
205 | 207 |
206 // Returns true if connection is flow controller blocked. | 208 // Returns true if connection is flow controller blocked. |
207 bool IsConnectionFlowControlBlocked() const; | 209 bool IsConnectionFlowControlBlocked() const; |
208 | 210 |
209 // Returns true if any stream is flow controller blocked. | 211 // Returns true if any stream is flow controller blocked. |
210 bool IsStreamFlowControlBlocked(); | 212 bool IsStreamFlowControlBlocked(); |
211 | 213 |
| 214 // Returns true if this is a secure QUIC session. |
| 215 bool is_secure() const { |
| 216 return is_secure_; |
| 217 } |
| 218 |
212 size_t get_max_open_streams() const { return max_open_streams_; } | 219 size_t get_max_open_streams() const { return max_open_streams_; } |
213 | 220 |
214 protected: | 221 protected: |
215 typedef base::hash_map<QuicStreamId, QuicDataStream*> DataStreamMap; | 222 typedef base::hash_map<QuicStreamId, QuicDataStream*> DataStreamMap; |
216 | 223 |
217 // Creates a new stream, owned by the caller, to handle a peer-initiated | 224 // Creates a new stream, owned by the caller, to handle a peer-initiated |
218 // stream. Returns nullptr and does error handling if the stream can not be | 225 // stream. Returns nullptr and does error handling if the stream can not be |
219 // created. | 226 // created. |
220 virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) = 0; | 227 virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) = 0; |
221 | 228 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 bool goaway_received_; | 326 bool goaway_received_; |
320 // Whether a GoAway has been sent. | 327 // Whether a GoAway has been sent. |
321 bool goaway_sent_; | 328 bool goaway_sent_; |
322 | 329 |
323 // Indicate if there is pending data for the crypto stream. | 330 // Indicate if there is pending data for the crypto stream. |
324 bool has_pending_handshake_; | 331 bool has_pending_handshake_; |
325 | 332 |
326 // Used for session level flow control. | 333 // Used for session level flow control. |
327 scoped_ptr<QuicFlowController> flow_controller_; | 334 scoped_ptr<QuicFlowController> flow_controller_; |
328 | 335 |
| 336 // True if this is a secure (HTTPS) QUIC session. |
| 337 bool is_secure_; |
| 338 |
329 DISALLOW_COPY_AND_ASSIGN(QuicSession); | 339 DISALLOW_COPY_AND_ASSIGN(QuicSession); |
330 }; | 340 }; |
331 | 341 |
332 } // namespace net | 342 } // namespace net |
333 | 343 |
334 #endif // NET_QUIC_QUIC_SESSION_H_ | 344 #endif // NET_QUIC_QUIC_SESSION_H_ |
OLD | NEW |