| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 OnPacket(const IPEndPoint& self_address, |
| 63 const IPEndPoint& peer_address, | 63 const IPEndPoint& peer_address, |
| 64 const QuicPacketHeader& header, | 64 const QuicPacketHeader& header, |
| 65 const std::vector<QuicStreamFrame>& frame) OVERRIDE; | 65 const std::vector<QuicStreamFrame>& frame) OVERRIDE; |
| 66 virtual void OnRstStream(const QuicRstStreamFrame& frame) OVERRIDE; | 66 virtual void OnRstStream(const QuicRstStreamFrame& frame) OVERRIDE; |
| 67 virtual void OnGoAway(const QuicGoAwayFrame& frame) OVERRIDE; | 67 virtual void OnGoAway(const QuicGoAwayFrame& frame) OVERRIDE; |
| 68 virtual void ConnectionClose(QuicErrorCode error, bool from_peer) OVERRIDE; | 68 virtual void ConnectionClose(QuicErrorCode error, bool from_peer) OVERRIDE; |
| 69 virtual void OnSuccessfulVersionNegotiation( |
| 70 const QuicVersion& version) OVERRIDE{} |
| 69 // Not needed for HTTP. | 71 // Not needed for HTTP. |
| 70 virtual void OnAck(const SequenceNumberSet& acked_packets) OVERRIDE {} | 72 virtual void OnAck(const SequenceNumberSet& acked_packets) OVERRIDE {} |
| 71 virtual bool OnCanWrite() OVERRIDE; | 73 virtual bool OnCanWrite() OVERRIDE; |
| 72 | 74 |
| 73 // Called by streams when they want to write data to the peer. | 75 // Called by streams when they want to write data to the peer. |
| 74 // Returns a pair with the number of bytes consumed from data, and a boolean | 76 // Returns a pair with the number of bytes consumed from data, and a boolean |
| 75 // indicating if the fin bit was consumed. This does not indicate the data | 77 // indicating if the fin bit was consumed. This does not indicate the data |
| 76 // has been sent on the wire: it may have been turned into a packet and queued | 78 // has been sent on the wire: it may have been turned into a packet and queued |
| 77 // if the socket was unexpectedly blocked. | 79 // if the socket was unexpectedly blocked. |
| 78 virtual QuicConsumedData WriteData(QuicStreamId id, | 80 virtual QuicConsumedData WritevData(QuicStreamId id, |
| 79 base::StringPiece data, | 81 const struct iovec* iov, |
| 80 QuicStreamOffset offset, | 82 int count, |
| 81 bool fin); | 83 QuicStreamOffset offset, |
| 84 bool fin); |
| 85 |
| 82 // Called by streams when they want to close the stream in both directions. | 86 // Called by streams when they want to close the stream in both directions. |
| 83 virtual void SendRstStream(QuicStreamId id, QuicRstStreamErrorCode error); | 87 virtual void SendRstStream(QuicStreamId id, QuicRstStreamErrorCode error); |
| 84 | 88 |
| 85 // Called when the session wants to go away and not accept any new streams. | 89 // Called when the session wants to go away and not accept any new streams. |
| 86 void SendGoAway(QuicErrorCode error_code, const std::string& reason); | 90 void SendGoAway(QuicErrorCode error_code, const std::string& reason); |
| 87 | 91 |
| 88 // Removes the stream associated with 'stream_id' from the active stream map. | 92 // Removes the stream associated with 'stream_id' from the active stream map. |
| 89 virtual void CloseStream(QuicStreamId stream_id); | 93 virtual void CloseStream(QuicStreamId stream_id); |
| 90 | 94 |
| 91 // Returns true if outgoing packets will be encrypted, even if the server | 95 // Returns true if outgoing packets will be encrypted, even if the server |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 return connection_->peer_address(); | 134 return connection_->peer_address(); |
| 131 } | 135 } |
| 132 QuicGuid guid() const { return connection_->guid(); } | 136 QuicGuid guid() const { return connection_->guid(); } |
| 133 | 137 |
| 134 QuicPacketCreator::Options* options() { return connection()->options(); } | 138 QuicPacketCreator::Options* options() { return connection()->options(); } |
| 135 | 139 |
| 136 // Returns the number of currently open streams, including those which have | 140 // Returns the number of currently open streams, including those which have |
| 137 // been implicitly created. | 141 // been implicitly created. |
| 138 virtual size_t GetNumOpenStreams() const; | 142 virtual size_t GetNumOpenStreams() const; |
| 139 | 143 |
| 140 void MarkWriteBlocked(QuicStreamId id); | 144 void MarkWriteBlocked(QuicStreamId id, QuicPriority priority); |
| 141 | 145 |
| 142 // Marks that |stream_id| is blocked waiting to decompress the | 146 // Marks that |stream_id| is blocked waiting to decompress the |
| 143 // headers identified by |decompression_id|. | 147 // headers identified by |decompression_id|. |
| 144 void MarkDecompressionBlocked(QuicHeaderId decompression_id, | 148 void MarkDecompressionBlocked(QuicHeaderId decompression_id, |
| 145 QuicStreamId stream_id); | 149 QuicStreamId stream_id); |
| 146 | 150 |
| 147 bool goaway_received() const { | 151 bool goaway_received() const { |
| 148 return goaway_received_; | 152 return goaway_received_; |
| 149 } | 153 } |
| 150 | 154 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 bool goaway_received_; | 285 bool goaway_received_; |
| 282 // Whether a GoAway has been sent. | 286 // Whether a GoAway has been sent. |
| 283 bool goaway_sent_; | 287 bool goaway_sent_; |
| 284 | 288 |
| 285 DISALLOW_COPY_AND_ASSIGN(QuicSession); | 289 DISALLOW_COPY_AND_ASSIGN(QuicSession); |
| 286 }; | 290 }; |
| 287 | 291 |
| 288 } // namespace net | 292 } // namespace net |
| 289 | 293 |
| 290 #endif // NET_QUIC_QUIC_SESSION_H_ | 294 #endif // NET_QUIC_QUIC_SESSION_H_ |
| OLD | NEW |