| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef NET_SPDY_HPACK_HPACK_DECODER_INTERFACE_H_ | 5 #ifndef NET_SPDY_HPACK_HPACK_DECODER_INTERFACE_H_ |
| 6 #define NET_SPDY_HPACK_HPACK_DECODER_INTERFACE_H_ | 6 #define NET_SPDY_HPACK_HPACK_DECODER_INTERFACE_H_ |
| 7 | 7 |
| 8 // HpackDecoderInterface is the base class for HPACK block decoders. | 8 // HpackDecoderInterface is the base class for HPACK block decoders. |
| 9 // HPACK is defined in http://tools.ietf.org/html/rfc7541 | 9 // HPACK is defined in http://tools.ietf.org/html/rfc7541 |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 class NET_EXPORT_PRIVATE HpackDecoderInterface { | 22 class NET_EXPORT_PRIVATE HpackDecoderInterface { |
| 23 public: | 23 public: |
| 24 virtual ~HpackDecoderInterface() {} | 24 virtual ~HpackDecoderInterface() {} |
| 25 | 25 |
| 26 // Called upon acknowledgement of SETTINGS_HEADER_TABLE_SIZE. | 26 // Called upon acknowledgement of SETTINGS_HEADER_TABLE_SIZE. |
| 27 virtual void ApplyHeaderTableSizeSetting(size_t size_setting) = 0; | 27 virtual void ApplyHeaderTableSizeSetting(size_t size_setting) = 0; |
| 28 | 28 |
| 29 // If a SpdyHeadersHandlerInterface is provided, the decoder will emit | 29 // If a SpdyHeadersHandlerInterface is provided, the decoder will emit |
| 30 // headers to it rather than accumulating them in a SpdyHeaderBlock. | 30 // headers to it rather than accumulating them in a SpdyHeaderBlock. |
| 31 // Does not take ownership of the handler, but does use the pointer until |
| 32 // the current HPACK block is completely decoded. |
| 31 virtual void HandleControlFrameHeadersStart( | 33 virtual void HandleControlFrameHeadersStart( |
| 32 SpdyHeadersHandlerInterface* handler) = 0; | 34 SpdyHeadersHandlerInterface* handler) = 0; |
| 33 | 35 |
| 34 // Called as HPACK block fragments arrive. Returns false if an error occurred | 36 // Called as HPACK block fragments arrive. Returns false if an error occurred |
| 35 // while decoding the block. | 37 // while decoding the block. Does not take ownership of headers_data. |
| 36 virtual bool HandleControlFrameHeadersData(const char* headers_data, | 38 virtual bool HandleControlFrameHeadersData(const char* headers_data, |
| 37 size_t headers_data_length) = 0; | 39 size_t headers_data_length) = 0; |
| 38 | 40 |
| 39 // Called after a HPACK block has been completely delivered via | 41 // Called after a HPACK block has been completely delivered via |
| 40 // HandleControlFrameHeadersData(). Returns false if an error occurred. | 42 // HandleControlFrameHeadersData(). Returns false if an error occurred. |
| 41 // |compressed_len| if non-null will be set to the size of the encoded | 43 // |compressed_len| if non-null will be set to the size of the encoded |
| 42 // buffered block that was accumulated in HandleControlFrameHeadersData(), | 44 // buffered block that was accumulated in HandleControlFrameHeadersData(), |
| 43 // to support subsequent calculation of compression percentage. | 45 // to support subsequent calculation of compression percentage. |
| 44 // Discards the handler supplied at the start of decoding the block. | 46 // Discards the handler supplied at the start of decoding the block. |
| 45 // TODO(jamessynge): Determine if compressed_len is needed; it is used to | 47 // TODO(jamessynge): Determine if compressed_len is needed; it is used to |
| 46 // produce UUMA stat Net.SpdyHpackDecompressionPercentage, but only for | 48 // produce UUMA stat Net.SpdyHpackDecompressionPercentage, but only for |
| 47 // deprecated SPDY3. | 49 // deprecated SPDY3. |
| 48 virtual bool HandleControlFrameHeadersComplete(size_t* compressed_len) = 0; | 50 virtual bool HandleControlFrameHeadersComplete(size_t* compressed_len) = 0; |
| 49 | 51 |
| 50 // Accessor for the most recently decoded headers block. Valid until the next | 52 // Accessor for the most recently decoded headers block. Valid until the next |
| 51 // call to HandleControlFrameHeadersData(). | 53 // call to HandleControlFrameHeadersData(). |
| 52 // TODO(birenroy): Remove this method when all users of HpackDecoder specify | 54 // TODO(birenroy): Remove this method when all users of HpackDecoder specify |
| 53 // a SpdyHeadersHandlerInterface. | 55 // a SpdyHeadersHandlerInterface. |
| 54 virtual const SpdyHeaderBlock& decoded_block() const = 0; | 56 virtual const SpdyHeaderBlock& decoded_block() const = 0; |
| 55 | 57 |
| 56 virtual void SetHeaderTableDebugVisitor( | 58 virtual void SetHeaderTableDebugVisitor( |
| 57 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor) = 0; | 59 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor) = 0; |
| 58 | 60 |
| 59 // Set how much encoded data this decoder is willing to buffer. | 61 // Set how much encoded data this decoder is willing to buffer. |
| 62 // TODO(jamessynge): Resolve definition of this value, as it is currently |
| 63 // too tied to a single implementation. We probably want to limit one or more |
| 64 // of these: individual name or value strings, header entries, the entire |
| 65 // header list, or the HPACK block; we probably shouldn't care about the size |
| 66 // of individual transport buffers. |
| 60 virtual void set_max_decode_buffer_size_bytes( | 67 virtual void set_max_decode_buffer_size_bytes( |
| 61 size_t max_decode_buffer_size_bytes) = 0; | 68 size_t max_decode_buffer_size_bytes) = 0; |
| 62 }; | 69 }; |
| 63 | 70 |
| 64 } // namespace net | 71 } // namespace net |
| 65 | 72 |
| 66 #endif // NET_SPDY_HPACK_HPACK_DECODER_INTERFACE_H_ | 73 #endif // NET_SPDY_HPACK_HPACK_DECODER_INTERFACE_H_ |
| OLD | NEW |