modules: pull in most of FreeBSD's module linker changes
[dragonfly.git] / usr.sbin / i4b / isdntrace / q931.c
blob58b04ea7c99534f25f4cc91ecd822bfcd9f2566a
1 /*
2 * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
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.
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.
25 *---------------------------------------------------------------------------
27 * q931.c - print Q.931 traces
28 * ---------------------------
30 * $FreeBSD: src/usr.sbin/i4b/isdntrace/q931.c,v 1.6.2.2 2001/12/10 09:34:39 hm Exp $
31 * $DragonFly: src/usr.sbin/i4b/isdntrace/q931.c,v 1.3 2007/05/13 18:33:59 swildner Exp $
33 * last edit-date: [Mon Dec 10 10:32:33 2001]
35 *---------------------------------------------------------------------------*/
37 #include "trace.h"
39 /*---------------------------------------------------------------------------*
40 * decode Q.931 protocol
41 *---------------------------------------------------------------------------*/
42 void
43 decode_q931(char *pbuf, int n, int off, unsigned char *buf, int raw)
45 int codeset = 0;
46 int codelock = 0;
47 int oldcodeset = 0;
49 int pd;
50 int len;
51 int j;
52 int i;
54 if(n <= 0)
55 return;
57 *pbuf = '\0';
59 if(raw)
61 for (i = 0; i < n; i += 16)
63 sprintf((pbuf+strlen(pbuf)),"Dump:%.3d ", i+off);
64 for (j = 0; j < 16; j++)
65 if (i + j < n)
66 sprintf((pbuf+strlen(pbuf)),"%02x ", buf[i + j]);
67 else
68 sprintf((pbuf+strlen(pbuf))," ");
69 sprintf((pbuf+strlen(pbuf))," ");
70 for (j = 0; j < 16 && i + j < n; j++)
71 if (isprint(buf[i + j]))
72 sprintf((pbuf+strlen(pbuf)),"%c", buf[i + j]);
73 else
74 sprintf((pbuf+strlen(pbuf)),".");
75 sprintf((pbuf+strlen(pbuf)),"\n");
79 i = 0;
81 sprintf((pbuf+strlen(pbuf)), "Q931: ");
83 /* protocol discriminator */
85 pd = buf[i];
87 if(pd >= 0x00 && pd <= 0x07)
88 sprintf((pbuf+strlen(pbuf)), "pd=User-User (0x%02x)\n",pd);
89 else if(pd == 0x08)
90 sprintf((pbuf+strlen(pbuf)), "pd=Q.931/I.451, ");
91 else if(pd >= 0x10 && pd <= 0x3f)
92 sprintf((pbuf+strlen(pbuf)), "pd=Other Layer 3 or X.25 (0x%02x)\n",pd);
93 else if(pd >= 0x40 && pd <= 0x4f)
94 sprintf((pbuf+strlen(pbuf)), "pd=National Use (0x%02x)\n",pd);
95 else if(pd >= 0x50 && pd <= 0xfe)
96 sprintf((pbuf+strlen(pbuf)), "pd=Other Layer 3 or X.25 (0x%02x)\n",pd);
97 else
98 sprintf((pbuf+strlen(pbuf)), "pd=Reserved (0x%02x)\n",pd);
100 /* call reference */
102 i++;
104 len = buf[i] & 0x0f;
106 switch(len)
108 case 0:
109 sprintf((pbuf+strlen(pbuf)), "cr=Dummy, ");
110 break;
111 case 1:
112 sprintf((pbuf+strlen(pbuf)), "cr=0x%02x %s, ", (buf[i+1] & 0x7f), (buf[i+1] & 0x80) ? "(from destination)" : "(from origination)");
113 break;
114 case 2:
115 sprintf((pbuf+strlen(pbuf)), "cr=0x%02x 0x%02x %s, ", (buf[i+1] & 0x7f), (buf[i+2] & 0x7f), (buf[i+1] & 0x80) ? "(org)" : "(dst)");
116 break;
119 i += (len+1);
121 /* message type */
123 sprintf((pbuf+strlen(pbuf)), "message=");
125 switch(buf[i])
127 /* escape to nationally specific message type */
129 case 0x00:
130 sprintf((pbuf+strlen(pbuf)), "ESCAPE: ");
131 break;
133 /* call establishment */
135 case 0x01:
136 sprintf((pbuf+strlen(pbuf)), "ALERTING: ");
137 break;
138 case 0x02:
139 sprintf((pbuf+strlen(pbuf)), "CALL PROCEEDING: ");
140 break;
141 case 0x03:
142 sprintf((pbuf+strlen(pbuf)), "PROGRESS: ");
143 break;
144 case 0x05:
145 sprintf((pbuf+strlen(pbuf)), "SETUP: ");
146 break;
147 case 0x07:
148 sprintf((pbuf+strlen(pbuf)), "CONNECT: ");
149 break;
150 case 0x0d:
151 sprintf((pbuf+strlen(pbuf)), "SETUP ACKNOWLEDGE: ");
152 break;
153 case 0x0f:
154 sprintf((pbuf+strlen(pbuf)), "CONNECT ACKNOWLEDGE: ");
155 break;
157 /* call information phase */
159 case 0x20:
160 sprintf((pbuf+strlen(pbuf)), "USER INFORMATION: ");
161 break;
162 case 0x21:
163 sprintf((pbuf+strlen(pbuf)), "SUSPEND REJECT: ");
164 break;
165 case 0x22:
166 sprintf((pbuf+strlen(pbuf)), "RESUME REJECT: ");
167 break;
168 case 0x24:
169 sprintf((pbuf+strlen(pbuf)), "HOLD: ");
170 break;
171 case 0x25:
172 sprintf((pbuf+strlen(pbuf)), "SUSPEND: ");
173 break;
174 case 0x26:
175 sprintf((pbuf+strlen(pbuf)), "RESUME: ");
176 break;
177 case 0x28:
178 sprintf((pbuf+strlen(pbuf)), "HOLD ACKNOWLEDGE: ");
179 break;
180 case 0x2d:
181 sprintf((pbuf+strlen(pbuf)), "SUSPEND ACKNOWLEDGE: ");
182 break;
183 case 0x2e:
184 sprintf((pbuf+strlen(pbuf)), "RESUME ACKNOWLEDGE: ");
185 break;
186 case 0x30:
187 sprintf((pbuf+strlen(pbuf)), "HOLD REJECT (Q.932): ");
188 break;
189 case 0x31:
190 sprintf((pbuf+strlen(pbuf)), "RETRIEVE (Q.932): ");
191 break;
192 case 0x32:
193 sprintf((pbuf+strlen(pbuf)), "RETRIEVE ACKNOWLEDGE (Q.932): ");
194 break;
195 case 0x37:
196 sprintf((pbuf+strlen(pbuf)), "RETRIEVE REJECT (Q.932): ");
197 break;
199 /* call clearing */
201 case 0x40:
202 sprintf((pbuf+strlen(pbuf)), "DETACH: ");
203 break;
204 case 0x45:
205 sprintf((pbuf+strlen(pbuf)), "DISCONNECT: ");
206 break;
207 case 0x46:
208 sprintf((pbuf+strlen(pbuf)), "RESTART: ");
209 break;
210 case 0x48:
211 sprintf((pbuf+strlen(pbuf)), "DETACH ACKNOWLEDGE: ");
212 break;
213 case 0x4d:
214 sprintf((pbuf+strlen(pbuf)), "RELEASE: ");
215 break;
216 case 0x4e:
217 sprintf((pbuf+strlen(pbuf)), "RESTART ACKNOWLEDGE: ");
218 break;
219 case 0x5a:
220 sprintf((pbuf+strlen(pbuf)), "RELEASE COMPLETE: ");
221 break;
223 /* misc messages */
225 case 0x60:
226 sprintf((pbuf+strlen(pbuf)), "SEGMENT: ");
227 break;
228 case 0x62:
229 sprintf((pbuf+strlen(pbuf)), "FACILITY (Q.932): ");
230 break;
231 case 0x64:
232 sprintf((pbuf+strlen(pbuf)), "REGISTER (Q.932): ");
233 break;
234 case 0x68:
235 sprintf((pbuf+strlen(pbuf)), "CANCEL ACKNOWLEDGE: ");
236 break;
237 case 0x6a:
238 sprintf((pbuf+strlen(pbuf)), "FACILITY ACKNOWLEDGE: ");
239 break;
240 case 0x6c:
241 sprintf((pbuf+strlen(pbuf)), "REGISTER ACKNOWLEDGE: ");
242 break;
243 case 0x6e:
244 sprintf((pbuf+strlen(pbuf)), "NOTIFY: ");
245 break;
246 case 0x70:
247 sprintf((pbuf+strlen(pbuf)), "CANCEL REJECT: ");
248 break;
249 case 0x72:
250 sprintf((pbuf+strlen(pbuf)), "FACILITY REJECT: ");
251 break;
252 case 0x74:
253 sprintf((pbuf+strlen(pbuf)), "REGISTER REJECT: ");
254 break;
255 case 0x75:
256 sprintf((pbuf+strlen(pbuf)), "STATUS ENQIRY: ");
257 break;
258 case 0x79:
259 sprintf((pbuf+strlen(pbuf)), "CONGESTION CONTROL: ");
260 break;
261 case 0x7b:
262 sprintf((pbuf+strlen(pbuf)), "INFORMATION: ");
263 break;
264 case 0x7d:
265 sprintf((pbuf+strlen(pbuf)), "STATUS: ");
266 break;
267 default:
268 sprintf((pbuf+strlen(pbuf)), "UNDEFINED, TYPE=0x%02x, ", buf[i]);
269 break;
272 /* other information elements */
274 i++;
276 for (; i < n;)
278 sprintf((pbuf+strlen(pbuf)), "\n ");
280 if(buf[i] & 0x80)
282 /* single octett info element */
284 switch(buf[i] & 0x70)
286 case 0x00: /* reserved */
287 sprintf((pbuf+strlen(pbuf)), "[reserved single octett info]");
288 break;
290 case 0x10: /* shift */
291 oldcodeset = codeset;
292 codeset = buf[i] & 0x07;
293 if(buf[i] & 0x08)
294 codelock = 0;
295 else
296 codelock = 1;
297 sprintf((pbuf+strlen(pbuf)), "[shift: codeset=%d lock=%d]", codeset, codelock);
298 break;
300 case 0x20: /* more data */
301 if(buf[i] & 0x01)
302 sprintf((pbuf+strlen(pbuf)), "[sending complete]");
303 else
304 sprintf((pbuf+strlen(pbuf)), "[more data]");
305 break;
307 case 0x30: /* congestion level */
308 sprintf((pbuf+strlen(pbuf)), "[congestion level=");
309 switch(buf[i] & 0x0f)
311 case 0x00:
312 sprintf((pbuf+strlen(pbuf)), "rx-ready]");
313 break;
314 case 0x0f:
315 sprintf((pbuf+strlen(pbuf)), "rx-not-ready]");
316 break;
317 default:
318 sprintf((pbuf+strlen(pbuf)), "reserved (0x%02x)]", buf[i] & 0x0f);
319 break;
321 break;
323 case 0x50: /* repeat ind */
324 sprintf((pbuf+strlen(pbuf)), "[repeat indicator]");
325 break;
327 default:
328 sprintf((pbuf+strlen(pbuf)), "[UNKNOWN SINGLE OCTET ELEMENT 0x%02x]", buf[i]);
329 break;
332 i++; /* next */
335 else
337 /* variable length info element */
339 if(codeset == 0)
341 switch(buf[i])
343 case 0x00:
344 sprintf((pbuf+strlen(pbuf)), "[segmented message: ");
345 break;
346 case 0x04:
347 sprintf((pbuf+strlen(pbuf)), "[bearer capability: ");
348 i += p_q931bc(pbuf, &buf[i]);
349 goto next;
350 break;
351 case 0x08:
352 sprintf((pbuf+strlen(pbuf)), "[cause: ");
353 i += p_q931cause(pbuf, &buf[i]);
354 goto next;
355 break;
356 case 0x0c:
357 sprintf((pbuf+strlen(pbuf)), "[connected address (old): ");
358 break;
359 case 0x0d:
360 sprintf((pbuf+strlen(pbuf)), "[extended facility (Q.932: )");
361 break;
362 case 0x10:
363 sprintf((pbuf+strlen(pbuf)), "[call identity: ");
364 break;
365 case 0x14:
366 sprintf((pbuf+strlen(pbuf)), "[call state: ");
367 i++;
368 len = buf[i];
369 i++;
370 sprintf((pbuf+strlen(pbuf)), "Std=");
371 switch((buf[i] & 0x60) >> 5)
373 case 0:
374 sprintf((pbuf+strlen(pbuf)), "CCITT");
375 break;
376 case 1:
377 sprintf((pbuf+strlen(pbuf)), "ISO/IEC");
378 break;
379 case 2:
380 sprintf((pbuf+strlen(pbuf)), "National");
381 break;
382 case 3:
383 sprintf((pbuf+strlen(pbuf)), "Special");
384 break;
386 sprintf((pbuf+strlen(pbuf)), ", State=");
388 switch((buf[i] & 0x3f))
390 case 0:
391 sprintf((pbuf+strlen(pbuf)), "Null");
392 break;
393 case 1:
394 sprintf((pbuf+strlen(pbuf)), "Call initiated");
395 break;
396 case 2:
397 sprintf((pbuf+strlen(pbuf)), "Overlap sending");
398 break;
399 case 3:
400 sprintf((pbuf+strlen(pbuf)), "Outgoing call proceeding");
401 break;
402 case 4:
403 sprintf((pbuf+strlen(pbuf)), "Call delivered");
404 break;
405 case 6:
406 sprintf((pbuf+strlen(pbuf)), "Call present");
407 break;
408 case 7:
409 sprintf((pbuf+strlen(pbuf)), "Call received");
410 break;
411 case 8:
412 sprintf((pbuf+strlen(pbuf)), "Connect request");
413 break;
414 case 9:
415 sprintf((pbuf+strlen(pbuf)), "Incoming call proceeding");
416 break;
417 case 10:
418 sprintf((pbuf+strlen(pbuf)), "Active");
419 break;
420 case 11:
421 sprintf((pbuf+strlen(pbuf)), "Disconnect request");
422 break;
423 case 12:
424 sprintf((pbuf+strlen(pbuf)), "Disconnect indication");
425 break;
426 case 15:
427 sprintf((pbuf+strlen(pbuf)), "Suspend request");
428 break;
429 case 17:
430 sprintf((pbuf+strlen(pbuf)), "Resume request");
431 break;
432 case 19:
433 sprintf((pbuf+strlen(pbuf)), "Release request");
434 break;
435 case 22:
436 sprintf((pbuf+strlen(pbuf)), "Call abort");
437 break;
438 case 25:
439 sprintf((pbuf+strlen(pbuf)), "Overlap receiving");
440 break;
441 case 0x3d:
442 sprintf((pbuf+strlen(pbuf)), "Restart request");
443 break;
444 case 0x3e:
445 sprintf((pbuf+strlen(pbuf)), "Restart");
446 break;
447 default:
448 sprintf((pbuf+strlen(pbuf)), "ERROR: undefined/reserved");
449 break;
451 sprintf((pbuf+strlen(pbuf)), "]");
452 i++;
453 goto next;
454 break;
455 case 0x18:
456 sprintf((pbuf+strlen(pbuf)), "[channel id: channel=");
457 i++;
458 len = buf[i];
459 i++;
460 switch(buf[i] & 0x03)
462 case 0:
463 sprintf((pbuf+strlen(pbuf)), "no channel");
464 break;
465 case 1:
466 sprintf((pbuf+strlen(pbuf)), "B-1");
467 break;
468 case 2:
469 sprintf((pbuf+strlen(pbuf)), "B-2");
470 break;
471 case 3:
472 sprintf((pbuf+strlen(pbuf)), "any channel");
473 break;
475 if(buf[i] & 0x08)
476 sprintf((pbuf+strlen(pbuf)), " (exclusive)]");
477 else
478 sprintf((pbuf+strlen(pbuf)), " (preferred)]");
479 i++;
480 goto next;
481 break;
482 case 0x19:
483 sprintf((pbuf+strlen(pbuf)), "[data link connection id (Q.933): ");
484 break;
485 case 0x1c:
486 i += q932_facility(pbuf, &buf[i]);
487 goto next;
488 break;
489 case 0x1e:
490 sprintf((pbuf+strlen(pbuf)), "[progress ind: ");
491 i++;
492 len = buf[i];
493 i++;
494 sprintf((pbuf+strlen(pbuf)), "Std=");
495 switch((buf[i] & 0x60) >> 5)
497 case 0:
498 sprintf((pbuf+strlen(pbuf)), "CCITT");
499 break;
500 case 1:
501 sprintf((pbuf+strlen(pbuf)), "ISO/IEC");
502 break;
503 case 2:
504 sprintf((pbuf+strlen(pbuf)), "National");
505 break;
506 case 3:
507 sprintf((pbuf+strlen(pbuf)), "Local");
508 break;
510 sprintf((pbuf+strlen(pbuf)), ", Loc=");
512 switch((buf[i] & 0x0f))
514 case 0:
515 sprintf((pbuf+strlen(pbuf)), "User");
516 break;
517 case 1:
518 sprintf((pbuf+strlen(pbuf)), "Private network serving local user");
519 break;
520 case 2:
521 sprintf((pbuf+strlen(pbuf)), "Public network serving local user");
522 break;
523 case 3:
524 sprintf((pbuf+strlen(pbuf)), "Transit network");
525 break;
526 case 4:
527 sprintf((pbuf+strlen(pbuf)), "Public network serving remote user");
528 break;
529 case 5:
530 sprintf((pbuf+strlen(pbuf)), "Private network serving remote user");
531 break;
532 case 6:
533 sprintf((pbuf+strlen(pbuf)), "Network beyond interworking point");
534 break;
535 default:
536 sprintf((pbuf+strlen(pbuf)), "ERROR: undefined/reserved");
537 break;
540 i++;
542 sprintf((pbuf+strlen(pbuf)), "\n Description: ");
544 switch((buf[i] & 0x7f))
546 case 1:
547 sprintf((pbuf+strlen(pbuf)), "Call is not end-to-end ISDN");
548 break;
549 case 2:
550 sprintf((pbuf+strlen(pbuf)), "Destination address is non-ISDN");
551 break;
552 case 3:
553 sprintf((pbuf+strlen(pbuf)), "Origination address is non-ISDN");
554 break;
555 case 4:
556 sprintf((pbuf+strlen(pbuf)), "Call has returned to the ISDN");
557 break;
558 case 5:
559 sprintf((pbuf+strlen(pbuf)), "Interworking occurred, Service change");
560 break;
561 case 8:
562 sprintf((pbuf+strlen(pbuf)), "In-band info or appropriate pattern now available");
563 break;
564 default:
565 sprintf((pbuf+strlen(pbuf)), "ERROR: undefined/reserved");
566 break;
568 sprintf((pbuf+strlen(pbuf)), "]");
569 i++;
570 goto next;
571 break;
572 case 0x20:
573 sprintf((pbuf+strlen(pbuf)), "[network specific facilities: ");
574 break;
575 case 0x24:
576 sprintf((pbuf+strlen(pbuf)), "[terminal capabilities: ");
577 break;
578 case 0x27:
579 sprintf((pbuf+strlen(pbuf)), "[notification indicator: ");
580 i += p_q931notification(pbuf, &buf[i]);
581 goto next;
582 break;
583 case 0x28:
584 sprintf((pbuf+strlen(pbuf)), "[display: ");
585 i++;
586 len = buf[i];
587 i++;
588 for(j = 0; j < len; j++)
590 sprintf((pbuf+strlen(pbuf)),"%c", buf[j+i]);
592 sprintf((pbuf+strlen(pbuf)),"]");
593 i += j;
594 goto next;
595 break;
596 case 0x29:
597 sprintf((pbuf+strlen(pbuf)), "[date/time: ");
598 i++;
599 len = buf[i];
600 i++;
601 j = 0;
602 sprintf((pbuf+strlen(pbuf)),"%.2d.%.2d.%.2d",
603 buf[i+2], buf[i+1], buf[i]);
604 j+=3;
605 if(j < len)
607 sprintf((pbuf+strlen(pbuf))," %.2d", buf[i+3]);
608 j++;
610 if(j < len)
612 sprintf((pbuf+strlen(pbuf)),":%.2d", buf[i+4]);
613 j++;
615 if(j < len)
617 sprintf((pbuf+strlen(pbuf)),":%.2d", buf[i+5]);
618 j++;
620 sprintf((pbuf+strlen(pbuf)),"]");
621 i += len;
622 goto next;
623 break;
624 case 0x2c:
625 sprintf((pbuf+strlen(pbuf)), "[keypad: ");
626 i++;
627 len = buf[i];
628 i++;
629 for(j = 0; j < len; j++)
631 sprintf((pbuf+strlen(pbuf)),"%c", buf[j+i]);
633 sprintf((pbuf+strlen(pbuf)),"]");
634 i += j;
635 goto next;
636 break;
637 case 0x30:
638 sprintf((pbuf+strlen(pbuf)), "[keypad echo: ");
639 break;
640 case 0x32:
641 sprintf((pbuf+strlen(pbuf)), "[information req (Q.932): ");
642 break;
643 case 0x34:
644 sprintf((pbuf+strlen(pbuf)), "[signal: ");
645 break;
646 case 0x36:
647 sprintf((pbuf+strlen(pbuf)), "[switchhook: ");
648 break;
649 case 0x38:
650 sprintf((pbuf+strlen(pbuf)), "[feature activation (Q.932): ");
651 break;
652 case 0x39:
653 sprintf((pbuf+strlen(pbuf)), "[feature ind (Q.932): ");
654 break;
655 case 0x3a:
656 sprintf((pbuf+strlen(pbuf)), "[service profile id (Q.932): ");
657 break;
658 case 0x3b:
659 sprintf((pbuf+strlen(pbuf)), "[endpoint id (Q.932): ");
660 break;
661 case 0x40:
662 sprintf((pbuf+strlen(pbuf)), "[information rate: ");
663 break;
664 case 0x41:
665 sprintf((pbuf+strlen(pbuf)), "[precedence level (Q.955): ");
666 break;
667 case 0x42:
668 sprintf((pbuf+strlen(pbuf)), "[end-to-end transit delay: ");
669 break;
670 case 0x43:
671 sprintf((pbuf+strlen(pbuf)), "[transit delay detection and indication: ");
672 break;
673 case 0x44:
674 sprintf((pbuf+strlen(pbuf)), "[packet layer binary parameters: ");
675 break;
676 case 0x45:
677 sprintf((pbuf+strlen(pbuf)), "[packet layer window size: ");
678 break;
679 case 0x46:
680 sprintf((pbuf+strlen(pbuf)), "[packet size: ");
681 break;
682 case 0x47:
683 sprintf((pbuf+strlen(pbuf)), "[closed user group: ");
684 break;
685 case 0x48:
686 sprintf((pbuf+strlen(pbuf)), "[link layer core parameters (Q.933): ");
687 break;
688 case 0x49:
689 sprintf((pbuf+strlen(pbuf)), "[link layer protocol parameters (Q.933): ");
690 break;
691 case 0x4a:
692 sprintf((pbuf+strlen(pbuf)), "[reverse charging information: ");
693 break;
694 case 0x4c:
695 sprintf((pbuf+strlen(pbuf)), "[connected number (Q.951): ");
696 i += p_q931address(pbuf, &buf[i]);
697 goto next;
698 break;
700 break;
701 case 0x4d:
702 sprintf((pbuf+strlen(pbuf)), "[connected subaddress (Q.951): ");
703 break;
704 case 0x50:
705 sprintf((pbuf+strlen(pbuf)), "[X.213 priority (Q.933): ");
706 break;
707 case 0x51:
708 sprintf((pbuf+strlen(pbuf)), "[report type (Q.933): ");
709 break;
710 case 0x53:
711 sprintf((pbuf+strlen(pbuf)), "[link integrity verification (Q.933): ");
712 break;
713 case 0x57:
714 sprintf((pbuf+strlen(pbuf)), "[PVC status (Q.933): ");
715 break;
716 case 0x6c:
717 sprintf((pbuf+strlen(pbuf)), "[calling party number: ");
718 i += p_q931address(pbuf, &buf[i]);
719 goto next;
720 break;
721 case 0x6d:
722 sprintf((pbuf+strlen(pbuf)), "[calling party subaddress: ");
723 break;
724 case 0x70:
725 sprintf((pbuf+strlen(pbuf)), "[called party number: ");
726 i += p_q931address(pbuf, &buf[i]);
727 goto next;
728 break;
729 case 0x71:
730 sprintf((pbuf+strlen(pbuf)), "[called party subaddress: ");
731 break;
732 case 0x74:
733 sprintf((pbuf+strlen(pbuf)), "[redirecting number: ");
734 i += p_q931redir(pbuf, &buf[i]);
735 goto next;
736 break;
737 case 0x76:
738 sprintf((pbuf+strlen(pbuf)), "[redirection number: ");
739 i += p_q931redir(pbuf, &buf[i]);
740 goto next;
741 break;
742 case 0x78:
743 sprintf((pbuf+strlen(pbuf)), "[transit network selection: ");
744 break;
745 case 0x79:
746 sprintf((pbuf+strlen(pbuf)), "[restart indicator: ");
747 break;
748 case 0x7c:
749 sprintf((pbuf+strlen(pbuf)), "[low layer compatibility: ");
750 break;
751 case 0x7d:
752 sprintf((pbuf+strlen(pbuf)), "[high layer compatibility:");
753 i += p_q931high_compat(pbuf, &buf[i]);
754 goto next;
755 break;
756 case 0x7e:
757 sprintf((pbuf+strlen(pbuf)), "[user-user: ");
758 i += p_q931user_user(pbuf, &buf[i]);
759 goto next;
760 break;
761 case 0x7f:
762 sprintf((pbuf+strlen(pbuf)), "[escape for extension: ");
763 break;
764 default:
765 sprintf((pbuf+strlen(pbuf)), "[UNKNOWN INFO-ELEMENT-ID=0x%02x: ", buf[i]);
766 break;
769 else
771 sprintf((pbuf+strlen(pbuf)), "[UNKNOWN CODESET=%d, IE=0x%02x: ", codeset, buf[i]);
774 i++; /* index -> length */
776 len = buf[i];
778 sprintf((pbuf+strlen(pbuf)), "LEN=0x%02x, DATA=", len);
780 i++; /* index -> 1st param */
782 for(j = 0; j < len; j++)
784 sprintf((pbuf+strlen(pbuf)),"0x%02x ", buf[j+i]);
787 sprintf((pbuf+strlen(pbuf)),"]");
789 i += len;
791 next:
793 if(!codelock && (codeset != oldcodeset))
794 codeset = oldcodeset;
797 sprintf((pbuf+strlen(pbuf)),"\n");
800 /* EOF */