home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / XA.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  8.2 KB  |  172 lines

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