fetch.9: Minor fixes.
[dragonfly.git] / sys / netproto / atm / uni / unisig_print.c
blob6bee38be7ec3420bb6a637bafc10b3fef92b720b
1 /*
3 * ===================================
4 * HARP | Host ATM Research Platform
5 * ===================================
8 * This Host ATM Research Platform ("HARP") file (the "Software") is
9 * made available by Network Computing Services, Inc. ("NetworkCS")
10 * "AS IS". NetworkCS does not provide maintenance, improvements or
11 * support of any kind.
13 * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15 * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16 * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17 * In no event shall NetworkCS be responsible for any damages, including
18 * but not limited to consequential damages, arising from or relating to
19 * any use of the Software or related support.
21 * Copyright 1994-1998 Network Computing Services, Inc.
23 * Copies of this Software may be made, however, the above copyright
24 * notice must be reproduced on all copies.
26 * @(#) $FreeBSD: src/sys/netatm/uni/unisig_print.c,v 1.4 2000/01/17 20:49:57 mks Exp $
27 * @(#) $DragonFly: src/sys/netproto/atm/uni/unisig_print.c,v 1.7 2006/12/22 23:57:54 swildner Exp $
31 * ATM Forum UNI 3.0/3.1 Signalling Manager
32 * ----------------------------------------
34 * Print Q.2931 messages
38 #include <netproto/atm/kern_include.h>
40 #include "unisig_var.h"
41 #include "unisig_msg.h"
42 #include "unisig_print.h"
45 * Local declarations
47 struct type_name {
48 char *name;
49 u_char type;
54 * Local functions
56 static char * find_type (struct type_name *, u_char);
57 static void usp_print_atm_addr (Atm_addr *);
58 static void usp_print_ie (struct ie_generic *);
59 static void usp_print_ie_aalp (struct ie_generic *);
60 static void usp_print_ie_clrt (struct ie_generic *);
61 static void usp_print_ie_bbcp (struct ie_generic *);
62 static void usp_print_ie_bhli (struct ie_generic *);
63 static void usp_print_ie_blli (struct ie_generic *);
64 static void usp_print_ie_clst (struct ie_generic *);
65 static void usp_print_ie_cdad (struct ie_generic *);
66 static void usp_print_ie_cdsa (struct ie_generic *);
67 static void usp_print_ie_cgad (struct ie_generic *);
68 static void usp_print_ie_cgsa (struct ie_generic *);
69 static void usp_print_ie_caus (struct ie_generic *);
70 static void usp_print_ie_cnid (struct ie_generic *);
71 static void usp_print_ie_qosp (struct ie_generic *);
72 static void usp_print_ie_brpi (struct ie_generic *);
73 static void usp_print_ie_rsti (struct ie_generic *);
74 static void usp_print_ie_blsh (struct ie_generic *);
75 static void usp_print_ie_bnsh (struct ie_generic *);
76 static void usp_print_ie_bsdc (struct ie_generic *);
77 static void usp_print_ie_trnt (struct ie_generic *);
78 static void usp_print_ie_eprf (struct ie_generic *);
79 static void usp_print_ie_epst (struct ie_generic *);
83 * Values for Q.2931 message type.
85 static struct type_name msg_types[] = {
86 { "Call proceeding", 0x02 },
87 { "Connect", 0x07 },
88 { "Connect ACK", 0x0F },
89 { "Setup", 0x05 },
90 { "Release", 0x4D },
91 { "Release complete", 0x5A },
92 { "Restart", 0x46 },
93 { "Restart ACK", 0x4E },
94 { "Status", 0x7D },
95 { "Status enquiry", 0x75 },
96 { "Add party", 0x80 },
97 { "Add party ACK", 0x81 },
98 { "Add party reject", 0x82 },
99 { "Drop party", 0x83 },
100 { "Drop party ACK", 0x84 },
101 {0, 0}
106 * Values for information element identifier.
108 static struct type_name ie_types[] = {
109 { "Cause", 0x08 },
110 { "Call state", 0x14 },
111 { "Endpoint reference", 0x54 },
112 { "Endpoint state", 0x55 },
113 { "ATM AAL parameters", 0x58 },
114 { "ATM user cell rate", 0x59 },
115 { "Connection ID", 0x5A },
116 { "QoS parameter", 0x5C },
117 { "Broadband high layer info", 0x5D },
118 { "Broadband bearer capability", 0x5E },
119 { "Broadband low layer info", 0x5F },
120 { "Broadband locking shift", 0x60 },
121 { "Broadband non-locking shift", 0x61 },
122 { "Broadband sending complete", 0x62 },
123 { "Broadband repeat indicator", 0x63 },
124 { "Calling party number", 0x6C },
125 { "Calling party subaddress", 0x6D },
126 { "Called party number", 0x70 },
127 { "Called party subaddress", 0x71 },
128 { "Transit net selection", 0x78 },
129 { "Restart indicator", 0x79 },
130 { 0, 0 }
135 * Search a name - type translation table
137 * Arguments:
138 * tbl a pointer to the table to search
139 * type the type to look for
141 * Returns:
142 * name a pointer to a character string with the name
145 static char *
146 find_type(struct type_name *tbl, u_char type)
148 while (type != tbl->type && tbl->name)
149 tbl++;
151 if (tbl->name)
152 return(tbl->name);
153 else
154 return("-");
159 * Print an ATM address
161 * Arguments:
162 * p pointer to a Atm_address
164 * Returns:
165 * none
168 static void
169 usp_print_atm_addr(Atm_addr *p)
171 char *cp;
173 cp = unisig_addr_print(p);
174 kprintf("%s", cp);
179 * Print a Q.2931 message structure
181 * Arguments:
182 * msg pointer to the message to print
184 * Returns:
185 * None
188 void
189 usp_print_msg(struct unisig_msg *msg, int dir)
191 char *name;
192 int i;
193 struct ie_generic *ie, *inxt;
195 name = find_type(msg_types, msg->msg_type);
196 switch (dir) {
197 case UNISIG_MSG_IN:
198 kprintf("Received ");
199 break;
200 case UNISIG_MSG_OUT:
201 kprintf("Sent ");
202 break;
204 kprintf("message: %s (%x)\n", name, msg->msg_type);
205 kprintf(" Call reference: 0x%x\n", msg->msg_call_ref);
206 #ifdef LONG_PRINT
207 kprintf(" Message type flag: 0x%x\n", msg->msg_type_flag);
208 kprintf(" Message type action: 0x%x\n", msg->msg_type_action);
209 kprintf(" Message length: %d\n", msg->msg_length);
210 for (i=0; i<UNI_MSG_IE_CNT; i++) {
211 ie = msg->msg_ie_vec[i];
212 while (ie) {
213 inxt = ie->ie_next;
214 usp_print_ie(ie);
215 ie = inxt;
218 #else
219 for (i=0; i<UNI_MSG_IE_CNT; i++)
221 ie = msg->msg_ie_vec[i];
222 while (ie) {
223 inxt = ie->ie_next;
224 name = find_type(ie_types, ie->ie_ident);
225 if (ie->ie_ident == UNI_IE_CAUS ||
226 ie->ie_ident == UNI_IE_RSTI ||
227 ie->ie_ident == UNI_IE_CLST) {
228 usp_print_ie(ie);
229 } else {
230 kprintf(" Information element: %s (0x%x)\n",
231 name, ie->ie_ident);
233 ie = inxt;
236 #endif
241 * Print a Q.2931 information element
243 * Arguments:
244 * ie pointer to the IE to print
246 * Returns:
247 * None
250 static void
251 usp_print_ie(struct ie_generic *ie)
253 char *name;
255 while (ie) {
256 name = find_type(ie_types, ie->ie_ident);
257 kprintf(" Information element: %s (0x%x)\n",
258 name, ie->ie_ident);
259 #ifdef LONG_PRINT
260 kprintf(" Coding: 0x%x\n",
261 ie->ie_coding);
262 kprintf(" Flag: 0x%x\n", ie->ie_flag);
263 kprintf(" Action: 0x%x\n",
264 ie->ie_action);
265 kprintf(" Length: %d\n", ie->ie_length);
266 #endif
268 switch (ie->ie_ident) {
269 case UNI_IE_AALP:
270 usp_print_ie_aalp(ie);
271 break;
272 case UNI_IE_CLRT:
273 usp_print_ie_clrt(ie);
274 break;
275 case UNI_IE_BBCP:
276 usp_print_ie_bbcp(ie);
277 break;
278 case UNI_IE_BHLI:
279 usp_print_ie_bhli(ie);
280 break;
281 case UNI_IE_BLLI:
282 usp_print_ie_blli(ie);
283 break;
284 case UNI_IE_CLST:
285 usp_print_ie_clst(ie);
286 break;
287 case UNI_IE_CDAD:
288 usp_print_ie_cdad(ie);
289 break;
290 case UNI_IE_CDSA:
291 usp_print_ie_cdsa(ie);
292 break;
293 case UNI_IE_CGAD:
294 usp_print_ie_cgad(ie);
295 break;
296 case UNI_IE_CGSA:
297 usp_print_ie_cgsa(ie);
298 break;
299 case UNI_IE_CAUS:
300 usp_print_ie_caus(ie);
301 break;
302 case UNI_IE_CNID:
303 usp_print_ie_cnid(ie);
304 break;
305 case UNI_IE_QOSP:
306 usp_print_ie_qosp(ie);
307 break;
308 case UNI_IE_BRPI:
309 usp_print_ie_brpi(ie);
310 break;
311 case UNI_IE_RSTI:
312 usp_print_ie_rsti(ie);
313 break;
314 case UNI_IE_BLSH:
315 usp_print_ie_blsh(ie);
316 break;
317 case UNI_IE_BNSH:
318 usp_print_ie_bnsh(ie);
319 break;
320 case UNI_IE_BSDC:
321 usp_print_ie_bsdc(ie);
322 break;
323 case UNI_IE_TRNT:
324 usp_print_ie_trnt(ie);
325 break;
326 case UNI_IE_EPRF:
327 usp_print_ie_eprf(ie);
328 break;
329 case UNI_IE_EPST:
330 usp_print_ie_epst(ie);
331 break;
333 ie = ie->ie_next;
339 * Print an AAL parameters information element
341 * Arguments:
342 * ie pointer to the IE to print
344 * Returns:
345 * None
348 static void
349 usp_print_ie_aalp(struct ie_generic *ie)
351 kprintf(" AAL type: %d\n", ie->ie_aalp_aal_type);
352 switch(ie->ie_aalp_aal_type) {
353 case UNI_IE_AALP_AT_AAL1:
354 kprintf(" Subtype: 0x%x\n",
355 ie->ie_aalp_1_subtype);
356 kprintf(" CBR rate: 0x%x\n",
357 ie->ie_aalp_1_cbr_rate);
358 kprintf(" Multiplier: 0x%x\n",
359 ie->ie_aalp_1_multiplier);
360 kprintf(" Clock rcvry: 0x%x\n",
361 ie->ie_aalp_1_clock_recovery);
362 kprintf(" Err corr: 0x%x\n",
363 ie->ie_aalp_1_error_correction);
364 kprintf(" Struct data: 0x%x\n",
365 ie->ie_aalp_1_struct_data_tran);
366 kprintf(" Partial cells: 0x%x\n",
367 ie->ie_aalp_1_partial_cells);
368 break;
369 case UNI_IE_AALP_AT_AAL3:
370 kprintf(" Fwd max SDU: %d\n",
371 ie->ie_aalp_4_fwd_max_sdu);
372 kprintf(" Bkwd max SDU: %d\n",
373 ie->ie_aalp_4_bkwd_max_sdu);
374 kprintf(" MID range: %d\n",
375 ie->ie_aalp_4_mid_range);
376 kprintf(" Mode: 0x%x\n",
377 ie->ie_aalp_4_mode);
378 kprintf(" SSCS type: 0x%x\n",
379 ie->ie_aalp_4_sscs_type);
380 break;
381 case UNI_IE_AALP_AT_AAL5:
382 kprintf(" Fwd max SDU: %d\n",
383 ie->ie_aalp_5_fwd_max_sdu);
384 kprintf(" Bkwd max SDU: %d\n",
385 ie->ie_aalp_5_bkwd_max_sdu);
386 kprintf(" Mode: 0x%x\n",
387 ie->ie_aalp_5_mode);
388 kprintf(" SSCS type: 0x%x\n",
389 ie->ie_aalp_5_sscs_type);
390 break;
391 case UNI_IE_AALP_AT_AALU:
392 kprintf(" User info: 0x%x %x %x %x\n",
393 ie->ie_aalp_user_info[0],
394 ie->ie_aalp_user_info[1],
395 ie->ie_aalp_user_info[2],
396 ie->ie_aalp_user_info[3]);
397 break;
403 * Print a user cell rate information element
405 * Arguments:
406 * ie pointer to the IE to print
408 * Returns:
409 * None
412 static void
413 usp_print_ie_clrt(struct ie_generic *ie)
415 kprintf(" Forward peak: %d\n", ie->ie_clrt_fwd_peak);
416 kprintf(" Backward peak: %d\n", ie->ie_clrt_bkwd_peak);
417 kprintf(" Fwd peak 01: %d\n", ie->ie_clrt_fwd_peak_01);
418 kprintf(" Bkwd peak 01: %d\n", ie->ie_clrt_bkwd_peak_01);
419 kprintf(" Fwd sust: %d\n", ie->ie_clrt_fwd_sust);
420 kprintf(" Bkwd sust: %d\n", ie->ie_clrt_bkwd_sust);
421 kprintf(" Fwd sust 01: %d\n", ie->ie_clrt_fwd_sust_01);
422 kprintf(" Bkwd sust 01: %d\n", ie->ie_clrt_bkwd_sust_01);
423 kprintf(" Fwd burst: %d\n", ie->ie_clrt_fwd_burst);
424 kprintf(" Bkwd burst: %d\n", ie->ie_clrt_bkwd_burst);
425 kprintf(" Fwd burst 01: %d\n", ie->ie_clrt_fwd_burst_01);
426 kprintf(" Bkwd burst 01: %d\n",
427 ie->ie_clrt_bkwd_burst_01);
428 kprintf(" Best effort: %d\n", ie->ie_clrt_best_effort);
429 kprintf(" TM optons: 0x%x\n",
430 ie->ie_clrt_tm_options);
435 * Print a broadband bearer capability information element
437 * Arguments:
438 * ie pointer to the IE to print
440 * Returns:
441 * None
444 static void
445 usp_print_ie_bbcp(struct ie_generic *ie)
447 kprintf(" Bearer class: 0x%x\n",
448 ie->ie_bbcp_bearer_class);
449 kprintf(" Traffic type: 0x%x\n",
450 ie->ie_bbcp_traffic_type);
451 kprintf(" Timing req: 0x%x\n",
452 ie->ie_bbcp_timing_req);
453 kprintf(" Clipping: 0x%x\n", ie->ie_bbcp_clipping);
454 kprintf(" Conn config: 0x%x\n",
455 ie->ie_bbcp_conn_config);
460 * Print a broadband high layer information information element
462 * Arguments:
463 * ie pointer to the IE to print
465 * Returns:
466 * None
469 static void
470 usp_print_ie_bhli(struct ie_generic *ie)
472 int i;
474 kprintf(" Type: 0x%x\n", ie->ie_bhli_type);
475 kprintf(" HL info: 0x");
476 for (i=0; i<ie->ie_length-1; i++) {
477 kprintf("%x ", ie->ie_bhli_info[i]);
479 kprintf("\n");
484 * Print a broadband low-layer information information element
486 * Arguments:
487 * ie pointer to the IE to print
489 * Returns:
490 * None
493 static void
494 usp_print_ie_blli(struct ie_generic *ie)
496 kprintf(" Layer 1 ID: 0x%x\n", ie->ie_blli_l1_id);
497 kprintf(" Layer 2 ID: 0x%x\n", ie->ie_blli_l2_id);
498 kprintf(" Layer 2 mode: 0x%x\n", ie->ie_blli_l2_mode);
499 kprintf(" Layer 2 Q.933: 0x%x\n",
500 ie->ie_blli_l2_q933_use);
501 kprintf(" Layer 2 win: 0x%x\n",
502 ie->ie_blli_l2_window);
503 kprintf(" Layer 2 user: 0x%x\n",
504 ie->ie_blli_l2_user_proto);
505 kprintf(" Layer 3 ID: 0x%x\n", ie->ie_blli_l3_id);
506 kprintf(" Layer 3 mode: 0x%x\n", ie->ie_blli_l3_mode);
507 kprintf(" Layer 3 pkt: 0x%x\n",
508 ie->ie_blli_l3_packet_size);
509 kprintf(" Layer 3 win: 0x%x\n",
510 ie->ie_blli_l3_window);
511 kprintf(" Layer 3 user: 0x%x\n",
512 ie->ie_blli_l3_user_proto);
513 kprintf(" Layer 3 IPI: 0x%x\n", ie->ie_blli_l3_ipi);
514 kprintf(" Layer 3 SNAP: 0x%x\n",
515 ie->ie_blli_l3_snap_id);
516 kprintf(" Layer 3 OUI: 0x%x %x %x\n",
517 ie->ie_blli_l3_oui[0],
518 ie->ie_blli_l3_oui[1],
519 ie->ie_blli_l3_oui[2]);
520 kprintf(" Layer 3 PID: 0x%x %x\n",
521 ie->ie_blli_l3_pid[0],
522 ie->ie_blli_l3_pid[1]);
527 * Print a call state information element
529 * Arguments:
530 * ie pointer to the IE to print
532 * Returns:
533 * None
536 static void
537 usp_print_ie_clst(struct ie_generic *ie)
539 kprintf(" Call state: %d\n",
540 ie->ie_clst_state);
545 * Print a called party number information element
547 * Arguments:
548 * ie pointer to the IE to print
550 * Returns:
551 * None
554 static void
555 usp_print_ie_cdad(struct ie_generic *ie)
557 kprintf(" ATM addr: ");
558 usp_print_atm_addr(&ie->ie_cdad_addr);
559 kprintf("\n");
564 * Print a called party subaddress information element
566 * Arguments:
567 * ie pointer to the IE to print
569 * Returns:
570 * None
573 static void
574 usp_print_ie_cdsa(struct ie_generic *ie)
576 kprintf(" ATM subaddr: ");
577 usp_print_atm_addr(&ie->ie_cdsa_addr);
578 kprintf("\n");
583 * Print a calling party number information element
585 * Arguments:
586 * ie pointer to the IE to print
588 * Returns:
589 * None
592 static void
593 usp_print_ie_cgad(struct ie_generic *ie)
595 kprintf(" ATM addr: ");
596 usp_print_atm_addr(&ie->ie_cgad_addr);
597 kprintf("\n");
602 * Print a calling party subaddress information element
604 * Arguments:
605 * ie pointer to the IE to print
607 * Returns:
608 * None
611 static void
612 usp_print_ie_cgsa(struct ie_generic *ie)
614 kprintf(" ATM subaddr: ");
615 usp_print_atm_addr(&ie->ie_cgsa_addr);
616 kprintf("\n");
621 * Print a cause information element
623 * Arguments:
624 * ie pointer to the IE to print
626 * Returns:
627 * None
630 static void
631 usp_print_ie_caus(struct ie_generic *ie)
633 int i;
635 kprintf(" Location: %d\n", ie->ie_caus_loc);
636 kprintf(" Cause: %d\n", ie->ie_caus_cause);
637 switch(ie->ie_caus_cause) {
638 case UNI_IE_CAUS_IECONTENT:
639 kprintf(" Flagged IEs: ");
640 for (i=0; ie->ie_caus_diagnostic[i]; i++) {
641 kprintf("0x%x ", ie->ie_caus_diagnostic[i]);
643 kprintf("\n");
644 break;
645 case UNI_IE_CAUS_TIMER:
646 kprintf(" Timer ID: %c%c%c\n",
647 ie->ie_caus_diagnostic[0],
648 ie->ie_caus_diagnostic[1],
649 ie->ie_caus_diagnostic[2]);
650 break;
651 default:
652 kprintf(" Diag length: %d\n",
653 ie->ie_caus_diag_len);
654 kprintf(" Diagnostic: ");
655 for (i=0; i<ie->ie_caus_diag_len; i++) {
656 kprintf("0x%x ", ie->ie_caus_diagnostic[i]);
658 kprintf("\n");
664 * Print a connection identifier information element
666 * Arguments:
667 * ie pointer to the IE to print
669 * Returns:
670 * None
673 static void
674 usp_print_ie_cnid(struct ie_generic *ie)
676 kprintf(" VP assoc sig: 0x%x\n", ie->ie_cnid_vp_sig);
677 kprintf(" Pref/excl: 0x%x\n",
678 ie->ie_cnid_pref_excl);
679 kprintf(" VPCI: %d\n", ie->ie_cnid_vpci);
680 kprintf(" VCI: %d\n", ie->ie_cnid_vci);
685 * Print a quality of service parameter information element
687 * Arguments:
688 * ie pointer to the IE to print
690 * Returns:
691 * None
694 static void
695 usp_print_ie_qosp(struct ie_generic *ie)
697 kprintf(" QoS fwd: 0x%x\n",
698 ie->ie_qosp_fwd_class);
699 kprintf(" QoS bkwd: 0x%x\n",
700 ie->ie_qosp_bkwd_class);
705 * Print a broadband repeat indicator information element
707 * Arguments:
708 * ie pointer to the IE to print
710 * Returns:
711 * None
714 static void
715 usp_print_ie_brpi(struct ie_generic *ie)
717 kprintf(" Indicator: 0x%x\n", ie->ie_brpi_ind);
722 * Print a restart indicator information element
724 * Arguments:
725 * ie pointer to the IE to print
727 * Returns:
728 * None
731 static void
732 usp_print_ie_rsti(struct ie_generic *ie)
734 kprintf(" Class: 0x%x\n", ie->ie_rsti_class);
739 * Print a broadband locking shift information element
741 * Arguments:
742 * ie pointer to the IE to print
744 * Returns:
745 * None
748 static void
749 usp_print_ie_blsh(struct ie_generic *ie)
755 * Print a broadband non-locking shift information element
757 * Arguments:
758 * ie pointer to the IE to print
760 * Returns:
761 * None
764 static void
765 usp_print_ie_bnsh(struct ie_generic *ie)
771 * Print a broadband sending complete information element
773 * Arguments:
774 * ie pointer to the IE to print
776 * Returns:
777 * None
780 static void
781 usp_print_ie_bsdc(struct ie_generic *ie)
783 kprintf(" Indication: 0x%x\n", ie->ie_bsdc_ind);
788 * Print a transit net selection information element
790 * Arguments:
791 * ie pointer to the IE to print
793 * Returns:
794 * None
797 static void
798 usp_print_ie_trnt(struct ie_generic *ie)
800 #ifdef NOTDEF
801 struct ie_generic ie_trnt_hdr;
802 u_char ie_trnt_id_type;
803 u_char ie_trnt_id_plan;
804 Atm_addr ie_trnt_id;
805 #endif
810 * Print an endpoint reference information element
812 * Arguments:
813 * ie pointer to the IE to print
815 * Returns:
816 * None
819 static void
820 usp_print_ie_eprf(struct ie_generic *ie)
822 kprintf(" Ref type: 0x%x\n",
823 ie->ie_eprf_type);
824 kprintf(" Endpt ref: 0x%x\n",
825 ie->ie_eprf_id);
830 * Print an endpoint state information element
832 * Arguments:
833 * ie pointer to the IE to print
835 * Returns:
836 * None
839 static void
840 usp_print_ie_epst(struct ie_generic *ie)
842 kprintf(" Endpt state: %d\n",
843 ie->ie_epst_state);