2 * Routines for Q.933 frame disassembly
3 * Guy Harris <guy@alum.mit.edu>
5 * $Id: packet-q933.c,v 1.2 2003/09/03 18:27:55 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 #include <epan/packet.h>
34 #include <epan/strutil.h>
38 #include "packet-tpkt.h"
40 static int proto_q933 = -1;
41 static int hf_q933_discriminator = -1;
42 static int hf_q933_call_ref_len = -1;
43 static int hf_q933_call_ref_flag = -1;
44 static int hf_q933_call_ref = -1;
45 static int hf_q933_message_type = -1;
46 static int hf_q933_cause_value = -1;
47 static int hf_q933_calling_party_number = -1;
48 static int hf_q933_called_party_number = -1;
49 static int hf_q933_connected_number = -1;
50 static int hf_q933_redirecting_number = -1;
52 static gint ett_q933 = -1;
53 static gint ett_q933_ie = -1;
56 * Q.933 message types.
58 #define Q933_ESCAPE 0x00
59 #define Q933_ALERTING 0x01
60 #define Q933_CALL_PROCEEDING 0x02
61 #define Q933_CONNECT 0x07
62 #define Q933_CONNECT_ACK 0x0F
63 #define Q933_PROGRESS 0x03
64 #define Q933_SETUP 0x05
65 #define Q933_DISCONNECT 0x45
66 #define Q933_RELEASE 0x4D
67 #define Q933_RELEASE_COMPLETE 0x5A
68 #define Q933_SEGMENT 0x60
69 #define Q933_STATUS 0x7D
70 #define Q933_STATUS_ENQUIRY 0x75
72 static const value_string q933_message_type_vals[] = {
73 { Q933_ESCAPE, "ESCAPE" },
74 { Q933_ALERTING, "ALERTING" },
75 { Q933_CALL_PROCEEDING, "CALL PROCEEDING" },
76 { Q933_CONNECT, "CONNECT" },
77 { Q933_CONNECT_ACK, "CONNECT ACKNOWLEDGE" },
78 { Q933_PROGRESS, "PROGRESS" },
79 { Q933_SETUP, "SETUP" },
80 { Q933_DISCONNECT, "DISCONNECT" },
81 { Q933_RELEASE, "RELEASE" },
82 { Q933_RELEASE_COMPLETE, "RELEASE COMPLETE" },
83 { Q933_SEGMENT, "SEGMENT" },
84 { Q933_STATUS, "STATUS" },
85 { Q933_STATUS_ENQUIRY, "STATUS ENQUIRY" },
89 static const true_false_string tfs_call_ref_flag = {
90 "Message sent to originating side",
91 "Message sent from originating side"
95 * Information elements.
98 /* Shifted codeset values */
108 #define Q933_IE_SO_MASK 0x80 /* single-octet/variable-length mask */
112 #define Q933_IE_SO_IDENTIFIER_MASK 0xf0 /* IE identifier mask */
113 #define Q933_IE_SO_IDENTIFIER_SHIFT 4 /* IE identifier shift */
114 #define Q933_IE_SO_IE_MASK 0x0F /* IE mask */
116 #define Q933_IE_SHIFT 0x90
117 #define Q933_IE_SHIFT_NON_LOCKING 0x08 /* non-locking shift */
118 #define Q933_IE_SHIFT_CODESET 0x0F /* codeset */
120 #define Q933_IE_REPEAT_INDICATOR 0xD0
123 * Variable-length IEs.
125 #define Q933_IE_VL_EXTENSION 0x80 /* Extension flag */
128 * Codeset 0 (default).
130 #define Q933_IE_SEGMENTED_MESSAGE 0x00
131 #define Q933_IE_BEARER_CAPABILITY 0x04
132 #define Q933_IE_CAUSE 0x08
133 #define Q933_IE_CALL_STATE 0x14
134 #define Q933_IE_CHANNEL_IDENTIFICATION 0x18
135 #define Q933_IE_DLCI 0x19
136 #define Q933_IE_PROGRESS_INDICATOR 0x1E
137 #define Q933_IE_NETWORK_SPECIFIC_FACIL 0x20 /* Network Specific Facilities */
138 #define Q933_IE_DISPLAY 0x28
139 #define Q933_IE_E2E_TRANSIT_DELAY 0x42 /* End-to-end Transit Delay */
140 #define Q933_IE_TD_SELECTION_AND_INT 0x43 /* Transit Delay Selection and Indication */
141 #define Q933_IE_PL_BINARY_PARAMETERS 0x44 /* Packet layer binary parameters */
142 #define Q933_IE_LL_CORE_PARAMETERS 0x48 /* Link layer core parameters */
143 #define Q933_IE_LL_PROTOCOL_PARAMETERS 0x49 /* Link layer protocol parameters */
144 #define Q933_IE_REVERSE_CHARGE_IND 0x4A /* Reverse charging indication */
145 #define Q933_IE_CONNECTED_NUMBER 0x4C /* Connected Number */
146 #define Q933_IE_CONNECTED_SUBADDR 0x4D /* Connected sub-address */
147 #define Q933_IE_X_213_PRIORITY 0x50 /* X.213 priority */
148 #define Q933_IE_REPORT_TYPE 0x51
149 #define Q933_IE_LINK_INTEGRITY_VERF 0x53 /* Link integrity verification */
150 #define Q933_IE_PVC_STATUS 0x57
151 #define Q933_IE_CALLING_PARTY_NUMBER 0x6C /* Calling Party Number */
152 #define Q933_IE_CALLING_PARTY_SUBADDR 0x6D /* Calling Party Subaddress */
153 #define Q933_IE_CALLED_PARTY_NUMBER 0x70 /* Called Party Number */
154 #define Q933_IE_CALLED_PARTY_SUBADDR 0x71 /* Called Party Subaddress */
155 #define Q933_IE_TRANSIT_NETWORK_SEL 0x78 /* Transit Network Selection */
156 #define Q933_IE_LOW_LAYER_COMPAT 0x7C /* Low-Layer Compatibility */
157 #define Q933_IE_HIGH_LAYER_COMPAT 0x7D /* High-Layer Compatibility */
158 #define Q933_IE_USER_USER 0x7E /* User-User */
159 #define Q933_IE_ESCAPE 0x7F /* Escape for extension */
162 static const value_string q933_info_element_vals0[] = {
163 { Q933_IE_SEGMENTED_MESSAGE, "Segmented message" },
164 { Q933_IE_BEARER_CAPABILITY, "Bearer capability" },
165 { Q933_IE_CAUSE, "Cause" },
166 { Q933_IE_CALL_STATE, "Call state" },
167 { Q933_IE_CHANNEL_IDENTIFICATION, "Channel identification" },
168 { Q933_IE_DLCI, "Data link connection identifier" },
169 { Q933_IE_PROGRESS_INDICATOR, "Progress indicator" },
170 { Q933_IE_NETWORK_SPECIFIC_FACIL, "Network specific facilities" },
171 { Q933_IE_E2E_TRANSIT_DELAY, "End-to-end transit delay" },
172 { Q933_IE_TD_SELECTION_AND_INT, "Transit delay selection and indication" },
173 { Q933_IE_PL_BINARY_PARAMETERS, "Packet layer binary parameters" },
174 { Q933_IE_LL_CORE_PARAMETERS, "Link layer core parameters" },
175 { Q933_IE_LL_PROTOCOL_PARAMETERS, "Link layer protocol parameters" },
176 { Q933_IE_REVERSE_CHARGE_IND, "Reverse charging indication" },
177 { Q933_IE_CONNECTED_NUMBER, "Connected number" },
178 { Q933_IE_CONNECTED_SUBADDR, "Connected subaddress" },
179 { Q933_IE_X_213_PRIORITY, "X.213 priority" },
180 { Q933_IE_REPORT_TYPE, "Report type" },
181 { Q933_IE_LINK_INTEGRITY_VERF, "Link integrity verification" },
182 { Q933_IE_PVC_STATUS, "PVC status" },
183 { Q933_IE_CALLING_PARTY_NUMBER, "Calling party number" },
184 { Q933_IE_CALLING_PARTY_SUBADDR, "Calling party subaddress" },
185 { Q933_IE_CALLED_PARTY_NUMBER, "Called party number" },
186 { Q933_IE_CALLED_PARTY_SUBADDR, "Called party subaddress" },
187 { Q933_IE_TRANSIT_NETWORK_SEL, "Transit network selection" },
188 { Q933_IE_LOW_LAYER_COMPAT, "Low-layer compatibility" },
189 { Q933_IE_HIGH_LAYER_COMPAT, "High-layer compatibility" },
190 { Q933_IE_USER_USER, "User-user" },
191 { Q933_IE_ESCAPE, "Escape" },
195 static const value_string q933_info_element_vals1[] = {
199 static const value_string q933_info_element_vals2[] = {
203 static const value_string q933_info_element_vals3[] = {
207 static const value_string q933_info_element_vals4[] = {
211 static const value_string q933_info_element_vals5[] = {
215 static const value_string q933_info_element_vals6[] = {
219 static const value_string q933_info_element_vals7[] = {
224 static const value_string *q933_info_element_vals[] = {
225 q933_info_element_vals0,
226 q933_info_element_vals1,
227 q933_info_element_vals2,
228 q933_info_element_vals3,
229 q933_info_element_vals4,
230 q933_info_element_vals5,
231 q933_info_element_vals6,
232 q933_info_element_vals7,
235 static const value_string q933_repeat_indication_vals[] = {
236 { 0x2, "Prioritized list" },
241 * ITU-standardized coding.
243 #define Q933_ITU_STANDARDIZED_CODING 0x00
246 * Dissect a Segmented message information element.
249 dissect_q933_segmented_message_ie(tvbuff_t *tvb, int offset, int len,
253 proto_tree_add_text(tree, tvb, offset, len,
254 "Segmented message: length is %d, should be 2\n", len);
257 if (tvb_get_guint8(tvb, offset) & 0x80) {
258 proto_tree_add_text(tree, tvb, offset, 1,
259 "First segment: %u segments remaining",
260 tvb_get_guint8(tvb, offset) & 0x7F);
262 proto_tree_add_text(tree, tvb, offset, 1,
263 "Not first segment: %u segments remaining",
264 tvb_get_guint8(tvb, offset) & 0x7F);
266 proto_tree_add_text(tree, tvb, offset + 1, 1,
267 "Segmented message type: %u\n", tvb_get_guint8(tvb, offset + 1));
271 * Dissect a Bearer capability or Low-layer compatibility information element.
273 static const value_string q933_bc_coding_standard_vals[] = {
274 { 0x00, "ITU-T standardized coding" },
275 { 0x20, "ISO/IEC standard" },
276 { 0x40, "National standard" },
277 { 0x60, "Standard defined for this particular network" },
281 static const value_string q933_information_transfer_capability_vals[] = {
282 { 0x08, "Unrestricted digital information" },
286 static const value_string q933_transfer_mode_vals[] = {
287 { 0x20, "Frame mode" },
291 static const value_string q933_uil1_vals[] = {
292 { 0x01, "V.110/I.460/X.30 rate adaption" },
293 { 0x02, "Recommendation G.711 u-law" },
294 { 0x03, "Recommendation G.711 A-law" },
295 { 0x04, "Recommendation G.721 32 kbit/s ADPCM and Recommendation I.460" },
296 { 0x05, "Recommendation H.221 and H.242" },
297 { 0x06, "Recommendation H.223 and H.245" },
298 { 0x07, "Non-ITU-T-standardized rate adaption" },
299 { 0x08, "V.120 rate adaption" },
300 { 0x09, "X.31 HDLC flag stuffing" },
304 static const value_string q933_l1_user_rate_vals[] = {
305 { 0x00, "Rate indicated by E-bits" },
306 { 0x01, "0.6 kbit/s" },
307 { 0x02, "1.2 kbit/s" },
308 { 0x03, "2.4 kbit/s" },
309 { 0x04, "3.6 kbit/s" },
310 { 0x05, "4.8 kbit/s" },
311 { 0x06, "7.2 kbit/s" },
312 { 0x07, "8 kbit/s" },
313 { 0x08, "9.6 kbit/s" },
314 { 0x09, "14.4 kbit/s" },
315 { 0x0A, "16 kbit/s" },
316 { 0x0B, "19.2 kbit/s" },
317 { 0x0C, "32 kbit/s" },
318 { 0x0E, "48 kbit/s" },
319 { 0x0F, "56 kbit/s" },
320 { 0x10, "64 kbit/s "},
321 { 0x15, "0.1345 kbit/s" },
322 { 0x16, "0.100 kbit/s" },
323 { 0x17, "0.075/1.2 kbit/s" },
324 { 0x18, "1.2/0.075 kbit/s" },
325 { 0x19, "0.050 kbit/s" },
326 { 0x1A, "0.075 kbit/s" },
327 { 0x1B, "0.110 kbit/s" },
328 { 0x1C, "0.150 kbit/s" },
329 { 0x1D, "0.200 kbit/s" },
330 { 0x1E, "0.300 kbit/s" },
331 { 0x1F, "12 kbit/s" },
335 static const value_string q933_l1_stop_bits_vals[] = {
342 static const value_string q933_l1_data_bits_vals[] = {
349 static const value_string q933_l1_parity_vals[] = {
353 { 0x04, "Forced to 0" },
354 { 0x05, "Forced to 1" },
358 #define Q933_UIL2_USER_SPEC 0x10
360 static const value_string q933_uil2_vals[] = {
361 { 0x01, "Basic mode ISO 1745" },
362 { 0x06, "X.25, link level" },
363 { 0x07, "X.25 multilink" },
364 { 0x08, "T.71 Extended LAPB" },
365 { 0x09, "HDLC ARM" },
366 { 0x0A, "HDLC NRM" },
367 { 0x0B, "HDLC ABM" },
368 { 0x0C, "ISO 8802/2 LLC" },
369 { 0x0D, "X.75 Single Link Procedure" },
371 { 0x0F, "Core aspects of Q.922" },
372 { Q933_UIL2_USER_SPEC, "User-specified" },
373 { 0x11, "ISO 7776 DTE-DTE operation" },
377 static const value_string q933_address_inclusion_vals[] = {
378 { 0x01, "Address included" },
379 { 0x02, "Encapsulation of logical control frame" },
383 static const value_string q933_mode_vals[] = {
384 { 0x20, "Normal mode" },
385 { 0x40, "Extended mode" },
389 #define Q933_UIL3_X25_PL 0x06
390 #define Q933_UIL3_ISO_8208 0x07 /* X.25-based */
391 #define Q933_UIL3_X223 0x08 /* X.25-based */
392 #define Q933_UIL3_TR_9577 0x0B
393 #define Q933_UIL3_USER_SPEC 0x10
395 static const value_string q933_uil3_vals[] = {
396 { Q933_UIL3_X25_PL, "X.25, packet layer" },
397 { Q933_UIL3_ISO_8208, "ISO/IEC 8208" },
398 { Q933_UIL3_X223, "X.223/ISO 8878" },
399 { 0x09, "ISO/IEC 8473" },
401 { Q933_UIL3_TR_9577, "ISO/IEC TR 9577" },
402 { Q933_UIL3_USER_SPEC, "User-specified" },
407 dissect_q933_protocol_discriminator(tvbuff_t *tvb, int offset, proto_tree *tree)
409 unsigned int discriminator = tvb_get_guint8(tvb, offset);
411 if (discriminator == NLPID_Q_933) {
412 proto_tree_add_uint_format(tree, hf_q933_discriminator,
413 tvb, offset, 1, discriminator,
414 "Protocol discriminator: Q.933");
415 } else if (discriminator == NLPID_Q_2931) {
416 proto_tree_add_uint_format(tree, hf_q933_discriminator,
417 tvb, offset, 1, discriminator,
418 "Protocol discriminator: Q.2931");
419 } else if ((discriminator >= 16 && discriminator < 63)
420 || ((discriminator >= 80) && (discriminator < 254))) {
421 proto_tree_add_uint_format(tree, hf_q933_discriminator,
422 tvb, offset, 1, discriminator,
423 "Protocol discriminator: Network layer or layer 3 protocol (0x%02X)",
425 } else if (discriminator >= 64 && discriminator <= 79) {
426 proto_tree_add_uint_format(tree, hf_q933_discriminator,
427 tvb, offset, 1, discriminator,
428 "Protocol discriminator: National use (0x%02X)",
431 proto_tree_add_uint_format(tree, hf_q933_discriminator,
432 tvb, offset, 1, discriminator,
433 "Protocol discriminator: Reserved (0x%02X)",
439 dissect_q933_bearer_capability_ie(tvbuff_t *tvb, int offset, int len,
443 guint8 coding_standard;
445 guint8 uil2_protocol;
446 guint8 uil3_protocol;
451 octet = tvb_get_guint8(tvb, offset);
452 coding_standard = octet & 0x60;
453 proto_tree_add_text(tree, tvb, offset, 1,
454 "Coding standard: %s",
455 val_to_str(coding_standard, q933_bc_coding_standard_vals, NULL));
456 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
458 * We don't know how the bearer capability is encoded,
459 * so just dump it as data and be done with it.
461 proto_tree_add_text(tree, tvb, offset,
463 tvb_bytes_to_str(tvb, offset, len));
466 proto_tree_add_text(tree, tvb, offset, 1,
467 "Information transfer capability: %s",
468 val_to_str(octet & 0x1F, q933_information_transfer_capability_vals,
469 "Unknown (0x%02X)"));
474 * XXX - only in Low-layer compatibility information element.
476 if (!(octet & Q933_IE_VL_EXTENSION)) {
479 octet = tvb_get_guint8(tvb, offset);
480 proto_tree_add_text(tree, tvb, offset, 1,
481 "Out-band negotiation %spossible",
482 (octet & 0x40) ? "" : "not ");
489 octet = tvb_get_guint8(tvb, offset);
490 proto_tree_add_text(tree, tvb, offset, 1,
492 val_to_str(octet & 0x60, q933_transfer_mode_vals,
493 "Unknown (0x%02X)"));
499 octet = tvb_get_guint8(tvb, offset);
500 if ((octet & 0x60) == 0x20) {
502 * Layer 1 information.
504 proto_tree_add_text(tree, tvb, offset, 1,
505 "User information layer 1 protocol: %s",
506 val_to_str(octet & 0x1F, q933_uil1_vals,
507 "Unknown (0x%02X)"));
511 if (octet & Q933_IE_VL_EXTENSION)
515 octet = tvb_get_guint8(tvb, offset);
516 proto_tree_add_text(tree, tvb, offset, 1,
518 (octet & 0x40) ? "Asynchronous" : "Synchronous");
519 proto_tree_add_text(tree, tvb, offset, 1,
521 val_to_str(octet & 0x1F, q933_l1_user_rate_vals,
522 "Unknown (0x%02X)"));
526 if (octet & Q933_IE_VL_EXTENSION)
530 octet = tvb_get_guint8(tvb, offset);
531 proto_tree_add_text(tree, tvb, offset, 1,
532 "Rate adaption header %sincluded",
533 (octet & 0x40) ? "" : "not ");
534 proto_tree_add_text(tree, tvb, offset, 1,
535 "Multiple frame establishment %ssupported",
536 (octet & 0x20) ? "" : "not ");
537 proto_tree_add_text(tree, tvb, offset, 1,
538 "%s mode of operation",
539 (octet & 0x10) ? "Protocol sensitive" : "Bit transparent");
543 if (octet & Q933_IE_VL_EXTENSION)
547 octet = tvb_get_guint8(tvb, offset);
548 proto_tree_add_text(tree, tvb, offset, 1,
550 val_to_str(octet & 0x60, q933_l1_stop_bits_vals,
552 proto_tree_add_text(tree, tvb, offset, 1,
554 val_to_str(octet & 0x18, q933_l1_data_bits_vals,
556 proto_tree_add_text(tree, tvb, offset, 1,
558 val_to_str(octet & 0x07, q933_l1_parity_vals,
561 if (octet & Q933_IE_VL_EXTENSION)
565 octet = tvb_get_guint8(tvb, offset);
566 proto_tree_add_text(tree, tvb, offset, 1,
568 (octet & 0x40) ? "Full" : "Half");
569 modem_type = octet & 0x3F;
570 proto_tree_add_text(tree, tvb, offset, 1,
571 "Modem type: Network-specific rules 0x%02X", modem_type);
580 octet = tvb_get_guint8(tvb, offset);
581 if ((octet & 0x60) == 0x40) {
583 * Layer 2 information.
585 uil2_protocol = octet & 0x1F;
586 proto_tree_add_text(tree, tvb, offset, 1,
587 "User information layer 2 protocol: %s",
588 val_to_str(uil2_protocol, q933_uil2_vals,
589 "Unknown (0x%02X)"));
594 * XXX - only in Low-layer compatibility information element.
596 if (octet & Q933_IE_VL_EXTENSION)
600 octet = tvb_get_guint8(tvb, offset);
601 if (uil2_protocol == Q933_UIL2_USER_SPEC) {
602 proto_tree_add_text(tree, tvb, offset, 1,
603 "User-specified layer 2 protocol information: 0x%02X",
606 proto_tree_add_text(tree, tvb, offset, 1,
607 "Address inclusion: %s",
608 val_to_str(octet & 0x03, q933_address_inclusion_vals,
609 "Unknown (0x%02X)"));
619 octet = tvb_get_guint8(tvb, offset);
620 if ((octet & 0x60) == 0x60) {
622 * Layer 3 information.
624 uil3_protocol = octet & 0x1F;
625 proto_tree_add_text(tree, tvb, offset, 1,
626 "User information layer 3 protocol: %s",
627 val_to_str(uil3_protocol, q933_uil3_vals,
628 "Unknown (0x%02X)"));
634 * XXX - only in Low-layer compatibility information element.
636 if (octet & Q933_IE_VL_EXTENSION)
640 octet = tvb_get_guint8(tvb, offset);
641 switch (uil3_protocol) {
643 case Q933_UIL3_X25_PL:
644 case Q933_UIL3_ISO_8208:
646 proto_tree_add_text(tree, tvb, offset, 1,
648 val_to_str(octet & 0x60, q933_mode_vals,
649 "Unknown (0x%02X)"));
653 if (octet & Q933_IE_VL_EXTENSION)
657 octet = tvb_get_guint8(tvb, offset);
658 proto_tree_add_text(tree, tvb, offset, 1,
659 "Default packet size: %u", octet & 0x0F);
663 if (octet & Q933_IE_VL_EXTENSION)
667 octet = tvb_get_guint8(tvb, offset);
668 proto_tree_add_text(tree, tvb, offset, 1,
669 "Packet window size: %u", octet & 0x7F);
674 case Q933_UIL3_USER_SPEC:
675 proto_tree_add_text(tree, tvb, offset, 1,
676 "Default packet size: %u octets",
677 1 << (octet & 0x0F));
682 case Q933_UIL3_TR_9577:
683 add_l3_info = (octet & 0x0F) << 4;
684 if (octet & Q933_IE_VL_EXTENSION)
688 octet = tvb_get_guint8(tvb, offset + 1);
689 add_l3_info |= (octet & 0x0F);
690 proto_tree_add_text(tree, tvb, offset, 2,
691 "Additional layer 3 protocol information: %s",
692 val_to_str(add_l3_info, nlpid_vals,
693 "Unknown (0x%02X)"));
704 * Dissect a Cause information element.
706 static const value_string q933_cause_coding_standard_vals[] = {
707 { 0x00, "ITU-T standardized coding" },
708 { 0x20, "ISO/IEC standard" },
709 { 0x40, "National standard" },
710 { 0x60, "Standard specific to identified location" },
714 const value_string q933_cause_location_vals[] = {
715 { 0x00, "User (U)" },
716 { 0x01, "Private network serving the local user (LPN)" },
717 { 0x02, "Public network serving the local user (LN)" },
718 { 0x03, "Transit network (TN)" },
719 { 0x04, "Public network serving the remote user (RLN)" },
720 { 0x05, "Private network serving the remote user (RPN)" },
721 { 0x07, "International network (INTL)" },
722 { 0x0A, "Network beyond interworking point (BI)" },
726 static const value_string q933_cause_recommendation_vals[] = {
730 { 0x05, "Q.1031/Q.1051" },
735 * Cause codes for Cause.
737 #define Q933_CAUSE_UNALLOC_NUMBER 0x01
738 #define Q933_CAUSE_NO_ROUTE_TO_DEST 0x03
739 #define Q933_CAUSE_CALL_REJECTED 0x15
740 #define Q933_CAUSE_NUMBER_CHANGED 0x16
741 #define Q933_CAUSE_ACCESS_INFO_DISC 0x2B
742 #define Q933_CAUSE_QOS_UNAVAILABLE 0x31
743 #define Q933_CAUSE_CHAN_NONEXISTENT 0x52
744 #define Q933_CAUSE_INCOMPATIBLE_DEST 0x58
745 #define Q933_CAUSE_MAND_IE_MISSING 0x60
746 #define Q933_CAUSE_MT_NONEX_OR_UNIMPL 0x61
747 #define Q933_CAUSE_IE_NONEX_OR_UNIMPL 0x63
748 #define Q933_CAUSE_INVALID_IE_CONTENTS 0x64
749 #define Q933_CAUSE_MSG_INCOMPAT_W_CS 0x65
750 #define Q933_CAUSE_REC_TIMER_EXP 0x66
752 const value_string q933_cause_code_vals[] = {
753 { 0x00, "Valid cause code not yet received" },
754 { Q933_CAUSE_UNALLOC_NUMBER, "Unallocated (unassigned) number" },
755 { 0x02, "No route to specified transit network" },
756 { Q933_CAUSE_NO_ROUTE_TO_DEST, "No route to destination" },
757 { 0x04, "Send special information tone" },
758 { 0x05, "Misdialled trunk prefix" },
759 { 0x06, "Channel unacceptable" },
760 { 0x07, "Call awarded and being delivered in an established channel" },
761 { 0x08, "Prefix 0 dialed but not allowed" },
762 /* Q.850 - "Preemption" */
763 { 0x09, "Prefix 1 dialed but not allowed" },
764 /* Q.850 - "Preemption - circuit reserved for reuse" */
765 { 0x0A, "Prefix 1 dialed but not required" },
766 { 0x0B, "More digits received than allowed, call is proceeding" },
767 { 0x0E, "QoR: ported number" },
768 { 0x10, "Normal call clearing" },
769 { 0x11, "User busy" },
770 { 0x12, "No user responding" },
771 { 0x13, "No answer from user (user alerted)" },
772 { 0x14, "Subscriber absent" },
773 { Q933_CAUSE_CALL_REJECTED, "Call rejected" },
774 { Q933_CAUSE_NUMBER_CHANGED, "Number changed" },
775 { 0x17, "Reverse charging rejected" },
776 /* Q.850 - "Redirection to new destination" */
777 { 0x18, "Call suspended" },
778 /* Q.850 Amendment 1 - "Call rejected due to feature at the destination" */
779 { 0x19, "Call resumed" },
780 /* Q.850 - "Exchange routing error */
781 { 0x1A, "Non-selected user clearing" },
782 { 0x1B, "Destination out of order" },
783 { 0x1C, "Invalid number format (incomplete number)" },
784 { 0x1D, "Facility rejected" },
785 { 0x1E, "Response to STATUS ENQUIRY" },
786 { 0x1F, "Normal unspecified" },
787 { 0x21, "Circuit out of order" },
788 { 0x22, "No circuit/channel available" },
789 { 0x23, "Destination unattainable" },
790 { 0x25, "Degraded service" },
791 { 0x26, "Network out of order" },
792 { 0x27, "Transit delay range cannot be achieved" },
793 /* Q.850 - "Permanent frame mode connection out of service" */
794 { 0x28, "Throughput range cannot be achieved" },
795 /* Q.850 - "Permanent frame mode connection operational" */
796 { 0x29, "Temporary failure" },
797 { 0x2A, "Switching equipment congestion" },
798 { Q933_CAUSE_ACCESS_INFO_DISC, "Access information discarded" },
799 { 0x2C, "Requested circuit/channel not available" },
800 { 0x2D, "Pre-empted" },
801 { 0x2E, "Precedence call blocked" },
802 { 0x2F, "Resources unavailable, unspecified" },
803 { Q933_CAUSE_QOS_UNAVAILABLE, "Quality of service unavailable" },
804 { 0x32, "Requested facility not subscribed" },
805 { 0x33, "Reverse charging not allowed" },
806 { 0x34, "Outgoing calls barred" },
807 { 0x35, "Outgoing calls barred within CUG" },
808 { 0x36, "Incoming calls barred" },
809 { 0x37, "Incoming calls barred within CUG" },
810 { 0x38, "Call waiting not subscribed" },
811 { 0x39, "Bearer capability not authorized" },
812 { 0x3A, "Bearer capability not presently available" },
813 { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
814 { 0x3F, "Service or option not available, unspecified" },
815 { 0x41, "Bearer capability not implemented" },
816 { 0x42, "Channel type not implemented" },
817 { 0x43, "Transit network selection not implemented" },
818 { 0x44, "Message not implemented" },
819 { 0x45, "Requested facility not implemented" },
820 { 0x46, "Only restricted digital information bearer capability is available" },
821 { 0x4F, "Service or option not implemented, unspecified" },
822 { 0x51, "Invalid call reference value" },
823 { Q933_CAUSE_CHAN_NONEXISTENT, "Identified channel does not exist" },
824 { 0x53, "Call identity does not exist for suspended call" },
825 { 0x54, "Call identity in use" },
826 { 0x55, "No call suspended" },
827 { 0x56, "Call having the requested call identity has been cleared" },
828 { 0x57, "Called user not member of CUG" },
829 { Q933_CAUSE_INCOMPATIBLE_DEST, "Incompatible destination" },
830 { 0x59, "Non-existent abbreviated address entry" },
831 { 0x5A, "Destination address missing, and direct call not subscribed" },
832 /* Q.850 - "Non-existent CUG" */
833 { 0x5B, "Invalid transit network selection (national use)" },
834 { 0x5C, "Invalid facility parameter" },
835 { 0x5D, "Mandatory information element is missing" },
836 { 0x5F, "Invalid message, unspecified" },
837 { Q933_CAUSE_MAND_IE_MISSING, "Mandatory information element is missing" },
838 { Q933_CAUSE_MT_NONEX_OR_UNIMPL,"Message type non-existent or not implemented" },
839 { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
840 { Q933_CAUSE_IE_NONEX_OR_UNIMPL,"Information element nonexistant or not implemented" },
841 { Q933_CAUSE_INVALID_IE_CONTENTS,"Invalid information element contents" },
842 { Q933_CAUSE_MSG_INCOMPAT_W_CS, "Message not compatible with call state" },
843 { Q933_CAUSE_REC_TIMER_EXP, "Recovery on timer expiry" },
844 { 0x67, "Parameter non-existent or not implemented - passed on" },
845 { 0x6E, "Message with unrecognized parameter discarded" },
846 { 0x6F, "Protocol error, unspecified" },
847 { 0x7F, "Internetworking, unspecified" },
851 static const value_string q933_cause_condition_vals[] = {
853 { 0x01, "Permanent" },
854 { 0x02, "Transient" },
858 #define Q933_REJ_USER_SPECIFIC 0x00
859 #define Q933_REJ_IE_MISSING 0x04
860 #define Q933_REJ_IE_INSUFFICIENT 0x08
862 static const value_string q933_rejection_reason_vals[] = {
863 { 0x00, "User specific" },
864 { 0x04, "Information element missing" },
865 { 0x08, "Information element contents are not sufficient" },
870 dissect_q933_cause_ie(tvbuff_t *tvb, int offset, int len,
871 proto_tree *tree, int hf_cause_value)
875 guint8 coding_standard;
876 guint8 rejection_reason;
880 octet = tvb_get_guint8(tvb, offset);
881 coding_standard = octet & 0x60;
882 proto_tree_add_text(tree, tvb, offset, 1,
883 "Coding standard: %s",
884 val_to_str(coding_standard, q933_cause_coding_standard_vals, NULL));
885 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
887 * We don't know how the cause is encoded,
888 * so just dump it as data and be done with it.
890 proto_tree_add_text(tree, tvb, offset,
892 tvb_bytes_to_str(tvb, offset, len));
895 proto_tree_add_text(tree, tvb, offset, 1,
897 val_to_str(octet & 0x0F, q933_cause_location_vals,
902 if (!(octet & Q933_IE_VL_EXTENSION)) {
905 octet = tvb_get_guint8(tvb, offset);
906 proto_tree_add_text(tree, tvb, offset, 1,
907 "Recommendation: %s",
908 val_to_str(octet & 0x7F, q933_cause_recommendation_vals,
909 "Unknown (0x%02X)"));
916 octet = tvb_get_guint8(tvb, offset);
917 cause_value = octet & 0x7F;
918 proto_tree_add_uint(tree, hf_cause_value, tvb, 0, 1, cause_value);
924 switch (cause_value) {
926 case Q933_CAUSE_UNALLOC_NUMBER:
927 case Q933_CAUSE_NO_ROUTE_TO_DEST:
928 case Q933_CAUSE_QOS_UNAVAILABLE:
929 octet = tvb_get_guint8(tvb, offset);
930 proto_tree_add_text(tree, tvb, offset, 1,
931 "Network service: %s",
932 (octet & 0x80) ? "User" : "Provider");
933 proto_tree_add_text(tree, tvb, offset, 1,
935 (octet & 0x40) ? "Abnormal" : "Normal");
936 proto_tree_add_text(tree, tvb, offset, 1,
938 val_to_str(octet & 0x03, q933_cause_condition_vals,
942 case Q933_CAUSE_CALL_REJECTED:
943 rejection_reason = octet & 0x7C;
944 proto_tree_add_text(tree, tvb, offset, 1,
945 "Rejection reason: %s",
946 val_to_str(octet & 0x7C, q933_rejection_reason_vals,
948 proto_tree_add_text(tree, tvb, offset, 1,
950 val_to_str(octet & 0x03, q933_cause_condition_vals,
957 switch (rejection_reason) {
959 case Q933_REJ_USER_SPECIFIC:
960 proto_tree_add_text(tree, tvb, offset, len,
961 "User specific diagnostic: %s",
962 tvb_bytes_to_str(tvb, offset, len));
965 case Q933_REJ_IE_MISSING:
966 proto_tree_add_text(tree, tvb, offset, 1,
967 "Missing information element: %s",
968 val_to_str(tvb_get_guint8(tvb, offset), q933_info_element_vals0,
969 "Unknown (0x%02X)"));
972 case Q933_REJ_IE_INSUFFICIENT:
973 proto_tree_add_text(tree, tvb, offset, 1,
974 "Insufficient information element: %s",
975 val_to_str(tvb_get_guint8(tvb, offset), q933_info_element_vals0,
976 "Unknown (0x%02X)"));
980 proto_tree_add_text(tree, tvb, offset, len,
982 tvb_bytes_to_str(tvb, offset, len));
987 case Q933_CAUSE_ACCESS_INFO_DISC:
988 case Q933_CAUSE_INCOMPATIBLE_DEST:
989 case Q933_CAUSE_MAND_IE_MISSING:
990 case Q933_CAUSE_IE_NONEX_OR_UNIMPL:
991 case Q933_CAUSE_INVALID_IE_CONTENTS:
993 proto_tree_add_text(tree, tvb, offset, 1,
994 "Information element: %s",
995 val_to_str(tvb_get_guint8(tvb, offset), q933_info_element_vals0,
996 "Unknown (0x%02X)"));
1002 case Q933_CAUSE_MT_NONEX_OR_UNIMPL:
1003 case Q933_CAUSE_MSG_INCOMPAT_W_CS:
1004 proto_tree_add_text(tree, tvb, offset, 1,
1006 val_to_str(tvb_get_guint8(tvb, offset), q933_message_type_vals,
1007 "Unknown (0x%02X)"));
1010 case Q933_CAUSE_REC_TIMER_EXP:
1013 proto_tree_add_text(tree, tvb, offset, 3,
1014 "Timer: %.3s", tvb_get_ptr(tvb, offset, 3));
1018 proto_tree_add_text(tree, tvb, offset, len,
1020 tvb_bytes_to_str(tvb, offset, len));
1025 * Dissect a Call state information element.
1027 static const value_string q933_coding_standard_vals[] = {
1028 { 0x00, "ITU-T standardized coding" },
1029 { 0x20, "ISO/IEC standard" },
1030 { 0x40, "National standard" },
1031 { 0x60, "Standard defined for the network" },
1035 static const value_string q933_call_state_vals[] = {
1037 { 0x01, "Call initiated" },
1038 { 0x02, "Overlap sending" },
1039 { 0x03, "Outgoing call proceeding" },
1040 { 0x04, "Call delivered" },
1041 { 0x06, "Call present" },
1042 { 0x07, "Call received" },
1043 { 0x08, "Connect request" },
1044 { 0x09, "Incoming call proceeding" },
1046 { 0x0B, "Disconnect request" },
1047 { 0x0C, "Disconnect indication" },
1048 { 0x0F, "Suspend request" },
1049 { 0x12, "Resume request" },
1050 { 0x13, "Release request" },
1051 { 0x16, "Call abort"},
1052 { 0x19, "Overlap receiving" },
1053 { 0x3D, "Restart request" },
1054 { 0x3E, "Restart" },
1059 dissect_q933_call_state_ie(tvbuff_t *tvb, int offset, int len,
1063 guint8 coding_standard;
1067 octet = tvb_get_guint8(tvb, offset);
1068 coding_standard = octet & 0x60;
1069 proto_tree_add_text(tree, tvb, offset, 1,
1070 "Coding standard: %s",
1071 val_to_str(coding_standard, q933_coding_standard_vals, NULL));
1072 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
1074 * We don't know how the call state is encoded,
1075 * so just dump it as data and be done with it.
1077 proto_tree_add_text(tree, tvb, offset,
1079 tvb_bytes_to_str(tvb, offset, len));
1082 proto_tree_add_text(tree, tvb, offset, 1,
1084 val_to_str(octet & 0x3F, q933_call_state_vals,
1085 "Unknown (0x%02X)"));
1089 * Dissect a Channel identification information element.
1091 #define Q933_INTERFACE_IDENTIFIED 0x40
1092 #define Q933_NOT_BASIC_CHANNEL 0x20
1094 static const value_string q933_basic_channel_selection_vals[] = {
1095 { 0x00, "No channel" },
1096 { 0x01, "B1 channel" },
1097 { 0x02, "B2 channel" },
1098 { 0x03, "Any channel" },
1102 static const value_string q933_not_basic_channel_selection_vals[] = {
1103 { 0x00, "No channel" },
1104 { 0x01, "Channel indicated in following octets" },
1105 { 0x03, "Any channel" },
1109 #define Q933_IS_SLOT_MAP 0x10
1111 static const value_string q933_element_type_vals[] = {
1112 { 0x03, "B-channel units" },
1113 { 0x06, "H0-channel units" },
1114 { 0x08, "H11-channel units" },
1115 { 0x09, "H12-channel units" },
1120 dissect_q933_channel_identification_ie(tvbuff_t *tvb, int offset, int len,
1124 int identifier_offset;
1126 guint8 coding_standard;
1130 octet = tvb_get_guint8(tvb, offset);
1131 proto_tree_add_text(tree, tvb, offset, 1,
1132 "Interface %s identified",
1133 (octet & Q933_INTERFACE_IDENTIFIED) ? "explicitly" : "implicitly");
1134 proto_tree_add_text(tree, tvb, offset, 1,
1136 (octet & Q933_NOT_BASIC_CHANNEL) ? "Not basic" : "Basic");
1137 proto_tree_add_text(tree, tvb, offset, 1,
1138 "Indicated channel is %s",
1139 (octet & 0x08) ? "required" : "preferred");
1140 proto_tree_add_text(tree, tvb, offset, 1,
1141 "Indicated channel is %sthe D-channel",
1142 (octet & 0x04) ? "" : "not ");
1143 if (octet & Q933_NOT_BASIC_CHANNEL) {
1144 proto_tree_add_text(tree, tvb, offset, 1,
1145 "Channel selection: %s",
1146 val_to_str(octet & 0x03, q933_not_basic_channel_selection_vals,
1149 proto_tree_add_text(tree, tvb, offset, 1,
1150 "Channel selection: %s",
1151 val_to_str(octet & 0x03, q933_basic_channel_selection_vals,
1157 if (octet & Q933_INTERFACE_IDENTIFIED) {
1158 identifier_offset = offset;
1163 octet = tvb_get_guint8(tvb, offset);
1167 } while (!(octet & Q933_IE_VL_EXTENSION));
1170 * XXX - do we want to strip off the 8th bit on the
1171 * last octet of the interface identifier?
1173 if (identifier_len != 0) {
1174 proto_tree_add_text(tree, tvb, identifier_offset,
1175 identifier_len, "Interface identifier: %s",
1177 tvb_get_ptr(tvb, identifier_offset, identifier_len),
1182 if (octet & Q933_NOT_BASIC_CHANNEL) {
1185 octet = tvb_get_guint8(tvb, offset);
1186 coding_standard = octet & 0x60;
1187 proto_tree_add_text(tree, tvb, offset, 1,
1188 "Coding standard: %s",
1189 val_to_str(coding_standard, q933_coding_standard_vals,
1191 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
1193 * We don't know how the channel identifier is
1194 * encoded, so just dump it as data and be done
1197 proto_tree_add_text(tree, tvb, offset,
1199 tvb_bytes_to_str(tvb, offset, len));
1202 proto_tree_add_text(tree, tvb, offset, 1,
1203 "Channel is indicated by %s",
1204 (octet & Q933_IS_SLOT_MAP) ? "slot map" : "number");
1205 proto_tree_add_text(tree, tvb, offset, 1,
1207 (octet & Q933_IS_SLOT_MAP) ? "Map element" : "Channel",
1208 val_to_str(octet & 0x0F, q933_element_type_vals,
1209 "Unknown (0x%02X)"));
1212 * XXX - dump the channel number or slot map.
1218 * Dissect a Progress indicator information element.
1220 static const value_string q933_progress_description_vals[] = {
1221 { 0x01, "Call is not end-to-end ISDN - progress information available in-band" },
1222 { 0x02, "Destination address is non-ISDN" },
1223 { 0x03, "Origination address is non-ISDN" },
1224 { 0x04, "Call has returned to the ISDN" },
1225 { 0x05, "Interworking has occurred and has resulted in a telecommunications service change" },
1226 { 0x08, "In-band information or an appropriate pattern is now available" },
1231 dissect_q933_progress_indicator_ie(tvbuff_t *tvb, int offset, int len,
1235 guint8 coding_standard;
1239 octet = tvb_get_guint8(tvb, offset);
1240 coding_standard = octet & 0x60;
1241 proto_tree_add_text(tree, tvb, offset, 1,
1242 "Coding standard: %s",
1243 val_to_str(coding_standard, q933_cause_coding_standard_vals, NULL));
1244 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
1246 * We don't know how the progress indicator is encoded,
1247 * so just dump it as data and be done with it.
1249 proto_tree_add_text(tree, tvb, offset,
1251 tvb_bytes_to_str(tvb, offset, len));
1254 proto_tree_add_text(tree, tvb, offset, 1,
1256 val_to_str(octet & 0x0F, q933_cause_location_vals,
1263 octet = tvb_get_guint8(tvb, offset);
1264 proto_tree_add_text(tree, tvb, offset, 1,
1265 "Progress description: %s",
1266 val_to_str(octet & 0x7F, q933_progress_description_vals,
1267 "Unknown (0x%02X)"));
1271 * Dissect a Network-specific facilities or Transit network selection
1272 * information element.
1274 static const value_string q933_netid_type_vals[] = {
1275 { 0x00, "User specified" },
1276 { 0x20, "National network identification" },
1277 { 0x30, "International network identification" },
1281 static const value_string q933_netid_plan_vals[] = {
1282 { 0x00, "Unknown" },
1283 { 0x01, "Carrier Identification Code" },
1284 { 0x03, "X.121 data network identification code" },
1289 dissect_q933_ns_facilities_ie(tvbuff_t *tvb, int offset, int len,
1297 octet = tvb_get_guint8(tvb, offset);
1298 netid_len = octet & 0x7F;
1299 proto_tree_add_text(tree, tvb, offset, 1,
1300 "Network identification length: %u",
1304 if (netid_len != 0) {
1307 octet = tvb_get_guint8(tvb, offset);
1308 proto_tree_add_text(tree, tvb, offset, 1,
1309 "Type of network identification: %s",
1310 val_to_str(octet & 0x70, q933_netid_type_vals,
1311 "Unknown (0x%02X)"));
1312 proto_tree_add_text(tree, tvb, offset, 1,
1313 "Network identification plan: %s",
1314 val_to_str(octet & 0x0F, q933_netid_plan_vals,
1315 "Unknown (0x%02X)"));
1322 if (netid_len > len)
1324 if (netid_len != 0) {
1325 proto_tree_add_text(tree, tvb, offset, netid_len,
1326 "Network identification: %s",
1327 tvb_format_text(tvb, offset, netid_len));
1328 offset += netid_len;
1334 * Whatever is left is the network-specific facility
1339 proto_tree_add_text(tree, tvb, offset,
1340 len, "Network-specific facility specification: %s",
1341 tvb_bytes_to_str(tvb, offset, len));
1345 dissect_q933_guint16_value(tvbuff_t *tvb, int offset, int len,
1346 proto_tree *tree, char *label)
1354 octet = tvb_get_guint8(tvb, offset);
1355 if (octet & Q933_IE_VL_EXTENSION) {
1357 * Only one octet long - error.
1361 value = (octet & 0x3) << 14;
1368 * We've reached the end of the information element - error.
1372 octet = tvb_get_guint8(tvb, offset);
1373 if (octet & Q933_IE_VL_EXTENSION) {
1375 * Only two octets long - error.
1379 value |= (octet & 0x7F) << 7;
1386 * We've reached the end of the information element - error.
1390 octet = tvb_get_guint8(tvb, offset);
1391 if (!(octet & Q933_IE_VL_EXTENSION)) {
1393 * More than three octets long - error.
1397 value |= (octet & 0x7F);
1402 proto_tree_add_text(tree, tvb, offset, value_len, "%s: %u ms", label,
1407 proto_tree_add_text(tree, tvb, offset, len,
1408 "%s goes past end of information element", label);
1412 proto_tree_add_text(tree, tvb, offset, len, "%s isn't 3 octets long",
1418 * Dissect an End-to-end transit delay information element.
1421 dissect_q933_e2e_transit_delay_ie(tvbuff_t *tvb, int offset, int len,
1428 value_len = dissect_q933_guint16_value(tvb, offset, len, tree,
1429 "Cumulative transit delay");
1432 offset += value_len;
1437 value_len = dissect_q933_guint16_value(tvb, offset, len, tree,
1438 "Requested end-to-end transit delay");
1441 offset += value_len;
1446 value_len = dissect_q933_guint16_value(tvb, offset, len, tree,
1447 "Maximum end-to-end transit delay");
1451 * Dissect a Transit delay selection and indication information element.
1454 dissect_q933_td_selection_and_int_ie(tvbuff_t *tvb, int offset, int len,
1459 dissect_q933_guint16_value(tvb, offset, len, tree,
1464 dissect_q933_pl_binary_parameters_ie(tvbuff_t *tvb, int offset, int len,
1471 octet = tvb_get_guint8(tvb, offset);
1472 proto_tree_add_text(tree, tvb, offset, 1,
1474 (octet & 0x04) ? "No request/request denied" :
1475 "Request indicated/request accepted");
1476 proto_tree_add_text(tree, tvb, offset, 1,
1478 (octet & 0x02) ? "Link-by-link" : "End-to-end");
1482 * Dissect a Reverse charging indication information element.
1484 static const value_string q933_reverse_charging_indication_vals[] = {
1485 { 0x01, "Reverse charging requested" },
1490 dissect_q933_reverse_charge_ind_ie(tvbuff_t *tvb, int offset, int len,
1495 proto_tree_add_text(tree, tvb, offset, 1,
1496 "Reverse charging indication: %s",
1497 val_to_str(tvb_get_guint8(tvb, offset) & 0x07,
1498 q933_reverse_charging_indication_vals, "Unknown (0x%02X)"));
1502 * Dissect a (phone) number information element.
1504 static const value_string q933_number_type_vals[] = {
1505 { 0x00, "Unknown" },
1506 { 0x10, "International number" },
1507 { 0x20, "National number" },
1508 { 0x30, "Network specific number" },
1509 { 0x40, "Subscriber number" },
1510 { 0x60, "Abbreviated number" },
1514 static const value_string q933_numbering_plan_vals[] = {
1515 { 0x00, "Unknown" },
1516 { 0x01, "E.164 ISDN/telephony numbering" },
1517 { 0x03, "X.121 data numbering" },
1518 { 0x04, "F.69 Telex numbering" },
1519 { 0x08, "National standard numbering" },
1520 { 0x09, "Private numbering" },
1524 static const value_string q933_presentation_indicator_vals[] = {
1525 { 0x00, "Presentation allowed" },
1526 { 0x20, "Presentation restricted" },
1527 { 0x40, "Number not available due to interworking" },
1531 static const value_string q933_screening_indicator_vals[] = {
1532 { 0x00, "User-provided, not screened" },
1533 { 0x01, "User-provided, verified and passed" },
1534 { 0x02, "User-provided, verified and failed" },
1535 { 0x03, "Network-provided" },
1539 static const value_string q933_redirection_reason_vals[] = {
1540 { 0x00, "Unknown" },
1541 { 0x01, "Call forwarding busy or called DTE busy" },
1542 { 0x02, "Call forwarding no reply" },
1543 { 0x04, "Call deflection" },
1544 { 0x09, "Called DTE out of order" },
1545 { 0x0A, "Call forwarding by the called DTE" },
1546 { 0x0F, "Call forwarding unconditional or systematic call redirection" },
1551 dissect_q933_number_ie(tvbuff_t *tvb, int offset, int len,
1552 proto_tree *tree, int hfindex)
1558 octet = tvb_get_guint8(tvb, offset);
1559 proto_tree_add_text(tree, tvb, offset, 1,
1560 "Type of number: %s",
1561 val_to_str(octet & 0x70, q933_number_type_vals,
1562 "Unknown (0x%02X)"));
1563 proto_tree_add_text(tree, tvb, offset, 1,
1564 "Numbering plan: %s",
1565 val_to_str(octet & 0x0F, q933_numbering_plan_vals,
1566 "Unknown (0x%02X)"));
1570 if (!(octet & Q933_IE_VL_EXTENSION)) {
1573 octet = tvb_get_guint8(tvb, offset);
1574 proto_tree_add_text(tree, tvb, offset, 1,
1575 "Presentation indicator: %s",
1576 val_to_str(octet & 0x60, q933_presentation_indicator_vals,
1578 proto_tree_add_text(tree, tvb, offset, 1,
1579 "Screening indicator: %s",
1580 val_to_str(octet & 0x03, q933_screening_indicator_vals,
1587 * XXX - only in a Redirecting number information element.
1589 if (!(octet & Q933_IE_VL_EXTENSION)) {
1592 octet = tvb_get_guint8(tvb, offset);
1593 proto_tree_add_text(tree, tvb, offset, 1,
1594 "Reason for redirection: %s",
1595 val_to_str(octet & 0x0F, q933_redirection_reason_vals,
1603 proto_tree_add_item(tree, hfindex, tvb, offset, len, FALSE);
1607 * Dissect a party subaddress information element.
1609 static const value_string q933_subaddress_type_vals[] = {
1610 { 0x00, "X.213/ISO 8348 Add.2 NSAP" },
1611 { 0x20, "User-specified" },
1615 static const value_string q933_odd_even_indicator_vals[] = {
1616 { 0x00, "Even number of address signals" },
1617 { 0x10, "Odd number of address signals" },
1622 dissect_q933_party_subaddr_ie(tvbuff_t *tvb, int offset, int len,
1629 octet = tvb_get_guint8(tvb, offset);
1630 proto_tree_add_text(tree, tvb, offset, 1,
1631 "Type of subaddress: %s",
1632 val_to_str(octet & 0x70, q933_subaddress_type_vals,
1633 "Unknown (0x%02X)"));
1634 proto_tree_add_text(tree, tvb, offset, 1,
1635 "Odd/even indicator: %s",
1636 val_to_str(octet & 0x10, q933_odd_even_indicator_vals,
1643 proto_tree_add_text(tree, tvb, offset, len, "Subaddress: %s",
1644 tvb_bytes_to_str(tvb, offset, len));
1648 * Dissect a High-layer compatibility information element.
1650 #define Q933_AUDIOVISUAL 0x60
1651 static const value_string q933_high_layer_characteristics_vals[] = {
1652 { 0x01, "Telephony" },
1653 { 0x04, "F.182 Facsimile Group 2/3" },
1654 { 0x21, "F.184 Facsimile Group 4 Class I" },
1655 { 0x24, "F.230 Teletex, basic and mixed mode, and F.184 Facsimile Group 4, Classes II and III" },
1656 { 0x28, "F.220 Teletex, basic and processable mode" },
1657 { 0x31, "F.200 Teletex, basic mode" },
1658 { 0x32, "F.300 and T.102 syntax-based Videotex" },
1659 { 0x33, "F.300 and T.101 international Videotex interworking" },
1660 { 0x35, "F.60 Telex" },
1661 { 0x38, "X.400 Message Handling Systems" },
1662 { 0x41, "X.200 OSI application" },
1663 { 0x42, "FTAM application" },
1664 { 0x5E, "Reserved for maintenance" },
1665 { 0x5F, "Reserved for management" },
1666 { Q933_AUDIOVISUAL, "F.720/F.821 and F.731 Profile 1a videotelephony" },
1667 { 0x61, "F.702 and F.731 Profile 1b videoconferencing" },
1668 { 0x62, "F.702 and F.731 audiographic conferencing" },
1672 static const value_string q933_audiovisual_characteristics_vals[] = {
1673 { 0x01, "Capability set of initial channel of H.221" },
1674 { 0x02, "Capability set of subsequent channel of H.221" },
1675 { 0x21, "Capability set of initial channel of an active 3.1kHz audio or speech call" },
1680 dissect_q933_high_layer_compat_ie(tvbuff_t *tvb, int offset, int len,
1684 guint8 coding_standard;
1685 guint8 characteristics;
1689 octet = tvb_get_guint8(tvb, offset);
1690 coding_standard = octet & 0x60;
1691 proto_tree_add_text(tree, tvb, offset, 1,
1692 "Coding standard: %s",
1693 val_to_str(coding_standard, q933_coding_standard_vals, NULL));
1696 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
1698 * We don't know how the call state is encoded,
1699 * so just dump it as data and be done with it.
1701 proto_tree_add_text(tree, tvb, offset,
1703 tvb_bytes_to_str(tvb, offset, len));
1709 octet = tvb_get_guint8(tvb, offset);
1710 characteristics = octet & 0x7F;
1711 proto_tree_add_text(tree, tvb, offset, 1,
1712 "High layer characteristics identification: %s",
1713 val_to_str(characteristics, q933_high_layer_characteristics_vals,
1714 "Unknown (0x%02X)"));
1718 if (!(octet & Q933_IE_VL_EXTENSION)) {
1721 octet = tvb_get_guint8(tvb, offset);
1722 if (characteristics == Q933_AUDIOVISUAL) {
1723 proto_tree_add_text(tree, tvb, offset, 1,
1724 "Extended audiovisual characteristics identification: %s",
1725 val_to_str(octet & 0x7F,
1726 q933_audiovisual_characteristics_vals,
1727 "Unknown (0x%02X)"));
1729 proto_tree_add_text(tree, tvb, offset, 1,
1730 "Extended high layer characteristics identification: %s",
1731 val_to_str(octet & 0x7F,
1732 q933_high_layer_characteristics_vals,
1733 "Unknown (0x%02X)"));
1740 * Dissect a User-user information element.
1742 #define Q933_PROTOCOL_DISCRIMINATOR_IA5 0x04
1743 #define Q933_PROTOCOL_DISCRIMINATOR_ASN1 0x05
1745 static const value_string q933_protocol_discriminator_vals[] = {
1746 { 0x00, "User-specific protocol" },
1747 { 0x01, "OSI high layer protocols" },
1749 { Q933_PROTOCOL_DISCRIMINATOR_IA5, "IA5 characters" },
1750 { Q933_PROTOCOL_DISCRIMINATOR_ASN1, "X.208 and X.209 coded user information" },
1751 { 0x07, "V.120 rate adaption" },
1752 { 0x08, "Q.933/I.451 user-network call control messages" },
1757 dissect_q933_user_user_ie(tvbuff_t *tvb, int offset, int len,
1764 octet = tvb_get_guint8(tvb, offset);
1765 proto_tree_add_text(tree, tvb, offset, 1,
1766 "Protocol discriminator: %s",
1767 val_to_str(octet, q933_protocol_discriminator_vals,
1768 "Unknown (0x%02x)"));
1776 case Q933_PROTOCOL_DISCRIMINATOR_IA5:
1777 proto_tree_add_text(tree, tvb, offset, len, "User information: %s",
1778 tvb_format_text(tvb, offset, len));
1782 proto_tree_add_text(tree, tvb, offset, len, "User information: %s",
1783 tvb_bytes_to_str(tvb, offset, len));
1789 * Dissect information elements consisting of ASCII^H^H^H^H^HIA5 text.
1792 dissect_q933_ia5_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree,
1796 proto_tree_add_text(tree, tvb, offset, len, "%s: %s", label,
1797 tvb_format_text(tvb, offset, len));
1801 static const value_string q933_codeset_vals[] = {
1802 { 0x00, "Q.933 information elements" },
1803 { 0x04, "Information elements for ISO/IEC use" },
1804 { 0x05, "Information elements for national use" },
1805 { 0x06, "Information elements specific to the local network" },
1806 { 0x07, "User-specific information elements" },
1811 dissect_q933(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1814 proto_tree *q933_tree = NULL;
1816 proto_tree *ie_tree = NULL;
1817 guint8 call_ref_len;
1818 guint8 call_ref[15];
1819 guint8 message_type;
1820 guint8 info_element;
1821 guint16 info_element_len;
1822 int codeset, locked_codeset;
1823 gboolean non_locking_shift;
1825 if (check_col(pinfo->cinfo, COL_PROTOCOL))
1826 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Q.933");
1829 ti = proto_tree_add_item(tree, proto_q933, tvb, offset, -1,
1831 q933_tree = proto_item_add_subtree(ti, ett_q933);
1833 dissect_q933_protocol_discriminator(tvb, offset, q933_tree);
1836 call_ref_len = tvb_get_guint8(tvb, offset) & 0xF; /* XXX - do as a bit field? */
1837 if (q933_tree != NULL)
1838 proto_tree_add_uint(q933_tree, hf_q933_call_ref_len, tvb, offset, 1, call_ref_len);
1840 if (call_ref_len != 0) {
1841 tvb_memcpy(tvb, call_ref, offset, call_ref_len);
1842 if (q933_tree != NULL) {
1843 proto_tree_add_boolean(q933_tree, hf_q933_call_ref_flag,
1844 tvb, offset, 1, (call_ref[0] & 0x80) != 0);
1845 call_ref[0] &= 0x7F;
1846 proto_tree_add_bytes(q933_tree, hf_q933_call_ref,
1847 tvb, offset, call_ref_len, call_ref);
1849 offset += call_ref_len;
1851 message_type = tvb_get_guint8(tvb, offset);
1852 if (check_col(pinfo->cinfo, COL_INFO)) {
1853 col_add_str(pinfo->cinfo, COL_INFO,
1854 val_to_str(message_type, q933_message_type_vals,
1855 "Unknown message type (0x%02X)"));
1857 if (q933_tree != NULL)
1858 proto_tree_add_uint(q933_tree, hf_q933_message_type, tvb, offset, 1, message_type);
1862 * And now for the information elements....
1864 codeset = locked_codeset = 0; /* start out in codeset 0 */
1865 non_locking_shift = TRUE;
1866 while (tvb_reported_length_remaining(tvb, offset) > 0) {
1867 info_element = tvb_get_guint8(tvb, offset);
1869 /* Check for the codeset shift */
1870 if ((info_element & Q933_IE_SO_MASK) &&
1871 ((info_element & Q933_IE_SO_IDENTIFIER_MASK) == Q933_IE_SHIFT)) {
1872 non_locking_shift = info_element & Q933_IE_SHIFT_NON_LOCKING;
1873 codeset = info_element & Q933_IE_SHIFT_CODESET;
1874 if (!non_locking_shift)
1875 locked_codeset = codeset;
1876 if (q933_tree != NULL) {
1877 proto_tree_add_text(q933_tree, tvb, offset, 1,
1878 "%s shift to codeset %u: %s",
1879 (non_locking_shift ? "Non-locking" : "Locking"),
1881 val_to_str(codeset, q933_codeset_vals,
1882 "Unknown (0x%02X)"));
1889 * Check for the single-octet IEs.
1891 if (info_element & Q933_IE_SO_MASK) {
1892 switch ((codeset << 8) | (info_element & Q933_IE_SO_IDENTIFIER_MASK)) {
1894 case CS0 | Q933_IE_REPEAT_INDICATOR:
1895 if (q933_tree != NULL) {
1896 proto_tree_add_text(q933_tree, tvb, offset, 1,
1897 "Repeat indicator: %s",
1898 val_to_str(info_element & Q933_IE_SO_IE_MASK,
1899 q933_repeat_indication_vals,
1905 if (q933_tree != NULL) {
1906 proto_tree_add_text(q933_tree, tvb, offset, 1,
1907 "Unknown information element (0x%02X)",
1913 codeset = locked_codeset;
1918 * Variable-length IE.
1920 info_element_len = tvb_get_guint8(tvb, offset + 1);
1921 if (q933_tree != NULL) {
1922 ti = proto_tree_add_text(q933_tree, tvb, offset,
1923 1+1+info_element_len, "%s",
1924 val_to_str(info_element, q933_info_element_vals[codeset],
1925 "Unknown information element (0x%02X)"));
1926 ie_tree = proto_item_add_subtree(ti, ett_q933_ie);
1927 proto_tree_add_text(ie_tree, tvb, offset, 1,
1928 "Information element: %s",
1929 val_to_str(info_element, q933_info_element_vals[codeset],
1930 "Unknown (0x%02X)"));
1931 proto_tree_add_text(ie_tree, tvb, offset + 1, 1,
1932 "Length: %u", info_element_len);
1934 switch ((codeset << 8) | info_element) {
1936 case CS0 | Q933_IE_SEGMENTED_MESSAGE:
1937 dissect_q933_segmented_message_ie(tvb,
1938 offset + 2, info_element_len,
1942 case CS0 | Q933_IE_BEARER_CAPABILITY:
1943 case CS0 | Q933_IE_LOW_LAYER_COMPAT:
1944 dissect_q933_bearer_capability_ie(tvb,
1945 offset + 2, info_element_len,
1949 case CS0 | Q933_IE_CAUSE:
1950 dissect_q933_cause_ie(tvb,
1951 offset + 2, info_element_len,
1953 hf_q933_cause_value);
1956 case CS0 | Q933_IE_CALL_STATE:
1957 dissect_q933_call_state_ie(tvb,
1958 offset + 2, info_element_len,
1962 case CS0 | Q933_IE_CHANNEL_IDENTIFICATION:
1963 dissect_q933_channel_identification_ie(
1964 tvb, offset + 2, info_element_len,
1968 case CS0 | Q933_IE_PROGRESS_INDICATOR:
1969 dissect_q933_progress_indicator_ie(tvb,
1970 offset + 2, info_element_len,
1974 case CS0 | Q933_IE_NETWORK_SPECIFIC_FACIL:
1975 case CS0 | Q933_IE_TRANSIT_NETWORK_SEL:
1976 dissect_q933_ns_facilities_ie(tvb,
1977 offset + 2, info_element_len,
1981 case CS0 | Q933_IE_DISPLAY:
1982 dissect_q933_ia5_ie(tvb, offset + 2,
1983 info_element_len, ie_tree,
1984 "Display information");
1987 case CS0 | Q933_IE_E2E_TRANSIT_DELAY:
1988 dissect_q933_e2e_transit_delay_ie(tvb,
1989 offset + 2, info_element_len,
1993 case CS0 | Q933_IE_TD_SELECTION_AND_INT:
1994 dissect_q933_td_selection_and_int_ie(
1995 tvb, offset + 2, info_element_len,
1999 case CS0 | Q933_IE_PL_BINARY_PARAMETERS:
2000 dissect_q933_pl_binary_parameters_ie(
2001 tvb, offset + 2, info_element_len,
2005 case CS0 | Q933_IE_REVERSE_CHARGE_IND:
2006 dissect_q933_reverse_charge_ind_ie(tvb,
2007 offset + 2, info_element_len,
2011 case CS0 | Q933_IE_CALLING_PARTY_NUMBER:
2012 dissect_q933_number_ie(tvb,
2013 offset + 2, info_element_len,
2015 hf_q933_calling_party_number);
2018 case CS0 | Q933_IE_CONNECTED_NUMBER:
2019 dissect_q933_number_ie(tvb,
2020 offset + 2, info_element_len,
2022 hf_q933_connected_number);
2025 case CS0 | Q933_IE_CALLED_PARTY_NUMBER:
2026 dissect_q933_number_ie(tvb,
2027 offset + 2, info_element_len,
2029 hf_q933_called_party_number);
2032 case CS0 | Q933_IE_CALLING_PARTY_SUBADDR:
2033 case CS0 | Q933_IE_CALLED_PARTY_SUBADDR:
2034 dissect_q933_party_subaddr_ie(tvb,
2035 offset + 2, info_element_len,
2039 case CS0 | Q933_IE_HIGH_LAYER_COMPAT:
2040 dissect_q933_high_layer_compat_ie(tvb,
2041 offset + 2, info_element_len,
2045 case CS0 | Q933_IE_USER_USER:
2046 dissect_q933_user_user_ie(tvb,
2047 offset + 2, info_element_len,
2052 proto_tree_add_text(ie_tree, tvb,
2053 offset + 2, info_element_len,
2056 tvb_get_ptr(tvb, offset + 2,
2062 offset += 1 + 1 + info_element_len;
2063 codeset = locked_codeset;
2068 proto_register_q933(void)
2070 static hf_register_info hf[] = {
2071 { &hf_q933_discriminator,
2072 { "Protocol discriminator", "q933.disc", FT_UINT8, BASE_HEX, NULL, 0x0,
2075 { &hf_q933_call_ref_len,
2076 { "Call reference value length", "q933.call_ref_len", FT_UINT8, BASE_DEC, NULL, 0x0,
2079 { &hf_q933_call_ref_flag,
2080 { "Call reference flag", "q933.call_ref_flag", FT_BOOLEAN, BASE_NONE, TFS(&tfs_call_ref_flag), 0x0,
2083 { &hf_q933_call_ref,
2084 { "Call reference value", "q933.call_ref", FT_BYTES, BASE_HEX, NULL, 0x0,
2087 { &hf_q933_message_type,
2088 { "Message type", "q933.message_type", FT_UINT8, BASE_HEX, VALS(q933_message_type_vals), 0x0,
2091 { &hf_q933_cause_value,
2092 { "Cause value", "q933.cause_value", FT_UINT8, BASE_DEC, VALS(q933_cause_code_vals), 0x0,
2095 { &hf_q933_calling_party_number,
2096 { "Calling party number digits", "q933.calling_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2099 { &hf_q933_called_party_number,
2100 { "Called party number digits", "q933.called_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2103 { &hf_q933_connected_number,
2104 { "Connected party number digits", "q933.connected_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2107 { &hf_q933_redirecting_number,
2108 { "Redirecting party number digits", "q933.redirecting_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2111 static gint *ett[] = {
2116 proto_q933 = proto_register_protocol("Q.933", "Q.933", "q933");
2117 proto_register_field_array (proto_q933, hf, array_length(hf));
2118 proto_register_subtree_array(ett, array_length(ett));
2120 register_dissector("q933", dissect_q933, proto_q933);
2124 proto_reg_handoff_q933(void)
2126 dissector_handle_t q933_handle;
2128 q933_handle = create_dissector_handle(dissect_q933, proto_q933);
2129 dissector_add("fr.osinl", NLPID_Q_933, q933_handle);