big svn cleanup
[anytun.git] / src / openvpn / tap-win32 / error.h
blob21137e5c5b79012176222d3fb660b4fc8ee59fda
1 /*
2 * TAP-Win32 -- A kernel driver to provide virtual tap device functionality
3 * on Windows. Originally derived from the CIPE-Win32
4 * project by Damion K. Wilson, with extensive modifications by
5 * James Yonan.
7 * All source code which derives from the CIPE-Win32 project is
8 * Copyright (C) Damion K. Wilson, 2003, and is released under the
9 * GPL version 2 (see below).
11 * All other source code is Copyright (C) 2002-2005 OpenVPN Solutions LLC,
12 * and is released under the GPL version 2 (see below).
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2
16 * as published by the Free Software Foundation.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program (see the file COPYING included with this
25 * distribution); if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 //-----------------
30 // DEBUGGING OUTPUT
31 //-----------------
33 #define NOTE_ERROR() \
34 { \
35 g_LastErrorFilename = __FILE__; \
36 g_LastErrorLineNumber = __LINE__; \
39 #if DBG
41 typedef struct {
42 unsigned int in;
43 unsigned int out;
44 unsigned int capacity;
45 char *text;
46 BOOLEAN error;
47 MUTEX lock;
48 } DebugOutput;
50 VOID MyDebugPrint (const unsigned char* format, ...);
52 VOID MyAssert (const unsigned char *file, int line);
54 VOID DumpPacket (const char *prefix,
55 const unsigned char *data,
56 unsigned int len);
58 VOID DumpPacket2 (const char *prefix,
59 const ETH_HEADER *eth,
60 const unsigned char *data,
61 unsigned int len);
63 #define CAN_WE_PRINT (DEBUGP_AT_DISPATCH || KeGetCurrentIrql () < DISPATCH_LEVEL)
65 #if ALSO_DBGPRINT
66 #define DEBUGP(fmt) { MyDebugPrint fmt; if (CAN_WE_PRINT) DbgPrint fmt; }
67 #else
68 #define DEBUGP(fmt) { MyDebugPrint fmt; }
69 #endif
71 #define MYASSERT(exp) \
72 { \
73 if (!(exp)) \
74 { \
75 MyAssert(__FILE__, __LINE__); \
76 } \
79 #define DUMP_PACKET(prefix, data, len) \
80 DumpPacket (prefix, data, len)
82 #define DUMP_PACKET2(prefix, eth, data, len) \
83 DumpPacket2 (prefix, eth, data, len)
85 #else
87 #define DEBUGP(fmt)
88 #define MYASSERT(exp)
89 #define DUMP_PACKET(prefix, data, len)
90 #define DUMP_PACKET2(prefix, eth, data, len)
92 #endif