hpack_constants.h
Go to the documentation of this file.
1 // Copyright 2021 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_CONSTANTS_H
16 #define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_CONSTANTS_H
17 
19 
20 #include <stdint.h>
21 
22 namespace grpc_core {
23 namespace hpack_constants {
24 // Per entry overhead bytes as per the spec
25 static constexpr uint32_t kEntryOverhead = 32;
26 // Initial table size as per the spec
27 static constexpr uint32_t kInitialTableSize = 4096;
28 
29 // last index in the static table
30 static constexpr uint32_t kLastStaticEntry = 61;
31 
32 static constexpr uint32_t EntriesForBytes(uint32_t bytes) noexcept {
33  return (bytes + kEntryOverhead - 1) / kEntryOverhead;
34 }
35 
36 static constexpr uint32_t kInitialTableEntries =
38 } // namespace hpack_constants
39 } // namespace grpc_core
40 
41 #endif // GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_CONSTANTS_H
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::hpack_constants::EntriesForBytes
static constexpr uint32_t EntriesForBytes(uint32_t bytes) noexcept
Definition: hpack_constants.h:32
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
grpc_core::hpack_constants::kEntryOverhead
static constexpr uint32_t kEntryOverhead
Definition: hpack_constants.h:25
stdint.h
grpc_core::hpack_constants::kInitialTableEntries
static constexpr uint32_t kInitialTableEntries
Definition: hpack_constants.h:36
grpc_core::hpack_constants::kLastStaticEntry
static constexpr uint32_t kLastStaticEntry
Definition: hpack_constants.h:30
bytes
uint8 bytes[10]
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream_unittest.cc:153
grpc_core::hpack_constants::kInitialTableSize
static constexpr uint32_t kInitialTableSize
Definition: hpack_constants.h:27
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:13