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.
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.h>
41 #include <netatm/uni/unisig_var.h>
42 #include <netatm/uni/unisig_msg.h>
43 #include <netatm/uni/unisig_print.h>
46 __RCSID("@(#) $FreeBSD$");
62 static char * find_type __P((struct type_name *, u_char));
63 static void usp_print_atm_addr __P((Atm_addr *));
64 static void usp_print_ie __P((struct ie_generic *));
65 static void usp_print_ie_aalp __P((struct ie_generic *));
66 static void usp_print_ie_clrt __P((struct ie_generic *));
67 static void usp_print_ie_bbcp __P((struct ie_generic *));
68 static void usp_print_ie_bhli __P((struct ie_generic *));
69 static void usp_print_ie_blli __P((struct ie_generic *));
70 static void usp_print_ie_clst __P((struct ie_generic *));
71 static void usp_print_ie_cdad __P((struct ie_generic *));
72 static void usp_print_ie_cdsa __P((struct ie_generic *));
73 static void usp_print_ie_cgad __P((struct ie_generic *));
74 static void usp_print_ie_cgsa __P((struct ie_generic *));
75 static void usp_print_ie_caus __P((struct ie_generic *));
76 static void usp_print_ie_cnid __P((struct ie_generic *));
77 static void usp_print_ie_qosp __P((struct ie_generic *));
78 static void usp_print_ie_brpi __P((struct ie_generic *));
79 static void usp_print_ie_rsti __P((struct ie_generic *));
80 static void usp_print_ie_blsh __P((struct ie_generic *));
81 static void usp_print_ie_bnsh __P((struct ie_generic *));
82 static void usp_print_ie_bsdc __P((struct ie_generic *));
83 static void usp_print_ie_trnt __P((struct ie_generic *));
84 static void usp_print_ie_eprf __P((struct ie_generic *));
85 static void usp_print_ie_epst __P((struct ie_generic *));
89 * Values for Q.2931 message type.
91 static struct type_name msg_types[] = {
92 { "Call proceeding", 0x02 },
94 { "Connect ACK", 0x0F },
97 { "Release complete", 0x5A },
99 { "Restart ACK", 0x4E },
101 { "Status enquiry", 0x75 },
102 { "Add party", 0x80 },
103 { "Add party ACK", 0x81 },
104 { "Add party reject", 0x82 },
105 { "Drop party", 0x83 },
106 { "Drop party ACK", 0x84 },
112 * Values for information element identifier.
114 static struct type_name ie_types[] = {
116 { "Call state", 0x14 },
117 { "Endpoint reference", 0x54 },
118 { "Endpoint state", 0x55 },
119 { "ATM AAL parameters", 0x58 },
120 { "ATM user cell rate", 0x59 },
121 { "Connection ID", 0x5A },
122 { "QoS parameter", 0x5C },
123 { "Broadband high layer info", 0x5D },
124 { "Broadband bearer capability", 0x5E },
125 { "Broadband low layer info", 0x5F },
126 { "Broadband locking shift", 0x60 },
127 { "Broadband non-locking shift", 0x61 },
128 { "Broadband sending complete", 0x62 },
129 { "Broadband repeat indicator", 0x63 },
130 { "Calling party number", 0x6C },
131 { "Calling party subaddress", 0x6D },
132 { "Called party number", 0x70 },
133 { "Called party subaddress", 0x71 },
134 { "Transit net selection", 0x78 },
135 { "Restart indicator", 0x79 },
141 * Search a name - type translation table
144 * tbl a pointer to the table to search
145 * type the type to look for
148 * name a pointer to a character string with the name
153 struct type_name *tbl;
156 while (type != tbl->type && tbl->name)
167 * Print an ATM address
170 * p pointer to a Atm_address
177 usp_print_atm_addr(p)
182 cp = unisig_addr_print(p);
188 * Print a Q.2931 message structure
191 * msg pointer to the message to print
198 usp_print_msg(msg, dir)
199 struct unisig_msg *msg;
204 struct ie_generic *ie, *inxt;
206 name = find_type(msg_types, msg->msg_type);
215 printf("message: %s (%x)\n", name, msg->msg_type);
216 printf(" Call reference: 0x%x\n", msg->msg_call_ref);
218 printf(" Message type flag: 0x%x\n", msg->msg_type_flag);
219 printf(" Message type action: 0x%x\n", msg->msg_type_action);
220 printf(" Message length: %d\n", msg->msg_length);
221 for (i=0; i<UNI_MSG_IE_CNT; i++) {
222 ie = msg->msg_ie_vec[i];
230 for (i=0; i<UNI_MSG_IE_CNT; i++)
232 ie = msg->msg_ie_vec[i];
235 name = find_type(ie_types, ie->ie_ident);
236 if (ie->ie_ident == UNI_IE_CAUS ||
237 ie->ie_ident == UNI_IE_RSTI ||
238 ie->ie_ident == UNI_IE_CLST) {
241 printf(" Information element: %s (0x%x)\n",
252 * Print a Q.2931 information element
255 * ie pointer to the IE to print
263 struct ie_generic *ie;
268 name = find_type(ie_types, ie->ie_ident);
269 printf(" Information element: %s (0x%x)\n",
272 printf(" Coding: 0x%x\n",
274 printf(" Flag: 0x%x\n", ie->ie_flag);
275 printf(" Action: 0x%x\n",
277 printf(" Length: %d\n", ie->ie_length);
280 switch (ie->ie_ident) {
282 usp_print_ie_aalp(ie);
285 usp_print_ie_clrt(ie);
288 usp_print_ie_bbcp(ie);
291 usp_print_ie_bhli(ie);
294 usp_print_ie_blli(ie);
297 usp_print_ie_clst(ie);
300 usp_print_ie_cdad(ie);
303 usp_print_ie_cdsa(ie);
306 usp_print_ie_cgad(ie);
309 usp_print_ie_cgsa(ie);
312 usp_print_ie_caus(ie);
315 usp_print_ie_cnid(ie);
318 usp_print_ie_qosp(ie);
321 usp_print_ie_brpi(ie);
324 usp_print_ie_rsti(ie);
327 usp_print_ie_blsh(ie);
330 usp_print_ie_bnsh(ie);
333 usp_print_ie_bsdc(ie);
336 usp_print_ie_trnt(ie);
339 usp_print_ie_eprf(ie);
342 usp_print_ie_epst(ie);
351 * Print an AAL parameters information element
354 * ie pointer to the IE to print
361 usp_print_ie_aalp(ie)
362 struct ie_generic *ie;
364 printf(" AAL type: %d\n", ie->ie_aalp_aal_type);
365 switch(ie->ie_aalp_aal_type) {
366 case UNI_IE_AALP_AT_AAL1:
367 printf(" Subtype: 0x%x\n",
368 ie->ie_aalp_1_subtype);
369 printf(" CBR rate: 0x%x\n",
370 ie->ie_aalp_1_cbr_rate);
371 printf(" Multiplier: 0x%x\n",
372 ie->ie_aalp_1_multiplier);
373 printf(" Clock rcvry: 0x%x\n",
374 ie->ie_aalp_1_clock_recovery);
375 printf(" Err corr: 0x%x\n",
376 ie->ie_aalp_1_error_correction);
377 printf(" Struct data: 0x%x\n",
378 ie->ie_aalp_1_struct_data_tran);
379 printf(" Partial cells: 0x%x\n",
380 ie->ie_aalp_1_partial_cells);
382 case UNI_IE_AALP_AT_AAL3:
383 printf(" Fwd max SDU: %d\n",
384 ie->ie_aalp_4_fwd_max_sdu);
385 printf(" Bkwd max SDU: %d\n",
386 ie->ie_aalp_4_bkwd_max_sdu);
387 printf(" MID range: %d\n",
388 ie->ie_aalp_4_mid_range);
389 printf(" Mode: 0x%x\n",
391 printf(" SSCS type: 0x%x\n",
392 ie->ie_aalp_4_sscs_type);
394 case UNI_IE_AALP_AT_AAL5:
395 printf(" Fwd max SDU: %d\n",
396 ie->ie_aalp_5_fwd_max_sdu);
397 printf(" Bkwd max SDU: %d\n",
398 ie->ie_aalp_5_bkwd_max_sdu);
399 printf(" Mode: 0x%x\n",
401 printf(" SSCS type: 0x%x\n",
402 ie->ie_aalp_5_sscs_type);
404 case UNI_IE_AALP_AT_AALU:
405 printf(" User info: 0x%x %x %x %x\n",
406 ie->ie_aalp_user_info[0],
407 ie->ie_aalp_user_info[1],
408 ie->ie_aalp_user_info[2],
409 ie->ie_aalp_user_info[3]);
416 * Print a user cell rate information element
419 * ie pointer to the IE to print
426 usp_print_ie_clrt(ie)
427 struct ie_generic *ie;
429 printf(" Forward peak: %d\n", ie->ie_clrt_fwd_peak);
430 printf(" Backward peak: %d\n", ie->ie_clrt_bkwd_peak);
431 printf(" Fwd peak 01: %d\n", ie->ie_clrt_fwd_peak_01);
432 printf(" Bkwd peak 01: %d\n", ie->ie_clrt_bkwd_peak_01);
433 printf(" Fwd sust: %d\n", ie->ie_clrt_fwd_sust);
434 printf(" Bkwd sust: %d\n", ie->ie_clrt_bkwd_sust);
435 printf(" Fwd sust 01: %d\n", ie->ie_clrt_fwd_sust_01);
436 printf(" Bkwd sust 01: %d\n", ie->ie_clrt_bkwd_sust_01);
437 printf(" Fwd burst: %d\n", ie->ie_clrt_fwd_burst);
438 printf(" Bkwd burst: %d\n", ie->ie_clrt_bkwd_burst);
439 printf(" Fwd burst 01: %d\n", ie->ie_clrt_fwd_burst_01);
440 printf(" Bkwd burst 01: %d\n",
441 ie->ie_clrt_bkwd_burst_01);
442 printf(" Best effort: %d\n", ie->ie_clrt_best_effort);
443 printf(" TM optons: 0x%x\n",
444 ie->ie_clrt_tm_options);
449 * Print a broadband bearer capability information element
452 * ie pointer to the IE to print
459 usp_print_ie_bbcp(ie)
460 struct ie_generic *ie;
462 printf(" Bearer class: 0x%x\n",
463 ie->ie_bbcp_bearer_class);
464 printf(" Traffic type: 0x%x\n",
465 ie->ie_bbcp_traffic_type);
466 printf(" Timing req: 0x%x\n",
467 ie->ie_bbcp_timing_req);
468 printf(" Clipping: 0x%x\n", ie->ie_bbcp_clipping);
469 printf(" Conn config: 0x%x\n",
470 ie->ie_bbcp_conn_config);
475 * Print a broadband high layer information information element
478 * ie pointer to the IE to print
485 usp_print_ie_bhli(ie)
486 struct ie_generic *ie;
490 printf(" Type: 0x%x\n", ie->ie_bhli_type);
491 printf(" HL info: 0x");
492 for (i=0; i<ie->ie_length-1; i++) {
493 printf("%x ", ie->ie_bhli_info[i]);
500 * Print a broadband low-layer information information element
503 * ie pointer to the IE to print
510 usp_print_ie_blli(ie)
511 struct ie_generic *ie;
513 printf(" Layer 1 ID: 0x%x\n", ie->ie_blli_l1_id);
514 printf(" Layer 2 ID: 0x%x\n", ie->ie_blli_l2_id);
515 printf(" Layer 2 mode: 0x%x\n", ie->ie_blli_l2_mode);
516 printf(" Layer 2 Q.933: 0x%x\n",
517 ie->ie_blli_l2_q933_use);
518 printf(" Layer 2 win: 0x%x\n",
519 ie->ie_blli_l2_window);
520 printf(" Layer 2 user: 0x%x\n",
521 ie->ie_blli_l2_user_proto);
522 printf(" Layer 3 ID: 0x%x\n", ie->ie_blli_l3_id);
523 printf(" Layer 3 mode: 0x%x\n", ie->ie_blli_l3_mode);
524 printf(" Layer 3 pkt: 0x%x\n",
525 ie->ie_blli_l3_packet_size);
526 printf(" Layer 3 win: 0x%x\n",
527 ie->ie_blli_l3_window);
528 printf(" Layer 3 user: 0x%x\n",
529 ie->ie_blli_l3_user_proto);
530 printf(" Layer 3 IPI: 0x%x\n", ie->ie_blli_l3_ipi);
531 printf(" Layer 3 SNAP: 0x%x\n",
532 ie->ie_blli_l3_snap_id);
533 printf(" Layer 3 OUI: 0x%x %x %x\n",
534 ie->ie_blli_l3_oui[0],
535 ie->ie_blli_l3_oui[1],
536 ie->ie_blli_l3_oui[2]);
537 printf(" Layer 3 PID: 0x%x %x\n",
538 ie->ie_blli_l3_pid[0],
539 ie->ie_blli_l3_pid[1]);
544 * Print a call state information element
547 * ie pointer to the IE to print
554 usp_print_ie_clst(ie)
555 struct ie_generic *ie;
557 printf(" Call state: %d\n",
563 * Print a called party number information element
566 * ie pointer to the IE to print
573 usp_print_ie_cdad(ie)
574 struct ie_generic *ie;
576 printf(" ATM addr: ");
577 usp_print_atm_addr(&ie->ie_cdad_addr);
583 * Print a called party subaddress information element
586 * ie pointer to the IE to print
593 usp_print_ie_cdsa(ie)
594 struct ie_generic *ie;
596 printf(" ATM subaddr: ");
597 usp_print_atm_addr(&ie->ie_cdsa_addr);
603 * Print a calling party number information element
606 * ie pointer to the IE to print
613 usp_print_ie_cgad(ie)
614 struct ie_generic *ie;
616 printf(" ATM addr: ");
617 usp_print_atm_addr(&ie->ie_cgad_addr);
623 * Print a calling party subaddress information element
626 * ie pointer to the IE to print
633 usp_print_ie_cgsa(ie)
634 struct ie_generic *ie;
636 printf(" ATM subaddr: ");
637 usp_print_atm_addr(&ie->ie_cgsa_addr);
643 * Print a cause information element
646 * ie pointer to the IE to print
653 usp_print_ie_caus(ie)
654 struct ie_generic *ie;
658 printf(" Location: %d\n", ie->ie_caus_loc);
659 printf(" Cause: %d\n", ie->ie_caus_cause);
660 switch(ie->ie_caus_cause) {
661 case UNI_IE_CAUS_IECONTENT:
662 printf(" Flagged IEs: ");
663 for (i=0; ie->ie_caus_diagnostic[i]; i++) {
664 printf("0x%x ", ie->ie_caus_diagnostic[i]);
668 case UNI_IE_CAUS_TIMER:
669 printf(" Timer ID: %c%c%c\n",
670 ie->ie_caus_diagnostic[0],
671 ie->ie_caus_diagnostic[1],
672 ie->ie_caus_diagnostic[2]);
675 printf(" Diag length: %d\n",
676 ie->ie_caus_diag_len);
677 printf(" Diagnostic: ");
678 for (i=0; i<ie->ie_caus_diag_len; i++) {
679 printf("0x%x ", ie->ie_caus_diagnostic[i]);
687 * Print a connection identifier information element
690 * ie pointer to the IE to print
697 usp_print_ie_cnid(ie)
698 struct ie_generic *ie;
700 printf(" VP assoc sig: 0x%x\n", ie->ie_cnid_vp_sig);
701 printf(" Pref/excl: 0x%x\n",
702 ie->ie_cnid_pref_excl);
703 printf(" VPCI: %d\n", ie->ie_cnid_vpci);
704 printf(" VCI: %d\n", ie->ie_cnid_vci);
709 * Print a quality of service parameter information element
712 * ie pointer to the IE to print
719 usp_print_ie_qosp(ie)
720 struct ie_generic *ie;
722 printf(" QoS fwd: 0x%x\n",
723 ie->ie_qosp_fwd_class);
724 printf(" QoS bkwd: 0x%x\n",
725 ie->ie_qosp_bkwd_class);
730 * Print a broadband repeat indicator information element
733 * ie pointer to the IE to print
740 usp_print_ie_brpi(ie)
741 struct ie_generic *ie;
743 printf(" Indicator: 0x%x\n", ie->ie_brpi_ind);
748 * Print a restart indicator information element
751 * ie pointer to the IE to print
758 usp_print_ie_rsti(ie)
759 struct ie_generic *ie;
761 printf(" Class: 0x%x\n", ie->ie_rsti_class);
766 * Print a broadband locking shift information element
769 * ie pointer to the IE to print
776 usp_print_ie_blsh(ie)
777 struct ie_generic *ie;
783 * Print a broadband non-locking shift information element
786 * ie pointer to the IE to print
793 usp_print_ie_bnsh(ie)
794 struct ie_generic *ie;
800 * Print a broadband sending complete information element
803 * ie pointer to the IE to print
810 usp_print_ie_bsdc(ie)
811 struct ie_generic *ie;
813 printf(" Indication: 0x%x\n", ie->ie_bsdc_ind);
818 * Print a transit net selection information element
821 * ie pointer to the IE to print
828 usp_print_ie_trnt(ie)
829 struct ie_generic *ie;
832 struct ie_generic ie_trnt_hdr;
833 u_char ie_trnt_id_type;
834 u_char ie_trnt_id_plan;
841 * Print an endpoint reference information element
844 * ie pointer to the IE to print
851 usp_print_ie_eprf(ie)
852 struct ie_generic *ie;
854 printf(" Ref type: 0x%x\n",
856 printf(" Endpt ref: 0x%x\n",
862 * Print an endpoint state information element
865 * ie pointer to the IE to print
872 usp_print_ie_epst(ie)
873 struct ie_generic *ie;
875 printf(" Endpt state: %d\n",