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 $
31 * ATM Forum UNI 3.0/3.1 Signalling Manager
32 * ----------------------------------------
34 * Print Q.2931 messages
38 #include <netatm/kern_include.h>
40 #include <netatm/uni/unisig_var.h>
41 #include <netatm/uni/unisig_msg.h>
42 #include <netatm/uni/unisig_print.h>
45 __RCSID("@(#) $FreeBSD: src/sys/netatm/uni/unisig_print.c,v 1.4 2000/01/17 20:49:57 mks Exp $");
61 static char * find_type __P((struct type_name *, u_char));
62 static void usp_print_atm_addr __P((Atm_addr *));
63 static void usp_print_ie __P((struct ie_generic *));
64 static void usp_print_ie_aalp __P((struct ie_generic *));
65 static void usp_print_ie_clrt __P((struct ie_generic *));
66 static void usp_print_ie_bbcp __P((struct ie_generic *));
67 static void usp_print_ie_bhli __P((struct ie_generic *));
68 static void usp_print_ie_blli __P((struct ie_generic *));
69 static void usp_print_ie_clst __P((struct ie_generic *));
70 static void usp_print_ie_cdad __P((struct ie_generic *));
71 static void usp_print_ie_cdsa __P((struct ie_generic *));
72 static void usp_print_ie_cgad __P((struct ie_generic *));
73 static void usp_print_ie_cgsa __P((struct ie_generic *));
74 static void usp_print_ie_caus __P((struct ie_generic *));
75 static void usp_print_ie_cnid __P((struct ie_generic *));
76 static void usp_print_ie_qosp __P((struct ie_generic *));
77 static void usp_print_ie_brpi __P((struct ie_generic *));
78 static void usp_print_ie_rsti __P((struct ie_generic *));
79 static void usp_print_ie_blsh __P((struct ie_generic *));
80 static void usp_print_ie_bnsh __P((struct ie_generic *));
81 static void usp_print_ie_bsdc __P((struct ie_generic *));
82 static void usp_print_ie_trnt __P((struct ie_generic *));
83 static void usp_print_ie_eprf __P((struct ie_generic *));
84 static void usp_print_ie_epst __P((struct ie_generic *));
88 * Values for Q.2931 message type.
90 static struct type_name msg_types[] = {
91 { "Call proceeding", 0x02 },
93 { "Connect ACK", 0x0F },
96 { "Release complete", 0x5A },
98 { "Restart ACK", 0x4E },
100 { "Status enquiry", 0x75 },
101 { "Add party", 0x80 },
102 { "Add party ACK", 0x81 },
103 { "Add party reject", 0x82 },
104 { "Drop party", 0x83 },
105 { "Drop party ACK", 0x84 },
111 * Values for information element identifier.
113 static struct type_name ie_types[] = {
115 { "Call state", 0x14 },
116 { "Endpoint reference", 0x54 },
117 { "Endpoint state", 0x55 },
118 { "ATM AAL parameters", 0x58 },
119 { "ATM user cell rate", 0x59 },
120 { "Connection ID", 0x5A },
121 { "QoS parameter", 0x5C },
122 { "Broadband high layer info", 0x5D },
123 { "Broadband bearer capability", 0x5E },
124 { "Broadband low layer info", 0x5F },
125 { "Broadband locking shift", 0x60 },
126 { "Broadband non-locking shift", 0x61 },
127 { "Broadband sending complete", 0x62 },
128 { "Broadband repeat indicator", 0x63 },
129 { "Calling party number", 0x6C },
130 { "Calling party subaddress", 0x6D },
131 { "Called party number", 0x70 },
132 { "Called party subaddress", 0x71 },
133 { "Transit net selection", 0x78 },
134 { "Restart indicator", 0x79 },
140 * Search a name - type translation table
143 * tbl a pointer to the table to search
144 * type the type to look for
147 * name a pointer to a character string with the name
152 struct type_name *tbl;
155 while (type != tbl->type && tbl->name)
166 * Print an ATM address
169 * p pointer to a Atm_address
176 usp_print_atm_addr(p)
181 cp = unisig_addr_print(p);
187 * Print a Q.2931 message structure
190 * msg pointer to the message to print
197 usp_print_msg(msg, dir)
198 struct unisig_msg *msg;
203 struct ie_generic *ie, *inxt;
205 name = find_type(msg_types, msg->msg_type);
214 printf("message: %s (%x)\n", name, msg->msg_type);
215 printf(" Call reference: 0x%x\n", msg->msg_call_ref);
217 printf(" Message type flag: 0x%x\n", msg->msg_type_flag);
218 printf(" Message type action: 0x%x\n", msg->msg_type_action);
219 printf(" Message length: %d\n", msg->msg_length);
220 for (i=0; i<UNI_MSG_IE_CNT; i++) {
221 ie = msg->msg_ie_vec[i];
229 for (i=0; i<UNI_MSG_IE_CNT; i++)
231 ie = msg->msg_ie_vec[i];
234 name = find_type(ie_types, ie->ie_ident);
235 if (ie->ie_ident == UNI_IE_CAUS ||
236 ie->ie_ident == UNI_IE_RSTI ||
237 ie->ie_ident == UNI_IE_CLST) {
240 printf(" Information element: %s (0x%x)\n",
251 * Print a Q.2931 information element
254 * ie pointer to the IE to print
262 struct ie_generic *ie;
267 name = find_type(ie_types, ie->ie_ident);
268 printf(" Information element: %s (0x%x)\n",
271 printf(" Coding: 0x%x\n",
273 printf(" Flag: 0x%x\n", ie->ie_flag);
274 printf(" Action: 0x%x\n",
276 printf(" Length: %d\n", ie->ie_length);
279 switch (ie->ie_ident) {
281 usp_print_ie_aalp(ie);
284 usp_print_ie_clrt(ie);
287 usp_print_ie_bbcp(ie);
290 usp_print_ie_bhli(ie);
293 usp_print_ie_blli(ie);
296 usp_print_ie_clst(ie);
299 usp_print_ie_cdad(ie);
302 usp_print_ie_cdsa(ie);
305 usp_print_ie_cgad(ie);
308 usp_print_ie_cgsa(ie);
311 usp_print_ie_caus(ie);
314 usp_print_ie_cnid(ie);
317 usp_print_ie_qosp(ie);
320 usp_print_ie_brpi(ie);
323 usp_print_ie_rsti(ie);
326 usp_print_ie_blsh(ie);
329 usp_print_ie_bnsh(ie);
332 usp_print_ie_bsdc(ie);
335 usp_print_ie_trnt(ie);
338 usp_print_ie_eprf(ie);
341 usp_print_ie_epst(ie);
350 * Print an AAL parameters information element
353 * ie pointer to the IE to print
360 usp_print_ie_aalp(ie)
361 struct ie_generic *ie;
363 printf(" AAL type: %d\n", ie->ie_aalp_aal_type);
364 switch(ie->ie_aalp_aal_type) {
365 case UNI_IE_AALP_AT_AAL1:
366 printf(" Subtype: 0x%x\n",
367 ie->ie_aalp_1_subtype);
368 printf(" CBR rate: 0x%x\n",
369 ie->ie_aalp_1_cbr_rate);
370 printf(" Multiplier: 0x%x\n",
371 ie->ie_aalp_1_multiplier);
372 printf(" Clock rcvry: 0x%x\n",
373 ie->ie_aalp_1_clock_recovery);
374 printf(" Err corr: 0x%x\n",
375 ie->ie_aalp_1_error_correction);
376 printf(" Struct data: 0x%x\n",
377 ie->ie_aalp_1_struct_data_tran);
378 printf(" Partial cells: 0x%x\n",
379 ie->ie_aalp_1_partial_cells);
381 case UNI_IE_AALP_AT_AAL3:
382 printf(" Fwd max SDU: %d\n",
383 ie->ie_aalp_4_fwd_max_sdu);
384 printf(" Bkwd max SDU: %d\n",
385 ie->ie_aalp_4_bkwd_max_sdu);
386 printf(" MID range: %d\n",
387 ie->ie_aalp_4_mid_range);
388 printf(" Mode: 0x%x\n",
390 printf(" SSCS type: 0x%x\n",
391 ie->ie_aalp_4_sscs_type);
393 case UNI_IE_AALP_AT_AAL5:
394 printf(" Fwd max SDU: %d\n",
395 ie->ie_aalp_5_fwd_max_sdu);
396 printf(" Bkwd max SDU: %d\n",
397 ie->ie_aalp_5_bkwd_max_sdu);
398 printf(" Mode: 0x%x\n",
400 printf(" SSCS type: 0x%x\n",
401 ie->ie_aalp_5_sscs_type);
403 case UNI_IE_AALP_AT_AALU:
404 printf(" User info: 0x%x %x %x %x\n",
405 ie->ie_aalp_user_info[0],
406 ie->ie_aalp_user_info[1],
407 ie->ie_aalp_user_info[2],
408 ie->ie_aalp_user_info[3]);
415 * Print a user cell rate information element
418 * ie pointer to the IE to print
425 usp_print_ie_clrt(ie)
426 struct ie_generic *ie;
428 printf(" Forward peak: %d\n", ie->ie_clrt_fwd_peak);
429 printf(" Backward peak: %d\n", ie->ie_clrt_bkwd_peak);
430 printf(" Fwd peak 01: %d\n", ie->ie_clrt_fwd_peak_01);
431 printf(" Bkwd peak 01: %d\n", ie->ie_clrt_bkwd_peak_01);
432 printf(" Fwd sust: %d\n", ie->ie_clrt_fwd_sust);
433 printf(" Bkwd sust: %d\n", ie->ie_clrt_bkwd_sust);
434 printf(" Fwd sust 01: %d\n", ie->ie_clrt_fwd_sust_01);
435 printf(" Bkwd sust 01: %d\n", ie->ie_clrt_bkwd_sust_01);
436 printf(" Fwd burst: %d\n", ie->ie_clrt_fwd_burst);
437 printf(" Bkwd burst: %d\n", ie->ie_clrt_bkwd_burst);
438 printf(" Fwd burst 01: %d\n", ie->ie_clrt_fwd_burst_01);
439 printf(" Bkwd burst 01: %d\n",
440 ie->ie_clrt_bkwd_burst_01);
441 printf(" Best effort: %d\n", ie->ie_clrt_best_effort);
442 printf(" TM optons: 0x%x\n",
443 ie->ie_clrt_tm_options);
448 * Print a broadband bearer capability information element
451 * ie pointer to the IE to print
458 usp_print_ie_bbcp(ie)
459 struct ie_generic *ie;
461 printf(" Bearer class: 0x%x\n",
462 ie->ie_bbcp_bearer_class);
463 printf(" Traffic type: 0x%x\n",
464 ie->ie_bbcp_traffic_type);
465 printf(" Timing req: 0x%x\n",
466 ie->ie_bbcp_timing_req);
467 printf(" Clipping: 0x%x\n", ie->ie_bbcp_clipping);
468 printf(" Conn config: 0x%x\n",
469 ie->ie_bbcp_conn_config);
474 * Print a broadband high layer information information element
477 * ie pointer to the IE to print
484 usp_print_ie_bhli(ie)
485 struct ie_generic *ie;
489 printf(" Type: 0x%x\n", ie->ie_bhli_type);
490 printf(" HL info: 0x");
491 for (i=0; i<ie->ie_length-1; i++) {
492 printf("%x ", ie->ie_bhli_info[i]);
499 * Print a broadband low-layer information information element
502 * ie pointer to the IE to print
509 usp_print_ie_blli(ie)
510 struct ie_generic *ie;
512 printf(" Layer 1 ID: 0x%x\n", ie->ie_blli_l1_id);
513 printf(" Layer 2 ID: 0x%x\n", ie->ie_blli_l2_id);
514 printf(" Layer 2 mode: 0x%x\n", ie->ie_blli_l2_mode);
515 printf(" Layer 2 Q.933: 0x%x\n",
516 ie->ie_blli_l2_q933_use);
517 printf(" Layer 2 win: 0x%x\n",
518 ie->ie_blli_l2_window);
519 printf(" Layer 2 user: 0x%x\n",
520 ie->ie_blli_l2_user_proto);
521 printf(" Layer 3 ID: 0x%x\n", ie->ie_blli_l3_id);
522 printf(" Layer 3 mode: 0x%x\n", ie->ie_blli_l3_mode);
523 printf(" Layer 3 pkt: 0x%x\n",
524 ie->ie_blli_l3_packet_size);
525 printf(" Layer 3 win: 0x%x\n",
526 ie->ie_blli_l3_window);
527 printf(" Layer 3 user: 0x%x\n",
528 ie->ie_blli_l3_user_proto);
529 printf(" Layer 3 IPI: 0x%x\n", ie->ie_blli_l3_ipi);
530 printf(" Layer 3 SNAP: 0x%x\n",
531 ie->ie_blli_l3_snap_id);
532 printf(" Layer 3 OUI: 0x%x %x %x\n",
533 ie->ie_blli_l3_oui[0],
534 ie->ie_blli_l3_oui[1],
535 ie->ie_blli_l3_oui[2]);
536 printf(" Layer 3 PID: 0x%x %x\n",
537 ie->ie_blli_l3_pid[0],
538 ie->ie_blli_l3_pid[1]);
543 * Print a call state information element
546 * ie pointer to the IE to print
553 usp_print_ie_clst(ie)
554 struct ie_generic *ie;
556 printf(" Call state: %d\n",
562 * Print a called party number information element
565 * ie pointer to the IE to print
572 usp_print_ie_cdad(ie)
573 struct ie_generic *ie;
575 printf(" ATM addr: ");
576 usp_print_atm_addr(&ie->ie_cdad_addr);
582 * Print a called party subaddress information element
585 * ie pointer to the IE to print
592 usp_print_ie_cdsa(ie)
593 struct ie_generic *ie;
595 printf(" ATM subaddr: ");
596 usp_print_atm_addr(&ie->ie_cdsa_addr);
602 * Print a calling party number information element
605 * ie pointer to the IE to print
612 usp_print_ie_cgad(ie)
613 struct ie_generic *ie;
615 printf(" ATM addr: ");
616 usp_print_atm_addr(&ie->ie_cgad_addr);
622 * Print a calling party subaddress information element
625 * ie pointer to the IE to print
632 usp_print_ie_cgsa(ie)
633 struct ie_generic *ie;
635 printf(" ATM subaddr: ");
636 usp_print_atm_addr(&ie->ie_cgsa_addr);
642 * Print a cause information element
645 * ie pointer to the IE to print
652 usp_print_ie_caus(ie)
653 struct ie_generic *ie;
657 printf(" Location: %d\n", ie->ie_caus_loc);
658 printf(" Cause: %d\n", ie->ie_caus_cause);
659 switch(ie->ie_caus_cause) {
660 case UNI_IE_CAUS_IECONTENT:
661 printf(" Flagged IEs: ");
662 for (i=0; ie->ie_caus_diagnostic[i]; i++) {
663 printf("0x%x ", ie->ie_caus_diagnostic[i]);
667 case UNI_IE_CAUS_TIMER:
668 printf(" Timer ID: %c%c%c\n",
669 ie->ie_caus_diagnostic[0],
670 ie->ie_caus_diagnostic[1],
671 ie->ie_caus_diagnostic[2]);
674 printf(" Diag length: %d\n",
675 ie->ie_caus_diag_len);
676 printf(" Diagnostic: ");
677 for (i=0; i<ie->ie_caus_diag_len; i++) {
678 printf("0x%x ", ie->ie_caus_diagnostic[i]);
686 * Print a connection identifier information element
689 * ie pointer to the IE to print
696 usp_print_ie_cnid(ie)
697 struct ie_generic *ie;
699 printf(" VP assoc sig: 0x%x\n", ie->ie_cnid_vp_sig);
700 printf(" Pref/excl: 0x%x\n",
701 ie->ie_cnid_pref_excl);
702 printf(" VPCI: %d\n", ie->ie_cnid_vpci);
703 printf(" VCI: %d\n", ie->ie_cnid_vci);
708 * Print a quality of service parameter information element
711 * ie pointer to the IE to print
718 usp_print_ie_qosp(ie)
719 struct ie_generic *ie;
721 printf(" QoS fwd: 0x%x\n",
722 ie->ie_qosp_fwd_class);
723 printf(" QoS bkwd: 0x%x\n",
724 ie->ie_qosp_bkwd_class);
729 * Print a broadband repeat indicator information element
732 * ie pointer to the IE to print
739 usp_print_ie_brpi(ie)
740 struct ie_generic *ie;
742 printf(" Indicator: 0x%x\n", ie->ie_brpi_ind);
747 * Print a restart indicator information element
750 * ie pointer to the IE to print
757 usp_print_ie_rsti(ie)
758 struct ie_generic *ie;
760 printf(" Class: 0x%x\n", ie->ie_rsti_class);
765 * Print a broadband locking shift information element
768 * ie pointer to the IE to print
775 usp_print_ie_blsh(ie)
776 struct ie_generic *ie;
782 * Print a broadband non-locking shift information element
785 * ie pointer to the IE to print
792 usp_print_ie_bnsh(ie)
793 struct ie_generic *ie;
799 * Print a broadband sending complete information element
802 * ie pointer to the IE to print
809 usp_print_ie_bsdc(ie)
810 struct ie_generic *ie;
812 printf(" Indication: 0x%x\n", ie->ie_bsdc_ind);
817 * Print a transit net selection information element
820 * ie pointer to the IE to print
827 usp_print_ie_trnt(ie)
828 struct ie_generic *ie;
831 struct ie_generic ie_trnt_hdr;
832 u_char ie_trnt_id_type;
833 u_char ie_trnt_id_plan;
840 * Print an endpoint reference information element
843 * ie pointer to the IE to print
850 usp_print_ie_eprf(ie)
851 struct ie_generic *ie;
853 printf(" Ref type: 0x%x\n",
855 printf(" Endpt ref: 0x%x\n",
861 * Print an endpoint state information element
864 * ie pointer to the IE to print
871 usp_print_ie_epst(ie)
872 struct ie_generic *ie;
874 printf(" Endpt state: %d\n",