summaryrefslogtreecommitdiffstats
path: root/include/internal/quic_fifd.h
blob: c1644e4d8ef2213c14bb3dc2de3e2f7ee1fcbc6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the Apache License 2.0 (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */

#ifndef OSSL_QUIC_FIFD_H
# define OSSL_QUIC_FIFD_H

# include <openssl/ssl.h>
# include "internal/quic_types.h"
# include "internal/quic_cfq.h"
# include "internal/quic_ackm.h"
# include "internal/quic_txpim.h"
# include "internal/quic_stream.h"
# include "internal/qlog.h"

# ifndef OPENSSL_NO_QUIC

/*
 * QUIC Frame-in-Flight Dispatcher (FIFD)
 * ======================================
 */
struct quic_fifd_st {
    /* Internal data; use the ossl_quic_fifd functions. */
    QUIC_CFQ       *cfq;
    OSSL_ACKM      *ackm;
    QUIC_TXPIM     *txpim;
    QUIC_SSTREAM *(*get_sstream_by_id)(uint64_t stream_id,
                                       uint32_t pn_space,
                                       void *arg);
    void           *get_sstream_by_id_arg;
    void          (*regen_frame)(uint64_t frame_type,
                                 uint64_t stream_id,
                                 QUIC_TXPIM_PKT *pkt,
                                 void *arg);
    void           *regen_frame_arg;
    void          (*confirm_frame)(uint64_t frame_type,
                                   uint64_t stream_id,
                                   QUIC_TXPIM_PKT *pkt,
                                   void *arg);
    void           *confirm_frame_arg;
    void          (*sstream_updated)(uint64_t stream_id,
                                   void *arg);
    void           *sstream_updated_arg;
    QLOG         *(*get_qlog_cb)(void *arg);
    void           *get_qlog_cb_arg;
};

int ossl_quic_fifd_init(QUIC_FIFD *fifd,
                        QUIC_CFQ *cfq,
                        OSSL_ACKM *ackm,
                        QUIC_TXPIM *txpim,
                        /* stream_id is UINT64_MAX for the crypto stream */
                        QUIC_SSTREAM *(*get_sstream_by_id)(uint64_t stream_id,
                                                           uint32_t pn_space,
                                                           void *arg),
                        void *get_sstream_by_id_arg,
                        /* stream_id is UINT64_MAX if not applicable */
                        void (*regen_frame)(uint64_t frame_type,
                                            uint64_t stream_id,
                                            QUIC_TXPIM_PKT *pkt,
                                            void *arg),
                        void *regen_frame_arg,
                        void (*confirm_frame)(uint64_t frame_type,
                                             uint64_t stream_id,
                                             QUIC_TXPIM_PKT *pkt,
                                             void *arg),
                        void *confirm_frame_arg,
                        void (*sstream_updated)(uint64_t stream_id,
                                                void *arg),
                        void *sstream_updated_arg,
                        QLOG *(*get_qlog_cb)(void *arg),
                        void *get_qlog_cb_arg);

void ossl_quic_fifd_cleanup(QUIC_FIFD *fifd); /* (no-op) */

int ossl_quic_fifd_pkt_commit(QUIC_FIFD *fifd, QUIC_TXPIM_PKT *pkt);

void ossl_quic_fifd_set_qlog_cb(QUIC_FIFD *fifd, QLOG *(*get_qlog_cb)(void *arg),
                                void *arg);

# endif

#endif