Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / usr.sbin / i4b / isdnd / 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  *      printing cause values
28  *      ---------------------
29  *
30  *      $Id: pcause.c,v 1.13 2000/10/09 12:53:29 hm Exp $
31  *
32  * $FreeBSD: src/usr.sbin/i4b/isdnd/pcause.c,v 1.6.2.2 2001/08/01 17:45:03 obrien Exp $
33  * $DragonFly: src/usr.sbin/i4b/isdnd/pcause.c,v 1.2 2003/06/17 04:29:54 dillon Exp $
34  *
35  *      last edit-date: [Mon Dec 13 21:48:07 1999]
36  *
37  *---------------------------------------------------------------------------*/
38
39 #include "isdnd.h"
40
41 static char *cause_i4b_tab[CAUSE_I4B_MAX+1];
42 static char *cause_q850_tab[CAUSE_Q850_MAX];
43
44 char *
45 print_i4b_cause(cause_t code)
46 {
47         static char error_message[128];
48
49         snprintf(error_message, sizeof(error_message), "%d: ", GET_CAUSE_VAL(code));
50
51         switch(GET_CAUSE_TYPE(code))
52         {
53                 case CAUSET_Q850:
54                         strcat(error_message, cause_q850_tab[GET_CAUSE_VAL(code)]);
55                         strcat(error_message, " (Q.850)");
56                         break;
57
58                 case CAUSET_I4B:
59                         if((GET_CAUSE_VAL(code) < CAUSE_I4B_NORMAL) ||
60                            (GET_CAUSE_VAL(code) >= CAUSE_I4B_MAX))
61                         {
62                                 SET_CAUSE_VAL(code, CAUSE_I4B_MAX);
63                         }
64                         strcat(error_message, cause_i4b_tab[GET_CAUSE_VAL(code)]);
65                         strcat(error_message, " (I4B)");
66                         break;
67
68                 default:
69                         strcat(error_message, "ERROR: unknown cause type!");
70                         break;
71         }
72         return(error_message);
73 }
74
75 static char *cause_i4b_tab[CAUSE_I4B_MAX+1] = {
76         "normal call clearing",
77         "user busy",
78         "channel not available",
79         "incompatible source or destination",
80         "call rejected",
81         "destination out of order",
82         "temporary failure",
83         "layer 1 error / persistent deactivation",
84         "dialing impossible on leased line",    
85         "ERROR, invalid I4B cause value!"
86 };
87
88 static char *cause_q850_tab[CAUSE_Q850_MAX] = {
89         "Normal D-channel shutdown",
90         "Unallocated (unassigned) number",
91         "No route to specified transit network (national use)",
92         "No route to destination",
93         "Send special information tone",
94         "Misdialled trunk prefix (national use)",
95         "Channel unacceptable",
96         "Call awarded and being delivered in an established channel",
97         "Preemption",
98         "Preemption - circuit reserved for reuse",
99
100 /*10*/  "cause code 10: error, unassigned in Q.850 (03/93)",
101         "cause code 11: error, unassigned in Q.850 (03/93)",
102         "cause code 12: error, unassigned in Q.850 (03/93)",
103         "cause code 13: error, unassigned in Q.850 (03/93)",
104         "cause code 14: error, unassigned in Q.850 (03/93)",
105         "cause code 15: error, unassigned in Q.850 (03/93)",
106         "Normal call clearing",
107         "User busy",
108         "No user responding",
109         "No answer from user (user alerted)",
110
111 /*20*/  "Subscriber absent",
112         "Call rejected",
113         "Number changed",
114         "cause code 23: error, unassigned in Q.850 (03/93)",
115         "cause code 24: error, unassigned in Q.850 (03/93)",
116         "cause code 25: error, unassigned in Q.850 (03/93)",
117         "Non-selected user clearing",
118         "Destination out of order",
119         "Invalid number format",
120         "Facility rejected",
121
122 /*30*/  "Response to STATUS ENQUIRY",
123         "Normal, unspecified",
124         "cause code 32: error, unassigned in Q.850 (03/93)",
125         "cause code 33: error, unassigned in Q.850 (03/93)",    
126         "No circuit / channel available",
127         "cause code 35: error, unassigned in Q.850 (03/93)",
128         "cause code 36: error, unassigned in Q.850 (03/93)",
129         "cause code 37: error, unassigned in Q.850 (03/93)",    
130         "Network out of order",
131         "Permanent frame mode connection out of service",
132
133 /*40*/  "Permanent frame mode connection operational",
134         "Temporary failure",
135         "Switching equipment congestion",
136         "Access information discarded",
137         "Requested circuit/channel not available",
138         "cause code 45: error, unassigned in Q.850 (03/93)",
139         "Precedence call blocked",
140         "Resources unavailable, unspecified",
141         "cause code 48: error, unassigned in Q.850 (03/93)",
142         "Quality of service unavailable",
143
144 /*50*/  "Requested facility not subscribed",
145         "cause code 51: error, unassigned in Q.850 (03/93)",
146         "cause code 52: error, unassigned in Q.850 (03/93)",
147         "Outgoing calls barred within CUG",
148         "cause code 54: error, unassigned in Q.850 (03/93)",
149         "Incoming calls barred within CUG",
150         "cause code 56: error, unassigned in Q.850 (03/93)",
151         "Bearer capability not authorized",
152         "Bearer capability not presently available",
153         "cause code 59: error, unassigned in Q.850 (03/93)",
154         
155 /*60*/  "cause code 60: error, unassigned in Q.850 (03/93)",
156         "cause code 61: error, unassigned in Q.850 (03/93)",    
157         "Inconsistenciy in designated outg. access info and subscriber class",
158         "Service or option not available, unspecified",
159         "cause code 64: error, unassigned in Q.850 (03/93)",    
160         "Bearer capability not implemented",
161         "Channel type not implemented",
162         "cause code 67: error, unassigned in Q.850 (03/93)",
163         "cause code 68: error, unassigned in Q.850 (03/93)",
164         "Requested facility not implemented",
165
166 /*70*/  "Only restricted digital information bearer capability is available",
167         "cause code 71: error, unassigned in Q.850 (03/93)",
168         "cause code 72: error, unassigned in Q.850 (03/93)",
169         "cause code 73: error, unassigned in Q.850 (03/93)",
170         "cause code 74: error, unassigned in Q.850 (03/93)",
171         "cause code 75: error, unassigned in Q.850 (03/93)",
172         "cause code 76: error, unassigned in Q.850 (03/93)",
173         "cause code 77: error, unassigned in Q.850 (03/93)",
174         "cause code 78: error, unassigned in Q.850 (03/93)",    
175         "Service or option not implemented, unspecified",
176
177 /*80*/  "cause code 80: error, unassigned in Q.850 (03/93)",
178         "Invalid call reference value",
179         "Identified channel does not exist",
180         "A suspended call exists, but this call identity does not",
181         "Call identity in use",
182         "No call suspended",
183         "Call having the requested call identity has been cleared",
184         "User not member of CUG",
185         "Incompatible destination",
186         "cause code 89: error, unassigned in Q.850 (03/93)",
187         
188 /*90*/  "Non-existent CUG",
189         "Invalid transit network selection",
190         "cause code 92: error, unassigned in Q.850 (03/93)",
191         "cause code 93: error, unassigned in Q.850 (03/93)",
192         "cause code 94: error, unassigned in Q.850 (03/93)",
193         "Invalid message, unspecified",
194         "Mandatory information element is missing",
195         "Message type non-existent or not implemented",
196         "Message not compatible with call state or message type non-existent or not implemented",
197         "Information element/parameter non-existent or not implemented",
198
199 /*100*/ "Invalid information element contents",
200         "Message not compatible with call state",
201         "Recovery on timer expiry",
202         "Parameter non-existent or not implemented, passed on",
203         "cause code 104: error, unassigned in Q.850 (03/93)",
204         "cause code 105: error, unassigned in Q.850 (03/93)",
205         "cause code 106: error, unassigned in Q.850 (03/93)",
206         "cause code 107: error, unassigned in Q.850 (03/93)",
207         "cause code 108: error, unassigned in Q.850 (03/93)",
208         "cause code 109: error, unassigned in Q.850 (03/93)",   
209
210 /*110*/ "Message with unrecognized parameter, discarded",
211         "Protocol error, unspecified",
212         "cause code 112: error, unassigned in Q.850 (03/93)",
213         "cause code 113: error, unassigned in Q.850 (03/93)",
214         "cause code 114: error, unassigned in Q.850 (03/93)",
215         "cause code 115: error, unassigned in Q.850 (03/93)",
216         "cause code 116: error, unassigned in Q.850 (03/93)",
217         "cause code 117: error, unassigned in Q.850 (03/93)",
218         "cause code 118: error, unassigned in Q.850 (03/93)",
219         "cause code 119: error, unassigned in Q.850 (03/93)",
220
221 /*120*/ "cause code 120: error, unassigned in Q.850 (03/93)",
222         "cause code 121: error, unassigned in Q.850 (03/93)",
223         "cause code 122: error, unassigned in Q.850 (03/93)",
224         "cause code 123: error, unassigned in Q.850 (03/93)",
225         "cause code 124: error, unassigned in Q.850 (03/93)",
226         "cause code 125: error, unassigned in Q.850 (03/93)",
227         "cause code 126: error, unassigned in Q.850 (03/93)",
228         "Interworking, unspecified"
229 };
230
231 /* EOF */