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.

270 lines
8.9 KiB

  1. //----------------------------------------------------------------
  2. //
  3. // Copyright (C) Microsoft Corporation, 1996 - 1999
  4. //
  5. // Module Name: mqcommon.h
  6. //
  7. //
  8. // Abstract:
  9. //
  10. // This is the Message Queue (Falcon) datagram client dll.
  11. //
  12. // Author:
  13. //
  14. // Edward Reus (edwardr) 17-Jun-1996
  15. //
  16. // Revision History:
  17. //
  18. //----------------------------------------------------------------
  19. #ifndef MQCOMMON_H
  20. #define MQCOMMON_H
  21. #define UNICODE // Use unicode API
  22. // Use the following define to turn on verbose debug messages:
  23. // #define MAJOR_DEBUG
  24. //----------------------------------------------------------------
  25. // Constants:
  26. //----------------------------------------------------------------
  27. #define DG_MQ_TRANSPORT_VERSION 1 // Not used.
  28. #define MAX_PATHNAME_LEN 256
  29. #define MAX_FORMAT_LEN 128
  30. #define MAX_COMPUTERNAME_LEN 32
  31. #define MAX_VAR 20
  32. #define MAX_SEND_VAR 20
  33. #define MAX_RECV_VAR 20
  34. #define MAX_SID_SIZE 256 // A typical SID is 20-30 bytes...
  35. #define MAX_USERNAME_SIZE 256
  36. #define MAX_DOMAIN_SIZE 256
  37. #define UUID_LEN 40
  38. #define TRANSPORTID 0x1D // Not official yet...
  39. #define TRANSPORTHOSTID 0x1E
  40. #define PROTSEQ "ncadg_mq"
  41. #define ENDPOINT_MAPPER_EP "EpMapper"
  42. #define WS_SEPARATOR TEXT("\\")
  43. #define WS_PRIVATE_DOLLAR TEXT("\\PRIVATE$\\")
  44. // These constants are use for temporary queue management:
  45. #define Q_SVC_PROTSEQ TEXT("ncalrpc")
  46. #define Q_SVC_ENDPOINT TEXT("epmapper")
  47. // These are the MQ Queue Type UUIDs for RPC:
  48. #define SVR_QTYPE_UUID_STR TEXT("bbd97de0-cb4f-11cf-8e62-00aa006b4f2f")
  49. #define CLNT_QTYPE_UUID_STR TEXT("8e482920-cead-11cf-8e68-00aa006b4f2f")
  50. #define CLNT_ADMIN_QTYPE_UUID_STR TEXT("c87ca5c0-ff67-11cf-8ebd-00aa006b4f2f")
  51. // Packet sizes:
  52. #define BASELINE_PDU_SIZE 65535
  53. #define PREFERRED_PDU_SIZE 65535
  54. #define MAX_PDU_SIZE 65535
  55. #define MAX_PACKET_SIZE 65535
  56. // was: 0x7fffffff
  57. #define DEFAULT_BUFFER_SIZE 0
  58. #define DEFAULT_PRIORITY 3
  59. //----------------------------------------------------------------
  60. // Types:
  61. //----------------------------------------------------------------
  62. typedef struct _MQ_INFO
  63. {
  64. WCHAR wsMachine[MAX_COMPUTERNAME_LEN];
  65. WCHAR wsQName[MQ_MAX_Q_NAME_LEN];
  66. WCHAR wsQPathName[MAX_PATHNAME_LEN];
  67. WCHAR wsQFormat[MAX_FORMAT_LEN];
  68. WCHAR wsAdminQFormat[MAX_FORMAT_LEN];
  69. UUID uuidQType;
  70. QUEUEHANDLE hQueue;
  71. QUEUEHANDLE hAdminQueue; // Sometimes used by the client.
  72. DWORD dwBufferSize;
  73. DWORD cThreads; // Used by server.
  74. BOOL fInitialized;
  75. // How to send this call message:
  76. BOOL fAck;
  77. ULONG ulDelivery;
  78. ULONG ulPriority;
  79. ULONG ulJournaling;
  80. ULONG ulTimeToReachQueue; // Seconds.
  81. ULONG ulTimeToReceive; // Seconds.
  82. BOOL fAuthenticate;
  83. BOOL fEncrypt;
  84. } MQ_INFO;
  85. typedef struct _MQ_ADDRESS
  86. {
  87. WCHAR wsMachine[MAX_COMPUTERNAME_LEN];
  88. WCHAR wsQName[MQ_MAX_Q_NAME_LEN];
  89. WCHAR wsQFormat[MAX_FORMAT_LEN];
  90. QUEUEHANDLE hQueue;
  91. BOOL fConnectionFailed;
  92. BOOL fAuthenticated; // Server security tracking.
  93. ULONG ulPrivacyLevel; // Server security tracking.
  94. ULONG ulAuthenticationLevel; // Server security tracking.
  95. UCHAR aSidBuffer[MAX_SID_SIZE]; // Server security tracking.
  96. } MQ_ADDRESS;
  97. typedef struct _MQ_OPTIONS
  98. {
  99. BOOL fAck;
  100. ULONG ulDelivery;
  101. ULONG ulPriority;
  102. ULONG ulJournaling;
  103. ULONG ulTimeToReachQueue;
  104. ULONG ulTimeToReceive;
  105. BOOL fAuthenticate;
  106. BOOL fEncrypt;
  107. } MQ_OPTIONS;
  108. //----------------------------------------------------------------
  109. // Prototypes:
  110. //----------------------------------------------------------------
  111. extern HRESULT CreateQueue( IN UUID *pQueueUuid,
  112. IN WCHAR *pwsPathName,
  113. IN WCHAR *pwsQueueLabel,
  114. IN ULONG ulQueueFlags,
  115. OUT WCHAR *pwsFormat,
  116. IN OUT DWORD *pdwFormatSize );
  117. extern BOOL ConstructQueuePathName( IN WCHAR *pwsMachineName,
  118. IN WCHAR *pwsQueueName,
  119. OUT WCHAR *pwsPathName,
  120. IN OUT DWORD *pdwSize );
  121. extern BOOL ConstructPrivateQueuePathName( IN WCHAR *pwsMachineName,
  122. IN WCHAR *pwsQueueName,
  123. OUT WCHAR *pwsPathName,
  124. IN OUT DWORD *pdwSize );
  125. extern HRESULT ClearQueue( QUEUEHANDLE hQueue );
  126. extern BOOL ParseQueuePathName(
  127. IN WCHAR *pwsPathName,
  128. OUT WCHAR wsMachineName[MAX_COMPUTERNAME_LEN],
  129. OUT WCHAR wsQueueName[MQ_MAX_Q_NAME_LEN] );
  130. #ifdef MAJOR_DEBUG
  131. extern void DbgPrintPacket( unsigned char *pPacket );
  132. #endif
  133. //
  134. // The Svr... functions are defined in ..\falcons\mqsvr.c
  135. extern HRESULT SvrSetupQueue( IN MQ_INFO *pEP,
  136. IN WCHAR *pwsSvrMachine,
  137. IN WCHAR *pwsEndpoint,
  138. IN unsigned long ulEndpointFlags );
  139. extern HRESULT SvrPeekQueue( IN MQ_INFO *pInfo,
  140. IN DWORD timeoutMsec,
  141. OUT ULONG *pdwBufferSize );
  142. extern HRESULT SvrReceiveFromQueue( IN MQ_INFO *pInfo,
  143. IN DWORD timeoutMsec,
  144. OUT MQ_ADDRESS *pAddress,
  145. OUT UCHAR *pBuffer,
  146. IN OUT DWORD *pdwBufferSize );
  147. extern HRESULT SvrSendToQueue( IN MQ_INFO *pInfo,
  148. IN MQ_ADDRESS *pAddress,
  149. IN UCHAR *pBuffer,
  150. IN DWORD dwBufferSize );
  151. extern HRESULT SvrShutdownQueue( IN MQ_INFO *pInfo );
  152. extern HRESULT SvrInitializeHandleMap();
  153. extern HRESULT SvrCloseAllHandles();
  154. //
  155. // The Clnt... functions are defined in mqclnt.c
  156. extern HRESULT ClntSetupQueue( MQ_INFO *pEP,
  157. WCHAR *pwsSvrMachine,
  158. WCHAR *pwsEndpoint );
  159. extern HRESULT ClntSetupAdminQueue( MQ_INFO *pEP );
  160. extern HRESULT ClntReceiveFromQueue( IN MQ_INFO *pInfo,
  161. IN DWORD timeoutMsec,
  162. OUT MQ_ADDRESS *pAddress,
  163. OUT UCHAR *pBuffer,
  164. IN OUT DWORD *pdwBufferSize );
  165. extern HRESULT ClntPeekQueue( IN MQ_INFO *pInfo,
  166. IN DWORD timeoutMsec,
  167. OUT DWORD *pdwBufferSize );
  168. extern HRESULT ClntSendToQueue( IN MQ_INFO *pInfo,
  169. IN MQ_ADDRESS *pAddress,
  170. IN UCHAR *pBuffer,
  171. IN DWORD dwBufferSize );
  172. extern HRESULT ClntShutdownQueue( IN MQ_INFO *pInfo );
  173. extern RPC_STATUS MQ_MapStatusCode( IN HRESULT hr,
  174. IN RPC_STATUS defStatus );
  175. #if FALSE
  176. NOTE: These functions are not currently being used...
  177. extern HRESULT LocateQueueViaQType( IN UUID *pQueueUuid,
  178. OUT WCHAR *pwsFormat,
  179. IN OUT DWORD *pdwFormatSize );
  180. extern HRESULT LocateQueueViaQTypeAndMachine( IN UUID *pQueueUuid,
  181. IN WCHAR *pwsMachine,
  182. OUT WCHAR *pwsFormat,
  183. IN OUT DWORD *pdwFormatSize );
  184. extern HRESULT LocateQueueViaQName( IN WCHAR *pwsQueueName,
  185. OUT WCHAR *pwsFormat,
  186. IN OUT DWORD *pdwFormatSize );
  187. extern HRESULT LocateQueueViaQNameAndMachine( IN WCHAR *pwsQName,
  188. IN WCHAR *pwsMachine,
  189. OUT WCHAR *pwsFormat,
  190. IN OUT DWORD *pdwFormatSize );
  191. extern BOOL FormatNameDirect( IN WCHAR *pwsMachineName,
  192. IN WCHAR *pwsQueueName,
  193. OUT WCHAR *pwsFormatName,
  194. IN OUT DWORD *pdwSize );
  195. #endif
  196. #endif