struct qf_crypto {
struct list list;
- uint64_t offset;
struct eb64_node offset_node;
uint64_t len;
const struct quic_enc_level *qel;
}
case QUIC_FT_CRYPTO: {
struct qf_crypto *f = &frm->crypto;
- len += 1 + quic_int_getsize(f->offset) + quic_int_getsize(f->len) + f->len;
+ len += 1 + quic_int_getsize(f->offset_node.key) + quic_int_getsize(f->len) + f->len;
break;
}
case QUIC_FT_NEW_TOKEN: {
{
const struct qf_crypto *crypto_frm = &frm->crypto;
chunk_appendf(buf, " cfoff=%llu cflen=%llu",
- (ull)crypto_frm->offset, (ull)crypto_frm->len);
+ (ull)crypto_frm->offset_node.key, (ull)crypto_frm->len);
break;
}
case QUIC_FT_RESET_STREAM:
const struct quic_enc_level *qel = crypto_frm->qel;
size_t offset, len;
- if (!quic_enc_int(pos, end, crypto_frm->offset) ||
+ if (!quic_enc_int(pos, end, crypto_frm->offset_node.key) ||
!quic_enc_int(pos, end, crypto_frm->len) || end - *pos < crypto_frm->len)
return 0;
len = crypto_frm->len;
- offset = crypto_frm->offset;
+ offset = crypto_frm->offset_node.key;
while (len) {
int idx;
size_t to_copy;
{
struct qf_crypto *crypto_frm = &frm->crypto;
- if (!quic_dec_int(&crypto_frm->offset, pos, end) ||
+ if (!quic_dec_int((uint64_t *)&crypto_frm->offset_node.key, pos, end) ||
!quic_dec_int(&crypto_frm->len, pos, end) || end - *pos < crypto_frm->len)
return 0;
}
else if (frm->type == QUIC_FT_CRYPTO) {
total = 1;
- total += quic_int_getsize(frm->crypto.offset);
+ total += quic_int_getsize(frm->crypto.offset_node.key);
payload = frm->crypto.len;
}
else {
}
else if (frm->type == QUIC_FT_CRYPTO) {
new->crypto.qel = frm->crypto.qel;
- new->crypto.offset = frm->crypto.offset;
+ new->crypto.offset_node.key = frm->crypto.offset_node.key;
new->crypto.len = split;
/* Advance original frame to point to the remaining data. */
frm->crypto.len -= split;
- frm->crypto.offset += split;
+ frm->crypto.offset_node.key += split;
}
else {
/* Function must only be used with STREAM or CRYPTO frames. */
enum quic_rx_ret_frm ret = QUIC_RX_RET_FRM_DONE;
/* XXX TO DO: <cfdebug> is used only for the traces. */
struct quic_rx_crypto_frm cfdebug = {
- .offset_node.key = crypto_frm->offset,
+ .offset_node.key = crypto_frm->offset_node.key,
.len = crypto_frm->len,
};
struct quic_cstream *cstream = qel->cstream;
TRACE_ENTER(QUIC_EV_CONN_PRSHPKT, qc);
- if (unlikely(crypto_frm->offset < cstream->rx.offset)) {
+ if (unlikely(crypto_frm->offset_node.key < cstream->rx.offset)) {
size_t diff;
- if (crypto_frm->offset + crypto_frm->len <= cstream->rx.offset) {
+ if (crypto_frm->offset_node.key + crypto_frm->len <= cstream->rx.offset) {
/* Nothing to do */
TRACE_PROTO("Already received CRYPTO data",
QUIC_EV_CONN_RXPKT, qc, pkt, &cfdebug);
TRACE_PROTO("Partially already received CRYPTO data",
QUIC_EV_CONN_RXPKT, qc, pkt, &cfdebug);
- diff = cstream->rx.offset - crypto_frm->offset;
+ diff = cstream->rx.offset - crypto_frm->offset_node.key;
crypto_frm->len -= diff;
crypto_frm->data += diff;
- crypto_frm->offset = cstream->rx.offset;
+ crypto_frm->offset_node.key = cstream->rx.offset;
}
if (!quic_get_ncbuf(ncbuf) || ncb_is_null(ncbuf)) {
}
/* crypto_frm->offset > cstream-trx.offset */
- off_rel = crypto_frm->offset - cstream->rx.offset;
+ off_rel = crypto_frm->offset_node.key - cstream->rx.offset;
/* RFC 9000 7.5. Cryptographic Message Buffering
*
break;
}
case QUIC_FT_CRYPTO:
- frm->crypto.offset_node.key = frm->crypto.offset;
+ frm->crypto.offset_node.key = frm->crypto.offset_node.key;
eb64_insert(&cf_frms_tree, &frm->crypto.offset_node);
frm = NULL;
break;
goto leave;
}
- frm->crypto.offset = cf_offset;
+ frm->crypto.offset_node.key = cf_offset;
frm->crypto.len = cf_len;
frm->crypto.qel = qel;
LIST_APPEND(&qel->pktns->tx.frms, &frm->list);