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.

260 lines
10 KiB

  1. //.-------------------------------------------------------------------------
  2. //.
  3. //. Microsoft Windows
  4. //. Copyright (C) 1995-2001 Microsoft Corporation
  5. //.
  6. //. File: transact.idl
  7. //.
  8. //. Contents: The basic transaction interfaces and types.
  9. //.
  10. //.--------------------------------------------------------------------------
  11. import "unknwn.idl";
  12. //
  13. //--------------------------------------------------------------------------
  14. //
  15. interface ITransaction;
  16. cpp_quote("#ifndef DECLSPEC_UUID")
  17. cpp_quote("#if _MSC_VER >= 1100")
  18. cpp_quote("#define DECLSPEC_UUID(x) __declspec(uuid(x))")
  19. cpp_quote("#else")
  20. cpp_quote("#define DECLSPEC_UUID(x)")
  21. cpp_quote("#endif")
  22. cpp_quote("#endif")
  23. //==========================================================================
  24. // Transaction related types
  25. //==========================================================================
  26. [local,pointer_default(unique)]
  27. interface BasicTransactionTypes
  28. {
  29. typedef struct BOID {
  30. byte rgb[16];
  31. } BOID;
  32. cpp_quote("#define BOID_NULL (*((BOID*)(&IID_NULL)))")
  33. // change the following two line together
  34. cpp_quote("#ifndef MAX_TRAN_DESC_DEFINED") // conflicts with uimsg.h. This is temporary work around
  35. cpp_quote("#define MAX_TRAN_DESC_DEFINED")
  36. typedef enum TX_MISC_CONSTANTS
  37. {
  38. MAX_TRAN_DESC = 40
  39. } TX_MISC_CONSTANTS;
  40. cpp_quote("#endif")
  41. // Unit Of Work.
  42. typedef BOID XACTUOW;
  43. // Data type for isolation level values.
  44. typedef LONG ISOLEVEL;
  45. // Constants that specifiy isolation level of a transaction.
  46. typedef enum ISOLATIONLEVEL {
  47. ISOLATIONLEVEL_UNSPECIFIED = 0xFFFFFFFF, //
  48. ISOLATIONLEVEL_CHAOS = 0x00000010, //
  49. ISOLATIONLEVEL_READUNCOMMITTED = 0x00000100, //
  50. ISOLATIONLEVEL_BROWSE = 0x00000100, // Synonym for _READUNCOMITTED
  51. ISOLATIONLEVEL_CURSORSTABILITY = 0x00001000, //
  52. ISOLATIONLEVEL_READCOMMITTED = 0x00001000, // Synonym for _CURSORSTABILITY
  53. ISOLATIONLEVEL_REPEATABLEREAD = 0x00010000, //
  54. ISOLATIONLEVEL_SERIALIZABLE = 0x00100000, //
  55. ISOLATIONLEVEL_ISOLATED = 0x00100000, // Synonym for _SERIALIZABLE
  56. } ISOLATIONLEVEL;
  57. // Transaction information structure, used in ITransaction
  58. typedef struct XACTTRANSINFO {
  59. XACTUOW uow; // The current unit of work
  60. ISOLEVEL isoLevel; // The isolation level for the current UOW
  61. ULONG isoFlags; // Values from ISOFLAG enumeration
  62. DWORD grfTCSupported; // Flags indicating capabilities
  63. DWORD grfRMSupported; // ... of this transaction wrt
  64. DWORD grfTCSupportedRetaining; // ... parameters to Commit
  65. DWORD grfRMSupportedRetaining; // ...
  66. } XACTTRANSINFO;
  67. typedef struct XACTSTATS {
  68. ULONG cOpen; // The number of currently extant transactions.
  69. ULONG cCommitting; // The number of transactions which are proceding towards committing.
  70. ULONG cCommitted; // The number of transactions that are have been committed.
  71. ULONG cAborting; // The number of transactions which are in the process of aborting.
  72. ULONG cAborted; // The number of transactions that are have been aborted.
  73. ULONG cInDoubt; // The number of transactions which are presently in doubt.
  74. ULONG cHeuristicDecision; // The number of transactions that have completed by heuristic decision.
  75. FILETIME timeTransactionsUp; // The amount of time that this transaction service has been up.
  76. } XACTSTATS;
  77. // @enum ISOFLAG | Used in <t XACTTRANSINFO> and <i ITransactionDispenser>.
  78. typedef enum ISOFLAG {
  79. ISOFLAG_RETAIN_COMMIT_DC = 1, // Use just one of ISOFLAG_RETAIN_COMMIT values
  80. ISOFLAG_RETAIN_COMMIT = 2, //
  81. ISOFLAG_RETAIN_COMMIT_NO = 3, //
  82. ISOFLAG_RETAIN_ABORT_DC = 4, // Use just one of ISOFLAG_RETAIN_ABORT values
  83. ISOFLAG_RETAIN_ABORT = 8, //
  84. ISOFLAG_RETAIN_ABORT_NO = 12, //
  85. ISOFLAG_RETAIN_DONTCARE = ISOFLAG_RETAIN_COMMIT_DC | ISOFLAG_RETAIN_ABORT_DC, //
  86. ISOFLAG_RETAIN_BOTH = ISOFLAG_RETAIN_COMMIT | ISOFLAG_RETAIN_ABORT, //
  87. ISOFLAG_RETAIN_NONE = ISOFLAG_RETAIN_COMMIT_NO | ISOFLAG_RETAIN_ABORT_NO, //
  88. ISOFLAG_OPTIMISTIC = 16, //
  89. ISOFLAG_READONLY = 32 //
  90. } ISOFLAG;
  91. // Used in ITransactionDispenser
  92. // A bit field of 32 bits; be sure to mask before comparing.
  93. typedef enum XACTTC {
  94. XACTTC_SYNC_PHASEONE = 1,
  95. XACTTC_SYNC_PHASETWO = 2,
  96. XACTTC_SYNC = 2, // nb alias for XACTTC_SYNC_PHASETWO
  97. XACTTC_ASYNC_PHASEONE = 4,
  98. XACTTC_ASYNC = 4 // nb alias for XACTTC_ASYNC_PHASEONE
  99. } XACTTC;
  100. // Used in ITransactionDispenser
  101. // A bit field of 32 bits; be sure to mask before comparing.
  102. typedef enum XACTRM {
  103. XACTRM_OPTIMISTICLASTWINS = 1, //
  104. XACTRM_NOREADONLYPREPARES = 2, //
  105. } XACTRM;
  106. typedef enum XACTCONST {
  107. XACTCONST_TIMEOUTINFINITE = 0, //
  108. } XACTCONST;
  109. typedef enum XACTHEURISTIC {
  110. XACTHEURISTIC_ABORT = 1,
  111. XACTHEURISTIC_COMMIT = 2,
  112. XACTHEURISTIC_DAMAGE = 3,
  113. XACTHEURISTIC_DANGER = 4,
  114. } XACTHEURISTIC;
  115. typedef enum XACTSTAT {
  116. XACTSTAT_NONE = 0x00000000,
  117. XACTSTAT_OPENNORMAL = 0x00000001,
  118. XACTSTAT_OPENREFUSED = 0x00000002,
  119. XACTSTAT_PREPARING = 0x00000004,
  120. XACTSTAT_PREPARED = 0x00000008,
  121. XACTSTAT_PREPARERETAINING = 0x00000010,
  122. XACTSTAT_PREPARERETAINED = 0x00000020,
  123. XACTSTAT_COMMITTING = 0x00000040,
  124. XACTSTAT_COMMITRETAINING = 0x00000080,
  125. XACTSTAT_ABORTING = 0x00000100,
  126. XACTSTAT_ABORTED = 0x00000200,
  127. XACTSTAT_COMMITTED = 0x00000400,
  128. XACTSTAT_HEURISTIC_ABORT = 0x00000800,
  129. XACTSTAT_HEURISTIC_COMMIT = 0x00001000,
  130. XACTSTAT_HEURISTIC_DAMAGE = 0x00002000,
  131. XACTSTAT_HEURISTIC_DANGER = 0x00004000,
  132. XACTSTAT_FORCED_ABORT = 0x00008000,
  133. XACTSTAT_FORCED_COMMIT = 0x00010000,
  134. XACTSTAT_INDOUBT = 0x00020000,
  135. XACTSTAT_CLOSED = 0x00040000,
  136. XACTSTAT_OPEN = 0x00000003,
  137. XACTSTAT_NOTPREPARED = 0x0007FFC3,
  138. XACTSTAT_ALL = 0x0007FFFF,
  139. } XACTSTAT;
  140. typedef struct XACTOPT { // Transaction configuration options
  141. ULONG ulTimeout; // timeout in milliseconds
  142. char szDescription[MAX_TRAN_DESC]; // description string for admin tools
  143. } XACTOPT;
  144. //
  145. //==========================================================================
  146. // Error code definitions for all transaction related functionality.
  147. //==========================================================================
  148. //
  149. typedef enum XACT_E {
  150. XACT_E_FIRST = 0x8004D000,
  151. XACT_E_LAST = 0x8004D01E,
  152. XACT_S_FIRST = 0x0004D000,
  153. XACT_S_LAST = 0x0004D009,
  154. XACT_E_ALREADYOTHERSINGLEPHASE = 0x8004D000,
  155. XACT_E_CANTRETAIN = 0x8004D001,
  156. XACT_E_COMMITFAILED = 0x8004D002,
  157. XACT_E_COMMITPREVENTED = 0x8004D003,
  158. XACT_E_HEURISTICABORT = 0x8004D004,
  159. XACT_E_HEURISTICCOMMIT = 0x8004D005,
  160. XACT_E_HEURISTICDAMAGE = 0x8004D006,
  161. XACT_E_HEURISTICDANGER = 0x8004D007,
  162. XACT_E_ISOLATIONLEVEL = 0x8004D008,
  163. XACT_E_NOASYNC = 0x8004D009,
  164. XACT_E_NOENLIST = 0x8004D00A,
  165. XACT_E_NOISORETAIN = 0x8004D00B,
  166. XACT_E_NORESOURCE = 0x8004D00C,
  167. XACT_E_NOTCURRENT = 0x8004D00D,
  168. XACT_E_NOTRANSACTION = 0x8004D00E,
  169. XACT_E_NOTSUPPORTED = 0x8004D00F,
  170. XACT_E_UNKNOWNRMGRID = 0x8004D010,
  171. XACT_E_WRONGSTATE = 0x8004D011,
  172. XACT_E_WRONGUOW = 0x8004D012,
  173. XACT_E_XTIONEXISTS = 0x8004D013,
  174. XACT_E_NOIMPORTOBJECT = 0x8004D014,
  175. XACT_E_INVALIDCOOKIE = 0x8004D015,
  176. XACT_E_INDOUBT = 0x8004D016,
  177. XACT_E_NOTIMEOUT = 0x8004D017,
  178. XACT_E_ALREADYINPROGRESS = 0x8004D018,
  179. XACT_E_ABORTED = 0x8004D019,
  180. XACT_E_LOGFULL = 0x8004D01A,
  181. XACT_E_TMNOTAVAILABLE = 0x8004D01B,
  182. XACT_E_CONNECTION_DOWN = 0x8004D01C,
  183. XACT_E_CONNECTION_DENIED = 0x8004D01D,
  184. XACT_E_REENLISTTIMEOUT = 0x8004D01E,
  185. XACT_S_ASYNC = 0x0004D000,
  186. XACT_S_DEFECT = 0x0004D001,
  187. XACT_S_READONLY = 0x0004D002,
  188. XACT_S_SOMENORETAIN = 0x0004D003,
  189. XACT_S_OKINFORM = 0x0004D004,
  190. XACT_S_MADECHANGESCONTENT = 0x0004D005,
  191. XACT_S_MADECHANGESINFORM = 0x0004D006,
  192. XACT_S_ALLNORETAIN = 0x0004D007,
  193. XACT_S_ABORTING = 0x0004D008,
  194. XACT_S_SINGLEPHASE = 0x0004D009,
  195. } XACT_E;
  196. }
  197. //
  198. //==========================================================================
  199. // Basic transaction interfaces
  200. //==========================================================================
  201. //
  202. // Transaction interface, single phase
  203. [object,uuid(0fb15084-af41-11ce-bd2b-204c4f4f5020), pointer_default(unique)]
  204. interface ITransaction : IUnknown {
  205. HRESULT Commit
  206. (
  207. [in] BOOL fRetaining,
  208. [in] DWORD grfTC,
  209. [in] DWORD grfRM
  210. );
  211. HRESULT Abort
  212. (
  213. [in, unique] BOID* pboidReason,
  214. [in] BOOL fRetaining,
  215. [in] BOOL fAsync
  216. );
  217. HRESULT GetTransactionInfo
  218. (
  219. [out] XACTTRANSINFO* pinfo
  220. );
  221. }