1N/A/*-
1N/A * See the file LICENSE for redistribution information.
1N/A *
1N/A * Copyright (c) 1998
1N/A * Sleepycat Software. All rights reserved.
1N/A *
1N/A * @(#)xa.h 10.1 (Sleepycat) 6/22/98
1N/A */
1N/A
1N/A#pragma ident "%Z%%M% %I% %E% SMI"
1N/A
1N/A/*
1N/A * Start of xa.h header
1N/A *
1N/A * Define a symbol to prevent multiple inclusions of this header file
1N/A */
1N/A#ifndef XA_H
1N/A#define XA_H
1N/A
1N/A/*
1N/A * Transaction branch identification: XID and NULLXID:
1N/A */
1N/A#define XIDDATASIZE 128 /* size in bytes */
1N/A#define MAXGTRIDSIZE 64 /* maximum size in bytes of gtrid */
1N/A#define MAXBQUALSIZE 64 /* maximum size in bytes of bqual */
1N/A
1N/Astruct xid_t {
1N/A long formatID; /* format identifier */
1N/A long gtrid_length; /* value from 1 through 64 */
1N/A long bqual_length; /* value from 1 through 64 */
1N/A char data[XIDDATASIZE];
1N/A};
1N/Atypedef struct xid_t XID;
1N/A/*
1N/A * A value of -1 in formatID means that the XID is null.
1N/A */
1N/A
1N/A/*
1N/A * Declarations of routines by which RMs call TMs:
1N/A */
1N/Aextern int ax_reg __P((int, XID *, long));
1N/Aextern int ax_unreg __P((int, long));
1N/A
1N/A/*
1N/A * XA Switch Data Structure
1N/A */
1N/A#define RMNAMESZ 32 /* length of resource manager name, */
1N/A /* including the null terminator */
1N/A#define MAXINFOSIZE 256 /* maximum size in bytes of xa_info */
1N/A /* strings, including the null
1N/A terminator */
1N/Astruct xa_switch_t {
1N/A char name[RMNAMESZ]; /* name of resource manager */
1N/A long flags; /* resource manager specific options */
1N/A long version; /* must be 0 */
1N/A int (*xa_open_entry) /* xa_open function pointer */
1N/A __P((char *, int, long));
1N/A int (*xa_close_entry) /* xa_close function pointer */
1N/A __P((char *, int, long));
1N/A int (*xa_start_entry) /* xa_start function pointer */
1N/A __P((XID *, int, long));
1N/A int (*xa_end_entry) /* xa_end function pointer */
1N/A __P((XID *, int, long));
1N/A int (*xa_rollback_entry) /* xa_rollback function pointer */
1N/A __P((XID *, int, long));
1N/A int (*xa_prepare_entry) /* xa_prepare function pointer */
1N/A __P((XID *, int, long));
1N/A int (*xa_commit_entry) /* xa_commit function pointer */
1N/A __P((XID *, int, long));
1N/A int (*xa_recover_entry) /* xa_recover function pointer */
1N/A __P((XID *, long, int, long));
1N/A int (*xa_forget_entry) /* xa_forget function pointer */
1N/A __P((XID *, int, long));
1N/A int (*xa_complete_entry) /* xa_complete function pointer */
1N/A __P((int *, int *, int, long));
1N/A};
1N/A
1N/A/*
1N/A * Flag definitions for the RM switch
1N/A */
1N/A#define TMNOFLAGS 0x00000000L /* no resource manager features
1N/A selected */
1N/A#define TMREGISTER 0x00000001L /* resource manager dynamically
1N/A registers */
1N/A#define TMNOMIGRATE 0x00000002L /* resource manager does not support
1N/A association migration */
1N/A#define TMUSEASYNC 0x00000004L /* resource manager supports
1N/A asynchronous operations */
1N/A/*
1N/A * Flag definitions for xa_ and ax_ routines
1N/A */
1N/A/* use TMNOFLAGGS, defined above, when not specifying other flags */
1N/A#define TMASYNC 0x80000000L /* perform routine asynchronously */
1N/A#define TMONEPHASE 0x40000000L /* caller is using one-phase commit
1N/A optimisation */
1N/A#define TMFAIL 0x20000000L /* dissociates caller and marks
1N/A transaction branch rollback-only */
1N/A#define TMNOWAIT 0x10000000L /* return if blocking condition
1N/A exists */
1N/A#define TMRESUME 0x08000000L /* caller is resuming association with
1N/A suspended transaction branch */
1N/A#define TMSUCCESS 0x04000000L /* dissociate caller from transaction
1N/A branch */
1N/A#define TMSUSPEND 0x02000000L /* caller is suspending, not ending,
1N/A association */
1N/A#define TMSTARTRSCAN 0x01000000L /* start a recovery scan */
1N/A#define TMENDRSCAN 0x00800000L /* end a recovery scan */
1N/A#define TMMULTIPLE 0x00400000L /* wait for any asynchronous
1N/A operation */
1N/A#define TMJOIN 0x00200000L /* caller is joining existing
1N/A transaction branch */
1N/A#define TMMIGRATE 0x00100000L /* caller intends to perform
1N/A migration */
1N/A
1N/A/*
1N/A * ax_() return codes (transaction manager reports to resource manager)
1N/A */
1N/A#define TM_JOIN 2 /* caller is joining existing
1N/A transaction branch */
1N/A#define TM_RESUME 1 /* caller is resuming association with
1N/A suspended transaction branch */
1N/A#define TM_OK 0 /* normal execution */
1N/A#define TMER_TMERR -1 /* an error occurred in the transaction
1N/A manager */
1N/A#define TMER_INVAL -2 /* invalid arguments were given */
1N/A#define TMER_PROTO -3 /* routine invoked in an improper
1N/A context */
1N/A
1N/A/*
1N/A * xa_() return codes (resource manager reports to transaction manager)
1N/A */
1N/A#define XA_RBBASE 100 /* The inclusive lower bound of the
1N/A rollback codes */
1N/A#define XA_RBROLLBACK XA_RBBASE /* The rollback was caused by an
1N/A unspecified reason */
1N/A#define XA_RBCOMMFAIL XA_RBBASE+1 /* The rollback was caused by a
1N/A communication failure */
1N/A#define XA_RBDEADLOCK XA_RBBASE+2 /* A deadlock was detected */
1N/A#define XA_RBINTEGRITY XA_RBBASE+3 /* A condition that violates the
1N/A integrity of the resources was
1N/A detected */
1N/A#define XA_RBOTHER XA_RBBASE+4 /* The resource manager rolled back the
1N/A transaction branch for a reason not
1N/A on this list */
1N/A#define XA_RBPROTO XA_RBBASE+5 /* A protocol error occurred in the
1N/A resource manager */
1N/A#define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took too long */
1N/A#define XA_RBTRANSIENT XA_RBBASE+7 /* May retry the transaction branch */
1N/A#define XA_RBEND XA_RBTRANSIENT /* The inclusive upper bound of the
1N/A rollback codes */
1N/A#define XA_NOMIGRATE 9 /* resumption must occur where
1N/A suspension occurred */
1N/A#define XA_HEURHAZ 8 /* the transaction branch may have
1N/A been heuristically completed */
1N/A#define XA_HEURCOM 7 /* the transaction branch has been
1N/A heuristically committed */
1N/A#define XA_HEURRB 6 /* the transaction branch has been
1N/A heuristically rolled back */
1N/A#define XA_HEURMIX 5 /* the transaction branch has been
1N/A heuristically committed and rolled
1N/A back */
1N/A#define XA_RETRY 4 /* routine returned with no effect and
1N/A may be re-issued */
1N/A#define XA_RDONLY 3 /* the transaction branch was read-only
1N/A and has been committed */
1N/A#define XA_OK 0 /* normal execution */
1N/A#define XAER_ASYNC -2 /* asynchronous operation already
1N/A outstanding */
1N/A#define XAER_RMERR -3 /* a resource manager error occurred in
1N/A the transaction branch */
1N/A#define XAER_NOTA -4 /* the XID is not valid */
1N/A#define XAER_INVAL -5 /* invalid arguments were given */
1N/A#define XAER_PROTO -6 /* routine invoked in an improper
1N/A context */
1N/A#define XAER_RMFAIL -7 /* resource manager unavailable */
1N/A#define XAER_DUPID -8 /* the XID already exists */
1N/A#define XAER_OUTSIDE -9 /* resource manager doing work outside
1N/A transaction */
1N/A#endif /* ifndef XA_H */
1N/A/*
1N/A * End of xa.h header
1N/A */