QUIC Refactor: Fix ANSI - struct definition duplications

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22674)
This commit is contained in:
Hugo Landau 2023-11-09 11:04:50 +00:00
parent 99655cb91d
commit ff3a26b24f
18 changed files with 33 additions and 39 deletions

View file

@ -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,

View file

@ -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;

View 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);

View 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 {
/*

View 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.
*

View 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

View 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);

View 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;

View 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
@ -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,

View 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.

View 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

View 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);

View file

@ -12,13 +12,14 @@
# 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. */

View 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

View 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

View 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

View 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,

View 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. */