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