lsquic_packet_out.h revision 5392f7a3
1229fce07SDmitri Tikhonov/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc.  See LICENSE. */
250aadb33SDmitri Tikhonov/*
350aadb33SDmitri Tikhonov * lsquic_packet_out.h -- Structure and routines dealing with packet_out
450aadb33SDmitri Tikhonov */
550aadb33SDmitri Tikhonov
650aadb33SDmitri Tikhonov#ifndef LSQUIC_PACKET_OUT_H
750aadb33SDmitri Tikhonov#define LSQUIC_PACKET_OUT_H 1
850aadb33SDmitri Tikhonov
950aadb33SDmitri Tikhonov#include <sys/queue.h>
1050aadb33SDmitri Tikhonov
1150aadb33SDmitri Tikhonovstruct malo;
129626cfc2SDmitri Tikhonovstruct lsquic_conn;
1350aadb33SDmitri Tikhonovstruct lsquic_engine_public;
1450aadb33SDmitri Tikhonovstruct lsquic_mm;
1550aadb33SDmitri Tikhonovstruct lsquic_stream;
165392f7a3SLiteSpeed Techstruct network_path;
1750aadb33SDmitri Tikhonovstruct parse_funcs;
185392f7a3SLiteSpeed Techstruct bwp_state;
1950aadb33SDmitri Tikhonov
2050aadb33SDmitri Tikhonov/* Each stream_rec is associated with one packet_out.  packet_out can have
2150aadb33SDmitri Tikhonov * zero or more stream_rec structures.  stream_rec keeps a pointer to a stream
224d83f5bdSDmitri Tikhonov * that has STREAM or RST_STREAM frames inside packet_out.  `sr_frame_type'
234d83f5bdSDmitri Tikhonov * specifies the type of the frame; if this value is zero, values of the
244d83f5bdSDmitri Tikhonov * other struct members are not valid.  `sr_off' indicates where inside
254d83f5bdSDmitri Tikhonov * packet_out->po_data the frame begins and `sr_len' is its length.
2650aadb33SDmitri Tikhonov *
27c51ce338SDmitri Tikhonov * We need this information for three reasons:
2850aadb33SDmitri Tikhonov *   1. A stream is not destroyed until all of its STREAM and RST_STREAM
2950aadb33SDmitri Tikhonov *      frames are acknowledged.  This is to make sure that we do not exceed
3050aadb33SDmitri Tikhonov *      maximum allowed number of streams.
3150aadb33SDmitri Tikhonov *   2. When a packet is resubmitted, STREAM frames for a stream that has
3250aadb33SDmitri Tikhonov *      been reset are not to be resubmitted.
33c51ce338SDmitri Tikhonov *   3. A buffered packet may have to be split before it is scheduled (this
34c51ce338SDmitri Tikhonov *      occurs if we guessed incorrectly the number of bytes required to
35c51ce338SDmitri Tikhonov *      encode the packet number and the actual number would make packet
36c51ce338SDmitri Tikhonov *      larger than the max).
37c51ce338SDmitri Tikhonov *
3850aadb33SDmitri Tikhonov */
3950aadb33SDmitri Tikhonovstruct stream_rec {
4050aadb33SDmitri Tikhonov    struct lsquic_stream    *sr_stream;
41c51ce338SDmitri Tikhonov    unsigned short           sr_off,
42c51ce338SDmitri Tikhonov                             sr_len;
436aba801dSDmitri Tikhonov    enum quic_frame_type     sr_frame_type:16;
4450aadb33SDmitri Tikhonov};
4550aadb33SDmitri Tikhonov
464d83f5bdSDmitri Tikhonov#define srec_taken(srec) ((srec)->sr_frame_type)
4750aadb33SDmitri Tikhonov
4850aadb33SDmitri Tikhonovstruct stream_rec_arr {
49c51ce338SDmitri Tikhonov    TAILQ_ENTRY(stream_rec_arr)     next_stream_rec_arr;
5050aadb33SDmitri Tikhonov    struct stream_rec               srecs[
5150aadb33SDmitri Tikhonov      ( 64                              /* Efficient size for malo allocator */
52c51ce338SDmitri Tikhonov      - sizeof(TAILQ_ENTRY(stream_rec)) /* next_stream_rec_arr */
5350aadb33SDmitri Tikhonov      ) / sizeof(struct stream_rec)
5450aadb33SDmitri Tikhonov    ];
5550aadb33SDmitri Tikhonov};
5650aadb33SDmitri Tikhonov
57c51ce338SDmitri TikhonovTAILQ_HEAD(stream_rec_arr_tailq, stream_rec_arr);
58c51ce338SDmitri Tikhonov
595392f7a3SLiteSpeed Tech
6050aadb33SDmitri Tikhonovtypedef struct lsquic_packet_out
6150aadb33SDmitri Tikhonov{
6250aadb33SDmitri Tikhonov    /* `po_next' is used for packets_out, unacked_packets and expired_packets
6350aadb33SDmitri Tikhonov     * lists.
6450aadb33SDmitri Tikhonov     */
6550aadb33SDmitri Tikhonov    TAILQ_ENTRY(lsquic_packet_out)
6650aadb33SDmitri Tikhonov                       po_next;
6750aadb33SDmitri Tikhonov    lsquic_time_t      po_sent;       /* Time sent */
6850aadb33SDmitri Tikhonov    lsquic_packno_t    po_packno;
695392f7a3SLiteSpeed Tech    lsquic_packno_t    po_ack2ed;       /* If packet has ACK frame, value of
705392f7a3SLiteSpeed Tech                                         * largest acked in it.
715392f7a3SLiteSpeed Tech                                         */
725392f7a3SLiteSpeed Tech    struct lsquic_packet_out
735392f7a3SLiteSpeed Tech                      *po_loss_chain;   /* Circular linked list */
7450aadb33SDmitri Tikhonov
755392f7a3SLiteSpeed Tech    enum quic_ft_bit   po_frame_types;  /* Bitmask of QUIC_FRAME_* */
76bfc7bfd8SDmitri Tikhonov    enum packet_out_flags {
775392f7a3SLiteSpeed Tech            /* TODO XXX Phase out PO_MINI in favor of a more specialized flag:
785392f7a3SLiteSpeed Tech             * we only need an indicator that a packet contains STREAM frames
795392f7a3SLiteSpeed Tech             * but no associated srecs.  This type of packets in only created
805392f7a3SLiteSpeed Tech             * by GQUIC mini conn.
815392f7a3SLiteSpeed Tech             */
825392f7a3SLiteSpeed Tech        PO_MINI     = (1 << 0),         /* Allocated by mini connection */
83bfc7bfd8SDmitri Tikhonov        PO_HELLO    = (1 << 1),         /* Packet contains SHLO or CHLO data */
845392f7a3SLiteSpeed Tech        PO_SENT     = (1 << 2),         /* Packet has been sent (mini only) */
85bfc7bfd8SDmitri Tikhonov        PO_ENCRYPTED= (1 << 3),         /* po_enc_data has encrypted data */
86bfc7bfd8SDmitri Tikhonov        PO_SREC_ARR = (1 << 4),
87bfc7bfd8SDmitri Tikhonov#define POBIT_SHIFT 5
88bfc7bfd8SDmitri Tikhonov        PO_BITS_0   = (1 << 5),         /* PO_BITS_0 and PO_BITS_1 encode the */
89bfc7bfd8SDmitri Tikhonov        PO_BITS_1   = (1 << 6),         /*   packet number length.  See macros below. */
90bfc7bfd8SDmitri Tikhonov        PO_NONCE    = (1 << 7),         /* Use value in `po_nonce' to generate header */
91bfc7bfd8SDmitri Tikhonov        PO_VERSION  = (1 << 8),         /* Use value in `po_ver_tag' to generate header */
92bfc7bfd8SDmitri Tikhonov        PO_CONN_ID  = (1 << 9),         /* Include connection ID in public header */
93bfc7bfd8SDmitri Tikhonov        PO_REPACKNO = (1 <<10),         /* Regenerate packet number */
94bfc7bfd8SDmitri Tikhonov        PO_NOENCRYPT= (1 <<11),         /* Do not encrypt data in po_data */
95bfc7bfd8SDmitri Tikhonov        PO_VERNEG   = (1 <<12),         /* Version negotiation packet. */
96bfc7bfd8SDmitri Tikhonov        PO_STREAM_END
97bfc7bfd8SDmitri Tikhonov                    = (1 <<13),         /* STREAM frame reaches the end of the packet: no
98bfc7bfd8SDmitri Tikhonov                                         * further writes are allowed.
99bfc7bfd8SDmitri Tikhonov                                         */
100bfc7bfd8SDmitri Tikhonov        PO_SCHED    = (1 <<14),         /* On scheduled queue */
10116a9b66aSDmitri Tikhonov        PO_SENT_SZ  = (1 <<15),
1025392f7a3SLiteSpeed Tech        PO_LONGHEAD = (1 <<16),         /* Only used for Q044 */
1031e75f938SDmitri Tikhonov#define POIPv6_SHIFT 20
1041e75f938SDmitri Tikhonov        PO_IPv6     = (1 <<20),         /* Set if pmi_allocate was passed is_ipv6=1,
1051e75f938SDmitri Tikhonov                                         *   otherwise unset.
1061e75f938SDmitri Tikhonov                                         */
1078252b0b9SDmitri Tikhonov        PO_LIMITED  = (1 <<21),         /* Used to credit sc_next_limit if needed. */
1085392f7a3SLiteSpeed Tech#define POPNS_SHIFT 22
1095392f7a3SLiteSpeed Tech        PO_PNS_HSK  = (1 <<22),         /* PNS bits contain the value of the */
1105392f7a3SLiteSpeed Tech        PO_PNS_APP  = (1 <<23),         /*   packet number space. */
1115392f7a3SLiteSpeed Tech        PO_RETRY    = (1 <<24),         /* Retry packet */
1125392f7a3SLiteSpeed Tech        PO_RETX     = (1 <<25),         /* Retransmitted packet: don't append to it */
1135392f7a3SLiteSpeed Tech        PO_UNUSED26 = (1 <<26),         /* Unused */
1145392f7a3SLiteSpeed Tech        PO_LOSS_REC = (1 <<27),         /* This structure is a loss record */
1155392f7a3SLiteSpeed Tech        /* Only one of PO_SCHED, PO_UNACKED, or PO_LOST can be set.  If pressed
1165392f7a3SLiteSpeed Tech         * for room in the enum, we can switch to using two bits to represent
1175392f7a3SLiteSpeed Tech         * this information.
1185392f7a3SLiteSpeed Tech         */
1195392f7a3SLiteSpeed Tech        PO_UNACKED  = (1 <<28),         /* On unacked queue */
1205392f7a3SLiteSpeed Tech        PO_LOST     = (1 <<29),         /* On lost queue */
1215392f7a3SLiteSpeed Tech#define POSPIN_SHIFT 30
1225392f7a3SLiteSpeed Tech        PO_SPIN_BIT = (1 <<30),         /* Value of the spin bit */
1239626cfc2SDmitri Tikhonov    }                  po_flags;
124bfc7bfd8SDmitri Tikhonov    unsigned short     po_data_sz;      /* Number of usable bytes in data */
125bfc7bfd8SDmitri Tikhonov    unsigned short     po_enc_data_sz;  /* Number of usable bytes in data */
12616a9b66aSDmitri Tikhonov    unsigned short     po_sent_sz;      /* If PO_SENT_SZ is set, real size of sent buffer. */
127bfc7bfd8SDmitri Tikhonov    unsigned short     po_regen_sz;     /* Number of bytes at the beginning
128bfc7bfd8SDmitri Tikhonov                                         * of data containing bytes that are
129bfc7bfd8SDmitri Tikhonov                                         * not to be retransmitted, e.g. ACK
130bfc7bfd8SDmitri Tikhonov                                         * frames.
131bfc7bfd8SDmitri Tikhonov                                         */
132bfc7bfd8SDmitri Tikhonov    unsigned short     po_n_alloc;      /* Total number of bytes allocated in po_data */
1335392f7a3SLiteSpeed Tech    unsigned short     po_token_len;
1349626cfc2SDmitri Tikhonov    enum header_type   po_header_type:8;
1355392f7a3SLiteSpeed Tech    unsigned char      po_path_id;
1365392f7a3SLiteSpeed Tech    enum {
1375392f7a3SLiteSpeed Tech        POL_GQUIC    = 1 << 0,         /* Used for logging */
1385392f7a3SLiteSpeed Tech#define POLEV_SHIFT 1
1395392f7a3SLiteSpeed Tech        POL_ELBIT_0  = 1 << 1,         /* EL bits encode the crypto level. */
1405392f7a3SLiteSpeed Tech        POL_ELBIT_1  = 1 << 2,
1415392f7a3SLiteSpeed Tech#define POKP_SHIFT 3
1425392f7a3SLiteSpeed Tech        POL_KEY_PHASE= 1 << 3,         /* Used for logging */
1435392f7a3SLiteSpeed Tech#define POECN_SHIFT 4
1445392f7a3SLiteSpeed Tech        POL_ECNBIT_0 = 1 << 4,
1455392f7a3SLiteSpeed Tech        POL_ECNBIT_1 = 1 << 5,
1465392f7a3SLiteSpeed Tech    }                  po_lflags:8;
147bfc7bfd8SDmitri Tikhonov    unsigned char     *po_data;
148bfc7bfd8SDmitri Tikhonov
14950aadb33SDmitri Tikhonov    /* A lot of packets contain data belonging to only one stream.  Thus,
150c51ce338SDmitri Tikhonov     * `one' is used first.  If this is not enough, any number of
15150aadb33SDmitri Tikhonov     * stream_rec_arr structures can be allocated to handle more stream
15250aadb33SDmitri Tikhonov     * records.
15350aadb33SDmitri Tikhonov     */
154c51ce338SDmitri Tikhonov    union {
155c51ce338SDmitri Tikhonov        struct stream_rec               one;
156c51ce338SDmitri Tikhonov        struct stream_rec_arr_tailq     arr;
157c51ce338SDmitri Tikhonov    }                  po_srecs;
15850aadb33SDmitri Tikhonov
15950aadb33SDmitri Tikhonov    /* If PO_ENCRYPTED is set, this points to the buffer that holds encrypted
16050aadb33SDmitri Tikhonov     * data.
16150aadb33SDmitri Tikhonov     */
16250aadb33SDmitri Tikhonov    unsigned char     *po_enc_data;
16350aadb33SDmitri Tikhonov
16450aadb33SDmitri Tikhonov    lsquic_ver_tag_t   po_ver_tag;      /* Set if PO_VERSION is set */
16550aadb33SDmitri Tikhonov    unsigned char     *po_nonce;        /* Use to generate header if PO_NONCE is set */
1665392f7a3SLiteSpeed Tech    const struct network_path
1675392f7a3SLiteSpeed Tech                      *po_path;
1685392f7a3SLiteSpeed Tech#define po_token po_nonce
1695392f7a3SLiteSpeed Tech    struct bwp_state  *po_bwp_state;
17050aadb33SDmitri Tikhonov} lsquic_packet_out_t;
17150aadb33SDmitri Tikhonov
1725392f7a3SLiteSpeed Tech/* This is to make sure these bit names are not used, they are only for
1735392f7a3SLiteSpeed Tech * convenience in gdb output.
1745392f7a3SLiteSpeed Tech */
1755392f7a3SLiteSpeed Tech#define PO_PNS_HSK
1765392f7a3SLiteSpeed Tech#define PO_PNS_APP
1775392f7a3SLiteSpeed Tech
17850aadb33SDmitri Tikhonov/* The size of lsquic_packet_out_t could be further reduced:
17950aadb33SDmitri Tikhonov *
18050aadb33SDmitri Tikhonov * po_ver_tag could be encoded as a few bits representing enum lsquic_version
18150aadb33SDmitri Tikhonov * in po_flags.  The cost is a bit of complexity.  This will save us four bytes.
18250aadb33SDmitri Tikhonov */
18350aadb33SDmitri Tikhonov
18450aadb33SDmitri Tikhonov#define lsquic_packet_out_avail(p) ((unsigned short) \
18550aadb33SDmitri Tikhonov                                        ((p)->po_n_alloc - (p)->po_data_sz))
18650aadb33SDmitri Tikhonov
18750aadb33SDmitri Tikhonov#define lsquic_packet_out_packno_bits(p) (((p)->po_flags >> POBIT_SHIFT) & 0x3)
18850aadb33SDmitri Tikhonov
189bfc7bfd8SDmitri Tikhonov#define lsquic_packet_out_set_packno_bits(p, b) do {                    \
190bfc7bfd8SDmitri Tikhonov    (p)->po_flags &= ~(0x3 << POBIT_SHIFT);                             \
191bfc7bfd8SDmitri Tikhonov    (p)->po_flags |= ((b) & 0x3) << POBIT_SHIFT;                        \
192bfc7bfd8SDmitri Tikhonov} while (0)
193bfc7bfd8SDmitri Tikhonov
1941e75f938SDmitri Tikhonov#define lsquic_packet_out_ipv6(p) ((int)(((p)->po_flags >> POIPv6_SHIFT) & 1))
1951e75f938SDmitri Tikhonov
1961e75f938SDmitri Tikhonov#define lsquic_packet_out_set_ipv6(p, b) do {                           \
1971e75f938SDmitri Tikhonov    (p)->po_flags &= ~(1 << POIPv6_SHIFT);                              \
1981e75f938SDmitri Tikhonov    (p)->po_flags |= ((b) & 1) << POIPv6_SHIFT;                         \
1991e75f938SDmitri Tikhonov} while (0)
2001e75f938SDmitri Tikhonov
2015392f7a3SLiteSpeed Tech#define lsquic_packet_out_spin_bit(p) (((p)->po_flags & PO_SPIN_BIT) > 0)
2025392f7a3SLiteSpeed Tech
2035392f7a3SLiteSpeed Tech#define lsquic_packet_out_set_spin_bit(p, b) do {                       \
2045392f7a3SLiteSpeed Tech    (p)->po_flags &= ~PO_SPIN_BIT;                                      \
2055392f7a3SLiteSpeed Tech    (p)->po_flags |= ((b) & 1) << POSPIN_SHIFT;                         \
2065392f7a3SLiteSpeed Tech} while (0)
2075392f7a3SLiteSpeed Tech
2085392f7a3SLiteSpeed Tech#define lsquic_packet_out_key_phase(p) 0    /* TODO */
2095392f7a3SLiteSpeed Tech
2105392f7a3SLiteSpeed Tech#define lsquic_po_header_length(lconn, po_flags, dcid_len) ( \
2115392f7a3SLiteSpeed Tech    lconn->cn_pf->pf_packout_max_header_size(lconn, po_flags, dcid_len))
21250aadb33SDmitri Tikhonov
2139626cfc2SDmitri Tikhonov#define lsquic_packet_out_total_sz(lconn, p) (\
2149626cfc2SDmitri Tikhonov    lconn->cn_pf->pf_packout_size(lconn, p))
215bfc7bfd8SDmitri Tikhonov
21616a9b66aSDmitri Tikhonov#if __GNUC__
21716a9b66aSDmitri Tikhonov#if LSQUIC_EXTRA_CHECKS
2189626cfc2SDmitri Tikhonov#define lsquic_packet_out_sent_sz(lconn, p) (                               \
21916a9b66aSDmitri Tikhonov        __builtin_expect(((p)->po_flags & PO_SENT_SZ), 1) ?                 \
2209626cfc2SDmitri Tikhonov        (assert((p)->po_sent_sz == lsquic_packet_out_total_sz(lconn, p)),   \
2219626cfc2SDmitri Tikhonov            (p)->po_sent_sz) : lsquic_packet_out_total_sz(lconn, p))
22216a9b66aSDmitri Tikhonov#   else
2239626cfc2SDmitri Tikhonov#define lsquic_packet_out_sent_sz(lconn, p) (                               \
22416a9b66aSDmitri Tikhonov        __builtin_expect(((p)->po_flags & PO_SENT_SZ), 1) ?                 \
2259626cfc2SDmitri Tikhonov        (p)->po_sent_sz : lsquic_packet_out_total_sz(lconn, p))
22616a9b66aSDmitri Tikhonov#endif
22716a9b66aSDmitri Tikhonov#else
2289626cfc2SDmitri Tikhonov#   define lsquic_packet_out_sent_sz(lconn, p) (                            \
22916a9b66aSDmitri Tikhonov        (p)->po_flags & PO_SENT_SZ ?                                        \
2309626cfc2SDmitri Tikhonov        (p)->po_sent_sz : lsquic_packet_out_total_sz(lconn, p))
23116a9b66aSDmitri Tikhonov#endif
23216a9b66aSDmitri Tikhonov
23350aadb33SDmitri Tikhonov#define lsquic_packet_out_verneg(p) \
2345392f7a3SLiteSpeed Tech    (((p)->po_flags & (PO_NOENCRYPT|PO_VERNEG|PO_RETRY)) == (PO_NOENCRYPT|PO_VERNEG))
23550aadb33SDmitri Tikhonov
23650aadb33SDmitri Tikhonov#define lsquic_packet_out_pubres(p) \
2375392f7a3SLiteSpeed Tech    (((p)->po_flags & (PO_NOENCRYPT|PO_VERNEG|PO_RETRY)) ==  PO_NOENCRYPT           )
2385392f7a3SLiteSpeed Tech
2395392f7a3SLiteSpeed Tech#define lsquic_packet_out_retry(p) \
2405392f7a3SLiteSpeed Tech    (((p)->po_flags & (PO_NOENCRYPT|PO_VERNEG|PO_RETRY)) == (PO_NOENCRYPT|PO_RETRY) )
24150aadb33SDmitri Tikhonov
2429626cfc2SDmitri Tikhonov#define lsquic_packet_out_set_enc_level(p, level) do {                      \
2435392f7a3SLiteSpeed Tech    (p)->po_lflags &= ~(3 << POLEV_SHIFT);                                  \
2445392f7a3SLiteSpeed Tech    (p)->po_lflags |= level << POLEV_SHIFT;                                 \
2455392f7a3SLiteSpeed Tech} while (0)
2465392f7a3SLiteSpeed Tech
2475392f7a3SLiteSpeed Tech#define lsquic_packet_out_enc_level(p)  (((p)->po_lflags >> POLEV_SHIFT) & 3)
2485392f7a3SLiteSpeed Tech
2495392f7a3SLiteSpeed Tech#define lsquic_packet_out_set_kp(p, kp) do {                                \
2505392f7a3SLiteSpeed Tech    (p)->po_lflags &= ~(1 << POKP_SHIFT);                                   \
2515392f7a3SLiteSpeed Tech    (p)->po_lflags |= kp << POKP_SHIFT;                                     \
2525392f7a3SLiteSpeed Tech} while (0)
2535392f7a3SLiteSpeed Tech
2545392f7a3SLiteSpeed Tech#define lsquic_packet_out_kp(p)  (((p)->po_lflags >> POKP_SHIFT) & 1)
2555392f7a3SLiteSpeed Tech
2565392f7a3SLiteSpeed Tech#define lsquic_packet_out_set_pns(p, pns) do {                              \
2575392f7a3SLiteSpeed Tech    (p)->po_flags &= ~(3 << POPNS_SHIFT);                                   \
2585392f7a3SLiteSpeed Tech    (p)->po_flags |= pns << POPNS_SHIFT;                                    \
2595392f7a3SLiteSpeed Tech} while (0)
2605392f7a3SLiteSpeed Tech
2615392f7a3SLiteSpeed Tech#define lsquic_packet_out_pns(p)  (((p)->po_flags >> POPNS_SHIFT) & 3)
2625392f7a3SLiteSpeed Tech
2635392f7a3SLiteSpeed Tech#define lsquic_packet_out_set_ecn(p, ecn) do {                              \
2645392f7a3SLiteSpeed Tech    (p)->po_lflags &= ~(3 << POECN_SHIFT);                                  \
2655392f7a3SLiteSpeed Tech    (p)->po_lflags |= ecn << POECN_SHIFT;                                   \
2669626cfc2SDmitri Tikhonov} while (0)
2679626cfc2SDmitri Tikhonov
2685392f7a3SLiteSpeed Tech#define lsquic_packet_out_ecn(p)  (((p)->po_lflags >> POECN_SHIFT) & 3)
2699626cfc2SDmitri Tikhonov
27050aadb33SDmitri Tikhonovstruct packet_out_srec_iter {
27150aadb33SDmitri Tikhonov    lsquic_packet_out_t         *packet_out;
27250aadb33SDmitri Tikhonov    struct stream_rec_arr       *cur_srec_arr;
27350aadb33SDmitri Tikhonov    unsigned                     srec_idx;
274c51ce338SDmitri Tikhonov    int                          impl_idx;
27550aadb33SDmitri Tikhonov};
27650aadb33SDmitri Tikhonov
2775392f7a3SLiteSpeed Tech
27850aadb33SDmitri Tikhonovstruct stream_rec *
27950aadb33SDmitri Tikhonovposi_first (struct packet_out_srec_iter *posi, lsquic_packet_out_t *);
28050aadb33SDmitri Tikhonov
28150aadb33SDmitri Tikhonovstruct stream_rec *
28250aadb33SDmitri Tikhonovposi_next (struct packet_out_srec_iter *posi);
28350aadb33SDmitri Tikhonov
28450aadb33SDmitri Tikhonovlsquic_packet_out_t *
28550aadb33SDmitri Tikhonovlsquic_packet_out_new (struct lsquic_mm *, struct malo *, int use_cid,
286c7d81ce1SDmitri Tikhonov                       const struct lsquic_conn *, enum packno_bits,
2875392f7a3SLiteSpeed Tech                       const lsquic_ver_tag_t *, const unsigned char *nonce,
2885392f7a3SLiteSpeed Tech                       const struct network_path *);
28950aadb33SDmitri Tikhonov
29050aadb33SDmitri Tikhonovvoid
29150aadb33SDmitri Tikhonovlsquic_packet_out_destroy (lsquic_packet_out_t *,
2921e75f938SDmitri Tikhonov                        struct lsquic_engine_public *, void *peer_ctx);
29350aadb33SDmitri Tikhonov
29450aadb33SDmitri Tikhonovint
29550aadb33SDmitri Tikhonovlsquic_packet_out_add_stream (lsquic_packet_out_t *packet_out,
29650aadb33SDmitri Tikhonov                              struct lsquic_mm *mm,
29750aadb33SDmitri Tikhonov                              struct lsquic_stream *new_stream,
2986aba801dSDmitri Tikhonov                              enum quic_frame_type,
299c51ce338SDmitri Tikhonov                              unsigned short off, unsigned short len);
30050aadb33SDmitri Tikhonov
301bfc7bfd8SDmitri Tikhonovunsigned
3025392f7a3SLiteSpeed Techlsquic_packet_out_elide_reset_stream_frames (lsquic_packet_out_t *,
3035392f7a3SLiteSpeed Tech                                                    lsquic_stream_id_t);
304c51ce338SDmitri Tikhonov
305c51ce338SDmitri Tikhonovint
306c51ce338SDmitri Tikhonovlsquic_packet_out_split_in_two (struct lsquic_mm *, lsquic_packet_out_t *,
307c51ce338SDmitri Tikhonov    lsquic_packet_out_t *, const struct parse_funcs *, unsigned excess_bytes);
30850aadb33SDmitri Tikhonov
30950aadb33SDmitri Tikhonovvoid
31050aadb33SDmitri Tikhonovlsquic_packet_out_chop_regen (lsquic_packet_out_t *);
31150aadb33SDmitri Tikhonov
312c51ce338SDmitri Tikhonovvoid
313c51ce338SDmitri Tikhonovlsquic_packet_out_ack_streams (struct lsquic_packet_out *);
314c51ce338SDmitri Tikhonov
315c51ce338SDmitri Tikhonovvoid
316c51ce338SDmitri Tikhonovlsquic_packet_out_zero_pad (struct lsquic_packet_out *);
317c51ce338SDmitri Tikhonov
318c51ce338SDmitri Tikhonovsize_t
319c51ce338SDmitri Tikhonovlsquic_packet_out_mem_used (const struct lsquic_packet_out *);
320c51ce338SDmitri Tikhonov
321c51ce338SDmitri Tikhonovint
322c51ce338SDmitri Tikhonovlsquic_packet_out_turn_on_fin (struct lsquic_packet_out *,
323c51ce338SDmitri Tikhonov                   const struct parse_funcs *, const struct lsquic_stream *);
324c51ce338SDmitri Tikhonov
32550aadb33SDmitri Tikhonov#endif
326