1    | /***************************************
2    |   $Revision: 2.3 $
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 COMPLETE, NOT REVUED, NOT TESTED, 
8    | 
9    |   Design and implementation by: daniele@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   | typedef enum {
70   |   /*  fac  code    sev  descr
71   |       
72   |       current facility specified inside the line below as CFAC
73   |    */
74   | 
75   |    LOW_MM_OK ,
76   |    LOW_MM_CANTOPEN ,
77   |    LOW_MM_LINETOOLONG ,
78   |    LOW_MM_INVMBX ,
79   |    LOW_MM_WARNCCL ,
80   |    LOW_MM_ERRCCL ,
81   |    LOW_MM_FATCCL 
82   | } MM_err_code_t;
83   | 
84   | /* paste the #define'd codes */
85   | #define MM_OK  (ER_SEV_I + (FAC_MM<<16) + LOW_MM_OK)
86   | #define MM_CANTOPEN  (ER_SEV_F + (FAC_MM<<16) + LOW_MM_CANTOPEN)
87   | #define MM_LINETOOLONG  (ER_SEV_F + (FAC_MM<<16) + LOW_MM_LINETOOLONG)
88   | #define MM_INVMBX  (ER_SEV_F + (FAC_MM<<16) + LOW_MM_INVMBX)
89   | #define MM_WARNCCL  (ER_SEV_W + (FAC_MM<<16) + LOW_MM_WARNCCL)
90   | #define MM_ERRCCL  (ER_SEV_E + (FAC_MM<<16) + LOW_MM_ERRCCL)
91   | #define MM_FATCCL  (ER_SEV_F + (FAC_MM<<16) + LOW_MM_FATCCL)
92   |  
93   | 
94   | #ifdef ER_IMPL
95   | er_list_t MM_mod_err[]={
96   | 
97   |   /* paste the ERDUP's */
98   |     { ERDUP(MM_OK),"OK" },
99   |   { ERDUP(MM_CANTOPEN),"Cannot open file" },
100  |   { ERDUP(MM_LINETOOLONG),"Line too long: line number" },
101  |   { ERDUP(MM_INVMBX),"Invalid mailbox:" },
102  |   { ERDUP(MM_WARNCCL),"Warning from c-client:" },
103  |   { ERDUP(MM_ERRCCL),"Error from c-client:" },
104  |   { ERDUP(MM_FATCCL),"Fatal error from c-client:" },
105  |  
106  |   
107  |   ER_LASTTXT
108  | };
109  | #endif /* ER_IMPL */