summaryrefslogtreecommitdiff
path: root/thirdparty/lws/ext/extension-permessage-deflate.h
blob: 87377368974daa5a0e0287cea57104c63fb770a3 (plain)
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

#include <zlib.h>

#define DEFLATE_FRAME_COMPRESSION_LEVEL_SERVER 1
#define DEFLATE_FRAME_COMPRESSION_LEVEL_CLIENT Z_DEFAULT_COMPRESSION

enum arg_indexes {
	PMD_SERVER_NO_CONTEXT_TAKEOVER,
	PMD_CLIENT_NO_CONTEXT_TAKEOVER,
	PMD_SERVER_MAX_WINDOW_BITS,
	PMD_CLIENT_MAX_WINDOW_BITS,
	PMD_RX_BUF_PWR2,
	PMD_TX_BUF_PWR2,
	PMD_COMP_LEVEL,
	PMD_MEM_LEVEL,

	PMD_ARG_COUNT
};

struct lws_ext_pm_deflate_priv {
	z_stream rx;
	z_stream tx;

	unsigned char *buf_rx_inflated; /* RX inflated output buffer */
	unsigned char *buf_tx_deflated; /* TX deflated output buffer */

	size_t count_rx_between_fin;

	unsigned char args[PMD_ARG_COUNT];
	unsigned char tx_held[5];
	unsigned char rx_held;

	unsigned char tx_init:1;
	unsigned char rx_init:1;
	unsigned char compressed_out:1;
	unsigned char rx_held_valid:1;
	unsigned char tx_held_valid:1;
	unsigned char rx_append_trailer:1;
	unsigned char pending_tx_trailer:1;
};