2 * Routines for Q.931 frame disassembly
3 * Guy Harris <guy@alum.mit.edu>
5 * $Id: packet-q931.c,v 1.67 2004/02/18 07:14:36 guy 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 "lapd_sapi.h"
42 #include "packet-tpkt.h"
46 * http://www.acacia-net.com/Clarinet/Protocol/q9313svn.htm
47 * http://www.acacia-net.com/Clarinet/Protocol/q9311sc3.htm
48 * http://www.acacia-net.com/Clarinet/Protocol/q9317oz7.htm
49 * http://www.protocols.com/pbook/isdn.htm
50 * http://freesoft.org/CIE/Topics/126.htm
51 * http://noc.comstar.ru/miscdocs/ascend-faq-cause-codes.html
52 * http://www.andrews-arnold.co.uk/isdn/q931cause.html
53 * http://www.tulatelecom.ru/staff/german/DSSHelp/MessList/InfEl/InfElList.html
56 static int proto_q931 = -1;
57 static int hf_q931_discriminator = -1;
58 static int hf_q931_coding_standard = -1;
59 static int hf_q931_information_transfer_capability = -1;
60 static int hf_q931_transfer_mode = -1;
61 static int hf_q931_information_transfer_rate = -1;
62 static int hf_q931_uil1 = -1;
63 static int hf_q931_call_ref_len = -1;
64 static int hf_q931_call_ref_flag = -1;
65 static int hf_q931_call_ref = -1;
66 static int hf_q931_message_type = -1;
67 static int hf_q931_cause_value = -1;
68 static int hf_q931_number_type = -1;
69 static int hf_q931_numbering_plan = -1;
70 static int hf_q931_extension_ind = -1;
71 static int hf_q931_calling_party_number = -1;
72 static int hf_q931_called_party_number = -1;
73 static int hf_q931_connected_number = -1;
74 static int hf_q931_redirecting_number = -1;
76 static gint ett_q931 = -1;
77 static gint ett_q931_ie = -1;
79 static dissector_table_t codeset_dissector_table;
80 static dissector_table_t ie_dissector_table;
82 /* desegmentation of Q.931 over TPKT over TCP */
83 static gboolean q931_desegment = TRUE;
85 static dissector_handle_t h225_handle;
86 static dissector_handle_t q931_tpkt_pdu_handle;
89 * Q.931 message types.
91 #define Q931_ESCAPE 0x00
92 #define Q931_ALERTING 0x01
93 #define Q931_CALL_PROCEEDING 0x02
94 #define Q931_CONNECT 0x07
95 #define Q931_CONNECT_ACK 0x0F
96 #define Q931_PROGRESS 0x03
97 #define Q931_SETUP 0x05
98 #define Q931_SETUP_ACK 0x0D
99 #define Q931_HOLD 0x24
100 #define Q931_HOLD_ACK 0x28
101 #define Q931_HOLD_REJECT 0x30
102 #define Q931_RESUME 0x26
103 #define Q931_RESUME_ACK 0x2E
104 #define Q931_RESUME_REJECT 0x22
105 #define Q931_RETRIEVE 0x31
106 #define Q931_RETRIEVE_ACK 0x33
107 #define Q931_RETRIEVE_REJECT 0x37
108 #define Q931_SUSPEND 0x25
109 #define Q931_SUSPEND_ACK 0x2D
110 #define Q931_SUSPEND_REJECT 0x21
111 #define Q931_USER_INFORMATION 0x20
112 #define Q931_DISCONNECT 0x45
113 #define Q931_RELEASE 0x4D
114 #define Q931_RELEASE_COMPLETE 0x5A
115 #define Q931_RESTART 0x46
116 #define Q931_RESTART_ACK 0x4E
117 #define Q931_CONGESTION_CONTROL 0x79
118 #define Q931_FACILITY 0x62
119 #define Q931_INFORMATION 0x7B
120 #define Q931_NOTIFY 0x6E
121 #define Q931_REGISTER 0x64
122 #define Q931_SEGMENT 0x60
123 #define Q931_STATUS 0x7D
124 #define Q931_STATUS_ENQUIRY 0x75
126 static const value_string q931_message_type_vals[] = {
127 { Q931_ESCAPE, "ESCAPE" },
128 { Q931_ALERTING, "ALERTING" },
129 { Q931_CALL_PROCEEDING, "CALL PROCEEDING" },
130 { Q931_CONNECT, "CONNECT" },
131 { Q931_CONNECT_ACK, "CONNECT ACKNOWLEDGE" },
132 { Q931_PROGRESS, "PROGRESS" },
133 { Q931_SETUP, "SETUP" },
134 { Q931_SETUP_ACK, "SETUP ACKNOWLEDGE" },
135 { Q931_HOLD, "HOLD" },
136 { Q931_HOLD_ACK, "HOLD_ACKNOWLEDGE" },
137 { Q931_HOLD_REJECT, "HOLD_REJECT" },
138 { Q931_RESUME, "RESUME" },
139 { Q931_RESUME_ACK, "RESUME ACKNOWLEDGE" },
140 { Q931_RESUME_REJECT, "RESUME REJECT" },
141 { Q931_RETRIEVE, "RETRIEVE" },
142 { Q931_RETRIEVE_ACK, "RETRIEVE ACKNOWLEDGE" },
143 { Q931_RETRIEVE_REJECT, "RETRIEVE REJECT" },
144 { Q931_SUSPEND, "SUSPEND" },
145 { Q931_SUSPEND_ACK, "SUSPEND ACKNOWLEDGE" },
146 { Q931_SUSPEND_REJECT, "SUSPEND REJECT" },
147 { Q931_USER_INFORMATION, "USER INFORMATION" },
148 { Q931_DISCONNECT, "DISCONNECT" },
149 { Q931_RELEASE, "RELEASE" },
150 { Q931_RELEASE_COMPLETE, "RELEASE COMPLETE" },
151 { Q931_RESTART, "RESTART" },
152 { Q931_RESTART_ACK, "RESTART ACKNOWLEDGE" },
153 { Q931_CONGESTION_CONTROL, "CONGESTION CONTROL" },
154 { Q931_FACILITY, "FACILITY" },
155 { Q931_INFORMATION, "INFORMATION" },
156 { Q931_NOTIFY, "NOTIFY" },
157 { Q931_REGISTER, "REGISTER" },
158 { Q931_SEGMENT, "SEGMENT" },
159 { Q931_STATUS, "STATUS" },
160 { Q931_STATUS_ENQUIRY, "STATUS ENQUIRY" },
164 static const true_false_string tfs_call_ref_flag = {
165 "Message sent to originating side",
166 "Message sent from originating side"
170 * Information elements.
173 /* Shifted codeset values */
183 #define Q931_IE_SO_MASK 0x80 /* single-octet/variable-length mask */
187 #define Q931_IE_SO_IDENTIFIER_MASK 0xf0 /* IE identifier mask */
188 #define Q931_IE_SO_IDENTIFIER_SHIFT 4 /* IE identifier shift */
189 #define Q931_IE_SO_IE_MASK 0x0F /* IE mask */
191 #define Q931_IE_SHIFT 0x90
192 #define Q931_IE_SHIFT_NON_LOCKING 0x08 /* non-locking shift */
193 #define Q931_IE_SHIFT_CODESET 0x07 /* codeset */
195 #define Q931_IE_MORE_DATA_OR_SEND_COMP 0xA0 /* More Data or Sending Complete */
196 #define Q931_IE_MORE_DATA 0xA0
197 #define Q931_IE_SENDING_COMPLETE 0xA1
199 #define Q931_IE_CONGESTION_LEVEL 0xB0
200 #define Q931_IE_REPEAT_INDICATOR 0xD0
203 * Variable-length IEs.
205 #define Q931_IE_VL_EXTENSION 0x80 /* Extension flag */
206 /* extension bit. The bit value "0" indicates that the octet continues through the */
207 /* next octet. The bit value "1" indicates that this octet is the last octet */
209 static const true_false_string q931_extension_ind_value = {
211 "information continues through the next octet",
217 * Codeset 0 (default).
219 #define Q931_IE_SEGMENTED_MESSAGE 0x00
220 #define Q931_IE_BEARER_CAPABILITY 0x04
221 #define Q931_IE_CAUSE 0x08
222 #define Q931_IE_CALL_IDENTITY 0x10
223 #define Q931_IE_CALL_STATE 0x14
224 #define Q931_IE_CHANNEL_IDENTIFICATION 0x18
225 #define Q931_IE_FACILITY 0x1C
226 #define Q931_IE_PROGRESS_INDICATOR 0x1E
227 #define Q931_IE_NETWORK_SPECIFIC_FACIL 0x20 /* Network Specific Facilities */
228 #define Q931_IE_NOTIFICATION_INDICATOR 0x27
229 #define Q931_IE_DISPLAY 0x28
230 #define Q931_IE_DATE_TIME 0x29
231 #define Q931_IE_KEYPAD_FACILITY 0x2C
232 #define Q931_IE_INFORMATION_REQUEST 0x32
233 #define Q931_IE_SIGNAL 0x34
234 #define Q931_IE_SWITCHHOOK 0x36
235 #define Q931_IE_FEATURE_ACTIVATION 0x38
236 #define Q931_IE_FEATURE_INDICATION 0x39
237 #define Q931_IE_ENDPOINT_IDENTIFIER 0x3B
238 #define Q931_IE_SERVICE_PROFILE_ID 0x3A
239 #define Q931_IE_INFORMATION_RATE 0x40
240 #define Q931_IE_E2E_TRANSIT_DELAY 0x42 /* End-to-end Transit Delay */
241 #define Q931_IE_TD_SELECTION_AND_INT 0x43 /* Transit Delay Selection and Indication */
242 #define Q931_IE_PL_BINARY_PARAMETERS 0x44 /* Packet layer binary parameters */
243 #define Q931_IE_PL_WINDOW_SIZE 0x45 /* Packet layer window size */
244 #define Q931_IE_PACKET_SIZE 0x46 /* Packet size */
245 #define Q931_IE_CUG 0x47 /* Closed user group */
246 #define Q931_IE_REVERSE_CHARGE_IND 0x4A /* Reverse charging indication */
247 #define Q931_IE_CONNECTED_NUMBER_DEFAULT 0x4C /* Connected Number */
248 #define Q931_IE_CALLING_PARTY_NUMBER 0x6C /* Calling Party Number */
249 #define Q931_IE_CALLING_PARTY_SUBADDR 0x6D /* Calling Party Subaddress */
250 #define Q931_IE_CALLED_PARTY_NUMBER 0x70 /* Called Party Number */
251 #define Q931_IE_CALLED_PARTY_SUBADDR 0x71 /* Called Party Subaddress */
252 #define Q931_IE_REDIRECTING_NUMBER 0x74
253 #define Q931_IE_REDIRECTION_NUMBER 0x76
254 #define Q931_IE_TRANSIT_NETWORK_SEL 0x78 /* Transit Network Selection */
255 #define Q931_IE_RESTART_INDICATOR 0x79
256 #define Q931_IE_LOW_LAYER_COMPAT 0x7C /* Low-Layer Compatibility */
257 #define Q931_IE_HIGH_LAYER_COMPAT 0x7D /* High-Layer Compatibility */
258 #define Q931_IE_USER_USER 0x7E /* User-User */
259 #define Q931_IE_ESCAPE 0x7F /* Escape for extension */
264 #define Q931_IE_CONNECTED_NUMBER 0x8C
265 #define Q931_IE_CONNECTED_SUBADDR 0x8D
268 * Codeset 5 (National-specific) Belgium.
270 #define Q931_IE_CHARGING_ADVICE 0x1A
273 * Codeset 5 (National-specific) Bellcore National ISDN.
275 #define Q931_IE_OPERATOR_SYSTEM_ACCESS 0x1D
278 * Codeset 6 (Network-specific) Belgium.
280 /* 0x1A is Charging Advice, as with Codeset 5 */
281 #define Q931_IE_REDIRECTING_NUMBER 0x74
284 * Codeset 6 (Network-specific) FT-Numeris.
286 /* 0x1D is User Capability */
289 * Codeset 6 (Network-specific) Bellcore National ISDN.
291 #define Q931_IE_REDIRECTING_SUBADDR 0x75 /* Redirecting Subaddress */
292 /* 0x76 is Redirection Number, but that's also Codeset 0 */
293 #define Q931_IE_CALL_APPEARANCE 0x7B
296 static const value_string q931_info_element_vals0[] = {
297 { Q931_IE_SEGMENTED_MESSAGE, "Segmented message" },
298 { Q931_IE_BEARER_CAPABILITY, "Bearer capability" },
299 { Q931_IE_CAUSE, "Cause" },
300 { Q931_IE_CALL_IDENTITY, "Call identity" },
301 { Q931_IE_CALL_STATE, "Call state" },
302 { Q931_IE_CHANNEL_IDENTIFICATION, "Channel identification" },
303 { Q931_IE_FACILITY, "Facility" },
304 { Q931_IE_PROGRESS_INDICATOR, "Progress indicator" },
305 { Q931_IE_NETWORK_SPECIFIC_FACIL, "Network specific facilities" },
306 { Q931_IE_NOTIFICATION_INDICATOR, "Notification indicator" },
307 { Q931_IE_DISPLAY, "Display" },
308 { Q931_IE_DATE_TIME, "Date/Time" },
309 { Q931_IE_KEYPAD_FACILITY, "Keypad facility" },
310 { Q931_IE_INFORMATION_REQUEST, "Information request" },
311 { Q931_IE_SIGNAL, "Signal" },
312 { Q931_IE_SWITCHHOOK, "Switchhook" },
313 { Q931_IE_FEATURE_ACTIVATION, "Feature activation" },
314 { Q931_IE_FEATURE_INDICATION, "Feature Indication" },
315 { Q931_IE_ENDPOINT_IDENTIFIER, "Endpoint identifier" },
316 { Q931_IE_SERVICE_PROFILE_ID, "Service profile ID" },
317 { Q931_IE_INFORMATION_RATE, "Information rate" },
318 { Q931_IE_E2E_TRANSIT_DELAY, "End-to-end transit delay" },
319 { Q931_IE_TD_SELECTION_AND_INT, "Transit delay selection and indication" },
320 { Q931_IE_PL_BINARY_PARAMETERS, "Packet layer binary parameters" },
321 { Q931_IE_PL_WINDOW_SIZE, "Packet layer window size" },
322 { Q931_IE_PACKET_SIZE, "Packet size" },
323 { Q931_IE_CUG, "Closed user group" },
324 { Q931_IE_REVERSE_CHARGE_IND, "Reverse charging indication" },
325 { Q931_IE_CONNECTED_NUMBER_DEFAULT, "Connected number" },
326 { Q931_IE_CALLING_PARTY_NUMBER, "Calling party number" },
327 { Q931_IE_CALLING_PARTY_SUBADDR, "Calling party subaddress" },
328 { Q931_IE_CALLED_PARTY_NUMBER, "Called party number" },
329 { Q931_IE_CALLED_PARTY_SUBADDR, "Called party subaddress" },
330 { Q931_IE_REDIRECTING_NUMBER, "Redirecting number" },
331 { Q931_IE_REDIRECTION_NUMBER, "Redirection number" },
332 { Q931_IE_TRANSIT_NETWORK_SEL, "Transit network selection" },
333 { Q931_IE_RESTART_INDICATOR, "Restart indicator" },
334 { Q931_IE_LOW_LAYER_COMPAT, "Low-layer compatibility" },
335 { Q931_IE_HIGH_LAYER_COMPAT, "High-layer compatibility" },
336 { Q931_IE_USER_USER, "User-user" },
337 { Q931_IE_ESCAPE, "Escape" },
338 { Q931_IE_CONNECTED_NUMBER, "Connected number" },
339 { Q931_IE_CONNECTED_SUBADDR, "Connected subaddress" },
343 static const value_string q931_info_element_vals1[] = {
347 static const value_string q931_info_element_vals2[] = {
351 static const value_string q931_info_element_vals3[] = {
355 static const value_string q931_info_element_vals4[] = {
359 static const value_string q931_info_element_vals5[] = {
360 { Q931_IE_CHARGING_ADVICE, "Charging advice" },
361 { Q931_IE_OPERATOR_SYSTEM_ACCESS, "Operator system access" },
365 static const value_string q931_info_element_vals6[] = {
366 { Q931_IE_REDIRECTING_NUMBER, "Redirecting number" },
367 { Q931_IE_REDIRECTING_SUBADDR, "Redirecting subaddress" },
368 { Q931_IE_CALL_APPEARANCE, "Call appearance" },
372 static const value_string q931_info_element_vals7[] = {
377 #define NUM_INFO_ELEMENT_VALS (Q931_IE_SHIFT_CODESET+1)
378 static const value_string *q931_info_element_vals[NUM_INFO_ELEMENT_VALS] = {
379 q931_info_element_vals0,
380 q931_info_element_vals1,
381 q931_info_element_vals2,
382 q931_info_element_vals3,
383 q931_info_element_vals4,
384 q931_info_element_vals5,
385 q931_info_element_vals6,
386 q931_info_element_vals7,
389 static const value_string q931_congestion_level_vals[] = {
390 { 0x0, "Receiver ready" },
391 { 0xF, "Receiver not ready" },
395 static const value_string q931_repeat_indication_vals[] = {
396 { 0x2, "Prioritized list" },
401 * ITU-standardized coding.
403 #define Q931_ITU_STANDARDIZED_CODING 0x00
406 * Dissect a Segmented message information element.
409 dissect_q931_segmented_message_ie(tvbuff_t *tvb, int offset, int len,
413 proto_tree_add_text(tree, tvb, offset, len,
414 "Segmented message: length is %d, should be 2\n", len);
417 if (tvb_get_guint8(tvb, offset) & 0x80) {
418 proto_tree_add_text(tree, tvb, offset, 1,
419 "First segment: %u segments remaining",
420 tvb_get_guint8(tvb, offset) & 0x7F);
422 proto_tree_add_text(tree, tvb, offset, 1,
423 "Not first segment: %u segments remaining",
424 tvb_get_guint8(tvb, offset) & 0x7F);
426 proto_tree_add_text(tree, tvb, offset + 1, 1,
427 "Segmented message type: %u\n", tvb_get_guint8(tvb, offset + 1));
431 * Dissect a Bearer capability or Low-layer compatibility information element.
433 static const value_string q931_coding_standard_vals[] = {
434 { 0x0, "ITU-T standardized coding" },
435 { 0x1, "ISO/IEC standard" },
436 { 0x2, "National standard" },
437 { 0x3, "Standard defined for this particular network" },
441 static const value_string q931_information_transfer_capability_vals[] = {
443 { 0x08, "Unrestricted digital information" },
444 { 0x09, "Restricted digital information" },
445 { 0x10, "3.1 kHz audio" },
446 { 0x11, "Unrestricted digital information with tones/announcements" },
451 static const value_string q931_transfer_mode_vals[] = {
452 { 0x00, "Circuit mode" },
453 { 0x02, "Packet mode" },
457 #define Q931_IT_RATE_MULTIRATE 0x18
459 static const value_string q931_information_transfer_rate_vals[] = {
460 { 0x00, "Packet mode" },
461 { 0x10, "64 kbit/s" },
462 { 0x11, "2 x 64 kbit/s" },
463 { 0x13, "384 kbit/s" },
464 { 0x15, "1536 kbit/s" },
465 { 0x17, "1920 kbit/s" },
466 { Q931_IT_RATE_MULTIRATE, "Multirate (64 kbit/s base rate)" },
470 static const value_string q931_uil1_vals[] = {
471 { 0x01, "V.110/I.460/X.30 rate adaption" },
472 { 0x02, "Recommendation G.711 u-law" },
473 { 0x03, "Recommendation G.711 A-law" },
474 { 0x04, "Recommendation G.721 32 kbit/s ADPCM and Recommendation I.460" },
475 { 0x05, "Recommendation H.221 and H.242" },
476 { 0x06, "Recommendation H.223 and H.245" },
477 { 0x07, "Non-ITU-T-standardized rate adaption" },
478 { 0x08, "V.120 rate adaption" },
479 { 0x09, "X.31 HDLC flag stuffing" },
483 static const value_string q931_l1_user_rate_vals[] = {
484 { 0x00, "Rate indicated by E-bits" },
485 { 0x01, "0.6 kbit/s" },
486 { 0x02, "1.2 kbit/s" },
487 { 0x03, "2.4 kbit/s" },
488 { 0x04, "3.6 kbit/s" },
489 { 0x05, "4.8 kbit/s" },
490 { 0x06, "7.2 kbit/s" },
491 { 0x07, "8 kbit/s" },
492 { 0x08, "9.6 kbit/s" },
493 { 0x09, "14.4 kbit/s" },
494 { 0x0A, "16 kbit/s" },
495 { 0x0B, "19.2 kbit/s" },
496 { 0x0C, "32 kbit/s" },
497 { 0x0E, "48 kbit/s" },
498 { 0x0F, "56 kbit/s" },
499 { 0x10, "64 kbit/s "},
500 { 0x15, "0.1345 kbit/s" },
501 { 0x16, "0.100 kbit/s" },
502 { 0x17, "0.075/1.2 kbit/s" },
503 { 0x18, "1.2/0.075 kbit/s" },
504 { 0x19, "0.050 kbit/s" },
505 { 0x1A, "0.075 kbit/s" },
506 { 0x1B, "0.110 kbit/s" },
507 { 0x1C, "0.150 kbit/s" },
508 { 0x1D, "0.200 kbit/s" },
509 { 0x1E, "0.300 kbit/s" },
510 { 0x1F, "12 kbit/s" },
514 static const value_string q931_l1_intermediate_rate_vals[] = {
515 { 0x20, "8 kbit/s" },
516 { 0x40, "16 kbit/s" },
517 { 0x60, "32 kbit/s" },
521 static const value_string q931_l1_stop_bits_vals[] = {
528 static const value_string q931_l1_data_bits_vals[] = {
535 static const value_string q931_l1_parity_vals[] = {
539 { 0x04, "Forced to 0" },
540 { 0x05, "Forced to 1" },
544 static const value_string q931_l1_modem_type_vals[] = {
547 { 0x13, "V.22 bis" },
550 { 0x16, "V.26 bis" },
551 { 0x17, "V.26 ter" },
553 { 0x19, "V.27 bis" },
554 { 0x1A, "V.27 ter" },
561 #define Q931_UIL2_USER_SPEC 0x10
563 static const value_string q931_uil2_vals[] = {
564 { 0x01, "Basic mode ISO 1745" },
565 { 0x02, "Q.921/I.441" }, /* LAPD */
566 { 0x06, "X.25, link layer" }, /* LAPB */
567 { 0x07, "X.25 multilink" }, /* or 0x0F? */
568 { 0x08, "T.71 Extended LAPB" },
569 { 0x09, "HDLC ARM" },
570 { 0x0A, "HDLC NRM" },
571 { 0x0B, "HDLC ABM" },
572 { 0x0C, "ISO 8802/2 LLC" },
573 { 0x0D, "X.75 Single Link Procedure" },
575 { 0x0F, "Core aspects of Q.922" },
576 { Q931_UIL2_USER_SPEC, "User-specified" },
577 { 0x11, "ISO 7776 DTE-DTE operation" },
581 static const value_string q931_mode_vals[] = {
582 { 0x20, "Normal mode" },
583 { 0x40, "Extended mode" },
587 #define Q931_UIL3_X25_PL 0x06
588 #define Q931_UIL3_ISO_8208 0x07 /* X.25-based */
589 #define Q931_UIL3_X223 0x08 /* X.25-based */
590 #define Q931_UIL3_TR_9577 0x0B
591 #define Q931_UIL3_USER_SPEC 0x10
593 static const value_string q931_uil3_vals[] = {
594 { 0x02, "Q.931/I.451" },
595 { Q931_UIL3_X25_PL, "X.25, packet layer" },
596 { Q931_UIL3_ISO_8208, "ISO/IEC 8208" },
597 { Q931_UIL3_X223, "X.223/ISO 8878" },
598 { 0x09, "ISO/IEC 8473" },
600 { Q931_UIL3_TR_9577, "ISO/IEC TR 9577" },
601 { Q931_UIL3_USER_SPEC, "User-specified" },
606 dissect_q931_protocol_discriminator(tvbuff_t *tvb, int offset, proto_tree *tree)
608 unsigned int discriminator = tvb_get_guint8(tvb, offset);
610 if (discriminator == NLPID_Q_931) {
611 proto_tree_add_uint_format(tree, hf_q931_discriminator,
612 tvb, offset, 1, discriminator,
613 "Protocol discriminator: Q.931");
614 } else if (discriminator == NLPID_Q_2931) {
615 proto_tree_add_uint_format(tree, hf_q931_discriminator,
616 tvb, offset, 1, discriminator,
617 "Protocol discriminator: Q.2931");
618 } else if ((discriminator >= 16 && discriminator < 63)
619 || ((discriminator >= 80) && (discriminator < 254))) {
620 proto_tree_add_uint_format(tree, hf_q931_discriminator,
621 tvb, offset, 1, discriminator,
622 "Protocol discriminator: Network layer or layer 3 protocol (0x%02X)",
624 } else if (discriminator >= 64 && discriminator <= 79) {
625 proto_tree_add_uint_format(tree, hf_q931_discriminator,
626 tvb, offset, 1, discriminator,
627 "Protocol discriminator: National use (0x%02X)",
630 proto_tree_add_uint_format(tree, hf_q931_discriminator,
631 tvb, offset, 1, discriminator,
632 "Protocol discriminator: Reserved (0x%02X)",
638 dissect_q931_bearer_capability_ie(tvbuff_t *tvb, int offset, int len,
642 guint8 coding_standard;
645 guint8 uil2_protocol;
646 guint8 uil3_protocol;
651 octet = tvb_get_guint8(tvb, offset);
652 coding_standard = octet & 0x60;
653 if (coding_standard != Q931_ITU_STANDARDIZED_CODING) {
655 * We don't know how the bearer capability is encoded,
656 * so just dump it as data and be done with it.
658 proto_tree_add_text(tree, tvb, offset,
660 tvb_bytes_to_str(tvb, offset, len));
661 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
662 proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet);
665 proto_tree_add_uint(tree, hf_q931_information_transfer_capability, tvb, offset, 1, octet);
666 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
667 proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet);
672 * XXX - only in Low-layer compatibility information element.
674 if (!(octet & Q931_IE_VL_EXTENSION)) {
677 octet = tvb_get_guint8(tvb, offset);
678 proto_tree_add_text(tree, tvb, offset, 1,
679 "Out-band negotiation %spossible",
680 (octet & 0x40) ? "" : "not ");
687 octet = tvb_get_guint8(tvb, offset);
688 proto_tree_add_uint(tree, hf_q931_information_transfer_rate, tvb, offset, 1, octet);
689 proto_tree_add_uint(tree, hf_q931_transfer_mode, tvb, offset, 1, octet);
690 proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet);
691 it_rate = octet & 0x1F;
695 if (it_rate == Q931_IT_RATE_MULTIRATE) {
698 proto_tree_add_text(tree, tvb, offset, 1, "Rate multiplier: %u", tvb_get_guint8(tvb, offset));
705 octet = tvb_get_guint8(tvb, offset);
706 if ((octet & 0x60) == 0x20) {
708 * Layer 1 information.
710 proto_tree_add_uint(tree, hf_q931_uil1, tvb, offset, 1, octet);
711 proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet);
715 if (octet & Q931_IE_VL_EXTENSION)
719 octet = tvb_get_guint8(tvb, offset);
720 proto_tree_add_text(tree, tvb, offset, 1,
722 (octet & 0x40) ? "Asynchronous" : "Synchronous");
723 proto_tree_add_text(tree, tvb, offset, 1,
724 "Layer 1 in-band negotiation is %spossible",
725 (octet & 0x20) ? "" : "not ");
726 proto_tree_add_text(tree, tvb, offset, 1,
728 val_to_str(octet & 0x1F, q931_l1_user_rate_vals,
729 "Unknown (0x%02X)"));
733 if (octet & Q931_IE_VL_EXTENSION)
737 octet = tvb_get_guint8(tvb, offset);
738 proto_tree_add_text(tree, tvb, offset, 1,
739 "Intermediate rate: %s",
740 val_to_str(octet & 0x60, q931_l1_intermediate_rate_vals,
742 proto_tree_add_text(tree, tvb, offset, 1,
743 "%s to send data with network independent clock",
744 (octet & 0x10) ? "Required" : "Not required");
745 proto_tree_add_text(tree, tvb, offset, 1,
746 "%s accept data with network independent clock",
747 (octet & 0x08) ? "Can" : "Cannot");
748 proto_tree_add_text(tree, tvb, offset, 1,
749 "%s to send data with flow control mechanism",
750 (octet & 0x04) ? "Required" : "Not required");
751 proto_tree_add_text(tree, tvb, offset, 1,
752 "%s accept data with flow control mechanism",
753 (octet & 0x02) ? "Can" : "Cannot");
757 if (octet & Q931_IE_VL_EXTENSION)
761 octet = tvb_get_guint8(tvb, offset);
762 proto_tree_add_text(tree, tvb, offset, 1,
763 "Rate adaption header %sincluded",
764 (octet & 0x40) ? "" : "not ");
765 proto_tree_add_text(tree, tvb, offset, 1,
766 "Multiple frame establishment %ssupported",
767 (octet & 0x20) ? "" : "not ");
768 proto_tree_add_text(tree, tvb, offset, 1,
769 "%s mode of operation",
770 (octet & 0x10) ? "Protocol sensitive" : "Bit transparent");
771 proto_tree_add_text(tree, tvb, offset, 1,
773 "Full protocol negotiation" : "LLI = 256 only");
774 proto_tree_add_text(tree, tvb, offset, 1,
775 "Message originator is %s",
776 (octet & 0x04) ? "Assignor only" : "Default assignee");
777 proto_tree_add_text(tree, tvb, offset, 1,
778 "Negotiation is done %s",
779 (octet & 0x02) ? "in-band" : "out-of-band");
783 if (octet & Q931_IE_VL_EXTENSION)
787 octet = tvb_get_guint8(tvb, offset);
788 proto_tree_add_text(tree, tvb, offset, 1,
790 val_to_str(octet & 0x60, q931_l1_stop_bits_vals,
792 proto_tree_add_text(tree, tvb, offset, 1,
794 val_to_str(octet & 0x18, q931_l1_data_bits_vals,
796 proto_tree_add_text(tree, tvb, offset, 1,
798 val_to_str(octet & 0x07, q931_l1_parity_vals,
801 if (octet & Q931_IE_VL_EXTENSION)
805 octet = tvb_get_guint8(tvb, offset);
806 proto_tree_add_text(tree, tvb, offset, 1,
808 (octet & 0x40) ? "Full" : "Half");
809 modem_type = octet & 0x3F;
810 if (modem_type <= 0x5 ||
811 (modem_type >= 0x20 && modem_type <= 0x2F)) {
812 proto_tree_add_text(tree, tvb, offset, 1,
813 "Modem type: National use 0x%02X", modem_type);
814 } else if (modem_type >= 0x30) {
815 proto_tree_add_text(tree, tvb, offset, 1,
816 "Modem type: User specified 0x%02X", modem_type);
818 proto_tree_add_text(tree, tvb, offset, 1,
820 val_to_str(modem_type, q931_l1_modem_type_vals,
821 "Unknown (0x%02X)"));
831 octet = tvb_get_guint8(tvb, offset);
832 if ((octet & 0x60) == 0x40) {
834 * Layer 2 information.
836 uil2_protocol = octet & 0x1F;
837 proto_tree_add_text(tree, tvb, offset, 1,
838 "User information layer 2 protocol: %s",
839 val_to_str(uil2_protocol, q931_uil2_vals,
840 "Unknown (0x%02X)"));
845 * XXX - only in Low-layer compatibility information element.
847 if (octet & Q931_IE_VL_EXTENSION)
851 octet = tvb_get_guint8(tvb, offset);
852 if (uil2_protocol == Q931_UIL2_USER_SPEC) {
853 proto_tree_add_text(tree, tvb, offset, 1,
854 "User-specified layer 2 protocol information: 0x%02X",
857 proto_tree_add_text(tree, tvb, offset, 1,
859 val_to_str(octet & 0x60, q931_mode_vals,
860 "Unknown (0x%02X)"));
865 if (octet & Q931_IE_VL_EXTENSION)
869 octet = tvb_get_guint8(tvb, offset);
870 proto_tree_add_text(tree, tvb, offset, 1,
871 "Window size: %u k", octet & 0x7F);
880 octet = tvb_get_guint8(tvb, offset);
881 if ((octet & 0x60) == 0x60) {
883 * Layer 3 information.
885 uil3_protocol = octet & 0x1F;
886 proto_tree_add_text(tree, tvb, offset, 1,
887 "User information layer 3 protocol: %s",
888 val_to_str(uil3_protocol, q931_uil3_vals,
889 "Unknown (0x%02X)"));
895 * XXX - only in Low-layer compatibility information element.
897 if (octet & Q931_IE_VL_EXTENSION)
901 octet = tvb_get_guint8(tvb, offset);
902 switch (uil3_protocol) {
904 case Q931_UIL3_X25_PL:
905 case Q931_UIL3_ISO_8208:
907 proto_tree_add_text(tree, tvb, offset, 1,
909 val_to_str(octet & 0x60, q931_mode_vals,
910 "Unknown (0x%02X)"));
914 if (octet & Q931_IE_VL_EXTENSION)
918 octet = tvb_get_guint8(tvb, offset);
919 proto_tree_add_text(tree, tvb, offset, 1,
920 "Default packet size: %u", octet & 0x0F);
924 if (octet & Q931_IE_VL_EXTENSION)
928 octet = tvb_get_guint8(tvb, offset);
929 proto_tree_add_text(tree, tvb, offset, 1,
930 "Packet window size: %u", octet & 0x7F);
935 case Q931_UIL3_USER_SPEC:
936 proto_tree_add_text(tree, tvb, offset, 1,
937 "Default packet size: %u octets",
938 1 << (octet & 0x0F));
943 case Q931_UIL3_TR_9577:
944 add_l3_info = (octet & 0x0F) << 4;
945 if (octet & Q931_IE_VL_EXTENSION)
949 octet = tvb_get_guint8(tvb, offset + 1);
950 add_l3_info |= (octet & 0x0F);
951 proto_tree_add_text(tree, tvb, offset, 2,
952 "Additional layer 3 protocol information: %s",
953 val_to_str(add_l3_info, nlpid_vals,
954 "Unknown (0x%02X)"));
965 * Dissect a Cause information element.
969 const value_string q931_cause_location_vals[] = {
970 { 0x00, "User (U)" },
971 { 0x01, "Private network serving the local user (LPN)" },
972 { 0x02, "Public network serving the local user (LN)" },
973 { 0x03, "Transit network (TN)" },
974 { 0x04, "Public network serving the remote user (RLN)" },
975 { 0x05, "Private network serving the remote user (RPN)" },
976 { 0x07, "International network (INTL)" },
977 { 0x0A, "Network beyond interworking point (BI)" },
981 static const value_string q931_cause_recommendation_vals[] = {
985 { 0x05, "Q.1031/Q.1051" },
990 * Cause codes for Cause.
992 #define Q931_CAUSE_UNALLOC_NUMBER 0x01
993 #define Q931_CAUSE_NO_ROUTE_TO_DEST 0x03
994 #define Q931_CAUSE_CALL_REJECTED 0x15
995 #define Q931_CAUSE_NUMBER_CHANGED 0x16
996 #define Q931_CAUSE_ACCESS_INFO_DISC 0x2B
997 #define Q931_CAUSE_QOS_UNAVAILABLE 0x31
998 #define Q931_CAUSE_CHAN_NONEXISTENT 0x52
999 #define Q931_CAUSE_INCOMPATIBLE_DEST 0x58
1000 #define Q931_CAUSE_MAND_IE_MISSING 0x60
1001 #define Q931_CAUSE_MT_NONEX_OR_UNIMPL 0x61
1002 #define Q931_CAUSE_IE_NONEX_OR_UNIMPL 0x63
1003 #define Q931_CAUSE_INVALID_IE_CONTENTS 0x64
1004 #define Q931_CAUSE_MSG_INCOMPAT_W_CS 0x65
1005 #define Q931_CAUSE_REC_TIMER_EXP 0x66
1007 const value_string q931_cause_code_vals[] = {
1008 { 0x00, "Valid cause code not yet received" },
1009 { Q931_CAUSE_UNALLOC_NUMBER, "Unallocated (unassigned) number" },
1010 { 0x02, "No route to specified transit network" },
1011 { Q931_CAUSE_NO_ROUTE_TO_DEST, "No route to destination" },
1012 { 0x04, "Send special information tone" },
1013 { 0x05, "Misdialled trunk prefix" },
1014 { 0x06, "Channel unacceptable" },
1015 { 0x07, "Call awarded and being delivered in an established channel" },
1016 { 0x08, "Prefix 0 dialed but not allowed" },
1017 /* Q.850 - "Preemption" */
1018 { 0x09, "Prefix 1 dialed but not allowed" },
1019 /* Q.850 - "Preemption - circuit reserved for reuse" */
1020 { 0x0A, "Prefix 1 dialed but not required" },
1021 { 0x0B, "More digits received than allowed, call is proceeding" },
1022 { 0x0E, "QoR: ported number" },
1023 { 0x10, "Normal call clearing" },
1024 { 0x11, "User busy" },
1025 { 0x12, "No user responding" },
1026 { 0x13, "No answer from user (user alerted)" },
1027 { 0x14, "Subscriber absent" },
1028 { Q931_CAUSE_CALL_REJECTED, "Call rejected" },
1029 { Q931_CAUSE_NUMBER_CHANGED, "Number changed" },
1030 { 0x17, "Reverse charging rejected" },
1031 /* Q.850 - "Redirection to new destination" */
1032 { 0x18, "Call suspended" },
1033 /* Q.850 Amendment 1 - "Call rejected due to feature at the destination" */
1034 { 0x19, "Call resumed" },
1035 /* Q.850 - "Exchange routing error */
1036 { 0x1A, "Non-selected user clearing" },
1037 { 0x1B, "Destination out of order" },
1038 { 0x1C, "Invalid number format (incomplete number)" },
1039 { 0x1D, "Facility rejected" },
1040 { 0x1E, "Response to STATUS ENQUIRY" },
1041 { 0x1F, "Normal unspecified" },
1042 { 0x21, "Circuit out of order" },
1043 { 0x22, "No circuit/channel available" },
1044 { 0x23, "Destination unattainable" },
1045 { 0x25, "Degraded service" },
1046 { 0x26, "Network out of order" },
1047 { 0x27, "Transit delay range cannot be achieved" },
1048 /* Q.850 - "Permanent frame mode connection out of service" */
1049 { 0x28, "Throughput range cannot be achieved" },
1050 /* Q.850 - "Permanent frame mode connection operational" */
1051 { 0x29, "Temporary failure" },
1052 { 0x2A, "Switching equipment congestion" },
1053 { Q931_CAUSE_ACCESS_INFO_DISC, "Access information discarded" },
1054 { 0x2C, "Requested circuit/channel not available" },
1055 { 0x2D, "Pre-empted" },
1056 { 0x2E, "Precedence call blocked" },
1057 { 0x2F, "Resources unavailable, unspecified" },
1058 { Q931_CAUSE_QOS_UNAVAILABLE, "Quality of service unavailable" },
1059 { 0x32, "Requested facility not subscribed" },
1060 { 0x33, "Reverse charging not allowed" },
1061 { 0x34, "Outgoing calls barred" },
1062 { 0x35, "Outgoing calls barred within CUG" },
1063 { 0x36, "Incoming calls barred" },
1064 { 0x37, "Incoming calls barred within CUG" },
1065 { 0x38, "Call waiting not subscribed" },
1066 { 0x39, "Bearer capability not authorized" },
1067 { 0x3A, "Bearer capability not presently available" },
1068 { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
1069 { 0x3F, "Service or option not available, unspecified" },
1070 { 0x41, "Bearer capability not implemented" },
1071 { 0x42, "Channel type not implemented" },
1072 { 0x43, "Transit network selection not implemented" },
1073 { 0x44, "Message not implemented" },
1074 { 0x45, "Requested facility not implemented" },
1075 { 0x46, "Only restricted digital information bearer capability is available" },
1076 { 0x4F, "Service or option not implemented, unspecified" },
1077 { 0x51, "Invalid call reference value" },
1078 { Q931_CAUSE_CHAN_NONEXISTENT, "Identified channel does not exist" },
1079 { 0x53, "Call identity does not exist for suspended call" },
1080 { 0x54, "Call identity in use" },
1081 { 0x55, "No call suspended" },
1082 { 0x56, "Call having the requested call identity has been cleared" },
1083 { 0x57, "Called user not member of CUG" },
1084 { Q931_CAUSE_INCOMPATIBLE_DEST, "Incompatible destination" },
1085 { 0x59, "Non-existent abbreviated address entry" },
1086 { 0x5A, "Destination address missing, and direct call not subscribed" },
1087 /* Q.850 - "Non-existent CUG" */
1088 { 0x5B, "Invalid transit network selection (national use)" },
1089 { 0x5C, "Invalid facility parameter" },
1090 { 0x5D, "Mandatory information element is missing" },
1091 { 0x5F, "Invalid message, unspecified" },
1092 { Q931_CAUSE_MAND_IE_MISSING, "Mandatory information element is missing" },
1093 { Q931_CAUSE_MT_NONEX_OR_UNIMPL,"Message type non-existent or not implemented" },
1094 { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
1095 { Q931_CAUSE_IE_NONEX_OR_UNIMPL,"Information element nonexistant or not implemented" },
1096 { Q931_CAUSE_INVALID_IE_CONTENTS,"Invalid information element contents" },
1097 { Q931_CAUSE_MSG_INCOMPAT_W_CS, "Message not compatible with call state" },
1098 { Q931_CAUSE_REC_TIMER_EXP, "Recovery on timer expiry" },
1099 { 0x67, "Parameter non-existent or not implemented - passed on" },
1100 { 0x6E, "Message with unrecognized parameter discarded" },
1101 { 0x6F, "Protocol error, unspecified" },
1102 { 0x7F, "Internetworking, unspecified" },
1106 static const value_string q931_cause_condition_vals[] = {
1107 { 0x00, "Unknown" },
1108 { 0x01, "Permanent" },
1109 { 0x02, "Transient" },
1113 #define Q931_REJ_USER_SPECIFIC 0x00
1114 #define Q931_REJ_IE_MISSING 0x04
1115 #define Q931_REJ_IE_INSUFFICIENT 0x08
1117 static const value_string q931_rejection_reason_vals[] = {
1118 { 0x00, "User specific" },
1119 { 0x04, "Information element missing" },
1120 { 0x08, "Information element contents are not sufficient" },
1125 dissect_q931_cause_ie(tvbuff_t *tvb, int offset, int len,
1126 proto_tree *tree, int hf_cause_value)
1130 guint8 coding_standard;
1131 guint8 rejection_reason;
1135 octet = tvb_get_guint8(tvb, offset);
1136 coding_standard = octet & 0x60;
1137 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
1138 if (coding_standard != Q931_ITU_STANDARDIZED_CODING) {
1140 * We don't know how the cause is encoded,
1141 * so just dump it as data and be done with it.
1143 proto_tree_add_text(tree, tvb, offset,
1145 tvb_bytes_to_str(tvb, offset, len));
1148 proto_tree_add_text(tree, tvb, offset, 1,
1150 val_to_str(octet & 0x0F, q931_cause_location_vals,
1152 proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet);
1156 if (!(octet & Q931_IE_VL_EXTENSION)) {
1159 octet = tvb_get_guint8(tvb, offset);
1160 proto_tree_add_text(tree, tvb, offset, 1,
1161 "Recommendation: %s",
1162 val_to_str(octet & 0x7F, q931_cause_recommendation_vals,
1163 "Unknown (0x%02X)"));
1170 octet = tvb_get_guint8(tvb, offset);
1171 cause_value = octet & 0x7F;
1172 proto_tree_add_uint(tree, hf_cause_value, tvb, offset, 1, cause_value);
1178 switch (cause_value) {
1180 case Q931_CAUSE_UNALLOC_NUMBER:
1181 case Q931_CAUSE_NO_ROUTE_TO_DEST:
1182 case Q931_CAUSE_QOS_UNAVAILABLE:
1183 octet = tvb_get_guint8(tvb, offset);
1184 proto_tree_add_text(tree, tvb, offset, 1,
1185 "Network service: %s",
1186 (octet & 0x80) ? "User" : "Provider");
1187 proto_tree_add_text(tree, tvb, offset, 1,
1189 (octet & 0x40) ? "Abnormal" : "Normal");
1190 proto_tree_add_text(tree, tvb, offset, 1,
1192 val_to_str(octet & 0x03, q931_cause_condition_vals,
1196 case Q931_CAUSE_CALL_REJECTED:
1197 rejection_reason = octet & 0x7C;
1198 proto_tree_add_text(tree, tvb, offset, 1,
1199 "Rejection reason: %s",
1200 val_to_str(octet & 0x7C, q931_rejection_reason_vals,
1202 proto_tree_add_text(tree, tvb, offset, 1,
1204 val_to_str(octet & 0x03, q931_cause_condition_vals,
1211 switch (rejection_reason) {
1213 case Q931_REJ_USER_SPECIFIC:
1214 proto_tree_add_text(tree, tvb, offset, len,
1215 "User specific diagnostic: %s",
1216 tvb_bytes_to_str(tvb, offset, len));
1219 case Q931_REJ_IE_MISSING:
1220 proto_tree_add_text(tree, tvb, offset, 1,
1221 "Missing information element: %s",
1222 val_to_str(tvb_get_guint8(tvb, offset), q931_info_element_vals0,
1223 "Unknown (0x%02X)"));
1226 case Q931_REJ_IE_INSUFFICIENT:
1227 proto_tree_add_text(tree, tvb, offset, 1,
1228 "Insufficient information element: %s",
1229 val_to_str(tvb_get_guint8(tvb, offset), q931_info_element_vals0,
1230 "Unknown (0x%02X)"));
1234 proto_tree_add_text(tree, tvb, offset, len,
1236 tvb_bytes_to_str(tvb, offset, len));
1241 case Q931_CAUSE_ACCESS_INFO_DISC:
1242 case Q931_CAUSE_INCOMPATIBLE_DEST:
1243 case Q931_CAUSE_MAND_IE_MISSING:
1244 case Q931_CAUSE_IE_NONEX_OR_UNIMPL:
1245 case Q931_CAUSE_INVALID_IE_CONTENTS:
1247 proto_tree_add_text(tree, tvb, offset, 1,
1248 "Information element: %s",
1249 val_to_str(tvb_get_guint8(tvb, offset), q931_info_element_vals0,
1250 "Unknown (0x%02X)"));
1256 case Q931_CAUSE_MT_NONEX_OR_UNIMPL:
1257 case Q931_CAUSE_MSG_INCOMPAT_W_CS:
1258 proto_tree_add_text(tree, tvb, offset, 1,
1260 val_to_str(tvb_get_guint8(tvb, offset), q931_message_type_vals,
1261 "Unknown (0x%02X)"));
1264 case Q931_CAUSE_REC_TIMER_EXP:
1267 proto_tree_add_text(tree, tvb, offset, 3,
1268 "Timer: %.3s", tvb_get_ptr(tvb, offset, 3));
1272 proto_tree_add_text(tree, tvb, offset, len,
1274 tvb_bytes_to_str(tvb, offset, len));
1279 * Dissect a Call state information element.
1281 static const value_string q931_call_state_vals[] = {
1283 { 0x01, "Call initiated" },
1284 { 0x02, "Overlap sending" },
1285 { 0x03, "Outgoing call proceeding" },
1286 { 0x04, "Call delivered" },
1287 { 0x06, "Call present" },
1288 { 0x07, "Call received" },
1289 { 0x08, "Connect request" },
1290 { 0x09, "Incoming call proceeding" },
1292 { 0x0B, "Disconnect request" },
1293 { 0x0C, "Disconnect indication" },
1294 { 0x0F, "Suspend request" },
1295 { 0x12, "Resume request" },
1296 { 0x13, "Release request" },
1297 { 0x16, "Call abort"},
1298 { 0x19, "Overlap receiving" },
1299 { 0x3D, "Restart request" },
1300 { 0x3E, "Restart" },
1305 dissect_q931_call_state_ie(tvbuff_t *tvb, int offset, int len,
1309 guint8 coding_standard;
1313 octet = tvb_get_guint8(tvb, offset);
1314 coding_standard = octet & 0x60;
1315 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
1316 if (coding_standard != Q931_ITU_STANDARDIZED_CODING) {
1318 * We don't know how the call state is encoded,
1319 * so just dump it as data and be done with it.
1321 proto_tree_add_text(tree, tvb, offset,
1323 tvb_bytes_to_str(tvb, offset, len));
1326 proto_tree_add_text(tree, tvb, offset, 1,
1328 val_to_str(octet & 0x3F, q931_call_state_vals,
1329 "Unknown (0x%02X)"));
1333 * Dissect a Channel identification information element.
1335 #define Q931_INTERFACE_IDENTIFIED 0x40
1336 #define Q931_NOT_BASIC_CHANNEL 0x20
1338 static const value_string q931_basic_channel_selection_vals[] = {
1339 { 0x00, "No channel" },
1340 { 0x01, "B1 channel" },
1341 { 0x02, "B2 channel" },
1342 { 0x03, "Any channel" },
1346 static const value_string q931_not_basic_channel_selection_vals[] = {
1347 { 0x00, "No channel" },
1348 { 0x01, "Channel indicated in following octets" },
1349 { 0x03, "Any channel" },
1353 #define Q931_IS_SLOT_MAP 0x10
1355 static const value_string q931_element_type_vals[] = {
1356 { 0x03, "B-channel units" },
1357 { 0x06, "H0-channel units" },
1358 { 0x08, "H11-channel units" },
1359 { 0x09, "H12-channel units" },
1364 dissect_q931_channel_identification_ie(tvbuff_t *tvb, int offset, int len,
1368 int identifier_offset;
1370 guint8 coding_standard;
1374 octet = tvb_get_guint8(tvb, offset);
1375 proto_tree_add_text(tree, tvb, offset, 1,
1376 "Interface %s identified",
1377 (octet & Q931_INTERFACE_IDENTIFIED) ? "explicitly" : "implicitly");
1378 proto_tree_add_text(tree, tvb, offset, 1,
1380 (octet & Q931_NOT_BASIC_CHANNEL) ? "Not basic" : "Basic");
1381 proto_tree_add_text(tree, tvb, offset, 1,
1382 "Indicated channel is %s",
1383 (octet & 0x08) ? "required" : "preferred");
1384 proto_tree_add_text(tree, tvb, offset, 1,
1385 "Indicated channel is %sthe D-channel",
1386 (octet & 0x04) ? "" : "not ");
1387 if (octet & Q931_NOT_BASIC_CHANNEL) {
1388 proto_tree_add_text(tree, tvb, offset, 1,
1389 "Channel selection: %s",
1390 val_to_str(octet & 0x03, q931_not_basic_channel_selection_vals,
1393 proto_tree_add_text(tree, tvb, offset, 1,
1394 "Channel selection: %s",
1395 val_to_str(octet & 0x03, q931_basic_channel_selection_vals,
1401 if (octet & Q931_INTERFACE_IDENTIFIED) {
1402 identifier_offset = offset;
1407 octet = tvb_get_guint8(tvb, offset);
1411 } while (!(octet & Q931_IE_VL_EXTENSION));
1414 * XXX - do we want to strip off the 8th bit on the
1415 * last octet of the interface identifier?
1417 if (identifier_len != 0) {
1418 proto_tree_add_text(tree, tvb, identifier_offset,
1419 identifier_len, "Interface identifier: %s",
1421 tvb_get_ptr(tvb, identifier_offset, identifier_len),
1426 if (octet & Q931_NOT_BASIC_CHANNEL) {
1429 octet = tvb_get_guint8(tvb, offset);
1430 coding_standard = octet & 0x60;
1431 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
1432 if (coding_standard != Q931_ITU_STANDARDIZED_CODING) {
1434 * We don't know how the channel identifier is
1435 * encoded, so just dump it as data and be done
1438 proto_tree_add_text(tree, tvb, offset,
1440 tvb_bytes_to_str(tvb, offset, len));
1443 proto_tree_add_text(tree, tvb, offset, 1,
1444 "Channel is indicated by %s",
1445 (octet & Q931_IS_SLOT_MAP) ? "slot map" : "number");
1446 proto_tree_add_text(tree, tvb, offset, 1,
1448 (octet & Q931_IS_SLOT_MAP) ? "Map element" : "Channel",
1449 val_to_str(octet & 0x0F, q931_element_type_vals,
1450 "Unknown (0x%02X)"));
1453 * XXX - dump the channel number or slot map.
1459 * Dissect a Progress indicator information element.
1461 static const value_string q931_progress_description_vals[] = {
1462 { 0x01, "Call is not end-to-end ISDN - progress information available in-band" },
1463 { 0x02, "Destination address is non-ISDN" },
1464 { 0x03, "Origination address is non-ISDN" },
1465 { 0x04, "Call has returned to the ISDN" },
1466 { 0x05, "Interworking has occurred and has resulted in a telecommunications service change" },
1467 { 0x08, "In-band information or an appropriate pattern is now available" },
1472 dissect_q931_progress_indicator_ie(tvbuff_t *tvb, int offset, int len,
1476 guint8 coding_standard;
1480 octet = tvb_get_guint8(tvb, offset);
1481 coding_standard = octet & 0x60;
1482 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
1483 if (coding_standard != Q931_ITU_STANDARDIZED_CODING) {
1485 * We don't know how the progress indicator is encoded,
1486 * so just dump it as data and be done with it.
1488 proto_tree_add_text(tree, tvb, offset,
1490 tvb_bytes_to_str(tvb, offset, len));
1493 proto_tree_add_text(tree, tvb, offset, 1,
1495 val_to_str(octet & 0x0F, q931_cause_location_vals,
1502 octet = tvb_get_guint8(tvb, offset);
1503 proto_tree_add_text(tree, tvb, offset, 1,
1504 "Progress description: %s",
1505 val_to_str(octet & 0x7F, q931_progress_description_vals,
1506 "Unknown (0x%02X)"));
1510 * Dissect a Network-specific facilities or Transit network selection
1511 * information element.
1513 static const value_string q931_netid_type_vals[] = {
1514 { 0x00, "User specified" },
1515 { 0x20, "National network identification" },
1516 { 0x30, "International network identification" },
1520 static const value_string q931_netid_plan_vals[] = {
1521 { 0x00, "Unknown" },
1522 { 0x01, "Carrier Identification Code" },
1523 { 0x03, "X.121 data network identification code" },
1528 dissect_q931_ns_facilities_ie(tvbuff_t *tvb, int offset, int len,
1536 octet = tvb_get_guint8(tvb, offset);
1537 netid_len = octet & 0x7F;
1538 proto_tree_add_text(tree, tvb, offset, 1,
1539 "Network identification length: %u",
1543 if (netid_len != 0) {
1546 octet = tvb_get_guint8(tvb, offset);
1547 proto_tree_add_text(tree, tvb, offset, 1,
1548 "Type of network identification: %s",
1549 val_to_str(octet & 0x70, q931_netid_type_vals,
1550 "Unknown (0x%02X)"));
1551 proto_tree_add_text(tree, tvb, offset, 1,
1552 "Network identification plan: %s",
1553 val_to_str(octet & 0x0F, q931_netid_plan_vals,
1554 "Unknown (0x%02X)"));
1561 if (netid_len > len)
1563 if (netid_len != 0) {
1564 proto_tree_add_text(tree, tvb, offset, netid_len,
1565 "Network identification: %s",
1566 tvb_format_text(tvb, offset, netid_len));
1567 offset += netid_len;
1573 * Whatever is left is the network-specific facility
1578 proto_tree_add_text(tree, tvb, offset,
1579 len, "Network-specific facility specification: %s",
1580 tvb_bytes_to_str(tvb, offset, len));
1584 * Dissect a Notification indicator information element.
1586 static const value_string q931_notification_description_vals[] = {
1587 { 0x00, "User suspended" },
1588 { 0x01, "User resumed" },
1589 { 0x02, "Bearer service change" },
1594 dissect_q931_notification_indicator_ie(tvbuff_t *tvb, int offset, int len,
1601 octet = tvb_get_guint8(tvb, offset);
1602 proto_tree_add_text(tree, tvb, offset, 1,
1603 "Notification description: %s",
1604 val_to_str(octet & 0x7F, q931_notification_description_vals,
1605 "Unknown (0x%02X)"));
1609 * Dissect a Date/time information element.
1612 dissect_q931_date_time_ie(tvbuff_t *tvb, int offset, int len,
1617 * XXX - what is "year" relative to? Is "month" 0-origin or
1618 * 1-origin? Q.931 doesn't say....
1620 proto_tree_add_text(tree, tvb, offset, 6,
1621 "Date/time: %02u-%02u-%02u %02u:%02u:%02u",
1622 tvb_get_guint8(tvb, offset + 0), tvb_get_guint8(tvb, offset + 1), tvb_get_guint8(tvb, offset + 2),
1623 tvb_get_guint8(tvb, offset + 3), tvb_get_guint8(tvb, offset + 4), tvb_get_guint8(tvb, offset + 5));
1624 } else if (len == 5) {
1625 proto_tree_add_text(tree, tvb, offset, 5,
1626 "Date/time: %02u-%02u-%02u %02u:%02u:00",
1627 tvb_get_guint8(tvb, offset + 0), tvb_get_guint8(tvb, offset + 1), tvb_get_guint8(tvb, offset + 2),
1628 tvb_get_guint8(tvb, offset + 3), tvb_get_guint8(tvb, offset + 4));
1630 proto_tree_add_text(tree, tvb, offset, len,
1631 "Date/time: length is %d, should be 5 or 6\n", len);
1636 * Dissect a Signal information element.
1638 static const value_string q931_signal_vals[] = {
1639 { 0x00, "Dial tone on" },
1640 { 0x01, "Ring tone on" },
1641 { 0x02, "Intercept tone on" },
1642 { 0x03, "Network congestion tone on" }, /* "fast busy" */
1643 { 0x04, "Busy tone on" },
1644 { 0x05, "Confirm tone on" },
1645 { 0x06, "Answer tone on" },
1646 { 0x07, "Call waiting tone on" },
1647 { 0x08, "Off-hook warning tone on" },
1648 { 0x09, "Preemption tone on" },
1649 { 0x3F, "Tones off" },
1650 { 0x40, "Alerting on - pattern 0" },
1651 { 0x41, "Alerting on - pattern 1" },
1652 { 0x42, "Alerting on - pattern 2" },
1653 { 0x43, "Alerting on - pattern 3" },
1654 { 0x44, "Alerting on - pattern 4" },
1655 { 0x45, "Alerting on - pattern 5" },
1656 { 0x46, "Alerting on - pattern 6" },
1657 { 0x47, "Alerting on - pattern 7" },
1658 { 0x4F, "Alerting off" },
1663 dissect_q931_signal_ie(tvbuff_t *tvb, int offset, int len,
1667 proto_tree_add_text(tree, tvb, offset, len,
1668 "Signal: length is %d, should be 1\n", len);
1671 proto_tree_add_text(tree, tvb, offset, 1,
1673 val_to_str(tvb_get_guint8(tvb, offset), q931_signal_vals,
1674 "Unknown (0x%02X)"));
1678 * Dissect an Information rate information element.
1680 static const value_string q931_throughput_class_vals[] = {
1681 { 0x03, "75 bit/s" },
1682 { 0x04, "150 bit/s" },
1683 { 0x05, "300 bit/s" },
1684 { 0x06, "600 bit/s" },
1685 { 0x07, "1200 bit/s" },
1686 { 0x08, "2400 bit/s" },
1687 { 0x09, "4800 bit/s" },
1688 { 0x0A, "9600 bit/s" },
1689 { 0x0B, "19200 bit/s" },
1690 { 0x0C, "48000 bit/s" },
1691 { 0x0D, "64000 bit/s" },
1696 dissect_q931_information_rate_ie(tvbuff_t *tvb, int offset, int len,
1700 proto_tree_add_text(tree, tvb, offset, len,
1701 "Information rate: length is %d, should be 4\n", len);
1704 proto_tree_add_text(tree, tvb, offset + 0, 1,
1705 "Incoming information rate: %s",
1706 val_to_str(tvb_get_guint8(tvb, offset + 0) & 0x1F,
1707 q931_throughput_class_vals, "Unknown (0x%02X)"));
1708 proto_tree_add_text(tree, tvb, offset + 1, 1,
1709 "Outgoing information rate: %s",
1710 val_to_str(tvb_get_guint8(tvb, offset + 1) & 0x1F,
1711 q931_throughput_class_vals, "Unknown (0x%02X)"));
1712 proto_tree_add_text(tree, tvb, offset + 2, 1,
1713 "Minimum incoming information rate: %s",
1714 val_to_str(tvb_get_guint8(tvb, offset + 2) & 0x1F,
1715 q931_throughput_class_vals, "Unknown (0x%02X)"));
1716 proto_tree_add_text(tree, tvb, offset + 3, 1,
1717 "Minimum outgoing information rate: %s",
1718 val_to_str(tvb_get_guint8(tvb, offset + 3) & 0x1F,
1719 q931_throughput_class_vals, "Unknown (0x%02X)"));
1723 dissect_q931_guint16_value(tvbuff_t *tvb, int offset, int len,
1724 proto_tree *tree, char *label)
1732 octet = tvb_get_guint8(tvb, offset);
1733 if (octet & Q931_IE_VL_EXTENSION) {
1735 * Only one octet long - error.
1739 value = (octet & 0x3) << 14;
1746 * We've reached the end of the information element - error.
1750 octet = tvb_get_guint8(tvb, offset);
1751 if (octet & Q931_IE_VL_EXTENSION) {
1753 * Only two octets long - error.
1757 value |= (octet & 0x7F) << 7;
1764 * We've reached the end of the information element - error.
1768 octet = tvb_get_guint8(tvb, offset);
1769 if (!(octet & Q931_IE_VL_EXTENSION)) {
1771 * More than three octets long - error.
1775 value |= (octet & 0x7F);
1780 proto_tree_add_text(tree, tvb, offset, value_len, "%s: %u ms", label,
1785 proto_tree_add_text(tree, tvb, offset, len,
1786 "%s goes past end of information element", label);
1790 proto_tree_add_text(tree, tvb, offset, len, "%s isn't 3 octets long",
1796 * Dissect an End-to-end transit delay information element.
1799 dissect_q931_e2e_transit_delay_ie(tvbuff_t *tvb, int offset, int len,
1806 value_len = dissect_q931_guint16_value(tvb, offset, len, tree,
1807 "Cumulative transit delay");
1810 offset += value_len;
1815 value_len = dissect_q931_guint16_value(tvb, offset, len, tree,
1816 "Requested end-to-end transit delay");
1819 offset += value_len;
1824 value_len = dissect_q931_guint16_value(tvb, offset, len, tree,
1825 "Maximum end-to-end transit delay");
1829 * Dissect a Transit delay selection and indication information element.
1832 dissect_q931_td_selection_and_int_ie(tvbuff_t *tvb, int offset, int len,
1837 dissect_q931_guint16_value(tvb, offset, len, tree,
1842 * Dissect a Packet layer binary parameters information element.
1844 static const value_string q931_fast_selected_vals[] = {
1845 { 0x00, "Fast select not requested" },
1846 { 0x08, "Fast select not requested" },
1847 { 0x10, "Fast select requested with no restriction of response" },
1848 { 0x18, "Fast select requested with restrictions of response" },
1853 dissect_q931_pl_binary_parameters_ie(tvbuff_t *tvb, int offset, int len,
1860 octet = tvb_get_guint8(tvb, offset);
1861 proto_tree_add_text(tree, tvb, offset, 1,
1863 val_to_str(octet & 0x18, q931_fast_selected_vals, NULL));
1864 proto_tree_add_text(tree, tvb, offset, 1,
1866 (octet & 0x04) ? "No request/request denied" :
1867 "Request indicated/request accepted");
1868 proto_tree_add_text(tree, tvb, offset, 1,
1870 (octet & 0x02) ? "Link-by-link" : "End-to-end");
1871 proto_tree_add_text(tree, tvb, offset, 1,
1872 "Modulus %u sequencing",
1873 (octet & 0x01) ? 8 : 128);
1877 * Dissect a Packet layer window size information element.
1880 dissect_q931_pl_window_size_ie(tvbuff_t *tvb, int offset, int len,
1885 proto_tree_add_text(tree, tvb, offset, 1,
1886 "Forward value: %u", tvb_get_guint8(tvb, offset) & 0x7F);
1892 proto_tree_add_text(tree, tvb, offset, 1,
1893 "Backward value: %u", tvb_get_guint8(tvb, offset) & 0x7F);
1897 * Dissect a Packet size information element.
1900 dissect_q931_packet_size_ie(tvbuff_t *tvb, int offset, int len,
1905 proto_tree_add_text(tree, tvb, offset, 1,
1906 "Forward value: %u", tvb_get_guint8(tvb, offset) & 0x7F);
1912 proto_tree_add_text(tree, tvb, offset, 1,
1913 "Backward value: %u", tvb_get_guint8(tvb, offset) & 0x7F);
1917 * Dissect a Closed user group information element.
1919 static const value_string q931_cug_indication_vals[] = {
1920 { 0x01, "Closed user group selection" },
1921 { 0x02, "Closed user group with outgoing access selection and indication" },
1926 dissect_q931_cug_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree)
1930 proto_tree_add_text(tree, tvb, offset, 1,
1931 "CUG indication: %s",
1932 val_to_str(tvb_get_guint8(tvb, offset) & 0x07,
1933 q931_cug_indication_vals, "Unknown (0x%02X)"));
1939 proto_tree_add_text(tree, tvb, offset, len, "CUG index code: %s",
1940 tvb_format_text(tvb, offset, len));
1944 * Dissect a Reverse charging indication information element.
1946 static const value_string q931_reverse_charging_indication_vals[] = {
1947 { 0x01, "Reverse charging requested" },
1952 dissect_q931_reverse_charge_ind_ie(tvbuff_t *tvb, int offset, int len,
1957 proto_tree_add_text(tree, tvb, offset, 1,
1958 "Reverse charging indication: %s",
1959 val_to_str(tvb_get_guint8(tvb, offset) & 0x07,
1960 q931_reverse_charging_indication_vals, "Unknown (0x%02X)"));
1964 * Dissect a (phone) number information element.
1966 static const value_string q931_number_type_vals[] = {
1968 { 0x1, "International number" },
1969 { 0x2, "National number" },
1970 { 0x3, "Network specific number" },
1971 { 0x4, "Subscriber number" },
1972 { 0x6, "Abbreviated number" },
1976 static const value_string q931_numbering_plan_vals[] = {
1977 { 0x00, "Unknown" },
1978 { 0x01, "E.164 ISDN/telephony numbering" },
1979 { 0x03, "X.121 data numbering" },
1980 { 0x04, "F.69 Telex numbering" },
1981 { 0x08, "National standard numbering" },
1982 { 0x09, "Private numbering" },
1986 static const value_string q931_presentation_indicator_vals[] = {
1987 { 0x00, "Presentation allowed" },
1988 { 0x20, "Presentation restricted" },
1989 { 0x40, "Number not available due to interworking" },
1993 static const value_string q931_screening_indicator_vals[] = {
1994 { 0x00, "User-provided, not screened" },
1995 { 0x01, "User-provided, verified and passed" },
1996 { 0x02, "User-provided, verified and failed" },
1997 { 0x03, "Network-provided" },
2001 static const value_string q931_redirection_reason_vals[] = {
2002 { 0x00, "Unknown" },
2003 { 0x01, "Call forwarding busy or called DTE busy" },
2004 { 0x02, "Call forwarding no reply" },
2005 { 0x04, "Call deflection" },
2006 { 0x09, "Called DTE out of order" },
2007 { 0x0A, "Call forwarding by the called DTE" },
2008 { 0x0F, "Call forwarding unconditional or systematic call redirection" },
2013 dissect_q931_number_ie(tvbuff_t *tvb, int offset, int len,
2014 proto_tree *tree, int hfindex)
2020 octet = tvb_get_guint8(tvb, offset);
2021 proto_tree_add_uint(tree, hf_q931_numbering_plan, tvb, offset, 1, octet);
2022 proto_tree_add_uint(tree, hf_q931_number_type, tvb, offset, 1, octet);
2023 proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet);
2028 if (!(octet & Q931_IE_VL_EXTENSION)) {
2031 octet = tvb_get_guint8(tvb, offset);
2032 proto_tree_add_text(tree, tvb, offset, 1,
2033 "Presentation indicator: %s",
2034 val_to_str(octet & 0x60, q931_presentation_indicator_vals,
2036 proto_tree_add_text(tree, tvb, offset, 1,
2037 "Screening indicator: %s",
2038 val_to_str(octet & 0x03, q931_screening_indicator_vals,
2045 * XXX - only in a Redirecting number information element.
2047 if (!(octet & Q931_IE_VL_EXTENSION)) {
2050 octet = tvb_get_guint8(tvb, offset);
2051 proto_tree_add_text(tree, tvb, offset, 1,
2052 "Reason for redirection: %s",
2053 val_to_str(octet & 0x0F, q931_redirection_reason_vals,
2061 proto_tree_add_item(tree, hfindex, tvb, offset, len, FALSE);
2065 * Dissect a party subaddress information element.
2067 static const value_string q931_subaddress_type_vals[] = {
2068 { 0x00, "X.213/ISO 8348 Add.2 NSAP" },
2069 { 0x20, "User-specified" },
2073 static const value_string q931_odd_even_indicator_vals[] = {
2074 { 0x00, "Even number of address signals" },
2075 { 0x10, "Odd number of address signals" },
2080 dissect_q931_party_subaddr_ie(tvbuff_t *tvb, int offset, int len,
2087 octet = tvb_get_guint8(tvb, offset);
2088 proto_tree_add_text(tree, tvb, offset, 1,
2089 "Type of subaddress: %s",
2090 val_to_str(octet & 0x70, q931_subaddress_type_vals,
2091 "Unknown (0x%02X)"));
2092 proto_tree_add_text(tree, tvb, offset, 1,
2093 "Odd/even indicator: %s",
2094 val_to_str(octet & 0x10, q931_odd_even_indicator_vals,
2101 proto_tree_add_text(tree, tvb, offset, len, "Subaddress: %s",
2102 tvb_bytes_to_str(tvb, offset, len));
2106 * Dissect a Restart indicator information element.
2108 static const value_string q931_restart_indicator_class_vals[] = {
2109 { 0x00, "Indicated channels" },
2110 { 0x06, "Single interface" },
2111 { 0x07, "All interfaces" },
2116 dissect_q931_restart_indicator_ie(tvbuff_t *tvb, int offset, int len,
2120 proto_tree_add_text(tree, tvb, offset, len,
2121 "Restart indicator: length is %d, should be 1\n", len);
2124 proto_tree_add_text(tree, tvb, offset, 1,
2125 "Restart indicator: %s",
2126 val_to_str(tvb_get_guint8(tvb, offset) & 0x07,
2127 q931_restart_indicator_class_vals, "Unknown (0x%02X)"));
2131 * Dissect a High-layer compatibility information element.
2133 #define Q931_AUDIOVISUAL 0x60
2134 static const value_string q931_high_layer_characteristics_vals[] = {
2135 { 0x01, "Telephony" },
2136 { 0x04, "F.182 Facsimile Group 2/3" },
2137 { 0x21, "F.184 Facsimile Group 4 Class I" },
2138 { 0x24, "F.230 Teletex, basic and mixed mode, and F.184 Facsimile Group 4, Classes II and III" },
2139 { 0x28, "F.220 Teletex, basic and processable mode" },
2140 { 0x31, "F.200 Teletex, basic mode" },
2141 { 0x32, "F.300 and T.102 syntax-based Videotex" },
2142 { 0x33, "F.300 and T.101 international Videotex interworking" },
2143 { 0x35, "F.60 Telex" },
2144 { 0x38, "X.400 Message Handling Systems" },
2145 { 0x41, "X.200 OSI application" },
2146 { 0x42, "FTAM application" },
2147 { 0x5E, "Reserved for maintenance" },
2148 { 0x5F, "Reserved for management" },
2149 { Q931_AUDIOVISUAL, "F.720/F.821 and F.731 Profile 1a videotelephony" },
2150 { 0x61, "F.702 and F.731 Profile 1b videoconferencing" },
2151 { 0x62, "F.702 and F.731 audiographic conferencing" },
2155 static const value_string q931_audiovisual_characteristics_vals[] = {
2156 { 0x01, "Capability set of initial channel of H.221" },
2157 { 0x02, "Capability set of subsequent channel of H.221" },
2158 { 0x21, "Capability set of initial channel of an active 3.1kHz audio or speech call" },
2163 dissect_q931_high_layer_compat_ie(tvbuff_t *tvb, int offset, int len,
2167 guint8 coding_standard;
2168 guint8 characteristics;
2172 octet = tvb_get_guint8(tvb, offset);
2173 coding_standard = octet & 0x60;
2174 proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet);
2177 if (coding_standard != Q931_ITU_STANDARDIZED_CODING) {
2179 * We don't know how the call state is encoded,
2180 * so just dump it as data and be done with it.
2182 proto_tree_add_text(tree, tvb, offset,
2184 tvb_bytes_to_str(tvb, offset, len));
2190 octet = tvb_get_guint8(tvb, offset);
2191 characteristics = octet & 0x7F;
2192 proto_tree_add_text(tree, tvb, offset, 1,
2193 "High layer characteristics identification: %s",
2194 val_to_str(characteristics, q931_high_layer_characteristics_vals,
2195 "Unknown (0x%02X)"));
2199 if (!(octet & Q931_IE_VL_EXTENSION)) {
2202 octet = tvb_get_guint8(tvb, offset);
2203 if (characteristics == Q931_AUDIOVISUAL) {
2204 proto_tree_add_text(tree, tvb, offset, 1,
2205 "Extended audiovisual characteristics identification: %s",
2206 val_to_str(octet & 0x7F,
2207 q931_audiovisual_characteristics_vals,
2208 "Unknown (0x%02X)"));
2210 proto_tree_add_text(tree, tvb, offset, 1,
2211 "Extended high layer characteristics identification: %s",
2212 val_to_str(octet & 0x7F,
2213 q931_high_layer_characteristics_vals,
2214 "Unknown (0x%02X)"));
2221 * Dissect a User-user information element.
2223 #define Q931_PROTOCOL_DISCRIMINATOR_IA5 0x04
2224 #define Q931_PROTOCOL_DISCRIMINATOR_ASN1 0x05
2226 static const value_string q931_protocol_discriminator_vals[] = {
2227 { 0x00, "User-specific protocol" },
2228 { 0x01, "OSI high layer protocols" },
2230 { Q931_PROTOCOL_DISCRIMINATOR_IA5, "IA5 characters" },
2231 { Q931_PROTOCOL_DISCRIMINATOR_ASN1, "X.208 and X.209 coded user information" },
2232 { 0x07, "V.120 rate adaption" },
2233 { 0x08, "Q.931/I.451 user-network call control messages" },
2238 dissect_q931_user_user_ie(tvbuff_t *tvb, int offset, int len,
2245 octet = tvb_get_guint8(tvb, offset);
2246 proto_tree_add_text(tree, tvb, offset, 1,
2247 "Protocol discriminator: %s",
2248 val_to_str(octet, q931_protocol_discriminator_vals,
2249 "Unknown (0x%02x)"));
2257 case Q931_PROTOCOL_DISCRIMINATOR_IA5:
2258 proto_tree_add_text(tree, tvb, offset, len, "User information: %s",
2259 tvb_format_text(tvb, offset, len));
2263 proto_tree_add_text(tree, tvb, offset, len, "User information: %s",
2264 tvb_bytes_to_str(tvb, offset, len));
2270 * Dissect information elements consisting of ASCII^H^H^H^H^HIA5 text.
2273 dissect_q931_ia5_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree,
2277 proto_tree_add_text(tree, tvb, offset, len, "%s: %s", label,
2278 tvb_format_text(tvb, offset, len));
2283 dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2287 proto_tree *q931_tree = NULL;
2289 guint8 call_ref_len;
2290 guint8 call_ref[15];
2291 guint8 message_type;
2293 if (check_col(pinfo->cinfo, COL_PROTOCOL))
2294 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Q.931");
2297 ti = proto_tree_add_item(tree, proto_q931, tvb, offset, -1,
2299 q931_tree = proto_item_add_subtree(ti, ett_q931);
2301 dissect_q931_protocol_discriminator(tvb, offset, q931_tree);
2304 call_ref_len = tvb_get_guint8(tvb, offset) & 0xF; /* XXX - do as a bit field? */
2305 if (q931_tree != NULL)
2306 proto_tree_add_uint(q931_tree, hf_q931_call_ref_len, tvb, offset, 1, call_ref_len);
2308 if (call_ref_len != 0) {
2309 tvb_memcpy(tvb, call_ref, offset, call_ref_len);
2310 if (q931_tree != NULL) {
2311 proto_tree_add_boolean(q931_tree, hf_q931_call_ref_flag,
2312 tvb, offset, 1, (call_ref[0] & 0x80) != 0);
2313 call_ref[0] &= 0x7F;
2314 proto_tree_add_bytes(q931_tree, hf_q931_call_ref,
2315 tvb, offset, call_ref_len, call_ref);
2317 offset += call_ref_len;
2319 message_type = tvb_get_guint8(tvb, offset);
2320 if (check_col(pinfo->cinfo, COL_INFO)) {
2321 col_add_str(pinfo->cinfo, COL_INFO,
2322 val_to_str(message_type, q931_message_type_vals,
2323 "Unknown message type (0x%02X)"));
2325 if (q931_tree != NULL)
2326 proto_tree_add_uint(q931_tree, hf_q931_message_type, tvb, offset, 1, message_type);
2330 * And now for the information elements....
2332 dissect_q931_IEs(tvb, pinfo, tree, q931_tree,is_tpkt, offset);
2335 static const value_string q931_codeset_vals[] = {
2336 { 0x00, "Q.931 information elements" },
2337 { 0x04, "Information elements for ISO/IEC use" },
2338 { 0x05, "Information elements for national use" },
2339 { 0x06, "Information elements specific to the local network" },
2340 { 0x07, "User-specific information elements" },
2345 dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2346 proto_tree *q931_tree, gboolean is_tpkt, int offset)
2349 proto_tree *ie_tree = NULL;
2350 guint8 info_element;
2351 guint16 info_element_len;
2352 int codeset, locked_codeset;
2353 gboolean non_locking_shift;
2354 tvbuff_t *h225_tvb, *next_tvb;
2356 codeset = locked_codeset = 0; /* start out in codeset 0 */
2357 non_locking_shift = TRUE;
2358 while (tvb_reported_length_remaining(tvb, offset) > 0) {
2359 info_element = tvb_get_guint8(tvb, offset);
2361 /* Check for the codeset shift */
2362 if ((info_element & Q931_IE_SO_MASK) &&
2363 ((info_element & Q931_IE_SO_IDENTIFIER_MASK) == Q931_IE_SHIFT)) {
2364 non_locking_shift = info_element & Q931_IE_SHIFT_NON_LOCKING;
2365 codeset = info_element & Q931_IE_SHIFT_CODESET;
2366 if (!non_locking_shift)
2367 locked_codeset = codeset;
2368 if (q931_tree != NULL) {
2369 proto_tree_add_text(q931_tree, tvb, offset, 1,
2370 "%s shift to codeset %u: %s",
2371 (non_locking_shift ? "Non-locking" : "Locking"),
2373 val_to_str(codeset, q931_codeset_vals,
2374 "Unknown (0x%02X)"));
2381 * Check for the single-octet IEs.
2383 if (info_element & Q931_IE_SO_MASK) {
2385 * Check for subdissectors for this IE or
2386 * for all IEs in this codeset.
2388 if (dissector_get_port_handle(codeset_dissector_table, codeset) ||
2389 dissector_get_port_handle(ie_dissector_table, (codeset << 8) | (info_element & Q931_IE_SO_IDENTIFIER_MASK))) {
2390 next_tvb = tvb_new_subset (tvb, offset, 1, 1);
2391 if (dissector_try_port(ie_dissector_table, (codeset << 8) | (info_element & Q931_IE_SO_IDENTIFIER_MASK), next_tvb, pinfo, q931_tree) ||
2392 dissector_try_port(codeset_dissector_table, codeset, next_tvb, pinfo, q931_tree)) {
2394 codeset = locked_codeset;
2399 switch ((codeset << 8) | (info_element & Q931_IE_SO_IDENTIFIER_MASK)) {
2401 case CS0 | Q931_IE_MORE_DATA_OR_SEND_COMP:
2402 switch (info_element) {
2404 case Q931_IE_MORE_DATA:
2405 if (q931_tree != NULL) {
2406 proto_tree_add_text(q931_tree, tvb, offset, 1,
2411 case Q931_IE_SENDING_COMPLETE:
2412 if (q931_tree != NULL) {
2413 proto_tree_add_text(q931_tree, tvb, offset, 1,
2414 "Sending complete");
2419 if (q931_tree != NULL) {
2420 proto_tree_add_text(q931_tree, tvb, offset, 1,
2421 "Unknown information element (0x%02X)",
2428 case CS0 | Q931_IE_CONGESTION_LEVEL:
2429 if (q931_tree != NULL) {
2430 proto_tree_add_text(q931_tree, tvb, offset, 1,
2431 "Congestion level: %s",
2432 val_to_str(info_element & Q931_IE_SO_IE_MASK,
2433 q931_congestion_level_vals,
2438 case CS0 | Q931_IE_REPEAT_INDICATOR:
2439 if (q931_tree != NULL) {
2440 proto_tree_add_text(q931_tree, tvb, offset, 1,
2441 "Repeat indicator: %s",
2442 val_to_str(info_element & Q931_IE_SO_IE_MASK,
2443 q931_repeat_indication_vals,
2449 if (q931_tree != NULL) {
2450 proto_tree_add_text(q931_tree, tvb, offset, 1,
2451 "Unknown information element (0x%02X)",
2457 codeset = locked_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;
2545 if (q931_tree != NULL) {
2546 ti = proto_tree_add_text(q931_tree, tvb, offset,
2547 1+1+info_element_len, "%s",
2548 val_to_str(info_element, q931_info_element_vals[codeset],
2549 "Unknown information element (0x%02X)"));
2550 ie_tree = proto_item_add_subtree(ti, ett_q931_ie);
2551 proto_tree_add_text(ie_tree, tvb, offset, 1,
2552 "Information element: %s",
2553 val_to_str(info_element, q931_info_element_vals[codeset],
2554 "Unknown (0x%02X)"));
2555 proto_tree_add_text(ie_tree, tvb, offset + 1, 1,
2556 "Length: %u", info_element_len);
2558 switch ((codeset << 8) | info_element) {
2560 case CS0 | Q931_IE_SEGMENTED_MESSAGE:
2561 dissect_q931_segmented_message_ie(tvb,
2562 offset + 2, info_element_len,
2566 case CS0 | Q931_IE_BEARER_CAPABILITY:
2567 case CS0 | Q931_IE_LOW_LAYER_COMPAT:
2568 dissect_q931_bearer_capability_ie(tvb,
2569 offset + 2, info_element_len,
2573 case CS0 | Q931_IE_CAUSE:
2574 dissect_q931_cause_ie(tvb,
2575 offset + 2, info_element_len,
2577 hf_q931_cause_value);
2580 case CS0 | Q931_IE_CALL_STATE:
2581 dissect_q931_call_state_ie(tvb,
2582 offset + 2, info_element_len,
2586 case CS0 | Q931_IE_CHANNEL_IDENTIFICATION:
2587 dissect_q931_channel_identification_ie(
2588 tvb, offset + 2, info_element_len,
2592 case CS0 | Q931_IE_PROGRESS_INDICATOR:
2593 dissect_q931_progress_indicator_ie(tvb,
2594 offset + 2, info_element_len,
2598 case CS0 | Q931_IE_NETWORK_SPECIFIC_FACIL:
2599 case CS0 | Q931_IE_TRANSIT_NETWORK_SEL:
2600 dissect_q931_ns_facilities_ie(tvb,
2601 offset + 2, info_element_len,
2605 case CS0 | Q931_IE_NOTIFICATION_INDICATOR:
2606 dissect_q931_notification_indicator_ie(
2607 tvb, offset + 2, info_element_len,
2611 case CS0 | Q931_IE_DISPLAY:
2612 dissect_q931_ia5_ie(tvb, offset + 2,
2613 info_element_len, ie_tree,
2614 "Display information");
2617 case CS0 | Q931_IE_DATE_TIME:
2618 dissect_q931_date_time_ie(tvb,
2619 offset + 2, info_element_len,
2623 case CS0 | Q931_IE_KEYPAD_FACILITY:
2624 dissect_q931_ia5_ie(tvb, offset + 2,
2625 info_element_len, ie_tree,
2629 case CS0 | Q931_IE_SIGNAL:
2630 dissect_q931_signal_ie(tvb,
2631 offset + 2, info_element_len,
2635 case CS0 | Q931_IE_INFORMATION_RATE:
2636 dissect_q931_information_rate_ie(tvb,
2637 offset + 2, info_element_len,
2641 case CS0 | Q931_IE_E2E_TRANSIT_DELAY:
2642 dissect_q931_e2e_transit_delay_ie(tvb,
2643 offset + 2, info_element_len,
2647 case CS0 | Q931_IE_TD_SELECTION_AND_INT:
2648 dissect_q931_td_selection_and_int_ie(
2649 tvb, offset + 2, info_element_len,
2653 case CS0 | Q931_IE_PL_BINARY_PARAMETERS:
2654 dissect_q931_pl_binary_parameters_ie(
2655 tvb, offset + 2, info_element_len,
2659 case CS0 | Q931_IE_PL_WINDOW_SIZE:
2660 dissect_q931_pl_window_size_ie(tvb,
2661 offset + 2, info_element_len,
2665 case CS0 | Q931_IE_PACKET_SIZE:
2666 dissect_q931_packet_size_ie(tvb,
2667 offset + 2, info_element_len,
2671 case CS0 | Q931_IE_CUG:
2672 dissect_q931_cug_ie(tvb,
2673 offset + 2, info_element_len,
2677 case CS0 | Q931_IE_REVERSE_CHARGE_IND:
2678 dissect_q931_reverse_charge_ind_ie(tvb,
2679 offset + 2, info_element_len,
2683 case CS0 | Q931_IE_CALLING_PARTY_NUMBER:
2684 dissect_q931_number_ie(tvb,
2685 offset + 2, info_element_len,
2687 hf_q931_calling_party_number);
2690 case CS0 | Q931_IE_CONNECTED_NUMBER_DEFAULT:
2691 dissect_q931_number_ie(tvb,
2692 offset + 2, info_element_len,
2694 hf_q931_connected_number);
2697 case CS0 | Q931_IE_CALLED_PARTY_NUMBER:
2698 dissect_q931_number_ie(tvb,
2699 offset + 2, info_element_len,
2701 hf_q931_called_party_number);
2704 case CS0 | Q931_IE_REDIRECTING_NUMBER:
2705 dissect_q931_number_ie(tvb,
2706 offset + 2, info_element_len,
2708 hf_q931_redirecting_number);
2711 case CS0 | Q931_IE_CALLING_PARTY_SUBADDR:
2712 case CS0 | Q931_IE_CALLED_PARTY_SUBADDR:
2713 dissect_q931_party_subaddr_ie(tvb,
2714 offset + 2, info_element_len,
2718 case CS0 | Q931_IE_RESTART_INDICATOR:
2719 dissect_q931_restart_indicator_ie(tvb,
2720 offset + 2, info_element_len,
2724 case CS0 | Q931_IE_HIGH_LAYER_COMPAT:
2725 dissect_q931_high_layer_compat_ie(tvb,
2726 offset + 2, info_element_len,
2730 case CS0 | Q931_IE_USER_USER:
2731 dissect_q931_user_user_ie(tvb,
2732 offset + 2, info_element_len,
2737 proto_tree_add_text(ie_tree, tvb,
2738 offset + 2, info_element_len,
2741 tvb_get_ptr(tvb, offset + 2,
2747 offset += 1 + 1 + info_element_len;
2749 codeset = locked_codeset;
2754 * Q.931-over-TPKT-over-TCP.
2757 dissect_q931_tpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2762 * Check whether this looks like a TPKT-encapsulated
2765 * The minimum length of a Q.931 message is 3:
2766 * 1 byte for the protocol discriminator,
2767 * 1 for the call_reference length,
2768 * and one for the message type.
2770 lv_tpkt_len = is_tpkt(tvb, 3);
2771 if (lv_tpkt_len == -1) {
2773 * It's not a TPKT packet; reject it.
2779 * If this segment is *exactly* the length of a TPKT header,
2780 * we assume that, as it looks like a TPKT header, it
2781 * is one, and that the code put a TPKT header in one
2782 * segment and the rest of the PDU in another.
2784 if (tvb_length(tvb) == 4) {
2786 * It is - call the "dissect TPKT over a TCP stream"
2789 dissect_tpkt_encap(tvb, pinfo, tree, q931_desegment,
2790 q931_tpkt_pdu_handle);
2795 * Well, we have more data than just the TPKT header;
2796 * check whether it looks like the beginning of a
2799 * The minimum length of a Q.931 message is 3, as per the
2802 * Check that we have that many bytes past the TPKT header in
2803 * the tvbuff; we already know that the TPKT header says we
2804 * have that many bytes (as we passed 3 as the "min_len" argument
2807 if (!tvb_bytes_exist(tvb, 4, 3))
2810 /* Check the protocol discriminator */
2811 if (tvb_get_guint8(tvb, 4) != NLPID_Q_931) {
2812 /* Doesn't look like Q.931 inside TPKT */
2817 * OK, it looks like Q.931-over-TPKT.
2818 * Call the "dissect TPKT over a TCP stream" routine.
2820 dissect_tpkt_encap(tvb, pinfo, tree, q931_desegment,
2821 q931_tpkt_pdu_handle);
2827 dissect_q931_tpkt_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2829 dissect_q931_pdu(tvb, pinfo, tree, TRUE);
2833 dissect_q931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2835 dissect_q931_pdu(tvb, pinfo, tree, FALSE);
2839 proto_register_q931(void)
2841 static hf_register_info hf[] = {
2842 { &hf_q931_discriminator,
2843 { "Protocol discriminator", "q931.disc", FT_UINT8, BASE_HEX, NULL, 0x0,
2846 { &hf_q931_call_ref_flag,
2847 { "Call reference flag", "q931.call_ref_flag", FT_BOOLEAN, BASE_NONE, TFS(&tfs_call_ref_flag), 0x0,
2850 { &hf_q931_call_ref,
2851 { "Call reference value", "q931.call_ref", FT_BYTES, BASE_HEX, NULL, 0x0,
2855 { &hf_q931_coding_standard,
2856 { "Coding standard", "q931.coding_standard", FT_UINT8, BASE_HEX,
2857 VALS(q931_coding_standard_vals), 0x60,"", HFILL }},
2859 { &hf_q931_information_transfer_capability,
2860 { "Information transfer capability", "q931.information_transfer_capability", FT_UINT8, BASE_HEX,
2861 VALS(q931_information_transfer_capability_vals), 0x1f,"", HFILL }},
2863 { &hf_q931_transfer_mode,
2864 { "Transfer mode", "q931.transfer_mode", FT_UINT8, BASE_HEX,
2865 VALS(q931_transfer_mode_vals), 0x60,"", HFILL }},
2867 { &hf_q931_information_transfer_rate,
2868 { "Information transfer rate", "q931.information_transfer_rate", FT_UINT8, BASE_HEX,
2869 VALS(q931_information_transfer_rate_vals), 0x1f,"", HFILL }},
2872 { "User information layer 1 protocol", "q931.uil1", FT_UINT8, BASE_HEX,
2873 VALS(q931_uil1_vals), 0x1f,"", HFILL }},
2875 { &hf_q931_call_ref_len,
2876 { "Call reference value length", "q931.call_ref_len", FT_UINT8, BASE_DEC, NULL, 0x0,
2879 { &hf_q931_message_type,
2880 { "Message type", "q931.message_type", FT_UINT8, BASE_HEX, VALS(q931_message_type_vals), 0x0,
2883 { &hf_q931_cause_value,
2884 { "Cause value", "q931.cause_value", FT_UINT8, BASE_DEC, VALS(q931_cause_code_vals), 0x0,
2887 { &hf_q931_number_type,
2888 { "Number type", "q931.number_type", FT_UINT8, BASE_HEX, VALS(q931_number_type_vals), 0x70,
2891 { &hf_q931_numbering_plan,
2892 { "Numbering plan", "q931.numbering_plan", FT_UINT8, BASE_HEX, VALS(q931_numbering_plan_vals), 0x0f,
2895 { &hf_q931_extension_ind,
2896 { "Extension indicator", "q931.extension_ind",
2897 FT_BOOLEAN, 8, TFS(&q931_extension_ind_value), 0x80,
2900 { &hf_q931_calling_party_number,
2901 { "Calling party number digits", "q931.calling_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2904 { &hf_q931_called_party_number,
2905 { "Called party number digits", "q931.called_party_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2908 { &hf_q931_connected_number,
2909 { "Connected party number digits", "q931.connected_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2912 { &hf_q931_redirecting_number,
2913 { "Redirecting party number digits", "q931.redirecting_number.digits", FT_STRING, BASE_NONE, NULL, 0x0,
2916 static gint *ett[] = {
2920 module_t *q931_module;
2922 proto_q931 = proto_register_protocol("Q.931", "Q.931", "q931");
2923 proto_register_field_array (proto_q931, hf, array_length(hf));
2924 proto_register_subtree_array(ett, array_length(ett));
2926 register_dissector("q931", dissect_q931, proto_q931);
2927 q931_tpkt_pdu_handle = create_dissector_handle(dissect_q931_tpkt_pdu,
2930 /* subdissector code */
2931 codeset_dissector_table = register_dissector_table("q931.codeset", "Q.931 Codeset", FT_UINT8, BASE_HEX);
2932 ie_dissector_table = register_dissector_table("q931.ie", "Q.931 IE", FT_UINT16, BASE_HEX);
2934 q931_module = prefs_register_protocol(proto_q931, NULL);
2935 prefs_register_bool_preference(q931_module, "desegment_h323_messages",
2936 "Desegment all Q.931 messages spanning multiple TCP segments",
2937 "Whether the Q.931 dissector should desegment all messages spanning multiple TCP segments",
2942 proto_reg_handoff_q931(void)
2944 dissector_handle_t q931_handle;
2946 q931_handle = find_dissector("q931");
2947 dissector_add("lapd.sapi", LAPD_SAPI_Q931, q931_handle);
2950 * Attempt to get a handle for the H.225 dissector.
2951 * If we can't, the handle we get is null, and we'll just
2952 * dissect putatively-H.255 Call Signaling stuff as User
2955 h225_handle = find_dissector("h225");
2960 heur_dissector_add("tcp", dissect_q931_tpkt, proto_q931);