Skip to content

Commit

Permalink
MINOR: quic: Export QUIC traces code from quic_conn.c
Browse files Browse the repository at this point in the history
To accelerate the compilation of quic_conn.c file, export the code in relation
with the traces from quic_conn.c to quic_trace.c.
Also add some headers (quic_trace-t.h and quic_trace.h).
  • Loading branch information
haproxyFred committed Jul 24, 2023
1 parent f537039 commit b67f651
Show file tree
Hide file tree
Showing 5 changed files with 715 additions and 647 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,8 @@ OPTIONS_OBJS += src/quic_conn.o src/mux_quic.o src/h3.o src/xprt_quic.o \
src/quic_cc_newreno.o src/quic_cc_cubic.o src/qpack-tbl.o \
src/qpack-dec.o src/hq_interop.o src/quic_stream.o \
src/h3_stats.o src/qmux_http.o src/cfgparse-quic.o \
src/cbuf.o src/quic_cc.o src/quic_cc_nocc.o
src/cbuf.o src/quic_cc.o src/quic_cc_nocc.o \
src/quic_trace.o
endif
ifneq ($(USE_QUIC_OPENSSL_COMPAT),)
Expand Down
41 changes: 41 additions & 0 deletions include/haproxy/quic_trace-t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* include/haproxy/quic_trace-t.h
* Definitions for QUIC traces internal types, constants and flags.
*
* Copyright (C) 2023
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
*/

#ifndef _HAPROXY_QUIC_TRACE_T_H
#define _HAPROXY_QUIC_TRACE_T_H

#include <inttypes.h>
#include <stdlib.h>

#include <haproxy/quic_tls-t.h>

/* Used only for QUIC TLS key phase traces */
struct quic_kp_trace {
const unsigned char *rx_sec;
size_t rx_seclen;
const struct quic_tls_kp *rx;
const unsigned char *tx_sec;
size_t tx_seclen;
const struct quic_tls_kp *tx;
};

/* Only for debug purpose */
struct enc_debug_info {
unsigned char *payload;
size_t payload_len;
unsigned char *aad;
size_t aad_len;
uint64_t pn;
};

#endif /* _HAPROXY_QUIC_TRACE_T_H */
38 changes: 38 additions & 0 deletions include/haproxy/quic_trace.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* include/haproxy/quic_trace.h
* This file contains QUIC traces definitions.
*
* Copyright (C) 2023
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, version 2.1
* exclusively.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _HAPROXY_QUIC_TRACE_H
#define _HAPROXY_QUIC_TRACE_H

#include <haproxy/quic_trace-t.h>

/* Initializes a enc_debug_info struct (only for debug purpose) */
static inline void enc_debug_info_init(struct enc_debug_info *edi,
unsigned char *payload, size_t payload_len,
unsigned char *aad, size_t aad_len, uint64_t pn)
{
edi->payload = payload;
edi->payload_len = payload_len;
edi->aad = aad;
edi->aad_len = aad_len;
edi->pn = pn;
}

#endif /* _HAPROXY_QUIC_TRACE_H */
Loading

0 comments on commit b67f651

Please sign in to comment.