xref: /freebsd/crypto/openssl/include/internal/quic_fifd.h (revision e7be843b4a162e68651d3911f0357ed464915629)
1*e7be843bSPierre Pronchery /*
2*e7be843bSPierre Pronchery  * Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved.
3*e7be843bSPierre Pronchery  *
4*e7be843bSPierre Pronchery  * Licensed under the Apache License 2.0 (the "License").  You may not use
5*e7be843bSPierre Pronchery  * this file except in compliance with the License.  You can obtain a copy
6*e7be843bSPierre Pronchery  * in the file LICENSE in the source distribution or at
7*e7be843bSPierre Pronchery  * https://www.openssl.org/source/license.html
8*e7be843bSPierre Pronchery  */
9*e7be843bSPierre Pronchery 
10*e7be843bSPierre Pronchery #ifndef OSSL_QUIC_FIFD_H
11*e7be843bSPierre Pronchery # define OSSL_QUIC_FIFD_H
12*e7be843bSPierre Pronchery 
13*e7be843bSPierre Pronchery # include <openssl/ssl.h>
14*e7be843bSPierre Pronchery # include "internal/quic_types.h"
15*e7be843bSPierre Pronchery # include "internal/quic_cfq.h"
16*e7be843bSPierre Pronchery # include "internal/quic_ackm.h"
17*e7be843bSPierre Pronchery # include "internal/quic_txpim.h"
18*e7be843bSPierre Pronchery # include "internal/quic_stream.h"
19*e7be843bSPierre Pronchery # include "internal/qlog.h"
20*e7be843bSPierre Pronchery 
21*e7be843bSPierre Pronchery # ifndef OPENSSL_NO_QUIC
22*e7be843bSPierre Pronchery 
23*e7be843bSPierre Pronchery /*
24*e7be843bSPierre Pronchery  * QUIC Frame-in-Flight Dispatcher (FIFD)
25*e7be843bSPierre Pronchery  * ======================================
26*e7be843bSPierre Pronchery  */
27*e7be843bSPierre Pronchery struct quic_fifd_st {
28*e7be843bSPierre Pronchery     /* Internal data; use the ossl_quic_fifd functions. */
29*e7be843bSPierre Pronchery     QUIC_CFQ       *cfq;
30*e7be843bSPierre Pronchery     OSSL_ACKM      *ackm;
31*e7be843bSPierre Pronchery     QUIC_TXPIM     *txpim;
32*e7be843bSPierre Pronchery     QUIC_SSTREAM *(*get_sstream_by_id)(uint64_t stream_id,
33*e7be843bSPierre Pronchery                                        uint32_t pn_space,
34*e7be843bSPierre Pronchery                                        void *arg);
35*e7be843bSPierre Pronchery     void           *get_sstream_by_id_arg;
36*e7be843bSPierre Pronchery     void          (*regen_frame)(uint64_t frame_type,
37*e7be843bSPierre Pronchery                                  uint64_t stream_id,
38*e7be843bSPierre Pronchery                                  QUIC_TXPIM_PKT *pkt,
39*e7be843bSPierre Pronchery                                  void *arg);
40*e7be843bSPierre Pronchery     void           *regen_frame_arg;
41*e7be843bSPierre Pronchery     void          (*confirm_frame)(uint64_t frame_type,
42*e7be843bSPierre Pronchery                                    uint64_t stream_id,
43*e7be843bSPierre Pronchery                                    QUIC_TXPIM_PKT *pkt,
44*e7be843bSPierre Pronchery                                    void *arg);
45*e7be843bSPierre Pronchery     void           *confirm_frame_arg;
46*e7be843bSPierre Pronchery     void          (*sstream_updated)(uint64_t stream_id,
47*e7be843bSPierre Pronchery                                    void *arg);
48*e7be843bSPierre Pronchery     void           *sstream_updated_arg;
49*e7be843bSPierre Pronchery     QLOG         *(*get_qlog_cb)(void *arg);
50*e7be843bSPierre Pronchery     void           *get_qlog_cb_arg;
51*e7be843bSPierre Pronchery };
52*e7be843bSPierre Pronchery 
53*e7be843bSPierre Pronchery int ossl_quic_fifd_init(QUIC_FIFD *fifd,
54*e7be843bSPierre Pronchery                         QUIC_CFQ *cfq,
55*e7be843bSPierre Pronchery                         OSSL_ACKM *ackm,
56*e7be843bSPierre Pronchery                         QUIC_TXPIM *txpim,
57*e7be843bSPierre Pronchery                         /* stream_id is UINT64_MAX for the crypto stream */
58*e7be843bSPierre Pronchery                         QUIC_SSTREAM *(*get_sstream_by_id)(uint64_t stream_id,
59*e7be843bSPierre Pronchery                                                            uint32_t pn_space,
60*e7be843bSPierre Pronchery                                                            void *arg),
61*e7be843bSPierre Pronchery                         void *get_sstream_by_id_arg,
62*e7be843bSPierre Pronchery                         /* stream_id is UINT64_MAX if not applicable */
63*e7be843bSPierre Pronchery                         void (*regen_frame)(uint64_t frame_type,
64*e7be843bSPierre Pronchery                                             uint64_t stream_id,
65*e7be843bSPierre Pronchery                                             QUIC_TXPIM_PKT *pkt,
66*e7be843bSPierre Pronchery                                             void *arg),
67*e7be843bSPierre Pronchery                         void *regen_frame_arg,
68*e7be843bSPierre Pronchery                         void (*confirm_frame)(uint64_t frame_type,
69*e7be843bSPierre Pronchery                                              uint64_t stream_id,
70*e7be843bSPierre Pronchery                                              QUIC_TXPIM_PKT *pkt,
71*e7be843bSPierre Pronchery                                              void *arg),
72*e7be843bSPierre Pronchery                         void *confirm_frame_arg,
73*e7be843bSPierre Pronchery                         void (*sstream_updated)(uint64_t stream_id,
74*e7be843bSPierre Pronchery                                                 void *arg),
75*e7be843bSPierre Pronchery                         void *sstream_updated_arg,
76*e7be843bSPierre Pronchery                         QLOG *(*get_qlog_cb)(void *arg),
77*e7be843bSPierre Pronchery                         void *get_qlog_cb_arg);
78*e7be843bSPierre Pronchery 
79*e7be843bSPierre Pronchery void ossl_quic_fifd_cleanup(QUIC_FIFD *fifd); /* (no-op) */
80*e7be843bSPierre Pronchery 
81*e7be843bSPierre Pronchery int ossl_quic_fifd_pkt_commit(QUIC_FIFD *fifd, QUIC_TXPIM_PKT *pkt);
82*e7be843bSPierre Pronchery 
83*e7be843bSPierre Pronchery void ossl_quic_fifd_set_qlog_cb(QUIC_FIFD *fifd, QLOG *(*get_qlog_cb)(void *arg),
84*e7be843bSPierre Pronchery                                 void *arg);
85*e7be843bSPierre Pronchery 
86*e7be843bSPierre Pronchery # endif
87*e7be843bSPierre Pronchery 
88*e7be843bSPierre Pronchery #endif
89