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
6 * Redistribution and use in source and binary forms, with or without
\r
7 * modification, are permitted provided that the following conditions
\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
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
34 #ifndef __DEBUG_INCLUDE
\r
35 #define __DEBUG_INCLUDE
\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
49 // unfortunately, NT4 does not have the __FUNCTION__ macro, so we define it as null
\r
51 #ifndef __FUNCTION__
\r
52 #define __FUNCTION__
\r
56 // Macro for deciding whether to dump lots of debugging information.
\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
69 if (PacketDebugFlag & (__level__)) \
\r
70 DbgPrint(" " __FUNCTION__ ": " __message__, __p1__); \
\r
73 #define TRACE_MESSAGE2(__level__, __message__, __p1__, __p2__) do \
\r
75 if (PacketDebugFlag & (__level__)) \
\r
76 DbgPrint(" " __FUNCTION__ ": " __message__, __p1__, __p2__); \
\r
79 #define TRACE_MESSAGE3(__level__, __message__, __p1__, __p2__, __p3__) do \
\r
81 if (PacketDebugFlag & (__level__)) \
\r
82 DbgPrint(" " __FUNCTION__ ": " __message__, __p1__, __p2__, __p3__); \
\r
85 #define TRACE_MESSAGE4(__level__, __message__, __p1__, __p2__, __p3__, __p4__) do \
\r
87 if (PacketDebugFlag & (__level__)) \
\r
88 DbgPrint(" " __FUNCTION__ ": " __message__, __p1__, __p2__, __p3__, __p4__ ); \
\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
108 #endif /*#define __DEBUG_INCLUDE*/
\r