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.

753 lines
17 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation.
  3. All rights reserved.
  4. MODULE NAME:
  5. ismapi.h
  6. ABSTRACT:
  7. Service-to-ISM (Intersite Messaging) service API and
  8. ISM-to-plug-in-transport API.
  9. DETAILS:
  10. CREATED:
  11. 97/11/26 Jeff Parham (jeffparh)
  12. REVISION HISTORY:
  13. --*/
  14. #ifndef __ISMAPI_H__
  15. #define __ISMAPI_H__
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19. // User-defined control
  20. #define ISM_SERVICE_CONTROL_REMOVE_STOP 0x00000080
  21. #ifndef ISM_STRUCTS_DEFINED
  22. #define ISM_STRUCTS_DEFINED
  23. //==============================================================================
  24. //
  25. // ISM_MSG structure contains the message data (as a byte blob).
  26. // Note, this structure is part of the RPC interface for the IP transport
  27. // plug-in. You should not change this structure without renaming it and
  28. // preserving the old one; the old one must continue to be used as part of the
  29. // old IP RPC interface.
  30. //
  31. typedef struct _ISM_MSG {
  32. DWORD cbData;
  33. #ifdef MIDL_PASS
  34. [size_is(cbData)] BYTE * pbData;
  35. #else
  36. BYTE * pbData;
  37. #endif
  38. LPWSTR pszSubject;
  39. } ISM_MSG, *PISM_MSG;
  40. typedef ISM_MSG ISM_MSG_V1, *PISM_MSG_V1;
  41. ////////////////////////////////////////////////////////////////////////////////
  42. //
  43. // ISM_SITE_CONNECTIVITY structure describes how sites are interconnected via
  44. // a specific transport.
  45. //
  46. // The pulCosts element should be interpreted as a multidimensional array.
  47. // pLinkValues[i*cNumSites + j].ulCost is the cost of communication from site
  48. // pSiteDNs[i] to site pSiteDNs[j].
  49. //
  50. typedef struct _ISM_LINK {
  51. ULONG ulCost;
  52. ULONG ulReplicationInterval;
  53. ULONG ulOptions;
  54. } ISM_LINK, *PISM_LINK;
  55. typedef struct _ISM_CONNECTIVITY {
  56. ULONG cNumSites;
  57. #ifdef MIDL_PASS
  58. [ref, size_is(cNumSites)] LPWSTR * ppSiteDNs;
  59. [ref, size_is(cNumSites * cNumSites)] ISM_LINK * pLinkValues;
  60. #else
  61. LPWSTR * ppSiteDNs;
  62. ISM_LINK * pLinkValues;
  63. #endif
  64. } ISM_CONNECTIVITY, *PISM_CONNECTIVITY;
  65. ////////////////////////////////////////////////////////////////////////////////
  66. //
  67. // ISM_SERVER_LIST structure describes a set of servers, identified by DN.
  68. //
  69. typedef struct _ISM_SERVER_LIST {
  70. DWORD cNumServers;
  71. #ifdef MIDL_PASS
  72. [ref, size_is(cNumServers)] LPWSTR * ppServerDNs;
  73. #else
  74. LPWSTR * ppServerDNs;
  75. #endif
  76. } ISM_SERVER_LIST, *PISM_SERVER_LIST;
  77. ////////////////////////////////////////////////////////////////////////////////
  78. //
  79. // ISM_SCHEDULE structure describes a schedule on which two sites are
  80. // connected. The byte stream should be interpreted as a SCHEDULE structure,
  81. // as defined in \nt\public\sdk\inc\schedule.h.
  82. //
  83. typedef struct _ISM_SCHEDULE {
  84. DWORD cbSchedule;
  85. #ifdef MIDL_PASS
  86. [ref, size_is(cbSchedule)] BYTE * pbSchedule;
  87. #else
  88. BYTE * pbSchedule;
  89. #endif
  90. } ISM_SCHEDULE, *PISM_SCHEDULE;
  91. ////////////////////////////////////////////////////////////////////////////////
  92. // Refresh reason codes
  93. typedef enum _ISM_REFRESH_REASON_CODE {
  94. ISM_REFRESH_REASON_RESERVED = 0,
  95. ISM_REFRESH_REASON_TRANSPORT,
  96. ISM_REFRESH_REASON_SITE,
  97. ISM_REFRESH_REASON_MAX // always last
  98. } ISM_REFRESH_REASON_CODE;
  99. // Shutdown reason codes
  100. typedef enum _ISM_SHUTDOWN_REASON_CODE {
  101. ISM_SHUTDOWN_REASON_RESERVED = 0,
  102. ISM_SHUTDOWN_REASON_NORMAL,
  103. ISM_SHUTDOWN_REASON_REMOVAL,
  104. ISM_SHUTDOWN_REASON_MAX // always last
  105. } ISM_SHUTDOWN_REASON_CODE;
  106. #endif // #ifndef ISM_STRUCTS_DEFINED
  107. #ifdef __cplusplus
  108. extern "C" {
  109. #endif
  110. #ifndef MIDL_PASS
  111. //==============================================================================
  112. //
  113. // Service-to-ISM (Intersite Messaging) service API.
  114. //
  115. DWORD
  116. I_ISMSend(
  117. IN const ISM_MSG * pMsg,
  118. IN LPCWSTR pszServiceName,
  119. IN LPCWSTR pszTransportDN,
  120. IN LPCWSTR pszTransportAddress
  121. );
  122. /*++
  123. Routine Description:
  124. Sends a message to a service on a remote machine. If the client specifies a
  125. NULL transport, the lowest cost transport will be used.
  126. Arguments:
  127. pMsg (IN) - The data to send.
  128. pszServiceName (IN) - Service to which to send the message.
  129. pszTransportDN (IN) - The DN of the Inter-Site-Transport object
  130. corresponding to the transport by which the message should be sent.
  131. pszTransportAddress (IN) - The transport-specific address to which to send
  132. the message.
  133. Return Values:
  134. NO_ERROR - Message successfully queued for send.
  135. other - Failure.
  136. --*/
  137. DWORD
  138. I_ISMReceive(
  139. IN LPCWSTR pszServiceName,
  140. IN DWORD dwMsecToWait,
  141. OUT ISM_MSG ** ppMsg
  142. );
  143. /*++
  144. Routine Description:
  145. Receives a message addressed to the given service on the local machine.
  146. If successful and no message is waiting, immediately returns a NULL message.
  147. If a non-NULL message is returned, the caller is responsible for eventually
  148. calling I_ISMFree()'ing the returned message.
  149. Arguments:
  150. pszServiceName (IN) - Service for which to receive the message.
  151. dwMsecToWait (IN) - Milliseconds to wait for message if none is immediately
  152. available; in the range [0, INFINITE].
  153. ppMsg (OUT) - On successful return, holds a pointer to the received message
  154. or NULL.
  155. Return Values:
  156. NO_ERROR - Message successfully returned (or NULL was returned,
  157. indicating no message is waiting).
  158. other - Failure.
  159. --*/
  160. void
  161. I_ISMFree(
  162. IN VOID * pv
  163. );
  164. /*++
  165. Routine Description:
  166. Frees memory allocated on the behalf of the client by I_ISM* APIs.
  167. Arguments:
  168. pv (IN) - Memory to free.
  169. Return Values:
  170. None.
  171. --*/
  172. DWORD
  173. I_ISMGetConnectivity(
  174. IN LPCWSTR pszTransportDN,
  175. OUT ISM_CONNECTIVITY ** ppConnectivity
  176. );
  177. /*++
  178. Routine Description:
  179. Compute the costs associated with transferring data amongst sites via a
  180. specific transport.
  181. On successful return, it is the client's responsibility to eventually call
  182. I_ISMFree(*ppConnectivity);
  183. Arguments:
  184. pszTransportDN (IN) - The transport for which to query costs.
  185. ppConnectivity (OUT) - On successful return, holds a pointer to the
  186. ISM_CONNECTIVITY structure describing the interconnection of sites
  187. along the given transport.
  188. Return Values:
  189. NO_ERROR - Success.
  190. ERROR_* - Failure.
  191. --*/
  192. DWORD
  193. I_ISMGetTransportServers(
  194. IN LPCWSTR pszTransportDN,
  195. IN LPCWSTR pszSiteDN,
  196. OUT ISM_SERVER_LIST ** ppServerList
  197. );
  198. /*++
  199. Routine Description:
  200. Retrieve the DNs of servers in a given site that are capable of sending and
  201. receiving data via a specific transport.
  202. On successful return, it is the client's responsibility to eventually call
  203. I_ISMFree(*ppServerList);
  204. Arguments:
  205. pszTransportDN (IN) - Transport to query.
  206. pszSiteDN (IN) - Site to query.
  207. ppServerList - On successful return, holds a pointer to a structure
  208. containing the DNs of the appropriate servers or NULL. If NULL, any
  209. server with a value for the transport address type attribute can be
  210. used.
  211. Return Values:
  212. NO_ERROR - Success.
  213. ERROR_* - Failure.
  214. --*/
  215. DWORD
  216. I_ISMGetConnectionSchedule(
  217. LPCWSTR pszTransportDN,
  218. LPCWSTR pszSite1DN,
  219. LPCWSTR pszSite2DN,
  220. ISM_SCHEDULE ** ppSchedule
  221. );
  222. /*++
  223. Routine Description:
  224. Retrieve the schedule by which two given sites are connected via a specific
  225. transport.
  226. On successful return, it is the client's responsibility to eventually call
  227. I_ISMFree(*ppSchedule);
  228. Arguments:
  229. pszTransportDN (IN) - Transport to query.
  230. pszSite1DN, pszSite2DN (IN) - Sites to query.
  231. ppSchedule - On successful return, holds a pointer to a structure
  232. describing the schedule by which the two given sites are connected via
  233. the transport, or NULL if the sites are always connected.
  234. Return Values:
  235. NO_ERROR - Success.
  236. ERROR_* - Failure.
  237. --*/
  238. //==============================================================================
  239. //
  240. // ISM-to-plug-in-transport API.
  241. //
  242. typedef void ISM_NOTIFY(
  243. IN HANDLE hNotify,
  244. IN LPCWSTR pszServiceName
  245. );
  246. /*++
  247. Routine Description:
  248. Called by the plug-in to notify the ISM service that a message has been
  249. received for the given service.
  250. Arguments:
  251. hNotify (IN) - Notification handle, as passed to the plug-in in the
  252. IsmStartup() call.
  253. pszServiceName (IN) - Service for which a message was received.
  254. Return Values:
  255. None.
  256. --*/
  257. typedef DWORD ISM_STARTUP(
  258. IN LPCWSTR pszTransportDN,
  259. IN ISM_NOTIFY * pNotifyFunction,
  260. IN HANDLE hNotify,
  261. OUT HANDLE *phIsm
  262. );
  263. ISM_STARTUP IsmStartup;
  264. /*++
  265. Routine Description:
  266. Initialize the plug-in.
  267. Arguments:
  268. pszTransportDN (IN) - The DN of the Inter-Site-Transport that named this
  269. DLL as its plug-in. The DS object may contain additional configuration
  270. information for the transport (e.g., the name of an SMTP server for
  271. an SMTP transport).
  272. pNotifyFunction (IN) - Function to call to notify the ISM service of pending
  273. messages.
  274. hNotify (IN) - Parameter to supply to the notify function.
  275. phIsm (OUT) - On successful return, holds a handle to be used in
  276. future calls to the plug-in for the named Inter-Site-Transport. Note
  277. that it is possible for more than one Inter-Site-Transport object to
  278. name a given DLL as its plug-in, in which case IsmStartup() will be
  279. called for each such object.
  280. Return Values:
  281. NO_ERROR - Successfully initialized.
  282. other - Failure.
  283. --*/
  284. typedef DWORD ISM_REFRESH(
  285. IN HANDLE hIsm,
  286. IN ISM_REFRESH_REASON_CODE eReason,
  287. IN LPCWSTR pszObjectDN OPTIONAL
  288. );
  289. ISM_REFRESH IsmRefresh;
  290. /*++
  291. Routine Description:
  292. Called whenever changes occur according to the reason code.
  293. One reason is to the Inter-Site-Transport object specified in the
  294. IsmStartup() call.
  295. Another is a change to a site in the sites container.
  296. Arguments:
  297. hIsm (IN) - Handle returned by a prior call to IsmStartup().
  298. dwReason (IN) - Dword indicating the reason we were called
  299. pszObjectDN (IN) - Object DN relating to the reason
  300. (Current) DN of the Inter-Site-Transport object that
  301. named this DLL as its plug-in. Note that this DN will differ from that
  302. specified in IsmStartup() if the transport DN has been renamed.
  303. Site DN of site that was added, renamed or deleted
  304. Return Values:
  305. NO_ERROR - Successfully updated.
  306. other - Failure. A failure return implies the plug-in has shut down (i.e.,
  307. no further calls will be made on hIsm, including an
  308. IsmShutdown()).
  309. --*/
  310. typedef DWORD ISM_SEND(
  311. IN HANDLE hIsm,
  312. IN LPCWSTR pszRemoteTransportAddress,
  313. IN LPCWSTR pszServiceName,
  314. IN const ISM_MSG * pMsg
  315. );
  316. ISM_SEND IsmSend;
  317. /*++
  318. Routine Description:
  319. Send a message over this transport.
  320. Arguments:
  321. hIsm (IN) - Handle returned by a prior call to IsmStartup().
  322. pszRemoteTransportAddress (IN) - Transport address of the destination
  323. server.
  324. pszServiceName (IN) - Name of the service on the remote machine that is the
  325. intended receiver of the message.
  326. pMsg (IN) - Message to send.
  327. Return Values:
  328. NO_ERROR - Message successfully queued for send.
  329. other - Failure.
  330. --*/
  331. typedef DWORD ISM_RECEIVE(
  332. IN HANDLE hIsm,
  333. IN LPCWSTR pszServiceName,
  334. OUT ISM_MSG ** ppMsg
  335. );
  336. ISM_RECEIVE IsmReceive;
  337. /*++
  338. Routine Description:
  339. Return the next waiting message (if any). If no message is waiting, a NULL
  340. message is returned. If a non-NULL message is returned, the ISM service
  341. is responsible for calling IsmFreeMsg(hIsm, *ppMsg) when the message is no
  342. longer needed.
  343. If a non-NULL message is returned, it is immediately dequeued. (I.e., once
  344. a message is returned through IsmReceive(), the transport is free to destroy
  345. it.)
  346. Arguments:
  347. hIsm (IN) - Handle returned by a prior call to IsmStartup().
  348. ppMsg (OUT) - On successful return, holds a pointer to the received message
  349. or NULL.
  350. Return Values:
  351. NO_ERROR - Message successfully returned (or NULL was returned,
  352. indicating no message is waiting).
  353. other - Failure.
  354. --*/
  355. typedef void ISM_FREE_MSG(
  356. IN HANDLE hIsm,
  357. IN ISM_MSG * pMsg
  358. );
  359. ISM_FREE_MSG IsmFreeMsg;
  360. /*++
  361. Routine Description:
  362. Frees a message returned by IsmReceive().
  363. Arguments:
  364. hIsm (IN) - Handle returned by a prior call to IsmStartup().
  365. pMsg (IN) - Message to free.
  366. Return Values:
  367. None.
  368. --*/
  369. typedef DWORD ISM_GET_CONNECTIVITY(
  370. IN HANDLE hIsm,
  371. OUT ISM_CONNECTIVITY ** ppConnectivity
  372. );
  373. ISM_GET_CONNECTIVITY IsmGetConnectivity;
  374. /*++
  375. Routine Description:
  376. Compute the costs associated with transferring data amongst sites.
  377. On successful return, the ISM service will eventually call
  378. IsmFreeConnectivity(hIsm, *ppConnectivity);
  379. Arguments:
  380. hIsm (IN) - Handle returned by a prior call to IsmStartup().
  381. ppConnectivity (OUT) - On successful return, holds a pointer to the
  382. ISM_CONNECTIVITY structure describing the interconnection of sites
  383. along this transport.
  384. Return Values:
  385. NO_ERROR - Success.
  386. ERROR_* - Failure.
  387. --*/
  388. typedef void ISM_FREE_CONNECTIVITY(
  389. IN HANDLE hIsm,
  390. IN ISM_CONNECTIVITY * pConnectivity
  391. );
  392. ISM_FREE_CONNECTIVITY IsmFreeConnectivity;
  393. /*++
  394. Routine Description:
  395. Frees the structure returned by IsmGetConnectivity().
  396. Arguments:
  397. hIsm (IN) - Handle returned by a prior call to IsmStartup().
  398. pSiteConnectivity (IN) - Structure to free.
  399. Return Values:
  400. None.
  401. --*/
  402. typedef DWORD ISM_GET_TRANSPORT_SERVERS(
  403. IN HANDLE hIsm,
  404. IN LPCWSTR pszSiteDN,
  405. OUT ISM_SERVER_LIST ** ppServerList
  406. );
  407. ISM_GET_TRANSPORT_SERVERS IsmGetTransportServers;
  408. /*++
  409. Routine Description:
  410. Retrieve the DNs of servers in a given site that are capable of sending and
  411. receiving data via this transport.
  412. On successful return of a non-NULL list, the ISM service will eventually call
  413. IsmFreeTransportServers(hIsm, *ppServerList);
  414. Arguments:
  415. hIsm (IN) - Handle returned by a prior call to IsmStartup().
  416. pszSiteDN (IN) - Site to query.
  417. ppServerList - On successful return, holds a pointer to a structure
  418. containing the DNs of the appropriate servers or NULL. If NULL, any
  419. server with a value for the transport address type attribute can be
  420. used.
  421. Return Values:
  422. NO_ERROR - Success.
  423. ERROR_* - Failure.
  424. --*/
  425. typedef void ISM_FREE_TRANSPORT_SERVERS(
  426. IN HANDLE hIsm,
  427. IN ISM_SERVER_LIST * pServerList
  428. );
  429. ISM_FREE_TRANSPORT_SERVERS IsmFreeTransportServers;
  430. /*++
  431. Routine Description:
  432. Frees the structure returned by IsmGetTransportServers().
  433. Arguments:
  434. hIsm (IN) - Handle returned by a prior call to IsmStartup().
  435. pServerList (IN) - Structure to free.
  436. Return Values:
  437. None.
  438. --*/
  439. typedef DWORD ISM_GET_CONNECTION_SCHEDULE(
  440. IN HANDLE hIsm,
  441. IN LPCWSTR pszSite1DN,
  442. IN LPCWSTR pszSite2DN,
  443. OUT ISM_SCHEDULE ** ppSchedule
  444. );
  445. ISM_GET_CONNECTION_SCHEDULE IsmGetConnectionSchedule;
  446. /*++
  447. Routine Description:
  448. Retrieve the schedule by which two given sites are connected via this
  449. transport.
  450. On successful return, it is the ISM service's responsibility to eventually
  451. call IsmFreeSchedule(*ppSchedule);
  452. Arguments:
  453. hIsm (IN) - Handle returned by a prior call to IsmStartup().
  454. pszSite1DN, pszSite2DN (IN) - Sites to query.
  455. ppSchedule - On successful return, holds a pointer to a structure
  456. describing the schedule by which the two given sites are connected via
  457. the transport, or NULL if the sites are always connected.
  458. Return Values:
  459. NO_ERROR - Success.
  460. ERROR_* - Failure.
  461. --*/
  462. typedef void ISM_FREE_CONNECTION_SCHEDULE(
  463. IN HANDLE hIsm,
  464. IN ISM_SCHEDULE * pSchedule
  465. );
  466. ISM_FREE_CONNECTION_SCHEDULE IsmFreeConnectionSchedule;
  467. /*++
  468. Routine Description:
  469. Frees the structure returned by IsmGetTransportServers().
  470. Arguments:
  471. hIsm (IN) - Handle returned by a prior call to IsmStartup().
  472. pSchedule (IN) - Structure to free.
  473. Return Values:
  474. None.
  475. --*/
  476. typedef void ISM_SHUTDOWN(
  477. IN HANDLE hIsm,
  478. IN ISM_SHUTDOWN_REASON_CODE eReason
  479. );
  480. ISM_SHUTDOWN IsmShutdown;
  481. /*++
  482. Routine Description:
  483. Uninitialize transport plug-in.
  484. Arguments:
  485. hIsm (IN) - Handle returned by a prior call to IsmStartup().
  486. Return Values:
  487. None.
  488. --*/
  489. #endif // #ifndef MIDL_PASS
  490. #ifdef __cplusplus
  491. }
  492. #endif
  493. #endif // __ISMAPI_H__