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.3 2003/08/07 21:17:36 dillon 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 "unisig_var.h"
41 #include "unisig_msg.h"
42 #include "unisig_print.h"
56 static char * find_type __P((struct type_name *, u_char));
57 static void usp_print_atm_addr __P((Atm_addr *));
58 static void usp_print_ie __P((struct ie_generic *));
59 static void usp_print_ie_aalp __P((struct ie_generic *));
60 static void usp_print_ie_clrt __P((struct ie_generic *));
61 static void usp_print_ie_bbcp __P((struct ie_generic *));
62 static void usp_print_ie_bhli __P((struct ie_generic *));
63 static void usp_print_ie_blli __P((struct ie_generic *));
64 static void usp_print_ie_clst __P((struct ie_generic *));
65 static void usp_print_ie_cdad __P((struct ie_generic *));
66 static void usp_print_ie_cdsa __P((struct ie_generic *));
67 static void usp_print_ie_cgad __P((struct ie_generic *));
68 static void usp_print_ie_cgsa __P((struct ie_generic *));
69 static void usp_print_ie_caus __P((struct ie_generic *));
70 static void usp_print_ie_cnid __P((struct ie_generic *));
71 static void usp_print_ie_qosp __P((struct ie_generic *));
72 static void usp_print_ie_brpi __P((struct ie_generic *));
73 static void usp_print_ie_rsti __P((struct ie_generic *));
74 static void usp_print_ie_blsh __P((struct ie_generic *));
75 static void usp_print_ie_bnsh __P((struct ie_generic *));
76 static void usp_print_ie_bsdc __P((struct ie_generic *));
77 static void usp_print_ie_trnt __P((struct ie_generic *));
78 static void usp_print_ie_eprf __P((struct ie_generic *));
79 static void usp_print_ie_epst __P((struct ie_generic *));
83 * Values for Q.2931 message type.
85 static struct type_name msg_types[] = {
86 { "Call proceeding", 0x02 },
88 { "Connect ACK", 0x0F },
91 { "Release complete", 0x5A },
93 { "Restart ACK", 0x4E },
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 },
106 * Values for information element identifier.
108 static struct type_name ie_types[] = {
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 },
135 * Search a name - type translation table
138 * tbl a pointer to the table to search
139 * type the type to look for
142 * name a pointer to a character string with the name
147 struct type_name *tbl;
150 while (type != tbl->type && tbl->name)
161 * Print an ATM address
164 * p pointer to a Atm_address
171 usp_print_atm_addr(p)
176 cp = unisig_addr_print(p);
182 * Print a Q.2931 message structure
185 * msg pointer to the message to print
192 usp_print_msg(msg, dir)
193 struct unisig_msg *msg;
198 struct ie_generic *ie, *inxt;
200 name = find_type(msg_types, msg->msg_type);
209 printf("message: %s (%x)\n", name, msg->msg_type);
210 printf(" Call reference: 0x%x\n", msg->msg_call_ref);
212 printf(" Message type flag: 0x%x\n", msg->msg_type_flag);
213 printf(" Message type action: 0x%x\n", msg->msg_type_action);
214 printf(" Message length: %d\n", msg->msg_length);
215 for (i=0; i<UNI_MSG_IE_CNT; i++) {
216 ie = msg->msg_ie_vec[i];
224 for (i=0; i<UNI_MSG_IE_CNT; i++)
226 ie = msg->msg_ie_vec[i];
229 name = find_type(ie_types, ie->ie_ident);
230 if (ie->ie_ident == UNI_IE_CAUS ||
231 ie->ie_ident == UNI_IE_RSTI ||
232 ie->ie_ident == UNI_IE_CLST) {
235 printf(" Information element: %s (0x%x)\n",
246 * Print a Q.2931 information element
249 * ie pointer to the IE to print
257 struct ie_generic *ie;
262 name = find_type(ie_types, ie->ie_ident);
263 printf(" Information element: %s (0x%x)\n",
266 printf(" Coding: 0x%x\n",
268 printf(" Flag: 0x%x\n", ie->ie_flag);
269 printf(" Action: 0x%x\n",
271 printf(" Length: %d\n", ie->ie_length);
274 switch (ie->ie_ident) {
276 usp_print_ie_aalp(ie);
279 usp_print_ie_clrt(ie);
282 usp_print_ie_bbcp(ie);
285 usp_print_ie_bhli(ie);
288 usp_print_ie_blli(ie);
291 usp_print_ie_clst(ie);
294 usp_print_ie_cdad(ie);
297 usp_print_ie_cdsa(ie);
300 usp_print_ie_cgad(ie);
303 usp_print_ie_cgsa(ie);
306 usp_print_ie_caus(ie);
309 usp_print_ie_cnid(ie);
312 usp_print_ie_qosp(ie);
315 usp_print_ie_brpi(ie);
318 usp_print_ie_rsti(ie);
321 usp_print_ie_blsh(ie);
324 usp_print_ie_bnsh(ie);
327 usp_print_ie_bsdc(ie);
330 usp_print_ie_trnt(ie);
333 usp_print_ie_eprf(ie);
336 usp_print_ie_epst(ie);
345 * Print an AAL parameters information element
348 * ie pointer to the IE to print
355 usp_print_ie_aalp(ie)
356 struct ie_generic *ie;
358 printf(" AAL type: %d\n", ie->ie_aalp_aal_type);
359 switch(ie->ie_aalp_aal_type) {
360 case UNI_IE_AALP_AT_AAL1:
361 printf(" Subtype: 0x%x\n",
362 ie->ie_aalp_1_subtype);
363 printf(" CBR rate: 0x%x\n",
364 ie->ie_aalp_1_cbr_rate);
365 printf(" Multiplier: 0x%x\n",
366 ie->ie_aalp_1_multiplier);
367 printf(" Clock rcvry: 0x%x\n",
368 ie->ie_aalp_1_clock_recovery);
369 printf(" Err corr: 0x%x\n",
370 ie->ie_aalp_1_error_correction);
371 printf(" Struct data: 0x%x\n",
372 ie->ie_aalp_1_struct_data_tran);
373 printf(" Partial cells: 0x%x\n",
374 ie->ie_aalp_1_partial_cells);
376 case UNI_IE_AALP_AT_AAL3:
377 printf(" Fwd max SDU: %d\n",
378 ie->ie_aalp_4_fwd_max_sdu);
379 printf(" Bkwd max SDU: %d\n",
380 ie->ie_aalp_4_bkwd_max_sdu);
381 printf(" MID range: %d\n",
382 ie->ie_aalp_4_mid_range);
383 printf(" Mode: 0x%x\n",
385 printf(" SSCS type: 0x%x\n",
386 ie->ie_aalp_4_sscs_type);
388 case UNI_IE_AALP_AT_AAL5:
389 printf(" Fwd max SDU: %d\n",
390 ie->ie_aalp_5_fwd_max_sdu);
391 printf(" Bkwd max SDU: %d\n",
392 ie->ie_aalp_5_bkwd_max_sdu);
393 printf(" Mode: 0x%x\n",
395 printf(" SSCS type: 0x%x\n",
396 ie->ie_aalp_5_sscs_type);
398 case UNI_IE_AALP_AT_AALU:
399 printf(" User info: 0x%x %x %x %x\n",
400 ie->ie_aalp_user_info[0],
401 ie->ie_aalp_user_info[1],
402 ie->ie_aalp_user_info[2],
403 ie->ie_aalp_user_info[3]);
410 * Print a user cell rate information element
413 * ie pointer to the IE to print
420 usp_print_ie_clrt(ie)
421 struct ie_generic *ie;
423 printf(" Forward peak: %d\n", ie->ie_clrt_fwd_peak);
424 printf(" Backward peak: %d\n", ie->ie_clrt_bkwd_peak);
425 printf(" Fwd peak 01: %d\n", ie->ie_clrt_fwd_peak_01);
426 printf(" Bkwd peak 01: %d\n", ie->ie_clrt_bkwd_peak_01);
427 printf(" Fwd sust: %d\n", ie->ie_clrt_fwd_sust);
428 printf(" Bkwd sust: %d\n", ie->ie_clrt_bkwd_sust);
429 printf(" Fwd sust 01: %d\n", ie->ie_clrt_fwd_sust_01);
430 printf(" Bkwd sust 01: %d\n", ie->ie_clrt_bkwd_sust_01);
431 printf(" Fwd burst: %d\n", ie->ie_clrt_fwd_burst);
432 printf(" Bkwd burst: %d\n", ie->ie_clrt_bkwd_burst);
433 printf(" Fwd burst 01: %d\n", ie->ie_clrt_fwd_burst_01);
434 printf(" Bkwd burst 01: %d\n",
435 ie->ie_clrt_bkwd_burst_01);
436 printf(" Best effort: %d\n", ie->ie_clrt_best_effort);
437 printf(" TM optons: 0x%x\n",
438 ie->ie_clrt_tm_options);
443 * Print a broadband bearer capability information element
446 * ie pointer to the IE to print
453 usp_print_ie_bbcp(ie)
454 struct ie_generic *ie;
456 printf(" Bearer class: 0x%x\n",
457 ie->ie_bbcp_bearer_class);
458 printf(" Traffic type: 0x%x\n",
459 ie->ie_bbcp_traffic_type);
460 printf(" Timing req: 0x%x\n",
461 ie->ie_bbcp_timing_req);
462 printf(" Clipping: 0x%x\n", ie->ie_bbcp_clipping);
463 printf(" Conn config: 0x%x\n",
464 ie->ie_bbcp_conn_config);
469 * Print a broadband high layer information information element
472 * ie pointer to the IE to print
479 usp_print_ie_bhli(ie)
480 struct ie_generic *ie;
484 printf(" Type: 0x%x\n", ie->ie_bhli_type);
485 printf(" HL info: 0x");
486 for (i=0; i<ie->ie_length-1; i++) {
487 printf("%x ", ie->ie_bhli_info[i]);
494 * Print a broadband low-layer information information element
497 * ie pointer to the IE to print
504 usp_print_ie_blli(ie)
505 struct ie_generic *ie;
507 printf(" Layer 1 ID: 0x%x\n", ie->ie_blli_l1_id);
508 printf(" Layer 2 ID: 0x%x\n", ie->ie_blli_l2_id);
509 printf(" Layer 2 mode: 0x%x\n", ie->ie_blli_l2_mode);
510 printf(" Layer 2 Q.933: 0x%x\n",
511 ie->ie_blli_l2_q933_use);
512 printf(" Layer 2 win: 0x%x\n",
513 ie->ie_blli_l2_window);
514 printf(" Layer 2 user: 0x%x\n",
515 ie->ie_blli_l2_user_proto);
516 printf(" Layer 3 ID: 0x%x\n", ie->ie_blli_l3_id);
517 printf(" Layer 3 mode: 0x%x\n", ie->ie_blli_l3_mode);
518 printf(" Layer 3 pkt: 0x%x\n",
519 ie->ie_blli_l3_packet_size);
520 printf(" Layer 3 win: 0x%x\n",
521 ie->ie_blli_l3_window);
522 printf(" Layer 3 user: 0x%x\n",
523 ie->ie_blli_l3_user_proto);
524 printf(" Layer 3 IPI: 0x%x\n", ie->ie_blli_l3_ipi);
525 printf(" Layer 3 SNAP: 0x%x\n",
526 ie->ie_blli_l3_snap_id);
527 printf(" Layer 3 OUI: 0x%x %x %x\n",
528 ie->ie_blli_l3_oui[0],
529 ie->ie_blli_l3_oui[1],
530 ie->ie_blli_l3_oui[2]);
531 printf(" Layer 3 PID: 0x%x %x\n",
532 ie->ie_blli_l3_pid[0],
533 ie->ie_blli_l3_pid[1]);
538 * Print a call state information element
541 * ie pointer to the IE to print
548 usp_print_ie_clst(ie)
549 struct ie_generic *ie;
551 printf(" Call state: %d\n",
557 * Print a called party number information element
560 * ie pointer to the IE to print
567 usp_print_ie_cdad(ie)
568 struct ie_generic *ie;
570 printf(" ATM addr: ");
571 usp_print_atm_addr(&ie->ie_cdad_addr);
577 * Print a called party subaddress information element
580 * ie pointer to the IE to print
587 usp_print_ie_cdsa(ie)
588 struct ie_generic *ie;
590 printf(" ATM subaddr: ");
591 usp_print_atm_addr(&ie->ie_cdsa_addr);
597 * Print a calling party number information element
600 * ie pointer to the IE to print
607 usp_print_ie_cgad(ie)
608 struct ie_generic *ie;
610 printf(" ATM addr: ");
611 usp_print_atm_addr(&ie->ie_cgad_addr);
617 * Print a calling party subaddress information element
620 * ie pointer to the IE to print
627 usp_print_ie_cgsa(ie)
628 struct ie_generic *ie;
630 printf(" ATM subaddr: ");
631 usp_print_atm_addr(&ie->ie_cgsa_addr);
637 * Print a cause information element
640 * ie pointer to the IE to print
647 usp_print_ie_caus(ie)
648 struct ie_generic *ie;
652 printf(" Location: %d\n", ie->ie_caus_loc);
653 printf(" Cause: %d\n", ie->ie_caus_cause);
654 switch(ie->ie_caus_cause) {
655 case UNI_IE_CAUS_IECONTENT:
656 printf(" Flagged IEs: ");
657 for (i=0; ie->ie_caus_diagnostic[i]; i++) {
658 printf("0x%x ", ie->ie_caus_diagnostic[i]);
662 case UNI_IE_CAUS_TIMER:
663 printf(" Timer ID: %c%c%c\n",
664 ie->ie_caus_diagnostic[0],
665 ie->ie_caus_diagnostic[1],
666 ie->ie_caus_diagnostic[2]);
669 printf(" Diag length: %d\n",
670 ie->ie_caus_diag_len);
671 printf(" Diagnostic: ");
672 for (i=0; i<ie->ie_caus_diag_len; i++) {
673 printf("0x%x ", ie->ie_caus_diagnostic[i]);
681 * Print a connection identifier information element
684 * ie pointer to the IE to print
691 usp_print_ie_cnid(ie)
692 struct ie_generic *ie;
694 printf(" VP assoc sig: 0x%x\n", ie->ie_cnid_vp_sig);
695 printf(" Pref/excl: 0x%x\n",
696 ie->ie_cnid_pref_excl);
697 printf(" VPCI: %d\n", ie->ie_cnid_vpci);
698 printf(" VCI: %d\n", ie->ie_cnid_vci);
703 * Print a quality of service parameter information element
706 * ie pointer to the IE to print
713 usp_print_ie_qosp(ie)
714 struct ie_generic *ie;
716 printf(" QoS fwd: 0x%x\n",
717 ie->ie_qosp_fwd_class);
718 printf(" QoS bkwd: 0x%x\n",
719 ie->ie_qosp_bkwd_class);
724 * Print a broadband repeat indicator information element
727 * ie pointer to the IE to print
734 usp_print_ie_brpi(ie)
735 struct ie_generic *ie;
737 printf(" Indicator: 0x%x\n", ie->ie_brpi_ind);
742 * Print a restart indicator information element
745 * ie pointer to the IE to print
752 usp_print_ie_rsti(ie)
753 struct ie_generic *ie;
755 printf(" Class: 0x%x\n", ie->ie_rsti_class);
760 * Print a broadband locking shift information element
763 * ie pointer to the IE to print
770 usp_print_ie_blsh(ie)
771 struct ie_generic *ie;
777 * Print a broadband non-locking shift information element
780 * ie pointer to the IE to print
787 usp_print_ie_bnsh(ie)
788 struct ie_generic *ie;
794 * Print a broadband sending complete information element
797 * ie pointer to the IE to print
804 usp_print_ie_bsdc(ie)
805 struct ie_generic *ie;
807 printf(" Indication: 0x%x\n", ie->ie_bsdc_ind);
812 * Print a transit net selection information element
815 * ie pointer to the IE to print
822 usp_print_ie_trnt(ie)
823 struct ie_generic *ie;
826 struct ie_generic ie_trnt_hdr;
827 u_char ie_trnt_id_type;
828 u_char ie_trnt_id_plan;
835 * Print an endpoint reference information element
838 * ie pointer to the IE to print
845 usp_print_ie_eprf(ie)
846 struct ie_generic *ie;
848 printf(" Ref type: 0x%x\n",
850 printf(" Endpt ref: 0x%x\n",
856 * Print an endpoint state information element
859 * ie pointer to the IE to print
866 usp_print_ie_epst(ie)
867 struct ie_generic *ie;
869 printf(" Endpt state: %d\n",