QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 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 QUICHE_HTTP2_HPACK_VARINT_HPACK_VARINT_ENCODER_H_ |
| 6 | #define QUICHE_HTTP2_HPACK_VARINT_HPACK_VARINT_ENCODER_H_ |
| 7 | |
bnc | e6640c8 | 2019-06-24 11:25:56 -0700 | [diff] [blame] | 8 | #include <cstddef> |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 9 | #include <cstdint> |
bnc | 4790400 | 2019-08-16 11:49:48 -0700 | [diff] [blame] | 10 | #include <string> |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 11 | |
| 12 | #include "net/third_party/quiche/src/http2/platform/api/http2_export.h" |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 13 | |
| 14 | namespace http2 { |
| 15 | |
bnc | d0f61e7 | 2019-06-24 11:53:31 -0700 | [diff] [blame] | 16 | // HPACK integer encoder class with single static method implementing variable |
| 17 | // length integer representation defined in RFC7541, Section 5.1: |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 18 | // https://httpwg.org/specs/rfc7541.html#integer.representation |
| 19 | class HTTP2_EXPORT_PRIVATE HpackVarintEncoder { |
| 20 | public: |
bnc | d0f61e7 | 2019-06-24 11:53:31 -0700 | [diff] [blame] | 21 | // Encode |varint|, appending encoded data to |*output|. |
| 22 | // Appends between 1 and 11 bytes in total. |
| 23 | static void Encode(uint8_t high_bits, |
| 24 | uint8_t prefix_length, |
| 25 | uint64_t varint, |
bnc | 4790400 | 2019-08-16 11:49:48 -0700 | [diff] [blame] | 26 | std::string* output); |
QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | } // namespace http2 |
| 30 | |
| 31 | #endif // QUICHE_HTTP2_HPACK_VARINT_HPACK_VARINT_ENCODER_H_ |