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.

293 lines
9.3 KiB

  1. /*
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. atalkio.h
  5. Abstract:
  6. This module contains interface specification to the appletalk stack.
  7. Author:
  8. Jameel Hyder (microsoft!jameelh)
  9. Revision History:
  10. 19 Jun 1992 Initial Version
  11. Notes: Tab stop: 4
  12. --*/
  13. #ifndef _ATALKIO_
  14. #define _ATALKIO_
  15. extern BOOLEAN AfpServerBoundToAsp;
  16. extern BOOLEAN AfpServerBoundToTcp;
  17. extern HANDLE AfpTdiNotificationHandle;
  18. extern
  19. VOID
  20. AfpTdiPnpHandler(
  21. IN TDI_PNP_OPCODE PnPOpcode,
  22. IN PUNICODE_STRING pBindDeviceName,
  23. IN PWSTR BindingList
  24. );
  25. extern
  26. VOID FASTCALL
  27. AfpPnPReconfigDisable(
  28. IN PVOID Context
  29. );
  30. extern
  31. VOID FASTCALL
  32. AfpPnPReconfigEnable(
  33. IN PVOID Context
  34. );
  35. extern
  36. NTSTATUS
  37. AfpTdiRegister(
  38. IN VOID
  39. );
  40. extern
  41. VOID
  42. AfpTdiBindCallback(
  43. IN PUNICODE_STRING pBindDeviceName
  44. );
  45. extern
  46. VOID
  47. AfpTdiUnbindCallback(
  48. IN PUNICODE_STRING pBindDeviceName
  49. );
  50. extern
  51. NTSTATUS
  52. AfpSpOpenAddress(
  53. VOID
  54. );
  55. extern
  56. VOID
  57. AfpSpCloseAddress(
  58. VOID
  59. );
  60. extern
  61. NTSTATUS FASTCALL
  62. AfpSpCloseSession(
  63. IN PSDA pSda
  64. );
  65. extern
  66. AFPSTATUS
  67. AfpSpRegisterName(
  68. IN PANSI_STRING ServerName,
  69. IN BOOLEAN Register
  70. );
  71. extern
  72. VOID FASTCALL
  73. AfpSpReplyClient(
  74. IN PREQUEST pRequest,
  75. IN LONG ReplyCode,
  76. IN PASP_XPORT_ENTRIES XportTable
  77. );
  78. extern
  79. VOID FASTCALL
  80. AfpSpSendAttention(
  81. IN PSDA pSda,
  82. IN USHORT AttnCode,
  83. IN BOOLEAN Synchronous
  84. );
  85. extern
  86. VOID
  87. AfpFreeReplyBuf(
  88. IN PSDA pSda,
  89. IN BOOLEAN fLockHeld
  90. );
  91. #define DSI_BACKFILL_OFFSET(pSda) \
  92. ((pSda->sda_Flags & SDA_SESSION_OVER_TCP)? DSI_HEADER_SIZE : 0)
  93. //
  94. // when we go over TCP/IP, we want to allocate 16 more bytes for the
  95. // DSI header for better performance.
  96. //
  97. #define AfpIOAllocBackFillBuffer(pSda) \
  98. { \
  99. DWORD _ReplySize = pSda->sda_ReplySize; \
  100. DWORD _Offset = 0; \
  101. PBYTE _pReplyBufStart; \
  102. \
  103. if (pSda->sda_Flags & SDA_SESSION_OVER_TCP) \
  104. { \
  105. _ReplySize += DSI_HEADER_SIZE; \
  106. _Offset = DSI_HEADER_SIZE; \
  107. } \
  108. \
  109. _pReplyBufStart = AfpIOAllocBuffer(_ReplySize); \
  110. \
  111. if (_pReplyBufStart != NULL) \
  112. { \
  113. pSda->sda_IOBuf = _pReplyBufStart+_Offset; \
  114. } \
  115. else \
  116. { \
  117. pSda->sda_IOBuf = NULL; \
  118. } \
  119. }
  120. #define AfpPutGuardSignature(pSda) \
  121. { \
  122. PBYTE _pReplyBufStart = pSda->sda_IOBuf; \
  123. if (pSda->sda_Flags & SDA_SESSION_OVER_TCP) \
  124. { \
  125. _pReplyBufStart -= DSI_HEADER_SIZE; \
  126. } \
  127. *(DWORD *)_pReplyBufStart = 0x081294; \
  128. }
  129. #define AfpIOFreeBackFillBuffer(pSda) \
  130. { \
  131. DWORD _Offset = 0; \
  132. PBYTE _pReplyBufStart = pSda->sda_IOBuf; \
  133. \
  134. if (pSda->sda_IOBuf != NULL) \
  135. { \
  136. if (pSda->sda_Flags & SDA_SESSION_OVER_TCP) \
  137. { \
  138. _pReplyBufStart -= DSI_HEADER_SIZE; \
  139. } \
  140. \
  141. AfpIOFreeBuffer(_pReplyBufStart); \
  142. \
  143. (pSda)->sda_IOBuf = NULL; \
  144. (pSda)->sda_IOSize = 0; \
  145. } \
  146. }
  147. #define AfpFreeIOBuffer(pSda) \
  148. if ((pSda)->sda_IOBuf != NULL) \
  149. { \
  150. AfpIOFreeBuffer((pSda)->sda_IOBuf); \
  151. (pSda)->sda_IOBuf = NULL; \
  152. (pSda)->sda_IOSize = 0; \
  153. }
  154. // set the status on ASP
  155. #define AfpSpSetAspStatus(pStatusBuf, Size) \
  156. (*(AfpAspEntries.asp_SetStatus))(AfpAspEntries.asp_AspCtxt, \
  157. pStatusBuf, \
  158. (USHORT)(Size));
  159. // set the status on DSI
  160. #define AfpSpSetDsiStatus(pStatusBuf, Size) \
  161. (*(AfpDsiEntries.asp_SetStatus))(AfpDsiEntries.asp_AspCtxt, \
  162. pStatusBuf, \
  163. (USHORT)(Size));
  164. // set the Disable Listen on ASP only
  165. #define AfpSpDisableListensOnAsp() \
  166. { \
  167. if (AfpServerBoundToAsp) \
  168. { \
  169. (*(AfpAspEntries.asp_ListenControl))(AfpAspEntries.asp_AspCtxt, False); \
  170. } \
  171. }
  172. // set the Disable Listen on ASP as well as DSI interfaces!
  173. #define AfpSpDisableListens() \
  174. { \
  175. if (AfpServerBoundToAsp) \
  176. { \
  177. (*(AfpAspEntries.asp_ListenControl))(AfpAspEntries.asp_AspCtxt, False); \
  178. } \
  179. if (AfpServerBoundToTcp) \
  180. { \
  181. (*(AfpDsiEntries.asp_ListenControl))(AfpDsiEntries.asp_AspCtxt, False); \
  182. } \
  183. }
  184. // set the Enable Listen on ASP as well as DSI interfaces!
  185. #define AfpSpEnableListens() \
  186. { \
  187. if (AfpServerBoundToAsp) \
  188. { \
  189. (*(AfpAspEntries.asp_ListenControl))(AfpAspEntries.asp_AspCtxt, True); \
  190. } \
  191. if (AfpServerBoundToTcp) \
  192. { \
  193. (*(AfpDsiEntries.asp_ListenControl))(AfpDsiEntries.asp_AspCtxt, True); \
  194. } \
  195. }
  196. GLOBAL ASP_XPORT_ENTRIES AfpAspEntries EQU { 0 };
  197. GLOBAL ASP_XPORT_ENTRIES AfpDsiEntries EQU { 0 };
  198. #define AFP_MAX_REQ_BUF 578
  199. #define afpInitializeActionHdr(p, Code) \
  200. (p)->ActionHeader.TransportId = MATK; \
  201. (p)->ActionHeader.ActionCode = (Code)
  202. // This is the device handle to the stack.
  203. extern BOOLEAN afpSpNameRegistered;
  204. extern HANDLE afpSpAddressHandle;
  205. extern PDEVICE_OBJECT afpSpAppleTalkDeviceObject;
  206. extern PFILE_OBJECT afpSpAddressObject;
  207. extern LONG afpSpNumOutstandingReplies;
  208. LOCAL NTSTATUS FASTCALL
  209. afpSpHandleRequest(
  210. IN NTSTATUS Status,
  211. IN PSDA pSda,
  212. IN PREQUEST pRequest
  213. );
  214. LOCAL VOID FASTCALL
  215. afpSpReplyComplete(
  216. IN NTSTATUS Status,
  217. IN PSDA pSda,
  218. IN PREQUEST pRequest
  219. );
  220. LOCAL VOID FASTCALL
  221. afpSpCloseComplete(
  222. IN NTSTATUS Status,
  223. IN PSDA pSda
  224. );
  225. LOCAL NTSTATUS
  226. afpSpGenericComplete(
  227. IN PDEVICE_OBJECT pDeviceObject,
  228. IN PIRP pIrp,
  229. IN PKEVENT pCmplEvent
  230. );
  231. LOCAL VOID FASTCALL
  232. afpSpAttentionComplete(
  233. IN PVOID pContext
  234. );
  235. #endif // _ATALKIO_
  236.