Source code of Windows XP (NT5)
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.

465 lines
13 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. atkerror.h
  5. Abstract:
  6. This module contains some error definitions for appletalk.
  7. Author:
  8. Jameel Hyder (jameelh@microsoft.com)
  9. Nikhil Kamkolkar (nikhilk@microsoft.com)
  10. Revision History:
  11. 19 Jun 1992 Initial Version
  12. Notes: Tab stop: 4
  13. --*/
  14. #ifndef _ATKERROR_
  15. #define _ATKERROR_
  16. // Define the modules names for Appletalk - use the high bits.
  17. #define ATKINIT 0x00010000
  18. #define ATKDRVR 0x00020000
  19. #define ATKNDIS 0x00030000
  20. #define ATKTDI 0x00040000
  21. #define ATKACT 0x00050000
  22. #define ATKUTILS 0x00060000
  23. #define ATKTIMER 0x00070000
  24. #define ATKMEM 0x00080000
  25. #define ATKERROR 0x00090000
  26. #define ROUTER 0x000A0000
  27. #define SOCKET 0x000B0000
  28. #define PORTS 0x000C0000
  29. #define NODE 0x000D0000
  30. #define AARP 0x000E0000
  31. #define AEP 0x000F0000
  32. #define DDP 0x00100000
  33. #define RTMP 0x00200000
  34. #define NBP 0x00300000
  35. #define ZIP 0x00400000
  36. #define ATP 0x00500000
  37. #define ASP 0x00600000
  38. #define PAP 0x00700000
  39. #define ADSP 0x00800000
  40. #define ATKIND 0x00900000
  41. #define ASPC 0x00A00000
  42. #define DATAX 0x00B00000
  43. #define RAS 0x00C00000
  44. #define ARAP 0x00D00000
  45. #define ARAPNDIS 0x00E00000
  46. #define ARAPUTIL 0x00F00000
  47. #define ARAPATK 0x01000000
  48. #define ARAPDBG 0x02000000
  49. #define ATKPNP 0x03000000
  50. #define PPP 0x04000000
  51. // DEBUGGING SUPPORT:
  52. // Debugging messages are provided per-subsystem defined here, and within
  53. // the subsystems, there are 4 levels of messages.
  54. //
  55. // The four levels of debug messages are:
  56. //
  57. // INFO: Informational messages, eg., entry exit in routines
  58. // WARN: Something went wrong, but its not an error, eg., packet was not ours
  59. // ERR: Error situations, but we can still run if a retry happens
  60. // FATAL: In this situation, the driver is not operational
  61. // These give the ref/deref dbgprints if DBG is defined. LOTS of output.
  62. // Defined as a hierarchy of the stack objects.
  63. #define DBG_LEVEL_REFDDP 0x2000
  64. #define DBG_LEVEL_REFNODE 0x3000
  65. #define DBG_LEVEL_REFPORT 0x4000
  66. #define DBG_LEVEL_REFATP 0x4100
  67. #define DBG_LEVEL_REFPAPADDR 0x4200
  68. #define DBG_LEVEL_REFPAPCONN 0x4300
  69. #define DBG_LEVEL_REFASPADDR 0x4400
  70. #define DBG_LEVEL_REFASPCONN 0x4500
  71. #define DBG_LEVEL_INFO 0x5000
  72. #define DBG_LEVEL_WARN 0x6000
  73. #define DBG_LEVEL_ERR 0x7000
  74. #define DBG_LEVEL_FATAL 0x8000
  75. // SUBSYSTEMS
  76. #define DBG_COMP_INIT 0x00000001
  77. #define DBG_COMP_DISPATCH 0x00000002
  78. #define DBG_COMP_CREATE 0x00000004
  79. #define DBG_COMP_CLOSE 0x00000008
  80. #define DBG_COMP_ACTION 0x00000010
  81. #define DBG_COMP_ADDROBJ 0x00000020
  82. #define DBG_COMP_CONNOBJ 0x00000040
  83. #define DBG_COMP_CHANOBJ 0x00000080
  84. #define DBG_COMP_RESOURCES 0x00000100
  85. #define DBG_COMP_UNLOAD 0x00000200
  86. #define DBG_COMP_NODE 0x00000400
  87. #define DBG_COMP_AARP 0x00000800
  88. #define DBG_COMP_AEP 0x00001000
  89. #define DBG_COMP_DDP 0x00002000
  90. #define DBG_COMP_ATP 0x00004000
  91. #define DBG_COMP_ADSP 0x00008000
  92. #define DBG_COMP_ZIP 0x00010000
  93. #define DBG_COMP_NBP 0x00020000
  94. #define DBG_COMP_PAP 0x00040000
  95. #define DBG_COMP_ASP 0x00080000
  96. #define DBG_COMP_RTMP 0x00100000
  97. #define DBG_COMP_ROUTER 0x00200000
  98. #define DBG_COMP_DUMP 0x00400000
  99. #define DBG_COMP_REFCOUNTS 0x00800000
  100. #define DBG_COMP_SYSTEM 0x01000000
  101. #define DBG_COMP_CRITSEC 0x02000000
  102. #define DBG_COMP_UTILS 0x04000000
  103. #define DBG_COMP_NDISSEND 0x08000000
  104. #define DBG_COMP_NDISRECV 0x10000000
  105. #define DBG_COMP_NDISREQ 0x20000000
  106. #define DBG_COMP_TDI 0x40000000
  107. #define DBG_COMP_RAS 0x80000000
  108. #define DBG_MOST (DBG_COMP_INIT | \
  109. DBG_COMP_DISPATCH | \
  110. DBG_COMP_CREATE | \
  111. DBG_COMP_CLOSE | \
  112. DBG_COMP_ACTION | \
  113. DBG_COMP_ADDROBJ | \
  114. DBG_COMP_CONNOBJ | \
  115. DBG_COMP_CHANOBJ | \
  116. DBG_COMP_RESOURCES | \
  117. DBG_COMP_UNLOAD | \
  118. DBG_COMP_NODE | \
  119. DBG_COMP_AARP | \
  120. DBG_COMP_AEP | \
  121. DBG_COMP_DDP | \
  122. DBG_COMP_ATP | \
  123. DBG_COMP_ADSP | \
  124. DBG_COMP_ZIP | \
  125. DBG_COMP_NBP | \
  126. DBG_COMP_PAP | \
  127. DBG_COMP_ASP | \
  128. DBG_COMP_RTMP | \
  129. DBG_COMP_ROUTER | \
  130. DBG_COMP_DUMP | \
  131. DBG_COMP_UTILS | \
  132. DBG_COMP_REFCOUNTS | \
  133. DBG_COMP_SYSTEM | \
  134. DBG_COMP_TDI | \
  135. DBG_COMP_RAS)
  136. // past here are debug things that are really frequent; don't use them
  137. // unless you want LOTS of output
  138. #define DBG_ALL (DBG_MOST | DBG_COMP_CRITSEC)
  139. // More debugging support. These values define the dumping components.
  140. // There are a max of 32 such components that can be defined. Each of
  141. // these are associated with a dump routine. It one is specified and
  142. // enabled, periodically it is called. It is upto that component to
  143. // decide what it wants to do
  144. #define DBG_DUMP_DEF_INTERVAL 300 // In 100ms units
  145. #define DBG_DUMP_PORTINFO 0x00000001
  146. #define DBG_DUMP_AMT 0x00000002
  147. #define DBG_DUMP_ZONETABLE 0x00000004
  148. #define DBG_DUMP_RTES 0x00000008
  149. #define DBG_DUMP_TIMERS 0x00000010
  150. #define DBG_DUMP_ATPINFO 0x00000020
  151. #define DBG_DUMP_ASPSESSIONS 0x00000040
  152. #define DBG_DUMP_PAPJOBS 0x00000080
  153. typedef LONG ATALK_ERROR, *PATALK_ERROR;
  154. #define ATALK_SUCCESS(error) ((ATALK_ERROR)(error) >= 0)
  155. #define ATALK_NO_ERROR 0x00000000
  156. #define ATALK_PENDING 0x00000001
  157. #define ATALK_RESR_MEM -1000
  158. #define ATALK_INVALID_PARAMETER -1050
  159. #define ATALK_BUFFER_TOO_SMALL -1051
  160. #define ATALK_BUFFER_TOO_BIG -1052
  161. #define ATALK_ALREADY_ASSOCIATED -1053
  162. #define ATALK_CANNOT_DISSOCIATE -1054
  163. #define ATALK_CANNOT_CANCEL -1055
  164. #define ATALK_INVALID_REQUEST -1056
  165. #define ATALK_REQUEST_NOT_ACCEPTED -1057
  166. #define ATALK_DEVICE_NOT_READY -1058
  167. #define ATALK_INVALID_CONNECTION -1059
  168. #define ATALK_INVALID_ADDRESS -1060
  169. #define ATALK_TOO_MANY_COMMANDS -1061
  170. #define ATALK_CONNECTION_TIMEOUT -1062
  171. #define ATALK_REMOTE_CLOSE -1063
  172. #define ATALK_LOCAL_CLOSE -1064
  173. #define ATALK_BUFFER_INVALID_SIZE -1065
  174. #define ATALK_REQUEST_CANCELLED -1066
  175. #define ATALK_NEW_SOCKET -1067
  176. #define ATALK_TIMEOUT -1068
  177. #define ATALK_SHARING_VIOLATION -1069
  178. #define ATALK_INVALID_PKT -1070
  179. #define ATALK_DUP_PKT -1071
  180. #define ATALK_INIT_BINDFAIL -1100
  181. #define ATALK_INIT_REGPROTO_FAIL -1101
  182. #define ATALK_INIT_MEDIA_INVALID -1102
  183. #define ATALK_PORT_INVALID -1200
  184. #define ATALK_PORT_CLOSING -1201
  185. #define ATALK_NODE_FINDING -1300
  186. #define ATALK_NODE_NONEXISTENT -1301
  187. #define ATALK_NODE_CLOSING -1302
  188. #define ATALK_NODE_NOMORE -1303
  189. #define ATALK_SOCKET_INVALID -1400
  190. #define ATALK_SOCKET_NODEFULL -1401
  191. #define ATALK_SOCKET_EXISTS -1402
  192. #define ATALK_SOCKET_CLOSED -1403
  193. #define ATALK_DDP_CLOSING -1500
  194. #define ATALK_DDP_NOTFOUND -1501
  195. #define ATALK_DDP_INVALID_LEN -1502
  196. #define ATALK_DDP_SHORT_HDR -1503
  197. #define ATALK_DDP_INVALID_SRC -1504
  198. #define ATALK_DDP_INVALID_DEST -1505
  199. #define ATALK_DDP_INVALID_ADDR -1506
  200. #define ATALK_DDP_INVALID_PROTO -1507
  201. #define ATALK_DDP_INVALID_PARAM -1508
  202. #define ATALK_DDP_NO_ROUTER -1509
  203. #define ATALK_DDP_NO_AMT_ENTRY -1510
  204. #define ATALK_DDP_NO_BRC_ENTRY -1511
  205. #define ATALK_DDP_PKT_DROPPED -1512
  206. #define ATALK_ATP_NOT_FOUND -1600
  207. #define ATALK_ATP_INVALID_PKT -1601
  208. #define ATALK_ATP_INVALID_REQ -1602
  209. #define ATALK_ATP_REQ_CLOSING -1603
  210. #define ATALK_ATP_RESP_CLOSING -1604
  211. #define ATALK_ATP_INVALID_RETRYCNT -1605
  212. #define ATALK_ATP_INVALID_TIMERVAL -1606
  213. #define ATALK_ATP_INVALID_RELINT -1607
  214. #define ATALK_ATP_CLOSING -1608
  215. #define ATALK_ATP_RESP_TOOMANY -1609
  216. #define ATALK_ATP_NO_MATCH_REQ -1610
  217. #define ATALK_ATP_NO_GET_REQ -1611
  218. #define ATALK_ATP_RESP_TIMEOUT -1612
  219. #define ATALK_ATP_RESP_CANCELLED -1613
  220. #define ATALK_ATP_REQ_CANCELLED -1614
  221. #define ATALK_ATP_GET_REQ_CANCELLED -1615
  222. #define ATALK_ATP_NO_VALID_RESP -1616
  223. #define ATALK_ATP_REQ_TIMEOUT -1617
  224. #define ATALK_ASP_INVALID_REQUEST -1700
  225. #define ATALK_PAP_LOCAL_CLOSE -1800
  226. #define ATALK_PAP_REMOTE_CLOSE -1801
  227. #define ATALK_PAP_INVALID_REQUEST -1802
  228. #define ATALK_PAP_TOO_MANY_READS -1803
  229. #define ATALK_PAP_TOO_MANY_WRITES -1804
  230. #define ATALK_PAP_CONN_NOT_ACTIVE -1805
  231. #define ATALK_PAP_ADDR_CLOSING -1806
  232. #define ATALK_PAP_CONN_CLOSING -1807
  233. #define ATALK_PAP_CONN_NOT_FOUND -1808
  234. #define ATALK_PAP_INVALID_USERBYTES -1809
  235. #define ATALK_PAP_SERVER_BUSY -1810
  236. #define ATALK_PAP_INVALID_STATUS -1811
  237. #define ATALK_PAP_PARTIAL_RECEIVE -1812
  238. #define ATALK_PAP_CONN_RESET -1813
  239. #define ATALK_ADSP_INVALID_REQUEST -1900
  240. #define ATALK_ADSP_CONN_NOT_ACTIVE -1903
  241. #define ATALK_ADSP_ADDR_CLOSING -1904
  242. #define ATALK_ADSP_CONN_CLOSING -1905
  243. #define ATALK_ADSP_CONN_NOT_FOUND -1906
  244. #define ATALK_ADSP_CONN_RESET -1907
  245. #define ATALK_ADSP_SERVER_BUSY -1908
  246. #define ATALK_ADSP_PARTIAL_RECEIVE -1912
  247. #define ATALK_ADSP_EXPED_RECEIVE -1913
  248. #define ATALK_ADSP_PAREXPED_RECEIVE -1914
  249. #define ATALK_ADSP_REMOTE_RESR -1915
  250. #define ATALK_TIMER_CANCEL_FAIL -2000
  251. #define ATALK_TIMER_SCHEDULE_FAIL -2001
  252. #define ATALK_ASPC_LOCAL_CLOSE -2100
  253. #define ATALK_ASPC_REMOTE_CLOSE -2101
  254. #define ATALK_ASPC_INVALID_REQUEST -2102
  255. #define ATALK_ASPC_TOO_MANY_READS -2103
  256. #define ATALK_ASPC_TOO_MANY_WRITES -2104
  257. #define ATALK_ASPC_CONN_NOT_ACTIVE -2105
  258. #define ATALK_ASPC_ADDR_CLOSING -2106
  259. #define ATALK_ASPC_CONN_CLOSING -2107
  260. #define ATALK_ASPC_CONN_NOT_FOUND -2108
  261. #define ATALK_ASPC_INVALID_USERBYTES -2109
  262. #define ATALK_ASPC_SERVER_BUSY -2110
  263. #define ATALK_ASPC_INVALID_STATUS -2111
  264. #define ATALK_ASPC_PARTIAL_RECEIVE -2112
  265. #define ATALK_ASPC_CONN_RESET -2113
  266. #define ATALK_FAILURE -5000
  267. // This defines the number of times an error has to happen consecutively before
  268. // it gets logged again.
  269. #define ERROR_CONSEQ_FREQ 200
  270. #define ERROR_CONSEQ_TIME 18000 // 30 minutes in 100ns intervals
  271. #if DBG
  272. extern ULONG AtalkDebugDump;
  273. extern LONG AtalkDumpInterval;
  274. extern ULONG AtalkDebugLevel;
  275. extern ULONG AtalkDebugSystems;
  276. extern TIMERLIST AtalkDumpTimerList;
  277. typedef VOID (*DUMP_ROUTINE)(VOID);
  278. extern
  279. LONG FASTCALL
  280. AtalkDumpComponents(
  281. IN PTIMERLIST Context,
  282. IN BOOLEAN TimerShuttingDown
  283. );
  284. extern
  285. VOID
  286. AtalkAmtDumpTable(
  287. VOID
  288. );
  289. extern
  290. VOID
  291. AtalkPortDumpInfo(
  292. VOID
  293. );
  294. extern
  295. VOID
  296. AtalkRtmpDumpTable(
  297. VOID
  298. );
  299. extern
  300. VOID
  301. AtalkTimerDumpList(
  302. VOID
  303. );
  304. extern
  305. VOID
  306. AtalkZoneDumpTable(
  307. VOID
  308. );
  309. extern
  310. VOID
  311. AtalkAspDumpSessions(
  312. VOID
  313. );
  314. #endif
  315. #define LOG_ERROR(AtalkError, NtStatus, RawData, RawDataLen) \
  316. LOG_ERRORONPORT(NULL, AtalkError, NtStatus, RawData, RawDataLen)
  317. #define RES_LOG_ERROR() \
  318. LOG_ERROR(EVENT_ATALK_RESOURCES, STATUS_INSUFFICIENT_RESOURCES, NULL, 0)
  319. #define LOG_ERRORONPORT(Port, AtalkError, NtStatus, RawData, RawDataLen) \
  320. { \
  321. if (!NT_SUCCESS(NtStatus)) \
  322. { \
  323. DBGPRINT(DBG_ALL, DBG_LEVEL_ERR, \
  324. ("LOG_ERROR: File %s Line %ld Event %lx Error %lx\n", \
  325. __FILE__, __LINE__, AtalkError, NtStatus)); \
  326. } \
  327. AtalkWriteErrorLogEntry(Port, \
  328. AtalkError, \
  329. (__LINE__ | FILENUM), \
  330. NtStatus, \
  331. RawData, \
  332. RawDataLen); \
  333. }
  334. #if DBG
  335. // ERROR and above ignore the Component part
  336. #define DBGPRINT(Component, Level, Fmt) \
  337. { \
  338. if ((Level >= AtalkDebugLevel) && \
  339. ((AtalkDebugSystems & Component) == Component)) \
  340. { \
  341. DbgPrint("***ATALK*** "); \
  342. DbgPrint Fmt; \
  343. } \
  344. }
  345. #define DBGPRINTSKIPHDR(Component, Level, Fmt) \
  346. { \
  347. if ((Level >= AtalkDebugLevel) && \
  348. ((AtalkDebugSystems & Component) == Component)) \
  349. { \
  350. DbgPrint Fmt; \
  351. } \
  352. }
  353. #define DBGBRK(Level) \
  354. { \
  355. if (Level >= AtalkDebugLevel) \
  356. DbgBreakPoint(); \
  357. }
  358. #define TMPLOGERR() DBGPRINT(DBG_MOST, DBG_LEVEL_ERR, \
  359. ("TempErrLog: %s, Line %ld\n", \
  360. __FILE__, __LINE__));
  361. #else
  362. #define DBGPRINTSKIPHDR(Component, Level, Fmt)
  363. #define DBGPRINT(Component, Level, Fmt)
  364. #define DBGBRK(Level)
  365. #define TMPLOGERR()
  366. #endif
  367. extern
  368. VOID
  369. AtalkWriteErrorLogEntry(
  370. IN struct _PORT_DESCRIPTOR * pPortDesc,
  371. IN NTSTATUS UniqueErrorCode,
  372. IN ULONG UniqueErrorValue,
  373. IN NTSTATUS NtStatusCode,
  374. IN PVOID RawDataBuf OPTIONAL,
  375. IN LONG RawDataLen);
  376. extern
  377. VOID
  378. AtalkLogBadPacket(
  379. IN struct _PORT_DESCRIPTOR * pPortDesc,
  380. IN PATALK_ADDR pSrcAddr,
  381. IN PATALK_ADDR pDstAddr OPTIONAL,
  382. IN PBYTE pPkt,
  383. IN USHORT PktLen);
  384. extern
  385. ATALK_ERROR FASTCALL
  386. AtalkNdisToAtalkError(
  387. IN NDIS_STATUS Error);
  388. extern
  389. NTSTATUS FASTCALL
  390. AtalkErrorToNtStatus(
  391. IN ATALK_ERROR AtalkError);
  392. #endif // _ATKERROR_
  393.