* to mutate this buffer; once the demuxer calls this callback, it will never
* read the buffer again.
*
+ * If a DCID was identified for the datagram, dcid is non-NULL; otherwise
+ * it is NULL.
+ *
* The callee must arrange for ossl_quic_demux_release_urxe or
* ossl_quic_demux_reinject_urxe to be called on the URXE at some point in the
* future (this need not be before the callback returns).
* At the time the callback is made, the URXE will not be in any queue,
* therefore the callee can use the prev and next fields as it wishes.
*/
-typedef void (ossl_quic_demux_cb_fn)(QUIC_URXE *e, void *arg);
+typedef void (ossl_quic_demux_cb_fn)(QUIC_URXE *e, void *arg,
+ const QUIC_CONN_ID *dcid);
/*
* Called when a datagram is received.
}
/* Identify the connection structure corresponding to a given URXE. */
-static QUIC_DEMUX_CONN *demux_identify_conn(QUIC_DEMUX *demux, QUIC_URXE *e)
+static QUIC_DEMUX_CONN *demux_identify_conn(QUIC_DEMUX *demux, QUIC_URXE *e,
+ QUIC_CONN_ID *dst_conn_id,
+ int *dst_conn_id_ok)
{
- QUIC_CONN_ID dst_conn_id;
-
- if (!demux_identify_conn_id(demux, e, &dst_conn_id))
+ if (!demux_identify_conn_id(demux, e, dst_conn_id))
/*
* Datagram is so badly malformed we can't get the DCID from the first
* packet in it, so just give up.
*/
return NULL;
- return demux_get_by_conn_id(demux, &dst_conn_id);
+ *dst_conn_id_ok = 1;
+ return demux_get_by_conn_id(demux, dst_conn_id);
}
/*
static int demux_process_pending_urxe(QUIC_DEMUX *demux, QUIC_URXE *e)
{
QUIC_DEMUX_CONN *conn;
- int r;
+ QUIC_CONN_ID dst_conn_id;
+ int r, dst_conn_id_ok = 0;
/* The next URXE we process should be at the head of the pending list. */
if (!ossl_assert(e == ossl_list_urxe_head(&demux->urx_pending)))
return 0;
}
- conn = demux_identify_conn(demux, e);
+ conn = demux_identify_conn(demux, e, &dst_conn_id, &dst_conn_id_ok);
if (conn == NULL) {
/*
* We could not identify a connection. If we have a default packet
if (demux->default_cb != NULL) {
/* Pass to default handler. */
e->demux_state = URXE_DEMUX_STATE_ISSUED;
- demux->default_cb(e, demux->default_cb_arg);
+ demux->default_cb(e, demux->default_cb_arg,
+ dst_conn_id_ok ? &dst_conn_id : NULL);
} else {
/* Discard. */
ossl_list_urxe_insert_tail(&demux->urx_free, e);
*/
ossl_list_urxe_remove(&demux->urx_pending, e);
e->demux_state = URXE_DEMUX_STATE_ISSUED;
- conn->cb(e, conn->cb_arg);
+ conn->cb(e, conn->cb_arg, dst_conn_id_ok ? &dst_conn_id : NULL);
return 1;
}
static void port_cleanup(QUIC_PORT *port);
static OSSL_TIME get_time(void *arg);
static void port_tick(QUIC_TICK_RESULT *res, void *arg, uint32_t flags);
-static void port_default_packet_handler(QUIC_URXE *e, void *arg);
+static void port_default_packet_handler(QUIC_URXE *e, void *arg,
+ const QUIC_CONN_ID *dcid);
static void port_rx_pre(QUIC_PORT *port);
DEFINE_LIST_OF_IMPL(ch, QUIC_CHANNEL);
* This is called by the demux when we get a packet not destined for any known
* DCID.
*/
-static void port_default_packet_handler(QUIC_URXE *e, void *arg)
+static void port_default_packet_handler(QUIC_URXE *e, void *arg,
+ const QUIC_CONN_ID *dcid)
{
QUIC_PORT *port = arg;
PACKET pkt;
SSL *msg_callback_ssl;
};
-static void qrx_on_rx(QUIC_URXE *urxe, void *arg);
+static void qrx_on_rx(QUIC_URXE *urxe, void *arg, const QUIC_CONN_ID *dcid);
OSSL_QRX *ossl_qrx_new(const OSSL_QRX_ARGS *args)
{
qrx->msg_callback_arg);
}
-static void qrx_on_rx(QUIC_URXE *urxe, void *arg)
+static void qrx_on_rx(QUIC_URXE *urxe, void *arg, const QUIC_CONN_ID *dcid)
{
OSSL_QRX *qrx = arg;