ws-server: restrict returned Sec-Websocket-Protocol to the chosen name only
[platform/upstream/libwebsockets.git] / lib / extension-permessage-deflate.h
1
2 #include <zlib.h>
3
4 #define DEFLATE_FRAME_COMPRESSION_LEVEL_SERVER 1
5 #define DEFLATE_FRAME_COMPRESSION_LEVEL_CLIENT Z_DEFAULT_COMPRESSION
6
7 enum arg_indexes {
8         PMD_SERVER_NO_CONTEXT_TAKEOVER,
9         PMD_CLIENT_NO_CONTEXT_TAKEOVER,
10         PMD_SERVER_MAX_WINDOW_BITS,
11         PMD_CLIENT_MAX_WINDOW_BITS,
12         PMD_RX_BUF_PWR2,
13         PMD_TX_BUF_PWR2,
14         PMD_COMP_LEVEL,
15         PMD_MEM_LEVEL,
16
17         PMD_ARG_COUNT
18 };
19
20 struct lws_ext_pm_deflate_priv {
21         z_stream rx;
22         z_stream tx;
23
24         unsigned char *buf_rx_inflated; /* RX inflated output buffer */
25         unsigned char *buf_tx_deflated; /* TX deflated output buffer */
26
27         size_t count_rx_between_fin;
28
29         unsigned char args[PMD_ARG_COUNT];
30         unsigned char tx_held[5];
31         unsigned char rx_held;
32
33         unsigned char tx_init:1;
34         unsigned char rx_init:1;
35         unsigned char compressed_out:1;
36         unsigned char rx_held_valid:1;
37         unsigned char tx_held_valid:1;
38         unsigned char rx_append_trailer:1;
39         unsigned char pending_tx_trailer:1;
40 };
41