QUIC Refactor: Fix ANSI - struct definition duplications
authorHugo Landau <hlandau@openssl.org>
Thu, 9 Nov 2023 11:04:50 +0000 (11:04 +0000)
committerHugo Landau <hlandau@openssl.org>
Thu, 21 Dec 2023 08:12:06 +0000 (08:12 +0000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22674)

18 files changed:
include/internal/quic_ackm.h
include/internal/quic_cc.h
include/internal/quic_cfq.h
include/internal/quic_channel.h
include/internal/quic_demux.h
include/internal/quic_lcidm.h
include/internal/quic_port.h
include/internal/quic_predef.h
include/internal/quic_reactor.h
include/internal/quic_record_rx.h
include/internal/quic_record_tx.h
include/internal/quic_srtm.h
include/internal/quic_statm.h
include/internal/quic_stream.h
include/internal/quic_stream_map.h
include/internal/quic_tls.h
include/internal/quic_txp.h
include/internal/quic_txpim.h

index 03fc6088678454f66303ce3ace1cf0cb2a1569b6..69b862d9c55a7b89b0e84f0f66621001d7740632 100644 (file)
 # 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,
index 60c710b0bdaae2ee449ecb862140ebbed890dbf1..dbd439dd0cf50acc95df65138c979e0c30e7412d 100644 (file)
 
 #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;
index 22c436dc0746a2739928d500243946fa7e71645a..56ebcb930ed61a967fbd2a77b018a09444ba2750 100644 (file)
@@ -12,6 +12,7 @@
 
 # include <openssl/ssl.h>
 # 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);
index 0103b96eab6b6ee19920f79f52e35e6b951f84a7..a745baedb62ce6c737fa65b0654ea28afac758d3 100644 (file)
@@ -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 {
     /*
index 40a1bc412faaffd4b10d4e983380a24cfa03a1ed..bc0ad9563600b7834f31b67323ced653e3ece06a 100644 (file)
@@ -12,6 +12,7 @@
 
 # include <openssl/ssl.h>
 # 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.
  *
index 9b11429814895f97d855d05f4864e5ac44fba2ff..4911e042302ba9d363d4255c900cbef17894b2b5 100644 (file)
@@ -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
index be08e213ee4efc96b72e0691e6d39839ec4676a7..9e52a1e77ccea8cc0a078bfade1ca1257d062705 100644 (file)
@@ -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);
index 2512810afa1c8daf57ef44bbd3faaec299ad7f28..6f8f8e5c93f548c412119723286e4f5978de0dea 100644 (file)
@@ -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;
index bffbf50d8be1e214c99fde4957d81c9e22323b9a..10d54ee15649dd7d340d927aeec65d557c2ae2ec 100644 (file)
@@ -11,6 +11,7 @@
 
 # include "internal/time.h"
 # include "internal/sockets.h"
+# include "internal/quic_predef.h"
 # include <openssl/bio.h>
 
 # ifndef OPENSSL_NO_QUIC
  * 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,
index cc2d6e94d8ff4b07e6ff3a0630c441ff9c8f72a0..24c2bbc8aec5498062f0664cf0852ada2e875adc 100644 (file)
@@ -13,6 +13,7 @@
 # include <openssl/ssl.h>
 # 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.
index f3b798fea06ce5414c9c8dc0efa58dd86e42266b..068899832610bfa72479d334af348e051132e61a 100644 (file)
@@ -13,6 +13,7 @@
 # include <openssl/ssl.h>
 # 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
index 9a2c18fdf33a02afbace48b411bcd466ba536751..830c3992757a0eca18d8cdf6dec6c66bc56d36b5 100644 (file)
@@ -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);
index 5b33551b06cabb99378548a575557efa7ed88abf..2fca69b0d181b9a61fb2320bf8421049f5c3abfe 100644 (file)
 
 # include <openssl/ssl.h>
 # 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. */
index 0da8febd5a8c8ac8f72770bbb5785b10857810de..d446dadc5047736d4bb40503054c7fba4902a1dd 100644 (file)
@@ -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
index ae7490619bb165670f1f5419f3e59b7d371999bf..9d860f6d1f46181fdf2f145858c9d0118076fe87 100644 (file)
@@ -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 <openssl/lhash.h>
@@ -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
index 0e4a9d339b74f8519b7c2971fa4b570a1a37c1c3..f9f007a76cc475ee8a29f6a0b7e42fcf5b7b170f 100644 (file)
@@ -12,9 +12,9 @@
 
 # include <openssl/ssl.h>
 # 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
index ae508f2393bd41bc63fd388ed3fd1deff020d706..7c00c4141939acbee8500f332dc0fd274a46d1a8 100644 (file)
@@ -12,6 +12,7 @@
 
 # include <openssl/ssl.h>
 # 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,
index ed6e3875c47b2def02a9c81ba3648a337f36377b..efe1ca6302a99810995a223afeb69cd7da39a429 100644 (file)
@@ -12,6 +12,7 @@
 
 # include <openssl/ssl.h>
 # 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. */