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.

245 lines
6.9 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. spxerror.h
  5. Abstract:
  6. This module contains some error definitions for spx.
  7. Author:
  8. Nikhil Kamkolkar (nikhilk@microsoft.com)
  9. Revision History:
  10. Notes: Tab stop: 4
  11. --*/
  12. // Define the modules names for SPX - use the high bits.
  13. #define SPXDRVR 0x00010000
  14. #define SPXREG 0x00020000
  15. #define SPXDEV 0x00030000
  16. #define SPXBIND 0x00040000
  17. #define SPXRECV 0x00050000
  18. #define SPXSEND 0x00060000
  19. #define SPXTIMER 0x00070000
  20. #define SPXERROR 0x00080000
  21. #define SPXPKT 0x00090000
  22. #define SPXUTILS 0x000a0000
  23. #define SPXCPKT 0x000b0000
  24. #define SPXCONN 0x000c0000
  25. #define SPXADDR 0x000d0000
  26. #define SPXCUTIL 0x000e0000
  27. #define SPXINIT 0x000f0000
  28. #define SPXMEM 0x00100000
  29. #define SPXQUERY 0x00200000
  30. // DEBUGGING SUPPORT:
  31. // Debugging messages are provided per-subsystem defined here, and within
  32. // the subsystems, there are 4 levels of messages.
  33. //
  34. // The four levels of debug messages are:
  35. //
  36. // INFO: Informational messages, eg., entry exit in routines
  37. // DBG: Used when debugging some msgs are turned from info to dbg
  38. // WARN: Something went wrong, but its not an error, eg., packet was not ours
  39. // ERR: Error situations, but we can still run if a retry happens
  40. // FATAL: In this situation, the driver is not operational
  41. #define DBG_LEVEL_INFO 0x4000
  42. #define DBG_LEVEL_DBG 0x5000
  43. #define DBG_LEVEL_DBG1 0x5001
  44. #define DBG_LEVEL_DBG2 0x5002
  45. #define DBG_LEVEL_DBG3 0x5003
  46. #define DBG_LEVEL_WARN 0x6000
  47. #define DBG_LEVEL_ERR 0x7000
  48. #define DBG_LEVEL_FATAL 0x8000
  49. // SUBSYSTEMS
  50. #define DBG_COMP_DEVICE 0x00000001
  51. #define DBG_COMP_CREATE 0x00000002
  52. #define DBG_COMP_ADDRESS 0x00000004
  53. #define DBG_COMP_SEND 0x00000008
  54. #define DBG_COMP_NDIS 0x00000010
  55. #define DBG_COMP_RECEIVE 0x00000020
  56. #define DBG_COMP_CONFIG 0x00000040
  57. #define DBG_COMP_PACKET 0x00000080
  58. #define DBG_COMP_RESOURCES 0x00000100
  59. #define DBG_COMP_BIND 0x00000200
  60. #define DBG_COMP_UNLOAD 0x00000400
  61. #define DBG_COMP_DUMP 0x00000800
  62. #define DBG_COMP_REFCOUNTS 0x00001000
  63. #define DBG_COMP_SYSTEM 0x00002000
  64. #define DBG_COMP_CRITSEC 0x00004000
  65. #define DBG_COMP_UTILS 0x00008000
  66. #define DBG_COMP_TDI 0x00010000
  67. #define DBG_COMP_CONNECT 0x00020000
  68. #define DBG_COMP_DISC 0x00040000
  69. #define DBG_COMP_ACTION 0x00080000
  70. #define DBG_COMP_STATE 0x00100000
  71. #define DBG_COMP_MOST (DBG_COMP_DEVICE | \
  72. DBG_COMP_CREATE | \
  73. DBG_COMP_ADDRESS | \
  74. DBG_COMP_SEND | \
  75. DBG_COMP_NDIS | \
  76. DBG_COMP_RECEIVE | \
  77. DBG_COMP_CONFIG | \
  78. DBG_COMP_PACKET | \
  79. DBG_COMP_RESOURCES | \
  80. DBG_COMP_BIND | \
  81. DBG_COMP_UNLOAD | \
  82. DBG_COMP_DUMP | \
  83. DBG_COMP_REFCOUNTS | \
  84. DBG_COMP_SYSTEM | \
  85. DBG_COMP_CRITSEC | \
  86. DBG_COMP_UTILS | \
  87. DBG_COMP_TDI | \
  88. DBG_COMP_CONNECT | \
  89. DBG_COMP_DISC | \
  90. DBG_COMP_ACTION | \
  91. DBG_COMP_STATE)
  92. // More debugging support. These values define the dumping components.
  93. // There are a max of 32 such components that can be defined. Each of
  94. // these are associated with a dump routine. It one is specified and
  95. // enabled, periodically it is called. It is upto that component to
  96. // decide what it wants to do
  97. #define DBG_DUMP_DEF_INTERVAL 30 // In Seconds
  98. // This defines the number of times an error has to happen consecutively before
  99. // it gets logged again.
  100. #define ERROR_CONSEQ_FREQ 200
  101. #define ERROR_CONSEQ_TIME (60*30) // 30 minutes
  102. #ifdef DBG
  103. typedef VOID (*DUMP_ROUTINE)(VOID);
  104. extern
  105. BOOLEAN
  106. SpxDumpComponents(
  107. IN PVOID Context);
  108. #endif
  109. //
  110. // PROTOTYPES
  111. //
  112. BOOLEAN
  113. SpxFilterErrorLogEntry(
  114. IN NTSTATUS UniqueErrorCode,
  115. IN NTSTATUS NtStatusCode,
  116. IN PVOID RawDataBuf OPTIONAL,
  117. IN LONG RawDataLen);
  118. VOID
  119. SpxWriteResourceErrorLog(
  120. IN PDEVICE Device,
  121. IN ULONG BytesNeeded,
  122. IN ULONG UniqueErrorValue);
  123. VOID
  124. SpxWriteGeneralErrorLog(
  125. IN PDEVICE Device,
  126. IN NTSTATUS ErrorCode,
  127. IN ULONG UniqueErrorValue,
  128. IN NTSTATUS FinalStatus,
  129. IN PWSTR SecondString,
  130. IN PVOID RawDataBuf OPTIONAL,
  131. IN LONG RawDataLen);
  132. //
  133. // MACROS
  134. //
  135. #if DBG
  136. #define LOG_ERROR(Error, NtStatus, SecondString, RawData, RawDataLen) \
  137. { \
  138. SpxWriteGeneralErrorLog( \
  139. SpxDevice, \
  140. Error, \
  141. FILENUM | __LINE__, \
  142. NtStatus, \
  143. SecondString, \
  144. RawData, \
  145. RawDataLen); \
  146. }
  147. #define RES_LOG_ERROR(BytesNeeded) \
  148. { \
  149. SpxWriteResourceErrorLog( \
  150. SpxDevice, \
  151. BytesNeeded, \
  152. FILENUM | __LINE__); \
  153. }
  154. #else
  155. #define LOG_ERROR(Error, NtStatus, SecondString, RawData, RawDataLen) \
  156. { \
  157. SpxWriteGeneralErrorLog( \
  158. SpxDevice, \
  159. Error, \
  160. FILENUM | __LINE__, \
  161. NtStatus, \
  162. SecondString, \
  163. RawData, \
  164. RawDataLen); \
  165. }
  166. #define RES_LOG_ERROR(BytesNeeded) \
  167. { \
  168. SpxWriteResourceErrorLog( \
  169. SpxDevice, \
  170. BytesNeeded, \
  171. FILENUM | __LINE__); \
  172. }
  173. #endif
  174. #if DBG
  175. #define DBGPRINT(Component, Level, Fmt) \
  176. { \
  177. if (((DBG_LEVEL_ ## Level) >= SpxDebugLevel) && \
  178. (SpxDebugSystems & (DBG_COMP_ ## Component))) \
  179. { \
  180. DbgPrint("SPX: "); \
  181. DbgPrint Fmt; \
  182. } \
  183. }
  184. #define DBGBRK(Level) \
  185. { \
  186. if ((DBG_LEVEL_ ## Level) >= SpxDebugLevel) \
  187. DbgBreakPoint(); \
  188. }
  189. #define TMPLOGERR() \
  190. { \
  191. DBGPRINT(MOST, ERR, \
  192. ("TempErrLog: %s, Line %ld\n", __FILE__, __LINE__)); \
  193. }
  194. #else
  195. #define DBGPRINT(Component, Level, Fmt)
  196. #define DBGBRK(Level)
  197. #define TMPLOGERR()
  198. #endif
  199. extern
  200. VOID
  201. SpxWriteErrorLogEntry(
  202. IN NTSTATUS UniqueErrorCode,
  203. IN ULONG UniqueErrorValue,
  204. IN NTSTATUS NtStatusCode,
  205. IN PVOID RawDataBuf OPTIONAL,
  206. IN LONG RawDataLen);
  207.