-
Notifications
You must be signed in to change notification settings - Fork 0
/
hpack_table.h
35 lines (30 loc) · 904 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
#ifndef HPACK_TABLE_H_
#define HPACK_TABLE_H_
#include <stdint.h>
#include <utility>
#include <string>
#include "hpack_huffman.h"
typedef std::pair<std::string, std::string> header;
struct RingTable {
header h;
RingTable *nxt, *pre;
};
class Table {
RingTable *head, *tail;
HuffmanTree *huffman;
uint32_t entry_size;
uint32_t entry_num;
public:
Table();
~Table();
uint32_t dynamic_table_size;
bool find_header(int &index, const header h);
void delete_last_entry();
void add_header(const header h);
void set_dynamic_table_size(uint32_t size);
int64_t parse_string(std::string &dst, const uint8_t* buf);
int64_t pack_string(uint8_t* buf, const std::string content, bool to_huffman);
header get_header(uint32_t index);
int64_t parse_header(header &dst, uint32_t index, const uint8_t* buf, bool isIndexed);
};
#endif // HPACK_TABLE_H_