Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
7.5 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. routign\ip\rtrmgr\logtrdefs.c
  5. Abstract:
  6. IP Router Manager defines for tracing and logging
  7. Revision History:
  8. Gurdeep Singh Pall 6/16/95 Created
  9. --*/
  10. #ifndef __LOGTRDEF_H__
  11. #define __LOGTRDEF_H__
  12. //
  13. // constants and macros used for tracing
  14. //
  15. #define IPRTRMGR_TRACE_ANY ((DWORD)0xFFFF0000 | TRACE_USE_MASK)
  16. #define IPRTRMGR_TRACE_ERR ((DWORD)0x00010000 | TRACE_USE_MASK)
  17. #define IPRTRMGR_TRACE_ENTER ((DWORD)0x00020000 | TRACE_USE_MASK)
  18. #define IPRTRMGR_TRACE_IF ((DWORD)0x00040000 | TRACE_USE_MASK)
  19. #define IPRTRMGR_TRACE_ROUTE ((DWORD)0x00080000 | TRACE_USE_MASK)
  20. #define IPRTRMGR_TRACE_MIB ((DWORD)0x00100000 | TRACE_USE_MASK)
  21. #define IPRTRMGR_TRACE_GLOBAL ((DWORD)0x00200000 | TRACE_USE_MASK)
  22. #define IPRTRMGR_TRACE_DEMAND ((DWORD)0x00400000 | TRACE_USE_MASK)
  23. #define IPRTRMGR_TRACE_RTRDISC ((DWORD)0x00800000 | TRACE_USE_MASK)
  24. #define IPRTRMGR_TRACE_LOCK ((DWORD)0x01000000 | TRACE_USE_MASK)
  25. #define IPRTRMGR_TRACE_MCAST ((DWORD)0x02000000 | TRACE_USE_MASK)
  26. #define IPRTRMGR_TRACE_MZAP ((DWORD)0x04000000 | TRACE_USE_MASK)
  27. #define IPRTRMGR_TRACE_INIT ((DWORD)0x08000000 | TRACE_USE_MASK)
  28. #define TRACEID TraceHandle
  29. #define Trace0(l,a) \
  30. TracePrintfEx(TRACEID, IPRTRMGR_TRACE_ ## l, a)
  31. #define Trace1(l,a,b) \
  32. TracePrintfEx(TRACEID, IPRTRMGR_TRACE_ ## l, a, b)
  33. #define Trace2(l,a,b,c) \
  34. TracePrintfEx(TRACEID, IPRTRMGR_TRACE_ ## l, a, b, c)
  35. #define Trace3(l,a,b,c,d) \
  36. TracePrintfEx(TRACEID, IPRTRMGR_TRACE_ ## l, a, b, c, d)
  37. #define Trace4(l,a,b,c,d,e) \
  38. TracePrintfEx(TRACEID, IPRTRMGR_TRACE_ ## l, a, b, c, d, e)
  39. #define Trace5(l,a,b,c,d,e,f) \
  40. TracePrintfEx(TRACEID, IPRTRMGR_TRACE_ ## l, a, b, c, d, e, f)
  41. #define Trace6(l,a,b,c,d,e,f,g) \
  42. TracePrintfEx(TRACEID, IPRTRMGR_TRACE_ ## l, a, b, c, d, e, f, g)
  43. #define Trace7(l,a,b,c,d,e,f,g,h) \
  44. TracePrintfEx(TRACEID, IPRTRMGR_TRACE_ ## l, a, b, c, d, e, f, g, h)
  45. #if TRACE_DBG
  46. #define TraceEnter(X) TracePrintfEx(TRACEID, IPRTRMGR_TRACE_ENTER, "Entered: "X)
  47. #define TraceLeave(X) TracePrintfEx(TRACEID, IPRTRMGR_TRACE_ENTER, "Leaving: "X"\n")
  48. #define TraceRoute0 Trace0
  49. #define TraceRoute1 Trace1
  50. #define TraceRoute2 Trace2
  51. #define TraceRoute3 Trace3
  52. #define TraceRoute4 Trace4
  53. #define TraceRoute5 Trace5
  54. #else // TRACE_DBG
  55. #define TraceEnter(X)
  56. #define TraceLeave(X)
  57. #define TraceRoute0(l,a)
  58. #define TraceRoute1(l,a,b)
  59. #define TraceRoute2(l,a,b,c)
  60. #define TraceRoute3(l,a,b,c,d)
  61. #define TraceRoute4(l,a,b,c,d,e)
  62. #define TraceRoute5(l,a,b,c,d,e,f)
  63. #endif // TRACE_DBG
  64. //
  65. // Event logging macros
  66. //
  67. #define LOGLEVEL g_dwLoggingLevel
  68. #define LOGHANDLE g_hLogHandle
  69. #define LOGERR RouterLogError
  70. #define LOGERRW RouterLogErrorW
  71. #define LOGERRDATA RouterLogErrorData
  72. #define LOGWARN RouterLogWarning
  73. #define LOGWARNDATA RouterLogWarningData
  74. #define LOGINFO RouterLogInformation
  75. #define LOGINFODATA RouterLogInformationData
  76. //
  77. // Error logging
  78. //
  79. //
  80. // VOID
  81. // Log{Err|Warn|Info}{NumArgs}(
  82. // DWORD dwLogMsgId,
  83. // PSTR pszInsertString1,
  84. // ....
  85. // PSTR pszInsertString{NumArgs},
  86. // DWORD dwErrorCode
  87. // );
  88. //
  89. // VOID
  90. // Log{Err|Warn|Info}Data{NumArgs}(
  91. // DWORD dwLogMsgId,
  92. // PSTR pszInsertString1,
  93. // ....
  94. // PSTR pszInsertString{NumArgs},
  95. // DWORD dwDataSize,
  96. // PBYTE pbData
  97. // );
  98. //
  99. #define LogErr0(msg,err) \
  100. if (LOGLEVEL >= IPRTR_LOGGING_ERROR) \
  101. LOGERR(LOGHANDLE,ROUTERLOG_IP_ ## msg,0,NULL,(err))
  102. #define LogErr1(msg,a,err) \
  103. if (LOGLEVEL >= IPRTR_LOGGING_ERROR) \
  104. LOGERR(LOGHANDLE,ROUTERLOG_IP_ ## msg,1,&(a),(err))
  105. #define LogErr2(msg,a,b,err) \
  106. if (LOGLEVEL >= IPRTR_LOGGING_ERROR) { \
  107. LPTSTR _asz[2] = { (a), (b) }; \
  108. LOGERR(LOGHANDLE,ROUTERLOG_IP_ ## msg,2,_asz,(err)); \
  109. }
  110. #define LogErr3(msg,a,b,c,err) \
  111. if (LOGLEVEL >= IPRTR_LOGGING_ERROR) { \
  112. LPTSTR _asz[3] = { (a), (b), (c) }; \
  113. LOGERR(LOGHANDLE,ROUTERLOG_IP_ ## msg,3,_asz,(err)); \
  114. }
  115. #define LogErr4(msg,a,b,c,d,err) \
  116. if (LOGLEVEL >= IPRTR_LOGGING_ERROR) { \
  117. LPSTR _asz[4] = { (a), (b), (c), (d) }; \
  118. LOGERR(LOGHANDLE,ROUTERLOG_IP_ ## msg,4,_asz,(err)); \
  119. }
  120. #define LogErr5(msg,a,b,c,d,e,err) \
  121. if (LOGLEVEL >= IPRTR_LOGGING_ERROR) { \
  122. LPSTR _asz[5] = { (a), (b), (c), (d), (e) }; \
  123. LOGERR(LOGHANDLE,ROUTERLOG_IP_ ## msg,5,_asz,(err)); \
  124. }
  125. #define LogErrW3(msg,a,b,c,err) \
  126. if (LOGLEVEL >= IPRTR_LOGGING_ERROR) { \
  127. LPTSTR _asz[3] = { (a), (b), (c) }; \
  128. LOGERRW(LOGHANDLE,ROUTERLOG_IP_ ## msg,3,_asz,(err)); \
  129. }
  130. // Warning logging
  131. #define LogWarn0(msg,err) \
  132. if (LOGLEVEL >= IPRTR_LOGGING_WARN) \
  133. LOGWARN(LOGHANDLE,ROUTERLOG_IP_ ## msg,0,NULL,(err))
  134. #define LogWarn1(msg,a,err) \
  135. if (LOGLEVEL >= IPRTR_LOGGING_WARN) \
  136. LOGWARN(LOGHANDLE,ROUTERLOG_IP_ ## msg,1,&(a),(err))
  137. #define LogWarn2(msg,a,b,err) \
  138. if (LOGLEVEL >= IPRTR_LOGGING_WARN) { \
  139. LPTSTR _asz[2] = { (a), (b) }; \
  140. LOGWARN(LOGHANDLE,ROUTERLOG_IP_ ## msg,2,_asz,(err)); \
  141. }
  142. #define LogWarn3(msg,a,b,c,err) \
  143. if (LOGLEVEL >= IPRTR_LOGGING_WARN) { \
  144. LPTSTR _asz[3] = { (a), (b), (c) }; \
  145. LOGWARN(LOGHANDLE,ROUTERLOG_IP_ ## msg,3,_asz,(err)); \
  146. }
  147. #define LogWarn4(msg,a,b,c,d,err) \
  148. if (LOGLEVEL >= IPRTR_LOGGING_WARN) { \
  149. LPTSTR _asz[4] = { (a), (b), (c), (d) }; \
  150. LOGWARN(LOGHANDLE,ROUTERLOG_IP_ ## msg,4,_asz,(err)); \
  151. }
  152. #define LogWarnData2(msg,a,b,dw,buf) \
  153. if (LOGLEVEL >= IPRTR_LOGGING_WARN) { \
  154. LPTSTR _asz[2] = { (a), (b) }; \
  155. LOGWARNDATA(LOGHANDLE,ROUTERLOG_IP_ ## msg,2,_asz,(dw),(buf)); \
  156. }
  157. #define LogWarnData5(msg,a,b,c,d,e,dw,buf) \
  158. if (LOGLEVEL >= IPRTR_LOGGING_WARN) { \
  159. LPTSTR _asz[5] = { (a), (b), (c), (d), (e)}; \
  160. LOGWARNDATA(LOGHANDLE,ROUTERLOG_IP_ ## msg,5,_asz,(dw),(buf)); \
  161. }
  162. // Information logging
  163. #define LogInfo0(msg,err) \
  164. if (LOGLEVEL >= IPRTR_LOGGING_INFO) \
  165. LOGINFO(LOGHANDLE,ROUTERLOG_IP_ ## msg,0,NULL,(err))
  166. #define LogInfo1(msg,a,err) \
  167. if (LOGLEVEL >= IPRTR_LOGGING_INFO) \
  168. LOGINFO(LOGHANDLE,ROUTERLOG_IP_ ## msg,1,&(a),(err))
  169. #define LogInfo2(msg,a,b,err) \
  170. if (LOGLEVEL >= IPRTR_LOGGING_INFO) { \
  171. LPTSTR _asz[2] = { (a), (b) }; \
  172. LOGINFO(LOGHANDLE,ROUTERLOG_IP_ ## msg,2,_asz,(err)); \
  173. }
  174. #define LogInfo3(msg,a,b,c,err) \
  175. if (LOGLEVEL >= IPRTR_LOGGING_INFO) { \
  176. LPTSTR _asz[3] = { (a), (b), (c) }; \
  177. LOGINFO(LOGHANDLE,ROUTERLOG_IP_ ## msg,3,_asz,(err)); \
  178. }
  179. #define LogInfo4(msg,a,b,c,d,err) \
  180. if (LOGLEVEL >= IPRTR_LOGGING_INFO) { \
  181. LPTSTR _asz[4] = { (a), (b), (c), (d) }; \
  182. LOGINFO(LOGHANDLE,ROUTERLOG_IP_ ## msg,4,_asz,(err)); \
  183. }
  184. #endif // __LOGTRDEF_H__