Home | History | Annotate | Line # | Download | only in internal
      1      1.1  christos /*
      2  1.1.1.2  christos  * Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
      3  1.1.1.2  christos  *
      4  1.1.1.2  christos  * Licensed under the Apache License 2.0 (the "License").  You may not use
      5  1.1.1.2  christos  * this file except in compliance with the License.  You can obtain a copy
      6  1.1.1.2  christos  * in the file LICENSE in the source distribution or at
      7  1.1.1.2  christos  * https://www.openssl.org/source/license.html
      8  1.1.1.2  christos  */
      9      1.1  christos 
     10      1.1  christos #ifndef OSSL_INTERNAL_QUIC_STREAM_H
     11  1.1.1.2  christos #define OSSL_INTERNAL_QUIC_STREAM_H
     12  1.1.1.2  christos #pragma once
     13      1.1  christos 
     14      1.1  christos #include "internal/e_os.h"
     15      1.1  christos #include "internal/time.h"
     16      1.1  christos #include "internal/quic_types.h"
     17      1.1  christos #include "internal/quic_predef.h"
     18      1.1  christos #include "internal/quic_wire.h"
     19      1.1  christos #include "internal/quic_record_tx.h"
     20      1.1  christos #include "internal/quic_record_rx.h"
     21      1.1  christos #include "internal/quic_fc.h"
     22      1.1  christos #include "internal/quic_statm.h"
     23      1.1  christos 
     24  1.1.1.2  christos #ifndef OPENSSL_NO_QUIC
     25      1.1  christos 
     26      1.1  christos /*
     27      1.1  christos  * QUIC Send Stream
     28      1.1  christos  * ================
     29      1.1  christos  *
     30      1.1  christos  * The QUIC Send Stream Manager (QUIC_SSTREAM) is responsible for:
     31      1.1  christos  *
     32      1.1  christos  *   - accepting octet strings of stream data;
     33      1.1  christos  *
     34      1.1  christos  *   - generating corresponding STREAM frames;
     35      1.1  christos  *
     36      1.1  christos  *   - receiving notifications of lost frames, in order to generate new STREAM
     37      1.1  christos  *     frames for the lost data;
     38      1.1  christos  *
     39      1.1  christos  *   - receiving notifications of acknowledged frames, in order to internally
     40      1.1  christos  *     reuse memory used to store acknowledged stream data;
     41      1.1  christos  *
     42      1.1  christos  *   - informing the caller of how much more stream data it can accept into
     43      1.1  christos  *     its internal buffers, so as to ensure that the amount of unacknowledged
     44      1.1  christos  *     data which can be written to a stream is not infinite and to allow the
     45      1.1  christos  *     caller to manifest backpressure conditions to the user.
     46      1.1  christos  *
     47      1.1  christos  * The QUIC_SSTREAM is instantiated once for every stream with a send component
     48      1.1  christos  * (i.e., for a unidirectional send stream or for the send component of a
     49      1.1  christos  * bidirectional stream).
     50      1.1  christos  *
     51      1.1  christos  * Note: The terms 'TX' and 'RX' are used when referring to frames, packets and
     52      1.1  christos  * datagrams. The terms 'send' and 'receive' are used when referring to the
     53      1.1  christos  * stream abstraction. Applications send; we transmit.
     54      1.1  christos  */
     55      1.1  christos 
     56      1.1  christos /*
     57      1.1  christos  * Instantiates a new QUIC_SSTREAM. init_buf_size specifies the initial size of
     58      1.1  christos  * the stream data buffer in bytes, which must be positive.
     59      1.1  christos  */
     60      1.1  christos QUIC_SSTREAM *ossl_quic_sstream_new(size_t init_buf_size);
     61      1.1  christos 
     62      1.1  christos /*
     63      1.1  christos  * Frees a QUIC_SSTREAM and associated stream data storage.
     64      1.1  christos  *
     65      1.1  christos  * Any iovecs returned by ossl_quic_sstream_get_stream_frame cease to be valid after
     66      1.1  christos  * calling this function.
     67      1.1  christos  */
     68      1.1  christos void ossl_quic_sstream_free(QUIC_SSTREAM *qss);
     69      1.1  christos 
     70      1.1  christos /*
     71      1.1  christos  * (For TX packetizer use.) Retrieves information about application stream data
     72      1.1  christos  * which is ready for transmission.
     73      1.1  christos  *
     74      1.1  christos  * *hdr is filled with the logical offset, maximum possible length of stream
     75      1.1  christos  * data which can be transmitted, and a pointer to the stream data to be
     76      1.1  christos  * transmitted. is_fin is set to 1 if hdr->offset + hdr->len is the final size
     77      1.1  christos  * of the stream and 0 otherwise. hdr->stream_id is not set; the caller must set
     78      1.1  christos  * it.
     79      1.1  christos  *
     80      1.1  christos  * The caller is not obligated to send all of the data. If the caller does not
     81      1.1  christos  * send all of the data, the caller must reduce hdr->len before serializing the
     82      1.1  christos  * header structure and must ensure that hdr->is_fin is cleared.
     83      1.1  christos  *
     84      1.1  christos  * hdr->has_explicit_len is always set. It is the caller's responsibility to
     85      1.1  christos  * clear this if it wants to use the optimization of omitting the length field,
     86      1.1  christos  * as only the caller can know when this optimization can be performed.
     87      1.1  christos  *
     88      1.1  christos  * *num_iov must be set to the size of the iov array at call time. When this
     89      1.1  christos  * function returns successfully, it is updated to the number of iov entries
     90      1.1  christos  * which have been written.
     91      1.1  christos  *
     92      1.1  christos  * The stream data may be split across up to two IOVs due to internal ring
     93      1.1  christos  * buffer organisation. The sum of the lengths of the IOVs and the value written
     94      1.1  christos  * to hdr->len will always match. If the caller decides to send less than
     95      1.1  christos  * hdr->len of stream data, it must adjust the IOVs accordingly. This may be
     96      1.1  christos  * done by updating hdr->len and then calling the utility function
     97      1.1  christos  * ossl_quic_sstream_adjust_iov().
     98      1.1  christos  *
     99      1.1  christos  * After committing one or more bytes returned by ossl_quic_sstream_get_stream_frame to a
    100      1.1  christos  * packet, call ossl_quic_sstream_mark_transmitted with the inclusive range of logical
    101      1.1  christos  * byte numbers of the transmitted bytes (i.e., hdr->offset, hdr->offset +
    102      1.1  christos  * hdr->len - 1). If you do not call ossl_quic_sstream_mark_transmitted, the next call to
    103      1.1  christos  * ossl_quic_sstream_get_stream_frame will return the same data (or potentially the same
    104      1.1  christos  * and more, if more data has been appended by the application).
    105      1.1  christos  *
    106      1.1  christos  * It is the caller's responsibility to clamp the length of data which this
    107      1.1  christos  * function indicates is available according to other concerns, such as
    108      1.1  christos  * stream-level flow control, connection-level flow control, or the applicable
    109      1.1  christos  * maximum datagram payload length (MDPL) for a packet under construction.
    110      1.1  christos  *
    111      1.1  christos  * The skip argument can usually be given as zero. If it is non-zero, this
    112      1.1  christos  * function outputs a range which would be output if it were called again after
    113      1.1  christos  * calling ossl_quic_sstream_mark_transmitted() with the returned range, repeated 'skip'
    114      1.1  christos  * times, and so on. This may be useful for callers which wish to enumerate
    115      1.1  christos  * available stream frames and batch their calls to ossl_quic_sstream_mark_transmitted at
    116      1.1  christos  * a later time.
    117      1.1  christos  *
    118      1.1  christos  * On success, this function will never write *num_iov with a value other than
    119      1.1  christos  * 0, 1 or 2. A *num_iov value of 0 can only occurs when hdr->is_fin is set (for
    120      1.1  christos  * example, when a stream is closed after all existing data has been sent, and
    121      1.1  christos  * without sending any more data); otherwise the function returns 0 as there is
    122      1.1  christos  * nothing useful to report.
    123      1.1  christos  *
    124      1.1  christos  * Returns 1 on success and 0 if there is no stream data available for
    125      1.1  christos  * transmission, or on other error (such as if the caller provides fewer
    126      1.1  christos  * than two IOVs.)
    127      1.1  christos  */
    128      1.1  christos int ossl_quic_sstream_get_stream_frame(QUIC_SSTREAM *qss,
    129  1.1.1.2  christos     size_t skip,
    130  1.1.1.2  christos     OSSL_QUIC_FRAME_STREAM *hdr,
    131  1.1.1.2  christos     OSSL_QTX_IOVEC *iov,
    132  1.1.1.2  christos     size_t *num_iov);
    133      1.1  christos 
    134      1.1  christos /*
    135      1.1  christos  * Returns 1 if there is data pending transmission. Equivalent to calling
    136      1.1  christos  * ossl_quic_sstream_get_stream_frame and seeing if it succeeds.
    137      1.1  christos  */
    138      1.1  christos int ossl_quic_sstream_has_pending(QUIC_SSTREAM *qss);
    139      1.1  christos 
    140      1.1  christos /*
    141      1.1  christos  * Returns the current size of the stream; i.e., the number of bytes which have
    142      1.1  christos  * been appended to the stream so far.
    143      1.1  christos  */
    144      1.1  christos uint64_t ossl_quic_sstream_get_cur_size(QUIC_SSTREAM *qss);
    145      1.1  christos 
    146      1.1  christos /*
    147      1.1  christos  * (For TX packetizer use.) Marks a logical range of the send stream as having
    148      1.1  christos  * been transmitted.
    149      1.1  christos  *
    150      1.1  christos  * 0 denotes the first byte ever sent on the stream. The start and end values
    151      1.1  christos  * are both inclusive, therefore all calls to this function always mark at least
    152      1.1  christos  * one byte as being transmitted; if no bytes have been transmitted, do not call
    153      1.1  christos  * this function.
    154      1.1  christos  *
    155      1.1  christos  * If the STREAM frame sent had the FIN bit set, you must also call
    156      1.1  christos  * ossl_quic_sstream_mark_transmitted_fin() after calling this function.
    157      1.1  christos  *
    158      1.1  christos  * If you sent a zero-length STREAM frame with the FIN bit set, you need only
    159      1.1  christos  * call ossl_quic_sstream_mark_transmitted_fin() and must not call this function.
    160      1.1  christos  *
    161      1.1  christos  * Returns 1 on success and 0 on error (e.g. if end < start).
    162      1.1  christos  */
    163      1.1  christos int ossl_quic_sstream_mark_transmitted(QUIC_SSTREAM *qss,
    164  1.1.1.2  christos     uint64_t start,
    165  1.1.1.2  christos     uint64_t end);
    166      1.1  christos 
    167      1.1  christos /*
    168      1.1  christos  * (For TX packetizer use.) Marks a STREAM frame with the FIN bit set as having
    169      1.1  christos  * been transmitted. final_size is the final size of the stream (i.e., the value
    170      1.1  christos  * offset + len of the transmitted STREAM frame).
    171      1.1  christos  *
    172      1.1  christos  * This function fails returning 0 if ossl_quic_sstream_fin() has not been called or if
    173      1.1  christos  * final_size is not correct. The final_size argument is not strictly needed by
    174      1.1  christos  * the QUIC_SSTREAM but is required as a sanity check.
    175      1.1  christos  */
    176      1.1  christos int ossl_quic_sstream_mark_transmitted_fin(QUIC_SSTREAM *qss,
    177  1.1.1.2  christos     uint64_t final_size);
    178      1.1  christos 
    179      1.1  christos /*
    180      1.1  christos  * (RX/ACKM use.) Marks a logical range of the send stream as having been lost.
    181      1.1  christos  * The send stream will return the lost data for retransmission on a future call
    182      1.1  christos  * to ossl_quic_sstream_get_stream_frame. The start and end values denote logical byte
    183      1.1  christos  * numbers and are inclusive.
    184      1.1  christos  *
    185      1.1  christos  * If the lost frame had the FIN bit set, you must also call
    186      1.1  christos  * ossl_quic_sstream_mark_lost_fin() after calling this function.
    187      1.1  christos  *
    188      1.1  christos  * Returns 1 on success and 0 on error (e.g. if end < start).
    189      1.1  christos  */
    190      1.1  christos int ossl_quic_sstream_mark_lost(QUIC_SSTREAM *qss,
    191  1.1.1.2  christos     uint64_t start,
    192  1.1.1.2  christos     uint64_t end);
    193      1.1  christos 
    194      1.1  christos /*
    195      1.1  christos  * (RX/ACKM use.) Informs the QUIC_SSTREAM that a STREAM frame with the FIN bit
    196      1.1  christos  * set was lost.
    197      1.1  christos  *
    198      1.1  christos  * Returns 1 on success and 0 on error.
    199      1.1  christos  */
    200      1.1  christos int ossl_quic_sstream_mark_lost_fin(QUIC_SSTREAM *qss);
    201      1.1  christos 
    202      1.1  christos /*
    203      1.1  christos  * (RX/ACKM use.) Marks a logical range of the send stream as having been
    204      1.1  christos  * acknowledged, meaning that the storage for the data in that range of the
    205      1.1  christos  * stream can be now recycled and neither that logical range of the stream nor
    206      1.1  christos  * any subset of it can be retransmitted again. The start and end values are
    207      1.1  christos  * inclusive.
    208      1.1  christos  *
    209      1.1  christos  * If the acknowledged frame had the FIN bit set, you must also call
    210      1.1  christos  * ossl_quic_sstream_mark_acked_fin() after calling this function.
    211      1.1  christos  *
    212      1.1  christos  * Returns 1 on success and 0 on error (e.g. if end < start).
    213      1.1  christos  */
    214      1.1  christos int ossl_quic_sstream_mark_acked(QUIC_SSTREAM *qss,
    215  1.1.1.2  christos     uint64_t start,
    216  1.1.1.2  christos     uint64_t end);
    217      1.1  christos 
    218      1.1  christos /*
    219      1.1  christos  * (RX/ACKM use.) Informs the QUIC_SSTREAM that a STREAM frame with the FIN bit
    220      1.1  christos  * set was acknowledged.
    221      1.1  christos  *
    222      1.1  christos  * Returns 1 on success and 0 on error.
    223      1.1  christos  */
    224      1.1  christos int ossl_quic_sstream_mark_acked_fin(QUIC_SSTREAM *qss);
    225      1.1  christos 
    226      1.1  christos /*
    227      1.1  christos  * (Front end use.) Appends user data to the stream. The data is copied into the
    228      1.1  christos  * stream. The amount of data consumed from buf is written to *consumed on
    229      1.1  christos  * success (short writes are possible). The amount of data which can be written
    230      1.1  christos  * can be determined in advance by calling the ossl_quic_sstream_get_buffer_avail()
    231      1.1  christos  * function; data is copied into an internal ring buffer of finite size.
    232      1.1  christos  *
    233      1.1  christos  * If the buffer is full, this should be materialised as a backpressure
    234      1.1  christos  * condition by the front end. This is not considered a failure condition;
    235      1.1  christos  * *consumed is written as 0 and the function returns 1.
    236      1.1  christos  *
    237      1.1  christos  * Returns 1 on success or 0 on failure.
    238      1.1  christos  */
    239      1.1  christos int ossl_quic_sstream_append(QUIC_SSTREAM *qss,
    240  1.1.1.2  christos     const unsigned char *buf,
    241  1.1.1.2  christos     size_t buf_len,
    242  1.1.1.2  christos     size_t *consumed);
    243      1.1  christos 
    244      1.1  christos /*
    245      1.1  christos  * Marks a stream as finished. ossl_quic_sstream_append() may not be called anymore
    246      1.1  christos  * after calling this.
    247      1.1  christos  */
    248      1.1  christos void ossl_quic_sstream_fin(QUIC_SSTREAM *qss);
    249      1.1  christos 
    250      1.1  christos /*
    251      1.1  christos  * If the stream has had ossl_quic_sstream_fin() called, returns 1 and writes
    252      1.1  christos  * the final size to *final_size. Otherwise, returns 0.
    253      1.1  christos  */
    254      1.1  christos int ossl_quic_sstream_get_final_size(QUIC_SSTREAM *qss, uint64_t *final_size);
    255      1.1  christos 
    256      1.1  christos /*
    257      1.1  christos  * Returns 1 iff all bytes (and any FIN, if any) which have been appended to the
    258      1.1  christos  * QUIC_SSTREAM so far, and any FIN (if any), have been both sent and acked.
    259      1.1  christos  */
    260      1.1  christos int ossl_quic_sstream_is_totally_acked(QUIC_SSTREAM *qss);
    261      1.1  christos 
    262      1.1  christos /*
    263      1.1  christos  * Resizes the internal ring buffer. All stream data is preserved safely.
    264      1.1  christos  *
    265      1.1  christos  * This can be used to expand or contract the ring buffer, but not to contract
    266      1.1  christos  * the ring buffer below the amount of stream data currently stored in it.
    267      1.1  christos  * Returns 1 on success and 0 on failure.
    268      1.1  christos  *
    269      1.1  christos  * IMPORTANT: Any buffers referenced by iovecs output by
    270      1.1  christos  * ossl_quic_sstream_get_stream_frame() cease to be valid after calling this function.
    271      1.1  christos  */
    272      1.1  christos int ossl_quic_sstream_set_buffer_size(QUIC_SSTREAM *qss, size_t num_bytes);
    273      1.1  christos 
    274      1.1  christos /*
    275      1.1  christos  * Gets the internal ring buffer size in bytes.
    276      1.1  christos  */
    277      1.1  christos size_t ossl_quic_sstream_get_buffer_size(QUIC_SSTREAM *qss);
    278      1.1  christos 
    279      1.1  christos /*
    280      1.1  christos  * Gets the number of bytes used in the internal ring buffer.
    281      1.1  christos  */
    282      1.1  christos size_t ossl_quic_sstream_get_buffer_used(QUIC_SSTREAM *qss);
    283      1.1  christos 
    284      1.1  christos /*
    285      1.1  christos  * Gets the number of bytes free in the internal ring buffer.
    286      1.1  christos  */
    287      1.1  christos size_t ossl_quic_sstream_get_buffer_avail(QUIC_SSTREAM *qss);
    288      1.1  christos 
    289      1.1  christos /*
    290      1.1  christos  * Utility function to ensure the length of an array of iovecs matches the
    291      1.1  christos  * length given as len. Trailing iovecs have their length values reduced or set
    292      1.1  christos  * to 0 as necessary.
    293      1.1  christos  */
    294      1.1  christos void ossl_quic_sstream_adjust_iov(size_t len,
    295  1.1.1.2  christos     OSSL_QTX_IOVEC *iov,
    296  1.1.1.2  christos     size_t num_iov);
    297      1.1  christos 
    298      1.1  christos /*
    299      1.1  christos  * Sets flag to cleanse the buffered data when it is acked.
    300      1.1  christos  */
    301      1.1  christos void ossl_quic_sstream_set_cleanse(QUIC_SSTREAM *qss, int cleanse);
    302      1.1  christos 
    303      1.1  christos /*
    304      1.1  christos  * QUIC Receive Stream Manager
    305      1.1  christos  * ===========================
    306      1.1  christos  *
    307      1.1  christos  * The QUIC Receive Stream Manager (QUIC_RSTREAM) is responsible for
    308      1.1  christos  * storing the received stream data frames until the application
    309      1.1  christos  * is able to read the data.
    310      1.1  christos  *
    311      1.1  christos  * The QUIC_RSTREAM is instantiated once for every stream that can receive data.
    312      1.1  christos  * (i.e., for a unidirectional receiving stream or for the receiving component
    313      1.1  christos  * of a bidirectional stream).
    314      1.1  christos  */
    315      1.1  christos 
    316      1.1  christos /*
    317      1.1  christos  * Create a new instance of QUIC_RSTREAM with pointers to the flow
    318      1.1  christos  * controller and statistics module. They can be NULL for unit testing.
    319      1.1  christos  * If they are non-NULL, the `rxfc` is called when receive stream data
    320      1.1  christos  * is read by application. `statm` is queried for current rtt.
    321      1.1  christos  * `rbuf_size` is the initial size of the ring buffer to be used
    322      1.1  christos  * when ossl_quic_rstream_move_to_rbuf() is called.
    323      1.1  christos  */
    324      1.1  christos QUIC_RSTREAM *ossl_quic_rstream_new(QUIC_RXFC *rxfc,
    325  1.1.1.2  christos     OSSL_STATM *statm, size_t rbuf_size);
    326      1.1  christos 
    327      1.1  christos /*
    328      1.1  christos  * Frees a QUIC_RSTREAM and any associated storage.
    329      1.1  christos  */
    330      1.1  christos void ossl_quic_rstream_free(QUIC_RSTREAM *qrs);
    331      1.1  christos 
    332      1.1  christos /*
    333      1.1  christos  * Adds received stream frame data to `qrs`. The `pkt_wrap` refcount is
    334      1.1  christos  * incremented if the `data` is queued directly without copying.
    335      1.1  christos  * It can be NULL for unit-testing purposes, i.e. if `data` is static or
    336      1.1  christos  * never released before calling ossl_quic_rstream_free().
    337      1.1  christos  * The `offset` is the absolute offset of the data in the stream.
    338      1.1  christos  * `data_len` can be 0 - can be useful for indicating `fin` for empty stream.
    339      1.1  christos  * Or to indicate `fin` without any further data added to the stream.
    340      1.1  christos  */
    341      1.1  christos 
    342      1.1  christos int ossl_quic_rstream_queue_data(QUIC_RSTREAM *qrs, OSSL_QRX_PKT *pkt,
    343  1.1.1.2  christos     uint64_t offset,
    344  1.1.1.2  christos     const unsigned char *data, uint64_t data_len,
    345  1.1.1.2  christos     int fin);
    346      1.1  christos 
    347      1.1  christos /*
    348      1.1  christos  * Copies the data from the stream storage to buffer `buf` of size `size`.
    349      1.1  christos  * `readbytes` is set to the number of bytes actually copied.
    350      1.1  christos  * `fin` is set to 1 if all the data from the stream were read so the
    351      1.1  christos  * stream is finished. It is set to 0 otherwise.
    352      1.1  christos  */
    353      1.1  christos int ossl_quic_rstream_read(QUIC_RSTREAM *qrs, unsigned char *buf, size_t size,
    354  1.1.1.2  christos     size_t *readbytes, int *fin);
    355      1.1  christos 
    356      1.1  christos /*
    357      1.1  christos  * Peeks at the data in the stream storage. It copies them to buffer `buf`
    358      1.1  christos  * of size `size` and sets `readbytes` to the number of bytes actually copied.
    359      1.1  christos  * `fin` is set to 1 if the copied data reach end of the stream.
    360      1.1  christos  * It is set to 0 otherwise.
    361      1.1  christos  */
    362      1.1  christos int ossl_quic_rstream_peek(QUIC_RSTREAM *qrs, unsigned char *buf, size_t size,
    363  1.1.1.2  christos     size_t *readbytes, int *fin);
    364      1.1  christos 
    365      1.1  christos /*
    366      1.1  christos  * Returns the size of the data available for reading. `fin` is set to 1 if
    367      1.1  christos  * after reading all the available data the stream will be finished,
    368      1.1  christos  * set to 0 otherwise.
    369      1.1  christos  */
    370      1.1  christos int ossl_quic_rstream_available(QUIC_RSTREAM *qrs, size_t *avail, int *fin);
    371      1.1  christos 
    372      1.1  christos /*
    373      1.1  christos  * Sets *record to the beginning of the first readable stream data chunk and
    374      1.1  christos  * *reclen to the size of the chunk. *fin is set to 1 if the end of the
    375      1.1  christos  * chunk is the last of the stream data chunks.
    376      1.1  christos  * If there is no record available *record is set to NULL and *rec_len to 0;
    377      1.1  christos  * ossl_quic_rstream_release_record() should not be called in that case.
    378      1.1  christos  * Returns 1 on success (including calls if no record is available, or
    379      1.1  christos  * after end of the stream - in that case *fin will be set to 1 and
    380      1.1  christos  * *rec_len to 0), 0 on error.
    381      1.1  christos  * It is an error to call ossl_quic_rstream_get_record() multiple times
    382      1.1  christos  * without calling ossl_quic_rstream_release_record() in between.
    383      1.1  christos  */
    384      1.1  christos int ossl_quic_rstream_get_record(QUIC_RSTREAM *qrs,
    385  1.1.1.2  christos     const unsigned char **record, size_t *rec_len,
    386  1.1.1.2  christos     int *fin);
    387      1.1  christos 
    388      1.1  christos /*
    389      1.1  christos  * Releases (possibly partially) the record returned by
    390      1.1  christos  * previous ossl_quic_rstream_get_record() call.
    391      1.1  christos  * read_len between previously returned *rec_len and SIZE_MAX indicates
    392      1.1  christos  * release of the whole record. Otherwise only part of the record is
    393      1.1  christos  * released. The remaining part of the record is unlocked, another
    394      1.1  christos  * call to ossl_quic_rstream_get_record() is needed to obtain further
    395      1.1  christos  * stream data.
    396      1.1  christos  * Returns 1 on success, 0 on error.
    397      1.1  christos  * It is an error to call ossl_quic_rstream_release_record() multiple
    398      1.1  christos  * times without calling ossl_quic_rstream_get_record() in between.
    399      1.1  christos  */
    400      1.1  christos int ossl_quic_rstream_release_record(QUIC_RSTREAM *qrs, size_t read_len);
    401      1.1  christos 
    402      1.1  christos /*
    403      1.1  christos  * Moves received frame data from decrypted packets to ring buffer.
    404      1.1  christos  * This should be called when there are too many decrypted packets allocated.
    405      1.1  christos  * Returns 1 on success, 0 when it was not possible to release all
    406      1.1  christos  * referenced packets due to an insufficient size of the ring buffer.
    407      1.1  christos  * Exception is the packet from the record returned previously by
    408      1.1  christos  * ossl_quic_rstream_get_record() - that one will be always skipped.
    409      1.1  christos  */
    410      1.1  christos int ossl_quic_rstream_move_to_rbuf(QUIC_RSTREAM *qrs);
    411      1.1  christos 
    412      1.1  christos /*
    413      1.1  christos  * Resizes the internal ring buffer to a new `rbuf_size` size.
    414      1.1  christos  * Returns 1 on success, 0 on error.
    415      1.1  christos  * Possible error conditions are an allocation failure, trying to resize
    416      1.1  christos  * the ring buffer when ossl_quic_rstream_get_record() was called and
    417      1.1  christos  * not yet released, or trying to resize the ring buffer to a smaller size
    418      1.1  christos  * than currently occupied.
    419      1.1  christos  */
    420      1.1  christos int ossl_quic_rstream_resize_rbuf(QUIC_RSTREAM *qrs, size_t rbuf_size);
    421      1.1  christos 
    422      1.1  christos /*
    423      1.1  christos  * Sets flag to cleanse the buffered data when user reads it.
    424      1.1  christos  */
    425      1.1  christos void ossl_quic_rstream_set_cleanse(QUIC_RSTREAM *qrs, int cleanse);
    426  1.1.1.2  christos #endif
    427      1.1  christos 
    428      1.1  christos #endif
    429