Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief Enduro/X ATMI Error handling header
0003  *
0004  * @file tperror.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 TPERROR_H
0035 #define TPERROR_H
0036 
0037 #ifdef  __cplusplus
0038 extern "C" {
0039 #endif
0040 
0041 /*---------------------------Includes-----------------------------------*/
0042 #include <regex.h>
0043 #include <ndrstandard.h>
0044 #include <ubf_int.h>
0045 #include <errno.h>
0046 /*---------------------------Externs------------------------------------*/
0047 /*---------------------------Macros-------------------------------------*/
0048 #define MAX_TP_ERROR_LEN   1024
0049 /*---------------------------Enums--------------------------------------*/
0050 /*---------------------------Typedefs-----------------------------------*/
0051     
0052 /**
0053  * ATMI error handler save/restore
0054  */
0055 typedef struct
0056 {
0057     char atmi_error_msg_buf[MAX_TP_ERROR_LEN+1];
0058     int atmi_error;
0059     short atmi_reason;
0060 } atmi_error_t;
0061 
0062 /*---------------------------Globals------------------------------------*/
0063 /*---------------------------Statics------------------------------------*/
0064 /*---------------------------Prototypes---------------------------------*/
0065 
0066 extern NDRX_API void ndrx_TPset_error_nstd(void);
0067 extern NDRX_API void ndrx_TPset_error(int error_code);
0068 extern NDRX_API void ndrx_TPset_error_msg(int error_code, char *msg);
0069 extern NDRX_API void ndrx_TPset_error_fmt(int error_code, const char *fmt, ...);
0070 extern NDRX_API void ndrx_TPset_error_fmt_rsn(int error_code, short reason, const char *fmt, ...);
0071 extern NDRX_API void ndrx_TPset_error_fmt_rsn_silent(int error_code, 
0072         short reason, const char *fmt, ...);
0073 extern NDRX_API void ndrx_TPset_error_ubf(UBFH *p_ub);
0074 extern NDRX_API void ndrx_TPunset_error(void);
0075 extern NDRX_API int ndrx_TPis_error(void);
0076 extern NDRX_API void ndrx_TPappend_error_msg(char *msg);
0077 extern NDRX_API void ndrx_TPoverride_code(int error_code);
0078 
0079 extern NDRX_API void ndrx_TPsave_error(atmi_error_t *p_err);
0080 extern NDRX_API void ndrx_TPrestore_error(atmi_error_t *p_err);
0081 
0082 /* xa error handling */
0083 extern NDRX_API void atmi_xa_set_error(UBFH *p_ub, short error_code, short reason);
0084 extern NDRX_API void atmi_xa_set_error_msg(UBFH *p_ub, short error_code, short reason, char *msg);
0085 extern NDRX_API void atmi_xa_set_error_fmt(UBFH *p_ub, short error_code, short reason, const char *fmt, ...);
0086 extern NDRX_API void atmi_xa_override_error(UBFH *p_ub, short error_code);
0087 extern NDRX_API void atmi_xa_unset_error(UBFH *p_ub);
0088 extern NDRX_API int atmi_xa_is_error(UBFH *p_ub);
0089 extern NDRX_API void atmi_xa_error_msg(UBFH *p_ub, char *msg);
0090 extern NDRX_API void atmi_xa2tperr(UBFH *p_ub);
0091 extern NDRX_API char *atmi_xa_geterrstr(int code);
0092 extern NDRX_API void atmi_xa_approve(UBFH *p_ub);
0093 extern NDRX_API short atmi_xa_get_reason(void);
0094 #ifdef  __cplusplus
0095 }
0096 #endif
0097 
0098 #endif  /* TPERROR_H */
0099 
0100 /* vim: set ts=4 sw=4 et smartindent: */