Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief XA Enduro/X Common header
0003  *
0004  * @file xa_cmn.h
0005  */
0006 /* -----------------------------------------------------------------------------
0007  * Enduro/X Middleware Platform for Distributed Transaction Processing
0008  * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0009  * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0010  * This software is released under one of the following licenses:
0011  * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0012  * See LICENSE file for full text.
0013  * -----------------------------------------------------------------------------
0014  * AGPL license:
0015  *
0016  * This program is free software; you can redistribute it and/or modify it under
0017  * the terms of the GNU Affero General Public License, version 3 as published
0018  * by the Free Software Foundation;
0019  *
0020  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0021  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0022  * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0023  * for more details.
0024  *
0025  * You should have received a copy of the GNU Affero General Public License along 
0026  * with this program; if not, write to the Free Software Foundation, Inc.,
0027  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0028  *
0029  * -----------------------------------------------------------------------------
0030  * A commercial use license is available from Mavimax, Ltd
0031  * contact@mavimax.com
0032  * -----------------------------------------------------------------------------
0033  */
0034 #ifndef XA_CMN
0035 #define XA_CMN
0036 
0037 #ifdef  __cplusplus
0038 extern "C" {
0039 #endif
0040 
0041 /*---------------------------Includes-----------------------------------*/
0042 #include <stdint.h>
0043 #include <sys_mqueue.h>
0044 #include <xa.h>
0045     
0046 #include <ndrxdcmn.h>
0047 #include <stdint.h>
0048 #include <nstopwatch.h>
0049 #include <exhash.h>
0050 #include <tx.h>
0051 /*---------------------------Externs------------------------------------*/
0052 /*---------------------------Macros-------------------------------------*/
0053 
0054 #define NDRX_LOCK_WAIT_TIME         5000    /**< lock wait time b4 give up */
0055 #define TOUT_CHECK_TIME             1       /**< Check for transaction timeout, sec   */
0056 #define COPY_MODE_FOREGROUND        0x1     /**< Copy foreground elements  */
0057 #define COPY_MODE_BACKGROUND        0x2     /**< Copy background elements  */
0058 #define COPY_MODE_ACQLOCK           0x4     /**< Should we do locking?     */
0059     
0060 /* Internal XA commands */
0061 /* buffer usage: */
0062 #define ATMI_XA_TPBEGIN             'b' /**< Begin global transaction           */
0063 #define ATMI_XA_TPCOMMIT            'c' /**< Commit global transaction          */
0064 #define ATMI_XA_TPABORT             'a' /**< Abort global transaction           */
0065     
0066 #define ATMI_XA_TPJOIN              'j' /**< Process is joining to txn, under new RM
0067                                         or process doesn't know that resorce is involed */
0068 #define ATMI_XA_PRINTTRANS          'p' /**< Print transactions to admin pt     */
0069 #define ATMI_XA_ABORTTRANS          'r' /**< Abo[r]t transaction, admin util    */
0070 #define ATMI_XA_COMMITTRANS         'm' /**< Co[m]mit transaction, admin util   */
0071 #define ATMI_XA_STATUS              's' /**< Return transaction status          */
0072     
0073     
0074 #define ATMI_XA_RECOVERLOCAL        'l' /**< Recover local transactions         */
0075 #define ATMI_XA_COMMITLOCAL         'o' /**< Commit local transaction           */
0076 #define ATMI_XA_ABORTLOCAL          't' /**< Abort local transactions           */
0077 #define ATMI_XA_FORGETLOCAL         'f' /**< Forget local transactions          */
0078 
0079 
0080 /* Register new resource handler - remote process sends us info about working under same TXN */
0081 #define ATMI_XA_TMREGISTER          'R' /**< Register new resource under txn... */
0082 #define ATMI_XA_TMPREPARE           'P' /**< Sends prepare statement to slave RM*/    
0083 #define ATMI_XA_TMCOMMIT            'C' /**< Sends commit to remove RM          */
0084 #define ATMI_XA_TMABORT             'A' /**< Master TM sends us Abort local tx  */
0085 #define ATMI_XA_TMFORGET            'F' /**< Master TM sends us Forget local tx  */
0086 #define ATMI_XA_RMSTATUS            'S' /**< Member is sending it actual status */
0087     
0088 /* Transaction status per RM */
0089 #define XA_RM_STATUS_NULL           0   /**< NULL                               */
0090 #define XA_RM_STATUS_NONE           'n' /**< Non transaction                    */
0091 #define XA_RM_STATUS_IDLE           'i' /**< Idle state, according to book      */
0092 #define XA_RM_STATUS_ACTIVE         'j' /**< RM is in joined state, book: atctive*/
0093 #define XA_RM_STATUS_ACT_AB         'k' /**< RM is in joined state, but must be aborted */
0094 #define XA_RM_STATUS_PREP           'p' /**< RM is in prepared state            */
0095 #define XA_RM_STATUS_ABORTED        'a' /**< RM is in abort state               */
0096 #define XA_RM_STATUS_ABFORGET_HAZ   'e' /**< Aborted, needs hazard forget       */
0097 #define XA_RM_STATUS_ABFORGET_HEU   'f' /**< Aborted, needs heuriestic forget   */
0098 /** For Postgres probably we need unknown which at commit prepare leads to abort*/
0099 #define XA_RM_STATUS_UNKOWN         'u' /**< RM has unknown status              */
0100 #define XA_RM_STATUS_ABORT_HEURIS   'b' /**< Aborted houristically              */
0101 #define XA_RM_STATUS_ABORT_HAZARD   'd' /**< Aborted, hazard                    */
0102 #define XA_RM_STATUS_COMMITTED      'c' /**< Committed                          */
0103 #define XA_RM_STATUS_COMMITTED_RO   'r' /**< Committed, was read only           */
0104 #define XA_RM_STATUS_COMMIT_HEURIS  'h' /**< Committed, Heuristically           */
0105 #define XA_RM_STATUS_COMMIT_HAZARD  'z' /**< Hazrad, committed or aborted       */
0106 #define XA_RM_STATUS_COMFORGET_HAZ  'g' /**< Committed, needs to forget, hazard */
0107 #define XA_RM_STATUS_COMFORGET_HEU  'l' /**< Committed, needs to forget, heuriestic*/
0108     
0109 /* Transaction Stages */
0110 /* The lowest number of RM outcomes, denotes the more exact Result */
0111 #define XA_TX_STAGE_NULL                     0   /**< Transaction does not exists */
0112 #define XA_TX_STAGE_ACTIVE                   5   /**< Transaction is in active processing */
0113 /* Abort base: */
0114 #define XA_TX_STAGE_ABORTING                 20   /**< Aborting                 */
0115 #define XA_TX_STAGE_ABORTED_HAZARD           25   /**< Abort, Hazard            */
0116 #define XA_TX_STAGE_ABORTED_HEURIS           30   /**< Aborted, Heuristically   */
0117 #define XA_TX_STAGE_ABORTED                  35   /**< Finished ok              */
0118     
0119 /*
0120  * Heuristic completion, aborting
0121  */
0122 #define XA_TX_STAGE_ABFORGETTING             36   /**< Still aborting, heuristic finish */
0123 #define XA_TX_STAGE_ABFORGOT_HAZ             37   /**< Aborted, hazard        */
0124 #define XA_TX_STAGE_ABFORGOT_HEU             38   /**< Aborted, heuristically */
0125 
0126 /* Entered in preparing stage, with possibility to fall back to Abort... */
0127 #define XA_TX_STAGE_PREPARING                40   /**< Doing prepare            */
0128 #define XA_TX_STAGE_PREPRO                   41   /**< No participants joined   */
0129 #define XA_TX_STAGE_PREPARED                 42   /**< For TMQ only             */
0130 
0131 /* 
0132  * Commit base 
0133  */
0134 #define XA_TX_STAGE_COMMITTING               50   /**< Prepared                 */
0135 #define XA_TX_STAGE_COMMITTED_HAZARD         55   /**< Commit, hazard           */
0136 #define XA_TX_STAGE_COMMITTED_HEURIS         65   /**< Commit Heuristically     */
0137 #define XA_TX_STAGE_COMMITTED                70   /**< Commit OK                */
0138     
0139 /*
0140  * Heuristic completion, commit
0141  */
0142 #define XA_TX_STAGE_COMFORGETTING            80   /**< Still committing, heuristic finish */
0143 #define XA_TX_STAGE_COMFORGOT_HAZ            85   /**< Committed, heuristically  */
0144 #define XA_TX_STAGE_COMFORGOT_HEU            87   /**< Committed, hazard         */
0145 
0146 #define XA_TX_STAGE_MAX_NEVER                100  /**< Upper never stage        */
0147 #define XA_TX_STAGE_MIN_NEVER                -1   /**< lower never stage        */
0148 
0149 #define XA_TX_COPY(X,Y)\
0150     X->tmtxflags = Y->tmtxflags;\
0151     strcpy(X->tmxid, Y->tmxid);\
0152     X->tmrmid = Y->tmrmid;\
0153     X->tmnodeid = Y->tmnodeid;\
0154     X->tmsrvid = Y->tmsrvid;\
0155     strcpy(X->tmknownrms, Y->tmknownrms);
0156     
0157 #define XA_TX_ZERO(X)\
0158     X->tmtxflags = 0;\
0159     X->tmxid[0] = EXEOS;\
0160     X->tmrmid = 0;\
0161     X->tmnodeid = 0;\
0162     X->tmsrvid = 0;\
0163     X->tmknownrms[0] = EXEOS;
0164     
0165 #define TMFLAGS_RMIDKNOWN        0x00000002  /**< RMID already registered     */
0166 #define TMFLAGS_TPTXCOMMITDLOG   0x00000004  /**< Commit decision logged      */
0167 #define TMFLAGS_TPNOSTARTXID     0x00000010  /**< internal, end makes prepare */
0168 #define TMFLAGS_DYNAMIC_REG      0x00000020  /**< TX initiator uses dyanmic reg */
0169 #define TMFLAGS_NOCON            0x00000040  /**< Do conversational API       */
0170 
0171 #define XA_OP_NOP                       0
0172 #define XA_OP_START                     1
0173 #define XA_OP_END                       2
0174 #define XA_OP_PREPARE                   3
0175 #define XA_OP_COMMIT                    4
0176 #define XA_OP_ROLLBACK                  5
0177 #define XA_OP_FORGET                    6
0178 #define XA_OP_OPEN                      7
0179 #define XA_OP_RECOVER                   8
0180 #define XA_OP_CLOSE                     9
0181     
0182 /**
0183  * Flags passed to atmi_xa_read_tx_info and associated flags
0184  * with with TPTRANID
0185  * @defgroup atmi_xa_read_tx_info_flags
0186  * @{
0187  */
0188 #define XA_TXINFO_NOFLAGS               0x00000000  /**< No special mode             */
0189 #define XA_TXINFO_NOBTID                0x00000001  /**< no BTID extract             */
0190 #define XA_TXINFO_INITIATOR             0x00000002  /**< Process is iniator of tx    */
0191 #define XA_TXINFO_AXREG_CLD             0x00000004  /**< ax_reg called of dynamic sw */
0192 /** @} */ /* end of atmi_xa_read_tx_info_flags */
0193     
0194     
0195 #define XA
0196 
0197 /*---------------------------Enums--------------------------------------*/
0198 /*---------------------------Typedefs-----------------------------------*/
0199     
0200 /*
0201  * Hash entry of call descriptor related with tx
0202  */
0203 struct atmi_xa_tx_cd
0204 {
0205     int cd;
0206     EX_hash_handle hh;         /* makes this structure hashable */
0207 };
0208 
0209 typedef struct atmi_xa_tx_cd atmi_xa_tx_cd_t;
0210 
0211 /**
0212  * Why this hash is needed?
0213  */
0214 struct atmi_xa_tx_info
0215 {
0216     ATMI_XA_TX_INFO_FIELDS;
0217     
0218     long btid;           /**< Branch TID, used locally only atmi procs      */
0219     int tranid_flags;    /**< Local/tranid flags, matches is_tx_initiator
0220                           * of TPTRANID (wich is not renamed for compatiblity*/
0221     /*int is_ax_reg_called;  Have work done, needs xa_end()!                */
0222 
0223     atmi_xa_tx_cd_t *call_cds;  /* hash list of call descriptors involved in tx 
0224                                  * (checked for commit/abort/tpreturn)      */
0225     atmi_xa_tx_cd_t *conv_cds;  /* hash list of conversation open           */
0226     
0227     EX_hash_handle hh;         /* makes this structure hashable             */
0228 };
0229 typedef struct atmi_xa_tx_info atmi_xa_tx_info_t;
0230 
0231 /* Current thread transaction info block */
0232 struct atmi_xa_curtx
0233 {
0234     int is_xa_open;      /**< Is xa_open for current thread                 */
0235     int is_xa_conn_error; /**< Is connection failed?                        */
0236     atmi_xa_tx_info_t *tx_tab; /**< transaction descriptors, table          */
0237     
0238     /* TODO: We should have hash list here with open transactions
0239      * And we should have a pointer to current transaction.
0240      * Hash is done by transaction id.
0241      * This is needed for suspend/resume purposes, so that we suspen one
0242      * and continue with other.
0243      * is_in_tx, is_tx_suspended, is_tx_initiator should be moved to txinfo!!!
0244      */
0245     atmi_xa_tx_info_t *txinfo; /**< we need a ptr to current transaction    */
0246     
0247 };
0248 typedef struct atmi_xa_curtx atmi_xa_curtx_t;
0249 
0250 /**
0251  * Transaction entry (mysql, postgresql for each connect session requires
0252  * new TID)
0253  */
0254 struct atmi_xa_rm_status_btid
0255 {
0256     char rmstatus;  /**< RM=1 index is 0                            */
0257     int  rmerrorcode;/**< ATMI error code                           */
0258     short rmreason; /**< Reason code of RM                          */
0259     long btid;      /**< Transaction ID in branch                   */
0260     short rmid;     /**< Resource manager ID (starting from 1)      */
0261     
0262     EX_hash_handle hh;         /**< makes this structure hashable   */
0263 };
0264 typedef struct atmi_xa_rm_status_btid atmi_xa_rm_status_btid_t;
0265 
0266 /**
0267  * Resource monitor status during the prepare-commit phase
0268  */
0269 struct atmi_xa_rm_status
0270 {
0271 #if 0
0272     char rmstatus; /* RM=1 index is 0 */
0273     int  rmerrorcode; /* ATMI error code */
0274     short  rmreason; /* Reason code of RM */
0275 #endif
0276     /* TODO:
0277      * - Have a TID counter here 
0278      * - add linked list or hash list? Seems like linked list should
0279      *   be enough. We could use DL list here, so that we can quickly
0280      *   find the last position to which add. But if we read the logs
0281      *   we need to update RM statuses, and that access will be done
0282      *   on per transaction basis. Thus EXHASH is needed here.
0283      */
0284     
0285     atmi_xa_rm_status_btid_t *btid_hash; /**<  Branch TID Hash */
0286     
0287     long tidcounter;   /**< TID counter*/
0288 };
0289 typedef struct atmi_xa_rm_status atmi_xa_rm_status_t;
0290 
0291 /**
0292  * TM's journal about transaction
0293  * This structure should be hashable.
0294  */
0295 struct atmi_xa_log
0296 {
0297     ATMI_XA_TX_INFO_FIELDS;         /**< tmknownrms not used!!!  */
0298 
0299     /* Log the date & time with transaction is open*/
0300     unsigned long long t_start;     /**< when tx started */
0301     unsigned long long t_update;    /**< wehn tx updated (last) */
0302     
0303     short   txstage;  /**< In what state we are */
0304     
0305     /* the list of RMs (the ID is index) statuses.
0306      * 0x0 indicates that RM is not in use.
0307      * TODO: Under "rmstatus" we need an array of branch xids.
0308      * To cope with Postgresql and Mysql - as for these
0309      * there is no JOIN, thus any processing unit is new
0310      * transaction, even under the same resource manager.
0311      * This we need status for each of the branches and these
0312      * branches will drive the final status. At RM level we
0313      * just need to know that we are involved.
0314      */
0315     atmi_xa_rm_status_t rmstatus[NDRX_MAX_RMS]; /* RM=1 index is 0 */
0316     
0317     char fname[PATH_MAX+1];    /**< Full file name of the transaction log file */
0318     FILE *f; /* the transaction file descriptor (where stuff is logged) */
0319     
0320     /* background processing: */
0321     long trycount;              /**< Number of attempts */
0322     /* Have a timer for active transaction (to watch for time-outs)  */
0323     ndrx_stopwatch_t ttimer;    /**< transaction timer */
0324     long txtout;                /**< Number of seconds for timeout */
0325     
0326     int is_background;          /**< Is background responsible for tx? */
0327     uint64_t    lockthreadid;   /**< Thread ID, locked the log entry */
0328     
0329     int log_version;            /**< Log file version number*/
0330 
0331     long sg_sequence;           /**< sequence number of singleton group lock */
0332     
0333     EX_hash_handle hh;          /**< makes this structure hashable */
0334 };
0335 typedef struct atmi_xa_log atmi_xa_log_t;
0336 
0337 
0338 typedef struct atmi_xa_log_list atmi_xa_log_list_t;
0339 struct atmi_xa_log_list
0340 {
0341     atmi_xa_log_t p_tl;/* copy of transaction */
0342     /* Linked list 
0343     atmi_xa_log_dl_t *prev;*/
0344     atmi_xa_log_list_t *next;
0345 };
0346 
0347 /**
0348  * XA State (Global transaction & branch) driving
0349  */
0350 struct rmstate_driver
0351 {
0352     short   txstage;      /* Global transaction stage          */
0353     char    rmstatus;     /* Current RM status, 1              */
0354     int     op;           /* XA Operation                      */
0355  
0356     int     min_retcode;  /* Return code of XA function        */
0357     int     max_retcode;  /* Return code of XA function        */
0358     char    next_rmstatus;/* New resource manager status       */
0359     short   next_txstage; /* Vote next global transaction stage*/
0360 };
0361 typedef struct rmstate_driver rmstatus_driver_t;
0362 
0363 /**
0364  * List of operations to do for particular tx state/rm status:
0365  */
0366 struct txaction_driver
0367 {
0368     short   txstage;      /* Global transaction stage          */
0369     char    rmstatus;     /* Current RM status, 1              */
0370     int     op;           /* XA Operation                      */
0371 };
0372 typedef struct txaction_driver txaction_driver_t;
0373 
0374 /**
0375  * State descriptors
0376  */
0377 struct txstate_descriptor
0378 {
0379     short   txstage;          /* Global transaction stage            */
0380     short   txs_stage_min;    /* minimums state to say at that level */
0381     short   txs_min_complete; /* minimum complete stage              */
0382     short   txs_max_complete; /* maximum complete stage              */
0383     char    descr[64];        /* stage description                   */
0384     int     allow_jump;       /* Allow jump to different group       */
0385 };
0386 typedef struct txstate_descriptor txstage_descriptor_t;
0387 
0388 
0389 struct txstate2tperrno
0390 {
0391     short   txstage;          /* Global transaction stage            */
0392     int     master_op;        /* Master operation (commit or abort)  */
0393     int     tpe;              /* tperrno */
0394 };
0395 typedef struct txstate2tperrno txstate2tperrno_t;
0396 
0397 
0398 /*---------------------------Globals------------------------------------*/
0399 /*---------------------------Statics------------------------------------*/
0400 /*---------------------------Prototypes---------------------------------*/
0401     
0402     
0403 /* ATMI XA lib */
0404 extern NDRX_API int atmi_xa_init(void);
0405 extern NDRX_API void atmi_xa_uninit(void);
0406 extern NDRX_API int atmi_xa_open_entry(void);
0407 extern NDRX_API int atmi_xa_close_entry(int for_retry);
0408 extern NDRX_API int atmi_xa_start_entry(XID *xid, long flags, int ping_try);
0409 extern NDRX_API int atmi_xa_end_entry(XID *xid, long flags, int aborting);
0410 extern NDRX_API int atmi_xa_prepare_entry(XID *xid, long flags);
0411 extern NDRX_API int atmi_xa_commit_entry(XID *xid, long flags);
0412 extern NDRX_API int atmi_xa_rollback_entry(XID *xid, long flags);
0413 extern NDRX_API int atmi_xa_recover_entry(XID *xids, long count, int rmid, long flags);
0414 extern NDRX_API int atmi_xa_forget_entry(XID *xid, long flags);
0415 
0416 extern NDRX_API UBFH* atmi_xa_call_tm_generic(char cmd, int call_any, short rmid,
0417                     atmi_xa_tx_info_t *p_xai, long flags, long btid);
0418 extern NDRX_API UBFH* atmi_xa_call_tm_generic_fb(char cmd, char *svcnm_spec, int call_any, short rmid, 
0419         atmi_xa_tx_info_t *p_xai, UBFH *p_ub);
0420 extern NDRX_API UBFH* atmi_xa_call_tm_rmstatus(atmi_xa_tx_info_t *p_xai, char rmstatus);
0421 
0422 /* interface to ATMI lib/utils */
0423 extern NDRX_API char * atmi_xa_serialize_xid(XID *xid, char *xid_str_out);
0424 extern NDRX_API void atmi_xa_xid_str_get_info(char *xid_str, short *p_nodeid, 
0425         short *p_srvid, unsigned char *p_rmid_start, 
0426         unsigned char *p_rmid_cur, long *p_btid);
0427 
0428 extern NDRX_API void atmi_xa_xid_get_info(XID *xid, short *p_nodeid, 
0429         short *p_srvid, unsigned char *p_rmid_start, 
0430         unsigned char *p_rmid_cur, long *p_btid);
0431 
0432 extern NDRX_API XID* atmi_xa_deserialize_xid(unsigned char *xid_str, XID *xid_out);
0433 extern NDRX_API int atmi_xa_load_tx_info(UBFH *p_ub, atmi_xa_tx_info_t *p_xai);
0434 extern NDRX_API void atmi_xa_print_knownrms(int dbglev, char *msg, char *tmknownrms);
0435 extern NDRX_API int atmi_xa_update_known_rms(char *dst_tmknownrms, char *src_tmknownrms);
0436 extern NDRX_API int atmi_xa_is_current_rm_known(char *tmknownrms);
0437 extern NDRX_API void atmi_xa_curtx_del(atmi_xa_tx_info_t *p_txinfo);
0438 
0439 extern NDRX_API UBFH * atmi_xa_alloc_tm_call(char cmd);
0440 extern NDRX_API int atmi_xa_reset_tm_call(UBFH *p_ub);
0441 extern NDRX_API int atmi_xa_set_curtx_from_xai(atmi_xa_tx_info_t *p_xai);
0442 extern NDRX_API void atmi_xa_reset_curtx(void);
0443 extern NDRX_API void atmi_xa_print_knownrms(int dbglev, char *msg, char *tmknownrms);
0444 extern NDRX_API int atmi_xa_read_tx_info(UBFH *p_ub, atmi_xa_tx_info_t *p_xai, int flags);
0445 extern NDRX_API XID* atmi_xa_get_branch_xid(atmi_xa_tx_info_t *p_xai, long btid);
0446 extern NDRX_API void atmi_xa_cpy_xai_to_call(tp_command_call_t *call, atmi_xa_tx_info_t *p_xai);
0447 
0448 /* CD registration with transaction: */
0449 extern NDRX_API int atmi_xa_cd_reg(atmi_xa_tx_cd_t **cds, int cd);
0450 extern NDRX_API atmi_xa_tx_cd_t * atmi_xa_cd_find(atmi_xa_tx_cd_t **cds, int cd);
0451 extern NDRX_API int atmi_xa_cd_isanyreg(atmi_xa_tx_cd_t **cds);
0452 extern NDRX_API void atmi_xa_cd_unreg(atmi_xa_tx_cd_t **cds, int cd);
0453 extern NDRX_API int atmi_xa_cd_unregall(atmi_xa_tx_cd_t **cds);
0454 extern NDRX_API int ndrx_tmfilter_common(char *svcnm);
0455 extern NDRX_API int ndrx_tmfilter_srv(char *svcnm);
0456 
0457 /* API sections */
0458 extern NDRX_API int ndrx_tpopen(void);
0459 extern NDRX_API int ndrx_tpclose(void);
0460 extern NDRX_API int ndrx_tpbegin(unsigned long timeout, long flags);
0461 extern NDRX_API int ndrx_tpcommit(long flags);
0462 extern NDRX_API int ndrx_tpabort(long flags, int call_xa_end);
0463 extern NDRX_API int ndrx_tpsuspend (TPTRANID *tranid, long flags, int is_contexting);
0464 extern NDRX_API int ndrx_tpresume (TPTRANID *tranid, long flags);
0465 extern NDRX_API int ndrx_tpscmt(long flags);
0466 extern NDRX_API int ndrx_tx_info(TXINFO * txinfo);
0467 
0468 extern NDRX_API int _tp_srv_join_or_new_from_call(tp_command_call_t *call, int is_ax_reg_callback);
0469 extern NDRX_API int _tp_srv_join_or_new(atmi_xa_tx_info_t *p_xai, int is_ax_reg_callback,
0470                     int *p_is_known, long join_flag, int tranid_flags);
0471 extern NDRX_API int _tp_srv_disassoc_tx(int rollback_on_fail, int *end_fail);
0472 extern NDRX_API int _tp_srv_tell_tx_fail(void);
0473 
0474 /* State driving */
0475 extern NDRX_API rmstatus_driver_t* xa_status_get_next_by_op(short txstage, char rmstatus, 
0476                                                     int op, int op_retcode,
0477                                                     atmi_xa_tx_info_t *p_xai, 
0478                                                     short rmid, long btid);
0479 extern NDRX_API rmstatus_driver_t* xa_status_get_next_by_new_status(short   txstage, 
0480                                                     char next_rmstatus);
0481 extern NDRX_API int xa_status_get_op(short txstage, char rmstatus);
0482 extern NDRX_API txstage_descriptor_t* xa_stage_get_descr(short txstage);
0483 extern NDRX_API int xa_txstage2tperrno(short txstage, int master_op);
0484 
0485 extern NDRX_API atmi_xa_curtx_t *ndrx_get_G_atmi_xa_curtx(void);
0486 
0487 #ifdef  __cplusplus
0488 }
0489 #endif
0490 
0491 #endif  /* XA_CMN */
0492 
0493 /* vim: set ts=4 sw=4 et smartindent: */