lsquic_types.h revision 5392f7a3
1/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc.  See LICENSE. */
2#ifndef __LSQUIC_TYPES_H__
3#define __LSQUIC_TYPES_H__
4
5/**
6 * @file
7 * LSQUIC types.
8 */
9
10#include <stdint.h>
11
12#define MAX_CID_LEN 20
13#define GQUIC_CID_LEN 8
14
15/**
16 * Connection ID
17 */
18typedef struct lsquic_cid
19{
20    uint_fast8_t    len;
21    union {
22        uint8_t     buf[MAX_CID_LEN];
23        uint64_t    id;
24    }               u_cid;
25#define idbuf u_cid.buf
26}
27lsquic_cid_t;
28
29
30#define LSQUIC_CIDS_EQ(a, b) ((a)->len == 8 ? \
31    (b)->len == 8 && (a)->u_cid.id == (b)->u_cid.id : \
32    (a)->len == (b)->len && 0 == memcmp((a)->idbuf, (b)->idbuf, (a)->len))
33
34/** Stream ID */
35typedef uint64_t lsquic_stream_id_t;
36
37/** LSQUIC engine */
38typedef struct lsquic_engine lsquic_engine_t;
39
40/** Connection */
41typedef struct lsquic_conn lsquic_conn_t;
42
43/** Connection context.  This is the return value of @ref on_new_conn. */
44typedef struct lsquic_conn_ctx lsquic_conn_ctx_t;
45
46/** Stream */
47typedef struct lsquic_stream lsquic_stream_t;
48
49/** Stream context.  This is the return value of @ref on_new_stream. */
50typedef struct lsquic_stream_ctx lsquic_stream_ctx_t;
51
52/** HTTP headers */
53typedef struct lsquic_http_headers lsquic_http_headers_t;
54
55#endif
56