xref: /reactos/drivers/network/tcpip/include/debug.h (revision 9e066abe)
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS TCP/IP protocol driver
4  * FILE:        include/debug.h
5  * PURPOSE:     Debugging support macros
6  * DEFINES:     DBG     - Enable debug output
7  *              NASSERT - Disable assertions
8  */
9 
10 #pragma once
11 
12 #define MIN_TRACE      ((1 << DPFLTR_WARNING_LEVEL))
13 #define MID_TRACE      ((1 << DPFLTR_WARNING_LEVEL) | (1 << DPFLTR_TRACE_LEVEL))
14 #define MAX_TRACE      ((1 << DPFLTR_WARNING_LEVEL) | (1 << DPFLTR_TRACE_LEVEL) | (1 << DPFLTR_INFO_LEVEL))
15 
16 #define DEBUG_CHECK    0x00000100
17 #define DEBUG_MEMORY   0x00000200
18 #define DEBUG_PBUFFER  0x00000400
19 #define DEBUG_IRP      0x00000800
20 #define DEBUG_TCPIF    0x00001000
21 #define DEBUG_ADDRFILE 0x00002000
22 #define DEBUG_DATALINK 0x00004000
23 #define DEBUG_ARP      0x00008000
24 #define DEBUG_IP       0x00010000
25 #define DEBUG_UDP      0x00020000
26 #define DEBUG_TCP      0x00040000
27 #define DEBUG_ICMP     0x00080000
28 #define DEBUG_ROUTER   0x00100000
29 #define DEBUG_RCACHE   0x00200000
30 #define DEBUG_NCACHE   0x00400000
31 #define DEBUG_CPOINT   0x00800000
32 #define DEBUG_LOCK     0x01000000
33 #define DEBUG_INFO     0x02000000
34 #define DEBUG_ULTRA    0x7FFFFFFF
35 
36 #if DBG
37 
38 #define REMOVE_PARENS(...) __VA_ARGS__
39 #define TI_DbgPrint(_t_, _x_) \
40     DbgPrintEx(DPFLTR_TCPIP_ID, (_t_) | DPFLTR_MASK, "(%s:%d) ", __FILE__, __LINE__), \
41     DbgPrintEx(DPFLTR_TCPIP_ID, (_t_) | DPFLTR_MASK, REMOVE_PARENS _x_)
42 
43 #else /* DBG */
44 
45 #define TI_DbgPrint(_t_, _x_)
46 
47 #endif /* DBG */
48 
49 
50 #define assert(x) ASSERT(x)
51 #define assert_irql(x) ASSERT_IRQL(x)
52 
53 
54 #ifdef _MSC_VER
55 
56 #define UNIMPLEMENTED \
57     TI_DbgPrint(MIN_TRACE, ("The function at %s:%d is unimplemented, \
58         but come back another day.\n", __FILE__, __LINE__));
59 
60 #else /* _MSC_VER */
61 
62 #define UNIMPLEMENTED \
63     TI_DbgPrint(MIN_TRACE, ("(%s:%d)(%s) is unimplemented, \
64         but come back another day.\n", __FILE__, __LINE__, __FUNCTION__));
65 
66 #endif /* _MSC_VER */
67 
68 
69 #define CHECKPOINT \
70     do { TI_DbgPrint(DEBUG_CHECK, ("(%s:%d)\n", __FILE__, __LINE__)); } while(0);
71 
72 #define CP CHECKPOINT
73 
74 #define ASSERT_KM_POINTER(_x) \
75    ASSERT(((ULONG_PTR)(_x)) != (ULONG_PTR)0xccccccccccccccccULL); \
76    ASSERT(((PVOID)(_x)) >= MmSystemRangeStart);
77 
78 /* EOF */
79