Copy wininet to branch
[reactos.git] / reactos / drivers / net / tcpip / include / debug.h
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 #ifndef __DEBUG_H
10 #define __DEBUG_H
11
12 #define NORMAL_MASK 0x000000FF
13 #define SPECIAL_MASK 0xFFFFFF00
14 #define MIN_TRACE 0x00000001
15 #define MID_TRACE 0x00000002
16 #define MAX_TRACE 0x00000003
17
18 #define DEBUG_CHECK 0x00000100
19 #define DEBUG_MEMORY 0x00000200
20 #define DEBUG_PBUFFER 0x00000400
21 #define DEBUG_IRP 0x00000800
22 #define DEBUG_TCPIF 0x00001000
23 #define DEBUG_ADDRFILE 0x00002000
24 #define DEBUG_DATALINK 0x00004000
25 #define DEBUG_ARP 0x00008000
26 #define DEBUG_IP 0x00010000
27 #define DEBUG_UDP 0x00020000
28 #define DEBUG_TCP 0x00040000
29 #define DEBUG_ICMP 0x00080000
30 #define DEBUG_ROUTER 0x00100000
31 #define DEBUG_RCACHE 0x00200000
32 #define DEBUG_NCACHE 0x00400000
33 #define DEBUG_CPOINT 0x00800000
34 #define DEBUG_LOCK 0x01000000
35 #define DEBUG_ULTRA 0xFFFFFFFF
36
37 #ifdef DBG
38
39 extern DWORD DebugTraceLevel;
40
41 #ifdef _MSC_VER
42
43 #define TI_DbgPrint(_t_, _x_) \
44 if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
45 ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
46 DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
47 DbgPrint _x_ ; \
48 }
49
50 #else /* _MSC_VER */
51
52 #define TI_DbgPrint(_t_, _x_) \
53 if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
54 ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
55 DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
56 DbgPrint _x_ ; \
57 }
58
59 #endif /* _MSC_VER */
60
61 #define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
62
63 #else /* DBG */
64
65 #define TI_DbgPrint(_t_, _x_)
66
67 #endif /* DBG */
68
69
70 #define assert(x) ASSERT(x)
71 #define assert_irql(x) ASSERT_IRQL(x)
72
73
74 #ifdef _MSC_VER
75
76 #define UNIMPLEMENTED \
77 TI_DbgPrint(MIN_TRACE, ("The function at %s:%d is unimplemented, \
78 but come back another day.\n", __FILE__, __LINE__));
79
80 #else /* _MSC_VER */
81
82 #define UNIMPLEMENTED \
83 TI_DbgPrint(MIN_TRACE, ("(%s:%d)(%s) is unimplemented, \
84 but come back another day.\n", __FILE__, __LINE__, __FUNCTION__));
85
86 #endif /* _MSC_VER */
87
88
89 #define CHECKPOINT \
90 do { TI_DbgPrint(DEBUG_CHECK, ("(%s:%d)\n", __FILE__, __LINE__)); } while(0);
91
92 #define CP CHECKPOINT
93
94 #include <memtrack.h>
95
96 #define ASSERT_KM_POINTER(_x) \
97 ASSERT(((PVOID)_x) != (PVOID)0xcccccccc); \
98 ASSERT(((PVOID)_x) >= (PVOID)0x80000000);
99
100 #endif /* __DEBUG_H */
101
102 /* EOF */