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"
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 },
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
146 find_type(struct type_name *tbl, u_char type)
148 while (type != tbl->type && tbl->name)
159 * Print an ATM address
162 * p pointer to a Atm_address
169 usp_print_atm_addr(Atm_addr *p)
173 cp = unisig_addr_print(p);
179 * Print a Q.2931 message structure
182 * msg pointer to the message to print
189 usp_print_msg(struct unisig_msg *msg, int dir)
193 struct ie_generic *ie, *inxt;
195 name = find_type(msg_types, msg->msg_type);
198 kprintf("Received ");
204 kprintf("message: %s (%x)\n", name, msg->msg_type);
205 kprintf(" Call reference: 0x%x\n", msg->msg_call_ref);
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];
219 for (i=0; i<UNI_MSG_IE_CNT; i++)
221 ie = msg->msg_ie_vec[i];
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) {
230 kprintf(" Information element: %s (0x%x)\n",
241 * Print a Q.2931 information element
244 * ie pointer to the IE to print
251 usp_print_ie(struct ie_generic *ie)
256 name = find_type(ie_types, ie->ie_ident);
257 kprintf(" Information element: %s (0x%x)\n",
260 kprintf(" Coding: 0x%x\n",
262 kprintf(" Flag: 0x%x\n", ie->ie_flag);
263 kprintf(" Action: 0x%x\n",
265 kprintf(" Length: %d\n", ie->ie_length);
268 switch (ie->ie_ident) {
270 usp_print_ie_aalp(ie);
273 usp_print_ie_clrt(ie);
276 usp_print_ie_bbcp(ie);
279 usp_print_ie_bhli(ie);
282 usp_print_ie_blli(ie);
285 usp_print_ie_clst(ie);
288 usp_print_ie_cdad(ie);
291 usp_print_ie_cdsa(ie);
294 usp_print_ie_cgad(ie);
297 usp_print_ie_cgsa(ie);
300 usp_print_ie_caus(ie);
303 usp_print_ie_cnid(ie);
306 usp_print_ie_qosp(ie);
309 usp_print_ie_brpi(ie);
312 usp_print_ie_rsti(ie);
315 usp_print_ie_blsh(ie);
318 usp_print_ie_bnsh(ie);
321 usp_print_ie_bsdc(ie);
324 usp_print_ie_trnt(ie);
327 usp_print_ie_eprf(ie);
330 usp_print_ie_epst(ie);
339 * Print an AAL parameters information element
342 * ie pointer to the IE to print
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);
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",
378 kprintf(" SSCS type: 0x%x\n",
379 ie->ie_aalp_4_sscs_type);
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",
388 kprintf(" SSCS type: 0x%x\n",
389 ie->ie_aalp_5_sscs_type);
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]);
403 * Print a user cell rate information element
406 * ie pointer to the IE to print
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
438 * ie pointer to the IE to print
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
463 * ie pointer to the IE to print
470 usp_print_ie_bhli(struct ie_generic *ie)
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]);
484 * Print a broadband low-layer information information element
487 * ie pointer to the IE to print
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
530 * ie pointer to the IE to print
537 usp_print_ie_clst(struct ie_generic *ie)
539 kprintf(" Call state: %d\n",
545 * Print a called party number information element
548 * ie pointer to the IE to print
555 usp_print_ie_cdad(struct ie_generic *ie)
557 kprintf(" ATM addr: ");
558 usp_print_atm_addr(&ie->ie_cdad_addr);
564 * Print a called party subaddress information element
567 * ie pointer to the IE to print
574 usp_print_ie_cdsa(struct ie_generic *ie)
576 kprintf(" ATM subaddr: ");
577 usp_print_atm_addr(&ie->ie_cdsa_addr);
583 * Print a calling party number information element
586 * ie pointer to the IE to print
593 usp_print_ie_cgad(struct ie_generic *ie)
595 kprintf(" ATM addr: ");
596 usp_print_atm_addr(&ie->ie_cgad_addr);
602 * Print a calling party subaddress information element
605 * ie pointer to the IE to print
612 usp_print_ie_cgsa(struct ie_generic *ie)
614 kprintf(" ATM subaddr: ");
615 usp_print_atm_addr(&ie->ie_cgsa_addr);
621 * Print a cause information element
624 * ie pointer to the IE to print
631 usp_print_ie_caus(struct ie_generic *ie)
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]);
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]);
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]);
664 * Print a connection identifier information element
667 * ie pointer to the IE to print
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
688 * ie pointer to the IE to print
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
708 * ie pointer to the IE to print
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
725 * ie pointer to the IE to print
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
742 * ie pointer to the IE to print
749 usp_print_ie_blsh(struct ie_generic *ie)
755 * Print a broadband non-locking shift information element
758 * ie pointer to the IE to print
765 usp_print_ie_bnsh(struct ie_generic *ie)
771 * Print a broadband sending complete information element
774 * ie pointer to the IE to print
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
791 * ie pointer to the IE to print
798 usp_print_ie_trnt(struct ie_generic *ie)
801 struct ie_generic ie_trnt_hdr;
802 u_char ie_trnt_id_type;
803 u_char ie_trnt_id_plan;
810 * Print an endpoint reference information element
813 * ie pointer to the IE to print
820 usp_print_ie_eprf(struct ie_generic *ie)
822 kprintf(" Ref type: 0x%x\n",
824 kprintf(" Endpt ref: 0x%x\n",
830 * Print an endpoint state information element
833 * ie pointer to the IE to print
840 usp_print_ie_epst(struct ie_generic *ie)
842 kprintf(" Endpt state: %d\n",