mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-10 09:33:20 +02:00
REORG: quic: Move NEW_CONNECTION_ID frame builder to quic_cid
Move qc_build_new_connection_id_frm() from quic_conn.c to quic_cid.c. Also move quic_connection_id_to_frm_cpy() from quic_conn.h to quic_cid.h.
This commit is contained in:
@@ -27,6 +27,8 @@ struct quic_conn *retrieve_qc_conn_from_cid(struct quic_rx_packet *pkt,
|
||||
struct listener *l,
|
||||
struct sockaddr_storage *saddr,
|
||||
int *new_tid);
|
||||
int qc_build_new_connection_id_frm(struct quic_conn *qc,
|
||||
struct quic_connection_id *conn_id);
|
||||
|
||||
/* Copy <src> QUIC CID to <dst>.
|
||||
* This is the responsibility of the caller to check there is enough room in
|
||||
@@ -90,5 +92,20 @@ static inline void quic_cid_delete(struct quic_connection_id *conn_id)
|
||||
HA_RWLOCK_WRUNLOCK(QC_CID_LOCK, &tree->lock);
|
||||
}
|
||||
|
||||
/* Copy <src> new connection ID information to <dst> NEW_CONNECTION_ID frame.
|
||||
* Always succeeds.
|
||||
*/
|
||||
static inline void quic_connection_id_to_frm_cpy(struct quic_frame *dst,
|
||||
struct quic_connection_id *src)
|
||||
{
|
||||
struct qf_new_connection_id *ncid_frm = &dst->new_connection_id;
|
||||
|
||||
ncid_frm->seq_num = src->seq_num.key;
|
||||
ncid_frm->retire_prior_to = src->retire_prior_to;
|
||||
ncid_frm->cid.len = src->cid.len;
|
||||
ncid_frm->cid.data = src->cid.data;
|
||||
ncid_frm->stateless_reset_token = src->stateless_reset_token;
|
||||
}
|
||||
|
||||
#endif /* USE_QUIC */
|
||||
#endif /* _HAPROXY_QUIC_CID_H */
|
||||
|
||||
@@ -66,8 +66,6 @@ struct quic_connection_id *new_quic_cid(struct eb_root *root,
|
||||
const struct sockaddr_storage *addr);
|
||||
void quic_conn_closed_err_count_inc(struct quic_conn *qc, struct quic_frame *frm);
|
||||
int qc_h3_request_reject(struct quic_conn *qc, uint64_t id);
|
||||
int qc_build_new_connection_id_frm(struct quic_conn *qc,
|
||||
struct quic_connection_id *conn_id);
|
||||
struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
|
||||
struct quic_cid *dcid, struct quic_cid *scid,
|
||||
const struct quic_cid *token_odcid,
|
||||
@@ -132,23 +130,7 @@ static inline void quic_conn_mv_cids_to_cc_conn(struct quic_conn_closed *cc_conn
|
||||
|
||||
}
|
||||
|
||||
/* Copy <src> new connection ID information to <dst> NEW_CONNECTION_ID frame.
|
||||
* Always succeeds.
|
||||
*/
|
||||
static inline void quic_connection_id_to_frm_cpy(struct quic_frame *dst,
|
||||
struct quic_connection_id *src)
|
||||
{
|
||||
struct qf_new_connection_id *ncid_frm = &dst->new_connection_id;
|
||||
|
||||
ncid_frm->seq_num = src->seq_num.key;
|
||||
ncid_frm->retire_prior_to = src->retire_prior_to;
|
||||
ncid_frm->cid.len = src->cid.len;
|
||||
ncid_frm->cid.data = src->cid.data;
|
||||
ncid_frm->stateless_reset_token = src->stateless_reset_token;
|
||||
}
|
||||
|
||||
void chunk_frm_appendf(struct buffer *buf, const struct quic_frame *frm);
|
||||
|
||||
void quic_set_connection_close(struct quic_conn *qc, const struct quic_err err);
|
||||
void quic_set_tls_alert(struct quic_conn *qc, int alert);
|
||||
int quic_set_app_ops(struct quic_conn *qc, const unsigned char *alpn, size_t alpn_len);
|
||||
|
||||
@@ -258,4 +258,30 @@ struct quic_conn *retrieve_qc_conn_from_cid(struct quic_rx_packet *pkt,
|
||||
return qc;
|
||||
}
|
||||
|
||||
/* Build a NEW_CONNECTION_ID frame for <conn_id> CID of <qc> connection.
|
||||
*
|
||||
* Returns 1 on success else 0.
|
||||
*/
|
||||
int qc_build_new_connection_id_frm(struct quic_conn *qc,
|
||||
struct quic_connection_id *conn_id)
|
||||
{
|
||||
int ret = 0;
|
||||
struct quic_frame *frm;
|
||||
struct quic_enc_level *qel;
|
||||
|
||||
TRACE_ENTER(QUIC_EV_CONN_PRSHPKT, qc);
|
||||
|
||||
qel = qc->ael;
|
||||
frm = qc_frm_alloc(QUIC_FT_NEW_CONNECTION_ID);
|
||||
if (!frm) {
|
||||
TRACE_ERROR("frame allocation error", QUIC_EV_CONN_IO_CB, qc);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
quic_connection_id_to_frm_cpy(frm, conn_id);
|
||||
LIST_APPEND(&qel->pktns->tx.frms, &frm->list);
|
||||
ret = 1;
|
||||
leave:
|
||||
TRACE_LEAVE(QUIC_EV_CONN_PRSHPKT, qc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -396,35 +396,6 @@ int qc_h3_request_reject(struct quic_conn *qc, uint64_t id)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Build a NEW_CONNECTION_ID frame for <conn_id> CID of <qc> connection.
|
||||
*
|
||||
* Returns 1 on success else 0.
|
||||
*/
|
||||
int qc_build_new_connection_id_frm(struct quic_conn *qc,
|
||||
struct quic_connection_id *conn_id)
|
||||
{
|
||||
int ret = 0;
|
||||
struct quic_frame *frm;
|
||||
struct quic_enc_level *qel;
|
||||
|
||||
TRACE_ENTER(QUIC_EV_CONN_PRSHPKT, qc);
|
||||
|
||||
qel = qc->ael;
|
||||
frm = qc_frm_alloc(QUIC_FT_NEW_CONNECTION_ID);
|
||||
if (!frm) {
|
||||
TRACE_ERROR("frame allocation error", QUIC_EV_CONN_IO_CB, qc);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
quic_connection_id_to_frm_cpy(frm, conn_id);
|
||||
LIST_APPEND(&qel->pktns->tx.frms, &frm->list);
|
||||
ret = 1;
|
||||
leave:
|
||||
TRACE_LEAVE(QUIC_EV_CONN_PRSHPKT, qc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Remove a <qc> quic-conn from its ha_thread_ctx list. If <closing> is true,
|
||||
* it will immediately be reinserted in the ha_thread_ctx quic_conns_clo list.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user