Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief Persistent queue commons
0003  *
0004  * @file qcommon.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 QCOMMON_H
0035 #define QCOMMON_H
0036 
0037 #ifdef  __cplusplus
0038 extern "C" {
0039 #endif
0040 /*---------------------------Includes-----------------------------------*/
0041 #include <stdint.h>
0042 #include <ubf.h>
0043 #include <atmi.h>
0044 /*---------------------------Externs------------------------------------*/
0045 /*---------------------------Macros-------------------------------------*/
0046 #define TMQ_DEFAULT_BUFSZ               1024 /* default buffer size     */
0047     
0048 /* Commands loaded into EX_QCMD: */
0049 #define TMQ_CMD_ENQUEUE         'E'      /**< Enqueue                     */
0050 #define TMQ_CMD_DEQUEUE         'D'      /**< Dequeue                     */
0051 #define TMQ_CMD_MQLQ            'P'      /**< Print queue                 */
0052 #define TMQ_CMD_MQLC            'C'      /**< List configuration of q     */
0053 #define TMQ_CMD_MQLM            'M'      /**< List messages               */
0054 #define TMQ_CMD_MQRC            'R'      /**< Reload config               */
0055 #define TMQ_CMD_MQCH            'H'      /**< Change Q  config (runtime)  */
0056     
0057 /* XA Commands: */
0058 #define TMQ_CMD_STARTTRAN       'b'      /**< Start new transaction       */
0059 #define TMQ_CMD_ABORTTRAN       'a'      /**< Rollback entry              */
0060 #define TMQ_CMD_PREPARETRAN     'p'      /**< Prepare entry               */
0061 #define TMQ_CMD_COMMITRAN       'c'      /**< Commit entry                */
0062 #define TMQ_CMD_CHK_MEMLOG      'v'      /**< Check transaction log       */
0063 #define TMQ_CMD_CHK_MEMLOG2     'z'      /**< Check log, restart if no fil*/
0064 
0065 #define TMQ_QDEF_MAX            512      /**< max buffer size for Q def   */
0066     
0067 /**
0068  * This is list of commands to manage files by tmqueue instead of xa driver
0069  * so that state is fully in sync
0070  * @defgroup tmqfilecmd
0071  * @{
0072  */
0073 #define TMQ_FILECMD_RENAME      'R'      /**< Rename files              */
0074 #define TMQ_FILECMD_UNLINK      'U'      /**< Unlink files              */
0075 /** @} */ /* end of tmqfilecmd */
0076     
0077 /*---------------------------Enums--------------------------------------*/
0078 /*---------------------------Typedefs-----------------------------------*/
0079 /*---------------------------Globals------------------------------------*/
0080 /*---------------------------Statics------------------------------------*/
0081 /*---------------------------Prototypes---------------------------------*/
0082     
0083 extern NDRX_API int tmq_tpqctl_to_ubf_enqreq(UBFH *p_ub, TPQCTL *ctl);
0084 extern NDRX_API int tmq_tpqctl_from_ubf_enqreq(UBFH *p_ub, TPQCTL *ctl);
0085 
0086 extern NDRX_API int tmq_tpqctl_to_ubf_enqrsp(UBFH *p_ub, TPQCTL *ctl);
0087 extern NDRX_API int tmq_tpqctl_from_ubf_enqrsp(UBFH *p_ub, TPQCTL *ctl);
0088 
0089 extern NDRX_API int tmq_tpqctl_to_ubf_deqreq(UBFH *p_ub, TPQCTL *ctl);
0090 extern NDRX_API int tmq_tpqctl_from_ubf_deqreq(UBFH *p_ub, TPQCTL *ctl);
0091 
0092 extern NDRX_API int tmq_tpqctl_to_ubf_deqrsp(UBFH *p_ub, TPQCTL *ctl);
0093 extern NDRX_API int tmq_tpqctl_from_ubf_deqrsp(UBFH *p_ub, TPQCTL *ctl);
0094 
0095 extern NDRX_API char * tmq_msgid_serialize(char *msgid_in, char *msgid_str_out);
0096 extern NDRX_API char * tmq_msgid_deserialize(char *msgid_str_in, char *msgid_out);
0097 
0098 /* API: */
0099 extern NDRX_API int ndrx_tpenqueue (char *qspace, short nodeid, short srvid, char *qname, TPQCTL *ctl, 
0100         char *data, long len, long flags);
0101 
0102 extern NDRX_API int ndrx_tpdequeue (char *qspace, short nodeid, short srvid, char *qname, TPQCTL *ctl, 
0103         char **data, long *len, long flags);
0104 #ifdef  __cplusplus
0105 }
0106 #endif
0107 
0108 #endif  /* QCOMMON_H */
0109 
0110 /* vim: set ts=4 sw=4 et smartindent: */