2 * Routines for Q.931 frame disassembly
3 * Guy Harris <guy@alum.mit.edu>
5 * $Id: packet-q931.c,v 1.63 2003/11/10 08:14:07 sahlberg Exp $
7 * Modified by Andreas Sikkema for possible use with H.323
9 * Ethereal - Network traffic analyzer
10 * By Gerald Combs <gerald@ethereal.com>
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 #include <epan/packet.h>
36 #include <epan/strutil.h>
38 #include "packet-q931.h"
41 #include "packet-tpkt.h"
45 * http://www.acacia-net.com/Clarinet/Protocol/q9313svn.htm
46 * http://www.acacia-net.com/Clarinet/Protocol/q9311sc3.htm
47 * http://www.acacia-net.com/Clarinet/Protocol/q9317oz7.htm
48 * http://www.protocols.com/pbook/isdn.htm
49 * http://freesoft.org/CIE/Topics/126.htm
50 * http://noc.comstar.ru/miscdocs/ascend-faq-cause-codes.html
51 * http://www.andrews-arnold.co.uk/isdn/q931cause.html
52 * http://www.tulatelecom.ru/staff/german/DSSHelp/MessList/InfEl/InfElList.html
55 static int proto_q931 = -1;
56 static int hf_q931_discriminator = -1;
57 static int hf_q931_coding_standard = -1;
58 static int hf_q931_information_transfer_capability = -1;
59 static int hf_q931_transfer_mode = -1;
60 static int hf_q931_information_transfer_rate = -1;
61 static int hf_q931_uil1 = -1;
62 static int hf_q931_call_ref_len = -1;
63 static int hf_q931_call_ref_flag = -1;
64 static int hf_q931_call_ref = -1;
65 static int hf_q931_message_type = -1;
66 static int hf_q931_cause_value = -1;
67 static int hf_q931_number_type = -1;
68 static int hf_q931_numbering_plan = -1;
69 static int hf_q931_extension_ind = -1;
70 static int hf_q931_calling_party_number = -1;
71 static int hf_q931_called_party_number = -1;
72 static int hf_q931_connected_number = -1;
73 static int hf_q931_redirecting_number = -1;
75 static gint ett_q931 = -1;
76 static gint ett_q931_ie = -1;
78 static dissector_table_t codeset_dissector_table;
79 static dissector_table_t ie_dissector_table;
81 /* desegmentation of Q.931 over TPKT over TCP */
82 static gboolean q931_desegment = TRUE;
84 static dissector_handle_t h225_handle;
85 static dissector_handle_t q931_tpkt_pdu_handle;
88 * Q.931 message types.
90 #define Q931_ESCAPE 0x00
91 #define Q931_ALERTING 0x01
92 #define Q931_CALL_PROCEEDING 0x02
93 #define Q931_CONNECT 0x07
94 #define Q931_CONNECT_ACK 0x0F
95 #define Q931_PROGRESS 0x03
96 #define Q931_SETUP 0x05
97 #define Q931_SETUP_ACK 0x0D
98 #define Q931_HOLD 0x24
99 #define Q931_HOLD_ACK 0x28
100 #define Q931_HOLD_REJECT 0x30
101 #define Q931_RESUME 0x26
102 #define Q931_RESUME_ACK 0x2E
103 #define Q931_RESUME_REJECT 0x22
104 #define Q931_RETRIEVE 0x31
105 #define Q931_RETRIEVE_ACK 0x33
106 #define Q931_RETRIEVE_REJECT 0x37
107 #define Q931_SUSPEND 0x25
108 #define Q931_SUSPEND_ACK 0x2D
109 #define Q931_SUSPEND_REJECT 0x21
110 #define Q931_USER_INFORMATION 0x20
111 #define Q931_DISCONNECT 0x45
112 #define Q931_RELEASE 0x4D
113 #define Q931_RELEASE_COMPLETE 0x5A
114 #define Q931_RESTART 0x46
115 #define Q931_RESTART_ACK 0x4E
116 #define Q931_CONGESTION_CONTROL 0x79
117 #define Q931_FACILITY 0x62
118 #define Q931_INFORMATION 0x7B
119 #define Q931_NOTIFY 0x6E
120 #define Q931_REGISTER 0x64
121 #define Q931_SEGMENT 0x60
122 #define Q931_STATUS 0x7D
123 #define Q931_STATUS_ENQUIRY 0x75
125 static const value_string q931_message_type_vals[] = {
126 { Q931_ESCAPE, "ESCAPE" },
127 { Q931_ALERTING, "ALERTING" },
128 { Q931_CALL_PROCEEDING, "CALL PROCEEDING" },
129 { Q931_CONNECT, "CONNECT" },
130 { Q931_CONNECT_ACK, "CONNECT ACKNOWLEDGE" },
131 { Q931_PROGRESS, "PROGRESS" },
132 { Q931_SETUP, "SETUP" },
133 { Q931_SETUP_ACK, "SETUP ACKNOWLEDGE" },
134 { Q931_HOLD, "HOLD" },
135 { Q931_HOLD_ACK, "HOLD_ACKNOWLEDGE" },
136 { Q931_HOLD_REJECT, "HOLD_REJECT" },
137 { Q931_RESUME, "RESUME" },
138 { Q931_RESUME_ACK, "RESUME ACKNOWLEDGE" },
139 { Q931_RESUME_REJECT, "RESUME REJECT" },
140 { Q931_RETRIEVE, "RETRIEVE" },
141 { Q931_RETRIEVE_ACK, "RETRIEVE ACKNOWLEDGE" },
142 { Q931_RETRIEVE_REJECT, "RETRIEVE REJECT" },
143 { Q931_SUSPEND, "SUSPEND" },
144 { Q931_SUSPEND_ACK, "SUSPEND ACKNOWLEDGE" },
145 { Q931_SUSPEND_REJECT, "SUSPEND REJECT" },
146 { Q931_USER_INFORMATION, "USER INFORMATION" },
147 { Q931_DISCONNECT, "DISCONNECT" },
148 { Q931_RELEASE, "RELEASE" },
149 { Q931_RELEASE_COMPLETE, "RELEASE COMPLETE" },
150 { Q931_RESTART, "RESTART" },
151 { Q931_RESTART_ACK, "RESTART ACKNOWLEDGE" },
152 { Q931_CONGESTION_CONTROL, "CONGESTION CONTROL" },
153 { Q931_FACILITY, "FACILITY" },
154 { Q931_INFORMATION, "INFORMATION" },
155 { Q931_NOTIFY, "NOTIFY" },
156 { Q931_REGISTER, "REGISTER" },
157 { Q931_SEGMENT, "SEGMENT" },
158 { Q931_STATUS, "STATUS" },
159 { Q931_STATUS_ENQUIRY, "STATUS ENQUIRY" },
163 static const true_false_string tfs_call_ref_flag = {
164 "Message sent to originating side",
165 "Message sent from originating side"
169 * Information elements.
172 /* Shifted codeset values */
182 #define Q931_IE_SO_MASK 0x80 /* single-octet/variable-length mask */
186 #define Q931_IE_SO_IDENTIFIER_MASK 0xf0 /* IE identifier mask */
187 #define Q931_IE_SO_IDENTIFIER_SHIFT 4 /* IE identifier shift */
188 #define Q931_IE_SO_IE_MASK 0x0F /* IE mask */
190 #define Q931_IE_SHIFT 0x90
191 #define Q931_IE_SHIFT_NON_LOCKING 0x08 /* non-locking shift */
192 #define Q931_IE_SHIFT_CODESET 0x0F /* codeset */
194 #define Q931_IE_MORE_DATA_OR_SEND_COMP 0xA0 /* More Data or Sending Complete */
195 #define Q931_IE_MORE_DATA 0xA0
196 #define Q931_IE_SENDING_COMPLETE 0xA1
198 #define Q931_IE_CONGESTION_LEVEL 0xB0
199 #define Q931_IE_REPEAT_INDICATOR 0xD0
202 * Variable-length IEs.
204 #define Q931_IE_VL_EXTENSION 0x80 /* Extension flag */
205 /* extension bit. The bit value "0" indicates that the octet continues through the */
206 /* next octet. The bit value "1" indicates that this octet is the last octet */
208 static const true_false_string q931_extension_ind_value = {
210 "information continues through the next octet",
216 * Codeset 0 (default).
218 #define Q931_IE_SEGMENTED_MESSAGE 0x00
219 #define Q931_IE_BEARER_CAPABILITY 0x04
220 #define Q931_IE_CAUSE 0x08
221 #define Q931_IE_CALL_IDENTITY 0x10
222 #define Q931_IE_CALL_STATE 0x14
223 #define Q931_IE_CHANNEL_IDENTIFICATION 0x18
224 #define Q931_IE_FACILITY 0x1C
225 #define Q931_IE_PROGRESS_INDICATOR 0x1E
226 #define Q931_IE_NETWORK_SPECIFIC_FACIL 0x20 /* Network Specific Facilities */
227 #define Q931_IE_NOTIFICATION_INDICATOR 0x27
228 #define Q931_IE_DISPLAY 0x28
229 #define Q931_IE_DATE_TIME 0x29
230 #define Q931_IE_KEYPAD_FACILITY 0x2C
231 #define Q931_IE_INFORMATION_REQUEST 0x32
232 #define Q931_IE_SIGNAL 0x34
233 #define Q931_IE_SWITCHHOOK 0x36
234 #define Q931_IE_FEATURE_ACTIVATION 0x38
235 #define Q931_IE_FEATURE_INDICATION 0x39
236 #define Q931_IE_ENDPOINT_IDENTIFIER 0x3B
237 #define Q931_IE_SERVICE_PROFILE_ID 0x3A
238 #define Q931_IE_INFORMATION_RATE 0x40
239 #define Q931_IE_E2E_TRANSIT_DELAY 0x42 /* End-to-end Transit Delay */
240 #define Q931_IE_TD_SELECTION_AND_INT 0x43 /* Transit Delay Selection and Indication */
241 #define Q931_IE_PL_BINARY_PARAMETERS 0x44 /* Packet layer binary parameters */
242 #define Q931_IE_PL_WINDOW_SIZE 0x45 /* Packet layer window size */
243 #define Q931_IE_PACKET_SIZE 0x46 /* Packet size */
244 #define Q931_IE_CUG 0x47 /* Closed user group */
245 #define Q931_IE_REVERSE_CHARGE_IND 0x4A /* Reverse charging indication */
246 #define Q931_IE_CONNECTED_NUMBER_DEFAULT 0x4C /* Connected Number */
247 #define Q931_IE_CALLING_PARTY_NUMBER 0x6C /* Calling Party Number */
248 #define Q931_IE_CALLING_PARTY_SUBADDR 0x6D /* Calling Party Subaddress */
249 #define Q931_IE_CALLED_PARTY_NUMBER 0x70 /* Called Party Number */
250 #define Q931_IE_CALLED_PARTY_SUBADDR 0x71 /* Called Party Subaddress */
251 #define Q931_IE_REDIRECTING_NUMBER 0x74
252 #define Q931_IE_REDIRECTION_NUMBER 0x76
253 #define Q931_IE_TRANSIT_NETWORK_SEL 0x78 /* Transit Network Selection */
254 #define Q931_IE_RESTART_INDICATOR 0x79
255 #define Q931_IE_LOW_LAYER_COMPAT 0x7C /* Low-Layer Compatibility */
256 #define Q931_IE_HIGH_LAYER_COMPAT 0x7D /* High-Layer Compatibility */
257 #define Q931_IE_USER_USER 0x7E /* User-User */
258 #define Q931_IE_ESCAPE 0x7F /* Escape for extension */
263 #define Q931_IE_CONNECTED_NUMBER 0x8C
264 #define Q931_IE_CONNECTED_SUBADDR 0x8D
267 * Codeset 5 (National-specific) Belgium.
269 #define Q931_IE_CHARGING_ADVICE 0x1A
272 * Codeset 5 (National-specific) Bellcore National ISDN.
274 #define Q931_IE_OPERATOR_SYSTEM_ACCESS 0x1D
277 * Codeset 6 (Network-specific) Belgium.
279 /* 0x1A is Charging Advice, as with Codeset 5 */
280 #define Q931_IE_REDIRECTING_NUMBER 0x74
283 * Codeset 6 (Network-specific) FT-Numeris.
285 /* 0x1D is User Capability */
288 * Codeset 6 (Network-specific) Bellcore National ISDN.
290 #define Q931_IE_REDIRECTING_SUBADDR 0x75 /* Redirecting Subaddress */
291 /* 0x76 is Redirection Number, but that's also Codeset 0 */
292 #define Q931_IE_CALL_APPEARANCE 0x7B
295 static const value_string q931_info_element_vals0[] = {
296 { Q931_IE_SEGMENTED_MESSAGE, "Segmented message" },
297 { Q931_IE_BEARER_CAPABILITY, "Bearer capability" },
298 { Q931_IE_CAUSE, "Cause" },
299 { Q931_IE_CALL_IDENTITY, "Call identity" },
300 { Q931_IE_CALL_STATE, "Call state" },
301 { Q931_IE_CHANNEL_IDENTIFICATION, "Channel identification" },
302 { Q931_IE_FACILITY, "Facility" },
303 { Q931_IE_PROGRESS_INDICATOR, "Progress indicator" },
304 { Q931_IE_NETWORK_SPECIFIC_FACIL, "Network specific facilities" },
305 { Q931_IE_NOTIFICATION_INDICATOR, "Notification indicator" },
306 { Q931_IE_DISPLAY, "Display" },
307 { Q931_IE_DATE_TIME, "Date/Time" },
308 { Q931_IE_KEYPAD_FACILITY, "Keypad facility" },
309 { Q931_IE_INFORMATION_REQUEST, "Information request" },
310 { Q931_IE_SIGNAL, "Signal" },
311 { Q931_IE_SWITCHHOOK, "Switchhook" },
312 { Q931_IE_FEATURE_ACTIVATION, "Feature activation" },
313 { Q931_IE_FEATURE_INDICATION, "Feature Indication" },
314 { Q931_IE_ENDPOINT_IDENTIFIER, "Endpoint identifier" },
315 { Q931_IE_SERVICE_PROFILE_ID, "Service profile ID" },
316 { Q931_IE_INFORMATION_RATE, "Information rate" },
317 { Q931_IE_E2E_TRANSIT_DELAY, "End-to-end transit delay" },
318 { Q931_IE_TD_SELECTION_AND_INT, "Transit delay selection and indication" },
319 { Q931_IE_PL_BINARY_PARAMETERS, "Packet layer binary parameters" },
320 { Q931_IE_PL_WINDOW_SIZE, "Packet layer window size" },
321 { Q931_IE_PACKET_SIZE, "Packet size" },
322 { Q931_IE_CUG, "Closed user group" },
323 { Q931_IE_REVERSE_CHARGE_IND, "Reverse charging indication" },
324 { Q931_IE_CONNECTED_NUMBER_DEFAULT, "Connected number" },
325 { Q931_IE_CALLING_PARTY_NUMBER, "Calling party number" },
326 { Q931_IE_CALLING_PARTY_SUBADDR, "Calling party subaddress" },
327 { Q931_IE_CALLED_PARTY_NUMBER, "Called party number" },
328 { Q931_IE_CALLED_PARTY_SUBADDR, "Called party subaddress" },
329 { Q931_IE_REDIRECTING_NUMBER, "Redirecting number" },
330 { Q931_IE_REDIRECTION_NUMBER, "Redirection number" },
331 { Q931_IE_TRANSIT_NETWORK_SEL, "Transit network selection" },
332 { Q931_IE_RESTART_INDICATOR, "Restart indicator" },
333 { Q931_IE_LOW_LAYER_COMPAT, "Low-layer compatibility" },
334 { Q931_IE_HIGH_LAYER_COMPAT, "High-layer compatibility" },
335 { Q931_IE_USER_USER, "User-user" },
336 { Q931_IE_ESCAPE, "Escape" },
337 { Q931_IE_CONNECTED_NUMBER, "Connected number" },
338 { Q931_IE_CONNECTED_SUBADDR, "Connected subaddress" },
342 static const value_string q931_info_element_vals1[] = {
346 static const value_string q931_info_element_vals2[] = {
350 static const value_string q931_info_element_vals3[] = {
354 static const value_string q931_info_element_vals4[] = {
358 static const value_string q931_info_element_vals5[] = {
359 { Q931_IE_CHARGING_ADVICE, "Charging advice" },
360 { Q931_IE_OPERATOR_SYSTEM_ACCESS, "Operator system access" },
364 static const value_string q931_info_element_vals6[] = {
365 { Q931_IE_REDIRECTING_NUMBER, "Redirecting number" },
366 { Q931_IE_REDIRECTING_SUBADDR, "Redirecting subaddress" },
367 { Q931_IE_CALL_APPEARANCE, "Call appearance" },
371 static const value_string q931_info_element_vals7[] = {
376 #define NUM_INFO_ELEMENT_VALS 8
377 static const value_string *q931_info_element_vals[NUM_INFO_ELEMENT_VALS] = {
378 q931_info_element_vals0,
379 q931_info_element_vals1,
380 q931_info_element_vals2,
381 q931_info_element_vals3,
382 q931_info_element_vals4,
383 q931_info_element_vals5,
384 q931_info_element_vals6,
385 q931_info_element_vals7,
388 static const value_string q931_congestion_level_vals[] = {
389 { 0x0, "Receiver ready" },
390 { 0xF, "Receiver not ready" },
394 static const value_string q931_repeat_indication_vals[] = {
395 { 0x2, "Prioritized list" },
400 * ITU-standardized coding.
402 #define Q931_ITU_STANDARDIZED_CODING 0x00
405 * Dissect a Segmented message information element.
408 dissect_q931_segmented_message_ie(tvbuff_t *tvb, int offset, int len,
412 proto_tree_add_text(tree, tvb, offset, len,
413 "Segmented message: length is %d, should be 2\n", len);
416 if (tvb_get_guint8(tvb, offset) & 0x80) {
417 proto_tree_add_text(tree, tvb, offset, 1,
418 "First segment: %u segments remaining",
419 tvb_get_guint8(tvb, offset) & 0x7F);
421 proto_tree_add_text(tree, tvb, offset, 1,
422 "Not first segment: %u segments remaining",
423 tvb_get_guint8(tvb, offset) & 0x7F);
425 proto_tree_add_text(tree, tvb, offset + 1, 1,
426 "Segmented message type: %u\n", tvb_get_guint8(tvb, offset + 1));
430 * Dissect a Bearer capability or Low-layer compatibility information element.
432 static const value_string q931_coding_standard_vals[] = {
433 { 0x0, "ITU-T standardized coding" },
434 { 0x1, "ISO/IEC standard" },
435 { 0x2, "National standard" },
436 { 0x3, "Standard defined for this particular network" },
440 static const value_string q931_information_transfer_capability_vals[] = {
442 { 0x08, "Unrestricted digital information" },
443 { 0x09, "Restricted digital information" },
444 { 0x10, "3.1 kHz audio" },
445 { 0x11, "Unrestricted digital information with tones/announcements" },
450 static const value_string q931_transfer_mode_vals[] = {
451 { 0x00, "Circuit mode" },
452 { 0x02, "Packet mode" },
456 #define Q931_IT_RATE_MULTIRATE 0x18
458 static const value_string q931_information_transfer_rate_vals[] = {
459 { 0x00, "Packet mode" },
460 { 0x10, "64 kbit/s" },
461 { 0x11, "2 x 64 kbit/s" },
462 { 0x13, "384 kbit/s" },
463 { 0x15, "1536 kbit/s" },
464 { 0x17, "1920 kbit/s" },
465 { Q931_IT_RATE_MULTIRATE, "Multirate (64 kbit/s base rate)" },
469 static const value_string q931_uil1_vals[] = {
470 { 0x01, "V.110/I.460/X.30 rate adaption" },
471 { 0x02, "Recommendation G.711 u-law" },
472 { 0x03, "Recommendation G.711 A-law" },
473 { 0x04, "Recommendation G.721 32 kbit/s ADPCM and Recommendation I.460" },
474 { 0x05, "Recommendation H.221 and H.242" },
475 { 0x06, "Recommendation H.223 and H.245" },
476 { 0x07, "Non-ITU-T-standardized rate adaption" },
477 { 0x08, "V.120 rate adaption" },
478 { 0x09, "X.31 HDLC flag stuffing" },
482 static const value_string q931_l1_user_rate_vals[] = {
483 { 0x00, "Rate indicated by E-bits" },
484 { 0x01, "0.6 kbit/s" },
485 { 0x02, "1.2 kbit/s" },
486 { 0x03, "2.4 kbit/s" },
487 { 0x04, "3.6 kbit/s" },
488 { 0x05, "4.8 kbit/s" },
489 { 0x06, "7.2 kbit/s" },
490 { 0x07, "8 kbit/s" },
491 { 0x08, "9.6 kbit/s" },
492 { 0x09, "14.4 kbit/s" },
493 { 0x0A, "16 kbit/s" },
494 { 0x0B, "19.2 kbit/s" },
495 { 0x0C, "32 kbit/s" },
496 { 0x0E, "48 kbit/s" },
497 { 0x0F, "56 kbit/s" },
498 { 0x10, "64 kbit/s "},
499 { 0x15, "0.1345 kbit/s" },
500 { 0x16, "0.100 kbit/s" },
501 { 0x17, "0.075/1.2 kbit/s" },
502 { 0x18, "1.2/0.075 kbit/s" },
503 { 0x19, "0.050 kbit/s" },
504 { 0x1A, "0.075 kbit/s" },
505 { 0x1B, "0.110 kbit/s" },
506 { 0x1C, "0.150 kbit/s" },
507 { 0x1D, "0.200 kbit/s" },
508 { 0x1E, "0.300 kbit/s" },
509 { 0x1F, "12 kbit/s" },
513 static const value_string q931_l1_intermediate_rate_vals[] = {
514 { 0x20, "8 kbit/s" },
515 { 0x40, "16 kbit/s" },
516 { 0x60, "32 kbit/s" },
520 static const value_string q931_l1_stop_bits_vals[] = {
527 static const value_string q931_l1_data_bits_vals[] = {
534 static const value_string q931_l1_parity_vals[] = {
538 { 0x04, "Forced to 0" },
539 { 0x05, "Forced to 1" },
543 static const value_string q931_l1_modem_type_vals[] = {
546 { 0x13, "V.22 bis" },
549 { 0x16, "V.26 bis" },
550 { 0x17, "V.26 ter" },
552 { 0x19, "V.27 bis" },
553 { 0x1A, "V.27 ter" },
560 #define Q931_UIL2_USER_SPEC 0x10
562 static const value_string q931_uil2_vals[] = {
563 { 0x01, "Basic mode ISO 1745" },
564 { 0x02, "Q.921/I.441" }, /* LAPD */
565 { 0x06, "X.25, link layer" }, /* LAPB */
566 { 0x07, "X.25 multilink" }, /* or 0x0F? */
567 { 0x08, "T.71 Extended LAPB" },
568 { 0x09, "HDLC ARM" },
569 { 0x0A, "HDLC NRM" },
570 { 0x0B, "HDLC ABM" },
571 { 0x0C, "ISO 8802/2 LLC" },
572 { 0x0D, "X.75 Single Link Procedure" },
574 { 0x0F, "Core aspects of Q.922" },
575 { Q931_UIL2_USER_SPEC, "User-specified" },
576 { 0x11, "ISO 7776 DTE-DTE operation" },
580 static const value_string q931_mode_vals[] = {
581 { 0x20, "Normal mode" },
582 { 0x40, "Extended mode" },
586 #define Q931_UIL3_X25_PL 0x06
587 #define Q931_UIL3_ISO_8208 0x07 /* X.25-based */
588 #define Q931_UIL3_X223 0x08 /* X.25-based */
589 #define Q931_UIL3_TR_9577 0x0B
590 #define Q931_UIL3_USER_SPEC 0x10
592 static const value_string q931_uil3_vals[] = {
593 { 0x02, "Q.931/I.451" },
594 { Q931_UIL3_X25_PL, "X.25, packet layer" },
595 { Q931_UIL3_ISO_8208, "ISO/IEC 8208" },
596 { Q931_UIL3_X223, "X.223/ISO 8878" },
597 { 0x09, "ISO/IEC 8473" },
599 { Q931_UIL3_TR_9577, "ISO/IEC TR 9577" },
600 { Q931_UIL3_USER_SPEC, "User-specified" },
605 dissect_q931_protocol_discriminator(tvbuff_t *tvb, int offset, proto_tree *tree)
607 unsigned int discriminator = tvb_get_guint8(tvb, offset);
609 if (discriminator == NLPID_Q_931) {
610 proto_tree_add_uint_format(tree, hf_q931_discriminator,
611 tvb, offset, 1, discriminator,
612 "Protocol discriminator: Q.931");
613 } else if (discriminator == NLPID_Q_2931) {
614 proto_tree_add_uint_format(tree, hf_q931_discriminator,
615 tvb, offset, 1, discriminator,
616 "Protocol discriminator: Q.2931");
617 } else if ((discriminator >= 16 && discriminator < 63)
618 || ((discriminator >= 80) && (discriminator < 254))) {
619 proto_tree_add_uint_format(tree, hf_q931_discriminator,
620 tvb, offset, 1, discriminator,
621 "Protocol discriminator: Network layer or layer 3 protocol (0x%02X)",
623 } else if (discriminator >= 64 && discriminator <= 79) {
624 proto_tree_add_uint_format(tree, hf_q931_discriminator,
625 tvb, offset, 1, discriminator,
626 "Protocol discriminator: National use (0x%02X)",
629 proto_tree_add_uint_format(tree, hf_q931_discriminator,
630 tvb, offset, 1, discriminator,
631 "Protocol discriminator: Reserved (0x%02X)",
637 dissect_q931_bearer_capability_ie(tvbuff_t *tvb, int offset, int len,
641 guint8 coding_standard;
644 guint8 uil2_protocol;
645 guint8 uil3_protocol;
650 octet = tvb_get_guint8(tvb, offset);
651 coding_standard = octet & 0x60;
652 if (coding_standard != Q931_ITU_STANDARDIZED_CODING) {
654 * We don't know how the bearer capability is encoded,
655 * so just dump it as data and be done with it.
657 proto_tree_add_text(tree, tvb, offset,
659 tvb_bytes_to_str(tvb, offset, len));
660 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
661 proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet);
664 proto_tree_add_uint(tree, hf_q931_information_transfer_capability, tvb, offset, 1, octet);
665 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
666 proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet);
671 * XXX - only in Low-layer compatibility information element.
673 if (!(octet & Q931_IE_VL_EXTENSION)) {
676 octet = tvb_get_guint8(tvb, offset);
677 proto_tree_add_text(tree, tvb, offset, 1,
678 "Out-band negotiation %spossible",
679 (octet & 0x40) ? "" : "not ");
686 octet = tvb_get_guint8(tvb, offset);
687 proto_tree_add_uint(tree, hf_q931_information_transfer_rate, tvb, offset, 1, octet);
688 proto_tree_add_uint(tree, hf_q931_transfer_mode, tvb, offset, 1, octet);
689 proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet);
690 it_rate = octet & 0x1F;
694 if (it_rate == Q931_IT_RATE_MULTIRATE) {
697 proto_tree_add_text(tree, tvb, offset, 1, "Rate multiplier: %u", tvb_get_guint8(tvb, offset));
704 octet = tvb_get_guint8(tvb, offset);
705 if ((octet & 0x60) == 0x20) {
707 * Layer 1 information.
709 proto_tree_add_uint(tree, hf_q931_uil1, tvb, offset, 1, octet);
710 proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet);
714 if (octet & Q931_IE_VL_EXTENSION)
718 octet = tvb_get_guint8(tvb, offset);
719 proto_tree_add_text(tree, tvb, offset, 1,
721 (octet & 0x40) ? "Asynchronous" : "Synchronous");
722 proto_tree_add_text(tree, tvb, offset, 1,
723 "Layer 1 in-band negotiation is %spossible",
724 (octet & 0x20) ? "" : "not ");
725 proto_tree_add_text(tree, tvb, offset, 1,
727 val_to_str(octet & 0x1F, q931_l1_user_rate_vals,
728 "Unknown (0x%02X)"));
732 if (octet & Q931_IE_VL_EXTENSION)
736 octet = tvb_get_guint8(tvb, offset);
737 proto_tree_add_text(tree, tvb, offset, 1,
738 "Intermediate rate: %s",
739 val_to_str(octet & 0x60, q931_l1_intermediate_rate_vals,
741 proto_tree_add_text(tree, tvb, offset, 1,
742 "%s to send data with network independent clock",
743 (octet & 0x10) ? "Required" : "Not required");
744 proto_tree_add_text(tree, tvb, offset, 1,
745 "%s accept data with network independent clock",
746 (octet & 0x08) ? "Can" : "Cannot");
747 proto_tree_add_text(tree, tvb, offset, 1,
748 "%s to send data with flow control mechanism",
749 (octet & 0x04) ? "Required" : "Not required");
750 proto_tree_add_text(tree, tvb, offset, 1,
751 "%s accept data with flow control mechanism",
752 (octet & 0x02) ? "Can" : "Cannot");
756 if (octet & Q931_IE_VL_EXTENSION)
760 octet = tvb_get_guint8(tvb, offset);
761 proto_tree_add_text(tree, tvb, offset, 1,
762 "Rate adaption header %sincluded",
763 (octet & 0x40) ? "" : "not ");
764 proto_tree_add_text(tree, tvb, offset, 1,
765 "Multiple frame establishment %ssupported",
766 (octet & 0x20) ? "" : "not ");
767 proto_tree_add_text(tree, tvb, offset, 1,
768 "%s mode of operation",
769 (octet & 0x10) ? "Protocol sensitive" : "Bit transparent");
770 proto_tree_add_text(tree, tvb, offset, 1,
772 "Full protocol negotiation" : "LLI = 256 only");
773 proto_tree_add_text(tree, tvb, offset, 1,
774 "Message originator is %s",
775 (octet & 0x04) ? "Assignor only" : "Default assignee");
776 proto_tree_add_text(tree, tvb, offset, 1,
777 "Negotiation is done %s",
778 (octet & 0x02) ? "in-band" : "out-of-band");
782 if (octet & Q931_IE_VL_EXTENSION)
786 octet = tvb_get_guint8(tvb, offset);
787 proto_tree_add_text(tree, tvb, offset, 1,
789 val_to_str(octet & 0x60, q931_l1_stop_bits_vals,
791 proto_tree_add_text(tree, tvb, offset, 1,
793 val_to_str(octet & 0x18, q931_l1_data_bits_vals,
795 proto_tree_add_text(tree, tvb, offset, 1,
797 val_to_str(octet & 0x07, q931_l1_parity_vals,
800 if (octet & Q931_IE_VL_EXTENSION)
804 octet = tvb_get_guint8(tvb, offset);
805 proto_tree_add_text(tree, tvb, offset, 1,
807 (octet & 0x40) ? "Full" : "Half");
808 modem_type = octet & 0x3F;
809 if (modem_type <= 0x5 ||
810 (modem_type >= 0x20 && modem_type <= 0x2F)) {
811 proto_tree_add_text(tree, tvb, offset, 1,
812 "Modem type: National use 0x%02X", modem_type);
813 } else if (modem_type >= 0x30) {
814 proto_tree_add_text(tree, tvb, offset, 1,
815 "Modem type: User specified 0x%02X", modem_type);
817 proto_tree_add_text(tree, tvb, offset, 1,
819 val_to_str(modem_type, q931_l1_modem_type_vals,
820 "Unknown (0x%02X)"));
830 octet = tvb_get_guint8(tvb, offset);
831 if ((octet & 0x60) == 0x40) {
833 * Layer 2 information.
835 uil2_protocol = octet & 0x1F;
836 proto_tree_add_text(tree, tvb, offset, 1,
837 "User information layer 2 protocol: %s",
838 val_to_str(uil2_protocol, q931_uil2_vals,
839 "Unknown (0x%02X)"));
844 * XXX - only in Low-layer compatibility information element.
846 if (octet & Q931_IE_VL_EXTENSION)
850 octet = tvb_get_guint8(tvb, offset);
851 if (uil2_protocol == Q931_UIL2_USER_SPEC) {
852 proto_tree_add_text(tree, tvb, offset, 1,
853 "User-specified layer 2 protocol information: 0x%02X",
856 proto_tree_add_text(tree, tvb, offset, 1,
858 val_to_str(octet & 0x60, q931_mode_vals,
859 "Unknown (0x%02X)"));
864 if (octet & Q931_IE_VL_EXTENSION)
868 octet = tvb_get_guint8(tvb, offset);
869 proto_tree_add_text(tree, tvb, offset, 1,
870 "Window size: %u k", octet & 0x7F);
879 octet = tvb_get_guint8(tvb, offset);
880 if ((octet & 0x60) == 0x60) {
882 * Layer 3 information.
884 uil3_protocol = octet & 0x1F;
885 proto_tree_add_text(tree, tvb, offset, 1,
886 "User information layer 3 protocol: %s",
887 val_to_str(uil3_protocol, q931_uil3_vals,
888 "Unknown (0x%02X)"));
894 * XXX - only in Low-layer compatibility information element.
896 if (octet & Q931_IE_VL_EXTENSION)
900 octet = tvb_get_guint8(tvb, offset);
901 switch (uil3_protocol) {
903 case Q931_UIL3_X25_PL:
904 case Q931_UIL3_ISO_8208:
906 proto_tree_add_text(tree, tvb, offset, 1,
908 val_to_str(octet & 0x60, q931_mode_vals,
909 "Unknown (0x%02X)"));
913 if (octet & Q931_IE_VL_EXTENSION)
917 octet = tvb_get_guint8(tvb, offset);
918 proto_tree_add_text(tree, tvb, offset, 1,
919 "Default packet size: %u", octet & 0x0F);
923 if (octet & Q931_IE_VL_EXTENSION)
927 octet = tvb_get_guint8(tvb, offset);
928 proto_tree_add_text(tree, tvb, offset, 1,
929 "Packet window size: %u", octet & 0x7F);
934 case Q931_UIL3_USER_SPEC:
935 proto_tree_add_text(tree, tvb, offset, 1,
936 "Default packet size: %u octets",
937 1 << (octet & 0x0F));
942 case Q931_UIL3_TR_9577:
943 add_l3_info = (octet & 0x0F) << 4;
944 if (octet & Q931_IE_VL_EXTENSION)
948 octet = tvb_get_guint8(tvb, offset + 1);
949 add_l3_info |= (octet & 0x0F);
950 proto_tree_add_text(tree, tvb, offset, 2,
951 "Additional layer 3 protocol information: %s",
952 val_to_str(add_l3_info, nlpid_vals,
953 "Unknown (0x%02X)"));
964 * Dissect a Cause information element.
968 const value_string q931_cause_location_vals[] = {
969 { 0x00, "User (U)" },
970 { 0x01, "Private network serving the local user (LPN)" },
971 { 0x02, "Public network serving the local user (LN)" },
972 { 0x03, "Transit network (TN)" },
973 { 0x04, "Public network serving the remote user (RLN)" },
974 { 0x05, "Private network serving the remote user (RPN)" },
975 { 0x07, "International network (INTL)" },
976 { 0x0A, "Network beyond interworking point (BI)" },
980 static const value_string q931_cause_recommendation_vals[] = {
984 { 0x05, "Q.1031/Q.1051" },
989 * Cause codes for Cause.
991 #define Q931_CAUSE_UNALLOC_NUMBER 0x01
992 #define Q931_CAUSE_NO_ROUTE_TO_DEST 0x03
993 #define Q931_CAUSE_CALL_REJECTED 0x15
994 #define Q931_CAUSE_NUMBER_CHANGED 0x16
995 #define Q931_CAUSE_ACCESS_INFO_DISC 0x2B
996 #define Q931_CAUSE_QOS_UNAVAILABLE 0x31
997 #define Q931_CAUSE_CHAN_NONEXISTENT 0x52
998 #define Q931_CAUSE_INCOMPATIBLE_DEST 0x58
999 #define Q931_CAUSE_MAND_IE_MISSING 0x60
1000 #define Q931_CAUSE_MT_NONEX_OR_UNIMPL 0x61
1001 #define Q931_CAUSE_IE_NONEX_OR_UNIMPL 0x63
1002 #define Q931_CAUSE_INVALID_IE_CONTENTS 0x64
1003 #define Q931_CAUSE_MSG_INCOMPAT_W_CS 0x65
1004 #define Q931_CAUSE_REC_TIMER_EXP 0x66
1006 const value_string q931_cause_code_vals[] = {
1007 { 0x00, "Valid cause code not yet received" },
1008 { Q931_CAUSE_UNALLOC_NUMBER, "Unallocated (unassigned) number" },
1009 { 0x02, "No route to specified transit network" },
1010 { Q931_CAUSE_NO_ROUTE_TO_DEST, "No route to destination" },
1011 { 0x04, "Send special information tone" },
1012 { 0x05, "Misdialled trunk prefix" },
1013 { 0x06, "Channel unacceptable" },
1014 { 0x07, "Call awarded and being delivered in an established channel" },
1015 { 0x08, "Prefix 0 dialed but not allowed" },
1016 /* Q.850 - "Preemption" */
1017 { 0x09, "Prefix 1 dialed but not allowed" },
1018 /* Q.850 - "Preemption - circuit reserved for reuse" */
1019 { 0x0A, "Prefix 1 dialed but not required" },
1020 { 0x0B, "More digits received than allowed, call is proceeding" },
1021 { 0x0E, "QoR: ported number" },
1022 { 0x10, "Normal call clearing" },
1023 { 0x11, "User busy" },
1024 { 0x12, "No user responding" },
1025 { 0x13, "No answer from user (user alerted)" },
1026 { 0x14, "Subscriber absent" },
1027 { Q931_CAUSE_CALL_REJECTED, "Call rejected" },
1028 { Q931_CAUSE_NUMBER_CHANGED, "Number changed" },
1029 { 0x17, "Reverse charging rejected" },
1030 /* Q.850 - "Redirection to new destination" */
1031 { 0x18, "Call suspended" },
1032 /* Q.850 Amendment 1 - "Call rejected due to feature at the destination" */
1033 { 0x19, "Call resumed" },
1034 /* Q.850 - "Exchange routing error */
1035 { 0x1A, "Non-selected user clearing" },
1036 { 0x1B, "Destination out of order" },
1037 { 0x1C, "Invalid number format (incomplete number)" },
1038 { 0x1D, "Facility rejected" },
1039 { 0x1E, "Response to STATUS ENQUIRY" },
1040 { 0x1F, "Normal unspecified" },
1041 { 0x21, "Circuit out of order" },
1042 { 0x22, "No circuit/channel available" },
1043 { 0x23, "Destination unattainable" },
1044 { 0x25, "Degraded service" },
1045 { 0x26, "Network out of order" },
1046 { 0x27, "Transit delay range cannot be achieved" },
1047 /* Q.850 - "Permanent frame mode connection out of service" */
1048 { 0x28, "Throughput range cannot be achieved" },
1049 /* Q.850 - "Permanent frame mode connection operational" */
1050 { 0x29, "Temporary failure" },
1051 { 0x2A, "Switching equipment congestion" },
1052 { Q931_CAUSE_ACCESS_INFO_DISC, "Access information discarded" },
1053 { 0x2C, "Requested circuit/channel not available" },
1054 { 0x2D, "Pre-empted" },
1055 { 0x2E, "Precedence call blocked" },
1056 { 0x2F, "Resources unavailable, unspecified" },
1057 { Q931_CAUSE_QOS_UNAVAILABLE, "Quality of service unavailable" },
1058 { 0x32, "Requested facility not subscribed" },
1059 { 0x33, "Reverse charging not allowed" },
1060 { 0x34, "Outgoing calls barred" },
1061 { 0x35, "Outgoing calls barred within CUG" },
1062 { 0x36, "Incoming calls barred" },
1063 { 0x37, "Incoming calls barred within CUG" },
1064 { 0x38, "Call waiting not subscribed" },
1065 { 0x39, "Bearer capability not authorized" },
1066 { 0x3A, "Bearer capability not presently available" },
1067 { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
1068 { 0x3F, "Service or option not available, unspecified" },
1069 { 0x41, "Bearer capability not implemented" },
1070 { 0x42, "Channel type not implemented" },
1071 { 0x43, "Transit network selection not implemented" },
1072 { 0x44, "Message not implemented" },
1073 { 0x45, "Requested facility not implemented" },
1074 { 0x46, "Only restricted digital information bearer capability is available" },
1075 { 0x4F, "Service or option not implemented, unspecified" },
1076 { 0x51, "Invalid call reference value" },
1077 { Q931_CAUSE_CHAN_NONEXISTENT, "Identified channel does not exist" },
1078 { 0x53, "Call identity does not exist for suspended call" },
1079 { 0x54, "Call identity in use" },
1080 { 0x55, "No call suspended" },
1081 { 0x56, "Call having the requested call identity has been cleared" },
1082 { 0x57, "Called user not member of CUG" },
1083 { Q931_CAUSE_INCOMPATIBLE_DEST, "Incompatible destination" },
1084 { 0x59, "Non-existent abbreviated address entry" },
1085 { 0x5A, "Destination address missing, and direct call not subscribed" },
1086 /* Q.850 - "Non-existent CUG" */
1087 { 0x5B, "Invalid transit network selection (national use)" },
1088 { 0x5C, "Invalid facility parameter" },
1089 { 0x5D, "Mandatory information element is missing" },
1090 { 0x5F, "Invalid message, unspecified" },
1091 { Q931_CAUSE_MAND_IE_MISSING, "Mandatory information element is missing" },
1092 { Q931_CAUSE_MT_NONEX_OR_UNIMPL,"Message type non-existent or not implemented" },
1093 { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
1094 { Q931_CAUSE_IE_NONEX_OR_UNIMPL,"Information element nonexistant or not implemented" },
1095 { Q931_CAUSE_INVALID_IE_CONTENTS,"Invalid information element contents" },
1096 { Q931_CAUSE_MSG_INCOMPAT_W_CS, "Message not compatible with call state" },
1097 { Q931_CAUSE_REC_TIMER_EXP, "Recovery on timer expiry" },
1098 { 0x67, "Parameter non-existent or not implemented - passed on" },
1099 { 0x6E, "Message with unrecognized parameter discarded" },
1100 { 0x6F, "Protocol error, unspecified" },
1101 { 0x7F, "Internetworking, unspecified" },
1105 static const value_string q931_cause_condition_vals[] = {
1106 { 0x00, "Unknown" },
1107 { 0x01, "Permanent" },
1108 { 0x02, "Transient" },
1112 #define Q931_REJ_USER_SPECIFIC 0x00
1113 #define Q931_REJ_IE_MISSING 0x04
1114 #define Q931_REJ_IE_INSUFFICIENT 0x08
1116 static const value_string q931_rejection_reason_vals[] = {
1117 { 0x00, "User specific" },
1118 { 0x04, "Information element missing" },
1119 { 0x08, "Information element contents are not sufficient" },
1124 dissect_q931_cause_ie(tvbuff_t *tvb, int offset, int len,
1125 proto_tree *tree, int hf_cause_value)
1129 guint8 coding_standard;
1130 guint8 rejection_reason;
1134 octet = tvb_get_guint8(tvb, offset);
1135 coding_standard = octet & 0x60;
1136 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
1137 if (coding_standard != Q931_ITU_STANDARDIZED_CODING) {
1139 * We don't know how the cause is encoded,
1140 * so just dump it as data and be done with it.
1142 proto_tree_add_text(tree, tvb, offset,
1144 tvb_bytes_to_str(tvb, offset, len));
1147 proto_tree_add_text(tree, tvb, offset, 1,
1149 val_to_str(octet & 0x0F, q931_cause_location_vals,
1151 proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet);
1155 if (!(octet & Q931_IE_VL_EXTENSION)) {
1158 octet = tvb_get_guint8(tvb, offset);
1159 proto_tree_add_text(tree, tvb, offset, 1,
1160 "Recommendation: %s",
1161 val_to_str(octet & 0x7F, q931_cause_recommendation_vals,
1162 "Unknown (0x%02X)"));
1169 octet = tvb_get_guint8(tvb, offset);
1170 cause_value = octet & 0x7F;
1171 proto_tree_add_uint(tree, hf_cause_value, tvb, offset, 1, cause_value);
1177 switch (cause_value) {
1179 case Q931_CAUSE_UNALLOC_NUMBER:
1180 case Q931_CAUSE_NO_ROUTE_TO_DEST:
1181 case Q931_CAUSE_QOS_UNAVAILABLE:
1182 octet = tvb_get_guint8(tvb, offset);
1183 proto_tree_add_text(tree, tvb, offset, 1,
1184 "Network service: %s",
1185 (octet & 0x80) ? "User" : "Provider");
1186 proto_tree_add_text(tree, tvb, offset, 1,
1188 (octet & 0x40) ? "Abnormal" : "Normal");
1189 proto_tree_add_text(tree, tvb, offset, 1,
1191 val_to_str(octet & 0x03, q931_cause_condition_vals,
1195 case Q931_CAUSE_CALL_REJECTED:
1196 rejection_reason = octet & 0x7C;
1197 proto_tree_add_text(tree, tvb, offset, 1,
1198 "Rejection reason: %s",
1199 val_to_str(octet & 0x7C, q931_rejection_reason_vals,
1201 proto_tree_add_text(tree, tvb, offset, 1,
1203 val_to_str(octet & 0x03, q931_cause_condition_vals,
1210 switch (rejection_reason) {
1212 case Q931_REJ_USER_SPECIFIC:
1213 proto_tree_add_text(tree, tvb, offset, len,
1214 "User specific diagnostic: %s",
1215 tvb_bytes_to_str(tvb, offset, len));
1218 case Q931_REJ_IE_MISSING:
1219 proto_tree_add_text(tree, tvb, offset, 1,
1220 "Missing information element: %s",
1221 val_to_str(tvb_get_guint8(tvb, offset), q931_info_element_vals0,
1222 "Unknown (0x%02X)"));
1225 case Q931_REJ_IE_INSUFFICIENT:
1226 proto_tree_add_text(tree, tvb, offset, 1,
1227 "Insufficient information element: %s",
1228 val_to_str(tvb_get_guint8(tvb, offset), q931_info_element_vals0,
1229 "Unknown (0x%02X)"));
1233 proto_tree_add_text(tree, tvb, offset, len,
1235 tvb_bytes_to_str(tvb, offset, len));
1240 case Q931_CAUSE_ACCESS_INFO_DISC:
1241 case Q931_CAUSE_INCOMPATIBLE_DEST:
1242 case Q931_CAUSE_MAND_IE_MISSING:
1243 case Q931_CAUSE_IE_NONEX_OR_UNIMPL:
1244 case Q931_CAUSE_INVALID_IE_CONTENTS:
1246 proto_tree_add_text(tree, tvb, offset, 1,
1247 "Information element: %s",
1248 val_to_str(tvb_get_guint8(tvb, offset), q931_info_element_vals0,
1249 "Unknown (0x%02X)"));
1255 case Q931_CAUSE_MT_NONEX_OR_UNIMPL:
1256 case Q931_CAUSE_MSG_INCOMPAT_W_CS:
1257 proto_tree_add_text(tree, tvb, offset, 1,
1259 val_to_str(tvb_get_guint8(tvb, offset), q931_message_type_vals,
1260 "Unknown (0x%02X)"));
1263 case Q931_CAUSE_REC_TIMER_EXP:
1266 proto_tree_add_text(tree, tvb, offset, 3,
1267 "Timer: %.3s", tvb_get_ptr(tvb, offset, 3));
1271 proto_tree_add_text(tree, tvb, offset, len,
1273 tvb_bytes_to_str(tvb, offset, len));
1278 * Dissect a Call state information element.
1280 static const value_string q931_call_state_vals[] = {
1282 { 0x01, "Call initiated" },
1283 { 0x02, "Overlap sending" },
1284 { 0x03, "Outgoing call proceeding" },
1285 { 0x04, "Call delivered" },
1286 { 0x06, "Call present" },
1287 { 0x07, "Call received" },
1288 { 0x08, "Connect request" },
1289 { 0x09, "Incoming call proceeding" },
1291 { 0x0B, "Disconnect request" },
1292 { 0x0C, "Disconnect indication" },
1293 { 0x0F, "Suspend request" },
1294 { 0x12, "Resume request" },
1295 { 0x13, "Release request" },
1296 { 0x16, "Call abort"},
1297 { 0x19, "Overlap receiving" },
1298 { 0x3D, "Restart request" },
1299 { 0x3E, "Restart" },
1304 dissect_q931_call_state_ie(tvbuff_t *tvb, int offset, int len,
1308 guint8 coding_standard;
1312 octet = tvb_get_guint8(tvb, offset);
1313 coding_standard = octet & 0x60;
1314 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
1315 if (coding_standard != Q931_ITU_STANDARDIZED_CODING) {
1317 * We don't know how the call state is encoded,
1318 * so just dump it as data and be done with it.
1320 proto_tree_add_text(tree, tvb, offset,
1322 tvb_bytes_to_str(tvb, offset, len));
1325 proto_tree_add_text(tree, tvb, offset, 1,
1327 val_to_str(octet & 0x3F, q931_call_state_vals,
1328 "Unknown (0x%02X)"));
1332 * Dissect a Channel identification information element.
1334 #define Q931_INTERFACE_IDENTIFIED 0x40
1335 #define Q931_NOT_BASIC_CHANNEL 0x20
1337 static const value_string q931_basic_channel_selection_vals[] = {
1338 { 0x00, "No channel" },
1339 { 0x01, "B1 channel" },
1340 { 0x02, "B2 channel" },
1341 { 0x03, "Any channel" },
1345 static const value_string q931_not_basic_channel_selection_vals[] = {
1346 { 0x00, "No channel" },
1347 { 0x01, "Channel indicated in following octets" },
1348 { 0x03, "Any channel" },
1352 #define Q931_IS_SLOT_MAP 0x10
1354 static const value_string q931_element_type_vals[] = {
1355 { 0x03, "B-channel units" },
1356 { 0x06, "H0-channel units" },
1357 { 0x08, "H11-channel units" },
1358 { 0x09, "H12-channel units" },
1363 dissect_q931_channel_identification_ie(tvbuff_t *tvb, int offset, int len,
1367 int identifier_offset;
1369 guint8 coding_standard;
1373 octet = tvb_get_guint8(tvb, offset);
1374 proto_tree_add_text(tree, tvb, offset, 1,
1375 "Interface %s identified",
1376 (octet & Q931_INTERFACE_IDENTIFIED) ? "explicitly" : "implicitly");
1377 proto_tree_add_text(tree, tvb, offset, 1,
1379 (octet & Q931_NOT_BASIC_CHANNEL) ? "Not basic" : "Basic");
1380 proto_tree_add_text(tree, tvb, offset, 1,
1381 "Indicated channel is %s",
1382 (octet & 0x08) ? "required" : "preferred");
1383 proto_tree_add_text(tree, tvb, offset, 1,
1384 "Indicated channel is %sthe D-channel",
1385 (octet & 0x04) ? "" : "not ");
1386 if (octet & Q931_NOT_BASIC_CHANNEL) {
1387 proto_tree_add_text(tree, tvb, offset, 1,
1388 "Channel selection: %s",
1389 val_to_str(octet & 0x03, q931_not_basic_channel_selection_vals,
1392 proto_tree_add_text(tree, tvb, offset, 1,
1393 "Channel selection: %s",
1394 val_to_str(octet & 0x03, q931_basic_channel_selection_vals,
1400 if (octet & Q931_INTERFACE_IDENTIFIED) {
1401 identifier_offset = offset;
1406 octet = tvb_get_guint8(tvb, offset);
1410 } while (!(octet & Q931_IE_VL_EXTENSION));
1413 * XXX - do we want to strip off the 8th bit on the
1414 * last octet of the interface identifier?
1416 if (identifier_len != 0) {
1417 proto_tree_add_text(tree, tvb, identifier_offset,
1418 identifier_len, "Interface identifier: %s",
1420 tvb_get_ptr(tvb, identifier_offset, identifier_len),
1425 if (octet & Q931_NOT_BASIC_CHANNEL) {
1428 octet = tvb_get_guint8(tvb, offset);
1429 coding_standard = octet & 0x60;
1430 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
1431 if (coding_standard != Q931_ITU_STANDARDIZED_CODING) {
1433 * We don't know how the channel identifier is
1434 * encoded, so just dump it as data and be done
1437 proto_tree_add_text(tree, tvb, offset,
1439 tvb_bytes_to_str(tvb, offset, len));
1442 proto_tree_add_text(tree, tvb, offset, 1,
1443 "Channel is indicated by %s",
1444 (octet & Q931_IS_SLOT_MAP) ? "slot map" : "number");
1445 proto_tree_add_text(tree, tvb, offset, 1,
1447 (octet & Q931_IS_SLOT_MAP) ? "Map element" : "Channel",
1448 val_to_str(octet & 0x0F, q931_element_type_vals,
1449 "Unknown (0x%02X)"));
1452 * XXX - dump the channel number or slot map.
1458 * Dissect a Progress indicator information element.
1460 static const value_string q931_progress_description_vals[] = {
1461 { 0x01, "Call is not end-to-end ISDN - progress information available in-band" },
1462 { 0x02, "Destination address is non-ISDN" },
1463 { 0x03, "Origination address is non-ISDN" },
1464 { 0x04, "Call has returned to the ISDN" },
1465 { 0x05, "Interworking has occurred and has resulted in a telecommunications service change" },
1466 { 0x08, "In-band information or an appropriate pattern is now available" },
1471 dissect_q931_progress_indicator_ie(tvbuff_t *tvb, int offset, int len,
1475 guint8 coding_standard;
1479 octet = tvb_get_guint8(tvb, offset);
1480 coding_standard = octet & 0x60;
1481 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
1482 if (coding_standard != Q931_ITU_STANDARDIZED_CODING) {
1484 * We don't know how the progress indicator is encoded,
1485 * so just dump it as data and be done with it.
1487 proto_tree_add_text(tree, tvb, offset,
1489 tvb_bytes_to_str(tvb, offset, len));
1492 proto_tree_add_text(tree, tvb, offset, 1,
1494 val_to_str(octet & 0x0F, q931_cause_location_vals,
1501 octet = tvb_get_guint8(tvb, offset);
1502 proto_tree_add_text(tree, tvb, offset, 1,
1503 "Progress description: %s",
1504 val_to_str(octet & 0x7F, q931_progress_description_vals,
1505 "Unknown (0x%02X)"));
1509 * Dissect a Network-specific facilities or Transit network selection
1510 * information element.
1512 static const value_string q931_netid_type_vals[] = {
1513 { 0x00, "User specified" },
1514 { 0x20, "National network identification" },
1515 { 0x30, "International network identification" },
1519 static const value_string q931_netid_plan_vals[] = {
1520 { 0x00, "Unknown" },
1521 { 0x01, "Carrier Identification Code" },
1522 { 0x03, "X.121 data network identification code" },
1527 dissect_q931_ns_facilities_ie(tvbuff_t *tvb, int offset, int len,
1535 octet = tvb_get_guint8(tvb, offset);
1536 netid_len = octet & 0x7F;
1537 proto_tree_add_text(tree, tvb, offset, 1,
1538 "Network identification length: %u",
1542 if (netid_len != 0) {
1545 octet = tvb_get_guint8(tvb, offset);
1546 proto_tree_add_text(tree, tvb, offset, 1,
1547 "Type of network identification: %s",
1548 val_to_str(octet & 0x70, q931_netid_type_vals,
1549 "Unknown (0x%02X)"));
1550 proto_tree_add_text(tree, tvb, offset, 1,
1551 "Network identification plan: %s",
1552 val_to_str(octet & 0x0F, q931_netid_plan_vals,
1553 "Unknown (0x%02X)"));
1560 if (netid_len > len)
1562 if (netid_len != 0) {
1563 proto_tree_add_text(tree, tvb, offset, netid_len,
1564 "Network identification: %s",
1565 tvb_format_text(tvb, offset, netid_len));
1566 offset += netid_len;
1572 * Whatever is left is the network-specific facility
1577 proto_tree_add_text(tree, tvb, offset,
1578 len, "Network-specific facility specification: %s",
1579 tvb_bytes_to_str(tvb, offset, len));
1583 * Dissect a Notification indicator information element.
1585 static const value_string q931_notification_description_vals[] = {
1586 { 0x00, "User suspended" },
1587 { 0x01, "User resumed" },
1588 { 0x02, "Bearer service change" },
1593 dissect_q931_notification_indicator_ie(tvbuff_t *tvb, int offset, int len,
1600 octet = tvb_get_guint8(tvb, offset);
1601 proto_tree_add_text(tree, tvb, offset, 1,
1602 "Notification description: %s",
1603 val_to_str(octet & 0x7F, q931_notification_description_vals,
1604 "Unknown (0x%02X)"));
1608 * Dissect a Date/time information element.
1611 dissect_q931_date_time_ie(tvbuff_t *tvb, int offset, int len,
1615 proto_tree_add_text(tree, tvb, offset, len,
1616 "Date/time: length is %d, should be 6\n", len);
1620 * XXX - what is "year" relative to? Is "month" 0-origin or
1621 * 1-origin? Q.931 doesn't say....
1623 proto_tree_add_text(tree, tvb, offset, 6,
1624 "Date/time: %02u-%02u-%02u %02u:%02u:%02u",
1625 tvb_get_guint8(tvb, offset + 0), tvb_get_guint8(tvb, offset + 1), tvb_get_guint8(tvb, offset + 2),
1626 tvb_get_guint8(tvb, offset + 3), tvb_get_guint8(tvb, offset + 4), tvb_get_guint8(tvb, offset + 5));
1630 * Dissect a Signal information element.
1632 static const value_string q931_signal_vals[] = {
1633 { 0x00, "Dial tone on" },
1634 { 0x01, "Ring tone on" },
1635 { 0x02, "Intercept tone on" },
1636 { 0x03, "Network congestion tone on" }, /* "fast busy" */
1637 { 0x04, "Busy tone on" },
1638 { 0x05, "Confirm tone on" },
1639 { 0x06, "Answer tone on" },
1640 { 0x07, "Call waiting tone on" },
1641 { 0x08, "Off-hook warning tone on" },
1642 { 0x09, "Preemption tone on" },
1643 { 0x3F, "Tones off" },
1644 { 0x40, "Alerting on - pattern 0" },
1645 { 0x41, "Alerting on - pattern 1" },
1646 { 0x42, "Alerting on - pattern 2" },
1647 { 0x43, "Alerting on - pattern 3" },
1648 { 0x44, "Alerting on - pattern 4" },
1649 { 0x45, "Alerting on - pattern 5" },
1650 { 0x46, "Alerting on - pattern 6" },
1651 { 0x47, "Alerting on - pattern 7" },
1652 { 0x4F, "Alerting off" },
1657 dissect_q931_signal_ie(tvbuff_t *tvb, int offset, int len,
1661 proto_tree_add_text(tree, tvb, offset, len,
1662 "Signal: length is %d, should be 1\n", len);
1665 proto_tree_add_text(tree, tvb, offset, 1,
1667 val_to_str(tvb_get_guint8(tvb, offset), q931_signal_vals,
1668 "Unknown (0x%02X)"));
1672 * Dissect an Information rate information element.
1674 static const value_string q931_throughput_class_vals[] = {
1675 { 0x03, "75 bit/s" },
1676 { 0x04, "150 bit/s" },
1677 { 0x05, "300 bit/s" },
1678 { 0x06, "600 bit/s" },
1679 { 0x07, "1200 bit/s" },
1680 { 0x08, "2400 bit/s" },
1681 { 0x09, "4800 bit/s" },
1682 { 0x0A, "9600 bit/s" },
1683 { 0x0B, "19200 bit/s" },
1684 { 0x0C, "48000 bit/s" },
1685 { 0x0D, "64000 bit/s" },
1690 dissect_q931_information_rate_ie(tvbuff_t *tvb, int offset, int len,
1694 proto_tree_add_text(tree, tvb, offset, len,
1695 "Information rate: length is %d, should be 4\n", len);
1698 proto_tree_add_text(tree, tvb, offset + 0, 1,
1699 "Incoming information rate: %s",
1700 val_to_str(tvb_get_guint8(tvb, offset + 0) & 0x1F,
1701 q931_throughput_class_vals, "Unknown (0x%02X)"));
1702 proto_tree_add_text(tree, tvb, offset + 1, 1,
1703 "Outgoing information rate: %s",
1704 val_to_str(tvb_get_guint8(tvb, offset + 1) & 0x1F,
1705 q931_throughput_class_vals, "Unknown (0x%02X)"));
1706 proto_tree_add_text(tree, tvb, offset + 2, 1,
1707 "Minimum incoming information rate: %s",
1708 val_to_str(tvb_get_guint8(tvb, offset + 2) & 0x1F,
1709 q931_throughput_class_vals, "Unknown (0x%02X)"));
1710 proto_tree_add_text(tree, tvb, offset + 3, 1,
1711 "Minimum outgoing information rate: %s",
1712 val_to_str(tvb_get_guint8(tvb, offset + 3) & 0x1F,
1713 q931_throughput_class_vals, "Unknown (0x%02X)"));
1717 dissect_q931_guint16_value(tvbuff_t *tvb, int offset, int len,
1718 proto_tree *tree, char *label)
1726 octet = tvb_get_guint8(tvb, offset);
1727 if (octet & Q931_IE_VL_EXTENSION) {
1729 * Only one octet long - error.
1733 value = (octet & 0x3) << 14;
1740 * We've reached the end of the information element - error.
1744 octet = tvb_get_guint8(tvb, offset);
1745 if (octet & Q931_IE_VL_EXTENSION) {
1747 * Only two octets long - error.
1751 value |= (octet & 0x7F) << 7;
1758 * We've reached the end of the information element - error.
1762 octet = tvb_get_guint8(tvb, offset);
1763 if (!(octet & Q931_IE_VL_EXTENSION)) {
1765 * More than three octets long - error.
1769 value |= (octet & 0x7F);
1774 proto_tree_add_text(tree, tvb, offset, value_len, "%s: %u ms", label,
1779 proto_tree_add_text(tree, tvb, offset, len,
1780 "%s goes past end of information element", label);
1784 proto_tree_add_text(tree, tvb, offset, len, "%s isn't 3 octets long",
1790 * Dissect an End-to-end transit delay information element.
1793 dissect_q931_e2e_transit_delay_ie(tvbuff_t *tvb, int offset, int len,
1800 value_len = dissect_q931_guint16_value(tvb, offset, len, tree,
1801 "Cumulative transit delay");
1804 offset += value_len;
1809 value_len = dissect_q931_guint16_value(tvb, offset, len, tree,
1810 "Requested end-to-end transit delay");
1813 offset += value_len;
1818 value_len = dissect_q931_guint16_value(tvb, offset, len, tree,
1819 "Maximum end-to-end transit delay");
1823 * Dissect a Transit delay selection and indication information element.
1826 dissect_q931_td_selection_and_int_ie(tvbuff_t *tvb, int offset, int len,
1831 dissect_q931_guint16_value(tvb, offset, len, tree,
1836 * Dissect a Packet layer binary parameters information element.
1838 static const value_string q931_fast_selected_vals[] = {
1839 { 0x00, "Fast select not requested" },
1840 { 0x08, "Fast select not requested" },
1841 { 0x10, "Fast select requested with no restriction of response" },
1842 { 0x18, "Fast select requested with restrictions of response" },
1847 dissect_q931_pl_binary_parameters_ie(tvbuff_t *tvb, int offset, int len,
1854 octet = tvb_get_guint8(tvb, offset);
1855 proto_tree_add_text(tree, tvb, offset, 1,
1857 val_to_str(octet & 0x18, q931_fast_selected_vals, NULL));
1858 proto_tree_add_text(tree, tvb, offset, 1,
1860 (octet & 0x04) ? "No request/request denied" :
1861 "Request indicated/request accepted");
1862 proto_tree_add_text(tree, tvb, offset, 1,
1864 (octet & 0x02) ? "Link-by-link" : "End-to-end");
1865 proto_tree_add_text(tree, tvb, offset, 1,
1866 "Modulus %u sequencing",
1867 (octet & 0x01) ? 8 : 128);
1871 * Dissect a Packet layer window size information element.
1874 dissect_q931_pl_window_size_ie(tvbuff_t *tvb, int offset, int len,
1879 proto_tree_add_text(tree, tvb, offset, 1,
1880 "Forward value: %u", tvb_get_guint8(tvb, offset) & 0x7F);
1886 proto_tree_add_text(tree, tvb, offset, 1,
1887 "Backward value: %u", tvb_get_guint8(tvb, offset) & 0x7F);
1891 * Dissect a Packet size information element.
1894 dissect_q931_packet_size_ie(tvbuff_t *tvb, int offset, int len,
1899 proto_tree_add_text(tree, tvb, offset, 1,
1900 "Forward value: %u", tvb_get_guint8(tvb, offset) & 0x7F);
1906 proto_tree_add_text(tree, tvb, offset, 1,
1907 "Backward value: %u", tvb_get_guint8(tvb, offset) & 0x7F);
1911 * Dissect a Closed user group information element.
1913 static const value_string q931_cug_indication_vals[] = {
1914 { 0x01, "Closed user group selection" },
1915 { 0x02, "Closed user group with outgoing access selection and indication" },
1920 dissect_q931_cug_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree)
1924 proto_tree_add_text(tree, tvb, offset, 1,
1925 "CUG indication: %s",
1926 val_to_str(tvb_get_guint8(tvb, offset) & 0x07,
1927 q931_cug_indication_vals, "Unknown (0x%02X)"));
1933 proto_tree_add_text(tree, tvb, offset, len, "CUG index code: %s",
1934 tvb_format_text(tvb, offset, len));
1938 * Dissect a Reverse charging indication information element.
1940 static const value_string q931_reverse_charging_indication_vals[] = {
1941 { 0x01, "Reverse charging requested" },
1946 dissect_q931_reverse_charge_ind_ie(tvbuff_t *tvb, int offset, int len,
1951 proto_tree_add_text(tree, tvb, offset, 1,
1952 "Reverse charging indication: %s",
1953 val_to_str(tvb_get_guint8(tvb, offset) & 0x07,
1954 q931_reverse_charging_indication_vals, "Unknown (0x%02X)"));
1958 * Dissect a (phone) number information element.
1960 static const value_string q931_number_type_vals[] = {
1962 { 0x1, "International number" },
1963 { 0x2, "National number" },
1964 { 0x3, "Network specific number" },
1965 { 0x4, "Subscriber number" },
1966 { 0x6, "Abbreviated number" },
1970 static const value_string q931_numbering_plan_vals[] = {
1971 { 0x00, "Unknown" },
1972 { 0x01, "E.164 ISDN/telephony numbering" },
1973 { 0x03, "X.121 data numbering" },
1974 { 0x04, "F.69 Telex numbering" },
1975 { 0x08, "National standard numbering" },
1976 { 0x09, "Private numbering" },
1980 static const value_string q931_presentation_indicator_vals[] = {
1981 { 0x00, "Presentation allowed" },
1982 { 0x20, "Presentation restricted" },
1983 { 0x40, "Number not available due to interworking" },
1987 static const value_string q931_screening_indicator_vals[] = {
1988 { 0x00, "User-provided, not screened" },
1989 { 0x01, "User-provided, verified and passed" },
1990 { 0x02, "User-provided, verified and failed" },
1991 { 0x03, "Network-provided" },
1995 static const value_string q931_redirection_reason_vals[] = {
1996 { 0x00, "Unknown" },
1997 { 0x01, "Call forwarding busy or called DTE busy" },
1998 { 0x02, "Call forwarding no reply" },
1999 { 0x04, "Call deflection" },
2000 { 0x09, "Called DTE out of order" },
2001 { 0x0A, "Call forwarding by the called DTE" },
2002 { 0x0F, "Call forwarding unconditional or systematic call redirection" },
2007 dissect_q931_number_ie(tvbuff_t *tvb, int offset, int len,
2008 proto_tree *tree, int hfindex)
2014 octet = tvb_get_guint8(tvb, offset);
2015 proto_tree_add_uint(tree, hf_q931_numbering_plan, tvb, offset, 1, octet);
2016 proto_tree_add_uint(tree, hf_q931_number_type, tvb, offset, 1, octet);
2017 proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet);
2022 if (!(octet & Q931_IE_VL_EXTENSION)) {
2025 octet = tvb_get_guint8(tvb, offset);
2026 proto_tree_add_text(tree, tvb, offset, 1,
2027 "Presentation indicator: %s",
2028 val_to_str(octet & 0x60, q931_presentation_indicator_vals,
2030 proto_tree_add_text(tree, tvb, offset, 1,
2031 "Screening indicator: %s",
2032 val_to_str(octet & 0x03, q931_screening_indicator_vals,
2039 * XXX - only in a Redirecting number information element.
2041 if (!(octet & Q931_IE_VL_EXTENSION)) {
2044 octet = tvb_get_guint8(tvb, offset);
2045 proto_tree_add_text(tree, tvb, offset, 1,
2046 "Reason for redirection: %s",
2047 val_to_str(octet & 0x0F, q931_redirection_reason_vals,
2055 proto_tree_add_item(tree, hfindex, tvb, offset, len, FALSE);
2059 * Dissect a party subaddress information element.
2061 static const value_string q931_subaddress_type_vals[] = {
2062 { 0x00, "X.213/ISO 8348 Add.2 NSAP" },
2063 { 0x20, "User-specified" },
2067 static const value_string q931_odd_even_indicator_vals[] = {
2068 { 0x00, "Even number of address signals" },
2069 { 0x10, "Odd number of address signals" },
2074 dissect_q931_party_subaddr_ie(tvbuff_t *tvb, int offset, int len,
2081 octet = tvb_get_guint8(tvb, offset);
2082 proto_tree_add_text(tree, tvb, offset, 1,
2083 "Type of subaddress: %s",
2084 val_to_str(octet & 0x70, q931_subaddress_type_vals,
2085 "Unknown (0x%02X)"));
2086 proto_tree_add_text(tree, tvb, offset, 1,
2087 "Odd/even indicator: %s",
2088 val_to_str(octet & 0x10, q931_odd_even_indicator_vals,
2095 proto_tree_add_text(tree, tvb, offset, len, "Subaddress: %s",
2096 tvb_bytes_to_str(tvb, offset, len));
2100 * Dissect a Restart indicator information element.
2102 static const value_string q931_restart_indicator_class_vals[] = {
2103 { 0x00, "Indicated channels" },
2104 { 0x06, "Single interface" },
2105 { 0x07, "All interfaces" },
2110 dissect_q931_restart_indicator_ie(tvbuff_t *tvb, int offset, int len,
2114 proto_tree_add_text(tree, tvb, offset, len,
2115 "Restart indicator: length is %d, should be 1\n", len);
2118 proto_tree_add_text(tree, tvb, offset, 1,
2119 "Restart indicator: %s",
2120 val_to_str(tvb_get_guint8(tvb, offset) & 0x07,
2121 q931_restart_indicator_class_vals, "Unknown (0x%02X)"));
2125 * Dissect a High-layer compatibility information element.
2127 #define Q931_AUDIOVISUAL 0x60
2128 static const value_string q931_high_layer_characteristics_vals[] = {
2129 { 0x01, "Telephony" },
2130 { 0x04, "F.182 Facsimile Group 2/3" },
2131 { 0x21, "F.184 Facsimile Group 4 Class I" },
2132 { 0x24, "F.230 Teletex, basic and mixed mode, and F.184 Facsimile Group 4, Classes II and III" },
2133 { 0x28, "F.220 Teletex, basic and processable mode" },
2134 { 0x31, "F.200 Teletex, basic mode" },
2135 { 0x32, "F.300 and T.102 syntax-based Videotex" },
2136 { 0x33, "F.300 and T.101 international Videotex interworking" },
2137 { 0x35, "F.60 Telex" },
2138 { 0x38, "X.400 Message Handling Systems" },
2139 { 0x41, "X.200 OSI application" },
2140 { 0x42, "FTAM application" },
2141 { 0x5E, "Reserved for maintenance" },
2142 { 0x5F, "Reserved for management" },
2143 { Q931_AUDIOVISUAL, "F.720/F.821 and F.731 Profile 1a videotelephony" },
2144 { 0x61, "F.702 and F.731 Profile 1b videoconferencing" },
2145 { 0x62, "F.702 and F.731 audiographic conferencing" },
2149 static const value_string q931_audiovisual_characteristics_vals[] = {
2150 { 0x01, "Capability set of initial channel of H.221" },
2151 { 0x02, "Capability set of subsequent channel of H.221" },
2152 { 0x21, "Capability set of initial channel of an active 3.1kHz audio or speech call" },
2157 dissect_q931_high_layer_compat_ie(tvbuff_t *tvb, int offset, int len,
2161 guint8 coding_standard;
2162 guint8 characteristics;
2166 octet = tvb_get_guint8(tvb, offset);
2167 coding_standard = octet & 0x60;
2168 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
2171 if (coding_standard != Q931_ITU_STANDARDIZED_CODING) {
2173 * We don't know how the call state is encoded,
2174 * so just dump it as data and be done with it.
2176 proto_tree_add_text(tree, tvb, offset,
2178 tvb_bytes_to_str(tvb, offset, len));
2184 octet = tvb_get_guint8(tvb, offset);
2185 characteristics = octet & 0x7F;
2186 proto_tree_add_text(tree, tvb, offset, 1,
2187 "High layer characteristics identification: %s",
2188 val_to_str(characteristics, q931_high_layer_characteristics_vals,
2189 "Unknown (0x%02X)"));
2193 if (!(octet & Q931_IE_VL_EXTENSION)) {
2196 octet = tvb_get_guint8(tvb, offset);
2197 if (characteristics == Q931_AUDIOVISUAL) {
2198 proto_tree_add_text(tree, tvb, offset, 1,
2199 "Extended audiovisual characteristics identification: %s",
2200 val_to_str(octet & 0x7F,
2201 q931_audiovisual_characteristics_vals,
2202 "Unknown (0x%02X)"));
2204 proto_tree_add_text(tree, tvb, offset, 1,
2205 "Extended high layer characteristics identification: %s",
2206 val_to_str(octet & 0x7F,
2207 q931_high_layer_characteristics_vals,
2208 "Unknown (0x%02X)"));
2215 * Dissect a User-user information element.
2217 #define Q931_PROTOCOL_DISCRIMINATOR_IA5 0x04
2218 #define Q931_PROTOCOL_DISCRIMINATOR_ASN1 0x05
2220 static const value_string q931_protocol_discriminator_vals[] = {
2221 { 0x00, "User-specific protocol" },
2222 { 0x01, "OSI high layer protocols" },
2224 { Q931_PROTOCOL_DISCRIMINATOR_IA5, "IA5 characters" },
2225 { Q931_PROTOCOL_DISCRIMINATOR_ASN1, "X.208 and X.209 coded user information" },
2226 { 0x07, "V.120 rate adaption" },
2227 { 0x08, "Q.931/I.451 user-network call control messages" },
2232 dissect_q931_user_user_ie(tvbuff_t *tvb, int offset, int len,
2239 octet = tvb_get_guint8(tvb, offset);
2240 proto_tree_add_text(tree, tvb, offset, 1,
2241 "Protocol discriminator: %s",
2242 val_to_str(octet, q931_protocol_discriminator_vals,
2243 "Unknown (0x%02x)"));
2251 case Q931_PROTOCOL_DISCRIMINATOR_IA5:
2252 proto_tree_add_text(tree, tvb, offset, len, "User information: %s",
2253 tvb_format_text(tvb, offset, len));
2257 proto_tree_add_text(tree, tvb, offset, len, "User information: %s",
2258 tvb_bytes_to_str(tvb, offset, len));
2264 * Dissect information elements consisting of ASCII^H^H^H^H^HIA5 text.
2267 dissect_q931_ia5_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree,
2271 proto_tree_add_text(tree, tvb, offset, len, "%s: %s", label,
2272 tvb_format_text(tvb, offset, len));
2276 static const value_string q931_codeset_vals[] = {
2277 { 0x00, "Q.931 information elements" },
2278 { 0x04, "Information elements for ISO/IEC use" },
2279 { 0x05, "Information elements for national use" },
2280 { 0x06, "Information elements specific to the local network" },
2281 { 0x07, "User-specific information elements" },
2286 dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2290 proto_tree *q931_tree = NULL;
2292 proto_tree *ie_tree = NULL;
2293 guint8 call_ref_len;
2294 guint8 call_ref[15];
2295 guint8 message_type;
2296 guint8 info_element;
2297 guint16 info_element_len;
2298 int codeset, locked_codeset;
2299 gboolean non_locking_shift;
2300 tvbuff_t *h225_tvb, *next_tvb;
2302 if (check_col(pinfo->cinfo, COL_PROTOCOL))
2303 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Q.931");
2306 ti = proto_tree_add_item(tree, proto_q931, tvb, offset, -1,
2308 q931_tree = proto_item_add_subtree(ti, ett_q931);
2310 dissect_q931_protocol_discriminator(tvb, offset, q931_tree);
2313 call_ref_len = tvb_get_guint8(tvb, offset) & 0xF; /* XXX - do as a bit field? */
2314 if (q931_tree != NULL)
2315 proto_tree_add_uint(q931_tree, hf_q931_call_ref_len, tvb, offset, 1, call_ref_len);
2317 if (call_ref_len != 0) {
2318 tvb_memcpy(tvb, call_ref, offset, call_ref_len);
2319 if (q931_tree != NULL) {
2320 proto_tree_add_boolean(q931_tree, hf_q931_call_ref_flag,
2321 tvb, offset, 1, (call_ref[0] & 0x80) != 0);
2322 call_ref[0] &= 0x7F;
2323 proto_tree_add_bytes(q931_tree, hf_q931_call_ref,
2324 tvb, offset, call_ref_len, call_ref);
2326 offset += call_ref_len;
2328 message_type = tvb_get_guint8(tvb, offset);
2329 if (check_col(pinfo->cinfo, COL_INFO)) {
2330 col_add_str(pinfo->cinfo, COL_INFO,
2331 val_to_str(message_type, q931_message_type_vals,
2332 "Unknown message type (0x%02X)"));
2334 if (q931_tree != NULL)
2335 proto_tree_add_uint(q931_tree, hf_q931_message_type, tvb, offset, 1, message_type);
2339 * And now for the information elements....
2341 codeset = locked_codeset = 0; /* start out in codeset 0 */
2342 non_locking_shift = TRUE;
2343 while (tvb_reported_length_remaining(tvb, offset) > 0) {
2344 info_element = tvb_get_guint8(tvb, offset);
2346 /* Check for the codeset shift */
2347 if ((info_element & Q931_IE_SO_MASK) &&
2348 ((info_element & Q931_IE_SO_IDENTIFIER_MASK) == Q931_IE_SHIFT)) {
2349 non_locking_shift = info_element & Q931_IE_SHIFT_NON_LOCKING;
2350 codeset = info_element & Q931_IE_SHIFT_CODESET;
2351 if(codeset>=NUM_INFO_ELEMENT_VALS){
2352 proto_tree_add_text(q931_tree, tvb, offset, 1,
2353 "Invalid codeset: %d", codeset);
2356 if (!non_locking_shift)
2357 locked_codeset = codeset;
2358 if (q931_tree != NULL) {
2359 proto_tree_add_text(q931_tree, tvb, offset, 1,
2360 "%s shift to codeset %u: %s",
2361 (non_locking_shift ? "Non-locking" : "Locking"),
2363 val_to_str(codeset, q931_codeset_vals,
2364 "Unknown (0x%02X)"));
2371 * Check for the single-octet IEs.
2373 if (info_element & Q931_IE_SO_MASK) {
2375 * Check for subdissectors for this IE or
2376 * for all IEs in this codeset.
2378 if (dissector_get_port_handle(codeset_dissector_table, codeset) ||
2379 dissector_get_port_handle(ie_dissector_table, (codeset << 8) | (info_element & Q931_IE_SO_IDENTIFIER_MASK))) {
2380 next_tvb = tvb_new_subset (tvb, offset, 1, 1);
2381 if (dissector_try_port(ie_dissector_table, (codeset << 8) | (info_element & Q931_IE_SO_IDENTIFIER_MASK), next_tvb, pinfo, q931_tree) ||
2382 dissector_try_port(codeset_dissector_table, codeset, next_tvb, pinfo, q931_tree)) {
2384 codeset = locked_codeset;
2385 if(codeset>=NUM_INFO_ELEMENT_VALS){
2386 proto_tree_add_text(q931_tree, tvb, offset, 1,
2387 "Invalid codeset: %d", codeset);
2394 switch ((codeset << 8) | (info_element & Q931_IE_SO_IDENTIFIER_MASK)) {
2396 case CS0 | Q931_IE_MORE_DATA_OR_SEND_COMP:
2397 switch (info_element) {
2399 case Q931_IE_MORE_DATA:
2400 if (q931_tree != NULL) {
2401 proto_tree_add_text(q931_tree, tvb, offset, 1,
2406 case Q931_IE_SENDING_COMPLETE:
2407 if (q931_tree != NULL) {
2408 proto_tree_add_text(q931_tree, tvb, offset, 1,
2409 "Sending complete");
2414 if (q931_tree != NULL) {
2415 proto_tree_add_text(q931_tree, tvb, offset, 1,
2416 "Unknown information element (0x%02X)",
2423 case CS0 | Q931_IE_CONGESTION_LEVEL:
2424 if (q931_tree != NULL) {
2425 proto_tree_add_text(q931_tree, tvb, offset, 1,
2426 "Congestion level: %s",
2427 val_to_str(info_element & Q931_IE_SO_IE_MASK,
2428 q931_congestion_level_vals,
2433 case CS0 | Q931_IE_REPEAT_INDICATOR:
2434 if (q931_tree != NULL) {
2435 proto_tree_add_text(q931_tree, tvb, offset, 1,
2436 "Repeat indicator: %s",
2437 val_to_str(info_element & Q931_IE_SO_IE_MASK,
2438 q931_repeat_indication_vals,
2444 if (q931_tree != NULL) {
2445 proto_tree_add_text(q931_tree, tvb, offset, 1,
2446 "Unknown information element (0x%02X)",
2452 codeset = locked_codeset;
2453 if(codeset>=NUM_INFO_ELEMENT_VALS){
2454 proto_tree_add_text(q931_tree, tvb, offset, 1,
2455 "Invalid codeset: %d", codeset);
2462 * Variable-length IE.
2464 * According to page 18 from Recommendation H.225.0 :
2465 * " Length of user-user contents contents
2466 * - Shall be 2 octets instead of 1 (as in Figure 4-36/Q.931)"
2468 * We assume that if this is Q.931-over-TPKT, it might
2469 * be H.225 traffic, and check for the IE being a user-user
2470 * IE with ASN.1 encoding of the user information.
2472 if (is_tpkt && tvb_bytes_exist(tvb, offset, 4) &&
2473 codeset == 0 && tvb_get_guint8(tvb, offset) == Q931_IE_USER_USER &&
2474 tvb_get_guint8(tvb, offset + 3) == Q931_PROTOCOL_DISCRIMINATOR_ASN1) {
2475 info_element_len = tvb_get_ntohs(tvb, offset + 1);
2476 if (q931_tree != NULL) {
2477 ti = proto_tree_add_text(q931_tree, tvb, offset,
2478 1+2+info_element_len, "%s",
2479 val_to_str(info_element,
2480 q931_info_element_vals[codeset],
2481 "Unknown information element (0x%02X)"));
2482 ie_tree = proto_item_add_subtree(ti,
2484 proto_tree_add_text(ie_tree, tvb, offset, 1,
2485 "Information element: %s",
2486 val_to_str(info_element,
2487 q931_info_element_vals[codeset], "Unknown (0x%02X)"));
2488 proto_tree_add_text(ie_tree, tvb, offset + 1,
2489 2, "Length: %u", info_element_len);
2490 proto_tree_add_text(ie_tree, tvb, offset + 3,
2491 1, "Protocol discriminator: %s",
2492 val_to_str(tvb_get_guint8(tvb, offset + 3),
2493 q931_protocol_discriminator_vals,
2494 "Unknown (0x%02x)"));
2497 if (info_element_len > 1) {
2499 * Do we have a handle for the H.225
2502 if (h225_handle != NULL) {
2504 * Yes - call it, regardless of
2505 * whether we're building a
2506 * protocol tree or not.
2508 h225_tvb = tvb_new_subset(tvb,
2509 offset + 4, info_element_len - 1,
2510 info_element_len - 1);
2511 call_dissector(h225_handle, h225_tvb,
2515 * No - just show it as "User
2516 * information" (if "ie_tree" is
2517 * null, this won't add anything).
2519 proto_tree_add_text(ie_tree, tvb,
2520 offset + 4, info_element_len - 1,
2521 "User information: %s",
2522 tvb_bytes_to_str(tvb, offset + 4,
2523 info_element_len - 1));
2526 offset += 1 + 2 + info_element_len;
2528 info_element_len = tvb_get_guint8(tvb, offset + 1);
2531 * Check for subdissectors for this IE or
2532 * for all IEs in this codeset.
2534 if (dissector_get_port_handle(codeset_dissector_table, codeset) ||
2535 dissector_get_port_handle(ie_dissector_table, (codeset << 8) | info_element)) {
2536 next_tvb = tvb_new_subset (tvb, offset, info_element_len + 2, info_element_len + 2);
2537 if (dissector_try_port(ie_dissector_table, (codeset << 8) | info_element, next_tvb, pinfo, q931_tree) ||
2538 dissector_try_port(codeset_dissector_table, codeset, next_tvb, pinfo, q931_tree)) {
2539 offset += 2 + info_element_len;
2540 codeset = locked_codeset;
2541 if(codeset>=NUM_INFO_ELEMENT_VALS){
2542 proto_tree_add_text(q931_tree, tvb, offset, 1,
2543 "Invalid codeset: %d", codeset);
2550 if (q931_tree != NULL) {
2551 ti = proto_tree_add_text(q931_tree, tvb, offset,
2552 1+1+info_element_len, "%s",
2553 val_to_str(info_element, q931_info_element_vals[codeset],
2554 "Unknown information element (0x%02X)"));
2555 ie_tree = proto_item_add_subtree(ti, ett_q931_ie);
2556 proto_tree_add_text(ie_tree, tvb, offset, 1,
2557 "Information element: %s",
2558 val_to_str(info_element, q931_info_element_vals[codeset],
2559 "Unknown (0x%02X)"));
2560 proto_tree_add_text(ie_tree, tvb, offset + 1, 1,
2561 "Length: %u", info_element_len);
2563 switch ((codeset << 8) | info_element) {
2565 case CS0 | Q931_IE_SEGMENTED_MESSAGE:
2566 dissect_q931_segmented_message_ie(tvb,
2567 offset + 2, info_element_len,
2571 case CS0 | Q931_IE_BEARER_CAPABILITY:
2572 case CS0 | Q931_IE_LOW_LAYER_COMPAT:
2573 dissect_q931_bearer_capability_ie(tvb,
2574 offset + 2, info_element_len,
2578 case CS0 | Q931_IE_CAUSE:
2579 dissect_q931_cause_ie(tvb,
2580 offset + 2, info_element_len,
2582 hf_q931_cause_value);
2585 case CS0 | Q931_IE_CALL_STATE:
2586 dissect_q931_call_state_ie(tvb,
2587 offset + 2, info_element_len,
2591 case CS0 | Q931_IE_CHANNEL_IDENTIFICATION:
2592 dissect_q931_channel_identification_ie(
2593 tvb, offset + 2, info_element_len,
2597 case CS0 | Q931_IE_PROGRESS_INDICATOR:
2598 dissect_q931_progress_indicator_ie(tvb,
2599 offset + 2, info_element_len,
2603 case CS0 | Q931_IE_NETWORK_SPECIFIC_FACIL:
2604 case CS0 | Q931_IE_TRANSIT_NETWORK_SEL:
2605 dissect_q931_ns_facilities_ie(tvb,
2606 offset + 2, info_element_len,
2610 case CS0 | Q931_IE_NOTIFICATION_INDICATOR:
2611 dissect_q931_notification_indicator_ie(
2612 tvb, offset + 2, info_element_len,
2616 case CS0 | Q931_IE_DISPLAY:
2617 dissect_q931_ia5_ie(tvb, offset + 2,
2618 info_element_len, ie_tree,
2619 "Display information");
2622 case CS0 | Q931_IE_DATE_TIME:
2623 dissect_q931_date_time_ie(tvb,
2624 offset + 2, info_element_len,
2628 case CS0 | Q931_IE_KEYPAD_FACILITY:
2629 dissect_q931_ia5_ie(tvb, offset + 2,
2630 info_element_len, ie_tree,
2634 case CS0 | Q931_IE_SIGNAL:
2635 dissect_q931_signal_ie(tvb,
2636 offset + 2, info_element_len,
2640 case CS0 | Q931_IE_INFORMATION_RATE:
2641 dissect_q931_information_rate_ie(tvb,
2642 offset + 2, info_element_len,
2646 case CS0 | Q931_IE_E2E_TRANSIT_DELAY:
2647 dissect_q931_e2e_transit_delay_ie(tvb,
2648 offset + 2, info_element_len,
2652 case CS0 | Q931_IE_TD_SELECTION_AND_INT:
2653 dissect_q931_td_selection_and_int_ie(
2654 tvb, offset + 2, info_element_len,
2658 case CS0 | Q931_IE_PL_BINARY_PARAMETERS:
2659 dissect_q931_pl_binary_parameters_ie(
2660 tvb, offset + 2, info_element_len,
2664 case CS0 | Q931_IE_PL_WINDOW_SIZE:
2665 dissect_q931_pl_window_size_ie(tvb,
2666 offset + 2, info_element_len,
2670 case CS0 | Q931_IE_PACKET_SIZE:
2671 dissect_q931_packet_size_ie(tvb,
2672 offset + 2, info_element_len,
2676 case CS0 | Q931_IE_CUG:
2677 dissect_q931_cug_ie(tvb,
2678 offset + 2, info_element_len,
2682 case CS0 | Q931_IE_REVERSE_CHARGE_IND:
2683 dissect_q931_reverse_charge_ind_ie(tvb,
2684 offset + 2, info_element_len,
2688 case CS0 | Q931_IE_CALLING_PARTY_NUMBER:
2689 dissect_q931_number_ie(tvb,
2690 offset + 2, info_element_len,
2692 hf_q931_calling_party_number);
2695 case CS0 | Q931_IE_CONNECTED_NUMBER_DEFAULT:
2696 dissect_q931_number_ie(tvb,
2697 offset + 2, info_element_len,
2699 hf_q931_connected_number);
2702 case CS0 | Q931_IE_CALLED_PARTY_NUMBER:
2703 dissect_q931_number_ie(tvb,
2704 offset + 2, info_element_len,
2706 hf_q931_called_party_number);
2709 case CS0 | Q931_IE_REDIRECTING_NUMBER:
2710 dissect_q931_number_ie(tvb,
2711 offset + 2, info_element_len,
2713 hf_q931_redirecting_number);
2716 case CS0 | Q931_IE_CALLING_PARTY_SUBADDR:
2717 case CS0 | Q931_IE_CALLED_PARTY_SUBADDR:
2718 dissect_q931_party_subaddr_ie(tvb,
2719 offset + 2, info_element_len,
2723 case CS0 | Q931_IE_RESTART_INDICATOR:
2724 dissect_q931_restart_indicator_ie(tvb,
2725 offset + 2, info_element_len,
2729 case CS0 | Q931_IE_HIGH_LAYER_COMPAT:
2730 dissect_q931_high_layer_compat_ie(tvb,
2731 offset + 2, info_element_len,
2735 case CS0 | Q931_IE_USER_USER:
2736 dissect_q931_user_user_ie(tvb,
2737 offset + 2, info_element_len,
2742 proto_tree_add_text(ie_tree, tvb,
2743 offset + 2, info_element_len,
2746 tvb_get_ptr(tvb, offset + 2,
2752 offset += 1 + 1 + info_element_len;
2754 codeset = locked_codeset;
2755 if(codeset>=NUM_INFO_ELEMENT_VALS){
2756 proto_tree_add_text(q931_tree, tvb, offset, 1,
2757 "Invalid codeset: %d", codeset);
2764 * Q.931-over-TPKT-over-TCP.
2767 dissect_q931_tpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2772 * Check whether this looks like a TPKT-encapsulated
2775 * The minimum length of a Q.931 message is 3:
2776 * 1 byte for the protocol discriminator,
2777 * 1 for the call_reference length,
2778 * and one for the message type.
2780 lv_tpkt_len = is_tpkt(tvb, 3);
2781 if (lv_tpkt_len == -1) {
2783 * It's not a TPKT packet; reject it.
2789 * If this segment is *exactly* the length of a TPKT header,
2790 * we assume that, as it looks like a TPKT header, it
2791 * is one, and that the code put a TPKT header in one
2792 * segment and the rest of the PDU in another.
2794 if (tvb_length(tvb) == 4) {
2796 * It is - call the "dissect TPKT over a TCP stream"
2799 dissect_tpkt_encap(tvb, pinfo, tree, q931_desegment,
2800 q931_tpkt_pdu_handle);
2805 * Well, we have more data than just the TPKT header;
2806 * check whether it looks like the beginning of a
2809 * The minimum length of a Q.931 message is 3, as per the
2812 * Check that we have that many bytes past the TPKT header in
2813 * the tvbuff; we already know that the TPKT header says we
2814 * have that many bytes (as we passed 3 as the "min_len" argument
2817 if (!tvb_bytes_exist(tvb, 4, 3))
2820 /* Check the protocol discriminator */
2821 if (tvb_get_guint8(tvb, 4) != NLPID_Q_931) {
2822 /* Doesn't look like Q.931 inside TPKT */
2827 * OK, it looks like Q.931-over-TPKT.
2828 * Call the "dissect TPKT over a TCP stream" routine.
2830 dissect_tpkt_encap(tvb, pinfo, tree, q931_desegment,
2831 q931_tpkt_pdu_handle);
2837 dissect_q931_tpkt_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2839 dissect_q931_pdu(tvb, pinfo, tree, TRUE);
2843 dissect_q931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2845 dissect_q931_pdu(tvb, pinfo, tree, FALSE);
2849 proto_register_q931(void)
2851 static hf_register_info hf[] = {
2852 { &hf_q931_discriminator,
2853 { "Protocol discriminator", "q931.disc", FT_UINT8, BASE_HEX, NULL, 0x0,
2856 { &hf_q931_call_ref_flag,
2857 { "Call reference flag", "q931.call_ref_flag", FT_BOOLEAN, BASE_NONE, TFS(&tfs_call_ref_flag), 0x0,
2860 { &hf_q931_call_ref,
2861 { "Call reference value", "q931.call_ref", FT_BYTES, BASE_HEX, NULL, 0x0,
2865 { &hf_q931_coding_standard,
2866 { "Coding standard", "q931.coding_standard", FT_UINT8, BASE_HEX,
2867 VALS(q931_coding_standard_vals), 0x60,"", HFILL }},
2869 { &hf_q931_information_transfer_capability,
2870 { "Information transfer capability", "q931.information_transfer_capability", FT_UINT8, BASE_HEX,
2871 VALS(q931_information_transfer_capability_vals), 0x1f,"", HFILL }},
2873 { &hf_q931_transfer_mode,
2874 { "Transfer mode", "q931.transfer_mode", FT_UINT8, BASE_HEX,
2875 VALS(q931_transfer_mode_vals), 0x60,"", HFILL }},
2877 { &hf_q931_information_transfer_rate,
2878 { "Information transfer rate", "q931.information_transfer_rate", FT_UINT8, BASE_HEX,
2879 VALS(q931_information_transfer_rate_vals), 0x1f,"", HFILL }},
2882 { "User information layer 1 protocol", "q931.uil1", FT_UINT8, BASE_HEX,
2883 VALS(q931_uil1_vals), 0x1f,"", HFILL }},
2885 { &hf_q931_call_ref_len,
2886 { "Call reference value length", "q931.call_ref_len", FT_UINT8, BASE_DEC, NULL, 0x0,
2889 { &hf_q931_message_type,
2890 { "Message type", "q931.message_type", FT_UINT8, BASE_HEX, VALS(q931_message_type_vals), 0x0,
2893 { &hf_q931_cause_value,
2894 { "Cause value", "q931.cause_value", FT_UINT8, BASE_DEC, VALS(q931_cause_code_vals), 0x0,
2897 { &hf_q931_number_type,
2898 { "Number type", "q931.number_type", FT_UINT8, BASE_HEX, VALS(q931_number_type_vals), 0x70,
2901 { &hf_q931_numbering_plan,
2902 { "Numbering plan", "q931.numbering_plan", FT_UINT8, BASE_HEX, VALS(q931_numbering_plan_vals), 0x0f,
2905 { &hf_q931_extension_ind,
2906 { "Extension indicator", "q931.extension_ind",
2907 FT_BOOLEAN, 8, TFS(&q931_extension_ind_value), 0x80,
2910 { &hf_q931_calling_party_number,
2911 { "Calling party number digits", "q931.calling_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2914 { &hf_q931_called_party_number,
2915 { "Called party number digits", "q931.called_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2918 { &hf_q931_connected_number,
2919 { "Connected party number digits", "q931.connected_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2922 { &hf_q931_redirecting_number,
2923 { "Redirecting party number digits", "q931.redirecting_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2926 static gint *ett[] = {
2930 module_t *q931_module;
2932 proto_q931 = proto_register_protocol("Q.931", "Q.931", "q931");
2933 proto_register_field_array (proto_q931, hf, array_length(hf));
2934 proto_register_subtree_array(ett, array_length(ett));
2936 register_dissector("q931", dissect_q931, proto_q931);
2937 q931_tpkt_pdu_handle = create_dissector_handle(dissect_q931_tpkt_pdu,
2940 /* subdissector code */
2941 codeset_dissector_table = register_dissector_table("q931.codeset", "Q.931 Codeset", FT_UINT8, BASE_HEX);
2942 ie_dissector_table = register_dissector_table("q931.ie", "Q.931 IE", FT_UINT16, BASE_HEX);
2944 q931_module = prefs_register_protocol(proto_q931, NULL);
2945 prefs_register_bool_preference(q931_module, "desegment_h323_messages",
2946 "Desegment all Q.931 messages spanning multiple TCP segments",
2947 "Whether the Q.931 dissector should desegment all messages spanning multiple TCP segments",
2952 proto_reg_handoff_q931(void)
2955 * Attempt to get a handle for the H.225 dissector.
2956 * If we can't, the handle we get is null, and we'll just
2957 * dissect putatively-H.255 Call Signaling stuff as User
2960 h225_handle = find_dissector("h225");
2965 heur_dissector_add("tcp", dissect_q931_tpkt, proto_q931);