]>
git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSCore/mDNSDebug.h
2 * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
25 Change History (most recent first):
28 Revision 1.23 2004/05/18 23:51:25 cheshire
29 Tidy up all checkin comments to use consistent "<rdar://problem/xxxxxxx>" format for bug numbers
31 Revision 1.22 2004/04/22 04:27:42 cheshire
34 Revision 1.21 2004/04/14 23:21:41 ksekar
35 Removed accidental checkin of MALLOC_DEBUGING flag in 1.20
37 Revision 1.20 2004/04/14 23:09:28 ksekar
38 Support for TSIG signed dynamic updates.
40 Revision 1.19 2004/03/15 18:57:59 cheshire
41 Undo last checkin that accidentally made verbose debugging the default for all targets
43 Revision 1.18 2004/03/13 01:57:33 ksekar
44 <rdar://problem/3192546>: DynDNS: Dynamic update of service records
46 Revision 1.17 2004/01/28 21:14:23 cheshire
47 Reconcile debug_mode and gDebugLogging into a single flag (mDNS_DebugMode)
49 Revision 1.16 2003/12/09 01:30:06 rpantos
50 Fix usage of ARGS... macros to build properly on Windows.
52 Revision 1.15 2003/12/08 20:55:26 rpantos
53 Move some definitions here from mDNSMacOSX.h.
55 Revision 1.14 2003/08/12 19:56:24 cheshire
58 Revision 1.13 2003/07/02 21:19:46 cheshire
59 <rdar://problem/3313413> Update copyright notices, etc., in source code comments
61 Revision 1.12 2003/05/26 03:01:27 cheshire
62 <rdar://problem/3268904> sprintf/vsprintf-style functions are unsafe; use snprintf/vsnprintf instead
64 Revision 1.11 2003/05/21 17:48:10 cheshire
65 Add macro to enable GCC's printf format string checking
67 Revision 1.10 2003/04/26 02:32:57 cheshire
68 Add extern void LogMsg(const char *format, ...);
70 Revision 1.9 2002/09/21 20:44:49 zarzycki
73 Revision 1.8 2002/09/19 04:20:43 cheshire
74 Remove high-ascii characters that confuse some systems
76 Revision 1.7 2002/09/16 18:41:42 cheshire
77 Merge in license terms from Quinn's copy, in preparation for Darwin release
84 // Set MDNS_DEBUGMSGS to 0 to optimize debugf() calls out of the compiled code
85 // Set MDNS_DEBUGMSGS to 1 to generate normal debugging messages
86 // Set MDNS_DEBUGMSGS to 2 to generate verbose debugging messages
87 // MDNS_DEBUGMSGS is normally set in the project options (or makefile) but can also be set here if desired
88 // (If you edit the file here to turn on MDNS_DEBUGMSGS while you're debugging some code, be careful
89 // not to accidentally check-in that change by mistake when you check in your other changes.)
91 //#define MDNS_DEBUGMSGS 2
93 // Set MDNS_CHECK_PRINTF_STYLE_FUNCTIONS to 1 to enable extra GCC compiler warnings
94 // Note: You don't normally want to do this, because it generates a bunch of
95 // spurious warnings for the following custom extensions implemented by mDNS_vsnprintf:
96 // warning: `#' flag used with `%s' printf format (for %#s -- pascal string format)
97 // warning: repeated `#' flag in format (for %##s -- DNS name string format)
98 // warning: double format, pointer arg (arg 2) (for %.4a, %.16a, %#a -- IP address formats)
99 #define MDNS_CHECK_PRINTF_STYLE_FUNCTIONS 0
100 #if MDNS_CHECK_PRINTF_STYLE_FUNCTIONS
101 #define IS_A_PRINTF_STYLE_FUNCTION(F,A) __attribute__ ((format(printf,F,A)))
103 #define IS_A_PRINTF_STYLE_FUNCTION(F,A)
111 #define debugf debugf_
112 extern void debugf_(const char *format
, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
113 #else // If debug breaks are off, use a preprocessor trick to optimize those calls out of the code
114 #if (defined(__GNUC__))
115 #define debugf( ARGS... ) ((void)0)
116 #elif (defined(__MWERKS__))
117 #define debugf( ... )
119 #define debugf 1 ? ((void)0) : (void)
123 #if MDNS_DEBUGMSGS > 1
124 #define verbosedebugf verbosedebugf_
125 extern void verbosedebugf_(const char *format
, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
127 #if (defined(__GNUC__))
128 #define verbosedebugf( ARGS... ) ((void)0)
129 #elif (defined(__MWERKS__))
130 #define verbosedebugf( ... )
132 #define verbosedebugf 1 ? ((void)0) : (void)
136 // LogMsg is used even in shipping code, to write truly serious error messages to syslog (or equivalent)
137 extern int mDNS_DebugMode
; // If non-zero, LogMsg() writes to stderr instead of syslog
138 extern void LogMsg(const char *format
, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
139 extern void LogMsgIdent(const char *ident
, const char *format
, ...);
140 extern void LogMsgNoIdent(const char *format
, ...);
142 // Set this symbol to 1 to do extra debug checks on malloc() and free()
143 // Set this symbol to 2 to write a log message for every malloc() and free()
144 #define MACOSX_MDNS_MALLOC_DEBUGGING 0
146 #if MACOSX_MDNS_MALLOC_DEBUGGING >= 1
147 extern void *mallocL(char *msg
, unsigned int size
);
148 extern void freeL(char *msg
, void *x
);
150 #define mallocL(X,Y) malloc(Y)
151 #define freeL(X,Y) free(Y)
154 #if MACOSX_MDNS_MALLOC_DEBUGGING >= 2
155 #define LogMalloc LogMsg
157 #if (defined( __GNUC__ ))
158 #define LogMalloc(ARGS...) ((void)0)
159 #elif (defined( __MWERKS__ ))
160 #define LogMalloc( ... )
162 #define LogMalloc 1 ? ((void)0) : (void)
166 #define LogAllOperations 0
169 #define LogOperation LogMsg
171 #define LogOperation debugf