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