182 lines
6.9 KiB
C
Executable File
182 lines
6.9 KiB
C
Executable File
/******************************************************************************
|
|
*
|
|
* xa.h - X/OPEN compatible header for transactions
|
|
*
|
|
* Module %M% Version %I% Date %H%
|
|
*
|
|
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
|
|
* This is unpublished proprietary source code of Ardent Software Inc.
|
|
* The copyright notice above does not evidence any actual or intended
|
|
* publication of such source code.
|
|
*
|
|
*******************************************************************************
|
|
*
|
|
* Maintenence log - insert most recent change descriptions at top
|
|
*
|
|
* Date.... GTAR# WHO Description........................................
|
|
* 10/14/98 23801 SAP Change copyrights.
|
|
* 06/16/93 11704 JKW add xa interface for odbc
|
|
* 06/23/93 11704 JKW remove MODULE define
|
|
******************************************************************************/
|
|
#ifndef XA_H
|
|
#define XA_H
|
|
/*
|
|
*Transaction Branch Identifier: XID and NULLXID:
|
|
*/
|
|
#define XIDDATASIZE 128 /* size in bytes */
|
|
#define MAXGTRIDSIZE 64 /* maximum size in bytes of gtrid */
|
|
#define MAXBQUALSIZE 64 /* maximum size in bytes of bqual */
|
|
struct xid_t {
|
|
long formatID; /* format identifier */
|
|
long gtrid_length; /* value from 1 through 64 */
|
|
long bqual_length; /* value from 1 through 64 */
|
|
char data[XIDDATASIZE];
|
|
};
|
|
typedef struct xid_t XID;
|
|
|
|
/*
|
|
* A value of -1 in formatID means that the XID is null
|
|
*/
|
|
|
|
/*
|
|
Declarations of routines by which RMs call TMs.
|
|
*/
|
|
|
|
#ifdef __STDC__
|
|
extern int ax_reg(int, XID *, long);
|
|
extern int ax_unreg(int, long);
|
|
#else
|
|
extern int ax_reg();
|
|
extern int ax_unreg();
|
|
#endif
|
|
|
|
/*
|
|
XA Switch Data Structure
|
|
*/
|
|
|
|
#define RMNAMESZ 32 /* length of resource manager name, */
|
|
/* including the null terminator */
|
|
#define MAXINFOSIZE 256 /* maximum size in bytes of xa_info */
|
|
/* strings, including the null terminator */
|
|
|
|
struct xa_switch_t {
|
|
char name[RMNAMESZ]; /* name of resource manager */
|
|
long flags; /* options specific to RM */
|
|
long version; /* must be 0 */
|
|
#ifdef __STDC__
|
|
int (*xa_open_entry)(char *, int, long); /*xa_open fcn ptr */
|
|
int (*xa_close_entry)(char *, int, long); /*xa_close fcn ptr */
|
|
int (*xa_start_entry)(XID *, int, long); /*xa_start fcn ptr */
|
|
int (*xa_end_entry)(XID *, int, long); /*xa_end fcn ptr */
|
|
int (*xa_rollback_entry)(XID *, int, long); /* fcn ptr */
|
|
int (*xa_prepare_entry)(XID *, int, long); /* fcn ptr */
|
|
int (*xa_commit_entry)(XID *, int, long); /* fcn ptr */
|
|
int (*xa_recover_entry)(XID *, long, int, long); /* fcn ptr */
|
|
int (*xa_forget_entry)(XID *, int, long); /* fcn ptr */
|
|
int (*xa_complete_entry)(int *, int *, int, long); /* fcn ptr */
|
|
#else
|
|
int (*xa_open_entry)(); /*xa_open fcn ptr */
|
|
int (*xa_close_entry)(); /*xa_close fcn ptr */
|
|
int (*xa_start_entry)(); /*xa_start fcn ptr */
|
|
int (*xa_end_entry)(); /*xa_end fcn ptr */
|
|
int (*xa_rollback_entry)(); /* fcn ptr */
|
|
int (*xa_prepare_entry)(); /* fcn ptr */
|
|
int (*xa_commit_entry)(); /* fcn ptr */
|
|
int (*xa_recover_entry)(); /* fcn ptr */
|
|
int (*xa_forget_entry)(); /* fcn ptr */
|
|
int (*xa_complete_entry)(); /* fcn ptr */
|
|
#endif
|
|
};
|
|
/*
|
|
Flag definitions for the RM switch
|
|
*/
|
|
|
|
#define TMNOFLAGS 0x00000000L /* no RM features selected */
|
|
#define TMREGISTER 0x00000001L /* RM dynamically registers */
|
|
#define TMNOMIGRATE 0x00000002L /* RM does not support association migration */
|
|
#define TMUSEASYNC 0x00000004L /* RM supports async operations */
|
|
|
|
/*
|
|
Flag definitions for the xa, ax routines
|
|
*/
|
|
|
|
#define TMASYNC 0x80000000L /* perform routine asynchrously */
|
|
#define TMONEPHASE 0x40000000L /* caller is using one phase commit
|
|
optimization */
|
|
#define TMFAIL 0x20000000L /* dissociates caller and marks transaction
|
|
branch rollback only */
|
|
#define TMNOWAIT 0x10000000L /* return if blocking condition exists */
|
|
#define TMRESUME 0x080000000L /* caller is resuming association with
|
|
suspended transaction branch */
|
|
#define TMSUCCESS 0x04000000L /* dissociate caller from tx branch */
|
|
#define TMSUSPEND 0x02000000L /* caller is suspending, not ending
|
|
association */
|
|
#define TMSTARTRSCAN 0x01000000L /* start a recovery scan */
|
|
#define TMENDRSCAN 0x00800000L /* end a recovery scan */
|
|
#define TMMULTIPLE 0x00400000L /* wait for an asynchronous operation */
|
|
#define TMJOIN 0x00200000L /* caller is joining existing transaction
|
|
branch */
|
|
#define TMMIGRATE 0x00100000L /* caller intends to perform migration */
|
|
|
|
/*
|
|
ax_ return codes
|
|
*/
|
|
|
|
#define TM_JOIN 2 /* caller is joining existing tx branch */
|
|
#define TM_RESUME 1 /* caller is resuming association with suspended
|
|
tx branch */
|
|
#define TM_OK 0 /* normal execution */
|
|
#define TMER_TMER -1 /* an error occurred in the tx manager */
|
|
#define TMER_INVAL -2 /* invalid arguments were given */
|
|
#define TMER_PROTO -3 /* routine invoked in improper context */
|
|
|
|
/*
|
|
xa_ return codes
|
|
*/
|
|
|
|
#define XA_RBBASE 100 /* the inclusive lower bound
|
|
of the rollback codes */
|
|
#define XA_RBROLLBACK XA_RBBASE /* rollback caused by
|
|
unspecified reason */
|
|
#define XA_RBCOMMFAIL XA_RBBASE+1 /* rollback caused by a communication
|
|
failure */
|
|
#define XA_RBDEADLOCK XA_RBBASE+2 /* a deadlock was detected */
|
|
#define XA_RBINTEGRITY XA_RBBASE+3 /* a condition that violates the
|
|
integrity of the resources was detected
|
|
*/
|
|
#define XA_RBOTHER XA_RBBASE+4 /* the RM rolled back the tx for a reason not
|
|
on this list */
|
|
#define XA_RBPROTO XA_RBBASE+5 /* a protocol error occurred in the RM */
|
|
#define XA_RBTIMEOUT XA_RBBASE+6 /* a tx branch took too long */
|
|
#define XA_RBTRANSIENT XA_RBBASE+7 /* may retry the tx branch */
|
|
#define XA_RBEND XA_RBTRANSIENT /* the inclusive upper bound of the rollback
|
|
codes */
|
|
|
|
#define XA_NOMIGRATE 9 /* resumption must occur where suspension occurred */
|
|
#define XA_HEURHAZ 8 /* the branch may have been heuristically completed */
|
|
#define XA_HEURCOM 7 /* the tx branch may have been heuristically committed */
|
|
#define XA_HEURRB 6 /* the tx branch may have been heuristically rolled
|
|
back */
|
|
#define XA_HEURMIX 5 /* the tx branch has been heuristically committed and
|
|
rolled back */
|
|
#define XA_RETRY 4 /* routine returned with no effect and may be reissued. */
|
|
#define XA_RDONLY 3 /* the tx branch was read-only and has been committed */
|
|
|
|
#define XA_OK 0 /* normal execution */
|
|
|
|
#define XAER_ASYNC -2 /* asynchronous operation already outstanding */
|
|
#define XAER_RMERR -3 /* an RM error occurred in the tx branch */
|
|
#define XAER_NOTA -4 /* the XID is not valid */
|
|
#define XAER_INVAL -5 /* invalid arguments were given */
|
|
#define XAER_PROTO -6 /* routine invoked in an improper context */
|
|
#define XAER_RMFAIL -7 /* resource manager unavailable */
|
|
#define XAER_DUPID -8 /* the XID already exists */
|
|
#define XAER_OUTSIDE -9 /* RM doing work outside global tx */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|