1 | /***************************************
2 | $Revision: 1.7 $
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 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. 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 | } UP_err_code_t;
85 |
86 | /* paste the #define'd codes */
87 | #define UP_OK (ER_SEV_I + (FAC_UP<<16) + LOW_UP_OK)
88 | #define UP_CANTOPEN (ER_SEV_F + (FAC_UP<<16) + LOW_UP_CANTOPEN)
89 | #define UP_CANTLOCK (ER_SEV_F + (FAC_UP<<16) + LOW_UP_CANTLOCK)
90 | #define UP_CONFERR (ER_SEV_F + (FAC_UP<<16) + LOW_UP_CONFERR)
91 | #define UP_CANTOPENW (ER_SEV_W + (FAC_UP<<16) + LOW_UP_CANTOPENW)
92 |
93 |
94 | #ifdef ER_IMPL
95 | er_list_t UP_mod_err[]={
96 |
97 | /* paste the ERDUP's */
98 | { ERDUP(UP_OK),"OK" },
99 | { ERDUP(UP_CANTOPEN),"Cannot open file" },
100 | { ERDUP(UP_CANTLOCK),"Cannot lock file" },
101 | { ERDUP(UP_CONFERR),"Error in the config file" },
102 | { ERDUP(UP_CANTOPENW),"Cannot open file" },
103 |
104 |
105 | ER_LASTTXT
106 | };
107 | #endif /* ER_IMPL */
108 | #endif /* _ER_UP_ */