-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhpack_table.h
41 lines (32 loc) · 921 Bytes
/
hpack_table.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef HPACK_TABLE_H
#define HPACK_TABLE_H
#include <cstddef>
#include <optional>
#include <vector>
#include "hpack_types.h"
namespace hpack {
header_type hpack_static_table_at(std::size_t index);
class hpack_dynamic_table {
private:
std::vector<header_type> entries_;
std::size_t max_size_ = 4096;
std::size_t current_table_size_ = 0;
public:
std::size_t size() const;
std::size_t table_size() const;
std::size_t maximum_table_size() const;
void set_maximum_table_size(std::size_t size);
header_type at(std::size_t index) const;
void add(const header_type& header);
void dump() const;
private:
std::size_t entry_size(const header_type& entry) const;
std::size_t calc_table_size() const;
void remove_tail();
void evict();
};
void dump(const hpack_dynamic_table& table);
std::optional<header_type>
hpack_table_at(const hpack_dynamic_table& dynamic_table, std::size_t index);
}
#endif