home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / xa.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  8.3 KB  |  173 lines

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