summaryrefslogtreecommitdiffstats
path: root/private/ntos/nbt/inc/vxddebug.h
blob: c81e769651fccd21d55c64805d0ebe449e22e925 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/**********************************************************************/
/**                       Microsoft Windows NT                       **/
/**                Copyright(c) Microsoft Corp., 1993                **/
/**********************************************************************/

/*
    debug.h

    This file contains a number of debug-dependent definitions.


    FILE HISTORY:
        KeithMo     20-Sep-1993 Created.

*/


#ifndef _DEBUG_H_
#define _DEBUG_H_


#ifdef DEBUG

#include <stdarg.h>

#define DBG_MEMALLOC_VERIFY  0x0BEEFCAFE

typedef struct {
    LIST_ENTRY    Linkage;          // to keep linked list of allocated blocks
    DWORD         Verify;           // our signature
    DWORD         ReqSize;          // original size as requested by caller
    DWORD         Owner[4];         // stack trace 4 deep (of ret.addrs)
} DbgMemBlkHdr;

LIST_ENTRY  DbgMemList;
ULONG       DbgLeakCheck;

//
//  Debug output control flags.
//

extern  DWORD   VxdDebugFlags;


#define VXD_DEBUG_INIT                 0x00000001L
#define VXD_DEBUG_SOCKET               0x00000002L
#define VXD_DEBUG_MISC                 0x00000004L
#define VXD_DEBUG_BIND                 0x00000008L
#define VXD_DEBUG_ACCEPT               0x00000010L
#define VXD_DEBUG_CONNECT              0x00000020L
#define VXD_DEBUG_LISTEN               0x00000040L
#define VXD_DEBUG_RECV                 0x00000080L
#define VXD_DEBUG_SEND                 0x00000100L
#define VXD_DEBUG_SOCKOPT              0x00000200L
#define VXD_DEBUG_CONFIG               0x00000400L
#define VXD_DEBUG_CONNECT_EVENT        0x00000800L
#define VXD_DEBUG_DISCONNECT_EVENT     0x00001000L
#define VXD_DEBUG_ERROR_EVENT          0x00002000L
#define VXD_DEBUG_RECV_EVENT           0x00004000L
#define VXD_DEBUG_RECV_DATAGRAM_EVENT  0x00008000L
#define VXD_DEBUG_RECV_EXPEDITED_EVENT 0x00010000L
// #define VXD_DEBUG_                     0x00020000L
// #define VXD_DEBUG_                     0x00040000L
// #define VXD_DEBUG_                     0x00080000L
// #define VXD_DEBUG_                     0x00100000L
// #define VXD_DEBUG_                     0x00200000L
// #define VXD_DEBUG_                     0x00400000L
// #define VXD_DEBUG_                     0x00800000L
// #define VXD_DEBUG_                     0x01000000L
// #define VXD_DEBUG_                     0x02000000L
// #define VXD_DEBUG_                     0x04000000L
// #define VXD_DEBUG_                     0x08000000L
// #define VXD_DEBUG_                     0x10000000L
// #define VXD_DEBUG_                     0x20000000L
// #define VXD_DEBUG_                     0x40000000L
#define VXD_DEBUG_OUTPUT_TO_DEBUGGER   0x80000000L

//
//  Debug output function.
//

void VxdPrintf( char * pszFormat,
                ... );

int VxdSprintf( char * pszStr,
                char * pszFmt,
                ... );

#define VXD_PRINT(args) VxdPrintf args


//
//  Assert & require.
//

void VxdAssert( void          * pAssertion,
                void          * pFileName,
                unsigned long   nLineNumber );

#define VXD_ASSERT(exp) if (!(exp)) VxdAssert( #exp, __FILE__, __LINE__ )
#define VXD_REQUIRE VXD_ASSERT


//
//  Miscellaneous goodies.
//

void VxdDebugOutput( char * pszMessage );

#define DEBUG_BREAK     _asm int 3
#define DEBUG_OUTPUT(x) VxdDebugOutput(x)


#else   // !DEBUG


//
//  No debug output.
//

#define IF_DEBUG(flag) if (0)


//
//  Null debug output function.
//

#define VXD_PRINT(args)


//
//  Null assert & require.
//

#define VXD_ASSERT(exp)
#define VXD_REQUIRE(exp) ((void)(exp))


//
//  No goodies.
//

#define DEBUG_BREAK
#define DEBUG_OUTPUT(x)


#endif  // DEBUG


#endif  // _DEBUG_H_