lsquic_headers.h revision 3b55e6ae
13b55e6aeSDmitri Tikhonov/* Copyright (c) 2017 - 2018 LiteSpeed Technologies Inc.  See LICENSE. */
23b55e6aeSDmitri Tikhonov#ifndef LSQUIC_HEADERS_H
33b55e6aeSDmitri Tikhonov#define LSQUIC_HEADERS_H 1
43b55e6aeSDmitri Tikhonov
53b55e6aeSDmitri Tikhonov#include <stdint.h>
63b55e6aeSDmitri Tikhonov
73b55e6aeSDmitri Tikhonov/* When ea_hsi_if is not specified, the headers are converted to a C string
83b55e6aeSDmitri Tikhonov * that contains HTTP/1.x-like header structure.
93b55e6aeSDmitri Tikhonov */
103b55e6aeSDmitri Tikhonovstruct http1x_headers
113b55e6aeSDmitri Tikhonov{
123b55e6aeSDmitri Tikhonov    unsigned        h1h_size; /* Number of characters in h1h_buf, not
133b55e6aeSDmitri Tikhonov                               * counting the NUL byte.
143b55e6aeSDmitri Tikhonov                               */
153b55e6aeSDmitri Tikhonov    unsigned        h1h_off;  /* Reading offset */
163b55e6aeSDmitri Tikhonov    char           *h1h_buf;
173b55e6aeSDmitri Tikhonov};
183b55e6aeSDmitri Tikhonov
193b55e6aeSDmitri Tikhonov
203b55e6aeSDmitri Tikhonov/* This struct is used to return decoded HEADERS and PUSH_PROMISE frames.
213b55e6aeSDmitri Tikhonov * Some of the fields are only used for HEADERS frames.  They are marked
223b55e6aeSDmitri Tikhonov * with "H" comment below.
233b55e6aeSDmitri Tikhonov */
243b55e6aeSDmitri Tikhonovstruct uncompressed_headers
253b55e6aeSDmitri Tikhonov{
263b55e6aeSDmitri Tikhonov    uint32_t               uh_stream_id;
273b55e6aeSDmitri Tikhonov    uint32_t               uh_oth_stream_id; /* For HEADERS frame, the ID of the
283b55e6aeSDmitri Tikhonov                                              * stream that this stream depends
293b55e6aeSDmitri Tikhonov                                              * on.  (Zero means unset.) For
303b55e6aeSDmitri Tikhonov                                              * PUSH_PROMISE, the promised stream
313b55e6aeSDmitri Tikhonov                                              * ID.
323b55e6aeSDmitri Tikhonov                                              */
333b55e6aeSDmitri Tikhonov    unsigned short /* H */ uh_weight;        /* 1 - 256; 0 means not set */
343b55e6aeSDmitri Tikhonov    signed char    /* H */ uh_exclusive;     /* 0 or 1 when set; -1 means not set */
353b55e6aeSDmitri Tikhonov    enum {
363b55e6aeSDmitri Tikhonov                   /* H */ UH_FIN  = (1 << 0),
373b55e6aeSDmitri Tikhonov                           UH_PP   = (1 << 1), /* Push promise */
383b55e6aeSDmitri Tikhonov                           UH_H1H  = (1 << 2),  /* uh_hset points to http1x_headers */
393b55e6aeSDmitri Tikhonov    }                      uh_flags:8;
403b55e6aeSDmitri Tikhonov    void                  *uh_hset;
413b55e6aeSDmitri Tikhonov};
423b55e6aeSDmitri Tikhonov
433b55e6aeSDmitri Tikhonov#endif
44