MINOR: quic: add const qualifier for traces function

Add const qualifier on arguments of several dump functions used in the
trace callback. This is required to be able to replace the first trace
argument by a quic_conn instance. The first argument is a const pointer
and so the members accessed through it must also be const.
This commit is contained in:
Amaury Denoyelle 2021-12-21 14:28:26 +01:00
parent c15dd9214b
commit 4fd53d772f
4 changed files with 8 additions and 9 deletions

View File

@ -42,7 +42,8 @@ unsigned char initial_salt_v1[20] = {
0xcc, 0xbb, 0x7f, 0x0a
};
void quic_tls_keys_hexdump(struct buffer *buf, struct quic_tls_secrets *secs);
void quic_tls_keys_hexdump(struct buffer *buf,
const struct quic_tls_secrets *secs);
void quic_tls_secret_hexdump(struct buffer *buf,
const unsigned char *secret, size_t secret_len);

View File

@ -114,7 +114,8 @@ static inline size_t quic_cid_saddr_cat(struct quic_cid *cid,
* debugging purposes.
* Always succeeds.
*/
static inline void quic_cid_dump(struct buffer *buf, struct quic_cid *cid)
static inline void quic_cid_dump(struct buffer *buf,
const struct quic_cid *cid)
{
int i;

View File

@ -23,7 +23,8 @@ __attribute__((format (printf, 3, 4)))
void hexdump(const void *buf, size_t buflen, const char *title_fmt, ...);
/* Dump the RX/TX secrets of <secs> QUIC TLS secrets. */
void quic_tls_keys_hexdump(struct buffer *buf, struct quic_tls_secrets *secs)
void quic_tls_keys_hexdump(struct buffer *buf,
const struct quic_tls_secrets *secs)
{
int i;
size_t aead_keylen = (size_t)EVP_CIPHER_key_length(secs->aead);

View File

@ -321,9 +321,7 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
const ssize_t *room = a4;
if (qel) {
struct quic_pktns *pktns;
pktns = qc->pktns;
const struct quic_pktns *pktns = qc->pktns;
chunk_appendf(&trace_buf, " qel=%c cwnd=%llu ppif=%lld pif=%llu "
"if=%llu pp=%u pdg=%d",
quic_enc_level_char_from_qel(qel, qc),
@ -422,9 +420,7 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
const struct quic_enc_level *qel = a2;
if (qel) {
struct quic_pktns *pktns;
pktns = qc->pktns;
const struct quic_pktns *pktns = qc->pktns;
chunk_appendf(&trace_buf,
" qel=%c state=%s ack?%d cwnd=%llu ppif=%lld pif=%llu if=%llu pp=%u pdg=%llu",
quic_enc_level_char_from_qel(qel, qc),