Initial import from FreeBSD RELENG_4:
[dragonfly.git] / usr.sbin / i4b / isdndecode / pcause.c
1 /*
2  * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23  * SUCH DAMAGE.
24  *
25  *---------------------------------------------------------------------------
26  *
27  *      pcause.c - printing cause values
28  *      --------------------------------
29  *
30  *      $Id: pcause.c,v 1.5 1999/12/13 21:25:25 hm Exp $
31  *
32  * $FreeBSD: src/usr.sbin/i4b/isdndecode/pcause.c,v 1.6.2.1 2001/08/01 17:45:05 obrien Exp $
33  *
34  *      last edit-date: [Mon Dec 13 21:51:20 1999]
35  *
36  *---------------------------------------------------------------------------*/
37
38 #include "decode.h"
39 #include "pcause.h"
40
41 char *
42 print_cause_q850(unsigned char code)
43 {
44         static char error_message[120];
45         char *e;
46
47         switch(code)
48         {
49                 case CAUSE_Q850_SHUTDN:
50                         e = "normal D-channel shutdown";
51                         break;
52
53                 case CAUSE_Q850_NUNALLC:
54                         e = "Unallocated (unassigned) number";
55                         break;
56
57                 case CAUSE_Q850_NRTTN:
58                         e = "No route to specified transit network";
59                         break;
60
61                 case CAUSE_Q850_NRTDST:
62                         e = "No route to destination";
63                         break;
64
65                 case CAUSE_Q850_SSINFTN:
66                         e = "Send special information tone";
67                         break;
68
69                 case CAUSE_Q850_MDIALTP:
70                         e = "Misdialled trunk prefix";
71                         break;
72
73                 case CAUSE_Q850_CHUNACC:
74                         e = "Channel unacceptable";
75                         break;
76
77                 case CAUSE_Q850_CALLAWD:
78                         e = "Call awarded and being delivered in an established channel";
79                         break;
80
81                 case CAUSE_Q850_PREEMPT:
82                         e = "Preemption";
83                         break;
84
85                 case CAUSE_Q850_PREECRR:
86                         e = "Preemption - circuit reserved for reuse";
87                         break;
88
89                 case CAUSE_Q850_NCCLR:
90                         e = "Normal call clearing";
91                         break;
92
93                 case CAUSE_Q850_USRBSY:
94                         e = "User busy";
95                         break;
96
97                 case CAUSE_Q850_NOUSRRSP:
98                         e = "No user responding";
99                         break;
100
101                 case CAUSE_Q850_NOANSWR:
102                         e = "No answer from user (user alerted)";
103                         break;
104
105                 case CAUSE_Q850_SUBSABS:
106                         e = "Subscriber absent";
107                         break;
108
109                 case CAUSE_Q850_CALLREJ:
110                         e = "Call rejected";
111                         break;
112
113                 case CAUSE_Q850_NUCHNG:
114                         e = "Number changed";
115                         break;
116
117                 case CAUSE_Q850_NONSELUC:
118                         e = "Non-selected user clearing";
119                         break;
120
121                 case CAUSE_Q850_DSTOOORDR:
122                         e = "Destination out of order";
123                         break;
124
125                 case CAUSE_Q850_INVNUFMT:
126                         e = "Invalid number format";
127                         break;
128
129                 case CAUSE_Q850_FACREJ:
130                         e = "Facility rejected";
131                         break;
132
133                 case CAUSE_Q850_STENQRSP:
134                         e = "Response to STATUS ENQUIRY";
135                         break;
136
137                 case CAUSE_Q850_NORMUNSP:
138                         e = "Normal, unspecified";
139                         break;
140
141                 case CAUSE_Q850_NOCAVAIL:
142                         e = "No circuit / channel available";
143                         break;
144
145                 case CAUSE_Q850_NETOOORDR:
146                         e = "Network out of order";
147                         break;
148
149                 case CAUSE_Q850_PFMCDOOSERV:
150                         e = "Permanent frame mode connection out of service";
151                         break;
152
153                 case CAUSE_Q850_PFMCOPER:
154                         e = "Permanent frame mode connection operational";
155                         break;
156
157                 case CAUSE_Q850_TMPFAIL:
158                         e = "Temporary failure";
159                         break;
160
161                 case CAUSE_Q850_SWEQCONG:
162                         e = "Switching equipment congestion";
163                         break;
164
165                 case CAUSE_Q850_ACCINFDIS:
166                         e = "Access information discarded";
167                         break;
168
169                 case CAUSE_Q850_REQCNOTAV:
170                         e = "Requested circuit/channel not available";
171                         break;
172
173                 case CAUSE_Q850_PRECALBLK:
174                         e = "Precedence call blocked";
175                         break;
176
177                 case CAUSE_Q850_RESUNAVAIL:
178                         e = "Resources unavailable, unspecified";
179                         break;
180
181                 case CAUSE_Q850_QOSUNAVAIL:
182                         e = "Quality of service unavailable";
183                         break;
184
185                 case CAUSE_Q850_REQSERVNS:
186                         e = "Requested facility not subscribed";
187                         break;
188
189                 case CAUSE_Q850_OCBARRCUG:
190                         e = "Outgoing calls barred within CUG";
191                         break;
192
193                 case CAUSE_Q850_ICBARRCUG:
194                         e = "Incoming calls barred within CUG";
195                         break;
196
197                 case CAUSE_Q850_BCAPNAUTH:
198                         e = "Bearer capability not authorized";
199                         break;
200
201                 case CAUSE_Q850_BCAPNAVAIL:
202                         e = "Bearer capability not presently available";
203                         break;
204
205                 case CAUSE_Q850_INCSTOACISC:
206                         e = "Inconsistenciy in designated outg. access info and subscriber class";
207                         break;
208
209                 case CAUSE_Q850_SOONOTAVAIL:
210                         e = "Service or option not available, unspecified";
211                         break;
212
213                 case CAUSE_Q850_BCAPNOTIMPL:
214                         e = "Bearer capability not implemented";
215                         break;
216
217                 case CAUSE_Q850_CHTYPNIMPL:
218                         e = "Channel type not implemented";
219                         break;
220
221                 case CAUSE_Q850_REQFACNIMPL:
222                         e = "Requested facility not implemented";
223                         break;
224
225                 case CAUSE_Q850_ORDINBCAVL:
226                         e = "Only restricted digital information bearer capability is available";
227                         break;
228
229                 case CAUSE_Q850_SOONOTIMPL:
230                         e = "Service or option not implemented, unspecified";
231                         break;
232
233                 case CAUSE_Q850_INVCLRFVAL:
234                         e = "Invalid call reference value";
235                         break;
236
237                 case CAUSE_Q850_IDCHDNOEX:
238                         e = "Identified channel does not exist";
239                         break;
240
241                 case CAUSE_Q850_SUSCAEXIN:
242                         e = "A suspended call exists, but this call identity does not";
243                         break;
244
245                 case CAUSE_Q850_CLIDINUSE:
246                         e = "Call identity in use";
247                         break;
248
249                 case CAUSE_Q850_NOCLSUSP:
250                         e = "No call suspended";
251                         break;
252
253                 case CAUSE_Q850_CLIDCLRD:
254                         e = "Call having the requested call identity has been cleared";
255                         break;
256
257                 case CAUSE_Q850_UNOTMEMCUG:
258                         e = "User not member of CUG";
259                         break;
260
261                 case CAUSE_Q850_INCDEST:
262                         e = "Incompatible destination";
263                         break;
264
265                 case CAUSE_Q850_NONEXCUG:
266                         e = "Non-existent CUG";
267                         break;
268
269                 case CAUSE_Q850_INVNTWSEL:
270                         e = "Invalid transit network selection";
271                         break;
272
273                 case CAUSE_Q850_INVMSG:
274                         e = "Invalid message, unspecified";
275                         break;
276
277                 case CAUSE_Q850_MIEMISS:
278                         e = "Mandatory information element is missing";
279                         break;
280
281                 case CAUSE_Q850_MSGTNI:
282                         e = "Message type non-existent or not implemented";
283                         break;
284
285                 case CAUSE_Q850_MSGNCMPT:
286                         e = "Msg incompatible with call state/message type non-existent/not implemented";
287                         break;
288
289                 case CAUSE_Q850_IENENI:
290                         e = "Information element/parameter non-existent or not implemented";
291                         break;
292
293                 case CAUSE_Q850_INVIEC:
294                         e = "Invalid information element contents";
295                         break;
296
297                 case CAUSE_Q850_MSGNCWCS:
298                         e = "Message not compatible with call state";
299                         break;
300
301                 case CAUSE_Q850_RECOTIMEXP:
302                         e = "Recovery on timer expiry";
303                         break;
304
305                 case CAUSE_Q850_PARMNENIPO:
306                         e = "Parameter non-existent or not implemented, passed on";
307                         break;
308
309                 case CAUSE_Q850_MSGUNRDPRM:
310                         e = "Message with unrecognized parameter, discarded";
311                         break;
312
313                 case CAUSE_Q850_PROTERR:
314                         e = "Protocol error, unspecified";
315                         break;
316
317                 case CAUSE_Q850_INTWRKU:
318                         e = "Interworking, unspecified";
319                         break;
320
321                 default:
322                         e = "ERROR, unknown cause value!";
323                         break;
324         }
325
326         sprintf(error_message, "%d: %s (Q.850)", code, e);
327         return(error_message);
328 }
329
330 /* EOF */