transact.idl
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:15k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //-----------------------------------------------------------------------------
  2. // File: transact.idl
  3. //
  4. // Copyright: Copyright (c) Microsoft Corporation          
  5. //
  6. // Contents:  The basic transaction interfaces and types.
  7. //
  8. // Comments: 
  9. //
  10. //-----------------------------------------------------------------------------
  11. cpp_quote("//-----------------------------------------------------------------------------")
  12. cpp_quote("// File: .C or .H file generated by transact.idl ")
  13. cpp_quote("//")
  14. cpp_quote("// Copyright: Copyright (c) 1998-1999 Microsoft Corporation")
  15. cpp_quote("//")
  16. cpp_quote("// Contents:  .C or .H file generated by transact.idl")
  17. cpp_quote("//")
  18. cpp_quote("// Comments:  Microsoft OLE DB")
  19. cpp_quote("//")
  20. cpp_quote("//-----------------------------------------------------------------------------")
  21. cpp_quote("")
  22. import "unknwn.idl";
  23. //
  24. //--------------------------------------------------------------------------
  25. //
  26. interface ITransaction;
  27. interface ITransactionDispenser;
  28. interface ITransactionOptions;
  29. interface ITransactionOutcomeEvents;
  30. interface ITransactionCompletionEvents;
  31. cpp_quote("#ifndef DECLSPEC_UUID")
  32. cpp_quote("#if _MSC_VER >= 1100")
  33. cpp_quote("#define DECLSPEC_UUID(x)    __declspec(uuid(x))")
  34. cpp_quote("#else")
  35. cpp_quote("#define DECLSPEC_UUID(x)")
  36. cpp_quote("#endif")
  37. cpp_quote("#endif")
  38. //==========================================================================
  39. // Transaction related types
  40. //==========================================================================
  41. [local,pointer_default(unique)]
  42. interface BasicTransactionTypes
  43.     {
  44. typedef struct BOID {
  45.         byte rgb[16];
  46.         } BOID;
  47.     cpp_quote("#define BOID_NULL (*((BOID*)(&IID_NULL)))")
  48. // change the following two line together
  49.     cpp_quote("#ifndef MAX_TRAN_DESC_DEFINED")         // conflicts with uimsg.h. This is temporary work around
  50.     cpp_quote("#define MAX_TRAN_DESC_DEFINED")
  51.     typedef enum TX_MISC_CONSTANTS
  52.         {
  53.         MAX_TRAN_DESC                   = 40
  54.         } TX_MISC_CONSTANTS;
  55.     cpp_quote("#endif")
  56. // Unit Of Work.
  57.     typedef BOID XACTUOW;
  58. // Data type for isolation level values.
  59.     typedef LONG ISOLEVEL;
  60. // Constants that specifiy isolation level of a transaction.
  61.     typedef enum ISOLATIONLEVEL {
  62.         ISOLATIONLEVEL_UNSPECIFIED      = 0xFFFFFFFF, // 
  63.         ISOLATIONLEVEL_CHAOS            = 0x00000010, // 
  64.         ISOLATIONLEVEL_READUNCOMMITTED  = 0x00000100, // 
  65.         ISOLATIONLEVEL_BROWSE           = 0x00000100,   // Synonym for _READUNCOMITTED
  66.         ISOLATIONLEVEL_CURSORSTABILITY  = 0x00001000, // 
  67.         ISOLATIONLEVEL_READCOMMITTED    = 0x00001000,   // Synonym for _CURSORSTABILITY
  68.         ISOLATIONLEVEL_REPEATABLEREAD   = 0x00010000, // 
  69.         ISOLATIONLEVEL_SERIALIZABLE     = 0x00100000, // 
  70.         ISOLATIONLEVEL_ISOLATED         = 0x00100000,   // Synonym for _SERIALIZABLE
  71.         } ISOLATIONLEVEL; 
  72. // Transaction information structure, used in ITransaction
  73.     typedef struct XACTTRANSINFO {
  74.         XACTUOW     uow;                        // The current unit of work
  75.         ISOLEVEL    isoLevel;                   // The isolation level for the current UOW
  76.         ULONG       isoFlags;                   // Values from ISOFLAG enumeration
  77.         DWORD       grfTCSupported;             // Flags indicating capabilities
  78.         DWORD       grfRMSupported;             //       ... of this transaction wrt
  79.         DWORD       grfTCSupportedRetaining;    //       ... parameters to Commit
  80.         DWORD       grfRMSupportedRetaining;    //       ...
  81.         } XACTTRANSINFO;
  82.     typedef struct XACTSTATS {
  83.         ULONG       cOpen;              // The number of currently extant transactions.
  84.         ULONG       cCommitting;        // The number of transactions which are proceding towards committing.
  85.         ULONG       cCommitted;         // The number of transactions that are have been committed.
  86.         ULONG       cAborting;          // The number of transactions which are in the process of aborting.
  87.         ULONG       cAborted;           // The number of transactions that are have been aborted.
  88.         ULONG       cInDoubt;           // The number of transactions which are presently in doubt.
  89.         ULONG       cHeuristicDecision; // The number of transactions that have completed by heuristic decision.
  90.         FILETIME    timeTransactionsUp; // The amount of time that this transaction service has been up.
  91.         } XACTSTATS;
  92. // @enum ISOFLAG | Used in <t XACTTRANSINFO> and <i ITransactionDispenser>.
  93.     typedef enum ISOFLAG { 
  94.         ISOFLAG_RETAIN_COMMIT_DC    = 1,    // Use just one of ISOFLAG_RETAIN_COMMIT values
  95.         ISOFLAG_RETAIN_COMMIT       = 2, // 
  96.         ISOFLAG_RETAIN_COMMIT_NO    = 3, // 
  97.         ISOFLAG_RETAIN_ABORT_DC     = 4,    // Use just one of ISOFLAG_RETAIN_ABORT values
  98.         ISOFLAG_RETAIN_ABORT        = 8, // 
  99.         ISOFLAG_RETAIN_ABORT_NO     = 12, // 
  100.         ISOFLAG_RETAIN_DONTCARE     = ISOFLAG_RETAIN_COMMIT_DC | ISOFLAG_RETAIN_ABORT_DC, // 
  101.         ISOFLAG_RETAIN_BOTH         = ISOFLAG_RETAIN_COMMIT    | ISOFLAG_RETAIN_ABORT, // 
  102.         ISOFLAG_RETAIN_NONE         = ISOFLAG_RETAIN_COMMIT_NO | ISOFLAG_RETAIN_ABORT_NO, // 
  103.         ISOFLAG_OPTIMISTIC          = 16, // 
  104.         ISOFLAG_READONLY         = 32 // 
  105.         } ISOFLAG;
  106. // Used in ITransactionDispenser
  107. // A bit field of 32 bits; be sure to mask before comparing.
  108.     typedef enum XACTTC {       
  109.         XACTTC_SYNC_PHASEONE    = 1,
  110.         XACTTC_SYNC_PHASETWO    = 2,
  111.         XACTTC_SYNC             = 2,  // nb alias for XACTTC_SYNC_PHASETWO
  112.         XACTTC_ASYNC_PHASEONE   = 4,
  113.         XACTTC_ASYNC            = 4     // nb alias for XACTTC_ASYNC_PHASEONE
  114.         } XACTTC;
  115. // Used in ITransactionDispenser
  116. // A bit field of 32 bits; be sure to mask before comparing.
  117.     
  118.     typedef enum XACTRM {       
  119.         XACTRM_OPTIMISTICLASTWINS = 1, //
  120.         XACTRM_NOREADONLYPREPARES = 2,  //
  121.         } XACTRM;
  122.     typedef enum XACTCONST {
  123.         XACTCONST_TIMEOUTINFINITE = 0,  //
  124.         } XACTCONST;
  125.     typedef enum XACTHEURISTIC {
  126.         XACTHEURISTIC_ABORT     = 1,
  127.         XACTHEURISTIC_COMMIT    = 2,
  128.         XACTHEURISTIC_DAMAGE    = 3,
  129.         XACTHEURISTIC_DANGER    = 4,
  130.         } XACTHEURISTIC;
  131.     typedef enum XACTSTAT {
  132. XACTSTAT_NONE = 0x00000000,
  133.         XACTSTAT_OPENNORMAL         = 0x00000001,
  134.         XACTSTAT_OPENREFUSED        = 0x00000002,
  135.         XACTSTAT_PREPARING          = 0x00000004,
  136.         XACTSTAT_PREPARED           = 0x00000008,
  137.         XACTSTAT_PREPARERETAINING   = 0x00000010,
  138.         XACTSTAT_PREPARERETAINED    = 0x00000020,
  139.         XACTSTAT_COMMITTING         = 0x00000040,
  140.         XACTSTAT_COMMITRETAINING    = 0x00000080,
  141.         XACTSTAT_ABORTING           = 0x00000100,
  142.         XACTSTAT_ABORTED            = 0x00000200,
  143.         XACTSTAT_COMMITTED          = 0x00000400,
  144.         XACTSTAT_HEURISTIC_ABORT    = 0x00000800,
  145.         XACTSTAT_HEURISTIC_COMMIT   = 0x00001000,
  146.         XACTSTAT_HEURISTIC_DAMAGE   = 0x00002000,
  147.         XACTSTAT_HEURISTIC_DANGER   = 0x00004000,
  148.         XACTSTAT_FORCED_ABORT       = 0x00008000,
  149.         XACTSTAT_FORCED_COMMIT      = 0x00010000,
  150.         XACTSTAT_INDOUBT            = 0x00020000,
  151.         XACTSTAT_CLOSED             = 0x00040000,
  152.         XACTSTAT_OPEN               = 0x00000003, 
  153.         XACTSTAT_NOTPREPARED        = 0x0007FFC3,
  154.         XACTSTAT_ALL                = 0x0007FFFF,
  155.         } XACTSTAT;
  156.    
  157.     typedef struct XACTOPT {                        // Transaction configuration options
  158.         ULONG       ulTimeout;                      // timeout in milliseconds
  159.         char szDescription[MAX_TRAN_DESC];   // description string for admin tools
  160.         } XACTOPT;
  161.     
  162.     
  163.     //
  164.     //==========================================================================
  165.     // Error code definitions for all transaction related functionality.
  166.     //==========================================================================
  167.     //
  168. /*
  169.     typedef enum XACT_E {
  170.         XACT_E_FIRST                = 0x8004D000,
  171.         XACT_E_LAST                 = 0x8004D022,
  172.         XACT_S_FIRST                = 0x0004D000,
  173.         XACT_S_LAST                 = 0x0004D009,
  174.         XACT_E_ALREADYOTHERSINGLEPHASE = 0x8004D000,
  175.         XACT_E_CANTRETAIN           = 0x8004D001,
  176.         XACT_E_COMMITFAILED         = 0x8004D002,
  177.         XACT_E_COMMITPREVENTED      = 0x8004D003,
  178.         XACT_E_HEURISTICABORT       = 0x8004D004,
  179.         XACT_E_HEURISTICCOMMIT      = 0x8004D005,
  180.         XACT_E_HEURISTICDAMAGE      = 0x8004D006,
  181.         XACT_E_HEURISTICDANGER      = 0x8004D007,
  182.         XACT_E_ISOLATIONLEVEL       = 0x8004D008,
  183.         XACT_E_NOASYNC              = 0x8004D009,
  184.         XACT_E_NOENLIST             = 0x8004D00A,
  185.         XACT_E_NOISORETAIN          = 0x8004D00B,
  186.         XACT_E_NORESOURCE           = 0x8004D00C,
  187.         XACT_E_NOTCURRENT           = 0x8004D00D,
  188.         XACT_E_NOTRANSACTION        = 0x8004D00E,
  189.         XACT_E_NOTSUPPORTED         = 0x8004D00F,
  190.         XACT_E_UNKNOWNRMGRID        = 0x8004D010,
  191.         XACT_E_WRONGSTATE           = 0x8004D011,
  192.         XACT_E_WRONGUOW             = 0x8004D012,
  193.         XACT_E_XTIONEXISTS          = 0x8004D013,
  194.         XACT_E_NOIMPORTOBJECT       = 0x8004D014,
  195.         XACT_E_INVALIDCOOKIE        = 0x8004D015,
  196.         XACT_E_INDOUBT              = 0x8004D016,
  197.         XACT_E_NOTIMEOUT            = 0x8004D017,
  198.         XACT_E_ALREADYINPROGRESS    = 0x8004D018,
  199.         XACT_E_ABORTED              = 0x8004D019,
  200.         XACT_E_LOGFULL              = 0x8004D01A,
  201.         XACT_E_TMNOTAVAILABLE       = 0x8004D01B,
  202.         XACT_E_CONNECTION_DOWN      = 0x8004D01C,
  203.         XACT_E_CONNECTION_DENIED    = 0x8004D01D,
  204.         XACT_E_REENLISTTIMEOUT      = 0x8004D01E,
  205. XACT_E_TIP_CONNECT_FAILED = 0x8004D01F,
  206. XACT_E_TIP_PROTOCOL_ERROR = 0x8004D020,
  207. XACT_E_TIP_PULL_FAILED = 0x8004D021,
  208. XACT_E_DEST_TMNOTAVAILABLE = 0x8004D022,
  209. // TXF log & CRM
  210. XACT_E_CLERKNOTFOUND = 0x8004d080,
  211. XACT_E_CLERKEXISTS = 0x8004d081,
  212. XACT_E_RECOVERYINPROGRESS = 0x8004d082,
  213. XACT_E_TRANSACTIONCLOSED = 0x8004d083,
  214. XACT_E_INVALIDLSN = 0x8004d084,
  215. XACT_E_REPLAYREQUEST = 0x8004d085,
  216.         XACT_S_ASYNC                = 0x0004D000,
  217.         XACT_S_DEFECT               = 0x0004D001,
  218.         XACT_S_READONLY             = 0x0004D002,
  219.         XACT_S_SOMENORETAIN         = 0x0004D003,
  220.         XACT_S_OKINFORM             = 0x0004D004,
  221.         XACT_S_MADECHANGESCONTENT   = 0x0004D005,
  222.         XACT_S_MADECHANGESINFORM    = 0x0004D006, 
  223.         XACT_S_ALLNORETAIN          = 0x0004D007,
  224.         XACT_S_ABORTING             = 0x0004D008,
  225.         XACT_S_SINGLEPHASE          = 0x0004D009,
  226.         } XACT_E;
  227. */
  228.     }
  229.     
  230. //
  231. //==========================================================================
  232. // Basic transaction interfaces
  233. //==========================================================================
  234. //
  235. // Transaction interface, single phase
  236. [object,uuid(0fb15084-af41-11ce-bd2b-204c4f4f5020), pointer_default(unique)]
  237. interface ITransaction : IUnknown {
  238.     HRESULT Commit
  239.         (
  240.         [in] BOOL  fRetaining, 
  241.         [in] DWORD grfTC,
  242.         [in] DWORD grfRM
  243.         );
  244.     HRESULT Abort
  245.         (
  246.         [in, unique] BOID* pboidReason,
  247.         [in]         BOOL  fRetaining,
  248.         [in]         BOOL  fAsync
  249.         );
  250.     HRESULT GetTransactionInfo
  251.         (
  252.         [out] XACTTRANSINFO* pinfo
  253.         );
  254.     }
  255. //
  256. //--------------------------------------------------------------------------
  257. //
  258. // Interface by which new transactions are commonly created
  259. [object,uuid(3A6AD9E1-23B9-11cf-AD60-00AA00A74CCD),pointer_default(unique)]
  260. interface ITransactionDispenser : IUnknown {
  261.     HRESULT GetOptionsObject
  262.         (
  263.         [out] ITransactionOptions** ppOptions
  264.         );
  265.     HRESULT BeginTransaction
  266.         (
  267.         [in, unique]    IUnknown*      punkOuter,             // controlling unknown
  268.         [in]            ISOLEVEL       isoLevel,              // isolation level for xtion
  269.         [in]            ULONG          isoFlags,              // values from ISOFLAG enumeration
  270.         [in, unique]    ITransactionOptions* pOptions,        // pointer retrieved from previous GetOptions
  271.         [out]           ITransaction** ppTransaction
  272.         );
  273.     }
  274. //
  275. //--------------------------------------------------------------------------
  276. //
  277. [object,uuid(3A6AD9E0-23B9-11cf-AD60-00AA00A74CCD),pointer_default(unique)]
  278. interface ITransactionOptions : IUnknown {
  279.     HRESULT SetOptions
  280.         (
  281.         [in]  XACTOPT* pOptions
  282.         );
  283.     HRESULT GetOptions
  284.         (
  285.         [in,out]  XACTOPT* pOptions
  286.         );
  287.     }
  288. //
  289. //--------------------------------------------------------------------------
  290. //
  291. [object,uuid(3A6AD9E2-23B9-11cf-AD60-00AA00A74CCD),pointer_default(unique)]
  292. interface ITransactionOutcomeEvents : IUnknown {
  293. HRESULT Committed
  294.     (
  295.     [in]            BOOL       fRetaining, 
  296.     [in, unique]    XACTUOW*   pNewUOW,
  297.         [in]            HRESULT    hr
  298.     );
  299. HRESULT Aborted
  300.     (
  301.     [in, unique]    BOID*      pboidReason,
  302.         [in]            BOOL       fRetaining, 
  303.     [in, unique]    XACTUOW*   pNewUOW,
  304.         [in]            HRESULT    hr
  305.     );
  306. HRESULT HeuristicDecision
  307.     (
  308.     [in]            DWORD      dwDecision, 
  309.     [in, unique]    BOID*      pboidReason,
  310.         [in]            HRESULT    hr
  311.     );
  312. HRESULT Indoubt
  313.     (
  314. void
  315.     );
  316. }
  317. cpp_quote("")
  318. cpp_quote("")
  319. cpp_quote("#if _MSC_VER < 1100 || !defined(__cplusplus)")
  320. cpp_quote("")
  321. cpp_quote("DEFINE_GUID(IID_ITransaction, 0x0fb15084, 0xaf41, 0x11ce, 0xbd, 0x2b, 0x20, 0x4c, 0x4f, 0x4f, 0x50, 0x20);")
  322. cpp_quote("DEFINE_GUID(IID_ITransactionDispenser, 0x3A6AD9E1, 0x23B9, 0x11cf, 0xAD, 0x60, 0x00, 0xAA, 0x00, 0xA7, 0x4C, 0xCD);")
  323. cpp_quote("DEFINE_GUID(IID_ITransactionOptions, 0x3A6AD9E0, 0x23B9, 0x11cf, 0xAD, 0x60, 0x00, 0xAA, 0x00, 0xA7, 0x4C, 0xCD);")
  324. cpp_quote("DEFINE_GUID(IID_ITransactionOutcomeEvents, 0x3A6AD9E2, 0x23B9, 0x11cf, 0xAD, 0x60, 0x00, 0xAA, 0x00, 0xA7, 0x4C, 0xCD);")
  325. cpp_quote("")
  326. cpp_quote("#else")
  327. cpp_quote("")
  328. cpp_quote("#define  IID_ITransaction                    __uuidof(ITransaction)")
  329. cpp_quote("#define  IID_ITransactionDispenser           __uuidof(ITransactionDispenser)")
  330. cpp_quote("#define  IID_ITransactionOptions             __uuidof(ITransactionOptions)")
  331. cpp_quote("#define  IID_ITransactionOutcomeEvents       __uuidof(ITransactionOutcomeEvents)")
  332. cpp_quote("")
  333. cpp_quote("#endif")