Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

conversation_debug.h
1 /* conversation_debug.h
2 * A file of debug printing stuff for conversation-related things,
3 * although really anything can use this so long as it includes this
4 * header file and defines DEBUG_CONVERSATION in conversation.c
5 *
6 * define DEBUG_CONVERSATION before including this file to turn on printing
7 * and also define it in conversation.c (because it has the indent variable)
8 *
9 * By Hadriel Kaplan <hadrielk at yahoo dot com>
10 * Copyright 2014 Hadriel Kaplan
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 */
14
15 #ifndef _CONVERSATION_DEBUG_H
16 #define _CONVERSATION_DEBUG_H
17
18 #ifdef DEBUG_CONVERSATION
19
20 #include <stdio.h>
21 #include "to_str.h"
22
23 extern int _debug_conversation_indent; /* the instance is in conversation.c */
24
25 #define DINDENT() _debug_conversation_indent += 4
26 #define DENDENT() _debug_conversation_indent -= 4
27
28 #define DPRINT(arg) \
29 g_printerr("%*.*s%s: ", \
30 _debug_conversation_indent,_debug_conversation_indent," ", \
31 G_STRLOC); \
32 g_printerr arg; \
33 g_printerr("\n")
34
35 #define DPRINT2(arg) \
36 g_printerr("%*.*s", \
37 _debug_conversation_indent,_debug_conversation_indent," "); \
38 g_printerr arg; \
39 g_printerr("\n")
40
41 #else /* !DEBUG_CONVERSATION */
42
43 /* a hack to let these defines be used with trailing semi-colon and not
44 * cause gcc extra-check pedantic warnings for extra colons
45 */
46 #define DINDENT() (void)0
47 #define DENDENT() (void)0
48 #define DPRINT(arg) (void)0
49 #define DPRINT2(arg) (void)0
50
51 #endif /* DEBUG_CONVERSATION */
52
53 #endif /* _CONVERSATION_DEBUG_H */