2 * Routines for Q.933 frame disassembly
3 * Guy Harris <guy@alum.mit.edu>
5 * $Id: packet-q933.c,v 1.4 2003/11/03 20:57:36 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_value = -1;
48 static int hf_q933_number_type = -1;
49 static int hf_q933_numbering_plan = -1;
50 static int hf_q933_extension_ind = -1;
51 static int hf_q933_calling_party_number = -1;
52 static int hf_q933_called_party_number = -1;
53 static int hf_q933_connected_number = -1;
54 static int hf_q933_redirecting_number = -1;
56 static gint ett_q933 = -1;
57 static gint ett_q933_ie = -1;
60 * Q.933 message types.
62 #define Q933_ESCAPE 0x00
63 #define Q933_ALERTING 0x01
64 #define Q933_CALL_PROCEEDING 0x02
65 #define Q933_CONNECT 0x07
66 #define Q933_CONNECT_ACK 0x0F
67 #define Q933_PROGRESS 0x03
68 #define Q933_SETUP 0x05
69 #define Q933_DISCONNECT 0x45
70 #define Q933_RELEASE 0x4D
71 #define Q933_RELEASE_COMPLETE 0x5A
72 #define Q933_SEGMENT 0x60
73 #define Q933_STATUS 0x7D
74 #define Q933_STATUS_ENQUIRY 0x75
76 static const value_string q933_message_type_vals[] = {
77 { Q933_ESCAPE, "ESCAPE" },
78 { Q933_ALERTING, "ALERTING" },
79 { Q933_CALL_PROCEEDING, "CALL PROCEEDING" },
80 { Q933_CONNECT, "CONNECT" },
81 { Q933_CONNECT_ACK, "CONNECT ACKNOWLEDGE" },
82 { Q933_PROGRESS, "PROGRESS" },
83 { Q933_SETUP, "SETUP" },
84 { Q933_DISCONNECT, "DISCONNECT" },
85 { Q933_RELEASE, "RELEASE" },
86 { Q933_RELEASE_COMPLETE, "RELEASE COMPLETE" },
87 { Q933_SEGMENT, "SEGMENT" },
88 { Q933_STATUS, "STATUS" },
89 { Q933_STATUS_ENQUIRY, "STATUS ENQUIRY" },
93 static const true_false_string tfs_call_ref_flag = {
94 "Message sent to originating side",
95 "Message sent from originating side"
99 * Information elements.
102 /* Shifted codeset values */
112 #define Q933_IE_SO_MASK 0x80 /* single-octet/variable-length mask */
116 #define Q933_IE_SO_IDENTIFIER_MASK 0xf0 /* IE identifier mask */
117 #define Q933_IE_SO_IDENTIFIER_SHIFT 4 /* IE identifier shift */
118 #define Q933_IE_SO_IE_MASK 0x0F /* IE mask */
120 #define Q933_IE_SHIFT 0x90
121 #define Q933_IE_SHIFT_NON_LOCKING 0x08 /* non-locking shift */
122 #define Q933_IE_SHIFT_CODESET 0x0F /* codeset */
124 #define Q933_IE_REPEAT_INDICATOR 0xD0
127 * Variable-length IEs.
129 #define Q933_IE_VL_EXTENSION 0x80 /* Extension flag */
130 /* extension bit. The bit value "0" indicates that the octet continues through the */
131 /* next octet. The bit value "1" indicates that this octet is the last octet */
133 static const true_false_string q933_extension_ind_value = {
135 "information continues through the next octet",
141 * Codeset 0 (default).
143 #define Q933_IE_SEGMENTED_MESSAGE 0x00
144 #define Q933_IE_BEARER_CAPABILITY 0x04
145 #define Q933_IE_CAUSE 0x08
146 #define Q933_IE_CALL_STATE 0x14
147 #define Q933_IE_CHANNEL_IDENTIFICATION 0x18
148 #define Q933_IE_DLCI 0x19
149 #define Q933_IE_PROGRESS_INDICATOR 0x1E
150 #define Q933_IE_NETWORK_SPECIFIC_FACIL 0x20 /* Network Specific Facilities */
151 #define Q933_IE_DISPLAY 0x28
152 #define Q933_IE_E2E_TRANSIT_DELAY 0x42 /* End-to-end Transit Delay */
153 #define Q933_IE_TD_SELECTION_AND_INT 0x43 /* Transit Delay Selection and Indication */
154 #define Q933_IE_PL_BINARY_PARAMETERS 0x44 /* Packet layer binary parameters */
155 #define Q933_IE_LL_CORE_PARAMETERS 0x48 /* Link layer core parameters */
156 #define Q933_IE_LL_PROTOCOL_PARAMETERS 0x49 /* Link layer protocol parameters */
157 #define Q933_IE_REVERSE_CHARGE_IND 0x4A /* Reverse charging indication */
158 #define Q933_IE_CONNECTED_NUMBER 0x4C /* Connected Number */
159 #define Q933_IE_CONNECTED_SUBADDR 0x4D /* Connected sub-address */
160 #define Q933_IE_X_213_PRIORITY 0x50 /* X.213 priority */
161 #define Q933_IE_REPORT_TYPE 0x51
162 #define Q933_IE_LINK_INTEGRITY_VERF 0x53 /* Link integrity verification */
163 #define Q933_IE_PVC_STATUS 0x57
164 #define Q933_IE_CALLING_PARTY_NUMBER 0x6C /* Calling Party Number */
165 #define Q933_IE_CALLING_PARTY_SUBADDR 0x6D /* Calling Party Subaddress */
166 #define Q933_IE_CALLED_PARTY_NUMBER 0x70 /* Called Party Number */
167 #define Q933_IE_CALLED_PARTY_SUBADDR 0x71 /* Called Party Subaddress */
168 #define Q933_IE_TRANSIT_NETWORK_SEL 0x78 /* Transit Network Selection */
169 #define Q933_IE_LOW_LAYER_COMPAT 0x7C /* Low-Layer Compatibility */
170 #define Q933_IE_HIGH_LAYER_COMPAT 0x7D /* High-Layer Compatibility */
171 #define Q933_IE_USER_USER 0x7E /* User-User */
172 #define Q933_IE_ESCAPE 0x7F /* Escape for extension */
175 static const value_string q933_info_element_vals0[] = {
176 { Q933_IE_SEGMENTED_MESSAGE, "Segmented message" },
177 { Q933_IE_BEARER_CAPABILITY, "Bearer capability" },
178 { Q933_IE_CAUSE, "Cause" },
179 { Q933_IE_CALL_STATE, "Call state" },
180 { Q933_IE_CHANNEL_IDENTIFICATION, "Channel identification" },
181 { Q933_IE_DLCI, "Data link connection identifier" },
182 { Q933_IE_PROGRESS_INDICATOR, "Progress indicator" },
183 { Q933_IE_NETWORK_SPECIFIC_FACIL, "Network specific facilities" },
184 { Q933_IE_E2E_TRANSIT_DELAY, "End-to-end transit delay" },
185 { Q933_IE_TD_SELECTION_AND_INT, "Transit delay selection and indication" },
186 { Q933_IE_PL_BINARY_PARAMETERS, "Packet layer binary parameters" },
187 { Q933_IE_LL_CORE_PARAMETERS, "Link layer core parameters" },
188 { Q933_IE_LL_PROTOCOL_PARAMETERS, "Link layer protocol parameters" },
189 { Q933_IE_REVERSE_CHARGE_IND, "Reverse charging indication" },
190 { Q933_IE_CONNECTED_NUMBER, "Connected number" },
191 { Q933_IE_CONNECTED_SUBADDR, "Connected subaddress" },
192 { Q933_IE_X_213_PRIORITY, "X.213 priority" },
193 { Q933_IE_REPORT_TYPE, "Report type" },
194 { Q933_IE_LINK_INTEGRITY_VERF, "Link integrity verification" },
195 { Q933_IE_PVC_STATUS, "PVC status" },
196 { Q933_IE_CALLING_PARTY_NUMBER, "Calling party number" },
197 { Q933_IE_CALLING_PARTY_SUBADDR, "Calling party subaddress" },
198 { Q933_IE_CALLED_PARTY_NUMBER, "Called party number" },
199 { Q933_IE_CALLED_PARTY_SUBADDR, "Called party subaddress" },
200 { Q933_IE_TRANSIT_NETWORK_SEL, "Transit network selection" },
201 { Q933_IE_LOW_LAYER_COMPAT, "Low-layer compatibility" },
202 { Q933_IE_HIGH_LAYER_COMPAT, "High-layer compatibility" },
203 { Q933_IE_USER_USER, "User-user" },
204 { Q933_IE_ESCAPE, "Escape" },
208 static const value_string q933_info_element_vals1[] = {
212 static const value_string q933_info_element_vals2[] = {
216 static const value_string q933_info_element_vals3[] = {
220 static const value_string q933_info_element_vals4[] = {
224 static const value_string q933_info_element_vals5[] = {
228 static const value_string q933_info_element_vals6[] = {
232 static const value_string q933_info_element_vals7[] = {
237 static const value_string *q933_info_element_vals[] = {
238 q933_info_element_vals0,
239 q933_info_element_vals1,
240 q933_info_element_vals2,
241 q933_info_element_vals3,
242 q933_info_element_vals4,
243 q933_info_element_vals5,
244 q933_info_element_vals6,
245 q933_info_element_vals7,
248 static const value_string q933_repeat_indication_vals[] = {
249 { 0x2, "Prioritized list" },
254 * ITU-standardized coding.
256 #define Q933_ITU_STANDARDIZED_CODING 0x00
259 * Dissect a Segmented message information element.
262 dissect_q933_segmented_message_ie(tvbuff_t *tvb, int offset, int len,
266 proto_tree_add_text(tree, tvb, offset, len,
267 "Segmented message: length is %d, should be 2\n", len);
270 if (tvb_get_guint8(tvb, offset) & 0x80) {
271 proto_tree_add_text(tree, tvb, offset, 1,
272 "First segment: %u segments remaining",
273 tvb_get_guint8(tvb, offset) & 0x7F);
275 proto_tree_add_text(tree, tvb, offset, 1,
276 "Not first segment: %u segments remaining",
277 tvb_get_guint8(tvb, offset) & 0x7F);
279 proto_tree_add_text(tree, tvb, offset + 1, 1,
280 "Segmented message type: %u\n", tvb_get_guint8(tvb, offset + 1));
284 * Dissect a Bearer capability or Low-layer compatibility information element.
286 static const value_string q933_coding_standard_vals[] = {
287 { 0x0, "ITU-T standardized coding" },
288 { 0x1, "ISO/IEC standard" },
289 { 0x2, "National standard" },
290 { 0x3, "Standard defined for this particular network" },
294 static const value_string q933_information_transfer_capability_vals[] = {
295 { 0x08, "Unrestricted digital information" },
299 static const value_string q933_transfer_mode_vals[] = {
300 { 0x01, "Frame mode" },
304 static const value_string q933_uil1_vals[] = {
305 { 0x01, "V.110/I.460/X.30 rate adaption" },
306 { 0x02, "Recommendation G.711 u-law" },
307 { 0x03, "Recommendation G.711 A-law" },
308 { 0x04, "Recommendation G.721 32 kbit/s ADPCM and Recommendation I.460" },
309 { 0x05, "Recommendation H.221 and H.242" },
310 { 0x06, "Recommendation H.223 and H.245" },
311 { 0x07, "Non-ITU-T-standardized rate adaption" },
312 { 0x08, "V.120 rate adaption" },
313 { 0x09, "X.31 HDLC flag stuffing" },
317 static const value_string q933_l1_user_rate_vals[] = {
318 { 0x00, "Rate indicated by E-bits" },
319 { 0x01, "0.6 kbit/s" },
320 { 0x02, "1.2 kbit/s" },
321 { 0x03, "2.4 kbit/s" },
322 { 0x04, "3.6 kbit/s" },
323 { 0x05, "4.8 kbit/s" },
324 { 0x06, "7.2 kbit/s" },
325 { 0x07, "8 kbit/s" },
326 { 0x08, "9.6 kbit/s" },
327 { 0x09, "14.4 kbit/s" },
328 { 0x0A, "16 kbit/s" },
329 { 0x0B, "19.2 kbit/s" },
330 { 0x0C, "32 kbit/s" },
331 { 0x0E, "48 kbit/s" },
332 { 0x0F, "56 kbit/s" },
333 { 0x10, "64 kbit/s "},
334 { 0x15, "0.1345 kbit/s" },
335 { 0x16, "0.100 kbit/s" },
336 { 0x17, "0.075/1.2 kbit/s" },
337 { 0x18, "1.2/0.075 kbit/s" },
338 { 0x19, "0.050 kbit/s" },
339 { 0x1A, "0.075 kbit/s" },
340 { 0x1B, "0.110 kbit/s" },
341 { 0x1C, "0.150 kbit/s" },
342 { 0x1D, "0.200 kbit/s" },
343 { 0x1E, "0.300 kbit/s" },
344 { 0x1F, "12 kbit/s" },
348 static const value_string q933_l1_stop_bits_vals[] = {
355 static const value_string q933_l1_data_bits_vals[] = {
362 static const value_string q933_l1_parity_vals[] = {
366 { 0x04, "Forced to 0" },
367 { 0x05, "Forced to 1" },
371 #define Q933_UIL2_USER_SPEC 0x10
373 static const value_string q933_uil2_vals[] = {
374 { 0x01, "Basic mode ISO 1745" },
375 { 0x06, "X.25, link level" },
376 { 0x07, "X.25 multilink" },
377 { 0x08, "T.71 Extended LAPB" },
378 { 0x09, "HDLC ARM" },
379 { 0x0A, "HDLC NRM" },
380 { 0x0B, "HDLC ABM" },
381 { 0x0C, "ISO 8802/2 LLC" },
382 { 0x0D, "X.75 Single Link Procedure" },
384 { 0x0F, "Core aspects of Q.922" },
385 { Q933_UIL2_USER_SPEC, "User-specified" },
386 { 0x11, "ISO 7776 DTE-DTE operation" },
390 static const value_string q933_address_inclusion_vals[] = {
391 { 0x01, "Address included" },
392 { 0x02, "Encapsulation of logical control frame" },
396 static const value_string q933_mode_vals[] = {
397 { 0x20, "Normal mode" },
398 { 0x40, "Extended mode" },
402 #define Q933_UIL3_X25_PL 0x06
403 #define Q933_UIL3_ISO_8208 0x07 /* X.25-based */
404 #define Q933_UIL3_X223 0x08 /* X.25-based */
405 #define Q933_UIL3_TR_9577 0x0B
406 #define Q933_UIL3_USER_SPEC 0x10
408 static const value_string q933_uil3_vals[] = {
409 { Q933_UIL3_X25_PL, "X.25, packet layer" },
410 { Q933_UIL3_ISO_8208, "ISO/IEC 8208" },
411 { Q933_UIL3_X223, "X.223/ISO 8878" },
412 { 0x09, "ISO/IEC 8473" },
414 { Q933_UIL3_TR_9577, "ISO/IEC TR 9577" },
415 { Q933_UIL3_USER_SPEC, "User-specified" },
420 dissect_q933_protocol_discriminator(tvbuff_t *tvb, int offset, proto_tree *tree)
422 unsigned int discriminator = tvb_get_guint8(tvb, offset);
424 if (discriminator == NLPID_Q_933) {
425 proto_tree_add_uint_format(tree, hf_q933_discriminator,
426 tvb, offset, 1, discriminator,
427 "Protocol discriminator: Q.933");
428 } else if (discriminator == NLPID_Q_2931) {
429 proto_tree_add_uint_format(tree, hf_q933_discriminator,
430 tvb, offset, 1, discriminator,
431 "Protocol discriminator: Q.2931");
432 } else if ((discriminator >= 16 && discriminator < 63)
433 || ((discriminator >= 80) && (discriminator < 254))) {
434 proto_tree_add_uint_format(tree, hf_q933_discriminator,
435 tvb, offset, 1, discriminator,
436 "Protocol discriminator: Network layer or layer 3 protocol (0x%02X)",
438 } else if (discriminator >= 64 && discriminator <= 79) {
439 proto_tree_add_uint_format(tree, hf_q933_discriminator,
440 tvb, offset, 1, discriminator,
441 "Protocol discriminator: National use (0x%02X)",
444 proto_tree_add_uint_format(tree, hf_q933_discriminator,
445 tvb, offset, 1, discriminator,
446 "Protocol discriminator: Reserved (0x%02X)",
452 dissect_q933_bearer_capability_ie(tvbuff_t *tvb, int offset, int len,
456 guint8 coding_standard;
458 guint8 uil2_protocol;
459 guint8 uil3_protocol;
464 octet = tvb_get_guint8(tvb, offset);
465 coding_standard = octet & 0x60;
466 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
468 * We don't know how the bearer capability is encoded,
469 * so just dump it as data and be done with it.
471 proto_tree_add_text(tree, tvb, offset,
473 tvb_bytes_to_str(tvb, offset, len));
474 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
475 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
478 proto_tree_add_uint(tree, hf_q933_information_transfer_capability, tvb, offset, 1, octet);
479 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
480 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
485 * XXX - only in Low-layer compatibility information element.
487 if (!(octet & Q933_IE_VL_EXTENSION)) {
490 octet = tvb_get_guint8(tvb, offset);
491 proto_tree_add_text(tree, tvb, offset, 1,
492 "Out-band negotiation %spossible",
493 (octet & 0x40) ? "" : "not ");
500 octet = tvb_get_guint8(tvb, offset);
501 proto_tree_add_uint(tree, hf_q933_transfer_mode, tvb, offset, 1, octet);
502 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
508 octet = tvb_get_guint8(tvb, offset);
509 if ((octet & 0x60) == 0x20) {
511 * Layer 1 information.
513 proto_tree_add_uint(tree, hf_q933_uil1, tvb, offset, 1, octet);
514 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
518 if (octet & Q933_IE_VL_EXTENSION)
522 octet = tvb_get_guint8(tvb, offset);
523 proto_tree_add_text(tree, tvb, offset, 1,
525 (octet & 0x40) ? "Asynchronous" : "Synchronous");
526 proto_tree_add_text(tree, tvb, offset, 1,
528 val_to_str(octet & 0x1F, q933_l1_user_rate_vals,
529 "Unknown (0x%02X)"));
533 if (octet & Q933_IE_VL_EXTENSION)
537 octet = tvb_get_guint8(tvb, offset);
538 proto_tree_add_text(tree, tvb, offset, 1,
539 "Rate adaption header %sincluded",
540 (octet & 0x40) ? "" : "not ");
541 proto_tree_add_text(tree, tvb, offset, 1,
542 "Multiple frame establishment %ssupported",
543 (octet & 0x20) ? "" : "not ");
544 proto_tree_add_text(tree, tvb, offset, 1,
545 "%s mode of operation",
546 (octet & 0x10) ? "Protocol sensitive" : "Bit transparent");
550 if (octet & Q933_IE_VL_EXTENSION)
554 octet = tvb_get_guint8(tvb, offset);
555 proto_tree_add_text(tree, tvb, offset, 1,
557 val_to_str(octet & 0x60, q933_l1_stop_bits_vals,
559 proto_tree_add_text(tree, tvb, offset, 1,
561 val_to_str(octet & 0x18, q933_l1_data_bits_vals,
563 proto_tree_add_text(tree, tvb, offset, 1,
565 val_to_str(octet & 0x07, q933_l1_parity_vals,
568 if (octet & Q933_IE_VL_EXTENSION)
572 octet = tvb_get_guint8(tvb, offset);
573 proto_tree_add_text(tree, tvb, offset, 1,
575 (octet & 0x40) ? "Full" : "Half");
576 modem_type = octet & 0x3F;
577 proto_tree_add_text(tree, tvb, offset, 1,
578 "Modem type: Network-specific rules 0x%02X", modem_type);
587 octet = tvb_get_guint8(tvb, offset);
588 if ((octet & 0x60) == 0x40) {
590 * Layer 2 information.
592 uil2_protocol = octet & 0x1F;
593 proto_tree_add_text(tree, tvb, offset, 1,
594 "User information layer 2 protocol: %s",
595 val_to_str(uil2_protocol, q933_uil2_vals,
596 "Unknown (0x%02X)"));
601 * XXX - only in Low-layer compatibility information element.
603 if (octet & Q933_IE_VL_EXTENSION)
607 octet = tvb_get_guint8(tvb, offset);
608 if (uil2_protocol == Q933_UIL2_USER_SPEC) {
609 proto_tree_add_text(tree, tvb, offset, 1,
610 "User-specified layer 2 protocol information: 0x%02X",
613 proto_tree_add_text(tree, tvb, offset, 1,
614 "Address inclusion: %s",
615 val_to_str(octet & 0x03, q933_address_inclusion_vals,
616 "Unknown (0x%02X)"));
626 octet = tvb_get_guint8(tvb, offset);
627 if ((octet & 0x60) == 0x60) {
629 * Layer 3 information.
631 uil3_protocol = octet & 0x1F;
632 proto_tree_add_text(tree, tvb, offset, 1,
633 "User information layer 3 protocol: %s",
634 val_to_str(uil3_protocol, q933_uil3_vals,
635 "Unknown (0x%02X)"));
641 * XXX - only in Low-layer compatibility information element.
643 if (octet & Q933_IE_VL_EXTENSION)
647 octet = tvb_get_guint8(tvb, offset);
648 switch (uil3_protocol) {
650 case Q933_UIL3_X25_PL:
651 case Q933_UIL3_ISO_8208:
653 proto_tree_add_text(tree, tvb, offset, 1,
655 val_to_str(octet & 0x60, q933_mode_vals,
656 "Unknown (0x%02X)"));
660 if (octet & Q933_IE_VL_EXTENSION)
664 octet = tvb_get_guint8(tvb, offset);
665 proto_tree_add_text(tree, tvb, offset, 1,
666 "Default packet size: %u", octet & 0x0F);
670 if (octet & Q933_IE_VL_EXTENSION)
674 octet = tvb_get_guint8(tvb, offset);
675 proto_tree_add_text(tree, tvb, offset, 1,
676 "Packet window size: %u", octet & 0x7F);
681 case Q933_UIL3_USER_SPEC:
682 proto_tree_add_text(tree, tvb, offset, 1,
683 "Default packet size: %u octets",
684 1 << (octet & 0x0F));
689 case Q933_UIL3_TR_9577:
690 add_l3_info = (octet & 0x0F) << 4;
691 if (octet & Q933_IE_VL_EXTENSION)
695 octet = tvb_get_guint8(tvb, offset + 1);
696 add_l3_info |= (octet & 0x0F);
697 proto_tree_add_text(tree, tvb, offset, 2,
698 "Additional layer 3 protocol information: %s",
699 val_to_str(add_l3_info, nlpid_vals,
700 "Unknown (0x%02X)"));
711 * Dissect a Cause information element.
715 const value_string q933_cause_location_vals[] = {
716 { 0x00, "User (U)" },
717 { 0x01, "Private network serving the local user (LPN)" },
718 { 0x02, "Public network serving the local user (LN)" },
719 { 0x03, "Transit network (TN)" },
720 { 0x04, "Public network serving the remote user (RLN)" },
721 { 0x05, "Private network serving the remote user (RPN)" },
722 { 0x07, "International network (INTL)" },
723 { 0x0A, "Network beyond interworking point (BI)" },
727 static const value_string q933_cause_recommendation_vals[] = {
731 { 0x05, "Q.1031/Q.1051" },
736 * Cause codes for Cause.
738 #define Q933_CAUSE_UNALLOC_NUMBER 0x01
739 #define Q933_CAUSE_NO_ROUTE_TO_DEST 0x03
740 #define Q933_CAUSE_CALL_REJECTED 0x15
741 #define Q933_CAUSE_NUMBER_CHANGED 0x16
742 #define Q933_CAUSE_ACCESS_INFO_DISC 0x2B
743 #define Q933_CAUSE_QOS_UNAVAILABLE 0x31
744 #define Q933_CAUSE_CHAN_NONEXISTENT 0x52
745 #define Q933_CAUSE_INCOMPATIBLE_DEST 0x58
746 #define Q933_CAUSE_MAND_IE_MISSING 0x60
747 #define Q933_CAUSE_MT_NONEX_OR_UNIMPL 0x61
748 #define Q933_CAUSE_IE_NONEX_OR_UNIMPL 0x63
749 #define Q933_CAUSE_INVALID_IE_CONTENTS 0x64
750 #define Q933_CAUSE_MSG_INCOMPAT_W_CS 0x65
751 #define Q933_CAUSE_REC_TIMER_EXP 0x66
753 const value_string q933_cause_code_vals[] = {
754 { 0x00, "Valid cause code not yet received" },
755 { Q933_CAUSE_UNALLOC_NUMBER, "Unallocated (unassigned) number" },
756 { 0x02, "No route to specified transit network" },
757 { Q933_CAUSE_NO_ROUTE_TO_DEST, "No route to destination" },
758 { 0x04, "Send special information tone" },
759 { 0x05, "Misdialled trunk prefix" },
760 { 0x06, "Channel unacceptable" },
761 { 0x07, "Call awarded and being delivered in an established channel" },
762 { 0x08, "Prefix 0 dialed but not allowed" },
763 /* Q.850 - "Preemption" */
764 { 0x09, "Prefix 1 dialed but not allowed" },
765 /* Q.850 - "Preemption - circuit reserved for reuse" */
766 { 0x0A, "Prefix 1 dialed but not required" },
767 { 0x0B, "More digits received than allowed, call is proceeding" },
768 { 0x0E, "QoR: ported number" },
769 { 0x10, "Normal call clearing" },
770 { 0x11, "User busy" },
771 { 0x12, "No user responding" },
772 { 0x13, "No answer from user (user alerted)" },
773 { 0x14, "Subscriber absent" },
774 { Q933_CAUSE_CALL_REJECTED, "Call rejected" },
775 { Q933_CAUSE_NUMBER_CHANGED, "Number changed" },
776 { 0x17, "Reverse charging rejected" },
777 /* Q.850 - "Redirection to new destination" */
778 { 0x18, "Call suspended" },
779 /* Q.850 Amendment 1 - "Call rejected due to feature at the destination" */
780 { 0x19, "Call resumed" },
781 /* Q.850 - "Exchange routing error */
782 { 0x1A, "Non-selected user clearing" },
783 { 0x1B, "Destination out of order" },
784 { 0x1C, "Invalid number format (incomplete number)" },
785 { 0x1D, "Facility rejected" },
786 { 0x1E, "Response to STATUS ENQUIRY" },
787 { 0x1F, "Normal unspecified" },
788 { 0x21, "Circuit out of order" },
789 { 0x22, "No circuit/channel available" },
790 { 0x23, "Destination unattainable" },
791 { 0x25, "Degraded service" },
792 { 0x26, "Network out of order" },
793 { 0x27, "Transit delay range cannot be achieved" },
794 /* Q.850 - "Permanent frame mode connection out of service" */
795 { 0x28, "Throughput range cannot be achieved" },
796 /* Q.850 - "Permanent frame mode connection operational" */
797 { 0x29, "Temporary failure" },
798 { 0x2A, "Switching equipment congestion" },
799 { Q933_CAUSE_ACCESS_INFO_DISC, "Access information discarded" },
800 { 0x2C, "Requested circuit/channel not available" },
801 { 0x2D, "Pre-empted" },
802 { 0x2E, "Precedence call blocked" },
803 { 0x2F, "Resources unavailable, unspecified" },
804 { Q933_CAUSE_QOS_UNAVAILABLE, "Quality of service unavailable" },
805 { 0x32, "Requested facility not subscribed" },
806 { 0x33, "Reverse charging not allowed" },
807 { 0x34, "Outgoing calls barred" },
808 { 0x35, "Outgoing calls barred within CUG" },
809 { 0x36, "Incoming calls barred" },
810 { 0x37, "Incoming calls barred within CUG" },
811 { 0x38, "Call waiting not subscribed" },
812 { 0x39, "Bearer capability not authorized" },
813 { 0x3A, "Bearer capability not presently available" },
814 { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
815 { 0x3F, "Service or option not available, unspecified" },
816 { 0x41, "Bearer capability not implemented" },
817 { 0x42, "Channel type not implemented" },
818 { 0x43, "Transit network selection not implemented" },
819 { 0x44, "Message not implemented" },
820 { 0x45, "Requested facility not implemented" },
821 { 0x46, "Only restricted digital information bearer capability is available" },
822 { 0x4F, "Service or option not implemented, unspecified" },
823 { 0x51, "Invalid call reference value" },
824 { Q933_CAUSE_CHAN_NONEXISTENT, "Identified channel does not exist" },
825 { 0x53, "Call identity does not exist for suspended call" },
826 { 0x54, "Call identity in use" },
827 { 0x55, "No call suspended" },
828 { 0x56, "Call having the requested call identity has been cleared" },
829 { 0x57, "Called user not member of CUG" },
830 { Q933_CAUSE_INCOMPATIBLE_DEST, "Incompatible destination" },
831 { 0x59, "Non-existent abbreviated address entry" },
832 { 0x5A, "Destination address missing, and direct call not subscribed" },
833 /* Q.850 - "Non-existent CUG" */
834 { 0x5B, "Invalid transit network selection (national use)" },
835 { 0x5C, "Invalid facility parameter" },
836 { 0x5D, "Mandatory information element is missing" },
837 { 0x5F, "Invalid message, unspecified" },
838 { Q933_CAUSE_MAND_IE_MISSING, "Mandatory information element is missing" },
839 { Q933_CAUSE_MT_NONEX_OR_UNIMPL,"Message type non-existent or not implemented" },
840 { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
841 { Q933_CAUSE_IE_NONEX_OR_UNIMPL,"Information element nonexistant or not implemented" },
842 { Q933_CAUSE_INVALID_IE_CONTENTS,"Invalid information element contents" },
843 { Q933_CAUSE_MSG_INCOMPAT_W_CS, "Message not compatible with call state" },
844 { Q933_CAUSE_REC_TIMER_EXP, "Recovery on timer expiry" },
845 { 0x67, "Parameter non-existent or not implemented - passed on" },
846 { 0x6E, "Message with unrecognized parameter discarded" },
847 { 0x6F, "Protocol error, unspecified" },
848 { 0x7F, "Internetworking, unspecified" },
852 static const value_string q933_cause_condition_vals[] = {
854 { 0x01, "Permanent" },
855 { 0x02, "Transient" },
859 #define Q933_REJ_USER_SPECIFIC 0x00
860 #define Q933_REJ_IE_MISSING 0x04
861 #define Q933_REJ_IE_INSUFFICIENT 0x08
863 static const value_string q933_rejection_reason_vals[] = {
864 { 0x00, "User specific" },
865 { 0x04, "Information element missing" },
866 { 0x08, "Information element contents are not sufficient" },
871 dissect_q933_cause_ie(tvbuff_t *tvb, int offset, int len,
872 proto_tree *tree, int hf_cause_value)
876 guint8 coding_standard;
877 guint8 rejection_reason;
881 octet = tvb_get_guint8(tvb, offset);
882 coding_standard = octet & 0x60;
883 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
884 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
886 * We don't know how the cause is encoded,
887 * so just dump it as data and be done with it.
889 proto_tree_add_text(tree, tvb, offset,
891 tvb_bytes_to_str(tvb, offset, len));
894 proto_tree_add_text(tree, tvb, offset, 1,
896 val_to_str(octet & 0x0F, q933_cause_location_vals,
898 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
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, offset, 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_call_state_vals[] = {
1029 { 0x01, "Call initiated" },
1030 { 0x02, "Overlap sending" },
1031 { 0x03, "Outgoing call proceeding" },
1032 { 0x04, "Call delivered" },
1033 { 0x06, "Call present" },
1034 { 0x07, "Call received" },
1035 { 0x08, "Connect request" },
1036 { 0x09, "Incoming call proceeding" },
1038 { 0x0B, "Disconnect request" },
1039 { 0x0C, "Disconnect indication" },
1040 { 0x0F, "Suspend request" },
1041 { 0x12, "Resume request" },
1042 { 0x13, "Release request" },
1043 { 0x16, "Call abort"},
1044 { 0x19, "Overlap receiving" },
1045 { 0x3D, "Restart request" },
1046 { 0x3E, "Restart" },
1051 dissect_q933_call_state_ie(tvbuff_t *tvb, int offset, int len,
1055 guint8 coding_standard;
1059 octet = tvb_get_guint8(tvb, offset);
1060 coding_standard = octet & 0x60;
1061 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
1062 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
1064 * We don't know how the call state is encoded,
1065 * so just dump it as data and be done with it.
1067 proto_tree_add_text(tree, tvb, offset,
1069 tvb_bytes_to_str(tvb, offset, len));
1072 proto_tree_add_text(tree, tvb, offset, 1,
1074 val_to_str(octet & 0x3F, q933_call_state_vals,
1075 "Unknown (0x%02X)"));
1079 * Dissect a Channel identification information element.
1081 #define Q933_INTERFACE_IDENTIFIED 0x40
1082 #define Q933_NOT_BASIC_CHANNEL 0x20
1084 static const value_string q933_basic_channel_selection_vals[] = {
1085 { 0x00, "No channel" },
1086 { 0x01, "B1 channel" },
1087 { 0x02, "B2 channel" },
1088 { 0x03, "Any channel" },
1092 static const value_string q933_not_basic_channel_selection_vals[] = {
1093 { 0x00, "No channel" },
1094 { 0x01, "Channel indicated in following octets" },
1095 { 0x03, "Any channel" },
1099 #define Q933_IS_SLOT_MAP 0x10
1101 static const value_string q933_element_type_vals[] = {
1102 { 0x03, "B-channel units" },
1103 { 0x06, "H0-channel units" },
1104 { 0x08, "H11-channel units" },
1105 { 0x09, "H12-channel units" },
1110 dissect_q933_channel_identification_ie(tvbuff_t *tvb, int offset, int len,
1114 int identifier_offset;
1116 guint8 coding_standard;
1120 octet = tvb_get_guint8(tvb, offset);
1121 proto_tree_add_text(tree, tvb, offset, 1,
1122 "Interface %s identified",
1123 (octet & Q933_INTERFACE_IDENTIFIED) ? "explicitly" : "implicitly");
1124 proto_tree_add_text(tree, tvb, offset, 1,
1126 (octet & Q933_NOT_BASIC_CHANNEL) ? "Not basic" : "Basic");
1127 proto_tree_add_text(tree, tvb, offset, 1,
1128 "Indicated channel is %s",
1129 (octet & 0x08) ? "required" : "preferred");
1130 proto_tree_add_text(tree, tvb, offset, 1,
1131 "Indicated channel is %sthe D-channel",
1132 (octet & 0x04) ? "" : "not ");
1133 if (octet & Q933_NOT_BASIC_CHANNEL) {
1134 proto_tree_add_text(tree, tvb, offset, 1,
1135 "Channel selection: %s",
1136 val_to_str(octet & 0x03, q933_not_basic_channel_selection_vals,
1139 proto_tree_add_text(tree, tvb, offset, 1,
1140 "Channel selection: %s",
1141 val_to_str(octet & 0x03, q933_basic_channel_selection_vals,
1147 if (octet & Q933_INTERFACE_IDENTIFIED) {
1148 identifier_offset = offset;
1153 octet = tvb_get_guint8(tvb, offset);
1157 } while (!(octet & Q933_IE_VL_EXTENSION));
1160 * XXX - do we want to strip off the 8th bit on the
1161 * last octet of the interface identifier?
1163 if (identifier_len != 0) {
1164 proto_tree_add_text(tree, tvb, identifier_offset,
1165 identifier_len, "Interface identifier: %s",
1167 tvb_get_ptr(tvb, identifier_offset, identifier_len),
1172 if (octet & Q933_NOT_BASIC_CHANNEL) {
1175 octet = tvb_get_guint8(tvb, offset);
1176 coding_standard = octet & 0x60;
1177 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
1178 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
1180 * We don't know how the channel identifier is
1181 * encoded, so just dump it as data and be done
1184 proto_tree_add_text(tree, tvb, offset,
1186 tvb_bytes_to_str(tvb, offset, len));
1189 proto_tree_add_text(tree, tvb, offset, 1,
1190 "Channel is indicated by %s",
1191 (octet & Q933_IS_SLOT_MAP) ? "slot map" : "number");
1192 proto_tree_add_text(tree, tvb, offset, 1,
1194 (octet & Q933_IS_SLOT_MAP) ? "Map element" : "Channel",
1195 val_to_str(octet & 0x0F, q933_element_type_vals,
1196 "Unknown (0x%02X)"));
1199 * XXX - dump the channel number or slot map.
1205 * Dissect a Progress indicator information element.
1207 static const value_string q933_progress_description_vals[] = {
1208 { 0x01, "Call is not end-to-end ISDN - progress information available in-band" },
1209 { 0x02, "Destination address is non-ISDN" },
1210 { 0x03, "Origination address is non-ISDN" },
1211 { 0x04, "Call has returned to the ISDN" },
1212 { 0x05, "Interworking has occurred and has resulted in a telecommunications service change" },
1213 { 0x08, "In-band information or an appropriate pattern is now available" },
1218 dissect_q933_progress_indicator_ie(tvbuff_t *tvb, int offset, int len,
1222 guint8 coding_standard;
1226 octet = tvb_get_guint8(tvb, offset);
1227 coding_standard = octet & 0x60;
1228 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
1229 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
1231 * We don't know how the progress indicator is encoded,
1232 * so just dump it as data and be done with it.
1234 proto_tree_add_text(tree, tvb, offset,
1236 tvb_bytes_to_str(tvb, offset, len));
1239 proto_tree_add_text(tree, tvb, offset, 1,
1241 val_to_str(octet & 0x0F, q933_cause_location_vals,
1248 octet = tvb_get_guint8(tvb, offset);
1249 proto_tree_add_text(tree, tvb, offset, 1,
1250 "Progress description: %s",
1251 val_to_str(octet & 0x7F, q933_progress_description_vals,
1252 "Unknown (0x%02X)"));
1256 * Dissect a Network-specific facilities or Transit network selection
1257 * information element.
1259 static const value_string q933_netid_type_vals[] = {
1260 { 0x00, "User specified" },
1261 { 0x20, "National network identification" },
1262 { 0x30, "International network identification" },
1266 static const value_string q933_netid_plan_vals[] = {
1267 { 0x00, "Unknown" },
1268 { 0x01, "Carrier Identification Code" },
1269 { 0x03, "X.121 data network identification code" },
1274 dissect_q933_ns_facilities_ie(tvbuff_t *tvb, int offset, int len,
1282 octet = tvb_get_guint8(tvb, offset);
1283 netid_len = octet & 0x7F;
1284 proto_tree_add_text(tree, tvb, offset, 1,
1285 "Network identification length: %u",
1289 if (netid_len != 0) {
1292 octet = tvb_get_guint8(tvb, offset);
1293 proto_tree_add_text(tree, tvb, offset, 1,
1294 "Type of network identification: %s",
1295 val_to_str(octet & 0x70, q933_netid_type_vals,
1296 "Unknown (0x%02X)"));
1297 proto_tree_add_text(tree, tvb, offset, 1,
1298 "Network identification plan: %s",
1299 val_to_str(octet & 0x0F, q933_netid_plan_vals,
1300 "Unknown (0x%02X)"));
1307 if (netid_len > len)
1309 if (netid_len != 0) {
1310 proto_tree_add_text(tree, tvb, offset, netid_len,
1311 "Network identification: %s",
1312 tvb_format_text(tvb, offset, netid_len));
1313 offset += netid_len;
1319 * Whatever is left is the network-specific facility
1324 proto_tree_add_text(tree, tvb, offset,
1325 len, "Network-specific facility specification: %s",
1326 tvb_bytes_to_str(tvb, offset, len));
1330 dissect_q933_guint16_value(tvbuff_t *tvb, int offset, int len,
1331 proto_tree *tree, char *label)
1339 octet = tvb_get_guint8(tvb, offset);
1340 if (octet & Q933_IE_VL_EXTENSION) {
1342 * Only one octet long - error.
1346 value = (octet & 0x3) << 14;
1353 * We've reached the end of the information element - error.
1357 octet = tvb_get_guint8(tvb, offset);
1358 if (octet & Q933_IE_VL_EXTENSION) {
1360 * Only two octets long - error.
1364 value |= (octet & 0x7F) << 7;
1371 * We've reached the end of the information element - error.
1375 octet = tvb_get_guint8(tvb, offset);
1376 if (!(octet & Q933_IE_VL_EXTENSION)) {
1378 * More than three octets long - error.
1382 value |= (octet & 0x7F);
1387 proto_tree_add_text(tree, tvb, offset, value_len, "%s: %u ms", label,
1392 proto_tree_add_text(tree, tvb, offset, len,
1393 "%s goes past end of information element", label);
1397 proto_tree_add_text(tree, tvb, offset, len, "%s isn't 3 octets long",
1403 * Dissect an End-to-end transit delay information element.
1406 dissect_q933_e2e_transit_delay_ie(tvbuff_t *tvb, int offset, int len,
1413 value_len = dissect_q933_guint16_value(tvb, offset, len, tree,
1414 "Cumulative transit delay");
1417 offset += value_len;
1422 value_len = dissect_q933_guint16_value(tvb, offset, len, tree,
1423 "Requested end-to-end transit delay");
1426 offset += value_len;
1431 value_len = dissect_q933_guint16_value(tvb, offset, len, tree,
1432 "Maximum end-to-end transit delay");
1436 * Dissect a Transit delay selection and indication information element.
1439 dissect_q933_td_selection_and_int_ie(tvbuff_t *tvb, int offset, int len,
1444 dissect_q933_guint16_value(tvb, offset, len, tree,
1449 dissect_q933_pl_binary_parameters_ie(tvbuff_t *tvb, int offset, int len,
1456 octet = tvb_get_guint8(tvb, offset);
1457 proto_tree_add_text(tree, tvb, offset, 1,
1459 (octet & 0x04) ? "No request/request denied" :
1460 "Request indicated/request accepted");
1461 proto_tree_add_text(tree, tvb, offset, 1,
1463 (octet & 0x02) ? "Link-by-link" : "End-to-end");
1467 * Dissect a Reverse charging indication information element.
1469 static const value_string q933_reverse_charging_indication_vals[] = {
1470 { 0x01, "Reverse charging requested" },
1475 dissect_q933_reverse_charge_ind_ie(tvbuff_t *tvb, int offset, int len,
1480 proto_tree_add_text(tree, tvb, offset, 1,
1481 "Reverse charging indication: %s",
1482 val_to_str(tvb_get_guint8(tvb, offset) & 0x07,
1483 q933_reverse_charging_indication_vals, "Unknown (0x%02X)"));
1487 * Dissect a (phone) number information element.
1489 static const value_string q933_number_type_vals[] = {
1491 { 0x1, "International number" },
1492 { 0x2, "National number" },
1493 { 0x3, "Network specific number" },
1494 { 0x4, "Subscriber number" },
1495 { 0x6, "Abbreviated number" },
1499 static const value_string q933_numbering_plan_vals[] = {
1500 { 0x00, "Unknown" },
1501 { 0x01, "E.164 ISDN/telephony numbering" },
1502 { 0x03, "X.121 data numbering" },
1503 { 0x04, "F.69 Telex numbering" },
1504 { 0x08, "National standard numbering" },
1505 { 0x09, "Private numbering" },
1509 static const value_string q933_presentation_indicator_vals[] = {
1510 { 0x00, "Presentation allowed" },
1511 { 0x20, "Presentation restricted" },
1512 { 0x40, "Number not available due to interworking" },
1516 static const value_string q933_screening_indicator_vals[] = {
1517 { 0x00, "User-provided, not screened" },
1518 { 0x01, "User-provided, verified and passed" },
1519 { 0x02, "User-provided, verified and failed" },
1520 { 0x03, "Network-provided" },
1524 static const value_string q933_redirection_reason_vals[] = {
1525 { 0x00, "Unknown" },
1526 { 0x01, "Call forwarding busy or called DTE busy" },
1527 { 0x02, "Call forwarding no reply" },
1528 { 0x04, "Call deflection" },
1529 { 0x09, "Called DTE out of order" },
1530 { 0x0A, "Call forwarding by the called DTE" },
1531 { 0x0F, "Call forwarding unconditional or systematic call redirection" },
1536 dissect_q933_number_ie(tvbuff_t *tvb, int offset, int len,
1537 proto_tree *tree, int hfindex)
1543 octet = tvb_get_guint8(tvb, offset);
1544 proto_tree_add_uint(tree, hf_q933_numbering_plan, tvb, offset, 1, octet);
1545 proto_tree_add_uint(tree, hf_q933_number_type, tvb, offset, 1, octet);
1546 proto_tree_add_boolean(tree, hf_q933_extension_ind, tvb, offset, 1, octet);
1551 if (!(octet & Q933_IE_VL_EXTENSION)) {
1554 octet = tvb_get_guint8(tvb, offset);
1555 proto_tree_add_text(tree, tvb, offset, 1,
1556 "Presentation indicator: %s",
1557 val_to_str(octet & 0x60, q933_presentation_indicator_vals,
1559 proto_tree_add_text(tree, tvb, offset, 1,
1560 "Screening indicator: %s",
1561 val_to_str(octet & 0x03, q933_screening_indicator_vals,
1568 * XXX - only in a Redirecting number information element.
1570 if (!(octet & Q933_IE_VL_EXTENSION)) {
1573 octet = tvb_get_guint8(tvb, offset);
1574 proto_tree_add_text(tree, tvb, offset, 1,
1575 "Reason for redirection: %s",
1576 val_to_str(octet & 0x0F, q933_redirection_reason_vals,
1584 proto_tree_add_item(tree, hfindex, tvb, offset, len, FALSE);
1588 * Dissect a party subaddress information element.
1590 static const value_string q933_subaddress_type_vals[] = {
1591 { 0x00, "X.213/ISO 8348 Add.2 NSAP" },
1592 { 0x20, "User-specified" },
1596 static const value_string q933_odd_even_indicator_vals[] = {
1597 { 0x00, "Even number of address signals" },
1598 { 0x10, "Odd number of address signals" },
1603 dissect_q933_party_subaddr_ie(tvbuff_t *tvb, int offset, int len,
1610 octet = tvb_get_guint8(tvb, offset);
1611 proto_tree_add_text(tree, tvb, offset, 1,
1612 "Type of subaddress: %s",
1613 val_to_str(octet & 0x70, q933_subaddress_type_vals,
1614 "Unknown (0x%02X)"));
1615 proto_tree_add_text(tree, tvb, offset, 1,
1616 "Odd/even indicator: %s",
1617 val_to_str(octet & 0x10, q933_odd_even_indicator_vals,
1624 proto_tree_add_text(tree, tvb, offset, len, "Subaddress: %s",
1625 tvb_bytes_to_str(tvb, offset, len));
1629 * Dissect a High-layer compatibility information element.
1631 #define Q933_AUDIOVISUAL 0x60
1632 static const value_string q933_high_layer_characteristics_vals[] = {
1633 { 0x01, "Telephony" },
1634 { 0x04, "F.182 Facsimile Group 2/3" },
1635 { 0x21, "F.184 Facsimile Group 4 Class I" },
1636 { 0x24, "F.230 Teletex, basic and mixed mode, and F.184 Facsimile Group 4, Classes II and III" },
1637 { 0x28, "F.220 Teletex, basic and processable mode" },
1638 { 0x31, "F.200 Teletex, basic mode" },
1639 { 0x32, "F.300 and T.102 syntax-based Videotex" },
1640 { 0x33, "F.300 and T.101 international Videotex interworking" },
1641 { 0x35, "F.60 Telex" },
1642 { 0x38, "X.400 Message Handling Systems" },
1643 { 0x41, "X.200 OSI application" },
1644 { 0x42, "FTAM application" },
1645 { 0x5E, "Reserved for maintenance" },
1646 { 0x5F, "Reserved for management" },
1647 { Q933_AUDIOVISUAL, "F.720/F.821 and F.731 Profile 1a videotelephony" },
1648 { 0x61, "F.702 and F.731 Profile 1b videoconferencing" },
1649 { 0x62, "F.702 and F.731 audiographic conferencing" },
1653 static const value_string q933_audiovisual_characteristics_vals[] = {
1654 { 0x01, "Capability set of initial channel of H.221" },
1655 { 0x02, "Capability set of subsequent channel of H.221" },
1656 { 0x21, "Capability set of initial channel of an active 3.1kHz audio or speech call" },
1661 dissect_q933_high_layer_compat_ie(tvbuff_t *tvb, int offset, int len,
1665 guint8 coding_standard;
1666 guint8 characteristics;
1670 octet = tvb_get_guint8(tvb, offset);
1671 coding_standard = octet & 0x60;
1672 proto_tree_add_uint(tree, hf_q933_coding_standard, tvb, offset, 1, octet);
1675 if (coding_standard != Q933_ITU_STANDARDIZED_CODING) {
1677 * We don't know how the call state is encoded,
1678 * so just dump it as data and be done with it.
1680 proto_tree_add_text(tree, tvb, offset,
1682 tvb_bytes_to_str(tvb, offset, len));
1688 octet = tvb_get_guint8(tvb, offset);
1689 characteristics = octet & 0x7F;
1690 proto_tree_add_text(tree, tvb, offset, 1,
1691 "High layer characteristics identification: %s",
1692 val_to_str(characteristics, q933_high_layer_characteristics_vals,
1693 "Unknown (0x%02X)"));
1697 if (!(octet & Q933_IE_VL_EXTENSION)) {
1700 octet = tvb_get_guint8(tvb, offset);
1701 if (characteristics == Q933_AUDIOVISUAL) {
1702 proto_tree_add_text(tree, tvb, offset, 1,
1703 "Extended audiovisual characteristics identification: %s",
1704 val_to_str(octet & 0x7F,
1705 q933_audiovisual_characteristics_vals,
1706 "Unknown (0x%02X)"));
1708 proto_tree_add_text(tree, tvb, offset, 1,
1709 "Extended high layer characteristics identification: %s",
1710 val_to_str(octet & 0x7F,
1711 q933_high_layer_characteristics_vals,
1712 "Unknown (0x%02X)"));
1719 * Dissect a User-user information element.
1721 #define Q933_PROTOCOL_DISCRIMINATOR_IA5 0x04
1722 #define Q933_PROTOCOL_DISCRIMINATOR_ASN1 0x05
1724 static const value_string q933_protocol_discriminator_vals[] = {
1725 { 0x00, "User-specific protocol" },
1726 { 0x01, "OSI high layer protocols" },
1728 { Q933_PROTOCOL_DISCRIMINATOR_IA5, "IA5 characters" },
1729 { Q933_PROTOCOL_DISCRIMINATOR_ASN1, "X.208 and X.209 coded user information" },
1730 { 0x07, "V.120 rate adaption" },
1731 { 0x08, "Q.933/I.451 user-network call control messages" },
1736 dissect_q933_user_user_ie(tvbuff_t *tvb, int offset, int len,
1743 octet = tvb_get_guint8(tvb, offset);
1744 proto_tree_add_text(tree, tvb, offset, 1,
1745 "Protocol discriminator: %s",
1746 val_to_str(octet, q933_protocol_discriminator_vals,
1747 "Unknown (0x%02x)"));
1755 case Q933_PROTOCOL_DISCRIMINATOR_IA5:
1756 proto_tree_add_text(tree, tvb, offset, len, "User information: %s",
1757 tvb_format_text(tvb, offset, len));
1761 proto_tree_add_text(tree, tvb, offset, len, "User information: %s",
1762 tvb_bytes_to_str(tvb, offset, len));
1768 * Dissect information elements consisting of ASCII^H^H^H^H^HIA5 text.
1771 dissect_q933_ia5_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree,
1775 proto_tree_add_text(tree, tvb, offset, len, "%s: %s", label,
1776 tvb_format_text(tvb, offset, len));
1780 static const value_string q933_codeset_vals[] = {
1781 { 0x00, "Q.933 information elements" },
1782 { 0x04, "Information elements for ISO/IEC use" },
1783 { 0x05, "Information elements for national use" },
1784 { 0x06, "Information elements specific to the local network" },
1785 { 0x07, "User-specific information elements" },
1790 dissect_q933(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1793 proto_tree *q933_tree = NULL;
1795 proto_tree *ie_tree = NULL;
1796 guint8 call_ref_len;
1797 guint8 call_ref[15];
1798 guint8 message_type;
1799 guint8 info_element;
1800 guint16 info_element_len;
1801 int codeset, locked_codeset;
1802 gboolean non_locking_shift;
1804 if (check_col(pinfo->cinfo, COL_PROTOCOL))
1805 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Q.933");
1808 ti = proto_tree_add_item(tree, proto_q933, tvb, offset, -1,
1810 q933_tree = proto_item_add_subtree(ti, ett_q933);
1812 dissect_q933_protocol_discriminator(tvb, offset, q933_tree);
1815 call_ref_len = tvb_get_guint8(tvb, offset) & 0xF; /* XXX - do as a bit field? */
1816 if (q933_tree != NULL)
1817 proto_tree_add_uint(q933_tree, hf_q933_call_ref_len, tvb, offset, 1, call_ref_len);
1819 if (call_ref_len != 0) {
1820 tvb_memcpy(tvb, call_ref, offset, call_ref_len);
1821 if (q933_tree != NULL) {
1822 proto_tree_add_boolean(q933_tree, hf_q933_call_ref_flag,
1823 tvb, offset, 1, (call_ref[0] & 0x80) != 0);
1824 call_ref[0] &= 0x7F;
1825 proto_tree_add_bytes(q933_tree, hf_q933_call_ref,
1826 tvb, offset, call_ref_len, call_ref);
1828 offset += call_ref_len;
1830 message_type = tvb_get_guint8(tvb, offset);
1831 if (check_col(pinfo->cinfo, COL_INFO)) {
1832 col_add_str(pinfo->cinfo, COL_INFO,
1833 val_to_str(message_type, q933_message_type_vals,
1834 "Unknown message type (0x%02X)"));
1836 if (q933_tree != NULL)
1837 proto_tree_add_uint(q933_tree, hf_q933_message_type, tvb, offset, 1, message_type);
1841 * And now for the information elements....
1843 codeset = locked_codeset = 0; /* start out in codeset 0 */
1844 non_locking_shift = TRUE;
1845 while (tvb_reported_length_remaining(tvb, offset) > 0) {
1846 info_element = tvb_get_guint8(tvb, offset);
1848 /* Check for the codeset shift */
1849 if ((info_element & Q933_IE_SO_MASK) &&
1850 ((info_element & Q933_IE_SO_IDENTIFIER_MASK) == Q933_IE_SHIFT)) {
1851 non_locking_shift = info_element & Q933_IE_SHIFT_NON_LOCKING;
1852 codeset = info_element & Q933_IE_SHIFT_CODESET;
1853 if (!non_locking_shift)
1854 locked_codeset = codeset;
1855 if (q933_tree != NULL) {
1856 proto_tree_add_text(q933_tree, tvb, offset, 1,
1857 "%s shift to codeset %u: %s",
1858 (non_locking_shift ? "Non-locking" : "Locking"),
1860 val_to_str(codeset, q933_codeset_vals,
1861 "Unknown (0x%02X)"));
1868 * Check for the single-octet IEs.
1870 if (info_element & Q933_IE_SO_MASK) {
1871 switch ((codeset << 8) | (info_element & Q933_IE_SO_IDENTIFIER_MASK)) {
1873 case CS0 | Q933_IE_REPEAT_INDICATOR:
1874 if (q933_tree != NULL) {
1875 proto_tree_add_text(q933_tree, tvb, offset, 1,
1876 "Repeat indicator: %s",
1877 val_to_str(info_element & Q933_IE_SO_IE_MASK,
1878 q933_repeat_indication_vals,
1884 if (q933_tree != NULL) {
1885 proto_tree_add_text(q933_tree, tvb, offset, 1,
1886 "Unknown information element (0x%02X)",
1892 codeset = locked_codeset;
1897 * Variable-length IE.
1899 info_element_len = tvb_get_guint8(tvb, offset + 1);
1900 if (q933_tree != NULL) {
1901 ti = proto_tree_add_text(q933_tree, tvb, offset,
1902 1+1+info_element_len, "%s",
1903 val_to_str(info_element, q933_info_element_vals[codeset],
1904 "Unknown information element (0x%02X)"));
1905 ie_tree = proto_item_add_subtree(ti, ett_q933_ie);
1906 proto_tree_add_text(ie_tree, tvb, offset, 1,
1907 "Information element: %s",
1908 val_to_str(info_element, q933_info_element_vals[codeset],
1909 "Unknown (0x%02X)"));
1910 proto_tree_add_text(ie_tree, tvb, offset + 1, 1,
1911 "Length: %u", info_element_len);
1913 switch ((codeset << 8) | info_element) {
1915 case CS0 | Q933_IE_SEGMENTED_MESSAGE:
1916 dissect_q933_segmented_message_ie(tvb,
1917 offset + 2, info_element_len,
1921 case CS0 | Q933_IE_BEARER_CAPABILITY:
1922 case CS0 | Q933_IE_LOW_LAYER_COMPAT:
1923 dissect_q933_bearer_capability_ie(tvb,
1924 offset + 2, info_element_len,
1928 case CS0 | Q933_IE_CAUSE:
1929 dissect_q933_cause_ie(tvb,
1930 offset + 2, info_element_len,
1932 hf_q933_cause_value);
1935 case CS0 | Q933_IE_CALL_STATE:
1936 dissect_q933_call_state_ie(tvb,
1937 offset + 2, info_element_len,
1941 case CS0 | Q933_IE_CHANNEL_IDENTIFICATION:
1942 dissect_q933_channel_identification_ie(
1943 tvb, offset + 2, info_element_len,
1947 case CS0 | Q933_IE_PROGRESS_INDICATOR:
1948 dissect_q933_progress_indicator_ie(tvb,
1949 offset + 2, info_element_len,
1953 case CS0 | Q933_IE_NETWORK_SPECIFIC_FACIL:
1954 case CS0 | Q933_IE_TRANSIT_NETWORK_SEL:
1955 dissect_q933_ns_facilities_ie(tvb,
1956 offset + 2, info_element_len,
1960 case CS0 | Q933_IE_DISPLAY:
1961 dissect_q933_ia5_ie(tvb, offset + 2,
1962 info_element_len, ie_tree,
1963 "Display information");
1966 case CS0 | Q933_IE_E2E_TRANSIT_DELAY:
1967 dissect_q933_e2e_transit_delay_ie(tvb,
1968 offset + 2, info_element_len,
1972 case CS0 | Q933_IE_TD_SELECTION_AND_INT:
1973 dissect_q933_td_selection_and_int_ie(
1974 tvb, offset + 2, info_element_len,
1978 case CS0 | Q933_IE_PL_BINARY_PARAMETERS:
1979 dissect_q933_pl_binary_parameters_ie(
1980 tvb, offset + 2, info_element_len,
1984 case CS0 | Q933_IE_REVERSE_CHARGE_IND:
1985 dissect_q933_reverse_charge_ind_ie(tvb,
1986 offset + 2, info_element_len,
1990 case CS0 | Q933_IE_CALLING_PARTY_NUMBER:
1991 dissect_q933_number_ie(tvb,
1992 offset + 2, info_element_len,
1994 hf_q933_calling_party_number);
1997 case CS0 | Q933_IE_CONNECTED_NUMBER:
1998 dissect_q933_number_ie(tvb,
1999 offset + 2, info_element_len,
2001 hf_q933_connected_number);
2004 case CS0 | Q933_IE_CALLED_PARTY_NUMBER:
2005 dissect_q933_number_ie(tvb,
2006 offset + 2, info_element_len,
2008 hf_q933_called_party_number);
2011 case CS0 | Q933_IE_CALLING_PARTY_SUBADDR:
2012 case CS0 | Q933_IE_CALLED_PARTY_SUBADDR:
2013 dissect_q933_party_subaddr_ie(tvb,
2014 offset + 2, info_element_len,
2018 case CS0 | Q933_IE_HIGH_LAYER_COMPAT:
2019 dissect_q933_high_layer_compat_ie(tvb,
2020 offset + 2, info_element_len,
2024 case CS0 | Q933_IE_USER_USER:
2025 dissect_q933_user_user_ie(tvb,
2026 offset + 2, info_element_len,
2031 proto_tree_add_text(ie_tree, tvb,
2032 offset + 2, info_element_len,
2035 tvb_get_ptr(tvb, offset + 2,
2041 offset += 1 + 1 + info_element_len;
2042 codeset = locked_codeset;
2047 proto_register_q933(void)
2049 static hf_register_info hf[] = {
2050 { &hf_q933_discriminator,
2051 { "Protocol discriminator", "q933.disc", FT_UINT8, BASE_HEX, NULL, 0x0,
2054 { &hf_q933_call_ref_flag,
2055 { "Call reference flag", "q933.call_ref_flag", FT_BOOLEAN, BASE_NONE, TFS(&tfs_call_ref_flag), 0x0,
2058 { &hf_q933_call_ref,
2059 { "Call reference value", "q933.call_ref", FT_BYTES, BASE_HEX, NULL, 0x0,
2063 { &hf_q933_coding_standard,
2064 { "Coding standard", "q933.coding_standard", FT_UINT8, BASE_HEX,
2065 VALS(q933_coding_standard_vals), 0x60,"", HFILL }},
2067 { &hf_q933_information_transfer_capability,
2068 { "Information transfer capability", "q933.information_transfer_capability", FT_UINT8, BASE_HEX,
2069 VALS(q933_information_transfer_capability_vals), 0x1f,"", HFILL }},
2071 { &hf_q933_transfer_mode,
2072 { "Transfer mode", "q933.transfer_mode", FT_UINT8, BASE_HEX,
2073 VALS(q933_transfer_mode_vals), 0x60,"", HFILL }},
2076 { "User information layer 1 protocol", "q933.uil1", FT_UINT8, BASE_HEX,
2077 VALS(q933_uil1_vals), 0x1f,"", HFILL }},
2079 { &hf_q933_call_ref_len,
2080 { "Call reference value length", "q933.call_ref_len", FT_UINT8, BASE_DEC, NULL, 0x0,
2083 { &hf_q933_message_type,
2084 { "Message type", "q933.message_type", FT_UINT8, BASE_HEX, VALS(q933_message_type_vals), 0x0,
2087 { &hf_q933_cause_value,
2088 { "Cause value", "q933.cause_value", FT_UINT8, BASE_DEC, VALS(q933_cause_code_vals), 0x0,
2091 { &hf_q933_number_type,
2092 { "Number type", "q933.number_type", FT_UINT8, BASE_HEX, VALS(q933_number_type_vals), 0x70,
2095 { &hf_q933_numbering_plan,
2096 { "numbering plan", "q933.numbering_plan", FT_UINT8, BASE_HEX, VALS(q933_numbering_plan_vals), 0x0f,
2099 { &hf_q933_extension_ind,
2100 { "Extension indicator", "q933.extension_ind",
2101 FT_BOOLEAN, 8, TFS(&q933_extension_ind_value), 0x80,
2104 { &hf_q933_calling_party_number,
2105 { "Calling party number digits", "q933.calling_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2108 { &hf_q933_called_party_number,
2109 { "Called party number digits", "q933.called_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2112 { &hf_q933_connected_number,
2113 { "Connected party number digits", "q933.connected_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2116 { &hf_q933_redirecting_number,
2117 { "Redirecting party number digits", "q933.redirecting_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2120 static gint *ett[] = {
2125 proto_q933 = proto_register_protocol("Q.933", "Q.933", "q933");
2126 proto_register_field_array (proto_q933, hf, array_length(hf));
2127 proto_register_subtree_array(ett, array_length(ett));
2129 register_dissector("q933", dissect_q933, proto_q933);
2133 proto_reg_handoff_q933(void)
2135 dissector_handle_t q933_handle;
2137 q933_handle = create_dissector_handle(dissect_q933, proto_q933);
2138 dissector_add("fr.osinl", NLPID_Q_933, q933_handle);