/* The engine which the QUIC port is to be a child of. */
QUIC_ENGINE *engine;
+ /*
+ * This callback allows port_new_handshake_layer to pre-create a quic
+ * connection object for the incomming channel
+ * user_ssl_arg is expected to point to a quic listener object
+ */
+ SSL *(*get_conn_user_ssl)(QUIC_CHANNEL *ch, void *arg);
+ void *user_ssl_arg;
+
/*
* This SSL_CTX will be used when constructing the handshake layer object
* inside newly created channels.
return SSL_KEY_UPDATE_NONE;
}
+/**
+ * @brief Allocates an SSL object for a user from a QUIC channel.
+ *
+ * This function creates a new QUIC_CONNECTION object based on an incoming
+ * connection associated with the provided QUIC_LISTENER. If the connection
+ * creation fails, the function returns NULL. Otherwise, it returns a pointer
+ * to the SSL object associated with the newly created connection.
+ *
+ * Note: This function is a registered port callback made from
+ * ossl_quic_new_listener and ossl_quic_new_listener_from, and allows for
+ * pre-allocation of the user_ssl object when a channel is created, rather than
+ * when it is accepted
+ *
+ * @param ch Pointer to the QUIC_CHANNEL representing the incoming connection.
+ * @param arg Pointer to a QUIC_LISTENER used to create the connection.
+ *
+ * @return Pointer to the SSL object on success, or NULL on failure.
+ */
+static SSL *alloc_port_user_ssl(QUIC_CHANNEL *ch, void *arg)
+{
+ QUIC_LISTENER *ql = arg;
+ QUIC_CONNECTION *qc = create_qc_from_incoming_conn(ql, ch);
+
+ return (qc == NULL) ? NULL : &qc->obj.ssl;
+}
+
/*
* QUIC Front-End I/O API: Listeners
* =================================
port_args.channel_ctx = ctx;
port_args.is_multi_conn = 1;
+ port_args.get_conn_user_ssl = alloc_port_user_ssl;
+ port_args.user_ssl_arg = ql;
if ((flags & SSL_LISTENER_FLAG_NO_VALIDATE) == 0)
port_args.do_addr_validation = 1;
ql->port = ossl_quic_engine_create_port(ql->engine, &port_args);
port_args.channel_ctx = ssl->ctx;
port_args.is_multi_conn = 1;
+ port_args.get_conn_user_ssl = alloc_port_user_ssl;
+ port_args.user_ssl_arg = ql;
if ((flags & SSL_LISTENER_FLAG_NO_VALIDATE) == 0)
port_args.do_addr_validation = 1;
ql->port = ossl_quic_engine_create_port(ctx.qd->engine, &port_args);