5 * Copyright (c) 2006 CACE Technologies, Davis (California)
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the project nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
24 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 #ifndef _AIRPDCAP_DEBUG_H
38 #define _AIRPDCAP_DEBUG_H
40 #include "airpdcap_interop.h"
42 void print_debug_line(const CHAR
*function
, const CHAR
*msg
, const INT level
);
46 #define AIRPDCAP_DEBUG_PRINT_LINE(notdefined, msg, level) print_debug_line(__FUNCTION__, msg, level);
48 #define AIRPDCAP_DEBUG_PRINT_LINE(function, msg, level) print_debug_line(function, msg, level);
52 #define AIRPDCAP_DEBUG_PRINT_LINE(notdefined, msg, level)
54 #define AIRPDCAP_DEBUG_PRINT_LINE(function, msg, level)
58 /******************************************************************************/
59 /* Debug section: internal function to print debug information */
65 /* Debug level definition */
66 #define AIRPDCAP_DEBUG_LEVEL_1 1
67 #define AIRPDCAP_DEBUG_LEVEL_2 2
68 #define AIRPDCAP_DEBUG_LEVEL_3 3
69 #define AIRPDCAP_DEBUG_LEVEL_4 4
70 #define AIRPDCAP_DEBUG_LEVEL_5 5
72 #define AIRPDCAP_DEBUG_USED_LEVEL AIRPDCAP_DEBUG_LEVEL_3
76 #define AIRPDCAP_DEBUG_TRACE_START(notdefined) print_debug_line(__FUNCTION__, "Start!", AIRPDCAP_DEBUG_USED_LEVEL);
77 #define AIRPDCAP_DEBUG_TRACE_END(notdefined) print_debug_line(__FUNCTION__, "End!", AIRPDCAP_DEBUG_USED_LEVEL);
79 #define AIRPDCAP_DEBUG_TRACE_START(function) print_debug_line(function, "Start!", AIRPDCAP_DEBUG_USED_LEVEL);
80 #define AIRPDCAP_DEBUG_TRACE_END(function) print_debug_line(function, "End!", AIRPDCAP_DEBUG_USED_LEVEL);
84 #define AIRPDCAP_DEBUG_TRACE_START(notdefined)
85 #define AIRPDCAP_DEBUG_TRACE_END(notdefined)
87 #define AIRPDCAP_DEBUG_TRACE_START(function)
88 #define AIRPDCAP_DEBUG_TRACE_END(function)
92 #define DEBUG_DUMP(x,y,z) g_warning("%s: %s", x, bytes_to_str(y, (z)))
94 #else /* !defined _DEBUG */
96 #define AIRPDCAP_DEBUG_LEVEL_1
97 #define AIRPDCAP_DEBUG_LEVEL_2
98 #define AIRPDCAP_DEBUG_LEVEL_3
99 #define AIRPDCAP_DEBUG_LEVEL_4
100 #define AIRPDCAP_DEBUG_LEVEL_5
102 #define AIRPDCAP_DEBUG_TRACE_START(function)
103 #define AIRPDCAP_DEBUG_TRACE_END(function)
105 #define DEBUG_DUMP(x,y,z)
107 #endif /* ?defined _DEBUG */
110 #endif /* ?defined _AIRPDCAP_DEBUG_H */