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.

317 lines
12 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 2000-2002 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: async.h
  6. * Content: Asynchronous Operations Header File
  7. *@@BEGIN_MSINTERNAL
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 12/28/99 mjn Created
  12. * 12/29/99 mjn Reformed DN_ASYNC_OP to use hParentOp instead of lpvUserContext
  13. * 01/14/00 mjn Added pvUserContext to DN_PerformListen
  14. * 01/14/00 mjn Changed DN_COUNT_BUFFER to CRefCountBuffer
  15. * 01/17/00 mjn Added dwStartTime to async op structure
  16. * 01/19/00 mjn Replaced DN_SYNC_EVENT with CSyncEvent
  17. * 01/21/00 mjn Added DNProcessInternalOperation
  18. * 01/27/00 mjn Added support for retention of receive buffers
  19. * 02/09/00 mjn Implemented DNSEND_COMPLETEONPROCESS
  20. * 02/18/00 mjn Converted DNADDRESS to IDirectPlayAddress8
  21. * 03/23/00 mjn Added phrSync and pvInternal
  22. * 03/24/00 mjn Add guidSP to DN_ASYNC_OP
  23. * 04/04/00 mjn Added DNProcessTerminateSession()
  24. * 04/10/00 mjn Use CAsyncOp for CONNECTs, LISTENs and DISCONNECTs
  25. * 04/17/00 mjn Replaced BUFFERDESC with DPN_BUFFER_DESC
  26. * 04/17/00 mjn Added DNCompleteAsyncHandle
  27. * 04/21/00 mjn Added DNPerformDisconnect
  28. * 04/23/00 mjn Optionally return child AsyncOp in DNPerformChildSend()
  29. * 04/24/00 mjn Added DNCreateUserHandle()
  30. * 06/24/00 mjn Added DNCompleteConnectToHost() and DNCompleteUserConnect()
  31. * 07/02/00 mjn Added DNSendGroupMessage() and DN_GROUP_SEND_OP
  32. * 07/10/00 mjn Added DNPerformEnumQuery()
  33. * 07/11/00 mjn Added fNoLoopBack to DNSendGroupMessage()
  34. * mjn Added DNPerformNextEnumQuery(),DNPerformSPListen(),DNPerformNextListen(),DNEnumAdapterGuids(),DNPerformNextConnect
  35. * mjn Added DN_LISTEN_OP_DATA,DN_CONNECT_OP_DATA
  36. * 07/20/00 mjn Added DNCompleteConnectOperation() and DNCompleteSendConnectInfo()
  37. * mjn Modified DNPerformDisconnect()
  38. * 08/05/00 mjn Added pParent to DNSendGroupMessage and DNSendMessage()
  39. * mjn Added fInternal to DNPerformChildSend()
  40. * mjn Removed DN_TerminateAllListens()
  41. * mjn Added DNCompleteRequest()
  42. * 09/23/00 mjn Added CSyncEvent to DN_LISTEN_OP_DATA
  43. * 10/04/00 mjn Added dwCompleteAdapters to DN_LISTEN_OP_DATA
  44. * 12/05/00 RichGr Changed DN_SEND_OP_DATA packing from 1 to default (4 on 32-bit, 8 on 64bit).
  45. * 03/30/00 mjn Added service provider to DNPerformConnect()
  46. *@@END_MSINTERNAL
  47. *
  48. ***************************************************************************/
  49. #ifndef __ASYNC_H__
  50. #define __ASYNC_H__
  51. typedef struct _DIRECTNETOBJECT DIRECTNETOBJECT;
  52. //**********************************************************************
  53. // Constant definitions
  54. //**********************************************************************
  55. #define DN_ASYNC_OP_SIG 0xdece0003
  56. #define DN_ASYNC_OP_FLAG_MULTI_OP 0x0001
  57. #define DN_ASYNC_OP_FLAG_MULTI_OP_PARENT 0x0002
  58. #define DN_ASYNC_OP_FLAG_SYNCHRONOUS_OP 0x0010
  59. #define DN_ASYNC_OP_FLAG_NO_COMPLETION 0x0100
  60. #define DN_ASYNC_OP_FLAG_RELEASE_SP 0x1000
  61. //
  62. // Enumerated values for buffer descriptions. The value DN_ASYNC_BUFFERDESC_COUNT
  63. // must be large enough to contain account for BUFFERDESC structres possibly
  64. // passed with this async operation
  65. //
  66. #define DN_ASYNC_BUFFERDESC_HEADER 0
  67. #define DN_ASYNC_BUFFERDESC_DATA 1
  68. #define DN_ASYNC_BUFFERDESC_COUNT 3
  69. #define DN_ASYNC_MAX_SEND_BUFFERDESC 8 // Is this value right?
  70. //**********************************************************************
  71. // Macro definitions
  72. //**********************************************************************
  73. //**********************************************************************
  74. // Structure definitions
  75. //**********************************************************************
  76. class CSyncEvent;
  77. class CRefCountBuffer;
  78. class CServiceProvider;
  79. class CAsyncOp;
  80. class CConnection;
  81. class CNameTableEntry;
  82. typedef struct _DN_SEND_OP_DATA
  83. {
  84. DWORD dwNumBuffers;
  85. DWORD dwMsgId;
  86. DPN_BUFFER_DESC BufferDesc[DN_ASYNC_MAX_SEND_BUFFERDESC+1];
  87. } DN_SEND_OP_DATA;
  88. typedef struct _DN_GROUP_SEND_OP
  89. {
  90. CConnection *pConnection;
  91. struct _DN_GROUP_SEND_OP *pNext;
  92. } DN_GROUP_SEND_OP;
  93. #ifndef DPNBUILD_ONLYONEADAPTER
  94. typedef struct _DN_LISTEN_OP_DATA
  95. {
  96. DWORD dwNumAdapters;
  97. DWORD dwCurrentAdapter;
  98. DWORD dwCompleteAdapters;
  99. CSyncEvent *pSyncEvent;
  100. } DN_LISTEN_OP_DATA;
  101. typedef struct _DN_CONNECT_OP_DATA
  102. {
  103. DWORD dwNumAdapters;
  104. DWORD dwCurrentAdapter;
  105. } DN_CONNECT_OP_DATA;
  106. #endif // ! DPNBUILD_ONLYONEADAPTER
  107. //**********************************************************************
  108. // Variable definitions
  109. //**********************************************************************
  110. //**********************************************************************
  111. // Function prototypes
  112. //**********************************************************************
  113. HRESULT DNCreateUserHandle(DIRECTNETOBJECT *const pdnObject,
  114. CAsyncOp **const ppAsyncOp);
  115. #ifndef DPNBUILD_ONLYONEADAPTER
  116. HRESULT DNEnumAdapterGuids(DIRECTNETOBJECT *const pdnObject,
  117. GUID *const pguidSP,
  118. const DWORD dwMatchFlags,
  119. GUID **const ppAdapterList,
  120. DWORD *const pdwNumAdapters);
  121. #endif // ! DPNBUILD_ONLYONEADAPTER
  122. HRESULT DNPerformSPListen(DIRECTNETOBJECT *const pdnObject,
  123. IDirectPlay8Address *const pDeviceAddr,
  124. CAsyncOp *const pListenParent,
  125. CAsyncOp **const ppParent);
  126. HRESULT DNPerformListen(DIRECTNETOBJECT *const pdnObject,
  127. IDirectPlay8Address *const pDeviceInfo,
  128. CAsyncOp *const pParent);
  129. #ifndef DPNBUILD_ONLYONEADAPTER
  130. HRESULT DNPerformNextListen(DIRECTNETOBJECT *const pdnObject,
  131. CAsyncOp *const pAsyncOp,
  132. IDirectPlay8Address *const pDeviceAddr);
  133. #endif // ! DPNBUILD_ONLYONEADAPTER
  134. void DNCompleteListen(DIRECTNETOBJECT *const pdnObject,
  135. CAsyncOp *const pAsyncOp);
  136. /* REMOVE
  137. HRESULT DN_TerminateAllListens(DIRECTNETOBJECT *const pdnObject);
  138. */
  139. HRESULT DNPerformEnumQuery(DIRECTNETOBJECT *const pdnObject,
  140. IDirectPlay8Address *const pHost,
  141. IDirectPlay8Address *const pDevice,
  142. const HANDLE hSPHandle,
  143. const DWORD dwFlags,
  144. void *const pvContext,
  145. CAsyncOp *const pParent);
  146. HRESULT DNPerformNextEnumQuery(DIRECTNETOBJECT *const pdnObject,
  147. CAsyncOp *const pAsyncOp,
  148. IDirectPlay8Address *const pHostAddr,
  149. IDirectPlay8Address *const pDeviceAddr);
  150. void DNCompleteEnumQuery(DIRECTNETOBJECT *const pdnObject,
  151. CAsyncOp *const pAsyncOp);
  152. void DNCompleteEnumResponse(DIRECTNETOBJECT *const pdnObject,
  153. CAsyncOp *const pAsyncOp);
  154. HRESULT DNPerformConnect(DIRECTNETOBJECT *const pdnObject,
  155. const DPNID dpnid,
  156. IDirectPlay8Address *const pDeviceInfo,
  157. IDirectPlay8Address *const pRemoteAddr,
  158. CServiceProvider *const pSP,
  159. const DWORD dwConnectFlags,
  160. CAsyncOp *const pParent);
  161. HRESULT DNPerformNextConnect(DIRECTNETOBJECT *const pdnObject,
  162. CAsyncOp *const pAsyncOp,
  163. IDirectPlay8Address *const pHostAddr,
  164. IDirectPlay8Address *const pDeviceAddr);
  165. void DNCompleteConnect(DIRECTNETOBJECT *const pdnObject,
  166. CAsyncOp *const pAsyncOp);
  167. void DNCompleteConnectToHost(DIRECTNETOBJECT *const pdnObject,
  168. CAsyncOp *const pAsyncOp);
  169. void DNCompleteConnectOperation(DIRECTNETOBJECT *const pdnObject,
  170. CAsyncOp *const pAsyncOp);
  171. void DNCompleteUserConnect(DIRECTNETOBJECT *const pdnObject,
  172. CAsyncOp *const pAsyncOp);
  173. void DNCompleteSendConnectInfo(DIRECTNETOBJECT *const pdnObject,
  174. CAsyncOp *const pAsyncOp);
  175. HRESULT DNPerformDisconnect(DIRECTNETOBJECT *const pdnObject,
  176. CConnection *const pConnection,
  177. const HANDLE hEndPt,
  178. const BOOL fImmediate);
  179. void DNCompleteAsyncHandle(DIRECTNETOBJECT *const pdnObject,
  180. CAsyncOp *const pAsyncOp);
  181. void DNCompleteSendHandle(DIRECTNETOBJECT *const pdnObject,
  182. CAsyncOp *const pAsyncOp);
  183. void DNCompleteSendAsyncOp(DIRECTNETOBJECT *const pdnObject,
  184. CAsyncOp *const pAsyncOp);
  185. void DNCompleteRequest(DIRECTNETOBJECT *const pdnObject,
  186. CAsyncOp *const pAsyncOp);
  187. void DNCompleteSendRequest(DIRECTNETOBJECT *const pdnObject,
  188. CAsyncOp *const pAsyncOp);
  189. HRESULT DNSendMessage(DIRECTNETOBJECT *const pdnObject,
  190. CConnection *const pConnection, // Connection to send to
  191. const DWORD dwMsgId, // Message ID
  192. const DPNID dpnidTarget, // Target of this send (may be NULL)
  193. const DPN_BUFFER_DESC *const pdnBufferDesc, // Array of buffer desc's
  194. const DWORD cBufferDesc, // Number of buffer desc's
  195. CRefCountBuffer *const pRefCountBuffer, // RefCountBuffer (may be NULL)
  196. const DWORD dwTimeOut, // Time out
  197. const DWORD dwSendFlags, // Send flags
  198. CAsyncOp *const pParent, // Parent of this send
  199. CAsyncOp **const ppAsyncOp); // CAsyncOp created for this send
  200. HRESULT DNSendGroupMessage(DIRECTNETOBJECT *const pdnObject,
  201. CNameTableEntry *const pGroup,
  202. const DWORD dwMsgId,
  203. const DPN_BUFFER_DESC *const pdnBufferDesc,
  204. const DWORD cBufferDesc,
  205. CRefCountBuffer *const pRefCountBuffer,
  206. const DWORD dwTimeOut,
  207. const DWORD dwSendFlags,
  208. const BOOL fNoLoopBack,
  209. const BOOL fRequest,
  210. CAsyncOp *const pParent,
  211. CAsyncOp **const ppParent);
  212. HRESULT DNPerformMultiSend(DIRECTNETOBJECT *const pdnObject,
  213. const DPNHANDLE hParentOp,
  214. CConnection *const pConnection,
  215. const DWORD dwTimeOut);
  216. HRESULT DNCreateSendParent(DIRECTNETOBJECT *const pdnObject,
  217. const DWORD dwMsgId,
  218. const DPN_BUFFER_DESC *const pdnBufferDesc,
  219. const DWORD cBufferDesc,
  220. const DWORD dwSendFlags,
  221. CAsyncOp **const ppParent);
  222. HRESULT DNPerformChildSend(DIRECTNETOBJECT *const pdnObject,
  223. CAsyncOp *const pParent,
  224. CConnection *const pConnection,
  225. const DWORD dwTimeOut,
  226. CAsyncOp **const ppChild,
  227. const BOOL fInternal);
  228. HRESULT DNFinishMultiOp(DIRECTNETOBJECT *const pdnObject,const DPNHANDLE hRootOp);
  229. HRESULT DNProcessInternalOperation(DIRECTNETOBJECT *const pdnObject,
  230. const DWORD dwMsgId,
  231. void *const pOpBuffer,
  232. const DWORD dwOpBufferSize,
  233. CConnection *const pConnection,
  234. const HANDLE hProtocol,
  235. CRefCountBuffer *const pRefCountBuffer);
  236. HRESULT DNPerformRequest(DIRECTNETOBJECT *const pdnObject,
  237. const DWORD dwMsgId,
  238. const DPN_BUFFER_DESC *const pBufferDesc,
  239. CConnection *const pConnection,
  240. CAsyncOp *const pParent,
  241. CAsyncOp **const ppRequest);
  242. HRESULT DNReceiveCompleteOnProcess(DIRECTNETOBJECT *const pdnObject,
  243. CConnection *const pConnection,
  244. void *const pBufferData,
  245. const DWORD dwBufferSize,
  246. const HANDLE hProtocol,
  247. CRefCountBuffer *const pOrigRefCountBuffer);
  248. HRESULT DNReceiveCompleteOnProcessReply(DIRECTNETOBJECT *const pdnObject,
  249. void *const pBufferData,
  250. const DWORD dwBufferSize);
  251. HRESULT DNProcessTerminateSession(DIRECTNETOBJECT *const pdnObject,
  252. void *const pvBuffer,
  253. const DWORD dwBufferSize);
  254. //**********************************************************************
  255. // Class prototypes
  256. //**********************************************************************
  257. #endif // __ASYNC_H__