1 | /*************************************** 2 | $Revision: 1.9 $ 3 | 4 | Error reporting (er) er.c - er_UP_errors.h - definition of errors for the 5 | error reporting module (used in test only). 6 | 7 | Status: NOT COMPLETE, NOT REVUED, NOT TESTED, 8 | 9 | Design and implementation by: engin@ripe.net 10 | 11 | ******************/ /****************** 12 | Copyright (c) 2000,2001,2002 RIPE NCC 13 | 14 | All Rights Reserved 15 | 16 | Permission to use, copy, modify, and distribute this software and its 17 | documentation for any purpose and without fee is hereby granted, 18 | provided that the above copyright notice appear in all copies and that 19 | both that copyright notice and this permission notice appear in 20 | supporting documentation, and that the name of the author not be 21 | used in advertising or publicity pertaining to distribution of the 22 | software without specific, written prior permission. 23 | 24 | THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 25 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL 26 | AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 27 | DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 28 | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 29 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 30 | ***************************************/ 31 | 32 | /* I see no way of automating things here... Maybe with a perl script. 33 | 34 | There are three things to do: 35 | 1. Get a new integer number from the enum 36 | (using a ??_LOW_<mnem> symbol) 37 | 2. define a new error code (??_<mnem>) by adding the facility and 38 | severity codes. 39 | 3. put the symbol (using macro ERDUP) and text of the message into the 40 | array. Should fit in one line with the macro. 41 | 42 | The order of codes in enum does NOT have to match the order of texts. 43 | The last in the texts array must be the ER_LASTTXT constant. 44 | 45 | Sounds familiar ? That's because facilities and errors are parts 46 | of the error reporting fractal :-) 47 | */ 48 | 49 | /* use m4 macros to keep stuff in sync */ 50 | 51 | 52 | 53 | 54 | /******************************************/ 55 | /* ***** DEFINE THE CURRENT FACILITY **** */ 56 | /* * make sure no whitespaces are inside! */ 57 | /* */ /* */ 58 | /* ************************************** */ 59 | /******************************************/ 60 | 61 | /* last thing: disable processing of commented text (this allows to comment 62 | out some macro entries. Alas, the #%$@&* designers screwed up, so now we 63 | have to manually disable messing with C preprocessor commands */ 64 | 65 | 66 | 67 | 68 | 69 | #ifndef _ER_UP_ 70 | #define _ER_UP_ 71 | 72 | 73 | typedef enum { 74 | /* fac code sev descr 75 | 76 | current facility specified inside the line below as CFAC 77 | */ 78 | 79 | LOW_UP_OK , 80 | LOW_UP_CANTOPEN , 81 | LOW_UP_CANTLOCK , 82 | LOW_UP_CONFERR , 83 | LOW_UP_CANTOPENW , 84 | LOW_UP_NOOBJECT , 85 | } UP_err_code_t; 86 | 87 | /* paste the #define'd codes */ 88 | #define UP_OK (ER_SEV_I + (FAC_UP<<16) + LOW_UP_OK) 89 | #define UP_CANTOPEN (ER_SEV_F + (FAC_UP<<16) + LOW_UP_CANTOPEN) 90 | #define UP_CANTLOCK (ER_SEV_F + (FAC_UP<<16) + LOW_UP_CANTLOCK) 91 | #define UP_CONFERR (ER_SEV_F + (FAC_UP<<16) + LOW_UP_CONFERR) 92 | #define UP_CANTOPENW (ER_SEV_W + (FAC_UP<<16) + LOW_UP_CANTOPENW) 93 | #define UP_NOOBJECT (ER_SEV_W + (FAC_UP<<16) + LOW_UP_NOOBJECT) 94 | 95 | 96 | #ifdef ER_IMPL 97 | er_list_t UP_mod_err[]={ 98 | 99 | /* paste the ERDUP's */ 100 | { ERDUP(UP_OK),"OK" }, 101 | { ERDUP(UP_CANTOPEN),"Cannot open file" }, 102 | { ERDUP(UP_CANTLOCK),"Cannot lock file" }, 103 | { ERDUP(UP_CONFERR),"Error in the config file" }, 104 | { ERDUP(UP_CANTOPENW),"Cannot open file" }, 105 | { ERDUP(UP_NOOBJECT),"Message contained no object" }, 106 | 107 | 108 | ER_LASTTXT 109 | }; 110 | #endif /* ER_IMPL */ 111 | #endif /* _ER_UP_ */