From: Hugo Landau Date: Thu, 9 Nov 2023 11:04:50 +0000 (+0000) Subject: QUIC Refactor: Fix ANSI - struct definition duplications X-Git-Tag: openssl-3.3.0-alpha1~406 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff3a26b24f0bf7f0b24e97453ea138dd167adcb5;p=thirdparty%2Fopenssl.git QUIC Refactor: Fix ANSI - struct definition duplications Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/22674) --- diff --git a/include/internal/quic_ackm.h b/include/internal/quic_ackm.h index 03fc6088678..69b862d9c55 100644 --- a/include/internal/quic_ackm.h +++ b/include/internal/quic_ackm.h @@ -13,13 +13,12 @@ # include "internal/quic_cc.h" # include "internal/quic_types.h" # include "internal/quic_wire.h" +# include "internal/quic_predef.h" # include "internal/time.h" # include "internal/list.h" # ifndef OPENSSL_NO_QUIC -typedef struct ossl_ackm_st OSSL_ACKM; - OSSL_ACKM *ossl_ackm_new(OSSL_TIME (*now)(void *arg), void *now_arg, OSSL_STATM *statm, diff --git a/include/internal/quic_cc.h b/include/internal/quic_cc.h index 60c710b0bda..dbd439dd0cf 100644 --- a/include/internal/quic_cc.h +++ b/include/internal/quic_cc.h @@ -11,11 +11,10 @@ #include "openssl/params.h" #include "internal/time.h" +#include "internal/quic_predef.h" # ifndef OPENSSL_NO_QUIC -typedef struct ossl_cc_data_st OSSL_CC_DATA; - typedef struct ossl_cc_ack_info_st { /* The time the packet being acknowledged was originally sent. */ OSSL_TIME tx_time; @@ -80,7 +79,7 @@ typedef struct ossl_cc_ecn_info_st { */ #define OSSL_CC_LOST_FLAG_PERSISTENT_CONGESTION (1U << 0) -typedef struct ossl_cc_method_st { +struct ossl_cc_method_st { /* * Instantiation. */ @@ -209,7 +208,7 @@ typedef struct ossl_cc_method_st { */ int (*on_ecn)(OSSL_CC_DATA *ccdata, const OSSL_CC_ECN_INFO *info); -} OSSL_CC_METHOD; +}; extern const OSSL_CC_METHOD ossl_cc_dummy_method; extern const OSSL_CC_METHOD ossl_cc_newreno_method; diff --git a/include/internal/quic_cfq.h b/include/internal/quic_cfq.h index 22c436dc074..56ebcb930ed 100644 --- a/include/internal/quic_cfq.h +++ b/include/internal/quic_cfq.h @@ -12,6 +12,7 @@ # include # include "internal/quic_types.h" +# include "internal/quic_predef.h" # ifndef OPENSSL_NO_QUIC @@ -63,7 +64,6 @@ int ossl_quic_cfq_item_is_unreliable(const QUIC_CFQ_ITEM *item); * QUIC Control Frame Queue * ======================== */ -typedef struct quic_cfq_st QUIC_CFQ; QUIC_CFQ *ossl_quic_cfq_new(void); void ossl_quic_cfq_free(QUIC_CFQ *cfq); diff --git a/include/internal/quic_channel.h b/include/internal/quic_channel.h index 0103b96eab6..a745baedb62 100644 --- a/include/internal/quic_channel.h +++ b/include/internal/quic_channel.h @@ -120,8 +120,6 @@ typedef struct quic_channel_args_st { SSL *tls; } QUIC_CHANNEL_ARGS; -typedef struct quic_channel_st QUIC_CHANNEL; - /* Represents the cause for a connection's termination. */ typedef struct quic_terminate_cause_st { /* diff --git a/include/internal/quic_demux.h b/include/internal/quic_demux.h index 40a1bc412fa..bc0ad956360 100644 --- a/include/internal/quic_demux.h +++ b/include/internal/quic_demux.h @@ -12,6 +12,7 @@ # include # include "internal/quic_types.h" +# include "internal/quic_predef.h" # include "internal/bio_addr.h" # include "internal/time.h" # include "internal/list.h" @@ -82,8 +83,6 @@ * same allocation. */ -typedef struct quic_urxe_st QUIC_URXE; - /* Maximum number of packets we allow to exist in one datagram. */ #define QUIC_MAX_PKT_PER_URXE (sizeof(uint64_t) * 8) @@ -158,9 +157,6 @@ void ossl_quic_urxe_remove(QUIC_URXE_LIST *l, QUIC_URXE *e); void ossl_quic_urxe_insert_head(QUIC_URXE_LIST *l, QUIC_URXE *e); void ossl_quic_urxe_insert_tail(QUIC_URXE_LIST *l, QUIC_URXE *e); -/* Opaque type representing a demuxer. */ -typedef struct quic_demux_st QUIC_DEMUX; - /* * Called when a datagram is received for a given connection ID. * diff --git a/include/internal/quic_lcidm.h b/include/internal/quic_lcidm.h index 9b114298148..4911e042302 100644 --- a/include/internal/quic_lcidm.h +++ b/include/internal/quic_lcidm.h @@ -15,6 +15,7 @@ # include "internal/time.h" # include "internal/quic_types.h" # include "internal/quic_wire.h" +# include "internal/quic_predef.h" # ifndef OPENSSL_NO_QUIC @@ -95,7 +96,6 @@ * An ODCID has no sequence number associated with it. It is the only CID to * lack one. */ -typedef struct quic_lcidm_st QUIC_LCIDM; /* * Creates a new LCIDM. lcid_len is the length to use for LCIDs in bytes, which diff --git a/include/internal/quic_port.h b/include/internal/quic_port.h index be08e213ee4..9e52a1e77cc 100644 --- a/include/internal/quic_port.h +++ b/include/internal/quic_port.h @@ -75,8 +75,6 @@ typedef struct quic_port_args_st { int is_multi_conn; } QUIC_PORT_ARGS; -typedef struct quic_port_st QUIC_PORT; - QUIC_PORT *ossl_quic_port_new(const QUIC_PORT_ARGS *args); void ossl_quic_port_free(QUIC_PORT *port); diff --git a/include/internal/quic_predef.h b/include/internal/quic_predef.h index 2512810afa1..6f8f8e5c93f 100644 --- a/include/internal/quic_predef.h +++ b/include/internal/quic_predef.h @@ -16,6 +16,7 @@ typedef struct quic_port_st QUIC_PORT; typedef struct quic_channel_st QUIC_CHANNEL; typedef struct quic_tls_st QUIC_TLS; typedef struct quic_txpim_st QUIC_TXPIM; +typedef struct quic_fifd_st QUIC_FIFD; typedef struct quic_cfq_st QUIC_CFQ; typedef struct ossl_quic_tx_packetiser_st OSSL_QUIC_TX_PACKETISER; typedef struct ossl_ackm_st OSSL_ACKM; diff --git a/include/internal/quic_reactor.h b/include/internal/quic_reactor.h index bffbf50d8be..10d54ee1564 100644 --- a/include/internal/quic_reactor.h +++ b/include/internal/quic_reactor.h @@ -11,6 +11,7 @@ # include "internal/time.h" # include "internal/sockets.h" +# include "internal/quic_predef.h" # include # ifndef OPENSSL_NO_QUIC @@ -67,11 +68,11 @@ * adaptation layer on top of our internal asynchronous I/O API as exposed by * the reactor interface. */ -typedef struct quic_tick_result_st { +struct quic_tick_result_st { char net_read_desired; char net_write_desired; OSSL_TIME tick_deadline; -} QUIC_TICK_RESULT; +}; static ossl_inline ossl_unused void ossl_quic_tick_result_merge_into(QUIC_TICK_RESULT *r, @@ -82,7 +83,7 @@ ossl_quic_tick_result_merge_into(QUIC_TICK_RESULT *r, r->tick_deadline = ossl_time_min(r->tick_deadline, src->tick_deadline); } -typedef struct quic_reactor_st { +struct quic_reactor_st { /* * BIO poll descriptors which can be polled. poll_r is a poll descriptor * which becomes readable when the QUIC state machine can potentially do @@ -110,7 +111,7 @@ typedef struct quic_reactor_st { */ unsigned int can_poll_r : 1; unsigned int can_poll_w : 1; -} QUIC_REACTOR; +}; void ossl_quic_reactor_init(QUIC_REACTOR *rtor, void (*tick_cb)(QUIC_TICK_RESULT *res, void *arg, diff --git a/include/internal/quic_record_rx.h b/include/internal/quic_record_rx.h index cc2d6e94d8f..24c2bbc8aec 100644 --- a/include/internal/quic_record_rx.h +++ b/include/internal/quic_record_rx.h @@ -13,6 +13,7 @@ # include # include "internal/quic_wire_pkt.h" # include "internal/quic_types.h" +# include "internal/quic_predef.h" # include "internal/quic_record_util.h" # include "internal/quic_demux.h" @@ -178,7 +179,7 @@ int ossl_qrx_discard_enc_level(OSSL_QRX *qrx, uint32_t enc_level); */ /* Information about a received packet. */ -typedef struct ossl_qrx_pkt_st { +struct ossl_qrx_pkt_st { /* * Points to a logical representation of the decoded QUIC packet header. The * data and len fields point to the decrypted QUIC payload (i.e., to a @@ -224,7 +225,7 @@ typedef struct ossl_qrx_pkt_st { * packets. */ uint64_t key_epoch; -} OSSL_QRX_PKT; +}; /* * Tries to read a new decrypted packet from the QRX. diff --git a/include/internal/quic_record_tx.h b/include/internal/quic_record_tx.h index f3b798fea06..06889983261 100644 --- a/include/internal/quic_record_tx.h +++ b/include/internal/quic_record_tx.h @@ -13,6 +13,7 @@ # include # include "internal/quic_wire_pkt.h" # include "internal/quic_types.h" +# include "internal/quic_predef.h" # include "internal/quic_record_util.h" # ifndef OPENSSL_NO_QUIC @@ -148,7 +149,7 @@ uint32_t ossl_qrl_get_suite_cipher_tag_len(uint32_t suite_id); * ------------------- */ -typedef struct ossl_qtx_pkt_st { +struct ossl_qtx_pkt_st { /* Logical packet header to be serialized. */ QUIC_PKT_HDR *hdr; @@ -176,7 +177,7 @@ typedef struct ossl_qtx_pkt_st { /* Packet flags. Zero or more OSSL_QTX_PKT_FLAG_* values. */ uint32_t flags; -} OSSL_QTX_PKT; +}; /* * More packets will be written which should be coalesced into a single diff --git a/include/internal/quic_srtm.h b/include/internal/quic_srtm.h index 9a2c18fdf33..830c3992757 100644 --- a/include/internal/quic_srtm.h +++ b/include/internal/quic_srtm.h @@ -15,6 +15,7 @@ # include "internal/time.h" # include "internal/quic_types.h" # include "internal/quic_wire.h" +# include "internal/quic_predef.h" # ifndef OPENSSL_NO_QUIC @@ -53,7 +54,6 @@ * The opaque pointer may be used for any purpose but is intended to represent a * connection identity and must therefore be consistent (usefully comparable). */ -typedef struct quic_srtm_st QUIC_SRTM; /* Creates a new empty SRTM instance. */ QUIC_SRTM *ossl_quic_srtm_new(OSSL_LIB_CTX *libctx, const char *propq); diff --git a/include/internal/quic_statm.h b/include/internal/quic_statm.h index 5b33551b06c..2fca69b0d18 100644 --- a/include/internal/quic_statm.h +++ b/include/internal/quic_statm.h @@ -12,13 +12,14 @@ # include # include "internal/time.h" +# include "internal/quic_predef.h" # ifndef OPENSSL_NO_QUIC -typedef struct ossl_statm_st { +struct ossl_statm_st { OSSL_TIME smoothed_rtt, latest_rtt, min_rtt, rtt_variance; char have_first_sample; -} OSSL_STATM; +}; typedef struct ossl_rtt_info_st { /* As defined in RFC 9002. */ diff --git a/include/internal/quic_stream.h b/include/internal/quic_stream.h index 0da8febd5a8..d446dadc504 100644 --- a/include/internal/quic_stream.h +++ b/include/internal/quic_stream.h @@ -14,6 +14,7 @@ #include "internal/e_os.h" #include "internal/time.h" #include "internal/quic_types.h" +#include "internal/quic_predef.h" #include "internal/quic_wire.h" #include "internal/quic_record_tx.h" #include "internal/quic_record_rx.h" @@ -51,7 +52,6 @@ * datagrams. The terms 'send' and 'receive' are used when referring to the * stream abstraction. Applications send; we transmit. */ -typedef struct quic_sstream_st QUIC_SSTREAM; /* * Instantiates a new QUIC_SSTREAM. init_buf_size specifies the initial size of @@ -312,7 +312,6 @@ void ossl_quic_sstream_set_cleanse(QUIC_SSTREAM *qss, int cleanse); * (i.e., for a unidirectional receiving stream or for the receiving component * of a bidirectional stream). */ -typedef struct quic_rstream_st QUIC_RSTREAM; /* * Create a new instance of QUIC_RSTREAM with pointers to the flow diff --git a/include/internal/quic_stream_map.h b/include/internal/quic_stream_map.h index ae7490619bb..9d860f6d1f4 100644 --- a/include/internal/quic_stream_map.h +++ b/include/internal/quic_stream_map.h @@ -15,6 +15,7 @@ # include "internal/time.h" # include "internal/common.h" # include "internal/quic_types.h" +# include "internal/quic_predef.h" # include "internal/quic_stream.h" # include "internal/quic_fc.h" # include @@ -27,7 +28,6 @@ * * Logical QUIC stream composing all relevant send and receive components. */ -typedef struct quic_stream_st QUIC_STREAM; typedef struct quic_stream_list_node_st QUIC_STREAM_LIST_NODE; @@ -514,7 +514,7 @@ static ossl_inline ossl_unused int ossl_quic_stream_recv_get_final_size(const QU * - allows iteration over the active streams only. * */ -typedef struct quic_stream_map_st { +struct quic_stream_map_st { LHASH_OF(QUIC_STREAM) *map; QUIC_STREAM_LIST_NODE active_list; QUIC_STREAM_LIST_NODE accept_list; @@ -527,7 +527,7 @@ typedef struct quic_stream_map_st { QUIC_RXFC *max_streams_bidi_rxfc; QUIC_RXFC *max_streams_uni_rxfc; int is_server; -} QUIC_STREAM_MAP; +}; /* * get_stream_limit is a callback which is called to retrieve the current stream diff --git a/include/internal/quic_tls.h b/include/internal/quic_tls.h index 0e4a9d339b7..f9f007a76cc 100644 --- a/include/internal/quic_tls.h +++ b/include/internal/quic_tls.h @@ -12,9 +12,9 @@ # include # include "internal/quic_stream.h" +# include "internal/quic_predef.h" - -typedef struct quic_tls_st QUIC_TLS; +# ifndef OPENSSL_NO_QUIC typedef struct quic_tls_args_st { /* @@ -103,4 +103,6 @@ int ossl_quic_tls_get_error(QUIC_TLS *qtls, int ossl_quic_tls_is_cert_request(QUIC_TLS *qtls); int ossl_quic_tls_has_bad_max_early_data(QUIC_TLS *qtls); +# endif + #endif diff --git a/include/internal/quic_txp.h b/include/internal/quic_txp.h index ae508f2393b..7c00c414193 100644 --- a/include/internal/quic_txp.h +++ b/include/internal/quic_txp.h @@ -12,6 +12,7 @@ # include # include "internal/quic_types.h" +# include "internal/quic_predef.h" # include "internal/quic_record_tx.h" # include "internal/quic_cfq.h" # include "internal/quic_txpim.h" @@ -59,8 +60,6 @@ typedef struct ossl_quic_tx_packetiser_args_st { } OSSL_QUIC_TX_PACKETISER_ARGS; -typedef struct ossl_quic_tx_packetiser_st OSSL_QUIC_TX_PACKETISER; - OSSL_QUIC_TX_PACKETISER *ossl_quic_tx_packetiser_new(const OSSL_QUIC_TX_PACKETISER_ARGS *args); typedef void (ossl_quic_initial_token_free_fn)(const unsigned char *buf, diff --git a/include/internal/quic_txpim.h b/include/internal/quic_txpim.h index ed6e3875c47..efe1ca6302a 100644 --- a/include/internal/quic_txpim.h +++ b/include/internal/quic_txpim.h @@ -12,6 +12,7 @@ # include # include "internal/quic_types.h" +# include "internal/quic_predef.h" # include "internal/quic_cfq.h" # include "internal/quic_ackm.h" @@ -21,8 +22,6 @@ * QUIC Transmitted Packet Information Manager * =========================================== */ -typedef struct quic_txpim_st QUIC_TXPIM; -typedef struct quic_fifd_st QUIC_FIFD; typedef struct quic_txpim_pkt_st { /* ACKM-specific data. Caller should fill this. */