Back to home page

Enduro/X

 
 

    


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 TX (Transaction Demarcation) Specification
0008  * ISBN: 1-85912-094-6
0009  * X/Open Document Number: C504
0010  */
0011 
0012 /*
0013 * Start of tx.h header
0014 *
0015 * Define a symbol to prevent multiple inclusions of this header file
0016 */
0017 #ifndef TX_H
0018 #define TX_H
0019 #define TX_H_VERSION 0 /* current version of this header file */
0020 
0021 #include <ndrx_config.h>
0022 #include <xa.h>
0023 
0024 /*
0025 * A value of -1 in formatID means that the XID is null.
0026 */
0027 /*
0028 * Definitions for tx_*() routines
0029 */
0030 /* commit return values */
0031 typedef long COMMIT_RETURN;
0032 #define TX_COMMIT_COMPLETED 0
0033 #define TX_COMMIT_DECISION_LOGGED 1
0034 /* transaction control values */
0035 typedef long TRANSACTION_CONTROL;
0036 #define TX_UNCHAINED 0
0037 #define TX_CHAINED 1
0038 /* type of transaction timeouts */
0039 typedef long TRANSACTION_TIMEOUT;
0040 /* transaction state values */
0041 typedef long TRANSACTION_STATE;
0042 
0043 #define TX_ACTIVE 0
0044 #define TX_TIMEOUT_ROLLBACK_ONLY 1
0045 #define TX_ROLLBACK_ONLY 2
0046 /* structure populated by tx_info() */
0047 struct tx_info_t {
0048     XID xid;
0049     COMMIT_RETURN when_return;
0050     TRANSACTION_CONTROL transaction_control;
0051     TRANSACTION_TIMEOUT transaction_timeout;
0052     TRANSACTION_STATE transaction_state;
0053 };
0054 typedef struct tx_info_t TXINFO;
0055 /*
0056 * Declarations of routines by which Applications call TMs:
0057 */
0058 
0059 extern NDRX_API int tx_begin(void);
0060 extern NDRX_API int tx_close(void);
0061 extern NDRX_API int tx_commit(void);
0062 extern NDRX_API int tx_info(TXINFO *);
0063 extern NDRX_API int tx_open(void);
0064 extern NDRX_API int tx_rollback(void);
0065 extern NDRX_API int tx_set_commit_return(COMMIT_RETURN);
0066 extern NDRX_API int tx_set_transaction_control(TRANSACTION_CONTROL);
0067 extern NDRX_API int tx_set_transaction_timeout(TRANSACTION_TIMEOUT);
0068 
0069 /*
0070 * tx_*() return codes (transaction manager reports to application)
0071 */
0072 #define TX_NOT_SUPPORTED 1 /* option not supported */
0073 #define TX_OK 0 /* normal execution */
0074 #define TX_OUTSIDE -1 /* application is in an RM local
0075 transaction */
0076 #define TX_ROLLBACK -2 /* transaction was rolled back */
0077 #define TX_MIXED -3 /* transaction was partially committed
0078 and partially rolled back */
0079 
0080 
0081 #define TX_HAZARD -4 /* transaction may have been partially
0082 committed and partially rolled back */
0083 #define TX_PROTOCOL_ERROR -5 /* routine invoked in an improper
0084 context */
0085 #define TX_ERROR -6 /* transient error */
0086 #define TX_FAIL -7 /* fatal error */
0087 #define TX_EINVAL -8 /* invalid arguments were given */
0088 #define TX_COMMITTED -9 /* transaction has heuristically
0089 committed */
0090 #define TX_NO_BEGIN -100 /* transaction committed plus new
0091 transaction could not be started */
0092 #define TX_ROLLBACK_NO_BEGIN (TX_ROLLBACK+TX_NO_BEGIN)
0093 /* transaction rollback plus new
0094 transaction could not be started */
0095 #define TX_MIXED_NO_BEGIN (TX_MIXED+TX_NO_BEGIN)
0096 /* mixed plus new transaction could not
0097 be started */
0098 #define TX_HAZARD_NO_BEGIN (TX_HAZARD+TX_NO_BEGIN)
0099 /* hazard plus new transaction could
0100 not be started */
0101 #define TX_COMMITTED_NO_BEGIN (TX_COMMITTED+TX_NO_BEGIN)
0102 /* heuristically committed plus new
0103 transaction could not be started */
0104 #endif /* ifndef TX_H */
0105 /*
0106 * End of tx.h header
0107 */
0108