Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
kcenon::network::protocols::http2::static_table Class Reference

HPACK static table (RFC 7541 Appendix A) More...

#include <hpack.h>

Collaboration diagram for kcenon::network::protocols::http2::static_table:
Collaboration graph

Static Public Member Functions

static auto get (size_t index) -> std::optional< http_header >
 Get static table entry by index.
 
static auto find (std::string_view name, std::string_view value="") -> size_t
 Find index of header in static table.
 
static constexpr auto size () -> size_t
 Get static table size.
 

Detailed Description

HPACK static table (RFC 7541 Appendix A)

The static table consists of 61 predefined common header fields.

Definition at line 49 of file hpack.h.

Member Function Documentation

◆ find()

auto kcenon::network::protocols::http2::static_table::find ( std::string_view name,
std::string_view value = "" ) -> size_t
static

Find index of header in static table.

Parameters
nameHeader name
valueHeader value (empty to match name only)
Returns
Index if found, 0 if not found

Definition at line 92 of file hpack.cpp.

94 {
95 for (size_t i = 1; i <= static_table_size; ++i)
96 {
97 const auto& entry = static_table_entries[i];
98 if (entry.name == name)
99 {
100 if (value.empty() || entry.value == value)
101 {
102 return i;
103 }
104 }
105 }
106 return 0;
107 }

Referenced by kcenon::network::protocols::http2::hpack_encoder::encode().

Here is the caller graph for this function:

◆ get()

auto kcenon::network::protocols::http2::static_table::get ( size_t index) -> std::optional<http_header>
static

Get static table entry by index.

Parameters
indexIndex (1-61, 0 is invalid)
Returns
Header entry if found

Definition at line 83 of file hpack.cpp.

84 {
85 if (index == 0 || index > static_table_size)
86 {
87 return std::nullopt;
88 }
89 return static_table_entries[index];
90 }

Referenced by kcenon::network::protocols::http2::hpack_decoder::get_indexed_header().

Here is the caller graph for this function:

◆ size()

static constexpr auto kcenon::network::protocols::http2::static_table::size ( ) -> size_t
inlinestaticconstexpr

Get static table size.

Returns
Number of entries (61)

Definition at line 72 of file hpack.h.

72{ return 61; }

Referenced by kcenon::network::protocols::http2::hpack_encoder::encode(), and kcenon::network::protocols::http2::hpack_decoder::get_indexed_header().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: