]> git.saurik.com Git - apple/mdnsresponder.git/blobdiff - mDNSCore/mDNSDebug.h
mDNSResponder-379.27.tar.gz
[apple/mdnsresponder.git] / mDNSCore / mDNSDebug.h
index 07647b52d452d3030ed303bd3c757f5298e82fa7..7b6c2c673f530c65a8b666c9f9aadee2b9791422 100755 (executable)
@@ -5,9 +5,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #define MDNS_CHECK_PRINTF_STYLE_FUNCTIONS 0
 
 typedef enum
-       {
-       MDNS_LOG_MSG,
-       MDNS_LOG_OPERATION,
-       MDNS_LOG_SPS,
-       MDNS_LOG_INFO,
-       MDNS_LOG_DEBUG,
-       } mDNSLogLevel_t;
+{
+    MDNS_LOG_MSG,
+    MDNS_LOG_OPERATION,
+    MDNS_LOG_SPS,
+    MDNS_LOG_INFO,
+    MDNS_LOG_DEBUG,
+} mDNSLogLevel_t;
 
 // Set this symbol to 1 to answer remote queries for our Address, reverse mapping PTR, and HINFO records
 #define ANSWER_REMOTE_HOSTNAME_QUERIES 0
@@ -64,62 +64,62 @@ typedef enum
 #endif
 
 #ifdef __cplusplus
-       extern "C" {
+extern "C" {
 #endif
 
 // Variable argument macro support. Use ANSI C99 __VA_ARGS__ where possible. Otherwise, use the next best thing.
 
 #if (defined(__GNUC__))
-       #if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
-               #define MDNS_C99_VA_ARGS        1
-               #define MDNS_GNU_VA_ARGS        0
-       #else
-               #define MDNS_C99_VA_ARGS        0
-               #define MDNS_GNU_VA_ARGS        1
-       #endif
-       #define MDNS_HAS_VA_ARG_MACROS      1
+    #if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
+        #define MDNS_C99_VA_ARGS        1
+        #define MDNS_GNU_VA_ARGS        0
+    #else
+        #define MDNS_C99_VA_ARGS        0
+        #define MDNS_GNU_VA_ARGS        1
+    #endif
+    #define MDNS_HAS_VA_ARG_MACROS      1
 #elif (_MSC_VER >= 1400) // Visual Studio 2005 and later
-       #define MDNS_C99_VA_ARGS            1
-       #define MDNS_GNU_VA_ARGS            0
-       #define MDNS_HAS_VA_ARG_MACROS      1
+    #define MDNS_C99_VA_ARGS            1
+    #define MDNS_GNU_VA_ARGS            0
+    #define MDNS_HAS_VA_ARG_MACROS      1
 #elif (defined(__MWERKS__))
-       #define MDNS_C99_VA_ARGS            1
-       #define MDNS_GNU_VA_ARGS            0
-       #define MDNS_HAS_VA_ARG_MACROS      1
+    #define MDNS_C99_VA_ARGS            1
+    #define MDNS_GNU_VA_ARGS            0
+    #define MDNS_HAS_VA_ARG_MACROS      1
 #else
-       #define MDNS_C99_VA_ARGS            0
-       #define MDNS_GNU_VA_ARGS            0
-       #define MDNS_HAS_VA_ARG_MACROS      0
+    #define MDNS_C99_VA_ARGS            0
+    #define MDNS_GNU_VA_ARGS            0
+    #define MDNS_HAS_VA_ARG_MACROS      0
 #endif
 
 #if (MDNS_HAS_VA_ARG_MACROS)
-       #if (MDNS_C99_VA_ARGS)
-               #define debug_noop( ... ) ((void)0)
-               #define LogMsg( ... )           LogMsgWithLevel(MDNS_LOG_MSG, __VA_ARGS__)
-               #define LogOperation( ... )     do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_OPERATION, __VA_ARGS__); } while (0)
-               #define LogSPS( ... )           do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_SPS,       __VA_ARGS__); } while (0)
-               #define LogInfo( ... )          do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_INFO,      __VA_ARGS__); } while (0)
-       #elif (MDNS_GNU_VA_ARGS)
-               #define debug_noop( ARGS... ) ((void)0)
-               #define LogMsg( ARGS... )       LogMsgWithLevel(MDNS_LOG_MSG, ARGS)
-               #define LogOperation( ARGS... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_OPERATION, ARGS); } while (0)
-               #define LogSPS( ARGS... )       do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_SPS,       ARGS); } while (0)
-               #define LogInfo( ARGS... )      do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_INFO,      ARGS); } while (0)
-       #else
-               #error Unknown variadic macros
-       #endif
+    #if (MDNS_C99_VA_ARGS)
+        #define debug_noop(... ) ((void)0)
+        #define LogMsg(... )           LogMsgWithLevel(MDNS_LOG_MSG, __VA_ARGS__)
+        #define LogOperation(... )     do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_OPERATION, __VA_ARGS__);} while (0)
+        #define LogSPS(... )           do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_SPS,       __VA_ARGS__);} while (0)
+        #define LogInfo(... )          do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_INFO,      __VA_ARGS__);} while (0)
+    #elif (MDNS_GNU_VA_ARGS)
+        #define debug_noop( ARGS... ) ((void)0)
+        #define LogMsg( ARGS... )       LogMsgWithLevel(MDNS_LOG_MSG, ARGS)
+        #define LogOperation( ARGS... ) do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_OPERATION, ARGS);} while (0)
+        #define LogSPS( ARGS... )       do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_SPS,       ARGS);} while (0)
+        #define LogInfo( ARGS... )      do { if (mDNS_LoggingEnabled) LogMsgWithLevel(MDNS_LOG_INFO,      ARGS);} while (0)
+    #else
+        #error Unknown variadic macros
+    #endif
 #else
-       // If your platform does not support variadic macros, you need to define the following variadic functions.
-       // See mDNSShared/mDNSDebug.c for sample implementation
-       #define debug_noop 1 ? (void)0 : (void)
-       #define LogMsg LogMsg_
-       #define LogOperation (mDNS_LoggingEnabled == 0) ? ((void)0) : LogOperation_
-       #define LogSPS       (mDNS_LoggingEnabled == 0) ? ((void)0) : LogSPS_
-       #define LogInfo      (mDNS_LoggingEnabled == 0) ? ((void)0) : LogInfo_
-       extern void LogMsg_(const char *format, ...)       IS_A_PRINTF_STYLE_FUNCTION(1,2);
-       extern void LogOperation_(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
-       extern void LogSPS_(const char *format, ...)       IS_A_PRINTF_STYLE_FUNCTION(1,2);
-       extern void LogInfo_(const char *format, ...)      IS_A_PRINTF_STYLE_FUNCTION(1,2);
+// If your platform does not support variadic macros, you need to define the following variadic functions.
+// See mDNSShared/mDNSDebug.c for sample implementation
+    #define debug_noop 1 ? (void)0 : (void)
+    #define LogMsg LogMsg_
+    #define LogOperation (mDNS_LoggingEnabled == 0) ? ((void)0) : LogOperation_
+    #define LogSPS       (mDNS_LoggingEnabled == 0) ? ((void)0) : LogSPS_
+    #define LogInfo      (mDNS_LoggingEnabled == 0) ? ((void)0) : LogInfo_
+extern void LogMsg_(const char *format, ...)       IS_A_PRINTF_STYLE_FUNCTION(1,2);
+extern void LogOperation_(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1,2);
+extern void LogSPS_(const char *format, ...)       IS_A_PRINTF_STYLE_FUNCTION(1,2);
+extern void LogInfo_(const char *format, ...)      IS_A_PRINTF_STYLE_FUNCTION(1,2);
 #endif
 
 #if MDNS_DEBUGMSGS
@@ -136,9 +136,9 @@ extern void verbosedebugf_(const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(1
 #define verbosedebugf debug_noop
 #endif
 
-extern int           mDNS_LoggingEnabled;
-extern int           mDNS_PacketLoggingEnabled;
-extern int        mDNS_DebugMode;      // If non-zero, LogMsg() writes to stderr instead of syslog
+extern int mDNS_LoggingEnabled;
+extern int mDNS_PacketLoggingEnabled;
+extern int mDNS_DebugMode;          // If non-zero, LogMsg() writes to stderr instead of syslog
 extern const char ProgramName[];
 
 extern void LogMsgWithLevel(mDNSLogLevel_t logLevel, const char *format, ...) IS_A_PRINTF_STYLE_FUNCTION(2,3);
@@ -158,7 +158,7 @@ extern void udns_validatelists(void *const v);
 #endif
 
 #ifdef __cplusplus
-       }
+}
 #endif
 
 #endif