static BIO_METHOD *ha_quic_meth;
-/* QUIC xprt connection context. */
-struct quic_conn_ctx {
- struct connection *conn;
- SSL *ssl;
- BIO *bio;
- const struct xprt_ops *xprt;
- void *xprt_ctx;
- struct wait_event wait_event;
- struct wait_event *subs;
-};
-
DECLARE_STATIC_POOL(pool_head_quic_conn_ctx,
- "quic_conn_ctx_pool", sizeof(struct quic_conn_ctx));
+ "quic_conn_ctx_pool", sizeof(struct ssl_sock_ctx));
DECLARE_STATIC_POOL(pool_head_quic_conn, "quic_conn", sizeof(struct quic_conn));
}
/* Returns 1 if the peer has validated <qc> QUIC connection address, 0 if not. */
-static inline int quic_peer_validated_addr(struct quic_conn_ctx *ctx)
+static inline int quic_peer_validated_addr(struct ssl_sock_ctx *ctx)
{
struct quic_conn *qc;
/* Set the timer attached to the QUIC connection with <ctx> as I/O handler and used for
* both loss detection and PTO and schedule the task assiated to this timer if needed.
*/
-static inline void qc_set_timer(struct quic_conn_ctx *ctx)
+static inline void qc_set_timer(struct ssl_sock_ctx *ctx)
{
struct quic_conn *qc;
struct quic_pktns *pktns;
static int qc_do_rm_hp(struct quic_rx_packet *pkt, struct quic_tls_ctx *tls_ctx,
int64_t largest_pn, unsigned char *pn,
unsigned char *byte0, const unsigned char *end,
- struct quic_conn_ctx *ctx)
+ struct ssl_sock_ctx *ctx)
{
int ret, outlen, i, pnlen;
uint64_t packet_number;
/* Treat <frm> frame whose packet it is attached to has just been acknowledged. */
static inline void qc_treat_acked_tx_frm(struct quic_tx_frm *frm,
- struct quic_conn_ctx *ctx)
+ struct ssl_sock_ctx *ctx)
{
TRACE_PROTO("Removing frame", QUIC_EV_CONN_PRSAFRM, ctx->conn, frm);
LIST_DELETE(&frm->list);
struct list *newly_acked_pkts,
struct eb64_node *largest_node,
uint64_t largest, uint64_t smallest,
- struct quic_conn_ctx *ctx)
+ struct ssl_sock_ctx *ctx)
{
struct eb64_node *node;
struct quic_tx_packet *pkt;
*/
static inline void qc_treat_nacked_tx_frm(struct quic_tx_frm *frm,
struct quic_pktns *pktns,
- struct quic_conn_ctx *ctx)
+ struct ssl_sock_ctx *ctx)
{
TRACE_PROTO("to resend frame", QUIC_EV_CONN_PRSAFRM, ctx->conn, frm);
LIST_DELETE(&frm->list);
* <newly_acked_pkts> list and free them.
* Always succeeds.
*/
-static inline void qc_treat_newly_acked_pkts(struct quic_conn_ctx *ctx,
+static inline void qc_treat_newly_acked_pkts(struct ssl_sock_ctx *ctx,
struct list *newly_acked_pkts)
{
struct quic_conn *qc = ctx->conn->qc;
* Never fails.
*/
static inline void qc_release_lost_pkts(struct quic_pktns *pktns,
- struct quic_conn_ctx *ctx,
+ struct ssl_sock_ctx *ctx,
struct list *pkts,
uint64_t now_us)
{
* acked ack-eliciting packet.
* Return 1, if succeeded, 0 if not.
*/
-static inline int qc_parse_ack_frm(struct quic_frame *frm, struct quic_conn_ctx *ctx,
+static inline int qc_parse_ack_frm(struct quic_frame *frm, struct ssl_sock_ctx *ctx,
struct quic_enc_level *qel,
unsigned int *rtt_sample,
const unsigned char **pos, const unsigned char *end)
* Return 1 if succeeded, 0 if not.
*/
static inline int qc_provide_cdata(struct quic_enc_level *el,
- struct quic_conn_ctx *ctx,
+ struct ssl_sock_ctx *ctx,
const unsigned char *data, size_t len,
struct quic_rx_packet *pkt,
struct quic_rx_crypto_frm *cf)
* as I/O handler context and <qel> as encryption level.
* Returns 1 if succeeded, 0 if failed.
*/
-static int qc_parse_pkt_frms(struct quic_rx_packet *pkt, struct quic_conn_ctx *ctx,
+static int qc_parse_pkt_frms(struct quic_rx_packet *pkt, struct ssl_sock_ctx *ctx,
struct quic_enc_level *qel)
{
struct quic_frame frm;
* with <ctx> as I/O handler context.
* Returns 1 if succeeded, or 0 if something wrong happened.
*/
-static int qc_prep_hdshk_pkts(struct quic_conn_ctx *ctx)
+static int qc_prep_hdshk_pkts(struct ssl_sock_ctx *ctx)
{
struct quic_conn *qc;
enum quic_tls_enc_level tel, next_tel;
/* Send the QUIC packets which have been prepared for QUIC connections
* with <ctx> as I/O handler context.
*/
-int qc_send_ppkts(struct quic_conn_ctx *ctx)
+int qc_send_ppkts(struct ssl_sock_ctx *ctx)
{
struct quic_conn *qc;
struct buffer tmpbuf = { };
/* Remove the header protection of packets at <el> encryption level.
* Always succeeds.
*/
-static inline void qc_rm_hp_pkts(struct quic_enc_level *el, struct quic_conn_ctx *ctx)
+static inline void qc_rm_hp_pkts(struct quic_enc_level *el, struct ssl_sock_ctx *ctx)
{
struct quic_tls_ctx *tls_ctx;
struct quic_rx_packet *pqpkt, *qqpkt;
* Return 1 if succeeded, 0 if not.
*/
static inline int qc_treat_rx_crypto_frms(struct quic_enc_level *el,
- struct quic_conn_ctx *ctx)
+ struct ssl_sock_ctx *ctx)
{
struct eb64_node *node;
/* Process all the packets at <el> encryption level.
* Return 1 if succeeded, 0 if not.
*/
-int qc_treat_rx_pkts(struct quic_enc_level *el, struct quic_conn_ctx *ctx)
+int qc_treat_rx_pkts(struct quic_enc_level *el, struct ssl_sock_ctx *ctx)
{
struct quic_tls_ctx *tls_ctx;
struct eb64_node *node;
* connections with <ctx> as I/O handler context.
* Returns 1 if succeeded, 0 if not.
*/
-int qc_do_hdshk(struct quic_conn_ctx *ctx)
+int qc_do_hdshk(struct ssl_sock_ctx *ctx)
{
int ssl_err;
struct quic_conn *qc;
/* Callback called upon loss detection and PTO timer expirations. */
static struct task *process_timer(struct task *task, void *ctx, unsigned int state)
{
- struct quic_conn_ctx *conn_ctx;
+ struct ssl_sock_ctx *conn_ctx;
struct quic_conn *qc;
struct quic_pktns *pktns;
* Note that <ctx> may be null (for Initial packets).
*/
static int qc_pkt_may_rm_hp(struct quic_rx_packet *pkt,
- struct quic_conn *qc, struct quic_conn_ctx *ctx,
+ struct quic_conn *qc, struct ssl_sock_ctx *ctx,
struct quic_enc_level **qel)
{
enum quic_tls_enc_level tel;
static inline int qc_try_rm_hp(struct quic_rx_packet *pkt,
unsigned char **buf, unsigned char *beg,
const unsigned char *end,
- struct quic_conn *qc, struct quic_conn_ctx *ctx)
+ struct quic_conn *qc, struct ssl_sock_ctx *ctx)
{
unsigned char *pn = NULL; /* Packet number field */
struct quic_enc_level *qel;
struct eb_root *cids;
struct ebmb_node *node;
struct connection *srv_conn;
- struct quic_conn_ctx *conn_ctx;
+ struct ssl_sock_ctx *conn_ctx;
int long_header;
qc = NULL;
struct eb_root *cids;
struct ebmb_node *node;
struct listener *l;
- struct quic_conn_ctx *conn_ctx;
+ struct ssl_sock_ctx *conn_ctx;
int long_header = 0;
/* boolean to denote if a connection exists for this packet.
* This does not mean there is an xprt context for it.
/* QUIC connection packet handler task. */
struct task *quic_conn_io_cb(struct task *t, void *context, unsigned int state)
{
- struct quic_conn_ctx *ctx = context;
+ struct ssl_sock_ctx *ctx = context;
if (ctx->conn->qc->state < QUIC_HS_ST_COMPLETE) {
qc_do_hdshk(ctx);
*/
static int qc_conn_init(struct connection *conn, void **xprt_ctx)
{
- struct quic_conn_ctx *ctx;
+ struct ssl_sock_ctx *ctx;
TRACE_ENTER(QUIC_EV_CONN_NEW, conn);
static int qc_xprt_start(struct connection *conn, void *ctx)
{
struct quic_conn *qc;
- struct quic_conn_ctx *qctx = ctx;
+ struct ssl_sock_ctx *qctx = ctx;
qc = conn->qc;
if (!quic_conn_init_timer(qc)) {