1 | /*************************************** 2 | $Revision: 1.2 $ 3 | 4 | Error reporting (er) er.c - er_RX_errors.h - definition of errors for the 5 | error reporting module (used in test only). 6 | 7 | Status: NOT REVUED, TESTED, 8 | 9 | Design and implementation by: Marek Bukowy 10 | 11 | ******************/ /****************** 12 | Copyright (c) 1999 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 | 50 | /* step 1 */ 51 | 52 | typedef enum { 53 | ER_LOW_TOOSTU=0, 54 | ER_LOW_TOOLAT 55 | } ER_err_code_t; 56 | 57 | /* step 2 */ 58 | 59 | #define ER_TOOSTU ER_SEV_F + (FAC_ER<<16) + ER_LOW_TOOSTU 60 | #define ER_TOOLAT ER_SEV_E + (FAC_ER<<16) + ER_LOW_TOOLAT 61 | 62 | 63 | /* step 3 */ 64 | 65 | #ifdef ER_IMPL 66 | er_list_t ER_mod_err[]={ 67 | { ERDUP(ER_TOOSTU), "You're too stupid to use this. Program aborted" }, 68 | { ERDUP(ER_TOOLAT), "Now it's %u, it is too late for this to work!" }, 69 | ER_LASTTXT 70 | }; 71 | 72 | #endif /* ER_IMPL */