1 /*!
2  * \file        sccp_debug.h
3  * \brief       SCCP Debug Header
4  * \author      Diederik de Groot < ddegroot@users.sourceforge.net >
5  * \note        This program is free software and may be modified and distributed under the terms of the GNU Public License.
6  *              See the LICENSE file at the top of the source tree.
7  * \since       2016-02-02
8  */
9 #pragma once
10 #include "config.h"
11 #include "define.h"
12 
13 #ifdef NO_FILE_LINE_FUNC_DEBUG
14 #	undef NO_FILE_LINE_FUNC_DEBUG
15 #endif
16 
17 #define _B_                     "", 0, ""
18 #define __LOG_VERBOSE           2
19 #define NO_FILE_LINE_FUNC_DEBUG __LOG_VERBOSE, _B_
20 
21 #define sccp_log2(...)                                                                                                                                                                                                          \
22 	{                                                                                                                                                                                                                       \
23 		if ((sccp_globals->debug & (DEBUGCAT_FILELINEFUNC)) == DEBUGCAT_FILELINEFUNC) {                                                                                                                                 \
24 			pbx_log(AST_LOG_NOTICE, __VA_ARGS__);                                                                                                                                                                   \
25 		} else {                                                                                                                                                                                                        \
26 			pbx_log(NO_FILE_LINE_FUNC_DEBUG, __VA_ARGS__);                                                                                                                                                          \
27 		}                                                                                                                                                                                                               \
28 	}
29 #define sccp_log1(_format, ...)                                                                                                                                                                                                 \
30 	sccp_log2(_format, ##__VA_ARGS__)                                                                                                                                                                                       \
31 	}                                                                                                                                                                                                                       \
32 	})
33 #define sccp_log(_x) ({if ((sccp_globals->debug & (_x))) {sccp_log1
34 #define sccp_log_and(_x) ({if ((sccp_globals->debug & (_x)) == (_x)) {sccp_log1
35 __BEGIN_C_EXTERN__
36 extern const char * SS_Memory_Allocation_Error;
37 /*!
38  * \brief SCCP Debug Category Enum
39  */
40 typedef enum
41 {
42 	/* *INDENT-OFF* */
43 	DEBUGCAT_NONE           = 0,
44 	DEBUGCAT_CORE           = 1 << 0,
45 	DEBUGCAT_HINT           = 1 << 1,
46 	DEBUGCAT_RTP            = 1 << 2,
47 	DEBUGCAT_DEVICE         = 1 << 3,
48 	DEBUGCAT_LINE           = 1 << 4,
49 	DEBUGCAT_ACTION         = 1 << 5,
50 	DEBUGCAT_CHANNEL        = 1 << 6,
51 	DEBUGCAT_CONFIG         = 1 << 7,
52 	DEBUGCAT_FEATURE        = 1 << 8,
53 	DEBUGCAT_FEATURE_BUTTON = 1 << 9,
54 	DEBUGCAT_SOFTKEY        = 1 << 10,
55 	DEBUGCAT_INDICATE       = 1 << 11,
56 	DEBUGCAT_PBX            = 1 << 12,
57 	DEBUGCAT_SOCKET         = 1 << 13,
58 	DEBUGCAT_MWI            = 1 << 14,
59 	DEBUGCAT_EVENT          = 1 << 15,
60 	DEBUGCAT_CONFERENCE     = 1 << 16,
61 	DEBUGCAT_BUTTONTEMPLATE = 1 << 17,
62 	DEBUGCAT_SPEEDDIAL      = 1 << 18,
63 	DEBUGCAT_CODEC          = 1 << 19,
64 	DEBUGCAT_REALTIME       = 1 << 20,
65 	DEBUGCAT_CALLINFO       = 1 << 21,
66 	DEBUGCAT_REFCOUNT       = 1 << 22,
67 	DEBUGCAT_MESSAGE        = 1 << 23,
68 	DEBUGCAT_PARKINGLOT     = 1 << 24,
69 	DEBUGCAT_WEBSERVICE     = 1 << 25,
70 	DEBUGCAT_THPOOL         = 1 << 26,
71 	DEBUGCAT_NEWCODE        = 1 << 27,
72 	DEBUGCAT_FILELINEFUNC   = 1 << 28,
73 	DEBUGCAT_HIGH           = 1 << 29,
74 	DEBUGCAT_ALL            = 0xffffffff,
75 	/* *INDENT-ON* */
76 } sccp_debug_category_t; /*!< SCCP Debug Category Enum (saved in global_vars:debug = uint32_t) */
77 
78 struct sccp_debug_category {
79 	const char * const    key;
80 	const char * const    text;
81 	sccp_debug_category_t category;
82 };
83 extern const struct sccp_debug_category sccp_debug_categories[32];
84 
85 SCCP_API int32_t SCCP_CALL sccp_parse_debugline(char * arguments[], int startat, int argc, int32_t new_debug_value);
86 SCCP_API char * SCCP_CALL  sccp_get_debugcategories(int32_t debugvalue);
87 __END_C_EXTERN__
88 // kate: indent-width 8; replace-tabs off; indent-mode cstyle; auto-insert-doxygen on; line-numbers on; tab-indents on; keep-extra-spaces off; auto-brackets off;
89