1a74702c6SGeorge Wang/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc. See LICENSE. */ 250aadb33SDmitri Tikhonov/* 350aadb33SDmitri Tikhonov * lsquic_conn_public.h -- Connection's "public interface" 450aadb33SDmitri Tikhonov * 550aadb33SDmitri Tikhonov * This structure is used to bundle things in connection that stream 650aadb33SDmitri Tikhonov * needs access to into a single object. This way, the space per 750aadb33SDmitri Tikhonov * stream object is one pointer instead of four or five. 850aadb33SDmitri Tikhonov */ 950aadb33SDmitri Tikhonov 1050aadb33SDmitri Tikhonov#ifndef LSQUIC_CONN_PUBLIC_H 1150aadb33SDmitri Tikhonov#define LSQUIC_CONN_PUBLIC_H 1 1250aadb33SDmitri Tikhonov 1350aadb33SDmitri Tikhonovstruct lsquic_conn; 1450aadb33SDmitri Tikhonovstruct lsquic_engine_public; 1550aadb33SDmitri Tikhonovstruct lsquic_mm; 16c51ce338SDmitri Tikhonovstruct lsquic_hash; 1750aadb33SDmitri Tikhonovstruct headers_stream; 1850aadb33SDmitri Tikhonovstruct lsquic_send_ctl; 1919f667fbSDmitri Tikhonov#if LSQUIC_CONN_STATS 2019f667fbSDmitri Tikhonovstruct conn_stats; 2119f667fbSDmitri Tikhonov#endif 225392f7a3SLiteSpeed Techstruct qpack_enc_hdl; 235392f7a3SLiteSpeed Techstruct qpack_dec_hdl; 245392f7a3SLiteSpeed Techstruct network_path; 2550aadb33SDmitri Tikhonov 2650aadb33SDmitri Tikhonovstruct lsquic_conn_public { 27c51ce338SDmitri Tikhonov struct lsquic_streams_tailq sending_streams, /* Send RST_STREAM, BLOCKED, and WUF frames */ 28c51ce338SDmitri Tikhonov read_streams, 29c51ce338SDmitri Tikhonov write_streams, /* Send STREAM frames */ 3050aadb33SDmitri Tikhonov service_streams; 31c51ce338SDmitri Tikhonov struct lsquic_hash *all_streams; 3250aadb33SDmitri Tikhonov struct lsquic_cfcw cfcw; 3350aadb33SDmitri Tikhonov struct lsquic_conn_cap conn_cap; 3450aadb33SDmitri Tikhonov struct lsquic_rtt_stats rtt_stats; 3550aadb33SDmitri Tikhonov struct lsquic_engine_public *enpub; 3650aadb33SDmitri Tikhonov struct malo *packet_out_malo; 3750aadb33SDmitri Tikhonov struct lsquic_conn *lconn; 3850aadb33SDmitri Tikhonov struct lsquic_mm *mm; 395392f7a3SLiteSpeed Tech union { 405392f7a3SLiteSpeed Tech struct { 415392f7a3SLiteSpeed Tech struct headers_stream *hs; 425392f7a3SLiteSpeed Tech } gquic; 435392f7a3SLiteSpeed Tech struct { 445392f7a3SLiteSpeed Tech struct qpack_enc_hdl *qeh; 455392f7a3SLiteSpeed Tech struct qpack_dec_hdl *qdh; 46fbc6cc04SDmitri Tikhonov struct hcso_writer *hcso; 475392f7a3SLiteSpeed Tech struct lsquic_hash *promises; 485392f7a3SLiteSpeed Tech } ietf; 495392f7a3SLiteSpeed Tech } u; 505392f7a3SLiteSpeed Tech enum { 515392f7a3SLiteSpeed Tech CP_STREAM_UNBLOCKED = 1 << 0, /* Set when a stream becomes unblocked */ 525392f7a3SLiteSpeed Tech } cp_flags; 5350aadb33SDmitri Tikhonov struct lsquic_send_ctl *send_ctl; 5419f667fbSDmitri Tikhonov#if LSQUIC_CONN_STATS 5519f667fbSDmitri Tikhonov struct conn_stats *conn_stats; 5619f667fbSDmitri Tikhonov#endif 575392f7a3SLiteSpeed Tech const struct network_path *path; 58c09fcff4SDmitri Tikhonov#if LSQUIC_EXTRA_CHECKS 59c09fcff4SDmitri Tikhonov unsigned long stream_frame_bytes; 608ae5ecb4SDmitri Tikhonov unsigned wtp_level; /* wtp: Write To Packets */ 61c09fcff4SDmitri Tikhonov#endif 62b55a5117SDmitri Tikhonov /* "unsigned" is wide enough: these values are only used for amplification 63b55a5117SDmitri Tikhonov * limit before initial path is validated. 64b55a5117SDmitri Tikhonov */ 65b55a5117SDmitri Tikhonov unsigned bytes_in; /* successfully processed */ 66b55a5117SDmitri Tikhonov unsigned bytes_out; 678ae5ecb4SDmitri Tikhonov /* Used for no-progress timeout */ 688ae5ecb4SDmitri Tikhonov lsquic_time_t last_tick, last_prog; 694580fab7SDmitri Tikhonov unsigned max_peer_ack_usec; 70084338b1SGeorge Wang uint8_t n_special_streams; 7150aadb33SDmitri Tikhonov}; 7250aadb33SDmitri Tikhonov 7350aadb33SDmitri Tikhonov#endif 74