blob: 8b1d80a8fb5ffefff77c4a8a814f3efbb3cdf537 [file] [log] [blame]
QUICHE teamfd50a402018-12-07 22:54:05 -05001// 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
bnce6640c82019-06-24 11:25:56 -07008#include <cstddef>
QUICHE teamfd50a402018-12-07 22:54:05 -05009#include <cstdint>
bnc47904002019-08-16 11:49:48 -070010#include <string>
QUICHE teamfd50a402018-12-07 22:54:05 -050011
bnc641ace72020-01-21 12:24:57 -080012#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
QUICHE teamfd50a402018-12-07 22:54:05 -050013
14namespace http2 {
15
bncd0f61e72019-06-24 11:53:31 -070016// HPACK integer encoder class with single static method implementing variable
17// length integer representation defined in RFC7541, Section 5.1:
QUICHE teamfd50a402018-12-07 22:54:05 -050018// https://httpwg.org/specs/rfc7541.html#integer.representation
bnc641ace72020-01-21 12:24:57 -080019class QUICHE_EXPORT_PRIVATE HpackVarintEncoder {
QUICHE teamfd50a402018-12-07 22:54:05 -050020 public:
bncd0f61e72019-06-24 11:53:31 -070021 // 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,
bnc47904002019-08-16 11:49:48 -070026 std::string* output);
QUICHE teamfd50a402018-12-07 22:54:05 -050027};
28
29} // namespace http2
30
31#endif // QUICHE_HTTP2_HPACK_VARINT_HPACK_VARINT_ENCODER_H_