| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 HANDSHAKE_CONFIRMED, | 52 HANDSHAKE_CONFIRMED, |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 QuicSession(QuicConnection* connection, | 55 QuicSession(QuicConnection* connection, |
| 56 const QuicConfig& config, | 56 const QuicConfig& config, |
| 57 bool is_server); | 57 bool is_server); |
| 58 | 58 |
| 59 virtual ~QuicSession(); | 59 virtual ~QuicSession(); |
| 60 | 60 |
| 61 // QuicConnectionVisitorInterface methods: | 61 // QuicConnectionVisitorInterface methods: |
| 62 virtual bool OnPacket(const IPEndPoint& self_address, | 62 virtual bool OnStreamFrames( |
| 63 const IPEndPoint& peer_address, | 63 const std::vector<QuicStreamFrame>& frames) OVERRIDE; |
| 64 const QuicPacketHeader& header, | |
| 65 const std::vector<QuicStreamFrame>& frame) OVERRIDE; | |
| 66 virtual void OnRstStream(const QuicRstStreamFrame& frame) OVERRIDE; | 64 virtual void OnRstStream(const QuicRstStreamFrame& frame) OVERRIDE; |
| 67 virtual void OnGoAway(const QuicGoAwayFrame& frame) OVERRIDE; | 65 virtual void OnGoAway(const QuicGoAwayFrame& frame) OVERRIDE; |
| 68 virtual void ConnectionClose(QuicErrorCode error, bool from_peer) OVERRIDE; | 66 virtual void ConnectionClose(QuicErrorCode error, bool from_peer) OVERRIDE; |
| 69 virtual void OnSuccessfulVersionNegotiation( | 67 virtual void OnSuccessfulVersionNegotiation( |
| 70 const QuicVersion& version) OVERRIDE{} | 68 const QuicVersion& version) OVERRIDE{} |
| 71 // Not needed for HTTP. | 69 // Not needed for HTTP. |
| 72 virtual void OnAck(const SequenceNumberSet& acked_packets) OVERRIDE {} | |
| 73 virtual bool OnCanWrite() OVERRIDE; | 70 virtual bool OnCanWrite() OVERRIDE; |
| 71 virtual bool HasPendingHandshake() const OVERRIDE; |
| 74 | 72 |
| 75 // Called by streams when they want to write data to the peer. | 73 // Called by streams when they want to write data to the peer. |
| 76 // Returns a pair with the number of bytes consumed from data, and a boolean | 74 // Returns a pair with the number of bytes consumed from data, and a boolean |
| 77 // indicating if the fin bit was consumed. This does not indicate the data | 75 // indicating if the fin bit was consumed. This does not indicate the data |
| 78 // has been sent on the wire: it may have been turned into a packet and queued | 76 // has been sent on the wire: it may have been turned into a packet and queued |
| 79 // if the socket was unexpectedly blocked. | 77 // if the socket was unexpectedly blocked. |
| 80 virtual QuicConsumedData WritevData(QuicStreamId id, | 78 virtual QuicConsumedData WritevData(QuicStreamId id, |
| 81 const struct iovec* iov, | 79 const struct iovec* iov, |
| 82 int count, | 80 int iov_count, |
| 83 QuicStreamOffset offset, | 81 QuicStreamOffset offset, |
| 84 bool fin); | 82 bool fin); |
| 85 | 83 |
| 86 // Called by streams when they want to close the stream in both directions. | 84 // Called by streams when they want to close the stream in both directions. |
| 87 virtual void SendRstStream(QuicStreamId id, QuicRstStreamErrorCode error); | 85 virtual void SendRstStream(QuicStreamId id, QuicRstStreamErrorCode error); |
| 88 | 86 |
| 89 // Called when the session wants to go away and not accept any new streams. | 87 // Called when the session wants to go away and not accept any new streams. |
| 90 void SendGoAway(QuicErrorCode error_code, const std::string& reason); | 88 void SendGoAway(QuicErrorCode error_code, const std::string& reason); |
| 91 | 89 |
| 92 // Removes the stream associated with 'stream_id' from the active stream map. | 90 // Removes the stream associated with 'stream_id' from the active stream map. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 QuicStreamId largest_peer_created_stream_id_; | 277 QuicStreamId largest_peer_created_stream_id_; |
| 280 | 278 |
| 281 // The latched error with which the connection was closed. | 279 // The latched error with which the connection was closed. |
| 282 QuicErrorCode error_; | 280 QuicErrorCode error_; |
| 283 | 281 |
| 284 // Whether a GoAway has been received. | 282 // Whether a GoAway has been received. |
| 285 bool goaway_received_; | 283 bool goaway_received_; |
| 286 // Whether a GoAway has been sent. | 284 // Whether a GoAway has been sent. |
| 287 bool goaway_sent_; | 285 bool goaway_sent_; |
| 288 | 286 |
| 287 // Indicate if there is pending data for the crypto stream. |
| 288 bool has_pending_handshake_; |
| 289 |
| 289 DISALLOW_COPY_AND_ASSIGN(QuicSession); | 290 DISALLOW_COPY_AND_ASSIGN(QuicSession); |
| 290 }; | 291 }; |
| 291 | 292 |
| 292 } // namespace net | 293 } // namespace net |
| 293 | 294 |
| 294 #endif // NET_QUIC_QUIC_SESSION_H_ | 295 #endif // NET_QUIC_QUIC_SESSION_H_ |
| OLD | NEW |