Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / sys / net / i4b / layer3 / i4b_q931.c
1 /*
2  * Copyright (c) 1997, 2000 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  *      i4b_q931.c - Q931 received messages handling
28  *      --------------------------------------------
29  *
30  *      $Id: i4b_q931.c,v 1.32 2000/08/24 11:48:58 hm Exp $ 
31  *
32  * $FreeBSD: src/sys/i4b/layer3/i4b_q931.c,v 1.6.2.1 2001/08/10 14:08:42 obrien Exp $
33  * $DragonFly: src/sys/net/i4b/layer3/i4b_q931.c,v 1.2 2003/06/17 04:28:40 dillon Exp $
34  *
35  *      last edit-date: [Mon May 29 16:56:52 2000]
36  *
37  *---------------------------------------------------------------------------*/
38
39 #ifdef __FreeBSD__
40 #include "i4bq931.h"
41 #else
42 #define NI4BQ931        1
43 #endif
44
45 #if NI4BQ931 > 0
46
47 #include <sys/param.h>
48 #include <sys/systm.h>
49 #include <sys/mbuf.h>
50
51 #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
52 #include <sys/callout.h>
53 #endif
54
55 #ifdef __FreeBSD__
56 #include <machine/i4b_debug.h>
57 #include <machine/i4b_ioctl.h>
58 #include <machine/i4b_cause.h>
59 #else
60 #include <i4b/i4b_debug.h>
61 #include <i4b/i4b_ioctl.h>
62 #include <i4b/i4b_cause.h>
63 #endif
64
65 #include <i4b/include/i4b_isdnq931.h>
66 #include <i4b/include/i4b_l3l4.h>
67 #include <i4b/include/i4b_global.h>
68
69 #include <i4b/layer3/i4b_l3.h>
70 #include <i4b/layer3/i4b_l3fsm.h>
71 #include <i4b/layer3/i4b_q931.h>
72
73 #include <i4b/layer4/i4b_l4.h>
74
75 #ifndef __FreeBSD__
76 #define memcpy(d,s,l)   bcopy(s,d,l)
77 #endif
78
79 unsigned int i4b_l3_debug = L3_DEBUG_DEFAULT;
80
81 call_desc_t call_desc[N_CALL_DESC];     /* call descriptor array */
82 ctrl_desc_t ctrl_desc[MAX_CONTROLLERS]; /* controller description array */
83 int utoc_tab[MAX_CONTROLLERS];          /* unit to controller conversion */
84
85 /* protocol independent causes -> Q.931 causes */
86
87 unsigned char cause_tab_q931[CAUSE_I4B_MAX] = {
88         CAUSE_Q850_NCCLR,       /* CAUSE_I4B_NORMAL -> normal call clearing */
89         CAUSE_Q850_USRBSY,      /* CAUSE_I4B_BUSY -> user busy */
90         CAUSE_Q850_NOCAVAIL,    /* CAUSE_I4B_NOCHAN -> no circuit/channel available*/
91         CAUSE_Q850_INCDEST,     /* CAUSE_I4B_INCOMP -> incompatible destination */
92         CAUSE_Q850_CALLREJ,     /* CAUSE_I4B_REJECT -> call rejected */
93         CAUSE_Q850_DSTOOORDR,   /* CAUSE_I4B_OOO -> destination out of order */
94         CAUSE_Q850_TMPFAIL,     /* CAUSE_I4B_TMPFAIL -> temporary failure */
95         CAUSE_Q850_USRBSY,      /* CAUSE_I4B_L1ERROR -> L1 error / persistent deact XXX */
96         CAUSE_Q850_USRBSY,      /* CAUSE_I4B_LLDIAL -> no dialout on leased line XXX */
97 };      
98
99 /*---------------------------------------------------------------------------*
100  *      setup cr ref flag according to direction
101  *---------------------------------------------------------------------------*/
102 unsigned char
103 setup_cr(call_desc_t *cd, unsigned char cr)
104 {
105         if(cd->crflag == CRF_ORIG)
106                 return(cr & 0x7f);      /* clear cr ref flag */
107         else if(cd->crflag == CRF_DEST)
108                 return(cr | 0x80);      /* set cr ref flag */
109         else
110                 panic("setup_cr: invalid crflag!\n"); 
111 }
112
113 /*---------------------------------------------------------------------------*
114  *      decode and process a Q.931 message
115  *---------------------------------------------------------------------------*/
116 void
117 i4b_decode_q931(int unit, int msg_len, u_char *msg_ptr)
118 {
119         call_desc_t *cd;
120         int codeset = CODESET_0;
121         int old_codeset = CODESET_0;
122         int shift_flag = UNSHIFTED;
123         int crlen = 0;
124         int crval = 0;
125         int crflag = 0;
126         int i;  
127         int offset;
128         int s;
129         
130         /* check protocol discriminator */
131         
132         if(*msg_ptr != PD_Q931)
133         {
134                 static int protoflag = -1;      /* print only once .. */
135
136                 if(*msg_ptr != protoflag)
137                 {
138                         NDBGL3(L3_P_ERR, "unknown protocol discriminator 0x%x!", *msg_ptr);
139                         protoflag = *msg_ptr;
140                 }                       
141                 return;
142         }
143
144         msg_ptr++;
145         msg_len--;
146
147         s = SPLI4B();           /* this has to be protected ! */
148         
149         /* extract call reference */
150
151         crlen = *msg_ptr & CRLENGTH_MASK;
152         msg_ptr++;
153         msg_len--;
154         
155         if(crlen != 0)
156         {
157                 crval += *msg_ptr & 0x7f;
158                 crflag = (*msg_ptr >> 7) & 0x01;
159                 msg_ptr++;
160                 msg_len--;
161                 
162                 for(i=1; i < crlen; i++)
163                 {
164                         crval += *msg_ptr;
165                         msg_ptr++;
166                         msg_len--;                      
167                 }
168         }
169         else
170         {
171                 crval = 0;
172                 crflag = 0;
173         }
174                         
175         NDBGL3(L3_P_MSG, "Call Ref, len %d, val %d, flag %d", crlen, crval, crflag);
176
177         /* find or allocate calldescriptor */
178
179         if((cd = cd_by_unitcr(unit, crval,
180                         crflag == CRF_DEST ? CRF_ORIG : CRF_DEST)) == NULL)
181         {
182                 if(*msg_ptr == SETUP)
183                 {
184                         /* get and init new calldescriptor */
185
186                         cd = reserve_cd();      /* cdid filled in */
187                         cd->controller = utoc_tab[unit];
188                         cd->cr = crval;         
189                         cd->crflag = CRF_DEST;  /* we are the dest side */
190                         cd->ilt = NULL;         /* reset link tab ptrs */
191                         cd->dlt = NULL;
192                 }
193                 else
194                 {
195 /*XXX*/                 if(crval != 0)  /* ignore global call references */
196                         {
197                                 NDBGL3(L3_P_ERR, "cannot find calldescriptor for cr = 0x%x, crflag = 0x%x, msg = 0x%x, frame = ", crval, crflag, *msg_ptr);
198                                 i4b_print_frame(msg_len, msg_ptr);
199                         }
200                         splx(s);
201                         return;
202                 }
203         }
204
205         splx(s);
206
207         /* decode and handle message type */
208         
209         i4b_decode_q931_message(unit, cd, *msg_ptr);
210         msg_ptr++;
211         msg_len--;
212         
213         /* process information elements */
214
215         while(msg_len > 0)
216         {
217                 /* check for shift codeset IE */
218                 
219                 if((*msg_ptr & 0x80) && ((*msg_ptr & 0xf0) == SOIE_SHIFT))
220                 {
221                         if(!(*msg_ptr & SHIFT_LOCK))
222                                 shift_flag = SHIFTED;
223
224                         old_codeset = codeset;
225                         codeset = *msg_ptr & CODESET_MASK;
226
227                         if((shift_flag != SHIFTED) &&
228                            (codeset <= old_codeset))
229                         {
230                                 NDBGL3(L3_P_ERR, "Q.931 lockingshift proc violation, shift %d -> %d", old_codeset, codeset);
231                                 codeset = old_codeset;
232                         }
233                         msg_len--;
234                         msg_ptr++;
235                 }
236
237                 /* process one IE for selected codeset */
238                 
239                 switch(codeset)
240                 {
241                         case CODESET_0:
242                                 offset = i4b_decode_q931_cs0_ie(unit, cd, msg_len, msg_ptr);
243                                 msg_len -= offset;
244                                 msg_ptr += offset;
245                                 break;
246                                 
247                         default:
248                                 NDBGL3(L3_P_ERR, "unknown codeset %d, ", codeset);
249                                 i4b_print_frame(msg_len, msg_ptr);
250                                 msg_len = 0;
251                                 break;
252                 }
253
254                 /* check for non-locking shifts */
255                 
256                 if(shift_flag == SHIFTED)
257                 {
258                         shift_flag = UNSHIFTED;
259                         codeset = old_codeset;
260                 }
261         }
262         next_l3state(cd, cd->event);
263 }
264
265 /*---------------------------------------------------------------------------*
266  *      decode and process one Q.931 codeset 0 information element
267  *---------------------------------------------------------------------------*/
268 int
269 i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr)
270 {
271         int i, j;
272         char *p;
273         
274         switch(*msg_ptr)
275         {
276
277 /*********/
278 /* Q.931 */
279 /*********/
280                 /* single byte IE's */
281                 
282                 case IEI_SENDCOMPL:
283                         NDBGL3(L3_P_MSG, "IEI_SENDCOMPL");
284                         return(1);
285                         break;
286
287                 /* multi byte IE's */
288                 
289                 case IEI_SEGMMSG:       /* segmented message */
290                         NDBGL3(L3_P_MSG, "IEI_SEGMENTED_MESSAGE");
291                         break;
292                         
293                 case IEI_BEARERCAP:     /* bearer capability */
294                         switch(msg_ptr[2])
295                         {
296                                 case 0x80:      /* speech */
297                                 case 0x89:      /* restricted digital info */
298                                 case 0x90:      /* 3.1KHz audio */
299 /* XXX */                               cd->bprot = BPROT_NONE;
300                                         NDBGL3(L3_P_MSG, "IEI_BEARERCAP - Telephony");
301                                         break;
302
303                                 case 0x88:      /* unrestricted digital info */
304 /* XXX */                               cd->bprot = BPROT_RHDLC;
305                                         NDBGL3(L3_P_MSG, "IEI_BEARERCAP - Raw HDLC");
306                                         break;
307
308                                 default:
309 /* XXX */                               cd->bprot = BPROT_NONE;
310                                         NDBGL3(L3_P_ERR, "IEI_BEARERCAP - Unsupported B-Protocol 0x%x", msg_ptr[2]);
311                                         break;
312                         }
313                         break;
314         
315                 case IEI_CAUSE:         /* cause */
316                         if(msg_ptr[2] & 0x80)
317                         {
318                                 cd->cause_in = msg_ptr[3] & 0x7f;
319                                 NDBGL3(L3_P_MSG, "IEI_CAUSE = %d", msg_ptr[3] & 0x7f);
320                         }
321                         else
322                         {
323                                 cd->cause_in = msg_ptr[4] & 0x7f;
324                                 NDBGL3(L3_P_MSG, "IEI_CAUSE = %d", msg_ptr[4] & 0x7f);
325                         }
326                         break;
327         
328                 case IEI_CALLID:        /* call identity */
329                         NDBGL3(L3_P_MSG, "IEI_CALL_IDENTITY");
330                         break;
331
332                 case IEI_CALLSTATE:     /* call state           */
333                         cd->call_state = msg_ptr[2] & 0x3f;             
334                         NDBGL3(L3_P_MSG, "IEI_CALLSTATE = %d", cd->call_state);
335                         break;
336                         
337                 case IEI_CHANNELID:     /* channel id */
338                         if((msg_ptr[2] & 0xf4) != 0x80)
339                         {
340                                 cd->channelid = CHAN_NO;
341                                 NDBGL3(L3_P_ERR, "IEI_CHANNELID, unsupported value 0x%x", msg_ptr[2]);
342                         }
343                         else
344                         {
345                                 switch(msg_ptr[2] & 0x03)
346                                 {
347                                         case IE_CHAN_ID_NO:
348                                                 cd->channelid = CHAN_NO;
349                                                 break;
350                                         case IE_CHAN_ID_B1:
351                                                 cd->channelid = CHAN_B1;
352                                                 break;
353                                         case IE_CHAN_ID_B2:
354                                                 cd->channelid = CHAN_B2;
355                                                 break;
356                                         case IE_CHAN_ID_ANY:
357                                                 cd->channelid = CHAN_ANY;
358                                                 break;
359                                 }
360                                 cd->channelexcl = (msg_ptr[2] & 0x08) >> 3;
361
362                                 NDBGL3(L3_P_MSG, "IEI_CHANNELID - channel %d, exclusive = %d", cd->channelid, cd->channelexcl);
363
364                                 /* if this is a setup message, reserve channel */
365                                 
366                                 if(cd->event == EV_SETUP)
367                                 {
368                                         if((cd->channelid == CHAN_B1) || (cd->channelid == CHAN_B2))
369                                         {
370                                                 if(ctrl_desc[cd->controller].bch_state[cd->channelid] == BCH_ST_FREE)
371                                                         ctrl_desc[cd->controller].bch_state[cd->channelid] = BCH_ST_RSVD;
372                                                 else
373                                                         NDBGL3(L3_P_ERR, "IE ChannelID, Channel NOT free!!");
374                                         }
375                                         else if(cd->channelid == CHAN_NO)
376                                         {
377                                                 NDBGL3(L3_P_MSG, "IE ChannelID, SETUP with channel = No channel (CW)");
378                                         }
379                                         else /* cd->channelid == CHAN_ANY */
380                                         {
381                                                 NDBGL3(L3_P_ERR, "ERROR: IE ChannelID, SETUP with channel = Any channel!");
382                                         }
383                                 }
384                         }
385                         break;                          
386         
387                 case IEI_PROGRESSI:     /* progress indicator   */
388                         NDBGL3(L3_P_MSG, "IEI_PROGRESSINDICATOR");
389                         break;
390                         
391                 case IEI_NETSPCFAC:     /* network specific fac */
392                         NDBGL3(L3_P_MSG, "IEI_NETSPCFAC");
393                         break;
394                         
395                 case IEI_NOTIFIND:      /* notification indicator */
396                         NDBGL3(L3_P_MSG, "IEI_NOTIFICATION_INDICATOR");
397                         break;
398                         
399                 case IEI_DISPLAY:       /* display              */
400                         memcpy(cd->display, &msg_ptr[2], min(DISPLAY_MAX, msg_ptr[1]));
401                         cd->display[min(DISPLAY_MAX, msg_ptr[1])] = '\0';
402                         NDBGL3(L3_P_MSG, "IEI_DISPLAY = %s", cd->display);
403                         break;
404                         
405                 case IEI_DATETIME:      /* date/time            */
406                         i = 2;
407                         j = msg_ptr[1];
408                         p = &(cd->datetime[0]);
409                         *p = '\0';
410                         
411                         for(j = msg_ptr[1]; j > 0; j--, i++)
412                                 sprintf(p+strlen(p), "%02d", msg_ptr[i]);
413                         
414                         NDBGL3(L3_P_MSG, "IEI_DATETIME = %s", cd->datetime);
415                         break;
416                         
417                 case IEI_KEYPAD:        /* keypad facility */
418                         NDBGL3(L3_P_MSG, "IEI_KEYPAD_FACILITY");
419                         break;
420                         
421                 case IEI_SIGNAL:        /* signal type */
422                         NDBGL3(L3_P_MSG, "IEI_SIGNAL = %d", msg_ptr[2]);
423                         break;
424
425                 case IEI_INFRATE:       /* information rate */
426                         NDBGL3(L3_P_MSG, "IEI_INFORMATION_RATE");
427                         break;
428
429                 case IEI_ETETDEL:       /* end to end transit delay */
430                         NDBGL3(L3_P_MSG, "IEI_END_TO_END_TRANSIT_DELAY");
431                         break;
432
433                 case IEI_CUG:           /* closed user group */
434                         NDBGL3(L3_P_MSG, "IEI_CLOSED_USER_GROUP");
435                         break;
436
437                 case IEI_CALLINGPN:     /* calling party no */
438                         if(msg_ptr[2] & 0x80) /* no presentation/screening indicator ? */
439                         {
440                                 memcpy(cd->src_telno, &msg_ptr[3], min(TELNO_MAX, msg_ptr[1]-1));
441                                 cd->src_telno[min(TELNO_MAX, msg_ptr[1] - 1)] = '\0';
442                                 cd->scr_ind = SCR_NONE;
443                                 cd->prs_ind = PRS_NONE;                         
444                         }
445                         else
446                         {
447                                 memcpy(cd->src_telno, &msg_ptr[4], min(TELNO_MAX, msg_ptr[1]-2));
448                                 cd->src_telno[min(TELNO_MAX, msg_ptr[1] - 2)] = '\0';
449                                 cd->scr_ind = (msg_ptr[3] & 0x03) + SCR_USR_NOSC;
450                                 cd->prs_ind = ((msg_ptr[3] >> 5) & 0x03) + PRS_ALLOWED;
451                         }
452                         NDBGL3(L3_P_MSG, "IEI_CALLINGPN = %s", cd->src_telno);
453                         break;
454         
455                 case IEI_CALLINGPS:     /* calling party subaddress */
456                         NDBGL3(L3_P_MSG, "IEI_CALLINGPS");
457                         break;
458                         
459                 case IEI_CALLEDPN:      /* called party number */
460                         memcpy(cd->dst_telno, &msg_ptr[3], min(TELNO_MAX, msg_ptr[1]-1));
461                         cd->dst_telno[min(TELNO_MAX, msg_ptr [1] - 1)] = '\0';
462                         NDBGL3(L3_P_MSG, "IEI_CALLED = %s", cd->dst_telno); 
463                         break;
464         
465                 case IEI_CALLEDPS:      /* called party subaddress */
466                         NDBGL3(L3_P_MSG, "IEI_CALLEDPS");
467                         break;
468
469                 case IEI_REDIRNO:       /* redirecting number */
470                         NDBGL3(L3_P_MSG, "IEI_REDIRECTING_NUMBER");
471                         break;
472
473                 case IEI_TRNSEL:        /* transit network selection */
474                         NDBGL3(L3_P_MSG, "IEI_TRANSIT_NETWORK_SELECTION");
475                         break;
476
477                 case IEI_RESTARTI:      /* restart indicator */
478                         NDBGL3(L3_P_MSG, "IEI_RESTART_INDICATOR");
479                         break;
480
481                 case IEI_LLCOMPAT:      /* low layer compat */
482                         NDBGL3(L3_P_MSG, "IEI_LLCOMPAT");
483                         break;
484                         
485                 case IEI_HLCOMPAT:      /* high layer compat    */
486                         NDBGL3(L3_P_MSG, "IEI_HLCOMPAT");
487                         break;
488                         
489                 case IEI_USERUSER:      /* user-user */
490                         NDBGL3(L3_P_MSG, "IEI_USER_USER");
491                         break;
492                         
493                 case IEI_ESCAPE:        /* escape for extension */
494                         NDBGL3(L3_P_MSG, "IEI_ESCAPE");
495                         break;
496                         
497 /*********/
498 /* Q.932 */
499 /*********/
500                 case IEI_FACILITY:      /* facility             */
501                         NDBGL3(L3_P_MSG, "IEI_FACILITY");
502                         if(i4b_aoc(msg_ptr, cd) > -1)
503                                 i4b_l4_charging_ind(cd);
504                         break;
505                         
506 /*********/
507 /* Q.95x */
508 /*********/
509                 case IEI_CONCTDNO:      /* connected number     */
510                         NDBGL3(L3_P_MSG, "IEI_CONCTDNO");
511                         break;
512                         
513                         
514                 default:
515                         NDBGL3(L3_P_ERR, "Unknown IE %d - ", *msg_ptr);
516                         i4b_print_frame(msg_ptr[1]+2, msg_ptr);
517                         break;
518         }
519         return(msg_ptr[1] + 2);
520 }
521
522 /*---------------------------------------------------------------------------*
523  *      decode and process one Q.931 codeset 0 information element
524  *---------------------------------------------------------------------------*/
525 void
526 i4b_decode_q931_message(int unit, call_desc_t *cd, u_char message_type)
527 {
528         char *m = NULL;
529         
530         cd->event = EV_ILL;
531
532         switch(message_type)
533         {
534                 /* call establishment */
535
536                 case ALERT:
537                         cd->event = EV_ALERT;                   
538                         m = "ALERT";
539                         break;
540                         
541                 case CALL_PROCEEDING:
542                         cd->event = EV_CALLPRC;
543                         m = "CALL_PROCEEDING";
544                         break;
545                         
546                 case PROGRESS:
547                         cd->event = EV_PROGIND;
548                         m = "PROGRESS";
549                         break;
550                         
551                 case SETUP:
552                         m = "SETUP";
553                         cd->bprot = BPROT_NONE;
554                         cd->cause_in = 0;
555                         cd->cause_out = 0;                      
556                         cd->dst_telno[0] = '\0';
557                         cd->src_telno[0] = '\0';
558                         cd->channelid = CHAN_NO;
559                         cd->channelexcl = 0;
560                         cd->display[0] = '\0';
561                         cd->datetime[0] = '\0';                 
562                         cd->event = EV_SETUP;
563                         break;
564                         
565                 case CONNECT:
566                         m = "CONNECT";
567                         cd->datetime[0] = '\0';         
568                         cd->event = EV_CONNECT;                 
569                         break;
570                         
571                 case SETUP_ACKNOWLEDGE:
572                         m = "SETUP_ACKNOWLEDGE";
573                         cd->event = EV_SETUPAK;
574                         break;
575                         
576                 case CONNECT_ACKNOWLEDGE:
577                         m = "CONNECT_ACKNOWLEDGE";
578                         cd->event = EV_CONACK;
579                         break;
580                         
581                 /* call information */
582
583                 case USER_INFORMATION:
584                         m = "USER_INFORMATION";
585                         break;
586         
587                 case SUSPEND_REJECT:
588                         m = "SUSPEND_REJECT";
589                         break;
590                         
591                 case RESUME_REJECT:
592                         m = "RESUME_REJECT";
593                         break;
594                         
595                 case HOLD:
596                         m = "HOLD";
597                         break;
598                         
599                 case SUSPEND:
600                         m = "SUSPEND";
601                         break;
602                         
603                 case RESUME:
604                         m = "RESUME";
605                         break;
606                         
607                 case HOLD_ACKNOWLEDGE:
608                         m = "HOLD_ACKNOWLEDGE";
609                         break;
610                         
611                 case SUSPEND_ACKNOWLEDGE:
612                         m = "SUSPEND_ACKNOWLEDGE";
613                         break;
614                         
615                 case RESUME_ACKNOWLEDGE:
616                         m = "RESUME_ACKNOWLEDGE";
617                         break;
618                         
619                 case HOLD_REJECT:
620                         m = "HOLD_REJECT";
621                         break;
622                         
623                 case RETRIEVE:
624                         m = "RETRIEVE";
625                         break;
626                         
627                 case RETRIEVE_ACKNOWLEDGE:
628                         m = "RETRIEVE_ACKNOWLEDGE";
629                         break;
630                         
631                 case RETRIEVE_REJECT:
632                         m = "RETRIEVE_REJECT";
633                         break;
634                         
635                 /* call clearing */
636
637                 case DISCONNECT:
638                         m = "DISCONNECT";
639                         cd->event = EV_DISCONN;
640                         break;
641         
642                 case RESTART:
643                         m = "RESTART";
644                         break;
645                         
646                 case RELEASE:
647                         m = "RELEASE";
648                         cd->event = EV_RELEASE;
649                         break;
650                         
651                 case RESTART_ACKNOWLEDGE:
652                         m = "RESTART_ACKNOWLEDGE";
653                         break;
654                         
655                 case RELEASE_COMPLETE:
656                         m = "RELEASE_COMPLETE";
657                         cd->event = EV_RELCOMP;         
658                         break;
659                         
660                 /* misc messages */
661
662                 case SEGMENT:
663                         m = "SEGMENT";
664                         break;
665         
666                 case FACILITY:
667                         m = "FACILITY";
668                         cd->event = EV_FACILITY;                
669                         break;
670                         
671                 case REGISTER:
672                         m = "REGISTER";
673                         break;
674                         
675                 case NOTIFY:
676                         m = "NOTIFY";
677                         break;
678                         
679                 case STATUS_ENQUIRY:
680                         m = "STATUS_ENQUIRY";
681                         cd->event = EV_STATENQ;         
682                         break;
683                         
684                 case CONGESTION_CONTROL:
685                         m = "CONGESTION_CONTROL";
686                         break;
687                         
688                 case INFORMATION:
689                         m = "INFORMATION";
690                         cd->event = EV_INFO;            
691                         break;
692                         
693                 case STATUS:
694                         m = "STATUS";
695                         cd->event = EV_STATUS;          
696                         break;
697                         
698                 default:
699                         NDBGL3(L3_P_ERR, "unit %d, cr = 0x%02x, msg = 0x%02x", unit, cd->cr, message_type);
700                         break;
701         }
702         if(m)
703         {
704                 NDBGL3(L3_PRIM, "%s: unit %d, cr = 0x%02x\n", m, unit, cd->cr);
705         }
706 }
707
708 #endif /* NI4BQ931 > 0 */