Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief NSTD library - header file for error handling.
0003  *
0004  * @file nerror.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 NERROR_H
0035 #define NERROR_H
0036 
0037 #ifdef  __cplusplus
0038 extern "C" {
0039 #endif
0040 
0041 /*---------------------------Includes-----------------------------------*/
0042 /*---------------------------Externs------------------------------------*/
0043 /*---------------------------Macros-------------------------------------*/
0044 #define MAX_ERROR_LEN   1024
0045 
0046 #define NMINVAL             0 /**< min error */
0047 #define NEINVALINI          1 /**< Invalid INI file */
0048 #define NEMALLOC            2 /**< Malloc failed */
0049 #define NEUNIX              3 /**< Unix error occurred */
0050 #define NEINVAL             4 /**< Invalid value passed to function */
0051 #define NESYSTEM            5 /**< System failure */
0052 #define NEMANDATORY         6 /**< Mandatory field is missing */
0053 #define NEFORMAT            7 /**< Format error */
0054 #define NETOUT              8 /**< Time-out condition */
0055 #define NENOCONN            9 /**< Connection not found */
0056 #define NELIMIT            10 /**< Limit reached */
0057 #define NEPLUGIN           11 /**< Plugin error */
0058 #define NENOSPACE          12 /**< No space */
0059 #define NEINVALKEY         13 /**< Invalid key (probably) */
0060 #define NENOENT            14 /**< No such file or directory */
0061 #define NEWRITE            15 /**< Failed to open/write */
0062 #define NEEXEC             16 /**< Failed to execute */
0063 #define NESUPPORT          17 /**< Command not supported */
0064 #define NEEXISTS           18 /**< Duplicate action */
0065 #define NEVERSION          19 /**< API version conflict */
0066 #define NEBUSY             19 /**< Resource is busy */
0067 #define NMAXVAL            20 /**< max error */
0068 
0069 #define Nerror  (*_Nget_Nerror_addr())
0070 
0071    
0072 /*---------------------------Enums--------------------------------------*/
0073 /*---------------------------Typedefs-----------------------------------*/
0074 /*---------------------------Globals------------------------------------*/
0075 /*---------------------------Statics------------------------------------*/
0076 /*---------------------------Prototypes---------------------------------*/
0077 extern NDRX_API char * ndrx_Necodestr(int err);
0078 extern NDRX_API char * ndrx_Nemsg_buf(void);
0079 extern NDRX_API void _Nset_error(int error_code);
0080 extern NDRX_API char * Nstrerror (int err);
0081 extern NDRX_API char * Nmsgerror (void);
0082 extern NDRX_API char * ndrx_Nstrerror2 (int err);
0083 extern NDRX_API void _Nset_error_msg(int error_code, char *msg);
0084 extern NDRX_API void _Nset_error_fmt(int error_code, const char *fmt, ...);
0085 /* Is error already set?  */
0086 extern NDRX_API int _Nis_error(void);
0087 extern NDRX_API void _Nappend_error_msg(char *msg);
0088 
0089 extern NDRX_API void _Nunset_error(void);
0090 
0091 extern NDRX_API int * _Nget_Nerror_addr (void);
0092 
0093 #ifdef  __cplusplus
0094 }
0095 #endif
0096 
0097 #endif  /* NERROR_H */
0098 
0099 /* vim: set ts=4 sw=4 et smartindent: */