summaryrefslogtreecommitdiff
path: root/epan/conversation_debug.h
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2014-03-05 10:56:33 -0500
committerAnders Broman <a.broman58@gmail.com>2014-03-21 05:15:57 +0000
commita04f610989400f76beaa7709b0e7fa1bce2109a7 (patch)
tree426bef8a3e3f4357d6d0f347c70fae223004e593 /epan/conversation_debug.h
parent9c5f1990504ba804df76157595248b7e90edf109 (diff)
downloadwireshark-a04f610989400f76beaa7709b0e7fa1bce2109a7.tar.gz
Add debug printing functions for conversations, sip, sdp, rtp
There have been enough gnarly bus in sip/sdp/rtp that it needs to have good debug printing. Using a debugger isn't good enough because there's interaction across multiple frames and it's too hard to follow what's going on without real printed data history. Change-Id: Ifb5bb1fb580be81f988569ece79d238a9c030c34 Reviewed-on: https://code.wireshark.org/review/688 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/conversation_debug.h')
-rw-r--r--epan/conversation_debug.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/epan/conversation_debug.h b/epan/conversation_debug.h
new file mode 100644
index 0000000000..b09e0f71f5
--- /dev/null
+++ b/epan/conversation_debug.h
@@ -0,0 +1,47 @@
+
+/* a file of debug printing stuff for conversation-related things,
+ * although really anything can use this so long as it includes this
+ *
+ * define DEBUG_CONVERSATION before including this file to turn on printing
+ * and also define it in conversation.c (because it has the indent variable)
+ */
+
+#ifndef _CONVERSATION_DEBUG_H
+#define _CONVERSATION_DEBUG_H
+
+#ifdef DEBUG_CONVERSATION
+
+#include <stdio.h>
+#include "to_str.h"
+
+extern int _debug_conversation_indent; /* the instance is in conversation.c */
+
+#define DINDENT() _debug_conversation_indent += 4
+#define DENDENT() _debug_conversation_indent -= 4
+
+#define DPRINT(arg) \
+ g_printerr("%*.*s%s: ", \
+ _debug_conversation_indent,_debug_conversation_indent," ", \
+ G_STRLOC); \
+ g_printerr arg; \
+ g_printerr("\n")
+
+#define DPRINT2(arg) \
+ g_printerr("%*.*s", \
+ _debug_conversation_indent,_debug_conversation_indent," "); \
+ g_printerr arg; \
+ g_printerr("\n")
+
+#else /* !DEBUG_CONVERSATION */
+
+/* a hack to let these defines be used with trailing semi-colon and not
+ * cause gcc extra-check pedantic warnings for extra colons
+ */
+#define DINDENT() (void)0
+#define DENDENT() (void)0
+#define DPRINT(arg) (void)0
+#define DPRINT2(arg) (void)0
+
+#endif /* DEBUG_CONVERSATION */
+
+#endif /* _CONVERSATION_DEBUG_H */