add winpcap 4.0.2 from url http://www.winpcap.org/
[natblaster.git] / winpcap / packetNtx / driver / DEBUG.H
blob790c32ca8f1336cfd509257deefbe7bab6a31a3a
1 /*\r
2  * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)\r
3  * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California)\r
4  * All rights reserved.\r
5  *\r
6  * Redistribution and use in source and binary forms, with or without\r
7  * modification, are permitted provided that the following conditions\r
8  * are met:\r
9  *\r
10  * 1. Redistributions of source code must retain the above copyright\r
11  * notice, this list of conditions and the following disclaimer.\r
12  * 2. Redistributions in binary form must reproduce the above copyright\r
13  * notice, this list of conditions and the following disclaimer in the\r
14  * documentation and/or other materials provided with the distribution.\r
15  * 3. Neither the name of the Politecnico di Torino, CACE Technologies \r
16  * nor the names of its contributors may be used to endorse or promote \r
17  * products derived from this software without specific prior written \r
18  * permission.\r
19  *\r
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
31  *\r
32  */\r
34 #ifndef __DEBUG_INCLUDE\r
35 #define __DEBUG_INCLUDE\r
38 #if DBG\r
40 #define IF_PACKETDEBUG(f) if (PacketDebugFlag & (f))\r
41 extern ULONG PacketDebugFlag;\r
43 #define PACKET_DEBUG_LOUD               0x00000001  // debugging info\r
44 #define PACKET_DEBUG_VERY_LOUD          0x00000002  // excessive debugging info\r
46 #define PACKET_DEBUG_INIT               0x00000100  // init debugging info\r
48 //\r
49 // unfortunately, NT4 does not have the __FUNCTION__ macro, so we define it as null\r
50 //\r
51 #ifndef __FUNCTION__\r
52 #define __FUNCTION__ \r
53 #endif\r
55 //\r
56 // Macro for deciding whether to dump lots of debugging information.\r
57 //\r
59 #define IF_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_LOUD ) { A }\r
60 #define IF_VERY_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_VERY_LOUD ) { A }\r
61 #define IF_INIT_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_INIT ) { A }\r
63 #define TRACE_ENTER() DbgPrint("--> " __FUNCTION__)\r
64 #define TRACE_EXIT() DbgPrint("<-- " __FUNCTION__)\r
65 #define TRACE_MESSAGE(__level__, __message__) do{ if (PacketDebugFlag & (__level__)) DbgPrint("    " __FUNCTION__ ": " __message__);} while(FALSE)\r
67 #define TRACE_MESSAGE1(__level__, __message__, __p1__) do                       \\r
68         {                                                                                                                               \\r
69                 if (PacketDebugFlag & (__level__))                                                      \\r
70                         DbgPrint("    " __FUNCTION__ ": " __message__, __p1__); \\r
71         } while(FALSE)\r
73 #define TRACE_MESSAGE2(__level__, __message__, __p1__, __p2__) do                       \\r
74         {                                                                                                                                               \\r
75                 if (PacketDebugFlag & (__level__))                                                                      \\r
76                         DbgPrint("    " __FUNCTION__ ": " __message__, __p1__, __p2__); \\r
77         } while(FALSE)\r
79 #define TRACE_MESSAGE3(__level__, __message__, __p1__, __p2__, __p3__) do       \\r
80         {                                                                                                                                               \\r
81                 if (PacketDebugFlag & (__level__))                                                                      \\r
82                         DbgPrint("    " __FUNCTION__ ": " __message__, __p1__, __p2__, __p3__); \\r
83         } while(FALSE)\r
85 #define TRACE_MESSAGE4(__level__, __message__, __p1__, __p2__, __p3__, __p4__) do       \\r
86         {                                                                                                                                               \\r
87                 if (PacketDebugFlag & (__level__))                                                                      \\r
88                         DbgPrint("    " __FUNCTION__ ": " __message__, __p1__, __p2__, __p3__, __p4__ );        \\r
89         } while(FALSE)\r
92 #else //DBG\r
94 #define IF_LOUD(A)\r
95 #define IF_VERY_LOUD(A)\r
96 #define IF_INIT_LOUD(A)\r
98 #define TRACE_ENTER()\r
99 #define TRACE_EXIT()\r
100 #define TRACE_MESSAGE(__level__, __message__)\r
101 #define TRACE_MESSAGE1(__level__, __message__, __p1__)\r
102 #define TRACE_MESSAGE2(__level__, __message__, __p1__, __p2__)\r
103 #define TRACE_MESSAGE3(__level__, __message__, __p1__, __p2__, __p3__)\r
104 #define TRACE_MESSAGE4(__level__, __message__, __p1__, __p2__, __p3__, __p4__)\r
106 #endif\r
108 #endif /*#define __DEBUG_INCLUDE*/\r