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.

170 lines
8.2 KiB

  1. // Copyright (C) 1995-1999 Microsoft Corporation. All rights reserved.
  2. /* -----------------------------------------------------------------
  3. * Microsoft Distributed Transaction Coordinator
  4. * Microsoft Corporation, 1995.
  5. *
  6. * File : xa.h
  7. *
  8. * Contents : This file is derived from xa.h as it appears in
  9. * "Distributed Transaction Processing: The XA Specification",
  10. * November 93, X/Open Company Limited.
  11. *
  12. */
  13. /*
  14. * Start of xa.h header
  15. *
  16. * Define a symbol to prevent multiple inclusion of this header file
  17. */
  18. #ifndef XA_H
  19. #define XA_H
  20. /*
  21. * Transaction branch identification: XID and NULLXID:
  22. */
  23. #define XIDDATASIZE 128 /* size in bytes */
  24. #define MAXGTRIDSIZE 64 /* maximum size in bytes of gtrid */
  25. #define MAXBQUALSIZE 64 /* maximum size in bytes of bqual */
  26. #ifndef _XID_T_DEFINED
  27. #define _XID_T_DEFINED
  28. struct xid_t
  29. {
  30. long formatID; /* format identifier */
  31. long gtrid_length; /* value not to exceed 64 */
  32. long bqual_length; /* value not to exceed 64 */
  33. char data[XIDDATASIZE];
  34. };
  35. #endif
  36. typedef struct xid_t XID;
  37. /*
  38. * A value of -1 in formatID means that the XID is null.
  39. */
  40. /*
  41. * Declarations of routines by which RMs call TMs:
  42. */
  43. #ifdef _TMPROTOTYPES
  44. extern int __cdecl ax_reg(int, XID *, long);
  45. extern int __cdecl ax_unreg(int, long);
  46. #else /* ifndef _TMPROTOTYPES */
  47. extern int __cdecl ax_reg();
  48. extern int __cdecl ax_unreg();
  49. #endif /* ifndef _TMPROTOTYPES */
  50. /*
  51. * XA Switch Data Structure
  52. */
  53. #define RMNAMESZ 32 /* length of resource manager name, */
  54. /* including the null terminator */
  55. #define MAXINFOSIZE 256 /* maximum size in bytes of xa_info strings, */
  56. /* including the null terminator */
  57. #ifndef _XA_SWITCH_T_DEFINED
  58. #define _XA_SWITCH_T_DEFINED
  59. struct xa_switch_t
  60. {
  61. char name[RMNAMESZ]; /* name of resource manager */
  62. long flags; /* resource manager specific options */
  63. long version; /* must be 0 */
  64. int (__cdecl *xa_open_entry)(char *, int, long); /* xa_open function pointer */
  65. int (__cdecl *xa_close_entry)(char *, int, long); /* xa_close function pointer*/
  66. int (__cdecl *xa_start_entry)(XID *, int, long); /* xa_start function pointer */
  67. int (__cdecl *xa_end_entry)(XID *, int, long); /* xa_end function pointer */
  68. int (__cdecl *xa_rollback_entry)(XID *, int, long); /* xa_rollback function pointer */
  69. int (__cdecl *xa_prepare_entry)(XID *, int, long); /* xa_prepare function pointer */
  70. int (__cdecl *xa_commit_entry)(XID *, int, long); /* xa_commit function pointer */
  71. int (__cdecl *xa_recover_entry)(XID *, long, int, long);
  72. /* xa_recover function pointer*/
  73. int (__cdecl *xa_forget_entry)(XID *, int, long); /* xa_forget function pointer */
  74. int (__cdecl *xa_complete_entry)(int *, int *, int, long);
  75. /* xa_complete function pointer */
  76. };
  77. typedef struct xa_switch_t xa_switch_t;
  78. #endif
  79. /*
  80. * Flag definitions for the RM switch
  81. */
  82. #define TMNOFLAGS 0x00000000L /* no resource manager features selected */
  83. #define TMREGISTER 0x00000001L /* resource manager dynamically registers */
  84. #define TMNOMIGRATE 0x00000002L /* resource manager does not support association migration */
  85. #define TMUSEASYNC 0x00000004L /* resource manager supports asynchronous operations */
  86. /*
  87. * Flag definitions for xa_ and ax_ routines
  88. */
  89. /* use TMNOFLAGS, defined above, when not specifying other flags */
  90. #define TMASYNC 0x80000000L /* perform routine asynchronously */
  91. #define TMONEPHASE 0x40000000L /* caller is using one-phase commit optimisation */
  92. #define TMFAIL 0x20000000L /* dissociates caller and marks transaction branch rollback-only */
  93. #define TMNOWAIT 0x10000000L /* return if blocking condition exists */
  94. #define TMRESUME 0x08000000L /* caller is resuming association with suspended transaction branch */
  95. #define TMSUCCESS 0x04000000L /* dissociate caller from transaction branch */
  96. #define TMSUSPEND 0x02000000L /* caller is suspending, not ending, association */
  97. #define TMSTARTRSCAN 0x01000000L /* start a recovery scan */
  98. #define TMENDRSCAN 0x00800000L /* end a recovery scan */
  99. #define TMMULTIPLE 0x00400000L /* wait for any asynchronous operation */
  100. #define TMJOIN 0x00200000L /* caller is joining existing transaction branch */
  101. #define TMMIGRATE 0x00100000L /* caller intends to perform migration */
  102. /*
  103. * ax_() return codes (transaction manager reports to resource manager)
  104. */
  105. #define TM_JOIN 2 /* caller is joining existing transaction branch */
  106. #define TM_RESUME 1 /* caller is resuming association with suspended transaction branch */
  107. #define TM_OK 0 /* normal execution */
  108. #define TMER_TMERR (-1) /* an error occurred in the transaction manager */
  109. #define TMER_INVAL (-2) /* invalid arguments were given */
  110. #define TMER_PROTO (-3) /* routine invoked in an improper context */
  111. /*
  112. * xa_() return codes (resource manager reports to transaction manager)
  113. */
  114. #define XA_RBBASE 100 /* The inclusive lower bound of the rollback codes */
  115. #define XA_RBROLLBACK XA_RBBASE /* The rollback was caused by an unspecified reason */
  116. #define XA_RBCOMMFAIL XA_RBBASE+1 /* The rollback was caused by a communication failure */
  117. #define XA_RBDEADLOCK XA_RBBASE+2 /* A deadlock was detected */
  118. #define XA_RBINTEGRITY XA_RBBASE+3 /* A condition that violates the integrity of the resources was detected */
  119. #define XA_RBOTHER XA_RBBASE+4 /* The resource manager rolled back the transaction branch for a reason not on this list */
  120. #define XA_RBPROTO XA_RBBASE+5 /* A protocol error occurred in the resource manager */
  121. #define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took too long */
  122. #define XA_RBTRANSIENT XA_RBBASE+7 /* May retry the transaction branch */
  123. #define XA_RBEND XA_RBTRANSIENT /* The inclusive upper bound of the rollback codes */
  124. #define XA_NOMIGRATE 9 /* resumption must occur where suspension occurred */
  125. #define XA_HEURHAZ 8 /* the transaction branch may have been heuristically completed */
  126. #define XA_HEURCOM 7 /* the transaction branch has been heuristically committed */
  127. #define XA_HEURRB 6 /* the transaction branch has been heuristically rolled back */
  128. #define XA_HEURMIX 5 /* the transaction branch has been heuristically committed and rolled back */
  129. #define XA_RETRY 4 /* routine returned with no effect and may be re-issued */
  130. #define XA_RDONLY 3 /* the transaction branch was read-only and has been committed */
  131. #define XA_OK 0 /* normal execution */
  132. #define XAER_ASYNC (-2) /* asynchronous operation already outstanding */
  133. #define XAER_RMERR (-3) /* a resource manager error occurred in the transaction branch */
  134. #define XAER_NOTA (-4) /* the XID is not valid */
  135. #define XAER_INVAL (-5) /* invalid arguments were given */
  136. #define XAER_PROTO (-6) /* routine invoked in an improper context */
  137. #define XAER_RMFAIL (-7) /* resource manager unavailable */
  138. #define XAER_DUPID (-8) /* the XID already exists */
  139. #define XAER_OUTSIDE (-9) /* resource manager doing work outside */
  140. /* global transaction */
  141. /*
  142. * XA entry point type definitions:
  143. */
  144. typedef int (__cdecl *XA_OPEN_EPT)(char *, int, long); /* xa_open entry point */
  145. typedef int (__cdecl *XA_CLOSE_EPT)(char *, int, long); /* xa_close entry point*/
  146. typedef int (__cdecl *XA_START_EPT)(XID *, int, long); /* xa_start entry point */
  147. typedef int (__cdecl *XA_END_EPT)(XID *, int, long); /* xa_end entry point */
  148. typedef int (__cdecl *XA_ROLLBACK_EPT)(XID *, int, long);
  149. /* xa_rollback entry point */
  150. typedef int (__cdecl *XA_PREPARE_EPT)(XID *, int, long);/* xa_prepare entry point */
  151. typedef int (__cdecl *XA_COMMIT_EPT)(XID *, int, long); /* xa_commit entry point */
  152. typedef int (__cdecl *XA_RECOVER_EPT)(XID *, long, int, long);
  153. /* xa_recover entry point*/
  154. typedef int (__cdecl *XA_FORGET_EPT)(XID *, int, long); /* xa_forget entry point */
  155. typedef int (__cdecl *XA_COMPLETE_EPT)(int *, int *, int, long);
  156. /* xa_complete entry point */
  157. #endif /* ifndef XA_H */
  158. /*
  159. * End of xa.h header
  160. */