QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef QUICHE_QUIC_CORE_QUIC_STREAM_FRAME_DATA_PRODUCER_H_ |
| 6 | #define QUICHE_QUIC_CORE_QUIC_STREAM_FRAME_DATA_PRODUCER_H_ |
| 7 | |
| 8 | #include "net/third_party/quiche/src/quic/core/quic_types.h" |
| 9 | |
| 10 | namespace quic { |
| 11 | |
| 12 | class QuicDataWriter; |
| 13 | |
| 14 | // Pure virtual class to retrieve stream data. |
| 15 | class QUIC_EXPORT_PRIVATE QuicStreamFrameDataProducer { |
| 16 | public: |
| 17 | virtual ~QuicStreamFrameDataProducer() {} |
| 18 | |
| 19 | // Let |writer| write |data_length| data with |offset| of stream |id|. The |
| 20 | // write fails when either stream is closed or corresponding data is failed to |
| 21 | // be retrieved. This method allows writing a single stream frame from data |
| 22 | // that spans multiple buffers. |
| 23 | virtual WriteStreamDataResult WriteStreamData(QuicStreamId id, |
| 24 | QuicStreamOffset offset, |
| 25 | QuicByteCount data_length, |
| 26 | QuicDataWriter* writer) = 0; |
| 27 | |
| 28 | // Writes the data for a CRYPTO frame to |writer| for a frame at encryption |
| 29 | // level |level| starting at offset |offset| for |data_length| bytes. Returns |
| 30 | // whether writing the data was successful. |
| 31 | virtual bool WriteCryptoData(EncryptionLevel level, |
| 32 | QuicStreamOffset offset, |
| 33 | QuicByteCount data_length, |
| 34 | QuicDataWriter* writer) = 0; |
| 35 | }; |
| 36 | |
| 37 | } // namespace quic |
| 38 | |
| 39 | #endif // QUICHE_QUIC_CORE_QUIC_STREAM_FRAME_DATA_PRODUCER_H_ |