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.

324 lines
12 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1996 - 1999
  3. Module Name:
  4. dgtrans.hxx
  5. Abstract:
  6. Common definitions shared between modules supporting
  7. protocols based on datagram winsock.
  8. Author:
  9. Mario Goertzel [MarioGo]
  10. Revision History:
  11. MarioGo 04/10/1996 Bits 'n pieces
  12. EdwardR 08/08/1997 Additions for MSMQ (Falcon).
  13. --*/
  14. #ifndef __DGTRANS_HXX
  15. #define __DGTRANS_HXX
  16. typedef RPC_STATUS (*ENDPOINT_TO_SOCKADDR)(char *, WS_SOCKADDR *);
  17. struct DG_PDU_SIZES
  18. {
  19. // Note: PDU sizes MUST be zero mod eight.
  20. UINT BaselinePdu; // Minimum size that must always work.
  21. UINT PreferredPdu; // Good starting size, >= BaselinePdu
  22. UINT MaxPdu; // Maximum possible PDU size
  23. UINT MaxPacket; // Transport (ethernet, tokenring) packet size
  24. UINT ReceiveBuffer; // transport buffer length (winsock usually 8k)
  25. };
  26. struct DG_TRANS_INFO
  27. {
  28. INT AddressFamily;
  29. INT SocketType;
  30. INT Protocol;
  31. DWORD ServerBufferSize;
  32. DWORD WorkstationBufferSize;
  33. ENDPOINT_TO_SOCKADDR EndpointToAddr;
  34. };
  35. typedef WS_DATAGRAM_ENDPOINT *PWS_DATAGRAM_ENDPOINT;
  36. #ifdef NCADG_MQ_ON
  37. typedef MQ_DATAGRAM_ENDPOINT *PMQ_DATAGRAM_ENDPOINT;
  38. extern void MQ_SubmitReceives(BASE_ADDRESS *ThisEndpoint);
  39. #endif
  40. extern void DG_SubmitReceives(BASE_ADDRESS *ThisEndpoint);
  41. //-------------------------------------------------------------------
  42. // Datagram Transport Interface Functions for MSMQ
  43. //-------------------------------------------------------------------
  44. #ifdef DBG
  45. // #define MAJOR_DBG
  46. #endif
  47. #ifdef NCADG_MQ_ON
  48. extern BOOL MQ_Initialize();
  49. extern RPC_STATUS MQ_MapStatusCode(
  50. IN HRESULT hr,
  51. IN RPC_STATUS defaultStatus );
  52. extern RPC_STATUS MQ_InitOptions(
  53. IN void PAPI *pvTransportOptions );
  54. extern RPC_STATUS MQ_SetOption(
  55. IN void PAPI *pvTransportOptions,
  56. IN unsigned long option,
  57. IN ULONG_PTR optionValue );
  58. extern RPC_STATUS MQ_InqOption(
  59. IN void PAPI *pvTransportOptions,
  60. IN unsigned long option,
  61. OUT ULONG_PTR * pOptionValue );
  62. extern RPC_STATUS MQ_ImplementOptions(
  63. IN DG_TRANSPORT_ENDPOINT pEndpoint,
  64. IN void *pvTransportOptions );
  65. extern RPC_STATUS MQ_BuildAddressVector(
  66. OUT NETWORK_ADDRESS_VECTOR **ppVector );
  67. extern BOOL MQ_AllowReceives(
  68. IN DG_TRANSPORT_ENDPOINT pEndpoint,
  69. IN BOOL fAllowReceives,
  70. IN BOOL fCancelPending );
  71. extern RPC_STATUS MQ_RegisterQueueToDelete(
  72. IN RPC_CHAR *pwsQFormat,
  73. IN RPC_CHAR *pwsMachine );
  74. extern RPC_STATUS MQ_FillInAddress(
  75. IN MQ_ADDRESS *pAddress,
  76. IN MQPROPVARIANT *pMsgPropVar );
  77. extern BOOL ConstructQueuePathName(
  78. IN RPC_CHAR *pwsMachine,
  79. IN RPC_CHAR *pwsQName,
  80. OUT RPC_CHAR *pwsPathName,
  81. IN OUT DWORD *pdwSize );
  82. extern BOOL ConstructPrivateQueuePathName(
  83. IN RPC_CHAR *pwsMachine,
  84. IN RPC_CHAR *pwsQName,
  85. OUT RPC_CHAR *pwsPathName,
  86. IN OUT DWORD *pdwSize );
  87. extern BOOL ConstructDirectFormat(
  88. IN RPC_CHAR *pwsMachine,
  89. IN RPC_CHAR *pwsQName,
  90. OUT RPC_CHAR *pwsPathName,
  91. IN OUT DWORD *pdwSize );
  92. extern BOOL ConstructPrivateDirectFormat(
  93. IN RPC_CHAR *pwsMachine,
  94. IN RPC_CHAR *pwsQName,
  95. OUT RPC_CHAR *pwsPathName,
  96. IN OUT DWORD *pdwSize );
  97. extern BOOL ParseQueuePathName(
  98. IN RPC_CHAR *pwsPathName,
  99. OUT RPC_CHAR wsMachineName[MAX_COMPUTERNAME_LEN],
  100. OUT RPC_CHAR wsQueueName[MQ_MAX_Q_NAME_LEN] );
  101. extern HRESULT LocateQueueViaQName(
  102. IN OUT MQ_ADDRESS *pAddress );
  103. extern HRESULT CreateQueue(
  104. IN SECURITY_DESCRIPTOR *pSecurityDescriptor,
  105. IN UUID *pQueueUuid,
  106. IN RPC_CHAR *pwsPathName,
  107. IN RPC_CHAR *pwsQueueLabel,
  108. IN ULONG ulQueueFlags,
  109. OUT RPC_CHAR *pwsFormat,
  110. IN OUT DWORD *pdwFormatSize );
  111. extern HRESULT SetQueueProperties(
  112. IN RPC_CHAR *pwsQFormat,
  113. IN ULONG ulQueueFlags );
  114. extern HRESULT ClearQueue( IN QUEUEHANDLE hQueue );
  115. extern HRESULT ClientSetupQueue(
  116. IN OUT MQ_DATAGRAM_ENDPOINT *pEndpoint,
  117. IN RPC_CHAR *pwsMachine,
  118. IN RPC_CHAR *pwsEndpoint );
  119. extern HRESULT ServerSetupQueue(
  120. IN OUT MQ_DATAGRAM_ENDPOINT *pEndpoint,
  121. IN RPC_CHAR *pwsMachine,
  122. IN RPC_CHAR *pwsEndpoint,
  123. IN void *pSecurityDescriptor,
  124. IN DWORD ulEndpointFlags );
  125. extern HRESULT ClientCloseQueue(
  126. IN MQ_DATAGRAM_ENDPOINT *pEndpoint );
  127. extern HRESULT ServerCloseQueue(
  128. IN MQ_DATAGRAM_ENDPOINT *pEndpoint );
  129. extern RPC_STATUS ConnectToServerQueue(
  130. IN OUT MQ_ADDRESS *pAddress,
  131. IN RPC_CHAR *pNetworkAddress,
  132. IN RPC_CHAR *pEndpoint );
  133. extern RPC_STATUS DisconnectFromServer(
  134. IN OUT MQ_ADDRESS *pAddress );
  135. extern HRESULT QueryQM( IN RPC_CHAR *pwsMachine,
  136. IN OUT DWORD *pdwSize );
  137. extern HRESULT EvaluateAckMessage(
  138. IN USHORT msgClass );
  139. extern HRESULT WaitForAck(
  140. IN MQ_DATAGRAM_ENDPOINT *pEndpoint );
  141. extern HRESULT SetupAdminQueue(
  142. IN MQ_DATAGRAM_ENDPOINT *pEndpoint );
  143. extern HRESULT ReadQueue(
  144. IN MQ_DATAGRAM_ENDPOINT *pEndpoint,
  145. IN DWORD timeoutMsec,
  146. OUT MQ_ADDRESS *pAddress,
  147. OUT UCHAR *pBuffer,
  148. IN OUT DWORD *pdwBufferSize );
  149. extern HRESULT AsyncReadQueue(
  150. IN MQ_DATAGRAM_ENDPOINT *pEndpoint,
  151. IN MQ_OVERLAPPED *pOl,
  152. OUT MQ_ADDRESS *pAddress,
  153. OUT UCHAR *pBuffer,
  154. IN DWORD dwBufferSize );
  155. extern HRESULT AsyncPeekQueue(
  156. IN MQ_DATAGRAM_ENDPOINT *pEndpoint,
  157. IN MQ_OVERLAPPED *pOl );
  158. extern HRESULT PeekQueue(
  159. IN MQ_DATAGRAM_ENDPOINT *pEndpoint,
  160. IN DWORD dwTimeoutMsec,
  161. OUT DWORD *pdwrSize );
  162. extern HRESULT MQ_SendToQueue(
  163. IN MQ_DATAGRAM_ENDPOINT *pEndpoint,
  164. IN MQ_ADDRESS *pAddress,
  165. IN UCHAR *pBuffer,
  166. IN DWORD dwBufferSize );
  167. extern RPC_STATUS MQ_SubmitReceive(
  168. IN PMQ_DATAGRAM_ENDPOINT pEndpoint,
  169. IN PMQ_DATAGRAM pDatagram);
  170. extern RPC_STATUS RPC_ENTRY MQ_SendPacket(
  171. IN DG_TRANSPORT_ENDPOINT ThisEndpoint,
  172. IN DG_TRANSPORT_ADDRESS pAddress,
  173. IN BUFFER pHeader,
  174. IN unsigned cHeader,
  175. IN BUFFER pBody,
  176. IN unsigned cBody,
  177. IN BUFFER pTrailer,
  178. IN unsigned cTrailer );
  179. extern RPC_STATUS RPC_ENTRY MQ_ClientOpenEndpoint(
  180. OUT DG_TRANSPORT_ENDPOINT ThisEndpoint,
  181. IN BOOL fAsync,
  182. IN DWORD Flags );
  183. extern RPC_STATUS RPC_ENTRY MQ_ClientInitializeAddress(
  184. OUT DG_TRANSPORT_ADDRESS Address,
  185. IN RPC_CHAR *NetworkAddress,
  186. IN RPC_CHAR *pPort,
  187. IN BOOL fUseCache,
  188. IN BOOL fBroadcast );
  189. extern RPC_STATUS RPC_ENTRY MQ_ClientCloseEndpoint(
  190. IN DG_TRANSPORT_ENDPOINT ThisEndpoint );
  191. extern RPC_STATUS RPC_ENTRY MQ_ReceivePacket(
  192. IN DG_TRANSPORT_ENDPOINT ThisEndpoint,
  193. OUT DG_TRANSPORT_ADDRESS *pReplyAddress,
  194. OUT PUINT pBufferLength,
  195. OUT BUFFER *pBuffer,
  196. IN LONG Timeout );
  197. extern RPC_STATUS RPC_ENTRY MQ_ResizePacket(
  198. IN DG_TRANSPORT_ENDPOINT ThisEndpoint,
  199. OUT DG_TRANSPORT_ADDRESS *pReplyAddress,
  200. OUT PUINT pBufferLength,
  201. OUT BUFFER *pBuffer );
  202. extern RPC_STATUS RPC_ENTRY MQ_ReReceivePacket(
  203. IN DG_TRANSPORT_ENDPOINT ThisEndpoint,
  204. OUT DG_TRANSPORT_ADDRESS *pReplyAddress,
  205. OUT PUINT pBufferLength,
  206. OUT BUFFER *pBuffer );
  207. extern RPC_STATUS RPC_ENTRY MQ_ForwardPacket(
  208. IN DG_TRANSPORT_ENDPOINT ThisEndpoint,
  209. IN BUFFER pHeader,
  210. IN unsigned cHeader,
  211. IN BUFFER pBody,
  212. IN unsigned cBody,
  213. IN BUFFER pTrailer,
  214. IN unsigned cTrailer,
  215. IN CHAR * pszPort );
  216. extern RPC_STATUS RPC_ENTRY MQ_ServerListen(
  217. IN OUT DG_TRANSPORT_ENDPOINT ThisEndpoint,
  218. IN RPC_CHAR *NetworkAddress,
  219. IN OUT RPC_CHAR **pPort,
  220. IN void *pSecurityDescriptor,
  221. IN ULONG EndpointFlags,
  222. IN ULONG NICFlags,
  223. OUT NETWORK_ADDRESS_VECTOR **ppNetworkAddressVector );
  224. extern void RPC_ENTRY MQ_ServerAbortListen(
  225. IN DG_TRANSPORT_ENDPOINT ThisEndpoint );
  226. extern RPC_STATUS MQ_QueryAddress(
  227. IN void * pOriginalEndpoint,
  228. OUT RPC_CHAR * pClientAddress );
  229. extern RPC_STATUS MQ_QueryEndpoint(
  230. IN void * pOriginalEndpoint,
  231. OUT RPC_CHAR * pClientEndpoint );
  232. extern RPC_STATUS RPC_ENTRY MQ_GetEndpointStats(
  233. IN DG_TRANSPORT_ENDPOINT ThisEndpoint,
  234. OUT DG_ENDPOINT_STATS * pStats );
  235. extern RPC_STATUS RPC_ENTRY MQ_InquireAuthClient(
  236. IN void *pClientEndpoint,
  237. OUT RPC_CHAR **ppPrincipal,
  238. OUT SID **ppSid,
  239. OUT ULONG *pulAuthenLevel,
  240. OUT ULONG *pulAuthnService,
  241. OUT ULONG *pulAuthzService );
  242. #endif
  243. #ifdef MAJOR_DBG
  244. extern void DG_DbgPrintPacket( unsigned char *pPacket );
  245. #endif
  246. #endif // __DGTRANS_HXX