You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2017/10/03 20:08:04 UTC
[trafficserver] branch quic-latest updated: Add debug tag for
handshake packet dump
This is an automated email from the ASF dual-hosted git repository.
masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/quic-latest by this push:
new 49ce8f1 Add debug tag for handshake packet dump
49ce8f1 is described below
commit 49ce8f11234a11639b9ee69829193fbb8845d2f3
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Tue Oct 3 13:07:17 2017 -0700
Add debug tag for handshake packet dump
---
iocore/net/quic/QUICHandshake.cc | 61 ++++++++++++++++++++++++++++------------
1 file changed, 43 insertions(+), 18 deletions(-)
diff --git a/iocore/net/quic/QUICHandshake.cc b/iocore/net/quic/QUICHandshake.cc
index 7c34690..9dbbc5f 100644
--- a/iocore/net/quic/QUICHandshake.cc
+++ b/iocore/net/quic/QUICHandshake.cc
@@ -29,24 +29,49 @@
#include "QUICConfig.h"
#include "P_SSLNextProtocolSet.h"
-#define I_WANNA_DUMP_THIS_BUF(buf, len) \
- { \
- int i, j; \
- fprintf(stderr, "len=%" PRId64 "\n", len); \
- for (i = 0; i < len / 8; i++) { \
- fprintf(stderr, "%02x %02x %02x %02x %02x %02x %02x %02x ", buf[i * 8 + 0], buf[i * 8 + 1], buf[i * 8 + 2], buf[i * 8 + 3], \
- buf[i * 8 + 4], buf[i * 8 + 5], buf[i * 8 + 6], buf[i * 8 + 7]); \
- if ((i + 1) % 4 == 0 || (len % 8 == 0 && i + 1 == len / 8)) { \
- fprintf(stderr, "\n"); \
- } \
- } \
- if (len % 8 != 0) { \
- fprintf(stderr, "%0x", buf[i * 8 + 0]); \
- for (j = 1; j < len % 8; j++) { \
- fprintf(stderr, " %02x", buf[i * 8 + j]); \
- } \
- fprintf(stderr, "\n"); \
- } \
+static constexpr char dump_tag[] = "quic_handshake_dump_pkt";
+
+#define I_WANNA_DUMP_THIS_BUF(buf, len) \
+ { \
+ int i; \
+ Debug(dump_tag, "len=%" PRId64 "\n", len); \
+ for (i = 0; i < len / 8; i++) { \
+ Debug(dump_tag, "%02x %02x %02x %02x %02x %02x %02x %02x ", buf[i * 8 + 0], buf[i * 8 + 1], buf[i * 8 + 2], buf[i * 8 + 3], \
+ buf[i * 8 + 4], buf[i * 8 + 5], buf[i * 8 + 6], buf[i * 8 + 7]); \
+ } \
+ switch (len % 8) { \
+ case 1: \
+ Debug(dump_tag, "%02x", buf[i * 8 + 0]); \
+ break; \
+ case 2: \
+ Debug(dump_tag, "%02x %02x", buf[i * 8 + 0], buf[i * 8 + 1]); \
+ \
+ break; \
+ case 3: \
+ Debug(dump_tag, "%02x %02x %02x", buf[i * 8 + 0], buf[i * 8 + 1], buf[i * 8 + 2]); \
+ \
+ break; \
+ case 4: \
+ Debug(dump_tag, "%02x %02x %02x %02x", buf[i * 8 + 0], buf[i * 8 + 1], buf[i * 8 + 2], buf[i * 8 + 3]); \
+ \
+ break; \
+ case 5: \
+ Debug(dump_tag, "%02x %02x %02x %02x %02x", buf[i * 8 + 0], buf[i * 8 + 1], buf[i * 8 + 2], buf[i * 8 + 3], buf[i * 8 + 4]); \
+ \
+ break; \
+ case 6: \
+ Debug(dump_tag, "%02x %02x %02x %02x %02x %02x", buf[i * 8 + 0], buf[i * 8 + 1], buf[i * 8 + 2], buf[i * 8 + 3], \
+ buf[i * 8 + 4], buf[i * 8 + 5]); \
+ \
+ break; \
+ case 7: \
+ Debug(dump_tag, "%02x %02x %02x %02x %02x %02x %02x", buf[i * 8 + 0], buf[i * 8 + 1], buf[i * 8 + 2], buf[i * 8 + 3], \
+ buf[i * 8 + 4], buf[i * 8 + 5], buf[i * 8 + 6]); \
+ \
+ break; \
+ default: \
+ break; \
+ } \
}
static constexpr char tag[] = "quic_handshake";
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].