home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / rmfacade.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  5KB  |  171 lines

  1. /* ----------------------------------------------------------------------------
  2. Microsoft    D.T.C (Distributed Transaction Coordinator)
  3.  
  4. (c)    1996    Microsoft Corporation.    All Rights Reserved
  5.  
  6. @doc
  7.  
  8. @module        RMFacade.h    |
  9.  
  10.             Contains helper API and interfaces for RMFacade which faciliates
  11.             OLE TX to XA protocol mapping
  12.  
  13. -------------------------------------------------------------------------------
  14. @rev     0     | 23rd-Nov-1996    |    GaganC        | Created with API
  15. ----------------------------------------------------------------------------- */
  16. #ifndef __RMFACADE_H__
  17. #define __RMFACADE_H__
  18.  
  19.  
  20. //---------------------------------------------------------
  21. //        ALL INCLUDE FILES GO HERE
  22. //---------------------------------------------------------
  23. #include <windows.h>
  24. #include "transact.h"
  25. #include "txcoord.h"
  26. #include "xa.h"
  27.  
  28.  
  29. //---------------------------------------------------------
  30. //            Typedefs
  31. //---------------------------------------------------------
  32. typedef enum _XactStatus
  33.     {
  34.         XACT_STATUS_NONE = 0,        //should never be encountered
  35.         XACT_STATUS_ABORTED,
  36.         XACT_STATUS_COMMITTED,        
  37.         XACT_STATUS_NOT_MY_TRANSACTION,
  38.         XACT_STATUS_TIMEOUT
  39.     } XACT_STATUS;
  40.  
  41.  
  42.  
  43. //---------------------------------------------------------
  44. //            Function Prototypes
  45. //---------------------------------------------------------
  46.  
  47. extern "C"
  48. {
  49.     HRESULT __stdcall GetDtcTxToXaMapperHelper
  50.                                     (
  51.                                      /* [in] */        REFIID riid, 
  52.                                      /* [out] */    void ** ppv
  53.                                     );
  54.  
  55.     HRESULT    __stdcall GetXARMClient 
  56.                                     (
  57.                                      /* [in] */        REFIID riid, 
  58.                                      /* [out] */    void ** ppv
  59.                                     );
  60. } //end all 'C' language API
  61.  
  62.  
  63.  
  64.  
  65. //---------------------------------------------------------
  66. //            ALL Errors Go Here
  67. //---------------------------------------------------------
  68. #define E_FAILED_TO_LOAD_DLL        0x8004D201L
  69.  
  70.  
  71.  
  72. //---------------------------------------------------------
  73. //            All    Interface IIDs go here 
  74. //---------------------------------------------------------
  75.  
  76. //IID_IResourceManagerFacade {EE5FF7B1-4572-11d0-9452-00A0C905416E}
  77. DEFINE_GUID(IID_IResourceManagerFacade, 
  78.             0xee5ff7b1,
  79.             0x4572,
  80.             0x11d0,
  81.             0x94, 0x52, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x6e);
  82.  
  83.  
  84. //IID_IResourceManagerClient {EE5FF7B2-4572-11d0-9452-00A0C905416E}
  85. DEFINE_GUID(IID_IResourceManagerClient, 
  86.             0xee5ff7b2,
  87.             0x4572,
  88.             0x11d0,
  89.             0x94, 0x52, 0x0, 0xa0, 0xc9, 0x5, 0x41, 0x6e);
  90.  
  91.  
  92. //---------------------------------------------------------
  93. //            All    Interfaces go here 
  94. //---------------------------------------------------------
  95.  
  96.  
  97. /* ----------------------------------------------------------------------------
  98. @interface <IResourceManagerFacade>
  99.  
  100.     Implemented by DTC Proxy for use by the client libraries of the XA RMs so 
  101.     they can get the OLE TX to XA Mapping
  102. ---------------------------------------------------------------------------- */
  103. #undef INTERFACE
  104. #define INTERFACE IResourceManagerFacade
  105.  
  106. DECLARE_INTERFACE_ (IResourceManagerFacade, IUnknown)
  107. {
  108.     // IUnknown interface methods:
  109.     STDMETHOD    (QueryInterface)    (THIS_ REFIID riid, LPVOID FAR * ppv) PURE;
  110.      STDMETHOD_    (ULONG, AddRef)        (THIS)     PURE;
  111.      STDMETHOD_    (ULONG, Release)    (THIS)     PURE;
  112.  
  113.     //methods for this interface
  114.     STDMETHOD (CreateNewResourceManager) 
  115.                                 (
  116.                                     /*[in]*/ char * pszDSN,
  117.                                     /*[in]*/ char * pszClientDllName,
  118.                                     /* [in-out] */ DWORD * pdwRMCookie
  119.                                 ) PURE;
  120.  
  121.     STDMETHOD (EnlistOnTransaction)
  122.                                 (
  123.                                     /* [in] */ DWORD dwRMCookie,
  124.                                     /* [in] */ ITransaction * pITransaction,
  125.                                     /* [in-out] */ XID * pxid,
  126.                                     /* [in] */ ITransactionResource * pITransRes
  127.                                 ) PURE;
  128.  
  129.     STDMETHOD (FindTransactionOutcome)
  130.                                 (
  131.                                     /* [in] */ DWORD dwRMCookie,
  132.                                     /* [in] */ XID * pxid,
  133.                                     /* [in-out] */ XACT_STATUS * pXactStatus
  134.                                 ) PURE;
  135.  
  136.     STDMETHOD (RecoveryComplete)
  137.                                 (
  138.                                     /* [in] */ DWORD dwRMCookie
  139.                                 ) PURE;
  140.  
  141. }; //end interface IResourceManagerFacade
  142.  
  143.  
  144.  
  145. /* ----------------------------------------------------------------------------
  146. @interface <IID_IResourceManagerClient>
  147.  
  148.     Implemented by the client libraries of the XA RMs which are providing the
  149.     OLE TX to XA Mapping. This interface will be used by DTC to drive recovery
  150. ---------------------------------------------------------------------------- */
  151. #undef INTERFACE
  152. #define INTERFACE IID_IResourceManagerClient
  153.  
  154. DECLARE_INTERFACE_ (IID_IResourceManagerClient, IUnknown)
  155. {
  156.     // IUnknown interface methods:
  157.     STDMETHOD    (QueryInterface)    (THIS_ REFIID riid, LPVOID FAR * ppv) PURE;
  158.      STDMETHOD_    (ULONG, AddRef)        (THIS)     PURE;
  159.      STDMETHOD_    (ULONG, Release)    (THIS)     PURE;
  160.  
  161.     STDMETHOD (DoRecovery)
  162.                                 (
  163.                                     /* [in] */ DWORD dwRMCookie,
  164.                                     /* [in] */ char * pszDSN
  165.                                 ) PURE;
  166.  
  167. }; //end interface IResourceManagerClient
  168.  
  169.  
  170.  
  171. #endif __RMFACADE_H__