lsquic_conn_public.h revision 8ae5ecb4
1/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc.  See LICENSE. */
2/*
3 * lsquic_conn_public.h -- Connection's "public interface"
4 *
5 * This structure is used to bundle things in connection that stream
6 * needs access to into a single object.  This way, the space per
7 * stream object is one pointer instead of four or five.
8 */
9
10#ifndef LSQUIC_CONN_PUBLIC_H
11#define LSQUIC_CONN_PUBLIC_H 1
12
13struct lsquic_conn;
14struct lsquic_engine_public;
15struct lsquic_mm;
16struct lsquic_hash;
17struct headers_stream;
18struct lsquic_send_ctl;
19#if LSQUIC_CONN_STATS
20struct conn_stats;
21#endif
22struct qpack_enc_hdl;
23struct qpack_dec_hdl;
24struct network_path;
25
26struct lsquic_conn_public {
27    struct lsquic_streams_tailq     sending_streams,    /* Send RST_STREAM, BLOCKED, and WUF frames */
28                                    read_streams,
29                                    write_streams,      /* Send STREAM frames */
30                                    service_streams;
31    struct lsquic_hash             *all_streams;
32    struct lsquic_cfcw              cfcw;
33    struct lsquic_conn_cap          conn_cap;
34    struct lsquic_rtt_stats         rtt_stats;
35    struct lsquic_engine_public    *enpub;
36    struct malo                    *packet_out_malo;
37    struct lsquic_conn             *lconn;
38    struct lsquic_mm               *mm;
39    union {
40        struct {
41            struct headers_stream  *hs;
42        }                       gquic;
43        struct {
44            struct qpack_enc_hdl *qeh;
45            struct qpack_dec_hdl *qdh;
46            struct lsquic_hash   *promises;
47        }                       ietf;
48    }                               u;
49    enum {
50        CP_STREAM_UNBLOCKED     = 1 << 0,   /* Set when a stream becomes unblocked */
51    }                               cp_flags;
52    struct lsquic_send_ctl         *send_ctl;
53#if LSQUIC_CONN_STATS
54    struct conn_stats              *conn_stats;
55#endif
56    const struct network_path      *path;
57#if LSQUIC_EXTRA_CHECKS
58    unsigned long                   stream_frame_bytes;
59    unsigned                        wtp_level;  /* wtp: Write To Packets */
60#endif
61    /* "unsigned" is wide enough: these values are only used for amplification
62     * limit before initial path is validated.
63     */
64    unsigned                        bytes_in;   /* successfully processed */
65    unsigned                        bytes_out;
66    /* Used for no-progress timeout */
67    lsquic_time_t                   last_tick, last_prog;
68};
69
70#endif
71