| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_SPDY_HPACK_HPACK_DECODER_INTERFACE_H_ | |
| 6 #define NET_SPDY_HPACK_HPACK_DECODER_INTERFACE_H_ | |
| 7 | |
| 8 // HpackDecoderInterface is the base class for HPACK block decoders. | |
| 9 // HPACK is defined in http://tools.ietf.org/html/rfc7541 | |
| 10 | |
| 11 #include <stddef.h> | |
| 12 | |
| 13 #include <memory> | |
| 14 | |
| 15 #include "net/base/net_export.h" | |
| 16 #include "net/spdy/hpack/hpack_header_table.h" | |
| 17 #include "net/spdy/spdy_header_block.h" | |
| 18 #include "net/spdy/spdy_headers_handler_interface.h" | |
| 19 | |
| 20 namespace net { | |
| 21 | |
| 22 class NET_EXPORT_PRIVATE HpackDecoderInterface { | |
| 23 public: | |
| 24 virtual ~HpackDecoderInterface() {} | |
| 25 | |
| 26 // Called upon acknowledgement of SETTINGS_HEADER_TABLE_SIZE. | |
| 27 virtual void ApplyHeaderTableSizeSetting(size_t size_setting) = 0; | |
| 28 | |
| 29 // If a SpdyHeadersHandlerInterface is provided, the decoder will emit | |
| 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. | |
| 33 virtual void HandleControlFrameHeadersStart( | |
| 34 SpdyHeadersHandlerInterface* handler) = 0; | |
| 35 | |
| 36 // Called as HPACK block fragments arrive. Returns false if an error occurred | |
| 37 // while decoding the block. Does not take ownership of headers_data. | |
| 38 virtual bool HandleControlFrameHeadersData(const char* headers_data, | |
| 39 size_t headers_data_length) = 0; | |
| 40 | |
| 41 // Called after a HPACK block has been completely delivered via | |
| 42 // HandleControlFrameHeadersData(). Returns false if an error occurred. | |
| 43 // |compressed_len| if non-null will be set to the size of the encoded | |
| 44 // buffered block that was accumulated in HandleControlFrameHeadersData(), | |
| 45 // to support subsequent calculation of compression percentage. | |
| 46 // Discards the handler supplied at the start of decoding the block. | |
| 47 // TODO(jamessynge): Determine if compressed_len is needed; it is used to | |
| 48 // produce UUMA stat Net.SpdyHpackDecompressionPercentage, but only for | |
| 49 // deprecated SPDY3. | |
| 50 virtual bool HandleControlFrameHeadersComplete(size_t* compressed_len) = 0; | |
| 51 | |
| 52 // Accessor for the most recently decoded headers block. Valid until the next | |
| 53 // call to HandleControlFrameHeadersData(). | |
| 54 // TODO(birenroy): Remove this method when all users of HpackDecoder specify | |
| 55 // a SpdyHeadersHandlerInterface. | |
| 56 virtual const SpdyHeaderBlock& decoded_block() const = 0; | |
| 57 | |
| 58 virtual void SetHeaderTableDebugVisitor( | |
| 59 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor) = 0; | |
| 60 | |
| 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. | |
| 67 virtual void set_max_decode_buffer_size_bytes( | |
| 68 size_t max_decode_buffer_size_bytes) = 0; | |
| 69 | |
| 70 // Returns the estimate of dynamically allocated memory in bytes. | |
| 71 virtual size_t EstimateMemoryUsage() const = 0; | |
| 72 }; | |
| 73 | |
| 74 } // namespace net | |
| 75 | |
| 76 #endif // NET_SPDY_HPACK_HPACK_DECODER_INTERFACE_H_ | |
| OLD | NEW |