Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 100 lines (81 sloc) 2.859 kB
1912fdf @firnsy initial import.
authored
1 /* $Id$ */
2 /*
3 ** Copyright (C) 2002-2009 Sourcefire, Inc.
4 ** Copyright (C) 1998-2002 Martin Roesch <roesch@sourcefire.com>
5 **
6 ** This program is free software; you can redistribute it and/or modify
7 ** it under the terms of the GNU General Public License Version 2 as
8 ** published by the Free Software Foundation. You may not use, modify or
9 ** distribute this program under any other version of the GNU General
10 ** Public License.
11 **
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
16 **
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; if not, write to the Free Software
19 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22
23 #ifndef DEBUG_H
24 #define DEBUG_H
25
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29
30 #ifdef WIN32
31 #define INLINE __inline
32 #else /* WIN32 */
33 #define INLINE inline
34 #endif /* WIN32 */
35
36 #include <ctype.h>
37 #ifdef HAVE_WCHAR_H
38 /* ISOC99 is defined to get required prototypes */
39 #ifndef __USE_ISOC99
40 #define __USE_ISOC99
41 #endif
42 #include <wchar.h>
43 #endif
44
45 #define DEBUG_VARIABLE "BARNYARD2_DEBUG"
46
47 #define DEBUG_ALL 0xffffffff /* 4294967295 */
48 #define DEBUG_INIT 0x00000001 /* 1 */
49 #define DEBUG_CONFIGRULES 0x00000002 /* 2 */
50 #define DEBUG_PLUGIN 0x00000004 /* 4 */
51 #define DEBUG_VARS 0x00000010 /* 16 */
52 #define DEBUG_LOG 0x00000020 /* 32 */
53 #define DEBUG_FLOW 0x00000040
54 #define DEBUG_DECODE 0x00000080
55 #define DEBUG_DATALINK 0x00000100
56 #define DEBUG_INPUT_PLUGIN 0x00000200
57 #define DEBUG_OUTPUT_PLUGIN 0x00000400
58 #define DEBUG_SPOOLER 0x00000800
59 #define DEBUG_MAPS 0x00001000
60 #define DEBUG_PATTERN_MATCH 0x00080000
61
62 void DebugMessageFunc(int dbg,char *fmt, ...);
63 #ifdef HAVE_WCHAR_H
64 void DebugWideMessageFunc(int dbg,wchar_t *fmt, ...);
65 #endif
66
67 #ifdef DEBUG
68
69 extern char *DebugMessageFile;
70 extern int DebugMessageLine;
71
72 #define DebugMessage DebugMessageFile = __FILE__; DebugMessageLine = __LINE__; DebugMessageFunc
73 #define DebugWideMessage DebugMessageFile = __FILE__; DebugMessageLine = __LINE__; DebugWideMessageFunc
74
75 int GetDebugLevel (void);
76 int DebugThis(int level);
77 #else
78
79 #ifdef WIN32
80 /* Visual C++ uses the keyword "__inline" rather than "__inline__" */
81 #define __inline__ __inline
82 #endif
83
84 #endif /* DEBUG */
85
86
87 #ifdef DEBUG
88 #define DEBUG_WRAP(code) code
89 void DebugMessageFunc(int dbg,char *fmt, ...);
90 #ifdef HAVE_WCHAR_H
91 void DebugWideMessageFunc(int dbg,wchar_t *fmt, ...);
92 #endif
93 #else
94 #define DEBUG_WRAP(code)
95 /* I would use DebugMessage(dbt,fmt...) but that only works with GCC */
96
97 #endif
98
99 #endif /* DEBUG_H */
Something went wrong with that request. Please try again.