blob: 60737bc0595176ce17100b0269c8e5859281fc65 [file] [log] [blame]
// Copyright 2024 The Pigweed Authors
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
//
// AUTOGENERATED FILE, DO NOT EDIT
//
// To regenerate, run `go run gen/hpack_gen.go > hpack.autogen.inc`.
// This file should be included in exactly one *.cc file.
//
// clang-format off
// Huffman decoder table. Decoding starts at index=0. For each bit, we inspect
// kHuffmanDecoderTable[index][bit] and take an action based on that value:
//
// * If the value matches 0b0..._...., set index=value
// * If the value matches 0b1xxx_xxxx, output byte 32 + xx_xxxx, set index=0
// * If the value matches 0b1111_1110, fail: unprintable character
// * If the value matches 0b1111_1111, fail: decoder entered an invalid state
//
static constexpr std::array<uint8_t[2], 114> kHuffmanDecoderTable = {{
/*0=*/ {1, 22},
/*1=*/ {2, 9},
/*2=*/ {3, 6},
/*3=*/ {4, 5},
/*4=*/ {144, 145},
/*5=*/ {146, 193},
/*6=*/ {7, 8},
/*7=*/ {195, 197},
/*8=*/ {201, 207},
/*9=*/ {10, 15},
/*10=*/ {11, 12},
/*11=*/ {211, 212},
/*12=*/ {13, 14},
/*13=*/ {128, 133},
/*14=*/ {141, 142},
/*15=*/ {16, 19},
/*16=*/ {17, 18},
/*17=*/ {143, 147},
/*18=*/ {148, 149},
/*19=*/ {20, 21},
/*20=*/ {150, 151},
/*21=*/ {152, 153},
/*22=*/ {23, 40},
/*23=*/ {24, 31},
/*24=*/ {25, 28},
/*25=*/ {26, 27},
/*26=*/ {157, 161},
/*27=*/ {191, 194},
/*28=*/ {29, 30},
/*29=*/ {196, 198},
/*30=*/ {199, 200},
/*31=*/ {32, 35},
/*32=*/ {33, 34},
/*33=*/ {204, 205},
/*34=*/ {206, 208},
/*35=*/ {36, 37},
/*36=*/ {210, 213},
/*37=*/ {38, 39},
/*38=*/ {154, 162},
/*39=*/ {163, 164},
/*40=*/ {41, 56},
/*41=*/ {42, 49},
/*42=*/ {43, 46},
/*43=*/ {44, 45},
/*44=*/ {165, 166},
/*45=*/ {167, 168},
/*46=*/ {47, 48},
/*47=*/ {169, 170},
/*48=*/ {171, 172},
/*49=*/ {50, 53},
/*50=*/ {51, 52},
/*51=*/ {173, 174},
/*52=*/ {175, 176},
/*53=*/ {54, 55},
/*54=*/ {177, 178},
/*55=*/ {179, 180},
/*56=*/ {57, 64},
/*57=*/ {58, 61},
/*58=*/ {59, 60},
/*59=*/ {181, 182},
/*60=*/ {183, 185},
/*61=*/ {62, 63},
/*62=*/ {202, 203},
/*63=*/ {209, 214},
/*64=*/ {65, 68},
/*65=*/ {66, 67},
/*66=*/ {215, 216},
/*67=*/ {217, 218},
/*68=*/ {69, 72},
/*69=*/ {70, 71},
/*70=*/ {134, 138},
/*71=*/ {140, 155},
/*72=*/ {73, 74},
/*73=*/ {184, 186},
/*74=*/ {75, 78},
/*75=*/ {76, 77},
/*76=*/ {129, 130},
/*77=*/ {136, 137},
/*78=*/ {79, 81},
/*79=*/ {159, 80},
/*80=*/ {135, 139},
/*81=*/ {82, 84},
/*82=*/ {220, 83},
/*83=*/ {131, 158},
/*84=*/ {85, 88},
/*85=*/ {86, 87},
/*86=*/ {254, 132},
/*87=*/ {160, 187},
/*88=*/ {89, 90},
/*89=*/ {189, 222},
/*90=*/ {91, 92},
/*91=*/ {190, 221},
/*92=*/ {93, 94},
/*93=*/ {156, 192},
/*94=*/ {219, 95},
/*95=*/ {96, 99},
/*96=*/ {97, 254},
/*97=*/ {98, 254},
/*98=*/ {188, 254},
/*99=*/ {254, 100},
/*100=*/ {254, 101},
/*101=*/ {254, 102},
/*102=*/ {254, 103},
/*103=*/ {254, 104},
/*104=*/ {254, 105},
/*105=*/ {254, 106},
/*106=*/ {254, 107},
/*107=*/ {254, 108},
/*108=*/ {254, 109},
/*109=*/ {110, 111},
/*110=*/ {223, 254},
/*111=*/ {254, 112},
/*112=*/ {254, 113},
/*113=*/ {254, 255},
}};
// Decoder table stats:
// before optimization = {numBranchNodes:256 numOutputNodes:96 numUnprintableNodes:160 numInvalidNodes:1}
// after optimization = {numBranchNodes:114 numOutputNodes:96 numUnprintableNodes:18 numInvalidNodes:1}
// HPACK-encoded header fields which form grpc Response-Headers.
// These are the same for every response.
static constexpr std::array<uint8_t, 19> kResponseHeaderFields = {
0x88, 0x5f, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63
};
// HPACK-encoded header fields which form grpc Trailers. All response Trailers
// are identical except for the status code.
//
// This is indexed by pw::Status::Code, which happens to be identical to grpc's
// status code.
struct ResponseTrailerPayload {
uint32_t size;
std::array<uint8_t, 16> bytes;
};
static constexpr std::array<ResponseTrailerPayload, 17> kResponseTrailerFields = {{
{.size=15, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1, 0x30}},
{.size=15, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1, 0x31}},
{.size=15, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1, 0x32}},
{.size=15, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1, 0x33}},
{.size=15, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1, 0x34}},
{.size=15, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1, 0x35}},
{.size=15, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1, 0x36}},
{.size=15, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1, 0x37}},
{.size=15, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1, 0x38}},
{.size=15, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1, 0x39}},
{.size=16, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2, 0x31, 0x30}},
{.size=16, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2, 0x31, 0x31}},
{.size=16, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2, 0x31, 0x32}},
{.size=16, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2, 0x31, 0x33}},
{.size=16, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2, 0x31, 0x34}},
{.size=16, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2, 0x31, 0x35}},
{.size=16, .bytes={0x40, 0xb, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2, 0x31, 0x36}},
}};