00001 /* 00002 * Start of xa.h header 00003 * 00004 * Define a symbol to prevent multiple inclusions of this header file 00005 */ 00006 #ifndef XA_H 00007 #define XA_H 00008 00009 /* 00010 * Transaction branch identification: XID and NULLXID: 00011 */ 00012 #ifndef XIDDATASIZE 00013 00014 #define XIDDATASIZE 128 /* size in bytes */ 00015 #define MAXGTRIDSIZE 64 /* maximum size in bytes of gtrid */ 00016 #define MAXBQUALSIZE 64 /* maximum size in bytes of bqual */ 00017 00018 struct xid_t { 00019 long formatID; /* format identifier */ 00020 long gtrid_length; /* value from 1 through 64 */ 00021 long bqual_length; /* value from 1 through 64 */ 00022 char data[XIDDATASIZE]; 00023 }; 00024 typedef struct xid_t XID; 00025 #endif 00026 /* 00027 * A value of -1 in formatID means that the XID is null. 00028 */ 00029 00030 00031 #ifdef NOTDEFINED 00032 /* Let us comment this out to remove compiler errors!!!!!!!!!!!! */ 00033 00034 /* 00035 * Declarations of routines by which RMs call TMs: 00036 */ 00037 extern int ax_reg __P((int, XID *, long)); 00038 extern int ax_unreg __P((int, long)); 00039 00040 /* 00041 * XA Switch Data Structure 00042 */ 00043 #define RMNAMESZ 32 /* length of resource manager name, */ 00044 /* including the null terminator */ 00045 #define MAXINFOSIZE 256 /* maximum size in bytes of xa_info */ 00046 /* strings, including the null 00047 terminator */ 00048 00049 00050 struct xa_switch_t { 00051 char name[RMNAMESZ]; /* name of resource manager */ 00052 long flags; /* resource manager specific options */ 00053 long version; /* must be 0 */ 00054 int (*xa_open_entry) /* xa_open function pointer */ 00055 __P((char *, int, long)); 00056 int (*xa_close_entry) /* xa_close function pointer */ 00057 __P((char *, int, long)); 00058 int (*xa_start_entry) /* xa_start function pointer */ 00059 __P((XID *, int, long)); 00060 int (*xa_end_entry) /* xa_end function pointer */ 00061 __P((XID *, int, long)); 00062 int (*xa_rollback_entry) /* xa_rollback function pointer */ 00063 __P((XID *, int, long)); 00064 int (*xa_prepare_entry) /* xa_prepare function pointer */ 00065 __P((XID *, int, long)); 00066 int (*xa_commit_entry) /* xa_commit function pointer */ 00067 __P((XID *, int, long)); 00068 int (*xa_recover_entry) /* xa_recover function pointer */ 00069 __P((XID *, long, int, long)); 00070 int (*xa_forget_entry) /* xa_forget function pointer */ 00071 __P((XID *, int, long)); 00072 int (*xa_complete_entry) /* xa_complete function pointer */ 00073 __P((int *, int *, int, long)); 00074 }; 00075 #endif /* NOTDEFINED */ 00076 00077 00078 /* 00079 * Flag definitions for the RM switch 00080 */ 00081 #define TMNOFLAGS 0x00000000L /* no resource manager features 00082 selected */ 00083 #define TMREGISTER 0x00000001L /* resource manager dynamically 00084 registers */ 00085 #define TMNOMIGRATE 0x00000002L /* resource manager does not support 00086 association migration */ 00087 #define TMUSEASYNC 0x00000004L /* resource manager supports 00088 asynchronous operations */ 00089 /* 00090 * Flag definitions for xa_ and ax_ routines 00091 */ 00092 /* use TMNOFLAGGS, defined above, when not specifying other flags */ 00093 #define TMASYNC 0x80000000L /* perform routine asynchronously */ 00094 #define TMONEPHASE 0x40000000L /* caller is using one-phase commit 00095 optimisation */ 00096 #define TMFAIL 0x20000000L /* dissociates caller and marks 00097 transaction branch rollback-only */ 00098 #define TMNOWAIT 0x10000000L /* return if blocking condition 00099 exists */ 00100 #define TMRESUME 0x08000000L /* caller is resuming association with 00101 suspended transaction branch */ 00102 #define TMSUCCESS 0x04000000L /* dissociate caller from transaction 00103 branch */ 00104 #define TMSUSPEND 0x02000000L /* caller is suspending, not ending, 00105 association */ 00106 #define TMSTARTRSCAN 0x01000000L /* start a recovery scan */ 00107 #define TMENDRSCAN 0x00800000L /* end a recovery scan */ 00108 #define TMMULTIPLE 0x00400000L /* wait for any asynchronous 00109 operation */ 00110 #define TMJOIN 0x00200000L /* caller is joining existing 00111 transaction branch */ 00112 #define TMMIGRATE 0x00100000L /* caller intends to perform 00113 migration */ 00114 00115 /* 00116 * ax_() return codes (transaction manager reports to resource manager) 00117 */ 00118 #define TM_JOIN 2 /* caller is joining existing 00119 transaction branch */ 00120 #define TM_RESUME 1 /* caller is resuming association with 00121 suspended transaction branch */ 00122 #define TM_OK 0 /* normal execution */ 00123 #define TMER_TMERR -1 /* an error occurred in the transaction 00124 manager */ 00125 #define TMER_INVAL -2 /* invalid arguments were given */ 00126 #define TMER_PROTO -3 /* routine invoked in an improper 00127 context */ 00128 00129 /* 00130 * xa_() return codes (resource manager reports to transaction manager) 00131 */ 00132 #define XA_RBBASE 100 /* The inclusive lower bound of the 00133 rollback codes */ 00134 #define XA_RBROLLBACK XA_RBBASE /* The rollback was caused by an 00135 unspecified reason */ 00136 #define XA_RBCOMMFAIL XA_RBBASE+1 /* The rollback was caused by a 00137 communication failure */ 00138 #define XA_RBDEADLOCK XA_RBBASE+2 /* A deadlock was detected */ 00139 #define XA_RBINTEGRITY XA_RBBASE+3 /* A condition that violates the 00140 integrity of the resources was 00141 detected */ 00142 #define XA_RBOTHER XA_RBBASE+4 /* The resource manager rolled back the 00143 transaction branch for a reason not 00144 on this list */ 00145 #define XA_RBPROTO XA_RBBASE+5 /* A protocol error occurred in the 00146 resource manager */ 00147 #define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took too long */ 00148 #define XA_RBTRANSIENT XA_RBBASE+7 /* May retry the transaction branch */ 00149 #define XA_RBEND XA_RBTRANSIENT /* The inclusive upper bound of the 00150 rollback codes */ 00151 #define XA_NOMIGRATE 9 /* resumption must occur where 00152 suspension occurred */ 00153 #define XA_HEURHAZ 8 /* the transaction branch may have 00154 been heuristically completed */ 00155 #define XA_HEURCOM 7 /* the transaction branch has been 00156 heuristically committed */ 00157 #define XA_HEURRB 6 /* the transaction branch has been 00158 heuristically rolled back */ 00159 #define XA_HEURMIX 5 /* the transaction branch has been 00160 heuristically committed and rolled 00161 back */ 00162 #define XA_RETRY 4 /* routine returned with no effect and 00163 may be re-issued */ 00164 #define XA_RDONLY 3 /* the transaction branch was read-only 00165 and has been committed */ 00166 #define XA_OK 0 /* normal execution */ 00167 #define XAER_ASYNC -2 /* asynchronous operation already 00168 outstanding */ 00169 #define XAER_RMERR -3 /* a resource manager error occurred in 00170 the transaction branch */ 00171 #define XAER_NOTA -4 /* the XID is not valid */ 00172 #define XAER_INVAL -5 /* invalid arguments were given */ 00173 #define XAER_PROTO -6 /* routine invoked in an improper 00174 context */ 00175 #define XAER_RMFAIL -7 /* resource manager unavailable */ 00176 #define XAER_DUPID -8 /* the XID already exists */ 00177 #define XAER_OUTSIDE -9 /* resource manager doing work outside 00178 transaction */ 00179 #endif /* ifndef XA_H */ 00180 /* 00181 * End of xa.h header 00182 */
1.4.7

