![]() |
|
|||
0001 /* 0002 * This header is NOT original but it's a derivative work of this public 0003 * documentation: 0004 * 0005 * X/Open CAE Specification 0006 * Distributed Transaction Processing: 0007 * The XA Specification 0008 * ISBN: 1 872630 24 3 0009 * X/Open Document Number: XO/CAE/91/300 0010 */ 0011 0012 /* 0013 * Start of xa.h header 0014 * 0015 * Define a symbol to prevent multiple inclusions of this header file 0016 */ 0017 #ifndef XA_H 0018 #define XA_H 0019 0020 #ifdef __cplusplus 0021 extern "C" { 0022 #endif 0023 0024 0025 #include <ndrx_config.h> 0026 /* 0027 * Transaction branch identification: XID and NULLXID: 0028 */ 0029 #define XIDDATASIZE 128 /* size in bytes */ 0030 #define MAXGTRIDSIZE 64 /* maximum size in bytes of gtrid */ 0031 #define MAXBQUALSIZE 64 /* maximum size in bytes of bqual */ 0032 #ifndef XID_T_TYPE 0033 # define XID_T_TYPE 0034 struct xid_t { 0035 long formatID; /* format identifier */ 0036 long gtrid_length; /* value from 1 through 64 */ 0037 long bqual_length; /* value from 1 through 64 */ 0038 char data[XIDDATASIZE]; 0039 }; 0040 typedef struct xid_t XID; 0041 #endif /* XID_T_TYPE */ 0042 /* 0043 * A value of -1 in formatID means that the XID is null. 0044 */ 0045 #ifndef NULLXID 0046 # define NULLXID -1 0047 #endif 0048 0049 0050 /* 0051 * Declarations of routines by which RMs call TMs: 0052 */ 0053 /** 0054 * Dynamically register a resource manager with a transaction manager 0055 */ 0056 extern NDRX_API int ax_reg(int rmid, XID *xid, long flags); 0057 /** 0058 * Dynamically unregister a resource manager with a transaction manager 0059 */ 0060 extern NDRX_API int ax_unreg(int rmid, long flags); 0061 0062 0063 0064 /* 0065 * XA Switch Data Structure 0066 */ 0067 #define RMNAMESZ 32 /* length of resource manager name, 0068 including the null terminator */ 0069 #define MAXINFOSIZE 256 /* maximum size in bytes of xa_info 0070 strings, including the null terminator*/ 0071 struct xa_switch_t { 0072 char name[RMNAMESZ]; /* name of resource manager */ 0073 long flags; /* options specific to the resource manager */ 0074 long version; /* must be 0 */ 0075 int (*xa_open_entry)(char *, int, long); /* xa_open function pointer*/ 0076 int (*xa_close_entry)(char *, int, long); /* xa_close function pointer*/ 0077 int (*xa_start_entry)(XID *, int, long); /* xa_start function pointer*/ 0078 int (*xa_end_entry)(XID *, int, long); /* xa_end function pointer*/ 0079 int (*xa_rollback_entry)(XID *, int, long); 0080 /* xa_rollback function pointer*/ 0081 int (*xa_prepare_entry)(XID *, int, long);/* xa_prepare function pointer*/ 0082 int (*xa_commit_entry)(XID *, int, long); /* xa_commit function pointer*/ 0083 int (*xa_recover_entry)(XID *, long, int, long); 0084 /* xa_recover function pointer*/ 0085 int (*xa_forget_entry)(XID *, int, long); /* xa_forget function pointer*/ 0086 int (*xa_complete_entry)(int *, int *, int, long); 0087 /* xa_complete function pointer*/ 0088 }; 0089 0090 0091 0092 typedef struct xa_switch_t * (* ndrx_get_xa_switch_loader) (void); 0093 0094 0095 0096 /* 0097 * Flag definitions for the RM switch 0098 */ 0099 #define TMNOFLAGS 0x00000000L /* no resource manager features selected */ 0100 #define TMREGISTER 0x00000001L /* resource manager dynamically registers */ 0101 #define TMNOMIGRATE 0x00000002L /* resource manager does not support 0102 association migration */ 0103 #define TMUSEASYNC 0x00000004L /* resource manager supports 0104 asynchronous operations */ 0105 /* 0106 * Flag definitions for xa_ and ax_ routines 0107 */ 0108 /* use TMNOFLAGS, defined above, when not specifying other flags */ 0109 #define TMASYNC 0x80000000L /* perform routine asynchronously */ 0110 #define TMONEPHASE 0x40000000L /* caller is using one-phase commit 0111 optimisation */ 0112 #define TMFAIL 0x20000000L /* dissociates caller and marks 0113 transaction branch rollback-only */ 0114 #define TMNOWAIT 0x10000000L /* return if blocking condition exists */ 0115 #define TMRESUME 0x08000000L /* caller is resuming association 0116 with suspended transaction branch */ 0117 #define TMSUCCESS 0x04000000L /* dissociate caller from transaction 0118 branch*/ 0119 #define TMSUSPEND 0x02000000L /* caller is suspending, not ending, 0120 association */ 0121 #define TMSTARTRSCAN 0x01000000L /* start a recovery scan */ 0122 #define TMENDRSCAN 0x00800000L /* end a recovery scan */ 0123 #define TMMULTIPLE 0x00400000L /* wait for any asynchronous operation */ 0124 #define TMJOIN 0x00200000L /* caller is joining existing transaction 0125 branch */ 0126 #define TMMIGRATE 0x00100000L /* caller intends to perform migration */ 0127 0128 0129 0130 /* 0131 * ax_() return codes (transaction manager reports to resource manager) 0132 */ 0133 #define TM_JOIN 2 /* caller is joining existing transaction 0134 branch */ 0135 #define TM_RESUME 1 /* caller is resuming association with 0136 suspended transaction branch */ 0137 #define TM_OK 0 /* normal execution */ 0138 #define TMER_TMERR -1 /* an error occurred in the transaction 0139 manager */ 0140 #define TMER_INVAL -2 /* invalid arguments were given */ 0141 #define TMER_PROTO -3 /* routine invoked in an improper context */ 0142 0143 0144 0145 /* 0146 * xa_() return codes (resource manager reports to transaction manager) 0147 */ 0148 #define XA_RBBASE 100 /* the inclusive lower bound of the 0149 rollback codes */ 0150 #define XA_RBROLLBACK XA_RBBASE /* the rollback was caused by an 0151 unspecified reason */ 0152 #define XA_RBCOMMFAIL XA_RBBASE+1 /* the rollback was caused by a 0153 communication failure */ 0154 #define XA_RBDEADLOCK XA_RBBASE+2 /* a deadlock was detected */ 0155 #define XA_RBINTEGRITY XA_RBBASE+3 /* a condition that violates the 0156 integrity of the resources 0157 was detected */ 0158 #define XA_RBOTHER XA_RBBASE+4 /* the resource manager rolled back 0159 the transaction branch for 0160 a reason not on this list */ 0161 #define XA_RBPROTO XA_RBBASE+5 /* a protocol error occurred in the 0162 resource manager */ 0163 #define XA_RBTIMEOUT XA_RBBASE+6 /* a transaction branch took too 0164 long */ 0165 #define XA_RBTRANSIENT XA_RBBASE+7 /* may retry the transaction branch */ 0166 #define XA_RBEND XA_RBTRANSIENT /* the inclusive upper bound of the 0167 rollback codes */ 0168 #define XA_NOMIGRATE 9 /* resumption must occur where 0169 suspension occurred */ 0170 #define XA_HEURHAZ 8 /* the transaction branch may have 0171 been heuristically completed */ 0172 #define XA_HEURCOM 7 /* the transaction branch has been 0173 heuristically committed */ 0174 #define XA_HEURRB 6 /* the transaction branch has been 0175 heuristically rolled back */ 0176 #define XA_HEURMIX 5 /* the transaction branch has been 0177 heuristically committed and rolled back */ 0178 #define XA_RETRY 4 /* routine returned with no effect and 0179 may be reissued */ 0180 #define XA_RDONLY 3 /* the transaction branch was read-only and 0181 has been committed */ 0182 #define XA_OK 0 /* normal execution */ 0183 #define XAER_ASYNC -2 /* asynchronous operation already outstanding */ 0184 #define XAER_RMERR -3 /* a resource manager error occurred in the 0185 transaction branch */ 0186 #define XAER_NOTA -4 /* the XID is not valid */ 0187 #define XAER_INVAL -5 /* invalid arguments were given */ 0188 #define XAER_PROTO -6 /* routine invoked in an improper context */ 0189 #define XAER_RMFAIL -7 /* resource manager unavailable */ 0190 #define XAER_DUPID -8 /* the XID already exists */ 0191 #define XAER_OUTSIDE -9 /* resource manager doing work outside 0192 global transaction */ 0193 0194 #ifdef __cplusplus 0195 } 0196 #endif 0197 0198 #endif /* ifndef XA_H */ 0199 /* 0200 * End of xa.h header 0201 */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |