2 * Routines for Q.933 frame disassembly
3 * Guy Harris <guy@alum.mit.edu>
5 * $Id: packet-q933.c,v 1.7 2004/03/06 10:46:38 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>
37 static int proto_q933 = -1;
38 static int hf_q933_discriminator = -1;
39 static int hf_q933_coding_standard = -1;
40 static int hf_q933_information_transfer_capability = -1;
41 static int hf_q933_transfer_mode = -1;
42 static int hf_q933_uil1 = -1;
43 static int hf_q933_call_ref_len = -1;
44 static int hf_q933_call_ref_flag = -1;
45 static int hf_q933_call_ref = -1;
46 static int hf_q933_message_type = -1;
47 static int hf_q933_cause_location = -1;
48 static int hf_q933_cause_value = -1;
49 static int hf_q933_number_type = -1;
50 static int hf_q933_numbering_plan = -1;
51 static int hf_q933_extension_ind = -1;
52 static int hf_q933_calling_party_number = -1;
53 static int hf_q933_called_party_number = -1;
54 static int hf_q933_connected_number = -1;
55 static int hf_q933_redirecting_number = -1;
56 static int hf_q933_screening_ind = -1;
57 static int hf_q933_presentation_ind = -1;
59 static gint ett_q933 = -1;
60 static gint ett_q933_ie = -1;
63 * Q.933 message types.
65 #define Q933_ESCAPE 0x00
66 #define Q933_ALERTING 0x01
67 #define Q933_CALL_PROCEEDING 0x02
68 #define Q933_CONNECT 0x07
69 #define Q933_CONNECT_ACK 0x0F
70 #define Q933_PROGRESS 0x03
71 #define Q933_SETUP 0x05
72 #define Q933_DISCONNECT 0x45
73 #define Q933_RELEASE 0x4D
74 #define Q933_RELEASE_COMPLETE 0x5A
75 #define Q933_SEGMENT 0x60
76 #define Q933_STATUS 0x7D
77 #define Q933_STATUS_ENQUIRY 0x75
79 static const value_string q933_message_type_vals[] = {
80 { Q933_ESCAPE, "ESCAPE" },
81 { Q933_ALERTING, "ALERTING" },
82 { Q933_CALL_PROCEEDING, "CALL PROCEEDING" },
83 { Q933_CONNECT, "CONNECT" },
84 { Q933_CONNECT_ACK, "CONNECT ACKNOWLEDGE" },
85 { Q933_PROGRESS, "PROGRESS" },
86 { Q933_SETUP, "SETUP" },
87 { Q933_DISCONNECT, "DISCONNECT" },
88 { Q933_RELEASE, "RELEASE" },
89 { Q933_RELEASE_COMPLETE, "RELEASE COMPLETE" },
90 { Q933_SEGMENT, "SEGMENT" },
91 { Q933_STATUS, "STATUS" },
92 { Q933_STATUS_ENQUIRY, "STATUS ENQUIRY" },
96 static const true_false_string tfs_call_ref_flag = {
97 "Message sent to originating side",
98 "Message sent from originating side"
102 * Information elements.
105 /* Shifted codeset values */
115 #define Q933_IE_SO_MASK 0x80 /* single-octet/variable-length mask */
119 #define Q933_IE_SO_IDENTIFIER_MASK 0xf0 /* IE identifier mask */
120 #define Q933_IE_SO_IDENTIFIER_SHIFT 4 /* IE identifier shift */
121 #define Q933_IE_SO_IE_MASK 0x0F /* IE mask */
123 #define Q933_IE_SHIFT 0x90
124 #define Q933_IE_SHIFT_NON_LOCKING 0x08 /* non-locking shift */
125 #define Q933_IE_SHIFT_CODESET 0x07 /* codeset */
127 #define Q933_IE_REPEAT_INDICATOR 0xD0
130 * Variable-length IEs.
132 #define Q933_IE_VL_EXTENSION 0x80 /* Extension flag */
133 /* extension bit. The bit value "0" indicates that the octet continues through the */
134 /* next octet. The bit value "1" indicates that this octet is the last octet */
136 static const true_false_string q933_extension_ind_value = {
138 "information continues through the next octet",
144 * Codeset 0 (default).
146 #define Q933_IE_SEGMENTED_MESSAGE 0x00
147 #define Q933_IE_BEARER_CAPABILITY 0x04
148 #define Q933_IE_CAUSE 0x08
149 #define Q933_IE_CALL_STATE 0x14
150 #define Q933_IE_CHANNEL_IDENTIFICATION 0x18
151 #define Q933_IE_DLCI 0x19
152 #define Q933_IE_PROGRESS_INDICATOR 0x1E
153 #define Q933_IE_NETWORK_SPECIFIC_FACIL 0x20 /* Network Specific Facilities */
154 #define Q933_IE_DISPLAY 0x28
155 #define Q933_IE_E2E_TRANSIT_DELAY 0x42 /* End-to-end Transit Delay */
156 #define Q933_IE_TD_SELECTION_AND_INT 0x43 /* Transit Delay Selection and Indication */
157 #define Q933_IE_PL_BINARY_PARAMETERS 0x44 /* Packet layer binary parameters */
158 #define Q933_IE_LL_CORE_PARAMETERS 0x48 /* Link layer core parameters */
159 #define Q933_IE_LL_PROTOCOL_PARAMETERS 0x49 /* Link layer protocol parameters */
160 #define Q933_IE_REVERSE_CHARGE_IND 0x4A /* Reverse charging indication */
161 #define Q933_IE_CONNECTED_NUMBER 0x4C /* Connected Number */
162 #define Q933_IE_CONNECTED_SUBADDR 0x4D /* Connected sub-address */
163 #define Q933_IE_X_213_PRIORITY 0x50 /* X.213 priority */
164 #define Q933_IE_REPORT_TYPE 0x51
165 #define Q933_IE_LINK_INTEGRITY_VERF 0x53 /* Link integrity verification */
166 #define Q933_IE_PVC_STATUS 0x57
167 #define Q933_IE_CALLING_PARTY_NUMBER 0x6C /* Calling Party Number */
168 #define Q933_IE_CALLING_PARTY_SUBADDR 0x6D /* Calling Party Subaddress */
169 #define Q933_IE_CALLED_PARTY_NUMBER 0x70 /* Called Party Number */
170 #define Q933_IE_CALLED_PARTY_SUBADDR 0x71 /* Called Party Subaddress */
171 #define Q933_IE_TRANSIT_NETWORK_SEL 0x78 /* Transit Network Selection */
172 #define Q933_IE_LOW_LAYER_COMPAT 0x7C /* Low-Layer Compatibility */
173 #define Q933_IE_HIGH_LAYER_COMPAT 0x7D /* High-Layer Compatibility */
174 #define Q933_IE_USER_USER 0x7E /* User-User */
175 #define Q933_IE_ESCAPE 0x7F /* Escape for extension */
178 static const value_string q933_info_element_vals0[] = {
179 { Q933_IE_SEGMENTED_MESSAGE, "Segmented message" },
180 { Q933_IE_BEARER_CAPABILITY, "Bearer capability" },
181 { Q933_IE_CAUSE, "Cause" },
182 { Q933_IE_CALL_STATE, "Call state" },
183 { Q933_IE_CHANNEL_IDENTIFICATION, "Channel identification" },
184 { Q933_IE_DLCI, "Data link connection identifier" },
185 { Q933_IE_PROGRESS_INDICATOR, "Progress indicator" },
186 { Q933_IE_NETWORK_SPECIFIC_FACIL, "Network specific facilities" },
187 { Q933_IE_E2E_TRANSIT_DELAY, "End-to-end transit delay" },
188 { Q933_IE_TD_SELECTION_AND_INT, "Transit delay selection and indication" },
189 { Q933_IE_PL_BINARY_PARAMETERS, "Packet layer binary parameters" },
190 { Q933_IE_LL_CORE_PARAMETERS, "Link layer core parameters" },
191 { Q933_IE_LL_PROTOCOL_PARAMETERS, "Link layer protocol parameters" },
192 { Q933_IE_REVERSE_CHARGE_IND, "Reverse charging indication" },
193 { Q933_IE_CONNECTED_NUMBER, "Connected number" },
194 { Q933_IE_CONNECTED_SUBADDR, "Connected subaddress" },
195 { Q933_IE_X_213_PRIORITY, "X.213 priority" },
196 { Q933_IE_REPORT_TYPE, "Report type" },
197 { Q933_IE_LINK_INTEGRITY_VERF, "Link integrity verification" },
198 { Q933_IE_PVC_STATUS, "PVC status" },
199 { Q933_IE_CALLING_PARTY_NUMBER, "Calling party number" },
200 { Q933_IE_CALLING_PARTY_SUBADDR, "Calling party subaddress" },
201 { Q933_IE_CALLED_PARTY_NUMBER, "Called party number" },
202 { Q933_IE_CALLED_PARTY_SUBADDR, "Called party subaddress" },
203 { Q933_IE_TRANSIT_NETWORK_SEL, "Transit network selection" },
204 { Q933_IE_LOW_LAYER_COMPAT, "Low-layer compatibility" },
205 { Q933_IE_HIGH_LAYER_COMPAT, "High-layer compatibility" },
206 { Q933_IE_USER_USER, "User-user" },
207 { Q933_IE_ESCAPE, "Escape" },
211 static const value_string q933_info_element_vals1[] = {
215 static const value_string q933_info_element_vals2[] = {
219 static const value_string q933_info_element_vals3[] = {
223 static const value_string q933_info_element_vals4[] = {
227 static const value_string q933_info_element_vals5[] = {
231 static const value_string q933_info_element_vals6[] = {
235 static const value_string q933_info_element_vals7[] = {
240 #define NUM_INFO_ELEMENT_VALS (Q933_IE_SHIFT_CODESET+1)
241 static const value_string *q933_info_element_vals[NUM_INFO_ELEMENT_VALS] = {
242 q933_info_element_vals0,
243 q933_info_element_vals1,
244 q933_info_element_vals2,
245 q933_info_element_vals3,
246 q933_info_element_vals4,
247 q933_info_element_vals5,
248 q933_info_element_vals6,
249 q933_info_element_vals7,
252 static const value_string q933_repeat_indication_vals[] = {
253 { 0x2, "Prioritized list" },
258 * ITU-standardized coding.
260 #define Q933_ITU_STANDARDIZED_CODING 0x00
263 * Dissect a Segmented message information element.
266 dissect_q933_segmented_message_ie(tvbuff_t *tvb, int offset, int len,
270 proto_tree_add_text(tree, tvb, offset, len,
271 "Segmented message: length is %d, should be 2", len);
274 if (tvb_get_guint8(tvb, offset) & 0x80) {
275 proto_tree_add_text(tree, tvb, offset, 1,
276 "First segment: %u segments remaining",
277 tvb_get_guint8(tvb, offset) & 0x7F);
279 proto_tree_add_text(tree, tvb, offset, 1,
280 "Not first segment: %u segments remaining",
281 tvb_get_guint8(tvb, offset) & 0x7F);
283 proto_tree_add_text(tree, tvb, offset + 1, 1,
284 "Segmented message type: %u", tvb_get_guint8(tvb, offset + 1));
288 * Dissect a Bearer capability or Low-layer compatibility information element.
290 static const value_string q933_coding_standard_vals[] = {
291 { 0x0, "ITU-T standardized coding" },
292 { 0x1, "ISO/IEC standard" },
293 { 0x2, "National standard" },
294 { 0x3, "Standard defined for this particular network" },
298 static const value_string q933_information_transfer_capability_vals[] = {
299 { 0x08, "Unrestricted digital information" },
303 static const value_string q933_transfer_mode_vals[] = {
304 { 0x01, "Frame mode" },
308 static const value_string q933_uil1_vals[] = {
309 { 0x01, "V.110/I.460/X.30 rate adaption" },
310 { 0x02, "Recommendation G.711 u-law" },
311 { 0x03, "Recommendation G.711 A-law" },
312 { 0x04, "Recommendation G.721 32 kbit/s ADPCM and Recommendation I.460" },
313 { 0x05, "Recommendation H.221 and H.242" },
314 { 0x06, "Recommendation H.223 and H.245" },
315 { 0x07, "Non-ITU-T-standardized rate adaption" },
316 { 0x08, "V.120 rate adaption" },
317 { 0x09, "X.31 HDLC flag stuffing" },
321 static const value_string q933_l1_user_rate_vals[] = {
322 { 0x00, "Rate indicated by E-bits" },
323 { 0x01, "0.6 kbit/s" },
324 { 0x02, "1.2 kbit/s" },
325 { 0x03, "2.4 kbit/s" },
326 { 0x04, "3.6 kbit/s" },
327 { 0x05, "4.8 kbit/s" },
328 { 0x06, "7.2 kbit/s" },
329 { 0x07, "8 kbit/s" },
330 { 0x08, "9.6 kbit/s" },
331 { 0x09, "14.4 kbit/s" },
332 { 0x0A, "16 kbit/s" },
333 { 0x0B, "19.2 kbit/s" },
334 { 0x0C, "32 kbit/s" },
335 { 0x0E, "48 kbit/s" },
336 { 0x0F, "56 kbit/s" },
337 { 0x10, "64 kbit/s "},
338 { 0x15, "0.1345 kbit/s" },
339 { 0x16, "0.100 kbit/s" },
340 { 0x17, "0.075/1.2 kbit/s" },
341 { 0x18, "1.2/0.075 kbit/s" },
342 { 0x19, "0.050 kbit/s" },
343 { 0x1A, "0.075 kbit/s" },
344 { 0x1B, "0.110 kbit/s" },
345 { 0x1C, "0.150 kbit/s" },
346 { 0x1D, "0.200 kbit/s" },
347 { 0x1E, "0.300 kbit/s" },
348 { 0x1F, "12 kbit/s" },
352 static const value_string q933_l1_stop_bits_vals[] = {
359 static const value_string q933_l1_data_bits_vals[] = {
366 static const value_string q933_l1_parity_vals[] = {
370 { 0x04, "Forced to 0" },
371 { 0x05, "Forced to 1" },
375 #define Q933_UIL2_USER_SPEC 0x10
377 static const value_string q933_uil2_vals[] = {
378 { 0x01, "Basic mode ISO 1745" },
379 { 0x06, "X.25, link level" },
380 { 0x07, "X.25 multilink" },
381 { 0x08, "T.71 Extended LAPB" },
382 { 0x09, "HDLC ARM" },
383 { 0x0A, "HDLC NRM" },
384 { 0x0B, "HDLC ABM" },
385 { 0x0C, "ISO 8802/2 LLC" },
386 { 0x0D, "X.75 Single Link Procedure" },
388 { 0x0F, "Core aspects of Q.922" },
389 { Q933_UIL2_USER_SPEC, "User-specified" },
390 { 0x11, "ISO 7776 DTE-DTE operation" },
394 static const value_string q933_address_inclusion_vals[] = {
395 { 0x01, "Address included" },
396 { 0x02, "Encapsulation of logical control frame" },
400 static const value_string q933_mode_vals[] = {
401 { 0x20, "Normal mode" },
402 { 0x40, "Extended mode" },
406 #define Q933_UIL3_X25_PL 0x06
407 #define Q933_UIL3_ISO_8208 0x07 /* X.25-based */
408 #define Q933_UIL3_X223 0x08 /* X.25-based */
409 #define Q933_UIL3_TR_9577 0x0B
410 #define Q933_UIL3_USER_SPEC 0x10
412 static const value_string q933_uil3_vals[] = {
413 { Q933_UIL3_X25_PL, "X.25, packet layer" },
414 { Q933_UIL3_ISO_8208, "ISO/IEC 8208" },
415 { Q933_UIL3_X223, "X.223/ISO 8878" },
416 { 0x09, "ISO/IEC 8473" },
418 { Q933_UIL3_TR_9577, "ISO/IEC TR 9577" },
419 { Q933_UIL3_USER_SPEC, "User-specified" },
424 dissect_q933_protocol_discriminator(tvbuff_t *tvb, int offset, proto_tree *tree)
426 unsigned int discriminator = tvb_get_guint8(tvb, offset);
428 if (discriminator == NLPID_Q_933) {
429 proto_tree_add_uint_format(tree, hf_q933_discriminator,
430 tvb, offset, 1, discriminator,
431 "Protocol discriminator: Q.933");
432 } else if (discriminator == NLPID_Q_2931) {
433 proto_tree_add_uint_format(tree, hf_q933_discriminator,
434 tvb, offset, 1, discriminator,
435 "Protocol discriminator: Q.2931");
436 } else if ((discriminator >= 16 && discriminator < 63)
437 || ((discriminator >= 80) && (discriminator < 254))) {
438 proto_tree_add_uint_format(tree, hf_q933_discriminator,
439 tvb, offset, 1, discriminator,
440 "Protocol discriminator: Network layer or layer 3 protocol (0x%02X)",
442 } else if (discriminator >= 64 && discriminator <= 79) {
443 proto_tree_add_uint_format(tree, hf_q933_discriminator,
444 tvb, offset, 1, discriminator,
445 "Protocol discriminator: National use (0x%02X)",
448 proto_tree_add_uint_format(tree, hf_q933_discriminator,
449 tvb, offset, 1, discriminator,
450 "Protocol discriminator: Reserved (0x%02X)",
456 dissect_q933_bearer_capability_ie(tvbuff_t *tvb, int offset, int len,
460 guint8 coding_standard;
462 guint8 uil2_protocol;
463 guint8 uil3_protocol;
468 octet = tvb_get_guint8(tvb, offset);
469 coding_standard = octet & 0x60;
470 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
472 * We don't know how the bearer capability is encoded,
473 * so just dump it as data and be done with it.
475 proto_tree_add_text(tree, tvb, offset,
477 tvb_bytes_to_str(tvb, offset, len));
478 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
479 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
482 proto_tree_add_uint(tree, hf_q933_information_transfer_capability, tvb, offset, 1, octet);
483 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
484 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
489 * XXX - only in Low-layer compatibility information element.
491 if (!(octet & Q933_IE_VL_EXTENSION)) {
494 octet = tvb_get_guint8(tvb, offset);
495 proto_tree_add_text(tree, tvb, offset, 1,
496 "Out-band negotiation %spossible",
497 (octet & 0x40) ? "" : "not ");
504 octet = tvb_get_guint8(tvb, offset);
505 proto_tree_add_uint(tree, hf_q933_transfer_mode, tvb, offset, 1, octet);
506 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
512 octet = tvb_get_guint8(tvb, offset);
513 if ((octet & 0x60) == 0x20) {
515 * Layer 1 information.
517 proto_tree_add_uint(tree, hf_q933_uil1, tvb, offset, 1, octet);
518 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
522 if (octet & Q933_IE_VL_EXTENSION)
526 octet = tvb_get_guint8(tvb, offset);
527 proto_tree_add_text(tree, tvb, offset, 1,
529 (octet & 0x40) ? "Asynchronous" : "Synchronous");
530 proto_tree_add_text(tree, tvb, offset, 1,
532 val_to_str(octet & 0x1F, q933_l1_user_rate_vals,
533 "Unknown (0x%02X)"));
537 if (octet & Q933_IE_VL_EXTENSION)
541 octet = tvb_get_guint8(tvb, offset);
542 proto_tree_add_text(tree, tvb, offset, 1,
543 "Rate adaption header %sincluded",
544 (octet & 0x40) ? "" : "not ");
545 proto_tree_add_text(tree, tvb, offset, 1,
546 "Multiple frame establishment %ssupported",
547 (octet & 0x20) ? "" : "not ");
548 proto_tree_add_text(tree, tvb, offset, 1,
549 "%s mode of operation",
550 (octet & 0x10) ? "Protocol sensitive" : "Bit transparent");
554 if (octet & Q933_IE_VL_EXTENSION)
558 octet = tvb_get_guint8(tvb, offset);
559 proto_tree_add_text(tree, tvb, offset, 1,
561 val_to_str(octet & 0x60, q933_l1_stop_bits_vals,
563 proto_tree_add_text(tree, tvb, offset, 1,
565 val_to_str(octet & 0x18, q933_l1_data_bits_vals,
567 proto_tree_add_text(tree, tvb, offset, 1,
569 val_to_str(octet & 0x07, q933_l1_parity_vals,
572 if (octet & Q933_IE_VL_EXTENSION)
576 octet = tvb_get_guint8(tvb, offset);
577 proto_tree_add_text(tree, tvb, offset, 1,
579 (octet & 0x40) ? "Full" : "Half");
580 modem_type = octet & 0x3F;
581 proto_tree_add_text(tree, tvb, offset, 1,
582 "Modem type: Network-specific rules 0x%02X", modem_type);
591 octet = tvb_get_guint8(tvb, offset);
592 if ((octet & 0x60) == 0x40) {
594 * Layer 2 information.
596 uil2_protocol = octet & 0x1F;
597 proto_tree_add_text(tree, tvb, offset, 1,
598 "User information layer 2 protocol: %s",
599 val_to_str(uil2_protocol, q933_uil2_vals,
600 "Unknown (0x%02X)"));
605 * XXX - only in Low-layer compatibility information element.
607 if (octet & Q933_IE_VL_EXTENSION)
611 octet = tvb_get_guint8(tvb, offset);
612 if (uil2_protocol == Q933_UIL2_USER_SPEC) {
613 proto_tree_add_text(tree, tvb, offset, 1,
614 "User-specified layer 2 protocol information: 0x%02X",
617 proto_tree_add_text(tree, tvb, offset, 1,
618 "Address inclusion: %s",
619 val_to_str(octet & 0x03, q933_address_inclusion_vals,
620 "Unknown (0x%02X)"));
630 octet = tvb_get_guint8(tvb, offset);
631 if ((octet & 0x60) == 0x60) {
633 * Layer 3 information.
635 uil3_protocol = octet & 0x1F;
636 proto_tree_add_text(tree, tvb, offset, 1,
637 "User information layer 3 protocol: %s",
638 val_to_str(uil3_protocol, q933_uil3_vals,
639 "Unknown (0x%02X)"));
645 * XXX - only in Low-layer compatibility information element.
647 if (octet & Q933_IE_VL_EXTENSION)
651 octet = tvb_get_guint8(tvb, offset);
652 switch (uil3_protocol) {
654 case Q933_UIL3_X25_PL:
655 case Q933_UIL3_ISO_8208:
657 proto_tree_add_text(tree, tvb, offset, 1,
659 val_to_str(octet & 0x60, q933_mode_vals,
660 "Unknown (0x%02X)"));
664 if (octet & Q933_IE_VL_EXTENSION)
668 octet = tvb_get_guint8(tvb, offset);
669 proto_tree_add_text(tree, tvb, offset, 1,
670 "Default packet size: %u", octet & 0x0F);
674 if (octet & Q933_IE_VL_EXTENSION)
678 octet = tvb_get_guint8(tvb, offset);
679 proto_tree_add_text(tree, tvb, offset, 1,
680 "Packet window size: %u", octet & 0x7F);
685 case Q933_UIL3_USER_SPEC:
686 proto_tree_add_text(tree, tvb, offset, 1,
687 "Default packet size: %u octets",
688 1 << (octet & 0x0F));
693 case Q933_UIL3_TR_9577:
694 add_l3_info = (octet & 0x0F) << 4;
695 if (octet & Q933_IE_VL_EXTENSION)
699 octet = tvb_get_guint8(tvb, offset + 1);
700 add_l3_info |= (octet & 0x0F);
701 proto_tree_add_text(tree, tvb, offset, 2,
702 "Additional layer 3 protocol information: %s",
703 val_to_str(add_l3_info, nlpid_vals,
704 "Unknown (0x%02X)"));
715 * Dissect a Cause information element.
719 const value_string q933_cause_location_vals[] = {
720 { 0x00, "User (U)" },
721 { 0x01, "Private network serving the local user (LPN)" },
722 { 0x02, "Public network serving the local user (LN)" },
723 { 0x03, "Transit network (TN)" },
724 { 0x04, "Public network serving the remote user (RLN)" },
725 { 0x05, "Private network serving the remote user (RPN)" },
726 { 0x07, "International network (INTL)" },
727 { 0x0A, "Network beyond interworking point (BI)" },
731 static const value_string q933_cause_recommendation_vals[] = {
735 { 0x05, "Q.1031/Q.1051" },
740 * Cause codes for Cause.
742 #define Q933_CAUSE_UNALLOC_NUMBER 0x01
743 #define Q933_CAUSE_NO_ROUTE_TO_DEST 0x03
744 #define Q933_CAUSE_CALL_REJECTED 0x15
745 #define Q933_CAUSE_NUMBER_CHANGED 0x16
746 #define Q933_CAUSE_ACCESS_INFO_DISC 0x2B
747 #define Q933_CAUSE_QOS_UNAVAILABLE 0x31
748 #define Q933_CAUSE_CHAN_NONEXISTENT 0x52
749 #define Q933_CAUSE_INCOMPATIBLE_DEST 0x58
750 #define Q933_CAUSE_MAND_IE_MISSING 0x60
751 #define Q933_CAUSE_MT_NONEX_OR_UNIMPL 0x61
752 #define Q933_CAUSE_IE_NONEX_OR_UNIMPL 0x63
753 #define Q933_CAUSE_INVALID_IE_CONTENTS 0x64
754 #define Q933_CAUSE_MSG_INCOMPAT_W_CS 0x65
755 #define Q933_CAUSE_REC_TIMER_EXP 0x66
757 const value_string q933_cause_code_vals[] = {
758 { 0x00, "Valid cause code not yet received" },
759 { Q933_CAUSE_UNALLOC_NUMBER, "Unallocated (unassigned) number" },
760 { 0x02, "No route to specified transit network" },
761 { Q933_CAUSE_NO_ROUTE_TO_DEST, "No route to destination" },
762 { 0x04, "Send special information tone" },
763 { 0x05, "Misdialled trunk prefix" },
764 { 0x06, "Channel unacceptable" },
765 { 0x07, "Call awarded and being delivered in an established channel" },
766 { 0x08, "Prefix 0 dialed but not allowed" },
767 /* Q.850 - "Preemption" */
768 { 0x09, "Prefix 1 dialed but not allowed" },
769 /* Q.850 - "Preemption - circuit reserved for reuse" */
770 { 0x0A, "Prefix 1 dialed but not required" },
771 { 0x0B, "More digits received than allowed, call is proceeding" },
772 { 0x0E, "QoR: ported number" },
773 { 0x10, "Normal call clearing" },
774 { 0x11, "User busy" },
775 { 0x12, "No user responding" },
776 { 0x13, "No answer from user (user alerted)" },
777 { 0x14, "Subscriber absent" },
778 { Q933_CAUSE_CALL_REJECTED, "Call rejected" },
779 { Q933_CAUSE_NUMBER_CHANGED, "Number changed" },
780 { 0x17, "Reverse charging rejected" },
781 /* Q.850 - "Redirection to new destination" */
782 { 0x18, "Call suspended" },
783 /* Q.850 Amendment 1 - "Call rejected due to feature at the destination" */
784 { 0x19, "Call resumed" },
785 /* Q.850 - "Exchange routing error */
786 { 0x1A, "Non-selected user clearing" },
787 { 0x1B, "Destination out of order" },
788 { 0x1C, "Invalid number format (incomplete number)" },
789 { 0x1D, "Facility rejected" },
790 { 0x1E, "Response to STATUS ENQUIRY" },
791 { 0x1F, "Normal unspecified" },
792 { 0x21, "Circuit out of order" },
793 { 0x22, "No circuit/channel available" },
794 { 0x23, "Destination unattainable" },
795 { 0x25, "Degraded service" },
796 { 0x26, "Network out of order" },
797 { 0x27, "Transit delay range cannot be achieved" },
798 /* Q.850 - "Permanent frame mode connection out of service" */
799 { 0x28, "Throughput range cannot be achieved" },
800 /* Q.850 - "Permanent frame mode connection operational" */
801 { 0x29, "Temporary failure" },
802 { 0x2A, "Switching equipment congestion" },
803 { Q933_CAUSE_ACCESS_INFO_DISC, "Access information discarded" },
804 { 0x2C, "Requested circuit/channel not available" },
805 { 0x2D, "Pre-empted" },
806 { 0x2E, "Precedence call blocked" },
807 { 0x2F, "Resources unavailable, unspecified" },
808 { Q933_CAUSE_QOS_UNAVAILABLE, "Quality of service unavailable" },
809 { 0x32, "Requested facility not subscribed" },
810 { 0x33, "Reverse charging not allowed" },
811 { 0x34, "Outgoing calls barred" },
812 { 0x35, "Outgoing calls barred within CUG" },
813 { 0x36, "Incoming calls barred" },
814 { 0x37, "Incoming calls barred within CUG" },
815 { 0x38, "Call waiting not subscribed" },
816 { 0x39, "Bearer capability not authorized" },
817 { 0x3A, "Bearer capability not presently available" },
818 { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
819 { 0x3F, "Service or option not available, unspecified" },
820 { 0x41, "Bearer capability not implemented" },
821 { 0x42, "Channel type not implemented" },
822 { 0x43, "Transit network selection not implemented" },
823 { 0x44, "Message not implemented" },
824 { 0x45, "Requested facility not implemented" },
825 { 0x46, "Only restricted digital information bearer capability is available" },
826 { 0x4F, "Service or option not implemented, unspecified" },
827 { 0x51, "Invalid call reference value" },
828 { Q933_CAUSE_CHAN_NONEXISTENT, "Identified channel does not exist" },
829 { 0x53, "Call identity does not exist for suspended call" },
830 { 0x54, "Call identity in use" },
831 { 0x55, "No call suspended" },
832 { 0x56, "Call having the requested call identity has been cleared" },
833 { 0x57, "Called user not member of CUG" },
834 { Q933_CAUSE_INCOMPATIBLE_DEST, "Incompatible destination" },
835 { 0x59, "Non-existent abbreviated address entry" },
836 { 0x5A, "Destination address missing, and direct call not subscribed" },
837 /* Q.850 - "Non-existent CUG" */
838 { 0x5B, "Invalid transit network selection (national use)" },
839 { 0x5C, "Invalid facility parameter" },
840 { 0x5D, "Mandatory information element is missing" },
841 { 0x5F, "Invalid message, unspecified" },
842 { Q933_CAUSE_MAND_IE_MISSING, "Mandatory information element is missing" },
843 { Q933_CAUSE_MT_NONEX_OR_UNIMPL,"Message type non-existent or not implemented" },
844 { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
845 { Q933_CAUSE_IE_NONEX_OR_UNIMPL,"Information element nonexistant or not implemented" },
846 { Q933_CAUSE_INVALID_IE_CONTENTS,"Invalid information element contents" },
847 { Q933_CAUSE_MSG_INCOMPAT_W_CS, "Message not compatible with call state" },
848 { Q933_CAUSE_REC_TIMER_EXP, "Recovery on timer expiry" },
849 { 0x67, "Parameter non-existent or not implemented - passed on" },
850 { 0x6E, "Message with unrecognized parameter discarded" },
851 { 0x6F, "Protocol error, unspecified" },
852 { 0x7F, "Internetworking, unspecified" },
856 static const value_string q933_cause_condition_vals[] = {
858 { 0x01, "Permanent" },
859 { 0x02, "Transient" },
863 #define Q933_REJ_USER_SPECIFIC 0x00
864 #define Q933_REJ_IE_MISSING 0x04
865 #define Q933_REJ_IE_INSUFFICIENT 0x08
867 static const value_string q933_rejection_reason_vals[] = {
868 { 0x00, "User specific" },
869 { 0x04, "Information element missing" },
870 { 0x08, "Information element contents are not sufficient" },
875 dissect_q933_cause_ie(tvbuff_t *tvb, int offset, int len,
876 proto_tree *tree, int hf_cause_value)
880 guint8 coding_standard;
881 guint8 rejection_reason;
885 octet = tvb_get_guint8(tvb, offset);
886 coding_standard = octet & 0x60;
887 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
889 * We don't know how the cause is encoded,
890 * so just dump it as data and be done with it.
892 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
893 proto_tree_add_text(tree, tvb, offset,
895 tvb_bytes_to_str(tvb, offset, len));
898 proto_tree_add_uint(tree, hf_q933_cause_location, tvb, offset, 1, octet);
899 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
900 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
904 if (!(octet & Q933_IE_VL_EXTENSION)) {
907 octet = tvb_get_guint8(tvb, offset);
908 proto_tree_add_text(tree, tvb, offset, 1,
909 "Recommendation: %s",
910 val_to_str(octet & 0x7F, q933_cause_recommendation_vals,
911 "Unknown (0x%02X)"));
912 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
919 octet = tvb_get_guint8(tvb, offset);
920 cause_value = octet & 0x7F;
921 proto_tree_add_uint(tree, hf_cause_value, tvb, offset, 1, cause_value);
922 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
928 switch (cause_value) {
930 case Q933_CAUSE_UNALLOC_NUMBER:
931 case Q933_CAUSE_NO_ROUTE_TO_DEST:
932 case Q933_CAUSE_QOS_UNAVAILABLE:
933 octet = tvb_get_guint8(tvb, offset);
934 proto_tree_add_text(tree, tvb, offset, 1,
935 "Network service: %s",
936 (octet & 0x80) ? "User" : "Provider");
937 proto_tree_add_text(tree, tvb, offset, 1,
939 (octet & 0x40) ? "Abnormal" : "Normal");
940 proto_tree_add_text(tree, tvb, offset, 1,
942 val_to_str(octet & 0x03, q933_cause_condition_vals,
946 case Q933_CAUSE_CALL_REJECTED:
947 rejection_reason = octet & 0x7C;
948 proto_tree_add_text(tree, tvb, offset, 1,
949 "Rejection reason: %s",
950 val_to_str(octet & 0x7C, q933_rejection_reason_vals,
952 proto_tree_add_text(tree, tvb, offset, 1,
954 val_to_str(octet & 0x03, q933_cause_condition_vals,
961 switch (rejection_reason) {
963 case Q933_REJ_USER_SPECIFIC:
964 proto_tree_add_text(tree, tvb, offset, len,
965 "User specific diagnostic: %s",
966 tvb_bytes_to_str(tvb, offset, len));
969 case Q933_REJ_IE_MISSING:
970 proto_tree_add_text(tree, tvb, offset, 1,
971 "Missing information element: %s",
972 val_to_str(tvb_get_guint8(tvb, offset), q933_info_element_vals0,
973 "Unknown (0x%02X)"));
976 case Q933_REJ_IE_INSUFFICIENT:
977 proto_tree_add_text(tree, tvb, offset, 1,
978 "Insufficient information element: %s",
979 val_to_str(tvb_get_guint8(tvb, offset), q933_info_element_vals0,
980 "Unknown (0x%02X)"));
984 proto_tree_add_text(tree, tvb, offset, len,
986 tvb_bytes_to_str(tvb, offset, len));
991 case Q933_CAUSE_ACCESS_INFO_DISC:
992 case Q933_CAUSE_INCOMPATIBLE_DEST:
993 case Q933_CAUSE_MAND_IE_MISSING:
994 case Q933_CAUSE_IE_NONEX_OR_UNIMPL:
995 case Q933_CAUSE_INVALID_IE_CONTENTS:
997 proto_tree_add_text(tree, tvb, offset, 1,
998 "Information element: %s",
999 val_to_str(tvb_get_guint8(tvb, offset), q933_info_element_vals0,
1000 "Unknown (0x%02X)"));
1006 case Q933_CAUSE_MT_NONEX_OR_UNIMPL:
1007 case Q933_CAUSE_MSG_INCOMPAT_W_CS:
1008 proto_tree_add_text(tree, tvb, offset, 1,
1010 val_to_str(tvb_get_guint8(tvb, offset), q933_message_type_vals,
1011 "Unknown (0x%02X)"));
1014 case Q933_CAUSE_REC_TIMER_EXP:
1017 proto_tree_add_text(tree, tvb, offset, 3,
1018 "Timer: %.3s", tvb_get_ptr(tvb, offset, 3));
1022 proto_tree_add_text(tree, tvb, offset, len,
1024 tvb_bytes_to_str(tvb, offset, len));
1029 * Dissect a Call state information element.
1031 static const value_string q933_call_state_vals[] = {
1033 { 0x01, "Call initiated" },
1034 { 0x02, "Overlap sending" },
1035 { 0x03, "Outgoing call proceeding" },
1036 { 0x04, "Call delivered" },
1037 { 0x06, "Call present" },
1038 { 0x07, "Call received" },
1039 { 0x08, "Connect request" },
1040 { 0x09, "Incoming call proceeding" },
1042 { 0x0B, "Disconnect request" },
1043 { 0x0C, "Disconnect indication" },
1044 { 0x0F, "Suspend request" },
1045 { 0x12, "Resume request" },
1046 { 0x13, "Release request" },
1047 { 0x16, "Call abort"},
1048 { 0x19, "Overlap receiving" },
1049 { 0x3D, "Restart request" },
1050 { 0x3E, "Restart" },
1055 dissect_q933_call_state_ie(tvbuff_t *tvb, int offset, int len,
1059 guint8 coding_standard;
1063 octet = tvb_get_guint8(tvb, offset);
1064 coding_standard = octet & 0x60;
1065 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
1066 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
1068 * We don't know how the call state is encoded,
1069 * so just dump it as data and be done with it.
1071 proto_tree_add_text(tree, tvb, offset,
1073 tvb_bytes_to_str(tvb, offset, len));
1076 proto_tree_add_text(tree, tvb, offset, 1,
1078 val_to_str(octet & 0x3F, q933_call_state_vals,
1079 "Unknown (0x%02X)"));
1083 * Dissect a Channel identification information element.
1085 #define Q933_INTERFACE_IDENTIFIED 0x40
1086 #define Q933_NOT_BASIC_CHANNEL 0x20
1088 static const value_string q933_basic_channel_selection_vals[] = {
1089 { 0x00, "No channel" },
1090 { 0x01, "B1 channel" },
1091 { 0x02, "B2 channel" },
1092 { 0x03, "Any channel" },
1096 static const value_string q933_not_basic_channel_selection_vals[] = {
1097 { 0x00, "No channel" },
1098 { 0x01, "Channel indicated in following octets" },
1099 { 0x03, "Any channel" },
1103 #define Q933_IS_SLOT_MAP 0x10
1105 static const value_string q933_element_type_vals[] = {
1106 { 0x03, "B-channel units" },
1107 { 0x06, "H0-channel units" },
1108 { 0x08, "H11-channel units" },
1109 { 0x09, "H12-channel units" },
1114 dissect_q933_channel_identification_ie(tvbuff_t *tvb, int offset, int len,
1118 int identifier_offset;
1120 guint8 coding_standard;
1124 octet = tvb_get_guint8(tvb, offset);
1125 proto_tree_add_text(tree, tvb, offset, 1,
1126 "Interface %s identified",
1127 (octet & Q933_INTERFACE_IDENTIFIED) ? "explicitly" : "implicitly");
1128 proto_tree_add_text(tree, tvb, offset, 1,
1130 (octet & Q933_NOT_BASIC_CHANNEL) ? "Not basic" : "Basic");
1131 proto_tree_add_text(tree, tvb, offset, 1,
1132 "Indicated channel is %s",
1133 (octet & 0x08) ? "required" : "preferred");
1134 proto_tree_add_text(tree, tvb, offset, 1,
1135 "Indicated channel is %sthe D-channel",
1136 (octet & 0x04) ? "" : "not ");
1137 if (octet & Q933_NOT_BASIC_CHANNEL) {
1138 proto_tree_add_text(tree, tvb, offset, 1,
1139 "Channel selection: %s",
1140 val_to_str(octet & 0x03, q933_not_basic_channel_selection_vals,
1143 proto_tree_add_text(tree, tvb, offset, 1,
1144 "Channel selection: %s",
1145 val_to_str(octet & 0x03, q933_basic_channel_selection_vals,
1151 if (octet & Q933_INTERFACE_IDENTIFIED) {
1152 identifier_offset = offset;
1157 octet = tvb_get_guint8(tvb, offset);
1161 } while (!(octet & Q933_IE_VL_EXTENSION));
1164 * XXX - do we want to strip off the 8th bit on the
1165 * last octet of the interface identifier?
1167 if (identifier_len != 0) {
1168 proto_tree_add_text(tree, tvb, identifier_offset,
1169 identifier_len, "Interface identifier: %s",
1171 tvb_get_ptr(tvb, identifier_offset, identifier_len),
1176 if (octet & Q933_NOT_BASIC_CHANNEL) {
1179 octet = tvb_get_guint8(tvb, offset);
1180 coding_standard = octet & 0x60;
1181 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
1182 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
1184 * We don't know how the channel identifier is
1185 * encoded, so just dump it as data and be done
1188 proto_tree_add_text(tree, tvb, offset,
1190 tvb_bytes_to_str(tvb, offset, len));
1193 proto_tree_add_text(tree, tvb, offset, 1,
1194 "Channel is indicated by %s",
1195 (octet & Q933_IS_SLOT_MAP) ? "slot map" : "number");
1196 proto_tree_add_text(tree, tvb, offset, 1,
1198 (octet & Q933_IS_SLOT_MAP) ? "Map element" : "Channel",
1199 val_to_str(octet & 0x0F, q933_element_type_vals,
1200 "Unknown (0x%02X)"));
1203 * XXX - dump the channel number or slot map.
1209 * Dissect a Progress indicator information element.
1211 static const value_string q933_progress_description_vals[] = {
1212 { 0x01, "Call is not end-to-end ISDN - progress information available in-band" },
1213 { 0x02, "Destination address is non-ISDN" },
1214 { 0x03, "Origination address is non-ISDN" },
1215 { 0x04, "Call has returned to the ISDN" },
1216 { 0x05, "Interworking has occurred and has resulted in a telecommunications service change" },
1217 { 0x08, "In-band information or an appropriate pattern is now available" },
1222 dissect_q933_progress_indicator_ie(tvbuff_t *tvb, int offset, int len,
1226 guint8 coding_standard;
1230 octet = tvb_get_guint8(tvb, offset);
1231 coding_standard = octet & 0x60;
1232 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
1233 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
1235 * We don't know how the progress indicator is encoded,
1236 * so just dump it as data and be done with it.
1238 proto_tree_add_text(tree, tvb, offset,
1240 tvb_bytes_to_str(tvb, offset, len));
1243 proto_tree_add_text(tree, tvb, offset, 1,
1245 val_to_str(octet & 0x0F, q933_cause_location_vals,
1252 octet = tvb_get_guint8(tvb, offset);
1253 proto_tree_add_text(tree, tvb, offset, 1,
1254 "Progress description: %s",
1255 val_to_str(octet & 0x7F, q933_progress_description_vals,
1256 "Unknown (0x%02X)"));
1260 * Dissect a Network-specific facilities or Transit network selection
1261 * information element.
1263 static const value_string q933_netid_type_vals[] = {
1264 { 0x00, "User specified" },
1265 { 0x20, "National network identification" },
1266 { 0x30, "International network identification" },
1270 static const value_string q933_netid_plan_vals[] = {
1271 { 0x00, "Unknown" },
1272 { 0x01, "Carrier Identification Code" },
1273 { 0x03, "X.121 data network identification code" },
1278 dissect_q933_ns_facilities_ie(tvbuff_t *tvb, int offset, int len,
1286 octet = tvb_get_guint8(tvb, offset);
1287 netid_len = octet & 0x7F;
1288 proto_tree_add_text(tree, tvb, offset, 1,
1289 "Network identification length: %u",
1293 if (netid_len != 0) {
1296 octet = tvb_get_guint8(tvb, offset);
1297 proto_tree_add_text(tree, tvb, offset, 1,
1298 "Type of network identification: %s",
1299 val_to_str(octet & 0x70, q933_netid_type_vals,
1300 "Unknown (0x%02X)"));
1301 proto_tree_add_text(tree, tvb, offset, 1,
1302 "Network identification plan: %s",
1303 val_to_str(octet & 0x0F, q933_netid_plan_vals,
1304 "Unknown (0x%02X)"));
1311 if (netid_len > len)
1313 if (netid_len != 0) {
1314 proto_tree_add_text(tree, tvb, offset, netid_len,
1315 "Network identification: %s",
1316 tvb_format_text(tvb, offset, netid_len));
1317 offset += netid_len;
1323 * Whatever is left is the network-specific facility
1328 proto_tree_add_text(tree, tvb, offset,
1329 len, "Network-specific facility specification: %s",
1330 tvb_bytes_to_str(tvb, offset, len));
1334 dissect_q933_guint16_value(tvbuff_t *tvb, int offset, int len,
1335 proto_tree *tree, char *label)
1343 octet = tvb_get_guint8(tvb, offset);
1344 if (octet & Q933_IE_VL_EXTENSION) {
1346 * Only one octet long - error.
1350 value = (octet & 0x3) << 14;
1357 * We've reached the end of the information element - error.
1361 octet = tvb_get_guint8(tvb, offset);
1362 if (octet & Q933_IE_VL_EXTENSION) {
1364 * Only two octets long - error.
1368 value |= (octet & 0x7F) << 7;
1375 * We've reached the end of the information element - error.
1379 octet = tvb_get_guint8(tvb, offset);
1380 if (!(octet & Q933_IE_VL_EXTENSION)) {
1382 * More than three octets long - error.
1386 value |= (octet & 0x7F);
1391 proto_tree_add_text(tree, tvb, offset, value_len, "%s: %u ms", label,
1396 proto_tree_add_text(tree, tvb, offset, len,
1397 "%s goes past end of information element", label);
1401 proto_tree_add_text(tree, tvb, offset, len, "%s isn't 3 octets long",
1407 * Dissect an End-to-end transit delay information element.
1410 dissect_q933_e2e_transit_delay_ie(tvbuff_t *tvb, int offset, int len,
1417 value_len = dissect_q933_guint16_value(tvb, offset, len, tree,
1418 "Cumulative transit delay");
1421 offset += value_len;
1426 value_len = dissect_q933_guint16_value(tvb, offset, len, tree,
1427 "Requested end-to-end transit delay");
1430 offset += value_len;
1435 value_len = dissect_q933_guint16_value(tvb, offset, len, tree,
1436 "Maximum end-to-end transit delay");
1440 * Dissect a Transit delay selection and indication information element.
1443 dissect_q933_td_selection_and_int_ie(tvbuff_t *tvb, int offset, int len,
1448 dissect_q933_guint16_value(tvb, offset, len, tree,
1453 dissect_q933_pl_binary_parameters_ie(tvbuff_t *tvb, int offset, int len,
1460 octet = tvb_get_guint8(tvb, offset);
1461 proto_tree_add_text(tree, tvb, offset, 1,
1463 (octet & 0x04) ? "No request/request denied" :
1464 "Request indicated/request accepted");
1465 proto_tree_add_text(tree, tvb, offset, 1,
1467 (octet & 0x02) ? "Link-by-link" : "End-to-end");
1471 * Dissect a Reverse charging indication information element.
1473 static const value_string q933_reverse_charging_indication_vals[] = {
1474 { 0x01, "Reverse charging requested" },
1479 dissect_q933_reverse_charge_ind_ie(tvbuff_t *tvb, int offset, int len,
1484 proto_tree_add_text(tree, tvb, offset, 1,
1485 "Reverse charging indication: %s",
1486 val_to_str(tvb_get_guint8(tvb, offset) & 0x07,
1487 q933_reverse_charging_indication_vals, "Unknown (0x%02X)"));
1491 * Dissect a (phone) number information element.
1493 static const value_string q933_number_type_vals[] = {
1495 { 0x1, "International number" },
1496 { 0x2, "National number" },
1497 { 0x3, "Network specific number" },
1498 { 0x4, "Subscriber number" },
1499 { 0x6, "Abbreviated number" },
1503 static const value_string q933_numbering_plan_vals[] = {
1504 { 0x00, "Unknown" },
1505 { 0x01, "E.164 ISDN/telephony numbering" },
1506 { 0x03, "X.121 data numbering" },
1507 { 0x04, "F.69 Telex numbering" },
1508 { 0x08, "National standard numbering" },
1509 { 0x09, "Private numbering" },
1513 static const value_string q933_presentation_indicator_vals[] = {
1514 { 0x00, "Presentation allowed" },
1515 { 0x01, "Presentation restricted" },
1516 { 0x02, "Number not available due to interworking" },
1520 static const value_string q933_screening_indicator_vals[] = {
1521 { 0x00, "User-provided, not screened" },
1522 { 0x01, "User-provided, verified and passed" },
1523 { 0x02, "User-provided, verified and failed" },
1524 { 0x03, "Network-provided" },
1528 static const value_string q933_redirection_reason_vals[] = {
1529 { 0x00, "Unknown" },
1530 { 0x01, "Call forwarding busy or called DTE busy" },
1531 { 0x02, "Call forwarding no reply" },
1532 { 0x04, "Call deflection" },
1533 { 0x09, "Called DTE out of order" },
1534 { 0x0A, "Call forwarding by the called DTE" },
1535 { 0x0F, "Call forwarding unconditional or systematic call redirection" },
1540 dissect_q933_number_ie(tvbuff_t *tvb, int offset, int len,
1541 proto_tree *tree, int hfindex)
1547 octet = tvb_get_guint8(tvb, offset);
1548 proto_tree_add_uint(tree, hf_q933_numbering_plan, tvb, offset, 1, octet);
1549 proto_tree_add_uint(tree, hf_q933_number_type, tvb, offset, 1, octet);
1550 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
1555 if (!(octet & Q933_IE_VL_EXTENSION)) {
1558 octet = tvb_get_guint8(tvb, offset);
1559 proto_tree_add_uint(tree, hf_q933_screening_ind, tvb, offset, 1, octet);
1560 proto_tree_add_uint(tree, hf_q933_presentation_ind, tvb, offset, 1, octet);
1561 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
1567 * XXX - only in a Redirecting number information element.
1569 if (!(octet & Q933_IE_VL_EXTENSION)) {
1572 octet = tvb_get_guint8(tvb, offset);
1573 proto_tree_add_text(tree, tvb, offset, 1,
1574 "Reason for redirection: %s",
1575 val_to_str(octet & 0x0F, q933_redirection_reason_vals,
1583 proto_tree_add_item(tree, hfindex, tvb, offset, len, FALSE);
1587 * Dissect a party subaddress information element.
1589 static const value_string q933_subaddress_type_vals[] = {
1590 { 0x00, "X.213/ISO 8348 Add.2 NSAP" },
1591 { 0x20, "User-specified" },
1595 static const value_string q933_odd_even_indicator_vals[] = {
1596 { 0x00, "Even number of address signals" },
1597 { 0x10, "Odd number of address signals" },
1602 dissect_q933_party_subaddr_ie(tvbuff_t *tvb, int offset, int len,
1609 octet = tvb_get_guint8(tvb, offset);
1610 proto_tree_add_text(tree, tvb, offset, 1,
1611 "Type of subaddress: %s",
1612 val_to_str(octet & 0x70, q933_subaddress_type_vals,
1613 "Unknown (0x%02X)"));
1614 proto_tree_add_text(tree, tvb, offset, 1,
1615 "Odd/even indicator: %s",
1616 val_to_str(octet & 0x10, q933_odd_even_indicator_vals,
1623 proto_tree_add_text(tree, tvb, offset, len, "Subaddress: %s",
1624 tvb_bytes_to_str(tvb, offset, len));
1628 * Dissect a High-layer compatibility information element.
1630 #define Q933_AUDIOVISUAL 0x60
1631 static const value_string q933_high_layer_characteristics_vals[] = {
1632 { 0x01, "Telephony" },
1633 { 0x04, "F.182 Facsimile Group 2/3" },
1634 { 0x21, "F.184 Facsimile Group 4 Class I" },
1635 { 0x24, "F.230 Teletex, basic and mixed mode, and F.184 Facsimile Group 4, Classes II and III" },
1636 { 0x28, "F.220 Teletex, basic and processable mode" },
1637 { 0x31, "F.200 Teletex, basic mode" },
1638 { 0x32, "F.300 and T.102 syntax-based Videotex" },
1639 { 0x33, "F.300 and T.101 international Videotex interworking" },
1640 { 0x35, "F.60 Telex" },
1641 { 0x38, "X.400 Message Handling Systems" },
1642 { 0x41, "X.200 OSI application" },
1643 { 0x42, "FTAM application" },
1644 { 0x5E, "Reserved for maintenance" },
1645 { 0x5F, "Reserved for management" },
1646 { Q933_AUDIOVISUAL, "F.720/F.821 and F.731 Profile 1a videotelephony" },
1647 { 0x61, "F.702 and F.731 Profile 1b videoconferencing" },
1648 { 0x62, "F.702 and F.731 audiographic conferencing" },
1652 static const value_string q933_audiovisual_characteristics_vals[] = {
1653 { 0x01, "Capability set of initial channel of H.221" },
1654 { 0x02, "Capability set of subsequent channel of H.221" },
1655 { 0x21, "Capability set of initial channel of an active 3.1kHz audio or speech call" },
1660 dissect_q933_high_layer_compat_ie(tvbuff_t *tvb, int offset, int len,
1664 guint8 coding_standard;
1665 guint8 characteristics;
1669 octet = tvb_get_guint8(tvb, offset);
1670 coding_standard = octet & 0x60;
1671 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
1674 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
1676 * We don't know how the call state is encoded,
1677 * so just dump it as data and be done with it.
1679 proto_tree_add_text(tree, tvb, offset,
1681 tvb_bytes_to_str(tvb, offset, len));
1687 octet = tvb_get_guint8(tvb, offset);
1688 characteristics = octet & 0x7F;
1689 proto_tree_add_text(tree, tvb, offset, 1,
1690 "High layer characteristics identification: %s",
1691 val_to_str(characteristics, q933_high_layer_characteristics_vals,
1692 "Unknown (0x%02X)"));
1696 if (!(octet & Q933_IE_VL_EXTENSION)) {
1699 octet = tvb_get_guint8(tvb, offset);
1700 if (characteristics == Q933_AUDIOVISUAL) {
1701 proto_tree_add_text(tree, tvb, offset, 1,
1702 "Extended audiovisual characteristics identification: %s",
1703 val_to_str(octet & 0x7F,
1704 q933_audiovisual_characteristics_vals,
1705 "Unknown (0x%02X)"));
1707 proto_tree_add_text(tree, tvb, offset, 1,
1708 "Extended high layer characteristics identification: %s",
1709 val_to_str(octet & 0x7F,
1710 q933_high_layer_characteristics_vals,
1711 "Unknown (0x%02X)"));
1718 * Dissect a User-user information element.
1720 #define Q933_PROTOCOL_DISCRIMINATOR_IA5 0x04
1721 #define Q933_PROTOCOL_DISCRIMINATOR_ASN1 0x05
1723 static const value_string q933_protocol_discriminator_vals[] = {
1724 { 0x00, "User-specific protocol" },
1725 { 0x01, "OSI high layer protocols" },
1727 { Q933_PROTOCOL_DISCRIMINATOR_IA5, "IA5 characters" },
1728 { Q933_PROTOCOL_DISCRIMINATOR_ASN1, "X.208 and X.209 coded user information" },
1729 { 0x07, "V.120 rate adaption" },
1730 { 0x08, "Q.933/I.451 user-network call control messages" },
1735 dissect_q933_user_user_ie(tvbuff_t *tvb, int offset, int len,
1742 octet = tvb_get_guint8(tvb, offset);
1743 proto_tree_add_text(tree, tvb, offset, 1,
1744 "Protocol discriminator: %s",
1745 val_to_str(octet, q933_protocol_discriminator_vals,
1746 "Unknown (0x%02x)"));
1754 case Q933_PROTOCOL_DISCRIMINATOR_IA5:
1755 proto_tree_add_text(tree, tvb, offset, len, "User information: %s",
1756 tvb_format_text(tvb, offset, len));
1760 proto_tree_add_text(tree, tvb, offset, len, "User information: %s",
1761 tvb_bytes_to_str(tvb, offset, len));
1767 * Dissect information elements consisting of ASCII^H^H^H^H^HIA5 text.
1770 dissect_q933_ia5_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree,
1774 proto_tree_add_text(tree, tvb, offset, len, "%s: %s", label,
1775 tvb_format_text(tvb, offset, len));
1779 static const value_string q933_codeset_vals[] = {
1780 { 0x00, "Q.933 information elements" },
1781 { 0x04, "Information elements for ISO/IEC use" },
1782 { 0x05, "Information elements for national use" },
1783 { 0x06, "Information elements specific to the local network" },
1784 { 0x07, "User-specific information elements" },
1789 dissect_q933(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1792 proto_tree *q933_tree = NULL;
1794 proto_tree *ie_tree = NULL;
1795 guint8 call_ref_len;
1796 guint8 call_ref[15];
1797 guint8 message_type;
1798 guint8 info_element;
1799 guint16 info_element_len;
1800 int codeset, locked_codeset;
1801 gboolean non_locking_shift;
1803 if (check_col(pinfo->cinfo, COL_PROTOCOL))
1804 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Q.933");
1807 ti = proto_tree_add_item(tree, proto_q933, tvb, offset, -1,
1809 q933_tree = proto_item_add_subtree(ti, ett_q933);
1811 dissect_q933_protocol_discriminator(tvb, offset, q933_tree);
1814 call_ref_len = tvb_get_guint8(tvb, offset) & 0xF; /* XXX - do as a bit field? */
1815 if (q933_tree != NULL)
1816 proto_tree_add_uint(q933_tree, hf_q933_call_ref_len, tvb, offset, 1, call_ref_len);
1818 if (call_ref_len != 0) {
1819 tvb_memcpy(tvb, call_ref, offset, call_ref_len);
1820 if (q933_tree != NULL) {
1821 proto_tree_add_boolean(q933_tree, hf_q933_call_ref_flag,
1822 tvb, offset, 1, (call_ref[0] & 0x80) != 0);
1823 call_ref[0] &= 0x7F;
1824 proto_tree_add_bytes(q933_tree, hf_q933_call_ref,
1825 tvb, offset, call_ref_len, call_ref);
1827 offset += call_ref_len;
1829 message_type = tvb_get_guint8(tvb, offset);
1830 if (check_col(pinfo->cinfo, COL_INFO)) {
1831 col_add_str(pinfo->cinfo, COL_INFO,
1832 val_to_str(message_type, q933_message_type_vals,
1833 "Unknown message type (0x%02X)"));
1835 if (q933_tree != NULL)
1836 proto_tree_add_uint(q933_tree, hf_q933_message_type, tvb, offset, 1, message_type);
1840 * And now for the information elements....
1842 codeset = locked_codeset = 0; /* start out in codeset 0 */
1843 non_locking_shift = TRUE;
1844 while (tvb_reported_length_remaining(tvb, offset) > 0) {
1845 info_element = tvb_get_guint8(tvb, offset);
1847 /* Check for the codeset shift */
1848 if ((info_element & Q933_IE_SO_MASK) &&
1849 ((info_element & Q933_IE_SO_IDENTIFIER_MASK) == Q933_IE_SHIFT)) {
1850 non_locking_shift = info_element & Q933_IE_SHIFT_NON_LOCKING;
1851 codeset = info_element & Q933_IE_SHIFT_CODESET;
1852 if (!non_locking_shift)
1853 locked_codeset = codeset;
1854 if (q933_tree != NULL) {
1855 proto_tree_add_text(q933_tree, tvb, offset, 1,
1856 "%s shift to codeset %u: %s",
1857 (non_locking_shift ? "Non-locking" : "Locking"),
1859 val_to_str(codeset, q933_codeset_vals,
1860 "Unknown (0x%02X)"));
1867 * Check for the single-octet IEs.
1869 if (info_element & Q933_IE_SO_MASK) {
1870 switch ((codeset << 8) | (info_element & Q933_IE_SO_IDENTIFIER_MASK)) {
1872 case CS0 | Q933_IE_REPEAT_INDICATOR:
1873 if (q933_tree != NULL) {
1874 proto_tree_add_text(q933_tree, tvb, offset, 1,
1875 "Repeat indicator: %s",
1876 val_to_str(info_element & Q933_IE_SO_IE_MASK,
1877 q933_repeat_indication_vals,
1883 if (q933_tree != NULL) {
1884 proto_tree_add_text(q933_tree, tvb, offset, 1,
1885 "Unknown information element (0x%02X)",
1891 codeset = locked_codeset;
1896 * Variable-length IE.
1898 info_element_len = tvb_get_guint8(tvb, offset + 1);
1899 if (q933_tree != NULL) {
1900 ti = proto_tree_add_text(q933_tree, tvb, offset,
1901 1+1+info_element_len, "%s",
1902 val_to_str(info_element, q933_info_element_vals[codeset],
1903 "Unknown information element (0x%02X)"));
1904 ie_tree = proto_item_add_subtree(ti, ett_q933_ie);
1905 proto_tree_add_text(ie_tree, tvb, offset, 1,
1906 "Information element: %s",
1907 val_to_str(info_element, q933_info_element_vals[codeset],
1908 "Unknown (0x%02X)"));
1909 proto_tree_add_text(ie_tree, tvb, offset + 1, 1,
1910 "Length: %u", info_element_len);
1912 switch ((codeset << 8) | info_element) {
1914 case CS0 | Q933_IE_SEGMENTED_MESSAGE:
1915 dissect_q933_segmented_message_ie(tvb,
1916 offset + 2, info_element_len,
1920 case CS0 | Q933_IE_BEARER_CAPABILITY:
1921 case CS0 | Q933_IE_LOW_LAYER_COMPAT:
1922 dissect_q933_bearer_capability_ie(tvb,
1923 offset + 2, info_element_len,
1927 case CS0 | Q933_IE_CAUSE:
1928 dissect_q933_cause_ie(tvb,
1929 offset + 2, info_element_len,
1931 hf_q933_cause_value);
1934 case CS0 | Q933_IE_CALL_STATE:
1935 dissect_q933_call_state_ie(tvb,
1936 offset + 2, info_element_len,
1940 case CS0 | Q933_IE_CHANNEL_IDENTIFICATION:
1941 dissect_q933_channel_identification_ie(
1942 tvb, offset + 2, info_element_len,
1946 case CS0 | Q933_IE_PROGRESS_INDICATOR:
1947 dissect_q933_progress_indicator_ie(tvb,
1948 offset + 2, info_element_len,
1952 case CS0 | Q933_IE_NETWORK_SPECIFIC_FACIL:
1953 case CS0 | Q933_IE_TRANSIT_NETWORK_SEL:
1954 dissect_q933_ns_facilities_ie(tvb,
1955 offset + 2, info_element_len,
1959 case CS0 | Q933_IE_DISPLAY:
1960 dissect_q933_ia5_ie(tvb, offset + 2,
1961 info_element_len, ie_tree,
1962 "Display information");
1965 case CS0 | Q933_IE_E2E_TRANSIT_DELAY:
1966 dissect_q933_e2e_transit_delay_ie(tvb,
1967 offset + 2, info_element_len,
1971 case CS0 | Q933_IE_TD_SELECTION_AND_INT:
1972 dissect_q933_td_selection_and_int_ie(
1973 tvb, offset + 2, info_element_len,
1977 case CS0 | Q933_IE_PL_BINARY_PARAMETERS:
1978 dissect_q933_pl_binary_parameters_ie(
1979 tvb, offset + 2, info_element_len,
1983 case CS0 | Q933_IE_REVERSE_CHARGE_IND:
1984 dissect_q933_reverse_charge_ind_ie(tvb,
1985 offset + 2, info_element_len,
1989 case CS0 | Q933_IE_CALLING_PARTY_NUMBER:
1990 dissect_q933_number_ie(tvb,
1991 offset + 2, info_element_len,
1993 hf_q933_calling_party_number);
1996 case CS0 | Q933_IE_CONNECTED_NUMBER:
1997 dissect_q933_number_ie(tvb,
1998 offset + 2, info_element_len,
2000 hf_q933_connected_number);
2003 case CS0 | Q933_IE_CALLED_PARTY_NUMBER:
2004 dissect_q933_number_ie(tvb,
2005 offset + 2, info_element_len,
2007 hf_q933_called_party_number);
2010 case CS0 | Q933_IE_CALLING_PARTY_SUBADDR:
2011 case CS0 | Q933_IE_CALLED_PARTY_SUBADDR:
2012 dissect_q933_party_subaddr_ie(tvb,
2013 offset + 2, info_element_len,
2017 case CS0 | Q933_IE_HIGH_LAYER_COMPAT:
2018 dissect_q933_high_layer_compat_ie(tvb,
2019 offset + 2, info_element_len,
2023 case CS0 | Q933_IE_USER_USER:
2024 dissect_q933_user_user_ie(tvb,
2025 offset + 2, info_element_len,
2030 proto_tree_add_text(ie_tree, tvb,
2031 offset + 2, info_element_len,
2034 tvb_get_ptr(tvb, offset + 2,
2040 offset += 1 + 1 + info_element_len;
2041 codeset = locked_codeset;
2046 proto_register_q933(void)
2048 static hf_register_info hf[] = {
2049 { &hf_q933_discriminator,
2050 { "Protocol discriminator", "q933.disc", FT_UINT8, BASE_HEX, NULL, 0x0,
2053 { &hf_q933_call_ref_flag,
2054 { "Call reference flag", "q933.call_ref_flag", FT_BOOLEAN, BASE_NONE, TFS(&tfs_call_ref_flag), 0x0,
2057 { &hf_q933_call_ref,
2058 { "Call reference value", "q933.call_ref", FT_BYTES, BASE_HEX, NULL, 0x0,
2062 { &hf_q933_coding_standard,
2063 { "Coding standard", "q933.coding_standard", FT_UINT8, BASE_HEX,
2064 VALS(q933_coding_standard_vals), 0x60,"", HFILL }},
2066 { &hf_q933_information_transfer_capability,
2067 { "Information transfer capability", "q933.information_transfer_capability", FT_UINT8, BASE_HEX,
2068 VALS(q933_information_transfer_capability_vals), 0x1f,"", HFILL }},
2070 { &hf_q933_transfer_mode,
2071 { "Transfer mode", "q933.transfer_mode", FT_UINT8, BASE_HEX,
2072 VALS(q933_transfer_mode_vals), 0x60,"", HFILL }},
2075 { "User information layer 1 protocol", "q933.uil1", FT_UINT8, BASE_HEX,
2076 VALS(q933_uil1_vals), 0x1f,"", HFILL }},
2078 { &hf_q933_call_ref_len,
2079 { "Call reference value length", "q933.call_ref_len", FT_UINT8, BASE_DEC, NULL, 0x0,
2082 { &hf_q933_message_type,
2083 { "Message type", "q933.message_type", FT_UINT8, BASE_HEX, VALS(q933_message_type_vals), 0x0,
2086 { &hf_q933_cause_location,
2087 { "Cause location", "q933.cause_location", FT_UINT8, BASE_DEC, VALS(q933_cause_location_vals), 0x0f,
2090 { &hf_q933_cause_value,
2091 { "Cause value", "q933.cause_value", FT_UINT8, BASE_DEC, VALS(q933_cause_code_vals), 0x7f,
2094 { &hf_q933_number_type,
2095 { "Number type", "q933.number_type", FT_UINT8, BASE_HEX, VALS(q933_number_type_vals), 0x70,
2098 { &hf_q933_numbering_plan,
2099 { "numbering plan", "q933.numbering_plan", FT_UINT8, BASE_HEX, VALS(q933_numbering_plan_vals), 0x0f,
2102 { &hf_q933_screening_ind,
2103 { "Screening indicator", "q933.screening_ind", FT_UINT8, BASE_HEX, VALS(q933_screening_indicator_vals), 0x03,
2106 { &hf_q933_presentation_ind,
2107 { "Presentation indicator", "q933.presentation_ind", FT_UINT8, BASE_HEX, VALS(q933_presentation_indicator_vals), 0x60,
2110 { &hf_q933_extension_ind,
2111 { "Extension indicator", "q933.extension_ind",
2112 FT_BOOLEAN, 8, TFS(&q933_extension_ind_value), 0x80,
2115 { &hf_q933_calling_party_number,
2116 { "Calling party number digits", "q933.calling_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2119 { &hf_q933_called_party_number,
2120 { "Called party number digits", "q933.called_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2123 { &hf_q933_connected_number,
2124 { "Connected party number digits", "q933.connected_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2127 { &hf_q933_redirecting_number,
2128 { "Redirecting party number digits", "q933.redirecting_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2131 static gint *ett[] = {
2136 proto_q933 = proto_register_protocol("Q.933", "Q.933", "q933");
2137 proto_register_field_array (proto_q933, hf, array_length(hf));
2138 proto_register_subtree_array(ett, array_length(ett));
2140 register_dissector("q933", dissect_q933, proto_q933);
2144 proto_reg_handoff_q933(void)
2146 dissector_handle_t q933_handle;
2148 q933_handle = create_dissector_handle(dissect_q933, proto_q933);
2149 dissector_add("fr.osinl", NLPID_Q_933, q933_handle);