2 * Routines for Q.931 frame disassembly
3 * Guy Harris <guy@alum.mit.edu>
5 * Modified by Andreas Sikkema for possible use with H.323
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
11 * SPDX-License-Identifier: GPL-2.0-or-later
16 #include <epan/packet.h>
18 #include <epan/unit_strings.h>
20 #include <epan/nlpid.h>
21 #include "packet-q931.h"
22 #include "packet-e164.h"
23 #include <epan/prefs.h>
24 #include <epan/expert.h>
25 #include <epan/reassemble.h>
26 #include <epan/sctpppids.h>
27 #include <epan/lapd_sapi.h>
28 #include "packet-tpkt.h"
33 * http://www.acacia-net.com/Clarinet/Protocol/q9313svn.htm
34 * http://www.acacia-net.com/Clarinet/Protocol/q9311sc3.htm
35 * http://www.acacia-net.com/Clarinet/Protocol/q9317oz7.htm
36 * http://web.archive.org/web/20150510102424/http://www.protocols.com/pbook/isdn.htm
37 * http://freesoft.org/CIE/Topics/126.htm
38 * http://noc.comstar.ru/miscdocs/ascend-faq-cause-codes.html
39 * http://www.andrews-arnold.co.uk/isdn/q931cause.html
40 * http://www.tulatelecom.ru/staff/german/DSSHelp/MessList/InfEl/InfElList.html
43 void proto_register_q931(void);
44 void proto_reg_handoff_q931(void);
46 static void reset_q931_packet_info(q931_packet_info
*pi
);
49 static dissector_handle_t q931_handle
;
50 static dissector_handle_t q931_over_ip_handle
;
52 static int proto_q931
;
53 static int hf_q931_discriminator
;
54 static int hf_q931_coding_standard
;
55 static int hf_q931_interpretation
;
56 static int hf_q931_pres_meth_prot_prof
;
57 static int hf_q931_high_layer_characteristics
;
58 static int hf_q931_extended_high_layer_characteristics
;
59 static int hf_q931_extended_audiovisual_characteristics
;
60 static int hf_q931_information_transfer_capability
;
61 static int hf_q931_transfer_mode
;
62 static int hf_q931_information_transfer_rate
;
63 static int hf_q931_layer_ident
;
64 static int hf_q931_uil1
;
65 static int hf_q931_call_ref_len
;
66 static int hf_q931_call_ref_flag
;
67 static int hf_q931_call_ref
;
68 static int hf_q931_message_type
;
69 static int hf_q931_maintenance_message_type
;
70 static int hf_q931_segment_type
;
71 static int hf_q931_cause_location
;
72 static int hf_q931_cause_value
;
73 static int hf_q931_number_type
;
74 static int hf_q931_numbering_plan
;
75 static int hf_q931_extension_ind
;
76 static int hf_q931_extension_ind_preference
;
77 static int hf_q931_extension_ind_new_status
;
78 static int hf_q931_calling_party_number
;
79 static int hf_q931_called_party_number
;
80 static int hf_q931_connected_number
;
81 static int hf_q931_redirecting_number
;
82 static int hf_q931_screening_ind
;
83 static int hf_q931_presentation_ind
;
85 /* fields for Channel Identification IE */
86 static int hf_q931_channel_interface_explicit
;
87 static int hf_q931_channel_interface_type
;
88 static int hf_q931_channel_exclusive
;
89 static int hf_q931_channel_dchan
;
90 static int hf_q931_channel_selection_bri
;
91 static int hf_q931_channel_selection_pri
;
92 static int hf_q931_channel_map
;
93 static int hf_q931_channel_element_type
;
94 static int hf_q931_channel_number
;
97 static int hf_q931_segments
;
98 static int hf_q931_segment
;
99 static int hf_q931_segment_overlap
;
100 static int hf_q931_segment_overlap_conflict
;
101 static int hf_q931_segment_multiple_tails
;
102 static int hf_q931_segment_too_long_segment
;
103 static int hf_q931_segment_error
;
104 static int hf_q931_segment_count
;
105 static int hf_q931_reassembled_in
;
106 static int hf_q931_reassembled_length
;
108 /* Generated from convert_proto_tree_add_text.pl */
109 static int hf_q931_user_information_bytes
;
110 static int hf_q931_restart_indicator
;
111 static int hf_q931_call_state_data
;
112 static int hf_q931_first_segment
;
113 static int hf_q931_packet_size_backward_value
;
114 static int hf_q931_packet_size_forward_value
;
115 static int hf_q931_information_rate_minimum_outgoing
;
116 static int hf_q931_bearer_capability_data
;
117 static int hf_q931_uil2_info
;
118 static int hf_q931_netid_facility_specification
;
119 static int hf_q931_bearer_capability_stop_bits
;
120 static int hf_q931_netid_length
;
121 static int hf_q931_channel_data
;
122 static int hf_q931_call_state
;
123 static int hf_q931_party_subaddr_type
;
124 static int hf_q931_uil3
;
125 static int hf_q931_user_information_str
;
126 static int hf_q931_bearer_capability_user_rate
;
127 static int hf_q931_channel_slot_map
;
128 static int hf_q931_bearer_capability_modem_type
;
129 static int hf_q931_cause_data
;
130 static int hf_q931_cause_recommendation
;
131 static int hf_q931_bearer_capability_parity
;
132 static int hf_q931_cause_call_rejection_reason
;
133 static int hf_q931_party_category
;
134 static int hf_q931_progress_indicator_location
;
135 static int hf_q931_bearer_capability_packet_window_size
;
136 static int hf_q931_extension_reason
;
137 static int hf_q931_information_rate_minimum_incoming
;
138 static int hf_q931_user_protocol_discriminator
;
139 static int hf_q931_uil2
;
140 static int hf_q931_progress_indicator_description
;
141 static int hf_q931_bearer_capability_mode
;
142 static int hf_q931_not_first_segment
;
143 static int hf_q931_fast_select
;
144 static int hf_q931_netid_plan
;
145 static int hf_q931_cause_call_message_type
;
146 static int hf_q931_reverse_charging_ind
;
147 static int hf_q931_high_layer_compat_data
;
148 static int hf_q931_progress_indicator_data
;
149 static int hf_q931_pl_window_size_forward_value
;
150 static int hf_q931_cause_call_rec_timer
;
151 static int hf_q931_bearer_capability_window_size
;
152 static int hf_q931_cause_call_user_specific_diagnostic
;
153 static int hf_q931_channel_interface_id
;
154 static int hf_q931_uil3_additional
;
155 static int hf_q931_party_subaddr
;
156 static int hf_q931_bearer_capability_rate_multiplier
;
157 static int hf_q931_bearer_capability_data_bits
;
158 static int hf_q931_cug_index_code
;
159 static int hf_q931_bearer_capability_default_packet_size
;
160 static int hf_q931_notification_description
;
161 static int hf_q931_information_rate_outgoing
;
162 static int hf_q931_user_information_len
;
163 static int hf_q931_pl_window_size_backward_value
;
164 static int hf_q931_repeat_indicator
;
165 static int hf_q931_cause_call_diagnostic
;
166 static int hf_q931_netid
;
167 static int hf_q931_cause_call_condition
;
168 static int hf_q931_signal
;
169 static int hf_q931_congestion_level
;
170 static int hf_q931_bearer_capability_intermediate_rate
;
171 static int hf_q931_netid_type
;
172 static int hf_q931_information_rate_incoming
;
173 static int hf_q931_party_subaddr_odd_even_indicator
;
174 static int hf_q931_cug_indication
;
175 static int hf_q931_multiple_frame_establishment
;
176 static int hf_q931_message_originator
;
177 static int hf_q931_out_band_negotiation
;
178 static int hf_q931_negotiation_is_done
;
179 static int hf_q931_layer_1
;
180 static int hf_q931_accept_data_flow_control
;
181 static int hf_q931_mode_of_operation
;
182 static int hf_q931_extension_condition_type
;
183 static int hf_q931_pl_binary_confirmation
;
184 static int hf_q931_pl_request
;
185 static int hf_q931_pl_modulus
;
186 static int hf_q931_network_service
;
187 static int hf_q931_extension_condition
;
188 static int hf_q931_rate_adaption_header
;
189 static int hf_q931_send_data_net_independent_clock
;
190 static int hf_q931_bearer_capability_duplex
;
191 static int hf_q931_accept_data_net_independent_clock
;
192 static int hf_q931_send_data_flow_control
;
193 static int hf_q931_data
;
194 static int hf_q931_layer_1_in_band_negotiation
;
195 static int hf_q931_information_element
;
196 static int hf_q931_information_element_len
;
197 static int hf_q931_date_time
;
198 static int hf_q931_more_data
;
199 static int hf_q931_sending_complete
;
200 static int hf_q931_message_segment
;
201 static int hf_q931_missing_info_element
;
202 static int hf_q931_insufficient_info_element
;
203 static int hf_q931_cumulative_transit_delay
;
204 static int hf_q931_requested_end_to_end_transit_delay
;
205 static int hf_q931_maximum_end_to_end_transit_delay
;
206 static int hf_q931_transit_delay
;
207 static int hf_q931_display_information
;
208 static int hf_q931_keypad_facility
;
209 static int hf_q931_avaya_display
;
210 static int hf_q931_locking_codeset
;
211 static int hf_q931_protocol_negotiation
;
216 static int ett_q931_ie
[NUM_IE
];
218 static int ett_q931_segments
;
219 static int ett_q931_segment
;
221 static expert_field ei_q931_invalid_length
;
222 static expert_field ei_q931_date_time
;
223 static expert_field ei_q931_information_element
;
224 static expert_field ei_q931_incomplete_ie
;
226 static const fragment_items q931_frag_items
= {
232 &hf_q931_segment_overlap
,
233 &hf_q931_segment_overlap_conflict
,
234 &hf_q931_segment_multiple_tails
,
235 &hf_q931_segment_too_long_segment
,
236 &hf_q931_segment_error
,
237 &hf_q931_segment_count
,
238 &hf_q931_reassembled_in
,
239 &hf_q931_reassembled_length
,
240 /* Reassembled data field */
245 /* Table for reassembly of fragments. */
246 static reassembly_table q931_reassembly_table
;
249 static bool q931_reassembly
= true;
250 static bool g931_iso_iec_cause
;
252 static dissector_table_t codeset_dissector_table
;
253 static dissector_table_t ie_dissector_table
;
255 /* desegmentation of Q.931 over TPKT over TCP */
256 static bool q931_desegment
= true;
259 static dissector_handle_t h225_handle
;
260 static dissector_handle_t q931_tpkt_handle
;
261 static dissector_handle_t q931_tpkt_pdu_handle
;
263 static heur_dissector_list_t q931_user_heur_subdissector_list
;
266 dissect_q931_IEs(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*root_tree
,
267 proto_tree
*q931_tree
, bool is_over_ip
, int offset
, int initial_codeset
,
268 q931_packet_info
*q931_pi
);
270 const value_string q931_message_type_vals
[] = {
271 /* 0 */ { Q931_ESCAPE
, "ESCAPE" },
272 /* 1 */ { Q931_ALERTING
, "ALERTING" },
273 /* 2 */ { Q931_CALL_PROCEEDING
, "CALL PROCEEDING" },
274 /* 3 */ { Q931_PROGRESS
, "PROGRESS" },
275 /* 5 */ { Q931_SETUP
, "SETUP" },
276 /* 6 */ { Q931_GROUIP_SERVICE
, "GROUP SERVICE" },
277 /* 7 */ { Q931_CONNECT
, "CONNECT" },
278 /* 8 */ { Q931_RESYNC_REQ
, "RESYNC REQ" },
279 /* 9 */ { Q931_RESYNC_RESP
, "RESYNC RESP" },
280 /* 10 */ { Q931_VERSION
, "VERSION" },
281 /* 11 */ { Q931_GROUIP_SERVICE_ACK
, "GROUP SERVICE ACK" },
282 /* 13 */ { Q931_SETUP_ACK
, "SETUP ACKNOWLEDGE" },
283 /* 15 */ { Q931_CONNECT_ACK
, "CONNECT ACKNOWLEDGE" },
284 /* 32 */ { Q931_USER_INFORMATION
, "USER INFORMATION" },
285 /* 33 */ { Q931_SUSPEND_REJECT
, "SUSPEND REJECT" },
286 /* 34 */ { Q931_RESUME_REJECT
, "RESUME REJECT" },
287 /* 36 */ { Q931_HOLD
, "HOLD" },
288 /* 37 */ { Q931_SUSPEND
, "SUSPEND" },
289 /* 38 */ { Q931_RESUME
, "RESUME" },
290 /* 40 */ { Q931_HOLD_ACK
, "HOLD_ACKNOWLEDGE" },
291 /* 45 */ { Q931_SUSPEND_ACK
, "SUSPEND ACKNOWLEDGE" },
292 /* 46 */ { Q931_RESUME_ACK
, "RESUME ACKNOWLEDGE" },
293 /* 48 */ { Q931_HOLD_REJECT
, "HOLD_REJECT" },
294 /* 49 */ { Q931_RETRIEVE
, "RETRIEVE" },
295 /* 51 */ { Q931_RETRIEVE_ACK
, "RETRIEVE ACKNOWLEDGE" },
296 /* 55 */ { Q931_RETRIEVE_REJECT
, "RETRIEVE REJECT" },
297 /* 64 */ { Q931_DETACH
, "DETACH" },
298 /* 69 */ { Q931_DISCONNECT
, "DISCONNECT" },
299 /* 70 */ { Q931_RESTART
, "RESTART" },
300 /* 72 */ { Q931_DETACH_ACKNOWLEDGE
, "DETACH ACKNOWLEDGE" },
301 /* 77 */ { Q931_RELEASE
, "RELEASE" },
302 /* 78 */ { Q931_RESTART_ACK
, "RESTART ACKNOWLEDGE" },
303 /* 90 */ { Q931_RELEASE_COMPLETE
, "RELEASE COMPLETE" },
304 /* 96 */ { Q931_SEGMENT
, "SEGMENT" },
305 /* 98 */ { Q931_FACILITY
, "FACILITY" },
306 /*100 */ { Q931_REGISTER
, "REGISTER" },
307 /*106 */ { Q931_FACILITY_ACKNOWLEDGE
, "FACILITY ACKNOWLEDGE" },
308 /*110 */ { Q931_NOTIFY
, "NOTIFY" },
309 /*114 */ { Q931_FACILITY_REJECT
, "FACILITY REJECT" },
310 /*117 */ { Q931_STATUS_ENQUIRY
, "STATUS ENQUIRY" },
311 /*121 */ { Q931_CONGESTION_CONTROL
, "CONGESTION CONTROL" },
312 /*123 */ { Q931_INFORMATION
, "INFORMATION" },
313 /*125 */ { Q931_STATUS
, "STATUS" },
317 static value_string_ext q931_message_type_vals_ext
= VALUE_STRING_EXT_INIT(q931_message_type_vals
);
319 static const value_string dms_message_type_vals
[] = {
320 { DMS_SERVICE_ACKNOWLEDGE
, "SERVICE ACKNOWLEDGE" },
321 { DMS_SERVICE
, "SERVICE" },
326 * NOTE For call reference flag (octet 2)
328 * 0 The message is sent from the side that originates the call reference
329 * 1 The message is sent to the side that originates the call reference
331 static const true_false_string tfs_call_ref_flag
= {
332 "Message sent to originating side",
333 "Message sent from originating side"
336 static const true_false_string tfs_interface_type
= {
337 "Primary rate interface",
338 "Basic rate interface"
341 static const true_false_string tfs_channel_exclusive
= {
342 "Exclusive; only the indicated channel is acceptable",
343 "Indicated channel is preferred"
346 static const true_false_string tfs_channel_map
= {
347 "Channel indicated by slot map",
348 "Channel indicated by number"
352 * Information elements.
355 /* Shifted codeset values */
365 #define Q931_IE_SO_MASK 0x80 /* single-octet/variable-length mask */
369 #define Q931_IE_SO_IDENTIFIER_MASK 0xf0 /* IE identifier mask */
370 #define Q931_IE_SO_IDENTIFIER_SHIFT 4 /* IE identifier shift */
371 #define Q931_IE_SO_IE_MASK 0x0F /* IE mask */
373 #define Q931_IE_SHIFT 0x90
374 #define Q931_IE_SHIFT_NON_LOCKING 0x08 /* non-locking shift */
375 #define Q931_IE_SHIFT_CODESET 0x07 /* codeset */
377 #define Q931_IE_MORE_DATA_OR_SEND_COMP 0xA0 /* More Data or Sending Complete */
378 #define Q931_IE_MORE_DATA 0xA0
379 #define Q931_IE_SENDING_COMPLETE 0xA1
381 #define Q931_IE_CONGESTION_LEVEL 0xB0
382 #define Q931_IE_REPEAT_INDICATOR 0xD0
385 * Variable-length IEs.
387 #define Q931_IE_VL_EXTENSION 0x80 /* Extension flag */
388 /* extension bit. The bit value "0" indicates that the octet continues through the */
389 /* next octet. The bit value "1" indicates that this octet is the last octet */
391 static const true_false_string q931_extension_ind_value
= {
393 "information continues through the next octet"
398 * Codeset 0 (default).
400 #define Q931_IE_SEGMENTED_MESSAGE 0x00
401 #define Q931_IE_CHANGE_STATUS 0x01
402 #define Q931_IE_BEARER_CAPABILITY 0x04
403 #define Q931_IE_CAUSE 0x08
404 #define Q931_IE_CALL_IDENTITY 0x10
405 #define Q931_IE_CALL_STATE 0x14
406 #define Q931_IE_CHANNEL_IDENTIFICATION 0x18
407 #define Q931_IE_FACILITY 0x1C
408 #define Q931_IE_PROGRESS_INDICATOR 0x1E
409 #define Q931_IE_NETWORK_SPECIFIC_FACIL 0x20 /* Network Specific Facilities */
410 #define Q931_IE_NOTIFICATION_INDICATOR 0x27
411 #define Q931_IE_DISPLAY 0x28
412 #define Q931_IE_DATE_TIME 0x29
413 #define Q931_IE_KEYPAD_FACILITY 0x2C
414 #define Q931_IE_INFORMATION_REQUEST 0x32
415 #define Q931_IE_SIGNAL 0x34
416 #define Q931_IE_SWITCHHOOK 0x36
417 #define Q931_IE_FEATURE_ACTIVATION 0x38
418 #define Q931_IE_FEATURE_INDICATION 0x39
419 #define Q931_IE_ENDPOINT_IDENTIFIER 0x3B
420 #define Q931_IE_SERVICE_PROFILE_ID 0x3A
421 #define Q931_IE_INFORMATION_RATE 0x40
422 #define Q931_IE_E2E_TRANSIT_DELAY 0x42 /* End-to-end Transit Delay */
423 #define Q931_IE_TD_SELECTION_AND_INT 0x43 /* Transit Delay Selection and Indication */
424 #define Q931_IE_PL_BINARY_PARAMETERS 0x44 /* Packet layer binary parameters */
425 #define Q931_IE_PL_WINDOW_SIZE 0x45 /* Packet layer window size */
426 #define Q931_IE_PACKET_SIZE 0x46 /* Packet size */
427 #define Q931_IE_CUG 0x47 /* Closed user group */
428 #define Q931_IE_REVERSE_CHARGE_IND 0x4A /* Reverse charging indication */
429 #define Q931_IE_CONNECTED_NUMBER_DEFAULT 0x4C /* Connected Number */
430 #define Q931_IE_INTERFACE_SERVICE 0x66 /* q931+ Interface Service */
431 #define Q931_IE_CHANNEL_STATUS 0x67 /* q931+ Channel Status */
432 #define Q931_IE_VERSION_INFO 0x68 /* q931+ Version Info */
433 #define Q931_IE_CALLING_PARTY_NUMBER 0x6C /* Calling Party Number */
434 #define Q931_IE_CALLING_PARTY_SUBADDR 0x6D /* Calling Party Subaddress */
435 #define Q931_IE_CALLED_PARTY_NUMBER 0x70 /* Called Party Number */
436 #define Q931_IE_CALLED_PARTY_SUBADDR 0x71 /* Called Party Subaddress */
437 #define Q931_IE_REDIRECTING_NUMBER 0x74
438 #define Q931_IE_REDIRECTION_NUMBER 0x76
439 #define Q931_IE_TRANSIT_NETWORK_SEL 0x78 /* Transit Network Selection */
440 #define Q931_IE_RESTART_INDICATOR 0x79
441 #define Q931_IE_LOW_LAYER_COMPAT 0x7C /* Low-Layer Compatibility */
442 #define Q931_IE_HIGH_LAYER_COMPAT 0x7D /* High-Layer Compatibility */
443 #define Q931_IE_USER_USER 0x7E /* User-User */
444 #define Q931_IE_ESCAPE 0x7F /* Escape for extension */
449 #define Q931_IE_CONNECTED_NUMBER 0x8C
450 #define Q931_IE_CONNECTED_SUBADDR 0x8D
453 * Codeset 5 (National-specific) Belgium.
455 #define Q931_IE_CHARGING_ADVICE 0x1A
458 * Codeset 5 (National-specific) Bellcore National ISDN.
460 #define Q931_IE_OPERATOR_SYSTEM_ACCESS 0x1D
463 * Codeset 5 ETSI ETS 300 192
465 #define Q931_IE_PARTY_CATEGORY 0x32
468 * Codeset 6 (Network-specific) Belgium.
470 /* 0x1A is Charging Advice, as with Codeset 5 */
471 #define Q931_IE_REDIRECTING_NUMBER 0x74
474 * Codeset 6 (Network-specific) FT-Numeris.
476 /* 0x1D is User Capability */
479 * Codeset 6 (Network-specific) Bellcore National ISDN.
481 #define Q931_IE_REDIRECTING_SUBADDR 0x75 /* Redirecting Subaddress */
482 /* 0x76 is Redirection Number, but that's also Codeset 0 */
483 #define Q931_IE_CALL_APPEARANCE 0x7B
486 static const value_string q931_info_element_vals0
[] = {
487 { Q931_IE_SEGMENTED_MESSAGE
, "Segmented message" },
488 { Q931_IE_CHANGE_STATUS
, "Change status" },
489 { Q931_IE_BEARER_CAPABILITY
, "Bearer capability" },
490 { Q931_IE_CAUSE
, "Cause" },
491 { Q931_IE_CALL_IDENTITY
, "Call identity" },
492 { Q931_IE_CALL_STATE
, "Call state" },
493 { Q931_IE_CHANNEL_IDENTIFICATION
, "Channel identification" },
494 { Q931_IE_FACILITY
, "Facility" },
495 { Q931_IE_PROGRESS_INDICATOR
, "Progress indicator" },
496 { Q931_IE_NETWORK_SPECIFIC_FACIL
, "Network specific facilities" },
497 { Q931_IE_NOTIFICATION_INDICATOR
, "Notification indicator" },
498 { Q931_IE_DISPLAY
, "Display" },
499 { Q931_IE_DATE_TIME
, "Date/Time" },
500 { Q931_IE_KEYPAD_FACILITY
, "Keypad facility" },
501 { Q931_IE_INFORMATION_REQUEST
, "Information request" },
502 { Q931_IE_SIGNAL
, "Signal" },
503 { Q931_IE_SWITCHHOOK
, "Switchhook" },
504 { Q931_IE_FEATURE_ACTIVATION
, "Feature activation" },
505 { Q931_IE_FEATURE_INDICATION
, "Feature Indication" },
506 { Q931_IE_ENDPOINT_IDENTIFIER
, "Endpoint identifier" },
507 { Q931_IE_SERVICE_PROFILE_ID
, "Service profile ID" },
508 { Q931_IE_INFORMATION_RATE
, "Information rate" },
509 { Q931_IE_E2E_TRANSIT_DELAY
, "End-to-end transit delay" },
510 { Q931_IE_TD_SELECTION_AND_INT
, "Transit delay selection and indication" },
511 { Q931_IE_PL_BINARY_PARAMETERS
, "Packet layer binary parameters" },
512 { Q931_IE_PL_WINDOW_SIZE
, "Packet layer window size" },
513 { Q931_IE_PACKET_SIZE
, "Packet size" },
514 { Q931_IE_CUG
, "Closed user group" },
515 { Q931_IE_REVERSE_CHARGE_IND
, "Reverse charging indication" },
516 { Q931_IE_CONNECTED_NUMBER_DEFAULT
, "Connected number" },
517 { Q931_IE_INTERFACE_SERVICE
, "Interface Service" },
518 { Q931_IE_CHANNEL_STATUS
, "Channel Status" },
519 { Q931_IE_VERSION_INFO
, "Version Info" },
520 { Q931_IE_CALLING_PARTY_NUMBER
, "Calling party number" },
521 { Q931_IE_CALLING_PARTY_SUBADDR
, "Calling party subaddress" },
522 { Q931_IE_CALLED_PARTY_NUMBER
, "Called party number" },
523 { Q931_IE_CALLED_PARTY_SUBADDR
, "Called party subaddress" },
524 { Q931_IE_REDIRECTING_NUMBER
, "Redirecting number" },
525 { Q931_IE_REDIRECTION_NUMBER
, "Redirection number" },
526 { Q931_IE_TRANSIT_NETWORK_SEL
, "Transit network selection" },
527 { Q931_IE_RESTART_INDICATOR
, "Restart indicator" },
528 { Q931_IE_LOW_LAYER_COMPAT
, "Low-layer compatibility" },
529 { Q931_IE_HIGH_LAYER_COMPAT
, "High-layer compatibility" },
530 { Q931_IE_USER_USER
, "User-user" },
531 { Q931_IE_ESCAPE
, "Escape" },
532 { Q931_IE_CONNECTED_NUMBER
, "Connected number" },
533 { Q931_IE_CONNECTED_SUBADDR
, "Connected subaddress" },
538 static const value_string q931_info_element_vals1
[] = {
542 static const value_string q931_info_element_vals2
[] = {
546 static const value_string q931_info_element_vals3
[] = {
550 static const value_string q931_info_element_vals4
[] = {
554 static const value_string q931_info_element_vals5
[] = {
555 { Q931_IE_CHARGING_ADVICE
, "Charging advice" },
556 { Q931_IE_OPERATOR_SYSTEM_ACCESS
, "Operator system access" },
557 { Q931_IE_PARTY_CATEGORY
, "Party category"},
561 static const value_string q931_info_element_vals6
[] = {
562 { Q931_IE_REDIRECTING_NUMBER
, "Redirecting number" },
563 { Q931_IE_REDIRECTING_SUBADDR
, "Redirecting subaddress" },
564 { Q931_IE_CALL_APPEARANCE
, "Call appearance" },
565 { Q931_IE_DISPLAY
, "Avaya Display" }, /* if Avaya codeset to send display = 6 */
569 static const value_string q931_info_element_vals7
[] = {
574 #define NUM_INFO_ELEMENT_VALS (Q931_IE_SHIFT_CODESET+1)
575 static const value_string
*q931_info_element_vals
[NUM_INFO_ELEMENT_VALS
] = {
576 q931_info_element_vals0
,
577 q931_info_element_vals1
,
578 q931_info_element_vals2
,
579 q931_info_element_vals3
,
580 q931_info_element_vals4
,
581 q931_info_element_vals5
,
582 q931_info_element_vals6
,
583 q931_info_element_vals7
,
586 static const value_string q931_congestion_level_vals
[] = {
587 { 0x0, "Receiver ready" },
588 { 0xF, "Receiver not ready" },
592 static const value_string q931_repeat_indication_vals
[] = {
593 { 0x2, "Prioritized list" },
598 * ITU-standardized coding.
600 #define Q931_ITU_STANDARDIZED_CODING 0x00
601 #define Q931_ISO_IEC_STANDARDIZED_CODING 0x20
604 * Dissect a Segmented message information element.
607 dissect_q931_segmented_message_ie(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, int len
,
608 proto_tree
*tree
, proto_item
* item
)
613 expert_add_info_format(pinfo
, item
, &ei_q931_invalid_length
,
614 "Segmented message: length is %d, should be 2", len
);
618 octet
= tvb_get_uint8(tvb
, offset
);
620 proto_tree_add_item(tree
, hf_q931_first_segment
, tvb
, offset
, 1, ENC_NA
);
622 proto_tree_add_item(tree
, hf_q931_not_first_segment
, tvb
, offset
, 1, ENC_NA
);
624 proto_tree_add_item(tree
, hf_q931_segment_type
, tvb
, offset
+ 1, 1, ENC_BIG_ENDIAN
);
628 * Dissect a Bearer capability or Low-layer compatibility information element.
630 static const value_string q931_coding_standard_vals
[] = {
631 { 0x0, "ITU-T standardized coding" },
632 { 0x1, "ISO/IEC standard" },
633 { 0x2, "National standard" },
634 { 0x3, "Standard defined for this particular network" },
638 static const value_string q931_information_transfer_capability_vals
[] = {
640 { 0x08, "Unrestricted digital information" },
641 { 0x09, "Restricted digital information" },
642 { 0x10, "3.1 kHz audio" },
643 { 0x11, "Unrestricted digital information with tones/announcements" },
648 static const value_string q931_transfer_mode_vals
[] = {
649 { 0x00, "Circuit mode" },
650 { 0x02, "Packet mode" },
654 #define Q931_IT_RATE_MULTIRATE 0x18
656 static const value_string q931_information_transfer_rate_vals
[] = {
657 { 0x00, "Packet mode" },
658 { 0x10, "64 kbit/s" },
659 { 0x11, "2 x 64 kbit/s" },
660 { 0x13, "384 kbit/s" },
661 { 0x15, "1536 kbit/s" },
662 { 0x17, "1920 kbit/s" },
663 { Q931_IT_RATE_MULTIRATE
, "Multirate (64 kbit/s base rate)" },
668 * Values 0x0a and 0x0b added from Q.931 Amendment 1 (12/2002)
670 static const value_string q931_uil1_vals
[] = {
671 { 0x01, "V.110/I.460/X.30 rate adaption" },
672 { 0x02, "Recommendation G.711 u-law" },
673 { 0x03, "Recommendation G.711 A-law" },
674 { 0x04, "Recommendation G.721 32 kbit/s ADPCM and Recommendation I.460" },
675 { 0x05, "Recommendation H.221 and H.242" },
676 { 0x06, "Recommendation H.223 and H.245" },
677 { 0x07, "Non-ITU-T-standardized rate adaption" },
678 { 0x08, "V.120 rate adaption" },
679 { 0x09, "X.31 HDLC flag stuffing" },
680 { 0x0a, "Recommendation G.728 LD-CELP" },
681 { 0x0b, "Recommendation G.729 CS-ACELP" },
684 static value_string_ext q931_uil1_vals_ext
= VALUE_STRING_EXT_INIT(q931_uil1_vals
);
686 static const value_string q931_l1_user_rate_vals
[] = {
687 { 0x00, "Rate indicated by E-bits" },
688 { 0x01, "0.6 kbit/s" },
689 { 0x02, "1.2 kbit/s" },
690 { 0x03, "2.4 kbit/s" },
691 { 0x04, "3.6 kbit/s" },
692 { 0x05, "4.8 kbit/s" },
693 { 0x06, "7.2 kbit/s" },
694 { 0x07, "8 kbit/s" },
695 { 0x08, "9.6 kbit/s" },
696 { 0x09, "14.4 kbit/s" },
697 { 0x0A, "16 kbit/s" },
698 { 0x0B, "19.2 kbit/s" },
699 { 0x0C, "32 kbit/s" },
700 { 0x0E, "48 kbit/s" },
701 { 0x0F, "56 kbit/s" },
702 { 0x10, "64 kbit/s "},
703 { 0x15, "0.1345 kbit/s" },
704 { 0x16, "0.100 kbit/s" },
705 { 0x17, "0.075/1.2 kbit/s" },
706 { 0x18, "1.2/0.075 kbit/s" },
707 { 0x19, "0.050 kbit/s" },
708 { 0x1A, "0.075 kbit/s" },
709 { 0x1B, "0.110 kbit/s" },
710 { 0x1C, "0.150 kbit/s" },
711 { 0x1D, "0.200 kbit/s" },
712 { 0x1E, "0.300 kbit/s" },
713 { 0x1F, "12 kbit/s" },
716 static value_string_ext q931_l1_user_rate_vals_ext
= VALUE_STRING_EXT_INIT(q931_l1_user_rate_vals
);
718 static const value_string q931_l1_intermediate_rate_vals
[] = {
719 { 0x00, "Not used" },
720 { 0x01, "8 kbit/s" },
721 { 0x02, "16 kbit/s" },
722 { 0x03, "32 kbit/s" },
726 static const value_string q931_l1_stop_bits_vals
[] = {
733 static const value_string q931_l1_data_bits_vals
[] = {
740 static const value_string q931_l1_parity_vals
[] = {
744 { 0x04, "Forced to 0" },
745 { 0x05, "Forced to 1" },
749 #define Q931_UIL2_USER_SPEC 0x10
751 static const value_string q931_uil2_vals
[] = {
752 { 0x01, "Basic mode ISO 1745" },
753 { 0x02, "Q.921/I.441" }, /* LAPD */
754 { 0x06, "X.25, link layer" }, /* LAPB */
755 { 0x07, "X.25 multilink" }, /* or 0x0F? */
756 { 0x08, "T.71 Extended LAPB" },
757 { 0x09, "HDLC ARM" },
758 { 0x0A, "HDLC NRM" },
759 { 0x0B, "HDLC ABM" },
760 { 0x0C, "ISO 8802/2 LLC" },
761 { 0x0D, "X.75 Single Link Procedure" },
763 { 0x0F, "Core aspects of Q.922" },
764 { Q931_UIL2_USER_SPEC
, "User-specified" },
765 { 0x11, "ISO 7776 DTE-DTE operation" },
768 static value_string_ext q931_uil2_vals_ext
= VALUE_STRING_EXT_INIT(q931_uil2_vals
);
770 static const value_string q931_mode_vals
[] = {
771 { 0x1, "Normal mode" },
772 { 0x2, "Extended mode" },
776 #define Q931_UIL3_X25_PL 0x06
777 #define Q931_UIL3_ISO_8208 0x07 /* X.25-based */
778 #define Q931_UIL3_X223 0x08 /* X.25-based */
779 #define Q931_UIL3_TR_9577 0x0B
780 #define Q931_UIL3_USER_SPEC 0x10
782 static const value_string q931_uil3_vals
[] = {
783 { 0x02, "Q.931/I.451" },
784 { Q931_UIL3_X25_PL
, "X.25, packet layer" },
785 { Q931_UIL3_ISO_8208
, "ISO/IEC 8208" },
786 { Q931_UIL3_X223
, "X.223/ISO 8878" },
787 { 0x09, "ISO/IEC 8473" },
789 { Q931_UIL3_TR_9577
, "ISO/IEC TR 9577" },
790 { Q931_UIL3_USER_SPEC
, "User-specified" },
795 dissect_q931_protocol_discriminator(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
)
797 unsigned int discriminator
= tvb_get_uint8(tvb
, offset
);
799 if (discriminator
== NLPID_DMS
) {
800 proto_tree_add_uint_format_value(tree
, hf_q931_discriminator
,
801 tvb
, offset
, 1, discriminator
,
802 "Maintenance messages");
803 } else if (discriminator
== NLPID_Q_931
) {
804 proto_tree_add_uint_format_value(tree
, hf_q931_discriminator
,
805 tvb
, offset
, 1, discriminator
,
807 } else if (discriminator
== NLPID_Q_2931
) {
808 proto_tree_add_uint_format_value(tree
, hf_q931_discriminator
,
809 tvb
, offset
, 1, discriminator
,
811 } else if ((discriminator
>= 16 && discriminator
< 63)
812 || ((discriminator
>= 80) && (discriminator
< 254))) {
813 proto_tree_add_uint_format_value(tree
, hf_q931_discriminator
,
814 tvb
, offset
, 1, discriminator
,
815 "Network layer or layer 3 protocol (0x%02X)",
817 } else if (discriminator
>= 64 && discriminator
<= 79) {
818 proto_tree_add_uint_format_value(tree
, hf_q931_discriminator
,
819 tvb
, offset
, 1, discriminator
,
820 "National use (0x%02X)",
823 proto_tree_add_uint_format_value(tree
, hf_q931_discriminator
,
824 tvb
, offset
, 1, discriminator
,
830 static const value_string q931_bearer_capability_layer_ident_vals
[] = {
831 { 0x01, "Layer 1 identifier" },
832 { 0x02, "Layer 2 identifier" },
833 { 0x03, "Layer 3 identifier" },
837 #define Q931_UIL2_USER_SPEC 0x10
839 static const range_string q931_l1_modem_type_rvals
[] = {
840 { 0x00, 0x05, "National use" },
841 { 0x11, 0x11, "V.21" },
842 { 0x12, 0x12, "V.22" },
843 { 0x13, 0x13, "V.22 bis" },
844 { 0x14, 0x14, "V.23" },
845 { 0x15, 0x15, "V.26" },
846 { 0x16, 0x16, "V.26 bis" },
847 { 0x17, 0x17, "V.26 ter" },
848 { 0x18, 0x18, "V.27" },
849 { 0x19, 0x19, "V.27 bis" },
850 { 0x1A, 0x1A, "V.27 ter" },
851 { 0x1B, 0x1B, "V.29" },
852 { 0x1C, 0x1C, "V.32" },
853 { 0x1E, 0x1E, "V.34" },
854 { 0x20, 0x2F, "National use" },
855 { 0x30, 0x3F, "User specified" },
859 static const true_false_string tfs_assignor_default
= { "Assignor only", "Default assignee" };
860 static const true_false_string tfs_in_out_band
= { "in-band", "out-of-band" };
861 static const true_false_string tfs_protocol_negotiation
= { "Full protocol negotiation", "LLI = 256 only" };
864 dissect_q931_bearer_capability_ie(tvbuff_t
*tvb
, int offset
, int len
,
868 uint8_t coding_standard
;
870 uint8_t uil2_protocol
;
871 uint8_t uil3_protocol
;
876 octet
= tvb_get_uint8(tvb
, offset
);
877 coding_standard
= octet
& 0x60;
878 if (coding_standard
!= Q931_ITU_STANDARDIZED_CODING
) {
880 * We don't know how the bearer capability is encoded,
881 * so just dump it as data and be done with it.
883 proto_tree_add_item(tree
, hf_q931_bearer_capability_data
, tvb
, offset
, len
, ENC_NA
);
884 proto_tree_add_boolean(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, octet
);
885 proto_tree_add_uint(tree
, hf_q931_coding_standard
, tvb
, offset
, 1, octet
);
888 proto_tree_add_boolean(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, octet
);
889 proto_tree_add_uint(tree
, hf_q931_coding_standard
, tvb
, offset
, 1, octet
);
890 proto_tree_add_uint(tree
, hf_q931_information_transfer_capability
, tvb
, offset
, 1, octet
);
895 * XXX - only in Low-layer compatibility information element.
897 if (!(octet
& Q931_IE_VL_EXTENSION
)) {
900 proto_tree_add_item(tree
, hf_q931_out_band_negotiation
, tvb
, offset
, 1, ENC_NA
);
907 octet
= tvb_get_uint8(tvb
, offset
);
908 proto_tree_add_boolean(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, octet
);
909 proto_tree_add_uint(tree
, hf_q931_transfer_mode
, tvb
, offset
, 1, octet
);
910 proto_tree_add_uint(tree
, hf_q931_information_transfer_rate
, tvb
, offset
, 1, octet
);
911 it_rate
= octet
& 0x1F;
915 if (it_rate
== Q931_IT_RATE_MULTIRATE
) {
918 proto_tree_add_item(tree
, hf_q931_bearer_capability_rate_multiplier
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
925 octet
= tvb_get_uint8(tvb
, offset
);
926 if ((octet
& 0x60) == 0x20) {
928 * Layer 1 information.
930 proto_tree_add_boolean(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, octet
);
931 proto_tree_add_uint(tree
, hf_q931_layer_ident
, tvb
, offset
, 1, octet
);
932 proto_tree_add_uint(tree
, hf_q931_uil1
, tvb
, offset
, 1, octet
);
936 if (octet
& Q931_IE_VL_EXTENSION
)
940 octet
= tvb_get_uint8(tvb
, offset
);
941 proto_tree_add_item(tree
, hf_q931_layer_1
, tvb
, offset
, 1, ENC_NA
);
942 proto_tree_add_item(tree
, hf_q931_layer_1_in_band_negotiation
, tvb
, offset
, 1, ENC_NA
);
943 proto_tree_add_item(tree
, hf_q931_bearer_capability_user_rate
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
947 if (octet
& Q931_IE_VL_EXTENSION
)
951 octet
= tvb_get_uint8(tvb
, offset
);
952 proto_tree_add_item(tree
, hf_q931_bearer_capability_intermediate_rate
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
953 proto_tree_add_item(tree
, hf_q931_send_data_net_independent_clock
, tvb
, offset
, 1, ENC_NA
);
954 proto_tree_add_item(tree
, hf_q931_accept_data_net_independent_clock
, tvb
, offset
, 1, ENC_NA
);
955 proto_tree_add_item(tree
, hf_q931_send_data_flow_control
, tvb
, offset
, 1, ENC_NA
);
956 proto_tree_add_item(tree
, hf_q931_accept_data_flow_control
, tvb
, offset
, 1, ENC_NA
);
960 if (octet
& Q931_IE_VL_EXTENSION
)
964 octet
= tvb_get_uint8(tvb
, offset
);
965 proto_tree_add_item(tree
, hf_q931_rate_adaption_header
, tvb
, offset
, 1, ENC_NA
);
966 proto_tree_add_item(tree
, hf_q931_multiple_frame_establishment
, tvb
, offset
, 1, ENC_NA
);
967 proto_tree_add_item(tree
, hf_q931_mode_of_operation
, tvb
, offset
, 1, ENC_NA
);
968 proto_tree_add_item(tree
, hf_q931_protocol_negotiation
, tvb
, offset
, 1, ENC_NA
);
969 proto_tree_add_item(tree
, hf_q931_message_originator
, tvb
, offset
, 1, ENC_NA
);
970 proto_tree_add_item(tree
, hf_q931_negotiation_is_done
, tvb
, offset
, 1, ENC_NA
);
974 if (octet
& Q931_IE_VL_EXTENSION
)
978 octet
= tvb_get_uint8(tvb
, offset
);
979 proto_tree_add_item(tree
, hf_q931_bearer_capability_stop_bits
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
980 proto_tree_add_item(tree
, hf_q931_bearer_capability_data_bits
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
981 proto_tree_add_item(tree
, hf_q931_bearer_capability_parity
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
983 if (octet
& Q931_IE_VL_EXTENSION
)
985 proto_tree_add_item(tree
, hf_q931_bearer_capability_duplex
, tvb
, offset
, 1, ENC_NA
);
986 proto_tree_add_item(tree
, hf_q931_bearer_capability_modem_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
995 octet
= tvb_get_uint8(tvb
, offset
);
996 if ((octet
& 0x60) == 0x40) {
998 * Layer 2 information.
1000 proto_tree_add_boolean(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, octet
);
1001 proto_tree_add_uint(tree
, hf_q931_layer_ident
, tvb
, offset
, 1, octet
);
1002 uil2_protocol
= octet
& 0x1F;
1003 proto_tree_add_item(tree
, hf_q931_uil2
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1008 * XXX - only in Low-layer compatibility information element.
1010 if (octet
& Q931_IE_VL_EXTENSION
)
1014 octet
= tvb_get_uint8(tvb
, offset
);
1015 if (uil2_protocol
== Q931_UIL2_USER_SPEC
) {
1016 proto_tree_add_item(tree
, hf_q931_uil2_info
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1018 proto_tree_add_item(tree
, hf_q931_bearer_capability_mode
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1023 if (octet
& Q931_IE_VL_EXTENSION
)
1027 octet
= tvb_get_uint8(tvb
, offset
) & 0x7F;
1028 proto_tree_add_uint_format_value(tree
, hf_q931_bearer_capability_window_size
, tvb
, offset
, 1,
1029 octet
, "octet & 0x7F%u k", octet
);
1038 octet
= tvb_get_uint8(tvb
, offset
);
1039 if ((octet
& 0x60) == 0x60) {
1041 * Layer 3 information.
1043 proto_tree_add_boolean(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, octet
);
1044 proto_tree_add_uint(tree
, hf_q931_layer_ident
, tvb
, offset
, 1, octet
);
1045 uil3_protocol
= octet
& 0x1F;
1046 proto_tree_add_item(tree
, hf_q931_uil3
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1052 * XXX - only in Low-layer compatibility information element.
1054 if (octet
& Q931_IE_VL_EXTENSION
)
1058 octet
= tvb_get_uint8(tvb
, offset
);
1059 switch (uil3_protocol
) {
1061 case Q931_UIL3_X25_PL
:
1062 case Q931_UIL3_ISO_8208
:
1063 case Q931_UIL3_X223
:
1064 proto_tree_add_item(tree
, hf_q931_bearer_capability_mode
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1068 if (octet
& Q931_IE_VL_EXTENSION
)
1072 octet
= tvb_get_uint8(tvb
, offset
);
1073 proto_tree_add_item(tree
, hf_q931_bearer_capability_default_packet_size
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1077 if (octet
& Q931_IE_VL_EXTENSION
)
1081 proto_tree_add_item(tree
, hf_q931_bearer_capability_packet_window_size
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1086 case Q931_UIL3_USER_SPEC
:
1087 proto_tree_add_uint(tree
, hf_q931_bearer_capability_default_packet_size
, tvb
, offset
, 1, 1 << (octet
& 0x0F));
1092 case Q931_UIL3_TR_9577
:
1093 add_l3_info
= (octet
& 0x0F) << 4;
1094 if (octet
& Q931_IE_VL_EXTENSION
)
1098 octet
= tvb_get_uint8(tvb
, offset
+ 1);
1099 add_l3_info
|= (octet
& 0x0F);
1100 proto_tree_add_uint(tree
, hf_q931_uil3_additional
, tvb
, offset
, 2, add_l3_info
);
1111 * Dissect a Cause information element.
1115 static const value_string q931_cause_location_vals
[] = {
1116 { 0x00, "User (U)" },
1117 { 0x01, "Private network serving the local user (LPN)" },
1118 { 0x02, "Public network serving the local user (LN)" },
1119 { 0x03, "Transit network (TN)" },
1120 { 0x04, "Public network serving the remote user (RLN)" },
1121 { 0x05, "Private network serving the remote user (RPN)" },
1122 { 0x06, "Unallocated code" },
1123 { 0x07, "International network (INTL)" },
1124 { 0x08, "Unallocated code" },
1125 { 0x09, "Unallocated code" },
1126 { 0x0A, "Network beyond interworking point (BI)" },
1129 value_string_ext q931_cause_location_vals_ext
= VALUE_STRING_EXT_INIT(q931_cause_location_vals
);
1131 static const value_string q931_cause_recommendation_vals
[] = {
1135 { 0x05, "Q.1031/Q.1051" },
1140 * Cause codes for Cause.
1142 #define Q931_CAUSE_UNALLOC_NUMBER 0x01
1143 #define Q931_CAUSE_NO_ROUTE_TO_DEST 0x03
1144 #define Q931_CAUSE_CALL_REJECTED 0x15
1145 #define Q931_CAUSE_NUMBER_CHANGED 0x16
1146 #define Q931_CAUSE_ACCESS_INFO_DISC 0x2B
1147 #define Q931_CAUSE_QOS_UNAVAILABLE 0x31
1148 #define Q931_CAUSE_CHAN_NONEXISTENT 0x52
1149 #define Q931_CAUSE_INCOMPATIBLE_DEST 0x58
1150 #define Q931_CAUSE_MAND_IE_MISSING 0x60
1151 #define Q931_CAUSE_MT_NONEX_OR_UNIMPL 0x61
1152 #define Q931_CAUSE_IE_NONEX_OR_UNIMPL 0x63
1153 #define Q931_CAUSE_INVALID_IE_CONTENTS 0x64
1154 #define Q931_CAUSE_MSG_INCOMPAT_W_CS 0x65
1155 #define Q931_CAUSE_REC_TIMER_EXP 0x66
1157 static const value_string q931_cause_code_vals
[] = {
1158 { 0x00, "Valid cause code not yet received" },
1159 { Q931_CAUSE_UNALLOC_NUMBER
, "Unallocated (unassigned) number" },
1160 { 0x02, "No route to specified transit network" },
1161 { Q931_CAUSE_NO_ROUTE_TO_DEST
, "No route to destination" },
1162 { 0x04, "Send special information tone" },
1163 { 0x05, "Misdialled trunk prefix" },
1164 { 0x06, "Channel unacceptable" },
1165 { 0x07, "Call awarded and being delivered in an established channel" },
1166 { 0x08, "Prefix 0 dialed but not allowed" },
1167 /* Q.850 - "Preemption" */
1168 { 0x09, "Prefix 1 dialed but not allowed" },
1169 /* Q.850 - "Preemption - circuit reserved for reuse" */
1170 { 0x0A, "Prefix 1 dialed but not required" },
1171 { 0x0B, "More digits received than allowed, call is proceeding" },
1172 { 0x0E, "QoR: ported number" },
1173 { 0x10, "Normal call clearing" },
1174 { 0x11, "User busy" },
1175 { 0x12, "No user responding" },
1176 { 0x13, "No answer from user (user alerted)" },
1177 { 0x14, "Subscriber absent" },
1178 { Q931_CAUSE_CALL_REJECTED
, "Call rejected" },
1179 { Q931_CAUSE_NUMBER_CHANGED
, "Number changed" },
1180 { 0x17, "Reverse charging rejected" },
1181 /* Q.850 - "Redirection to new destination" */
1182 { 0x18, "Call suspended" },
1183 /* Q.850 Amendment 1 - "Call rejected due to feature at the destination" */
1184 { 0x19, "Call resumed" },
1185 /* Q.850 - "Exchange routing error */
1186 { 0x1A, "Non-selected user clearing" },
1187 { 0x1B, "Destination out of order" },
1188 { 0x1C, "Invalid number format (incomplete number)" },
1189 { 0x1D, "Facility rejected" },
1190 { 0x1E, "Response to STATUS ENQUIRY" },
1191 { 0x1F, "Normal unspecified" },
1192 { 0x21, "Circuit out of order" },
1193 { 0x22, "No circuit/channel available" },
1194 { 0x23, "Destination unattainable" },
1195 { 0x25, "Degraded service" },
1196 { 0x26, "Network out of order" },
1197 { 0x27, "Transit delay range cannot be achieved" },
1198 /* Q.850 - "Permanent frame mode connection out of service" */
1199 { 0x28, "Throughput range cannot be achieved" },
1200 /* Q.850 - "Permanent frame mode connection operational" */
1201 { 0x29, "Temporary failure" },
1202 { 0x2A, "Switching equipment congestion" },
1203 { Q931_CAUSE_ACCESS_INFO_DISC
, "Access information discarded" },
1204 { 0x2C, "Requested circuit/channel not available" },
1205 { 0x2D, "Pre-empted" },
1206 { 0x2E, "Precedence call blocked" },
1207 { 0x2F, "Resources unavailable, unspecified" },
1208 { Q931_CAUSE_QOS_UNAVAILABLE
, "Quality of service unavailable" },
1209 { 0x32, "Requested facility not subscribed" },
1210 { 0x33, "Reverse charging not allowed" },
1211 { 0x34, "Outgoing calls barred" },
1212 { 0x35, "Outgoing calls barred within CUG" },
1213 { 0x36, "Incoming calls barred" },
1214 { 0x37, "Incoming calls barred within CUG" },
1215 { 0x38, "Call waiting not subscribed" },
1216 { 0x39, "Bearer capability not authorized" },
1217 { 0x3A, "Bearer capability not presently available" },
1218 { 0x3E, "Inconsistency in designated outgoing access information and subscriber class" },
1219 { 0x3F, "Service or option not available, unspecified" },
1220 { 0x41, "Bearer capability not implemented" },
1221 { 0x42, "Channel type not implemented" },
1222 { 0x43, "Transit network selection not implemented" },
1223 { 0x44, "Message not implemented" },
1224 { 0x45, "Requested facility not implemented" },
1225 { 0x46, "Only restricted digital information bearer capability is available" },
1226 { 0x4F, "Service or option not implemented, unspecified" },
1227 { 0x51, "Invalid call reference value" },
1228 { Q931_CAUSE_CHAN_NONEXISTENT
, "Identified channel does not exist" },
1229 { 0x53, "Call identity does not exist for suspended call" },
1230 { 0x54, "Call identity in use" },
1231 { 0x55, "No call suspended" },
1232 { 0x56, "Call having the requested call identity has been cleared" },
1233 { 0x57, "Called user not member of CUG" },
1234 { Q931_CAUSE_INCOMPATIBLE_DEST
, "Incompatible destination" },
1235 { 0x59, "Non-existent abbreviated address entry" },
1236 { 0x5A, "Destination address missing, and direct call not subscribed" },
1237 /* Q.850 - "Non-existent CUG" */
1238 { 0x5B, "Invalid transit network selection (national use)" },
1239 { 0x5C, "Invalid facility parameter" },
1240 { 0x5D, "Mandatory information element is missing" },
1241 { 0x5F, "Invalid message, unspecified" },
1242 { Q931_CAUSE_MAND_IE_MISSING
, "Mandatory information element is missing" },
1243 { Q931_CAUSE_MT_NONEX_OR_UNIMPL
, "Message type non-existent or not implemented" },
1244 { 0x62, "Message not compatible with call state or message type non-existent or not implemented" },
1245 { Q931_CAUSE_IE_NONEX_OR_UNIMPL
, "Information element non-existent or not implemented" },
1246 { Q931_CAUSE_INVALID_IE_CONTENTS
, "Invalid information element contents" },
1247 { Q931_CAUSE_MSG_INCOMPAT_W_CS
, "Message not compatible with call state" },
1248 { Q931_CAUSE_REC_TIMER_EXP
, "Recovery on timer expiry" },
1249 { 0x67, "Parameter non-existent or not implemented - passed on" },
1250 { 0x6E, "Message with unrecognized parameter discarded" },
1251 { 0x6F, "Protocol error, unspecified" },
1252 { 0x7F, "Internetworking, unspecified" },
1255 value_string_ext q931_cause_code_vals_ext
= VALUE_STRING_EXT_INIT(q931_cause_code_vals
);
1257 static const value_string q931_cause_condition_vals
[] = {
1258 { 0x00, "Unknown" },
1259 { 0x01, "Permanent" },
1260 { 0x02, "Transient" },
1264 #define Q931_REJ_USER_SPECIFIC 0x00
1265 #define Q931_REJ_IE_MISSING 0x04
1266 #define Q931_REJ_IE_INSUFFICIENT 0x08
1268 static const value_string q931_rejection_reason_vals
[] = {
1269 { 0x00, "User specific" },
1270 { 0x04, "Information element missing" },
1271 { 0x08, "Information element contents are not sufficient" },
1275 static const char *get_message_name(uint8_t prot_discr
, uint8_t message_type
) {
1276 if (prot_discr
== NLPID_DMS
)
1277 return val_to_str(message_type
, dms_message_type_vals
, "Unknown (0x%02X)");
1279 return val_to_str_ext(message_type
, &q931_message_type_vals_ext
, "Unknown (0x%02X)");
1282 static const true_false_string tfs_abnormal_normal
= { "Abnormal", "Normal" };
1285 dissect_q931_cause_ie_with_info(tvbuff_t
*tvb
, int offset
, int len
,
1286 proto_tree
*tree
, int hf_cause_value
, uint8_t *cause_value
, const value_string
*ie_vals
,
1287 q931_packet_info
*q931_pi
)
1290 uint8_t coding_standard
;
1291 uint8_t rejection_reason
;
1295 octet
= tvb_get_uint8(tvb
, offset
);
1296 coding_standard
= octet
& 0x60;
1297 if (coding_standard
!= Q931_ITU_STANDARDIZED_CODING
&&
1298 !g931_iso_iec_cause
&& coding_standard
!= Q931_ISO_IEC_STANDARDIZED_CODING
) {
1300 * We don't know how the cause is encoded,
1301 * so just dump it as data and be done with it.
1303 proto_tree_add_uint(tree
, hf_q931_coding_standard
, tvb
, offset
, 1, octet
);
1304 proto_tree_add_item(tree
, hf_q931_cause_data
, tvb
, offset
, len
, ENC_NA
);
1307 proto_tree_add_uint(tree
, hf_q931_cause_location
, tvb
, offset
, 1, octet
);
1308 proto_tree_add_uint(tree
, hf_q931_coding_standard
, tvb
, offset
, 1, octet
);
1309 proto_tree_add_boolean(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, octet
);
1313 if (!(octet
& Q931_IE_VL_EXTENSION
)) {
1316 octet
= tvb_get_uint8(tvb
, offset
);
1317 proto_tree_add_item(tree
, hf_q931_cause_recommendation
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1318 proto_tree_add_boolean(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, octet
);
1325 octet
= tvb_get_uint8(tvb
, offset
);
1326 *cause_value
= octet
& 0x7F;
1328 /* add cause value to packet info for use in tap */
1330 q931_pi
->cause_value
= *cause_value
;
1333 proto_tree_add_uint(tree
, hf_cause_value
, tvb
, offset
, 1, *cause_value
);
1334 proto_tree_add_boolean(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, octet
);
1340 switch (*cause_value
) {
1341 case Q931_CAUSE_UNALLOC_NUMBER
:
1342 case Q931_CAUSE_NO_ROUTE_TO_DEST
:
1343 case Q931_CAUSE_QOS_UNAVAILABLE
:
1344 proto_tree_add_item(tree
, hf_q931_network_service
, tvb
, offset
, 1, ENC_NA
);
1345 proto_tree_add_item(tree
, hf_q931_extension_condition_type
, tvb
, offset
, 1, ENC_NA
);
1346 proto_tree_add_item(tree
, hf_q931_extension_condition
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1349 case Q931_CAUSE_CALL_REJECTED
:
1350 rejection_reason
= octet
& 0x7C;
1351 proto_tree_add_item(tree
, hf_q931_cause_call_rejection_reason
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1352 proto_tree_add_item(tree
, hf_q931_cause_call_condition
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1358 switch (rejection_reason
) {
1360 case Q931_REJ_USER_SPECIFIC
:
1361 proto_tree_add_item(tree
, hf_q931_cause_call_user_specific_diagnostic
, tvb
, offset
, len
, ENC_NA
);
1364 case Q931_REJ_IE_MISSING
:
1365 proto_tree_add_uint_format_value(tree
, hf_q931_missing_info_element
, tvb
, offset
, 1,
1366 tvb_get_uint8(tvb
, offset
), "%s", val_to_str(tvb_get_uint8(tvb
, offset
), ie_vals
,
1367 "Unknown (0x%02X)"));
1370 case Q931_REJ_IE_INSUFFICIENT
:
1371 proto_tree_add_uint_format_value(tree
, hf_q931_insufficient_info_element
, tvb
, offset
, 1,
1372 tvb_get_uint8(tvb
, offset
), "%s", val_to_str(tvb_get_uint8(tvb
, offset
), ie_vals
,
1373 "Unknown (0x%02X)"));
1377 proto_tree_add_item(tree
, hf_q931_cause_call_diagnostic
, tvb
, offset
, len
, ENC_NA
);
1382 case Q931_CAUSE_ACCESS_INFO_DISC
:
1383 case Q931_CAUSE_INCOMPATIBLE_DEST
:
1384 case Q931_CAUSE_MAND_IE_MISSING
:
1385 case Q931_CAUSE_IE_NONEX_OR_UNIMPL
:
1386 case Q931_CAUSE_INVALID_IE_CONTENTS
:
1388 proto_tree_add_uint_format_value(tree
, hf_q931_information_element
, tvb
, offset
, 1,
1389 tvb_get_uint8(tvb
, offset
), "%s", val_to_str(tvb_get_uint8(tvb
, offset
), ie_vals
,
1390 "Unknown (0x%02X)"));
1396 case Q931_CAUSE_MT_NONEX_OR_UNIMPL
:
1397 case Q931_CAUSE_MSG_INCOMPAT_W_CS
:
1398 proto_tree_add_item(tree
, hf_q931_cause_call_message_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1401 case Q931_CAUSE_REC_TIMER_EXP
:
1404 proto_tree_add_item(tree
, hf_q931_cause_call_rec_timer
, tvb
, offset
, 3, ENC_NA
|ENC_ASCII
);
1408 proto_tree_add_item(tree
, hf_q931_cause_call_diagnostic
, tvb
, offset
, len
, ENC_NA
);
1413 dissect_q931_cause_ie(tvbuff_t
*tvb
, int offset
, int len
,
1414 proto_tree
*tree
, int hf_cause_value
, uint8_t *cause_value
, const value_string
*ie_vals
)
1416 /* External dissectors have no use for "q931_packet_info". */
1417 dissect_q931_cause_ie_with_info(tvb
, offset
, len
, tree
, hf_cause_value
, cause_value
, ie_vals
, NULL
);
1421 * Dissect a Change status information element.
1424 static const value_string q931_status_preference_vals
[] = {
1425 { 0x01, "Channel" },
1429 static const value_string q931_new_status_vals
[] = {
1430 { 0x00, "In Service" },
1431 { 0x01, "Maintenance" },
1432 { 0x02, "Out of Service" },
1437 dissect_q931_change_status_ie(tvbuff_t
*tvb
, int offset
, int len _U_
, proto_tree
*tree
)
1442 proto_tree_add_item(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1443 proto_tree_add_item(tree
, hf_q931_extension_ind_preference
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1444 proto_tree_add_item(tree
, hf_q931_extension_ind_new_status
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1448 * Dissect a Call state information element.
1450 static const value_string q931_call_state_vals
[] = {
1452 { 0x01, "Call initiated" },
1453 { 0x02, "Overlap sending" },
1454 { 0x03, "Outgoing call proceeding" },
1455 { 0x04, "Call delivered" },
1456 { 0x06, "Call present" },
1457 { 0x07, "Call received" },
1458 { 0x08, "Connect request" },
1459 { 0x09, "Incoming call proceeding" },
1461 { 0x0B, "Disconnect request" },
1462 { 0x0C, "Disconnect indication" },
1463 { 0x0F, "Suspend request" },
1464 { 0x11, "Resume request" },
1465 { 0x13, "Release request" },
1466 { 0x16, "Call abort"},
1467 { 0x19, "Overlap receiving" },
1468 { 0x3D, "Restart request" },
1469 { 0x3E, "Restart" },
1472 value_string_ext q931_call_state_vals_ext
= VALUE_STRING_EXT_INIT(q931_call_state_vals
);
1475 dissect_q931_call_state_ie(tvbuff_t
*tvb
, int offset
, int len
,
1479 uint8_t coding_standard
;
1483 octet
= tvb_get_uint8(tvb
, offset
);
1484 coding_standard
= octet
& 0x60;
1485 proto_tree_add_uint(tree
, hf_q931_coding_standard
, tvb
, offset
, 1, octet
);
1486 if (coding_standard
!= Q931_ITU_STANDARDIZED_CODING
) {
1488 * We don't know how the call state is encoded,
1489 * so just dump it as data and be done with it.
1491 proto_tree_add_item(tree
, hf_q931_call_state_data
, tvb
, offset
, len
, ENC_NA
);
1494 proto_tree_add_item(tree
, hf_q931_call_state
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1498 * Dissect a Channel identification information element.
1500 #define Q931_INTERFACE_IDENTIFIED 0x40
1501 #define Q931_NOT_BASIC_CHANNEL 0x20
1503 static const value_string q931_basic_channel_selection_vals
[] = {
1504 { 0x00, "No channel" },
1505 { 0x01, "B1 channel" },
1506 { 0x02, "B2 channel" },
1507 { 0x03, "Any channel" },
1511 static const value_string q931_not_basic_channel_selection_vals
[] = {
1512 { 0x00, "No channel" },
1513 { 0x01, "Channel indicated in following octets" },
1514 { 0x03, "Any channel" },
1518 #define Q931_IS_SLOT_MAP 0x10
1520 static const value_string q931_element_type_vals
[] = {
1521 { 0x03, "B-channel units" },
1522 { 0x06, "H0-channel units" },
1523 { 0x08, "H11-channel units" },
1524 { 0x09, "H12-channel units" },
1529 dissect_q931_channel_identification_ie(tvbuff_t
*tvb
, int offset
, int len
,
1533 uint8_t coding_standard
;
1537 octet
= tvb_get_uint8(tvb
, offset
);
1539 proto_tree_add_item(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1540 proto_tree_add_item(tree
, hf_q931_channel_interface_explicit
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1541 proto_tree_add_item(tree
, hf_q931_channel_interface_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1542 proto_tree_add_item(tree
, hf_q931_channel_exclusive
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1543 proto_tree_add_item(tree
, hf_q931_channel_dchan
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1545 if (octet
& Q931_NOT_BASIC_CHANNEL
) {
1546 proto_tree_add_item(tree
, hf_q931_channel_selection_pri
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1548 proto_tree_add_item(tree
, hf_q931_channel_selection_bri
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1553 if (octet
& Q931_INTERFACE_IDENTIFIED
) {
1555 uint32_t identifier_val
= 0;
1556 int identifier_offset
= offset
;
1557 int identifier_len
= 0;
1561 octet2
= tvb_get_uint8(tvb
, offset
);
1565 identifier_val
<<= 7;
1566 identifier_val
|= octet2
& 0x7F;
1567 } while (!(octet2
& Q931_IE_VL_EXTENSION
));
1569 if (identifier_len
!= 0) {
1570 proto_tree_add_uint(tree
, hf_q931_channel_interface_id
, tvb
, identifier_offset
,
1571 identifier_len
, identifier_val
);
1575 if (octet
& Q931_NOT_BASIC_CHANNEL
) {
1578 octet
= tvb_get_uint8(tvb
, offset
);
1579 coding_standard
= octet
& 0x60;
1580 proto_tree_add_item(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1581 proto_tree_add_uint(tree
, hf_q931_coding_standard
, tvb
, offset
, 1, octet
);
1582 if (coding_standard
!= Q931_ITU_STANDARDIZED_CODING
) {
1584 * We don't know how the channel identifier is
1585 * encoded, so just dump it as data and be done
1588 proto_tree_add_item(tree
, hf_q931_channel_data
, tvb
, offset
, len
, ENC_NA
);
1591 proto_tree_add_item(tree
, hf_q931_channel_map
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1592 proto_tree_add_item(tree
, hf_q931_channel_element_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1597 if (octet
& Q931_IS_SLOT_MAP
) {
1599 proto_tree_add_item(tree
, hf_q931_channel_slot_map
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1608 octet2
= tvb_get_uint8(tvb
, offset
);
1610 proto_tree_add_item(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1611 proto_tree_add_item(tree
,hf_q931_channel_number
,tvb
,offset
,1,ENC_BIG_ENDIAN
);
1615 } while (!(octet2
& Q931_IE_VL_EXTENSION
));
1621 * Dissect a Progress indicator information element.
1623 static const value_string q931_progress_description_vals
[] = {
1624 { 0x01, "Call is not end-to-end ISDN - progress information available in-band" },
1625 { 0x02, "Destination address is non-ISDN" },
1626 { 0x03, "Origination address is non-ISDN" },
1627 { 0x04, "Call has returned to the ISDN" },
1628 { 0x05, "Interworking has occurred and has resulted in a telecommunications service change" },
1629 { 0x08, "In-band information or an appropriate pattern is now available" },
1632 value_string_ext q931_progress_description_vals_ext
= VALUE_STRING_EXT_INIT(q931_progress_description_vals
);
1635 dissect_q931_progress_indicator_ie(tvbuff_t
*tvb
, int offset
, int len
,
1639 uint8_t coding_standard
;
1643 octet
= tvb_get_uint8(tvb
, offset
);
1644 coding_standard
= octet
& 0x60;
1645 proto_tree_add_uint(tree
, hf_q931_coding_standard
, tvb
, offset
, 1, octet
);
1646 if (coding_standard
!= Q931_ITU_STANDARDIZED_CODING
) {
1648 * We don't know how the progress indicator is encoded,
1649 * so just dump it as data and be done with it.
1651 proto_tree_add_item(tree
, hf_q931_progress_indicator_data
, tvb
, offset
, len
, ENC_NA
);
1654 proto_tree_add_item(tree
, hf_q931_progress_indicator_location
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1661 proto_tree_add_item(tree
, hf_q931_progress_indicator_description
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1665 * Dissect a Network-specific facilities or Transit network selection
1666 * information element.
1668 static const value_string q931_netid_type_vals
[] = {
1669 { 0x0, "User specified" },
1670 { 0x2, "National network identification" },
1671 { 0x3, "International network identification" },
1675 static const value_string q931_netid_plan_vals
[] = {
1676 { 0x00, "Unknown" },
1677 { 0x01, "Carrier Identification Code" },
1678 { 0x03, "X.121 data network identification code" },
1683 dissect_q931_ns_facilities_ie(tvbuff_t
*tvb
, int offset
, int len
,
1691 octet
= tvb_get_uint8(tvb
, offset
);
1692 netid_len
= octet
& 0x7F;
1693 proto_tree_add_item(tree
, hf_q931_netid_length
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1696 if (netid_len
!= 0) {
1699 proto_tree_add_item(tree
, hf_q931_netid_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1700 proto_tree_add_item(tree
, hf_q931_netid_plan
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1707 if (netid_len
> len
)
1709 if (netid_len
!= 0) {
1710 proto_tree_add_item(tree
, hf_q931_netid
, tvb
, offset
, netid_len
, ENC_NA
|ENC_ASCII
);
1711 offset
+= netid_len
;
1717 * Whatever is left is the network-specific facility
1722 proto_tree_add_item(tree
, hf_q931_netid_facility_specification
, tvb
, offset
, len
, ENC_NA
);
1726 * Dissect a Notification indicator information element.
1728 static const value_string q931_notification_description_vals
[] = {
1729 { 0x00, "User suspended" },
1730 { 0x01, "User resumed" },
1731 { 0x02, "Bearer service change" },
1736 dissect_q931_notification_indicator_ie(tvbuff_t
*tvb
, int offset
, int len
,
1742 proto_tree_add_item(tree
, hf_q931_notification_description
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1746 * Dissect a Date/time information element.
1749 dissect_q931_date_time_ie(tvbuff_t
*tvb
, packet_info
* pinfo
, int offset
, int len
,
1754 * XXX - what is "year" relative to? Is "month" 0-origin or
1755 * 1-origin? Q.931 doesn't say....
1757 proto_tree_add_bytes_format_value(tree
, hf_q931_date_time
, tvb
, offset
, 6, NULL
, "%02u-%02u-%02u %02u:%02u:%02u",
1758 tvb_get_uint8(tvb
, offset
+ 0), tvb_get_uint8(tvb
, offset
+ 1), tvb_get_uint8(tvb
, offset
+ 2),
1759 tvb_get_uint8(tvb
, offset
+ 3), tvb_get_uint8(tvb
, offset
+ 4), tvb_get_uint8(tvb
, offset
+ 5));
1760 } else if (len
== 5) {
1761 proto_tree_add_bytes_format_value(tree
, hf_q931_date_time
, tvb
, offset
, 5, NULL
, "%02u-%02u-%02u %02u:%02u:00",
1762 tvb_get_uint8(tvb
, offset
+ 0), tvb_get_uint8(tvb
, offset
+ 1), tvb_get_uint8(tvb
, offset
+ 2),
1763 tvb_get_uint8(tvb
, offset
+ 3), tvb_get_uint8(tvb
, offset
+ 4));
1765 proto_tree_add_expert_format(tree
, pinfo
, &ei_q931_date_time
, tvb
, offset
, len
, "Date/time: length is %d, should be 5 or 6", len
);
1770 * Dissect a Signal information element.
1772 static const value_string q931_signal_vals
[] = {
1773 { 0x00, "Dial tone on" },
1774 { 0x01, "Ring tone on" },
1775 { 0x02, "Intercept tone on" },
1776 { 0x03, "Network congestion tone on" }, /* "fast busy" */
1777 { 0x04, "Busy tone on" },
1778 { 0x05, "Confirm tone on" },
1779 { 0x06, "Answer tone on" },
1780 { 0x07, "Call waiting tone on" },
1781 { 0x08, "Off-hook warning tone on" },
1782 { 0x09, "Preemption tone on" },
1783 { 0x3F, "Tones off" },
1784 { 0x40, "Alerting on - pattern 0" },
1785 { 0x41, "Alerting on - pattern 1" },
1786 { 0x42, "Alerting on - pattern 2" },
1787 { 0x43, "Alerting on - pattern 3" },
1788 { 0x44, "Alerting on - pattern 4" },
1789 { 0x45, "Alerting on - pattern 5" },
1790 { 0x46, "Alerting on - pattern 6" },
1791 { 0x47, "Alerting on - pattern 7" },
1792 { 0x4F, "Alerting off" },
1795 static value_string_ext q931_signal_vals_ext
= VALUE_STRING_EXT_INIT(q931_signal_vals
);
1798 dissect_q931_signal_ie(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, int len
,
1799 proto_tree
*tree
, proto_item
* item
)
1802 expert_add_info_format(pinfo
, item
, &ei_q931_invalid_length
,
1803 "Signal: length is %d, should be 1", len
);
1806 proto_tree_add_item(tree
, hf_q931_signal
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1810 * Dissect an Information rate information element.
1812 static const value_string q931_throughput_class_vals
[] = {
1813 { 0x03, "75 bit/s" },
1814 { 0x04, "150 bit/s" },
1815 { 0x05, "300 bit/s" },
1816 { 0x06, "600 bit/s" },
1817 { 0x07, "1200 bit/s" },
1818 { 0x08, "2400 bit/s" },
1819 { 0x09, "4800 bit/s" },
1820 { 0x0A, "9600 bit/s" },
1821 { 0x0B, "19200 bit/s" },
1822 { 0x0C, "48000 bit/s" },
1823 { 0x0D, "64000 bit/s" },
1826 static value_string_ext q931_throughput_class_vals_ext
= VALUE_STRING_EXT_INIT(q931_throughput_class_vals
);
1829 dissect_q931_information_rate_ie(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, int len
,
1830 proto_tree
*tree
, proto_item
* item
)
1833 expert_add_info_format(pinfo
, item
, &ei_q931_invalid_length
,
1834 "Information rate: length is %d, should be 4", len
);
1837 proto_tree_add_item(tree
, hf_q931_information_rate_incoming
, tvb
, offset
+ 0, 1, ENC_BIG_ENDIAN
);
1838 proto_tree_add_item(tree
, hf_q931_information_rate_outgoing
, tvb
, offset
+ 1, 1, ENC_BIG_ENDIAN
);
1839 proto_tree_add_item(tree
, hf_q931_information_rate_minimum_incoming
, tvb
, offset
+ 2, 1, ENC_BIG_ENDIAN
);
1840 proto_tree_add_item(tree
, hf_q931_information_rate_minimum_outgoing
, tvb
, offset
+ 3, 1, ENC_BIG_ENDIAN
);
1844 dissect_q931_uint16_value(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, int len
,
1845 proto_tree
*tree
, proto_item
* item
, int hf_value
)
1853 octet
= tvb_get_uint8(tvb
, offset
);
1854 if (octet
& Q931_IE_VL_EXTENSION
) {
1856 * Only one octet long - error.
1860 value
= (octet
& 0x3) << 14;
1867 * We've reached the end of the information element - error.
1871 octet
= tvb_get_uint8(tvb
, offset
);
1872 if (octet
& Q931_IE_VL_EXTENSION
) {
1874 * Only two octets long - error.
1878 value
|= (octet
& 0x7F) << 7;
1885 * We've reached the end of the information element - error.
1889 octet
= tvb_get_uint8(tvb
, offset
);
1890 if (!(octet
& Q931_IE_VL_EXTENSION
)) {
1892 * More than three octets long - error.
1896 value
|= (octet
& 0x7F);
1901 proto_tree_add_uint(tree
, hf_value
, tvb
, offset
, value_len
, value
);
1905 expert_add_info_format(pinfo
, item
, &ei_q931_invalid_length
,
1906 "%s goes past end of information element", proto_registrar_get_name(hf_value
));
1910 expert_add_info_format(pinfo
, item
, &ei_q931_invalid_length
, "%s isn't 3 octets long",
1911 proto_registrar_get_name(hf_value
));
1916 * Dissect an End-to-end transit delay information element.
1919 dissect_q931_e2e_transit_delay_ie(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, int len
,
1920 proto_tree
*tree
, proto_item
* item
)
1926 value_len
= dissect_q931_uint16_value(tvb
, pinfo
, offset
, len
, tree
, item
, hf_q931_cumulative_transit_delay
);
1929 offset
+= value_len
;
1934 value_len
= dissect_q931_uint16_value(tvb
, pinfo
, offset
, len
, tree
, item
, hf_q931_requested_end_to_end_transit_delay
);
1937 offset
+= value_len
;
1942 dissect_q931_uint16_value(tvb
, pinfo
, offset
, len
, tree
, item
, hf_q931_maximum_end_to_end_transit_delay
);
1946 * Dissect a Transit delay selection and indication information element.
1949 dissect_q931_td_selection_and_int_ie(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, int len
,
1950 proto_tree
*tree
, proto_item
* item
)
1954 dissect_q931_uint16_value(tvb
, pinfo
, offset
, len
, tree
, item
, hf_q931_transit_delay
);
1958 * Dissect a Packet layer binary parameters information element.
1960 static const value_string q931_fast_selected_vals
[] = {
1961 { 0x0, "Fast select not requested" },
1962 { 0x1, "Fast select not requested" },
1963 { 0x2, "Fast select requested with no restriction of response" },
1964 { 0x3, "Fast select requested with restrictions of response" },
1968 static const true_false_string tfs_link_end
= { "Link-by-link", "End-to-end" };
1969 static const true_false_string tfs_pl_request
= { "No request/request denied", "Request indicated/request accepted" };
1970 static const true_false_string tfs_pl_modulus
= { "8 sequencing", "128 sequencing" };
1973 dissect_q931_pl_binary_parameters_ie(tvbuff_t
*tvb
, int offset
, int len
,
1976 static int * const fields
[] = {
1977 &hf_q931_fast_select
,
1978 &hf_q931_pl_request
,
1979 &hf_q931_pl_binary_confirmation
,
1980 &hf_q931_pl_modulus
,
1987 proto_tree_add_bitmask_list(tree
, tvb
, offset
, 1, fields
, ENC_NA
);
1991 * Dissect a Packet layer window size information element.
1994 dissect_q931_pl_window_size_ie(tvbuff_t
*tvb
, int offset
, int len
,
1999 proto_tree_add_item(tree
, hf_q931_pl_window_size_forward_value
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2005 proto_tree_add_item(tree
, hf_q931_pl_window_size_backward_value
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2009 * Dissect a Packet size information element.
2012 dissect_q931_packet_size_ie(tvbuff_t
*tvb
, int offset
, int len
,
2017 proto_tree_add_item(tree
, hf_q931_packet_size_forward_value
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2023 proto_tree_add_item(tree
, hf_q931_packet_size_backward_value
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2027 * Dissect a Closed user group information element.
2029 static const value_string q931_cug_indication_vals
[] = {
2030 { 0x01, "Closed user group selection" },
2031 { 0x02, "Closed user group with outgoing access selection and indication" },
2036 dissect_q931_cug_ie(tvbuff_t
*tvb
, int offset
, int len
, proto_tree
*tree
)
2040 proto_tree_add_item(tree
, hf_q931_cug_indication
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2046 proto_tree_add_item(tree
, hf_q931_cug_index_code
, tvb
, offset
, len
, ENC_NA
|ENC_ASCII
);
2050 * Dissect a Reverse charging indication information element.
2052 static const value_string q931_reverse_charging_indication_vals
[] = {
2053 { 0x01, "Reverse charging requested" },
2058 dissect_q931_reverse_charge_ind_ie(tvbuff_t
*tvb
, int offset
, int len
,
2063 proto_tree_add_item(tree
, hf_q931_reverse_charging_ind
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2067 * Dissect a (phone) number information element.
2069 static const value_string q931_number_type_vals
[] = {
2071 { 0x1, "International number" },
2072 { 0x2, "National number" },
2073 { 0x3, "Network specific number" },
2074 { 0x4, "Subscriber number" },
2075 { 0x6, "Abbreviated number" },
2079 static const value_string q931_numbering_plan_vals
[] = {
2080 { 0x00, "Unknown" },
2081 { 0x01, "E.164 ISDN/telephony numbering" },
2082 { 0x03, "X.121 data numbering" },
2083 { 0x04, "F.69 Telex numbering" },
2084 { 0x08, "National standard numbering" },
2085 { 0x09, "Private numbering" },
2089 static const value_string q931_presentation_indicator_vals
[] = {
2090 { 0x00, "Presentation allowed" },
2091 { 0x01, "Presentation restricted" },
2092 { 0x02, "Number not available due to interworking" },
2096 static const value_string q931_screening_indicator_vals
[] = {
2097 { 0x00, "User-provided, not screened" },
2098 { 0x01, "User-provided, verified and passed" },
2099 { 0x02, "User-provided, verified and failed" },
2100 { 0x03, "Network-provided" },
2104 static const value_string q931_redirection_reason_vals
[] = {
2105 { 0x00, "Unknown" },
2106 { 0x01, "Call forwarding busy or called DTE busy" },
2107 { 0x02, "Call forwarding no reply" },
2108 { 0x04, "Call deflection" },
2109 { 0x09, "Called DTE out of order" },
2110 { 0x0A, "Call forwarding by the called DTE" },
2111 { 0x0F, "Call forwarding unconditional or systematic call redirection" },
2116 dissect_q931_number_ie(packet_info
*pinfo
, tvbuff_t
*tvb
, int offset
, int len
,
2117 proto_tree
*tree
, int hfindex
, e164_info_t e164_info
, q931_packet_info
*q931_pi
)
2124 octet
= tvb_get_uint8(tvb
, offset
);
2125 number_plan
= octet
& 0x0f;
2126 e164_info
.nature_of_address
= ( octet
& 0x70 ) >> 4;
2127 proto_tree_add_uint(tree
, hf_q931_numbering_plan
, tvb
, offset
, 1, octet
);
2128 proto_tree_add_uint(tree
, hf_q931_number_type
, tvb
, offset
, 1, octet
);
2129 proto_tree_add_boolean(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, octet
);
2134 if (!(octet
& Q931_IE_VL_EXTENSION
)) {
2137 octet
= tvb_get_uint8(tvb
, offset
);
2138 proto_tree_add_uint(tree
, hf_q931_screening_ind
, tvb
, offset
, 1, octet
);
2139 proto_tree_add_uint(tree
, hf_q931_presentation_ind
, tvb
, offset
, 1, octet
);
2140 proto_tree_add_boolean(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, octet
);
2146 * XXX - only in a Redirecting number information element.
2148 if (!(octet
& Q931_IE_VL_EXTENSION
)) {
2151 proto_tree_add_item(tree
, hf_q931_extension_reason
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2158 proto_tree_add_item(tree
, hfindex
, tvb
, offset
, len
, ENC_ASCII
|ENC_NA
);
2159 proto_item_append_text(proto_tree_get_parent(tree
), ": '%s'", tvb_format_text(pinfo
->pool
, tvb
, offset
, len
));
2161 if ( number_plan
== 1 ) {
2162 if ( e164_info
.e164_number_type
!= NONE
){
2164 e164_info
.E164_number_str
= tvb_get_string_enc(pinfo
->pool
, tvb
, offset
, len
, ENC_ASCII
|ENC_NA
);
2165 e164_info
.E164_number_length
= len
;
2166 dissect_e164_number(tvb
, tree
, offset
, len
, e164_info
);
2170 /* Collect q931_packet_info */
2171 if ( e164_info
.e164_number_type
== CALLING_PARTY_NUMBER
&& q931_pi
)
2172 q931_pi
->calling_number
= tvb_get_string_enc(pinfo
->pool
, tvb
, offset
, len
, ENC_ASCII
|ENC_NA
);
2173 if ( e164_info
.e164_number_type
== CALLED_PARTY_NUMBER
&& q931_pi
)
2174 q931_pi
->called_number
= tvb_get_string_enc(pinfo
->pool
, tvb
, offset
, len
, ENC_ASCII
|ENC_NA
);
2178 * Dissect a party subaddress information element.
2180 static const value_string q931_subaddress_type_vals
[] = {
2181 { 0x0, "X.213/ISO 8348 Add.2 NSAP" },
2182 { 0x2, "User-specified" },
2186 static const value_string q931_odd_even_indicator_vals
[] = {
2187 { 0x0, "Even number of address signals" },
2188 { 0x1, "Odd number of address signals" },
2193 dissect_q931_party_subaddr_ie(tvbuff_t
*tvb
, int offset
, int len
,
2199 proto_tree_add_item(tree
, hf_q931_party_subaddr_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2200 proto_tree_add_item(tree
, hf_q931_party_subaddr_odd_even_indicator
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2206 proto_tree_add_item(tree
, hf_q931_party_subaddr
, tvb
, offset
, len
, ENC_NA
);
2210 * Dissect a Restart indicator information element.
2212 static const value_string q931_restart_indicator_class_vals
[] = {
2213 { 0x00, "Indicated channels" },
2214 { 0x06, "Single interface" },
2215 { 0x07, "All interfaces" },
2220 dissect_q931_restart_indicator_ie(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, int len
,
2221 proto_tree
*tree
, proto_item
* item
)
2224 expert_add_info_format(pinfo
, item
, &ei_q931_invalid_length
,
2225 "Restart indicator: length is %d, should be 1", len
);
2228 proto_tree_add_item(tree
, hf_q931_restart_indicator
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2232 * Dissect a High-layer compatibility information element.
2234 #define Q931_MAINTENANCE 0x5e
2235 #define Q931_MANAGEMENT 0x5f
2236 #define Q931_AUDIOVISUAL 0x60
2237 static const value_string q931_high_layer_characteristics_vals
[] = {
2238 { 0x01, "Telephony" },
2239 { 0x04, "F.182 Facsimile Group 2/3" },
2240 { 0x21, "F.184 Facsimile Group 4 Class I" },
2241 { 0x24, "F.230 Teletex, basic and mixed mode, and F.184 Facsimile Group 4, Classes II and III" },
2242 { 0x28, "F.220 Teletex, basic and processable mode" },
2243 { 0x31, "F.200 Teletex, basic mode" },
2244 { 0x32, "F.300 and T.102 syntax-based Videotex" },
2245 { 0x33, "F.300 and T.101 international Videotex interworking" },
2246 { 0x35, "F.60 Telex" },
2247 { 0x38, "X.400 Message Handling Systems" },
2248 { 0x41, "X.200 OSI application" },
2249 { 0x42, "FTAM application" },
2250 { 0x5E, "Reserved for maintenance" },
2251 { 0x5F, "Reserved for management" },
2252 { Q931_AUDIOVISUAL
, "F.720/F.821 and F.731 Profile 1a videotelephony" },
2253 { 0x61, "F.702 and F.731 Profile 1b videoconferencing" },
2254 { 0x62, "F.702 and F.731 audiographic conferencing" },
2255 { 0x68, "F.700-series Multimedia services" },
2258 static value_string_ext q931_high_layer_characteristics_vals_ext
= VALUE_STRING_EXT_INIT(q931_high_layer_characteristics_vals
);
2260 static const value_string q931_extended_high_layer_characteristics_vals
[] = {
2261 { 0x01, "Telephony" },
2262 { 0x04, "F.182 Facsimile Group 2/3" },
2263 { 0x21, "F.184 Facsimile Group 4 Class I" },
2264 { 0x24, "F.230 Teletex, basic and mixed mode, and F.184 Facsimile Group 4, Classes II and III" },
2265 { 0x28, "F.220 Teletex, basic and processable mode" },
2266 { 0x31, "F.200 Teletex, basic mode" },
2267 { 0x32, "F.300 and T.102 syntax-based Videotex" },
2268 { 0x33, "F.300 and T.101 international Videotex interworking" },
2269 { 0x35, "F.60 Telex" },
2270 { 0x38, "X.400 Message Handling Systems" },
2271 { 0x41, "X.200 OSI application" },
2272 { 0x42, "FTAM application" },
2273 { 0x5E, "Not available for assignment" },
2274 { 0x5F, "Not available for assignment" },
2275 { Q931_AUDIOVISUAL
, "F.720/F.821 and F.731 Profile 1a videotelephony" },
2276 { 0x61, "F.702 and F.731 Profile 1b videoconferencing" },
2277 { 0x62, "F.702 and F.731 audiographic conferencing" },
2278 { 0x68, "F.700-series Multimedia services" },
2281 static value_string_ext q931_extended_high_layer_characteristics_vals_ext
= VALUE_STRING_EXT_INIT(q931_extended_high_layer_characteristics_vals
);
2283 static const value_string q931_audiovisual_characteristics_vals
[] = {
2284 { 0x01, "Capability set of initial channel of H.221" },
2285 { 0x02, "Capability set of subsequent channel of H.221" },
2286 { 0x21, "Capability set of initial channel of an active 3.1kHz audio or speech call" },
2290 static const value_string q931_interpretation_vals
[] = {
2291 { 0x04, "First (primary or only) high layer characteristics identification to be used in the call" },
2295 static const value_string q931_pres_meth_prot_prof_vals
[] = {
2296 { 0x01, "High layer protocol profile (without specification of attributes)" },
2301 * High layer protocol profile
2303 #define Q931_HIGH_LAYER_PROTOCOL_PROFILE 0x01
2306 dissect_q931_high_layer_compat_ie(tvbuff_t
*tvb
, int offset
, int len
,
2310 uint8_t coding_standard
;
2311 uint8_t pres_method
;
2312 uint8_t characteristics
;
2316 octet
= tvb_get_uint8(tvb
, offset
);
2317 coding_standard
= octet
& 0x60;
2318 pres_method
= octet
& 0x03;
2320 proto_tree_add_item(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2321 proto_tree_add_uint(tree
, hf_q931_coding_standard
, tvb
, offset
, 1, octet
);
2322 proto_tree_add_uint(tree
, hf_q931_interpretation
, tvb
, offset
, 1, octet
);
2323 proto_tree_add_uint(tree
, hf_q931_pres_meth_prot_prof
, tvb
, offset
, 1, octet
);
2327 if ((coding_standard
!= Q931_ITU_STANDARDIZED_CODING
) || (pres_method
!= Q931_HIGH_LAYER_PROTOCOL_PROFILE
)) {
2329 * We don't know how the call state is encoded,
2330 * so just dump it as data and be done with it.
2332 proto_tree_add_item(tree
, hf_q931_high_layer_compat_data
, tvb
, offset
, len
, ENC_NA
);
2338 octet
= tvb_get_uint8(tvb
, offset
);
2339 characteristics
= octet
& 0x7F;
2341 proto_tree_add_item(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2342 proto_tree_add_uint(tree
, hf_q931_high_layer_characteristics
, tvb
, offset
, 1, octet
);
2347 if (!(octet
& Q931_IE_VL_EXTENSION
)) {
2350 octet
= tvb_get_uint8(tvb
, offset
);
2351 if ((characteristics
== Q931_AUDIOVISUAL
) || (characteristics
== 0x61) || (characteristics
== 0x62) ||
2352 (characteristics
== 0x68)) {
2353 proto_tree_add_item(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2354 proto_tree_add_uint(tree
, hf_q931_extended_audiovisual_characteristics
, tvb
, offset
, 1, octet
);
2356 else if ((characteristics
== Q931_MANAGEMENT
) || (characteristics
== Q931_MAINTENANCE
)) {
2357 proto_tree_add_item(tree
, hf_q931_extension_ind
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2358 proto_tree_add_uint(tree
, hf_q931_extended_high_layer_characteristics
, tvb
, offset
, 1, octet
);
2365 * Dissect a User-user information element.
2367 #define Q931_PROTOCOL_DISCRIMINATOR_USER 0x00
2368 #define Q931_PROTOCOL_DISCRIMINATOR_IA5 0x04
2369 #define Q931_PROTOCOL_DISCRIMINATOR_ASN1 0x05
2371 static const value_string q931_protocol_discriminator_vals
[] = {
2372 { Q931_PROTOCOL_DISCRIMINATOR_USER
, "User-specific protocol" },
2373 { 0x01, "OSI high layer protocols" },
2375 { 0x03, "Reserved for system management convergence function" },
2376 { Q931_PROTOCOL_DISCRIMINATOR_IA5
, "IA5 characters" },
2377 { Q931_PROTOCOL_DISCRIMINATOR_ASN1
, "X.208 and X.209 coded user information" },
2378 { 0x06, "Undefined" },
2379 { 0x07, "V.120 rate adaption" },
2380 { 0x08, "Q.931/I.451 user-network call control messages" },
2383 value_string_ext q931_protocol_discriminator_vals_ext
= VALUE_STRING_EXT_INIT(q931_protocol_discriminator_vals
);
2386 dissect_q931_user_user_ie(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, int len
,
2390 tvbuff_t
*next_tvb
= NULL
;
2391 heur_dtbl_entry_t
*hdtbl_entry
;
2395 octet
= tvb_get_uint8(tvb
, offset
);
2396 proto_tree_add_item(tree
, hf_q931_user_protocol_discriminator
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2404 case Q931_PROTOCOL_DISCRIMINATOR_USER
:
2405 next_tvb
= tvb_new_subset_length(tvb
, offset
, len
);
2406 proto_tree_add_uint_format_value(tree
, hf_q931_user_information_len
, tvb
, offset
, len
, len
, "%d octets", len
);
2407 if (!dissector_try_heuristic(q931_user_heur_subdissector_list
, next_tvb
, pinfo
, tree
, &hdtbl_entry
, NULL
)) {
2408 call_data_dissector(next_tvb
, pinfo
, tree
);
2412 case Q931_PROTOCOL_DISCRIMINATOR_IA5
:
2413 proto_tree_add_item(tree
, hf_q931_user_information_str
, tvb
, offset
, len
, ENC_NA
|ENC_ASCII
);
2417 proto_tree_add_item(tree
, hf_q931_user_information_bytes
, tvb
, offset
, len
, ENC_NA
);
2422 static const value_string q931_party_category_vals
[] = {
2423 { 0x00, "Unknown" },
2424 { 0x01, "Extension" },
2425 { 0x02, "Operator" },
2426 { 0x03, "Emergency extension" },
2431 dissect_q931_party_category_ie(tvbuff_t
*tvb
, int offset
, int len
,
2437 proto_tree_add_item(tree
, hf_q931_party_category
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2447 * Dissect information elements consisting of ASCII^H^H^H^H^HIA5 text.
2450 dissect_q931_ia5_ie(tvbuff_t
*tvb
, int offset
, int len
, packet_info
*pinfo
, proto_tree
*tree
,
2454 proto_tree_add_item(tree
, hf_value
, tvb
, offset
, len
, ENC_ASCII
|ENC_NA
);
2455 proto_item_append_text(proto_tree_get_parent(tree
), " '%s'", tvb_format_text(pinfo
->pool
, tvb
, offset
, len
));
2460 dissect_q931_pdu(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
2464 proto_tree
*q931_tree
= NULL
;
2465 proto_tree
*ie_tree
= NULL
;
2468 uint8_t call_ref_len
;
2469 uint8_t call_ref
[16];
2470 uint32_t call_ref_val
;
2471 uint8_t message_type
, segmented_message_type
;
2472 uint8_t info_element
;
2473 uint16_t info_element_len
;
2474 bool first_frag
, more_frags
;
2476 fragment_head
*fd_head
;
2477 tvbuff_t
*next_tvb
= NULL
;
2478 q931_packet_info
*q931_pi
= NULL
;
2480 q931_pi
=wmem_new(pinfo
->pool
, q931_packet_info
);
2482 /* Init struct for collecting q931_packet_info */
2483 reset_q931_packet_info(q931_pi
);
2485 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Q.931");
2487 prot_discr
= tvb_get_uint8(tvb
, offset
);
2488 ti
= proto_tree_add_item(tree
, proto_q931
, tvb
, offset
, -1, ENC_NA
);
2490 q931_tree
= proto_item_add_subtree(ti
, ett_q931
);
2492 dissect_q931_protocol_discriminator(tvb
, offset
, q931_tree
);
2495 call_ref_len
= tvb_get_uint8(tvb
, offset
) & 0xF; /* XXX - do as a bit field? */
2496 if (q931_tree
!= NULL
)
2497 proto_tree_add_uint(q931_tree
, hf_q931_call_ref_len
, tvb
, offset
, 1, call_ref_len
);
2499 switch (call_ref_len
) {
2500 case 0: call_ref_val
= 0; break;
2501 case 1: call_ref_val
= tvb_get_uint8(tvb
, offset
); break;
2502 case 2: call_ref_val
= tvb_get_ntohs(tvb
, offset
); break;
2503 case 3: call_ref_val
= tvb_get_ntoh24(tvb
, offset
); break;
2504 default: call_ref_val
= tvb_get_ntohl(tvb
, offset
);
2506 if (call_ref_len
!= 0) {
2507 tvb_memcpy(tvb
, call_ref
, offset
, call_ref_len
);
2508 if (q931_tree
!= NULL
) {
2509 proto_tree_add_boolean(q931_tree
, hf_q931_call_ref_flag
,
2510 tvb
, offset
, 1, (call_ref
[0] & 0x80) != 0);
2511 call_ref
[0] &= 0x7F;
2512 proto_tree_add_bytes(q931_tree
, hf_q931_call_ref
,
2513 tvb
, offset
, call_ref_len
, call_ref
);
2515 { /* info for the tap */
2516 call_ref
[0] &= 0x7F;
2518 /* XXX - Should crv be something besides a uint32_t? */
2519 memcpy(&(q931_pi
->crv
), call_ref
, call_ref_len
> sizeof(q931_pi
->crv
) ? sizeof(q931_pi
->crv
) : call_ref_len
);
2520 offset
+= call_ref_len
;
2522 message_type
= tvb_get_uint8(tvb
, offset
);
2523 q931_pi
->message_type
= message_type
;
2524 col_add_str(pinfo
->cinfo
, COL_INFO
, get_message_name(prot_discr
, message_type
));
2526 if (prot_discr
== NLPID_DMS
)
2527 proto_tree_add_item(q931_tree
, hf_q931_maintenance_message_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2529 proto_tree_add_item(q931_tree
, hf_q931_message_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2534 * And now for the information elements....
2536 if ((message_type
!= Q931_SEGMENT
) || !q931_reassembly
||
2537 (tvb_reported_length_remaining(tvb
, offset
) <= 4)) {
2538 dissect_q931_IEs(tvb
, pinfo
, tree
, q931_tree
, is_over_ip
, offset
, 0, q931_pi
);
2541 info_element
= tvb_get_uint8(tvb
, offset
);
2542 info_element_len
= tvb_get_uint8(tvb
, offset
+ 1);
2543 if ((info_element
!= Q931_IE_SEGMENTED_MESSAGE
) || (info_element_len
< 2)) {
2544 dissect_q931_IEs(tvb
, pinfo
, tree
, q931_tree
, is_over_ip
, offset
, 0, q931_pi
);
2547 /* Segmented message IE */
2548 ie_tree
= proto_tree_add_subtree(q931_tree
, tvb
, offset
, 1+1+info_element_len
, ett_q931_ie
[info_element
], NULL
,
2549 val_to_str(info_element
, q931_info_element_vals
[0], "Unknown information element (0x%02X)"));
2550 proto_tree_add_uint_format_value(ie_tree
, hf_q931_information_element
, tvb
, offset
, 1, info_element
,
2551 "%s", val_to_str(info_element
, q931_info_element_vals
[0], "Unknown (0x%02X)"));
2552 proto_tree_add_item(ie_tree
, hf_q931_information_element_len
, tvb
, offset
+ 1, 1, ENC_NA
);
2553 dissect_q931_segmented_message_ie(tvb
, pinfo
, offset
+ 2, info_element_len
, ie_tree
, ti
);
2554 first_frag
= (tvb_get_uint8(tvb
, offset
+ 2) & 0x80) != 0;
2555 more_frags
= (tvb_get_uint8(tvb
, offset
+ 2) & 0x7F) != 0;
2556 segmented_message_type
= tvb_get_uint8(tvb
, offset
+ 3);
2557 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " of %s",
2558 val_to_str_ext(segmented_message_type
, &q931_message_type_vals_ext
, "Unknown message type (0x%02X)"));
2560 offset
+= 1 + 1 + info_element_len
;
2562 frag_len
= tvb_reported_length_remaining(tvb
, offset
);
2563 if (first_frag
&& fragment_get(&q931_reassembly_table
, pinfo
, call_ref_val
, NULL
)) {
2564 /* there are some unreassembled segments, ignore them */
2565 fragment_end_seq_next(&q931_reassembly_table
, pinfo
, call_ref_val
, NULL
);
2567 fd_head
= fragment_add_seq_next(&q931_reassembly_table
,
2568 tvb
, offset
, pinfo
, call_ref_val
, NULL
,
2569 frag_len
, more_frags
);
2571 if (pinfo
->num
== fd_head
->reassembled_in
) { /* last fragment */
2572 if (fd_head
->next
!= NULL
) { /* 2 or more segments */
2573 next_tvb
= tvb_new_chain(tvb
, fd_head
->tvb_data
);
2574 add_new_data_source(pinfo
, next_tvb
, "Reassembled Q.931 IEs");
2575 /* Show all fragments. */
2577 proto_item
*frag_tree_item
;
2578 show_fragment_seq_tree(fd_head
, &q931_frag_items
, q931_tree
, pinfo
, next_tvb
, &frag_tree_item
);
2580 } else { /* only 1 segment */
2581 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
2584 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "%s [reassembled]",
2585 val_to_str_ext(segmented_message_type
, &q931_message_type_vals_ext
, "Unknown message type (0x%02X)"));
2588 if (tree
) proto_tree_add_uint(q931_tree
, hf_q931_reassembled_in
, tvb
, offset
, frag_len
, fd_head
->reassembled_in
);
2592 dissect_q931_IEs(next_tvb
, pinfo
, tree
, q931_tree
, is_over_ip
, 0, 0, q931_pi
);
2595 static const value_string q931_codeset_vals
[] = {
2596 { 0x00, "Q.931 information elements" },
2597 { 0x04, "Information elements for ISO/IEC use" },
2598 { 0x05, "Information elements for national use" },
2599 { 0x06, "Information elements specific to the local network" },
2600 { 0x07, "User-specific information elements" },
2605 dissect_q931_IEs(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*root_tree
,
2606 proto_tree
*q931_tree
, bool is_over_ip
, int offset
, int initial_codeset
,
2607 q931_packet_info
*q931_pi
)
2610 proto_tree
*ie_tree
= NULL
;
2611 uint8_t info_element
;
2613 uint16_t info_element_len
;
2614 int codeset
, locked_codeset
;
2615 bool non_locking_shift
, first_segment
;
2616 tvbuff_t
*h225_tvb
, *next_tvb
;
2617 e164_info_t e164_info
;
2618 e164_info
.e164_number_type
= NONE
;
2619 e164_info
.nature_of_address
= NONE
;
2620 e164_info
.E164_number_str
= "";
2621 e164_info
.E164_number_length
= NONE
;
2623 codeset
= locked_codeset
= initial_codeset
;
2624 first_segment
= false;
2625 while (tvb_reported_length_remaining(tvb
, offset
) > 0) {
2626 info_element
= tvb_get_uint8(tvb
, offset
);
2628 /* Check for the codeset shift */
2629 if ((info_element
& Q931_IE_SO_MASK
) &&
2630 ((info_element
& Q931_IE_SO_IDENTIFIER_MASK
) == Q931_IE_SHIFT
)) {
2631 non_locking_shift
= info_element
& Q931_IE_SHIFT_NON_LOCKING
;
2632 codeset
= info_element
& Q931_IE_SHIFT_CODESET
;
2633 if (!non_locking_shift
)
2634 locked_codeset
= codeset
;
2635 if (q931_tree
!= NULL
) {
2636 proto_tree_add_uint_format(q931_tree
, hf_q931_locking_codeset
, tvb
, offset
, 1,
2637 codeset
, "%s shift to codeset %u: %s",
2638 (non_locking_shift
? "Non-locking" : "Locking"),
2639 codeset
, val_to_str(codeset
, q931_codeset_vals
,
2640 "Unknown (0x%02X)"));
2647 * Check for the single-octet IEs.
2649 if (info_element
& Q931_IE_SO_MASK
) {
2651 * Check for subdissectors for this IE or
2652 * for all IEs in this codeset.
2654 if (dissector_get_uint_handle(codeset_dissector_table
, codeset
) ||
2655 dissector_get_uint_handle(ie_dissector_table
, (codeset
<< 8) | (info_element
& Q931_IE_SO_IDENTIFIER_MASK
))) {
2656 next_tvb
= tvb_new_subset_length (tvb
, offset
, 1);
2657 if (dissector_try_uint(ie_dissector_table
, (codeset
<< 8) | (info_element
& Q931_IE_SO_IDENTIFIER_MASK
), next_tvb
, pinfo
, q931_tree
) ||
2658 dissector_try_uint(codeset_dissector_table
, codeset
, next_tvb
, pinfo
, q931_tree
)) {
2660 codeset
= locked_codeset
;
2665 switch ((codeset
<< 8) | (info_element
& Q931_IE_SO_IDENTIFIER_MASK
)) {
2667 case CS0
| Q931_IE_MORE_DATA_OR_SEND_COMP
:
2668 switch (info_element
) {
2670 case Q931_IE_MORE_DATA
:
2671 proto_tree_add_item(q931_tree
, hf_q931_more_data
, tvb
, offset
, 1, ENC_NA
);
2674 case Q931_IE_SENDING_COMPLETE
:
2675 proto_tree_add_item(q931_tree
, hf_q931_sending_complete
, tvb
, offset
, 1, ENC_NA
);
2679 proto_tree_add_expert_format(q931_tree
, pinfo
, &ei_q931_information_element
, tvb
, offset
, 1,
2680 "Unknown information element (0x%02X)", info_element
);
2685 case CS0
| Q931_IE_CONGESTION_LEVEL
:
2686 proto_tree_add_item(q931_tree
, hf_q931_congestion_level
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2689 case CS0
| Q931_IE_REPEAT_INDICATOR
:
2690 proto_tree_add_item(q931_tree
, hf_q931_repeat_indicator
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
2694 proto_tree_add_expert_format(q931_tree
, pinfo
, &ei_q931_information_element
, tvb
, offset
, 1,
2695 "Unknown information element (0x%02X)", info_element
);
2699 codeset
= locked_codeset
;
2704 * Variable-length IE.
2706 * According to page 18 from Recommendation H.225.0 :
2707 * " Length of user-user contents contents
2708 * - Shall be 2 octets instead of 1 (as in Figure 4-36/Q.931)"
2710 * We assume that if this is Q.931-over-TPKT, it might
2711 * be H.225 traffic, and check for the IE being a user-user
2712 * IE with ASN.1 encoding of the user information.
2714 if (is_over_ip
&& tvb_bytes_exist(tvb
, offset
, 4) &&
2715 codeset
== 0 && tvb_get_uint8(tvb
, offset
) == Q931_IE_USER_USER
&&
2716 tvb_get_uint8(tvb
, offset
+ 3) == Q931_PROTOCOL_DISCRIMINATOR_ASN1
) {
2717 info_element_len
= tvb_get_ntohs(tvb
, offset
+ 1);
2718 if (q931_tree
!= NULL
) {
2719 ie_tree
= proto_tree_add_subtree(q931_tree
, tvb
, offset
,
2720 1+2+info_element_len
, ett_q931_ie
[info_element
], NULL
,
2721 val_to_str(info_element
,
2722 q931_info_element_vals
[codeset
],
2723 "Unknown information element (0x%02X)"));
2724 proto_tree_add_uint_format_value(ie_tree
, hf_q931_information_element
, tvb
, offset
, 1, info_element
, "%s", val_to_str(info_element
,
2725 q931_info_element_vals
[codeset
], "Unknown (0x%02X)"));
2726 proto_tree_add_item(ie_tree
, hf_q931_information_element_len
, tvb
, offset
+ 1, 2, ENC_BIG_ENDIAN
);
2727 proto_tree_add_item(ie_tree
, hf_q931_user_protocol_discriminator
, tvb
, offset
+ 3, 1, ENC_NA
);
2730 if (info_element_len
> 1) {
2732 * If we don't desegment limit the length
2733 * to the actual size in the frame
2735 if (!pinfo
->can_desegment
) {
2736 info_element_len
= MIN(info_element_len
, tvb_captured_length_remaining(tvb
, offset
+ 3));
2739 * Do we have a handle for the H.225
2742 if (h225_handle
!= NULL
) {
2744 * Yes - call it, regardless of
2745 * whether we're building a
2746 * protocol tree or not.
2748 h225_tvb
= tvb_new_subset_length(tvb
,
2749 offset
+ 4, info_element_len
- 1);
2750 call_dissector(h225_handle
, h225_tvb
,
2754 * No - just show it as "User
2755 * information" (if "ie_tree" is
2756 * null, this won't add anything).
2758 proto_tree_add_item(ie_tree
, hf_q931_user_information_bytes
, tvb
, offset
+ 4, info_element_len
- 1, ENC_NA
);
2761 offset
+= 1 + 2 + info_element_len
;
2763 info_element_len
= tvb_get_uint8(tvb
, offset
+ 1);
2765 if (first_segment
&& (tvb_reported_length_remaining(tvb
, offset
+ 2) < info_element_len
)) { /* incomplete IE at the end of the 1st segment */
2766 proto_tree_add_expert(q931_tree
, pinfo
, &ei_q931_incomplete_ie
, tvb
, offset
, -1);
2771 * Check for subdissectors for this IE or
2772 * for all IEs in this codeset.
2774 if (dissector_get_uint_handle(codeset_dissector_table
, codeset
) ||
2775 dissector_get_uint_handle(ie_dissector_table
, (codeset
<< 8) | info_element
)) {
2776 next_tvb
= tvb_new_subset_length (tvb
, offset
, info_element_len
+ 2);
2777 if (dissector_try_uint(ie_dissector_table
, (codeset
<< 8) | info_element
, next_tvb
, pinfo
, q931_tree
) ||
2778 dissector_try_uint(codeset_dissector_table
, codeset
, next_tvb
, pinfo
, q931_tree
)) {
2779 offset
+= 2 + info_element_len
;
2780 codeset
= locked_codeset
;
2785 ie_tree
= proto_tree_add_subtree(q931_tree
, tvb
, offset
, 1+1+info_element_len
, ett_q931_ie
[info_element
], &ti
,
2786 val_to_str(info_element
, q931_info_element_vals
[codeset
], "Unknown information element (0x%02X)"));
2787 proto_tree_add_uint_format_value(ie_tree
, hf_q931_information_element
, tvb
, offset
, 1, info_element
, "%s",
2788 val_to_str(info_element
, q931_info_element_vals
[codeset
], "Unknown (0x%02X)"));
2789 proto_tree_add_uint(ie_tree
, hf_q931_information_element_len
, tvb
, offset
+ 1, 1, info_element_len
);
2791 if (((codeset
<< 8) | info_element
) == (CS0
| Q931_IE_SEGMENTED_MESSAGE
)) {
2792 dissect_q931_segmented_message_ie(tvb
, pinfo
, offset
+ 2, info_element_len
, ie_tree
, ti
);
2793 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " of %s",
2794 val_to_str_ext(tvb_get_uint8(tvb
, offset
+ 3), &q931_message_type_vals_ext
, "Unknown message type (0x%02X)"));
2796 if (tvb_get_uint8(tvb
, offset
+ 2) & 0x80) { /* the 1st segment */
2797 first_segment
= true;
2798 } else { /* not the 1st segment */
2799 proto_tree_add_item(q931_tree
, hf_q931_message_segment
, tvb
, offset
+ 4, -1, ENC_NA
);
2800 info_element_len
+= tvb_reported_length_remaining(tvb
, offset
+ 4);
2804 * For the calling number, called number,
2805 * and release cause IEs, don't check
2806 * for the tree being null, as
2807 * the dissectors for those IEs also
2808 * supply information for the tap used
2811 switch ((codeset
<< 8) | info_element
) {
2813 case CS0
| Q931_IE_BEARER_CAPABILITY
:
2814 case CS0
| Q931_IE_LOW_LAYER_COMPAT
:
2815 if (q931_tree
!= NULL
) {
2816 dissect_q931_bearer_capability_ie(tvb
,
2817 offset
+ 2, info_element_len
,
2822 case CS0
| Q931_IE_CAUSE
:
2823 dissect_q931_cause_ie_with_info(tvb
,
2824 offset
+ 2, info_element_len
,
2826 hf_q931_cause_value
, &dummy
, q931_info_element_vals0
, q931_pi
);
2829 case CS0
| Q931_IE_CHANGE_STATUS
:
2830 if (q931_tree
!= NULL
) {
2831 dissect_q931_change_status_ie(tvb
,
2832 offset
+ 2, info_element_len
,
2837 case CS0
| Q931_IE_CALL_STATE
:
2838 if (q931_tree
!= NULL
) {
2839 dissect_q931_call_state_ie(tvb
,
2840 offset
+ 2, info_element_len
,
2845 case CS0
| Q931_IE_CHANNEL_IDENTIFICATION
:
2846 if (q931_tree
!= NULL
) {
2847 dissect_q931_channel_identification_ie(
2848 tvb
, offset
+ 2, info_element_len
,
2853 case CS0
| Q931_IE_PROGRESS_INDICATOR
:
2854 if (q931_tree
!= NULL
) {
2855 dissect_q931_progress_indicator_ie(tvb
,
2856 offset
+ 2, info_element_len
,
2861 case CS0
| Q931_IE_NETWORK_SPECIFIC_FACIL
:
2862 case CS0
| Q931_IE_TRANSIT_NETWORK_SEL
:
2863 if (q931_tree
!= NULL
) {
2864 dissect_q931_ns_facilities_ie(tvb
,
2865 offset
+ 2, info_element_len
,
2870 case CS0
| Q931_IE_NOTIFICATION_INDICATOR
:
2871 if (q931_tree
!= NULL
) {
2872 dissect_q931_notification_indicator_ie(
2873 tvb
, offset
+ 2, info_element_len
,
2878 case CS0
| Q931_IE_DISPLAY
:
2879 if (q931_tree
!= NULL
) {
2880 dissect_q931_ia5_ie(tvb
, offset
+ 2, info_element_len
, pinfo
, ie_tree
, hf_q931_display_information
);
2884 case CS0
| Q931_IE_DATE_TIME
:
2885 dissect_q931_date_time_ie(tvb
, pinfo
,
2886 offset
+ 2, info_element_len
,
2890 case CS0
| Q931_IE_KEYPAD_FACILITY
:
2891 if (q931_tree
!= NULL
) {
2892 dissect_q931_ia5_ie(tvb
, offset
+ 2, info_element_len
, pinfo
, ie_tree
, hf_q931_keypad_facility
);
2896 case CS0
| Q931_IE_SIGNAL
:
2897 dissect_q931_signal_ie(tvb
, pinfo
,
2898 offset
+ 2, info_element_len
,
2902 case CS0
| Q931_IE_INFORMATION_RATE
:
2903 dissect_q931_information_rate_ie(tvb
, pinfo
,
2904 offset
+ 2, info_element_len
,
2908 case CS0
| Q931_IE_E2E_TRANSIT_DELAY
:
2909 dissect_q931_e2e_transit_delay_ie(tvb
, pinfo
,
2910 offset
+ 2, info_element_len
,
2914 case CS0
| Q931_IE_TD_SELECTION_AND_INT
:
2915 dissect_q931_td_selection_and_int_ie(
2916 tvb
, pinfo
, offset
+ 2, info_element_len
,
2920 case CS0
| Q931_IE_PL_BINARY_PARAMETERS
:
2921 if (q931_tree
!= NULL
) {
2922 dissect_q931_pl_binary_parameters_ie(
2923 tvb
, offset
+ 2, info_element_len
,
2928 case CS0
| Q931_IE_PL_WINDOW_SIZE
:
2929 if (q931_tree
!= NULL
) {
2930 dissect_q931_pl_window_size_ie(tvb
,
2931 offset
+ 2, info_element_len
,
2936 case CS0
| Q931_IE_PACKET_SIZE
:
2937 if (q931_tree
!= NULL
) {
2938 dissect_q931_packet_size_ie(tvb
,
2939 offset
+ 2, info_element_len
,
2944 case CS0
| Q931_IE_CUG
:
2945 if (q931_tree
!= NULL
) {
2946 dissect_q931_cug_ie(tvb
,
2947 offset
+ 2, info_element_len
,
2952 case CS0
| Q931_IE_REVERSE_CHARGE_IND
:
2953 if (q931_tree
!= NULL
) {
2954 dissect_q931_reverse_charge_ind_ie(tvb
,
2955 offset
+ 2, info_element_len
,
2960 case CS0
| Q931_IE_CONNECTED_NUMBER_DEFAULT
:
2961 if (q931_tree
!= NULL
) {
2962 dissect_q931_number_ie(pinfo
, tvb
,
2963 offset
+ 2, info_element_len
,
2965 hf_q931_connected_number
, e164_info
, q931_pi
);
2970 case CS0
| Q931_IE_CALLING_PARTY_NUMBER
:
2971 e164_info
.e164_number_type
= CALLING_PARTY_NUMBER
;
2972 dissect_q931_number_ie(pinfo
, tvb
,
2973 offset
+ 2, info_element_len
,
2975 hf_q931_calling_party_number
, e164_info
, q931_pi
);
2978 case CS0
| Q931_IE_CALLED_PARTY_NUMBER
:
2979 e164_info
.e164_number_type
= CALLED_PARTY_NUMBER
;
2980 dissect_q931_number_ie(pinfo
, tvb
,
2981 offset
+ 2, info_element_len
,
2983 hf_q931_called_party_number
, e164_info
, q931_pi
);
2986 case CS0
| Q931_IE_CALLING_PARTY_SUBADDR
:
2987 case CS0
| Q931_IE_CALLED_PARTY_SUBADDR
:
2988 if (q931_tree
!= NULL
) {
2989 dissect_q931_party_subaddr_ie(tvb
,
2990 offset
+ 2, info_element_len
,
2995 case CS0
| Q931_IE_REDIRECTING_NUMBER
:
2996 if (q931_tree
!= NULL
) {
2997 dissect_q931_number_ie(pinfo
, tvb
,
2998 offset
+ 2, info_element_len
,
3000 hf_q931_redirecting_number
, e164_info
, q931_pi
);
3004 case CS0
| Q931_IE_RESTART_INDICATOR
:
3005 dissect_q931_restart_indicator_ie(tvb
, pinfo
,
3006 offset
+ 2, info_element_len
,
3010 case CS0
| Q931_IE_HIGH_LAYER_COMPAT
:
3011 if (q931_tree
!= NULL
) {
3012 dissect_q931_high_layer_compat_ie(tvb
,
3013 offset
+ 2, info_element_len
,
3018 case CS0
| Q931_IE_USER_USER
:
3019 if (q931_tree
!= NULL
) {
3020 dissect_q931_user_user_ie(tvb
, pinfo
,
3021 offset
+ 2, info_element_len
,
3026 case CS5
| Q931_IE_PARTY_CATEGORY
:
3027 if (q931_tree
!= NULL
) {
3028 dissect_q931_party_category_ie(tvb
,
3029 offset
+ 2, info_element_len
,
3034 case CS6
| Q931_IE_DISPLAY
:
3035 if (q931_tree
!= NULL
) {
3036 dissect_q931_ia5_ie(tvb
, offset
+ 2, info_element_len
, pinfo
, ie_tree
, hf_q931_avaya_display
);
3041 if (q931_tree
!= NULL
) {
3042 proto_tree_add_item(ie_tree
, hf_q931_data
, tvb
,
3043 offset
+ 2, info_element_len
, ENC_NA
);
3048 offset
+= 1 + 1 + info_element_len
;
3050 codeset
= locked_codeset
;
3053 tap_queue_packet(q931_tap
, pinfo
, q931_pi
);
3058 * Q.931-over-TPKT-over-TCP.
3061 dissect_q931_tpkt_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
3066 * Check whether this looks like a TPKT-encapsulated
3069 * The minimum length of a Q.931 message is 3:
3070 * 1 byte for the protocol discriminator,
3071 * 1 for the call_reference length,
3072 * and one for the message type.
3074 lv_tpkt_len
= is_tpkt(tvb
, 3);
3075 if (lv_tpkt_len
== -1) {
3077 * It's not a TPKT packet; reject it.
3083 * If this segment is *exactly* the length of a TPKT header,
3084 * we assume that, as it looks like a TPKT header, it
3085 * is one, and that the code put a TPKT header in one
3086 * segment and the rest of the PDU in another.
3088 if (tvb_reported_length(tvb
) == 4) {
3090 * It is - call the "dissect TPKT over a TCP stream"
3093 dissect_tpkt_encap(tvb
, pinfo
, tree
, q931_desegment
,
3094 q931_tpkt_pdu_handle
);
3099 * Well, we have more data than just the TPKT header;
3100 * check whether it looks like the beginning of a
3103 * The minimum length of a Q.931 message is 3, as per the
3106 * Check that we have that many bytes past the TPKT header in
3107 * the tvbuff; we already know that the TPKT header says we
3108 * have that many bytes (as we passed 3 as the "min_len" argument
3111 if (!tvb_bytes_exist(tvb
, 4, 3))
3114 /* Check the protocol discriminator */
3115 if ((tvb_get_uint8(tvb
, 4) != NLPID_Q_931
) && (tvb_get_uint8(tvb
, 4) != 0x03)) {
3116 /* Doesn't look like Q.931 inside TPKT */
3121 * OK, it looks like Q.931-over-TPKT.
3122 * Call the "dissect TPKT over a TCP stream" routine.
3124 dissect_tpkt_encap(tvb
, pinfo
, tree
, q931_desegment
,
3125 q931_tpkt_pdu_handle
);
3131 dissect_q931_tpkt(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
3133 dissect_q931_tpkt_heur(tvb
, pinfo
, tree
, NULL
);
3134 return tvb_captured_length(tvb
);
3138 dissect_q931_tpkt_pdu(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
3140 dissect_q931_pdu(tvb
, pinfo
, tree
, true);
3141 return tvb_captured_length(tvb
);
3145 dissect_q931(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
3147 dissect_q931_pdu(tvb
, pinfo
, tree
, false);
3148 return tvb_captured_length(tvb
);
3152 dissect_q931_over_ip(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
3154 dissect_q931_pdu(tvb
, pinfo
, tree
, true);
3155 return tvb_captured_length(tvb
);
3159 dissect_q931_ie_cs0(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
3161 dissect_q931_IEs(tvb
, pinfo
, NULL
, tree
, false, 0, 0, NULL
);
3162 return tvb_captured_length(tvb
);
3166 dissect_q931_ie_cs7(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
3168 dissect_q931_IEs(tvb
, pinfo
, NULL
, tree
, false, 0, 7, NULL
);
3169 return tvb_captured_length(tvb
);
3173 proto_register_q931(void)
3176 unsigned last_offset
;
3178 static hf_register_info hf
[] = {
3179 { &hf_q931_discriminator
,
3180 { "Protocol discriminator", "q931.disc", FT_UINT8
, BASE_HEX
, NULL
, 0x0,
3183 { &hf_q931_call_ref_len
,
3184 { "Call reference value length", "q931.call_ref_len", FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3187 { &hf_q931_call_ref_flag
,
3188 { "Call reference flag", "q931.call_ref_flag", FT_BOOLEAN
, BASE_NONE
, TFS(&tfs_call_ref_flag
), 0x0,
3191 { &hf_q931_call_ref
,
3192 { "Call reference value", "q931.call_ref", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3195 { &hf_q931_message_type
,
3196 { "Message type", "q931.message_type", FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_message_type_vals_ext
, 0x0,
3199 { &hf_q931_maintenance_message_type
,
3200 { "Maintenance message type", "q931.maintenance_message_type", FT_UINT8
, BASE_HEX
, VALS(dms_message_type_vals
), 0x0,
3203 { &hf_q931_segment_type
,
3204 { "Segmented message type", "q931.segment_type", FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_message_type_vals_ext
, 0x0,
3207 { &hf_q931_coding_standard
,
3208 { "Coding standard", "q931.coding_standard", FT_UINT8
, BASE_HEX
,
3209 VALS(q931_coding_standard_vals
), 0x60,NULL
, HFILL
}},
3211 { &hf_q931_interpretation
,
3212 { "Interpretation", "q931.interpretation", FT_UINT8
, BASE_HEX
,
3213 VALS(q931_interpretation_vals
), 0x1C, NULL
, HFILL
}},
3215 { &hf_q931_pres_meth_prot_prof
,
3216 { "Presentation method of protocol profile", "q931.presentation_method_protocol_profile", FT_UINT8
, BASE_HEX
,
3217 VALS(q931_pres_meth_prot_prof_vals
), 0x03, NULL
, HFILL
}},
3219 { &hf_q931_high_layer_characteristics
,
3220 { "High layer characteristics identification", "q931.high_layer_characteristics", FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
,
3221 &q931_high_layer_characteristics_vals_ext
, 0x7f, NULL
, HFILL
}},
3223 { &hf_q931_extended_high_layer_characteristics
,
3224 { "Extended high layer characteristics identification", "q931.extended_high_layer_characteristics", FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
,
3225 &q931_extended_high_layer_characteristics_vals_ext
, 0x7f, NULL
, HFILL
}},
3227 { &hf_q931_extended_audiovisual_characteristics
,
3228 { "Extended audiovisual characteristics identification", "q931.extended_audiovisual_characteristics", FT_UINT8
, BASE_HEX
,
3229 VALS(q931_audiovisual_characteristics_vals
), 0x7f, NULL
, HFILL
}},
3231 { &hf_q931_information_transfer_capability
,
3232 { "Information transfer capability", "q931.information_transfer_capability", FT_UINT8
, BASE_HEX
,
3233 VALS(q931_information_transfer_capability_vals
), 0x1f,NULL
, HFILL
}},
3235 { &hf_q931_transfer_mode
,
3236 { "Transfer mode", "q931.transfer_mode", FT_UINT8
, BASE_HEX
,
3237 VALS(q931_transfer_mode_vals
), 0x60,NULL
, HFILL
}},
3239 { &hf_q931_information_transfer_rate
,
3240 { "Information transfer rate", "q931.information_transfer_rate", FT_UINT8
, BASE_HEX
,
3241 VALS(q931_information_transfer_rate_vals
), 0x1f,NULL
, HFILL
}},
3243 { &hf_q931_layer_ident
,
3244 { "Layer identification", "q931.layer_ident", FT_UINT8
, BASE_HEX
,
3245 VALS(q931_bearer_capability_layer_ident_vals
), 0x60, NULL
, HFILL
}},
3248 { "User information layer 1 protocol", "q931.uil1", FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
,
3249 &q931_uil1_vals_ext
, 0x1f,NULL
, HFILL
}},
3251 { &hf_q931_cause_location
,
3252 { "Cause location", "q931.cause_location", FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &q931_cause_location_vals_ext
, 0x0f,
3255 { &hf_q931_cause_value
,
3256 { "Cause value", "q931.cause_value", FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &q931_cause_code_vals_ext
, 0x7f,
3259 { &hf_q931_number_type
,
3260 { "Number type", "q931.number_type", FT_UINT8
, BASE_HEX
, VALS(q931_number_type_vals
), 0x70,
3263 { &hf_q931_numbering_plan
,
3264 { "Numbering plan", "q931.numbering_plan", FT_UINT8
, BASE_HEX
, VALS(q931_numbering_plan_vals
), 0x0f,
3267 { &hf_q931_screening_ind
,
3268 { "Screening indicator", "q931.screening_ind", FT_UINT8
, BASE_HEX
, VALS(q931_screening_indicator_vals
), 0x03,
3271 { &hf_q931_presentation_ind
,
3272 { "Presentation indicator", "q931.presentation_ind", FT_UINT8
, BASE_HEX
, VALS(q931_presentation_indicator_vals
), 0x60,
3275 { &hf_q931_extension_ind
,
3276 { "Extension indicator", "q931.extension_ind",
3277 FT_BOOLEAN
, 8, TFS(&q931_extension_ind_value
), 0x80,
3280 { &hf_q931_extension_ind_preference
,
3281 { "Preference", "q931.extension_ind_preference",
3282 FT_UINT8
, BASE_DEC
, VALS(q931_status_preference_vals
), 0x40,
3285 { &hf_q931_extension_ind_new_status
,
3286 { "New status", "q931.extension_ind_new_status",
3287 FT_UINT8
, BASE_DEC
, VALS(q931_new_status_vals
), 0x07,
3290 { &hf_q931_calling_party_number
,
3291 { "Calling party number digits", "q931.calling_party_number.digits", FT_STRING
, BASE_NONE
, NULL
, 0x0,
3294 { &hf_q931_called_party_number
,
3295 { "Called party number digits", "q931.called_party_number.digits", FT_STRING
, BASE_NONE
, NULL
, 0x0,
3298 { &hf_q931_connected_number
,
3299 { "Connected party number digits", "q931.connected_number.digits", FT_STRING
, BASE_NONE
, NULL
, 0x0,
3302 { &hf_q931_redirecting_number
,
3303 { "Redirecting party number digits", "q931.redirecting_number.digits", FT_STRING
, BASE_NONE
, NULL
, 0x0,
3306 /* fields for channel identification IE */
3307 /* 0x80 is the extension bit */
3309 { &hf_q931_channel_interface_explicit
,
3310 { "Interface identifier present", "q931.channel.interface_id_present", FT_BOOLEAN
, 8, NULL
, 0x40,
3311 "True if the interface identifier is explicit in the following octets", HFILL
}},
3313 { &hf_q931_channel_interface_type
,
3314 { "Interface type", "q931.channel.interface_type", FT_BOOLEAN
, 8, TFS(&tfs_interface_type
), 0x20,
3315 "Identifies the ISDN interface type", HFILL
}},
3319 { &hf_q931_channel_exclusive
,
3320 { "Indicated channel", "q931.channel.exclusive", FT_BOOLEAN
, 8, TFS(&tfs_channel_exclusive
), 0x08,
3321 "True if only the indicated channel is acceptable", HFILL
}},
3323 { &hf_q931_channel_dchan
,
3324 { "D-channel indicator", "q931.channel.dchan", FT_BOOLEAN
, 8, NULL
, 0x04,
3325 "True if the identified channel is the D-Channel", HFILL
}},
3327 { &hf_q931_channel_selection_bri
,
3328 { "Information channel selection", "q931.channel.selection", FT_UINT8
, BASE_HEX
, VALS(q931_basic_channel_selection_vals
), 0x03,
3329 "Identifies the information channel to be used", HFILL
}},
3331 { &hf_q931_channel_selection_pri
,
3332 { "Information channel selection", "q931.channel.selection", FT_UINT8
, BASE_HEX
, VALS(q931_not_basic_channel_selection_vals
), 0x03,
3333 "Identifies the information channel to be used", HFILL
}},
3335 { &hf_q931_channel_map
,
3336 { "Number/map", "q931.channel.map", FT_BOOLEAN
, 8, TFS(&tfs_channel_map
), 0x10,
3337 "True if channel is indicates by channel map rather than number", HFILL
}},
3339 { &hf_q931_channel_element_type
,
3340 { "Element type", "q931.channel.element_type", FT_UINT8
, BASE_HEX
, VALS(q931_element_type_vals
), 0xF,
3341 "Type of element in the channel number/slot map octets", HFILL
}},
3343 { &hf_q931_channel_number
,
3344 { "Channel number", "q931.channel.number", FT_UINT8
, BASE_DEC
, NULL
, 0x7F,
3347 /* desegmentation fields */
3348 { &hf_q931_segment_overlap
,
3349 { "Segment overlap", "q931.segment.overlap", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
3350 "Fragment overlaps with other fragments", HFILL
}},
3352 { &hf_q931_segment_overlap_conflict
,
3353 { "Conflicting data in fragment overlap", "q931.segment.overlap.conflict", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
3354 "Overlapping fragments contained conflicting data", HFILL
}},
3356 { &hf_q931_segment_multiple_tails
,
3357 { "Multiple tail fragments found", "q931.segment.multipletails", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
3358 "Several tails were found when defragmenting the packet", HFILL
}},
3360 { &hf_q931_segment_too_long_segment
,
3361 { "Segment too long", "q931.segment.toolongfragment", FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
3362 "Segment contained data past end of packet", HFILL
}},
3364 { &hf_q931_segment_error
,
3365 { "Defragmentation error", "q931.segment.error", FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
3366 "Defragmentation error due to illegal fragments", HFILL
}},
3368 { &hf_q931_segment_count
,
3369 { "Segment count", "q931.segment.count", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
3373 { "Q.931 Segment", "q931.segment", FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
3376 { &hf_q931_segments
,
3377 { "Q.931 Segments", "q931.segments", FT_NONE
, BASE_NONE
, NULL
, 0x0,
3380 { &hf_q931_reassembled_in
,
3381 { "Reassembled Q.931 in frame", "q931.reassembled_in", FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
3382 "This Q.931 message is reassembled in this frame", HFILL
}},
3384 { &hf_q931_reassembled_length
,
3385 { "Reassembled Q.931 length", "q931.reassembled.length", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
3386 "The total length of the reassembled payload", HFILL
}},
3388 /* Generated from convert_proto_tree_add_text.pl */
3389 { &hf_q931_first_segment
,
3390 { "First segment", "q931.segment.first",
3391 FT_UINT8
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_segment_remaining
), 0x7F,
3394 { &hf_q931_not_first_segment
,
3395 { "Not first segment", "q931.segment.not_first",
3396 FT_UINT8
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_segment_remaining
), 0x7F,
3399 { &hf_q931_bearer_capability_data
,
3400 { "Data", "q931.bearer_capability.data",
3401 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3404 { &hf_q931_bearer_capability_rate_multiplier
,
3405 { "Rate multiplier", "q931.bearer_capability.rate_multiplier",
3406 FT_UINT8
, BASE_DEC
, NULL
, 0x7f,
3409 { &hf_q931_bearer_capability_user_rate
,
3410 { "User rate", "q931.bearer_capability.user_rate",
3411 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_l1_user_rate_vals_ext
, 0x1F,
3414 { &hf_q931_bearer_capability_intermediate_rate
,
3415 { "Intermediate rate", "q931.bearer_capability.intermediate_rate",
3416 FT_UINT8
, BASE_HEX
, VALS(q931_l1_intermediate_rate_vals
), 0x60,
3419 { &hf_q931_bearer_capability_stop_bits
,
3420 { "Stop bits", "q931.bearer_capability.stop_bits",
3421 FT_UINT8
, BASE_HEX
, VALS(q931_l1_stop_bits_vals
), 0x60,
3424 { &hf_q931_bearer_capability_data_bits
,
3425 { "Data bits", "q931.bearer_capability.data_bits",
3426 FT_UINT8
, BASE_HEX
, VALS(q931_l1_data_bits_vals
), 0x18,
3429 { &hf_q931_bearer_capability_parity
,
3430 { "Parity", "q931.bearer_capability.parity",
3431 FT_UINT8
, BASE_HEX
, VALS(q931_l1_parity_vals
), 0x07,
3434 { &hf_q931_bearer_capability_modem_type
,
3435 { "Modem type", "q931.bearer_capability.modem_type",
3436 FT_UINT8
, BASE_HEX
|BASE_RANGE_STRING
, RVALS(q931_l1_modem_type_rvals
), 0x3F,
3440 { "User information layer 2 protocol", "q931.uil2",
3441 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_uil2_vals_ext
, 0x1F,
3444 { &hf_q931_uil2_info
,
3445 { "User-specified layer 2 protocol information", "q931.uil2_info",
3446 FT_UINT8
, BASE_HEX
, NULL
, 0x7F,
3449 { &hf_q931_bearer_capability_mode
,
3450 { "Mode", "q931.bearer_capability.mode",
3451 FT_UINT8
, BASE_HEX
, VALS(q931_mode_vals
), 0x60,
3454 { &hf_q931_bearer_capability_window_size
,
3455 { "Window size", "q931.bearer_capability.window_size",
3456 FT_UINT8
, BASE_DEC
, NULL
, 0x7F,
3460 { "User information layer 3 protocol", "q931.uil3",
3461 FT_UINT8
, BASE_HEX
, VALS(q931_uil3_vals
), 0x1F,
3464 { &hf_q931_bearer_capability_default_packet_size
,
3465 { "Default packet size", "q931.bearer_capability.default_packet_size",
3466 FT_UINT8
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_octet_octets
), 0x0F,
3469 { &hf_q931_bearer_capability_packet_window_size
,
3470 { "Packet window size", "q931.bearer_capability.packet_window_size",
3471 FT_UINT8
, BASE_DEC
, NULL
, 0x7F,
3474 { &hf_q931_uil3_additional
,
3475 { "Additional layer 3 protocol information", "q931.uil3_additional",
3476 FT_UINT16
, BASE_HEX
, VALS(nlpid_vals
), 0x0,
3479 { &hf_q931_cause_data
,
3480 { "Data", "q931.cause.data",
3481 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3484 { &hf_q931_cause_recommendation
,
3485 { "Recommendation", "q931.cause.recommendation",
3486 FT_UINT8
, BASE_HEX
, VALS(q931_cause_recommendation_vals
), 0x7F,
3489 { &hf_q931_cause_call_rejection_reason
,
3490 { "Rejection reason", "q931.cause_call.rejection_reason",
3491 FT_UINT8
, BASE_HEX
, VALS(q931_rejection_reason_vals
), 0x7C,
3494 { &hf_q931_cause_call_condition
,
3495 { "Condition", "q931.cause_call.condition",
3496 FT_UINT8
, BASE_HEX
, VALS(q931_cause_condition_vals
), 0x03,
3499 { &hf_q931_cause_call_user_specific_diagnostic
,
3500 { "User specific diagnostic", "q931.cause_call.user_specific_diagnostic",
3501 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3504 { &hf_q931_cause_call_diagnostic
,
3505 { "Diagnostic", "q931.cause_call.diagnostic",
3506 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3509 { &hf_q931_cause_call_message_type
,
3510 { "Message type", "q931.cause_call.message_type",
3511 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_message_type_vals_ext
, 0x0,
3514 { &hf_q931_cause_call_rec_timer
,
3515 { "Timer", "q931.cause_call.rec_timer",
3516 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3519 { &hf_q931_call_state_data
,
3520 { "Data", "q931.call_state.data",
3521 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3524 { &hf_q931_call_state
,
3525 { "Call state", "q931.call_state",
3526 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_call_state_vals_ext
, 0x3F,
3529 { &hf_q931_channel_interface_id
,
3530 { "Interface ID", "q931.channel.interface_id",
3531 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
3534 { &hf_q931_channel_data
,
3535 { "Data", "q931.channel.data",
3536 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3539 { &hf_q931_channel_slot_map
,
3540 { "Slot map", "q931.channel.slot_map",
3541 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
3544 { &hf_q931_progress_indicator_data
,
3545 { "Data", "q931.progress_indicator.data",
3546 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3549 { &hf_q931_progress_indicator_location
,
3550 { "Location", "q931.progress_indicator.location",
3551 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_cause_location_vals_ext
, 0x0F,
3554 { &hf_q931_progress_indicator_description
,
3555 { "Progress description", "q931.progress_indicator.description",
3556 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_progress_description_vals_ext
, 0x7F,
3559 { &hf_q931_netid_length
,
3560 { "Network identification length", "q931.netid.length",
3561 FT_UINT8
, BASE_DEC
, NULL
, 0x7F,
3564 { &hf_q931_netid_type
,
3565 { "Type of network identification", "q931.netid.type",
3566 FT_UINT8
, BASE_HEX
, VALS(q931_netid_type_vals
), 0x70,
3569 { &hf_q931_netid_plan
,
3570 { "Network identification plan", "q931.netid.plan",
3571 FT_UINT8
, BASE_HEX
, VALS(q931_netid_plan_vals
), 0x0F,
3575 { "Network identification", "q931.netid",
3576 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3579 { &hf_q931_netid_facility_specification
,
3580 { "Network-specific facility specification", "q931.netid.facility_specification",
3581 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3584 { &hf_q931_notification_description
,
3585 { "Notification description", "q931.notification_description",
3586 FT_UINT8
, BASE_HEX
, VALS(q931_notification_description_vals
), 0x7F,
3590 { "Signal", "q931.signal",
3591 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_signal_vals_ext
, 0x0,
3594 { &hf_q931_information_rate_incoming
,
3595 { "Incoming information rate", "q931.information_rate.incoming",
3596 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_throughput_class_vals_ext
, 0x1F,
3599 { &hf_q931_information_rate_outgoing
,
3600 { "Outgoing information rate", "q931.information_rate.outgoing",
3601 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_throughput_class_vals_ext
, 0x1F,
3604 { &hf_q931_information_rate_minimum_incoming
,
3605 { "Minimum incoming information rate", "q931.information_rate.minimum_incoming",
3606 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_throughput_class_vals_ext
, 0x1F,
3609 { &hf_q931_information_rate_minimum_outgoing
,
3610 { "Minimum outgoing information rate", "q931.information_rate.minimum_outgoing",
3611 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_throughput_class_vals_ext
, 0x1F,
3614 { &hf_q931_fast_select
,
3615 { "Fast select", "q931.fast_select",
3616 FT_UINT8
, BASE_HEX
, VALS(q931_fast_selected_vals
), 0x18,
3619 { &hf_q931_pl_window_size_forward_value
,
3620 { "Forward value", "q931.pl_window_size.forward_value",
3621 FT_UINT8
, BASE_DEC
, NULL
, 0x7F,
3624 { &hf_q931_pl_window_size_backward_value
,
3625 { "Backward value", "q931.pl_window_size.backward_value",
3626 FT_UINT8
, BASE_DEC
, NULL
, 0x7F,
3629 { &hf_q931_packet_size_forward_value
,
3630 { "Forward value", "q931.packet_size.forward_value",
3631 FT_UINT8
, BASE_DEC
, NULL
, 0x7F,
3634 { &hf_q931_packet_size_backward_value
,
3635 { "Backward value", "q931.packet_size.backward_value",
3636 FT_UINT8
, BASE_DEC
, NULL
, 0x7F,
3639 { &hf_q931_cug_indication
,
3640 { "CUG indication", "q931.cug_indication",
3641 FT_UINT8
, BASE_HEX
, VALS(q931_cug_indication_vals
), 0x07,
3644 { &hf_q931_cug_index_code
,
3645 { "CUG index code", "q931.cug_index_code",
3646 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3649 { &hf_q931_reverse_charging_ind
,
3650 { "Reverse charging indication", "q931.reverse_charging_ind",
3651 FT_UINT8
, BASE_HEX
, VALS(q931_reverse_charging_indication_vals
), 0x07,
3654 { &hf_q931_extension_reason
,
3655 { "Reason for redirection", "q931.extension.reason",
3656 FT_UINT8
, BASE_HEX
, VALS(q931_redirection_reason_vals
), 0x0F,
3659 { &hf_q931_party_subaddr_type
,
3660 { "Type of subaddress", "q931.party_subaddr.type",
3661 FT_UINT8
, BASE_HEX
, VALS(q931_subaddress_type_vals
), 0x70,
3664 { &hf_q931_party_subaddr_odd_even_indicator
,
3665 { "Odd/even indicator", "q931.party_subaddr.odd_even",
3666 FT_UINT8
, BASE_HEX
, VALS(q931_odd_even_indicator_vals
), 0x08,
3669 { &hf_q931_party_subaddr
,
3670 { "Subaddress", "q931.party_subaddr",
3671 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3674 { &hf_q931_restart_indicator
,
3675 { "Restart indicator", "q931.restart_indicator",
3676 FT_UINT8
, BASE_HEX
, VALS(q931_restart_indicator_class_vals
), 0x07,
3679 { &hf_q931_high_layer_compat_data
,
3680 { "Data", "q931.high_layer_compat.data",
3681 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3684 { &hf_q931_user_protocol_discriminator
,
3685 { "Protocol discriminator", "q931.user.protocol_discriminator",
3686 FT_UINT8
, BASE_HEX
|BASE_EXT_STRING
, &q931_protocol_discriminator_vals_ext
, 0x0,
3689 { &hf_q931_user_information_len
,
3690 { "User information", "q931.user.len",
3691 FT_UINT32
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_octet_octets
), 0x0,
3694 { &hf_q931_user_information_str
,
3695 { "User information", "q931.user.string",
3696 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3699 { &hf_q931_user_information_bytes
,
3700 { "User information", "q931.user.bytes",
3701 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3704 { &hf_q931_party_category
,
3705 { "Party category", "q931.party_category",
3706 FT_UINT8
, BASE_HEX
, VALS(q931_party_category_vals
), 0x07,
3709 { &hf_q931_congestion_level
,
3710 { "Congestion level", "q931.congestion_level",
3711 FT_UINT8
, BASE_HEX
, VALS(q931_congestion_level_vals
), Q931_IE_SO_IE_MASK
,
3714 { &hf_q931_repeat_indicator
,
3715 { "Repeat indicator", "q931.repeat_indicator",
3716 FT_UINT8
, BASE_HEX
, VALS(q931_repeat_indication_vals
), Q931_IE_SO_IE_MASK
,
3719 { &hf_q931_out_band_negotiation
,
3720 { "Out-band negotiation", "q931.out_band_negotiation",
3721 FT_BOOLEAN
, 8, TFS(&tfs_possible_not_possible
), 0x40,
3725 { "Layer 1", "q931.layer_1",
3726 FT_BOOLEAN
, 8, TFS(&tfs_asynchronous_synchronous
), 0x40,
3729 { &hf_q931_layer_1_in_band_negotiation
,
3730 { "Layer 1 in-band negotiation", "q931.layer_1_in_band_negotiation",
3731 FT_BOOLEAN
, 8, TFS(&tfs_possible_not_possible
), 0x20,
3734 { &hf_q931_send_data_net_independent_clock
,
3735 { "Send data with network independent clock", "q931.send_data_net_independent_clock",
3736 FT_BOOLEAN
, 8, TFS(&tfs_required_not_required
), 0x10,
3739 { &hf_q931_accept_data_net_independent_clock
,
3740 { "Accept data with network independent clock", "q931.accept_data_net_independent_clock",
3741 FT_BOOLEAN
, 8, TFS(&tfs_accepted_not_accepted
), 0x08,
3744 { &hf_q931_send_data_flow_control
,
3745 { "Send data with flow control mechanism", "q931.send_data_flow_control",
3746 FT_BOOLEAN
, 8, TFS(&tfs_required_not_required
), 0x04,
3749 { &hf_q931_accept_data_flow_control
,
3750 { "Accept data with flow control mechanism", "q931.accept_data_flow_control",
3751 FT_BOOLEAN
, 8, TFS(&tfs_accepted_not_accepted
), 0x2,
3754 { &hf_q931_rate_adaption_header
,
3755 { "Rate adaption header", "q931.rate_adaption_header",
3756 FT_BOOLEAN
, 8, TFS(&tfs_present_not_present
), 0x40,
3759 { &hf_q931_multiple_frame_establishment
,
3760 { "Multiple frame establishment", "q931.multiple_frame_establishment",
3761 FT_BOOLEAN
, 8, TFS(&tfs_supported_not_supported
), 0x20,
3764 { &hf_q931_mode_of_operation
,
3765 { "mode of operation", "q931.mode_of_operation",
3766 FT_BOOLEAN
, 8, TFS(&tfs_protocol_sensative_bit_transparent
), 0x10,
3769 { &hf_q931_message_originator
,
3770 { "Message originator", "q931.message_originator",
3771 FT_BOOLEAN
, 8, TFS(&tfs_assignor_default
), 0x04,
3774 { &hf_q931_negotiation_is_done
,
3775 { "Negotiation is done", "q931.negotiation_is_done",
3776 FT_BOOLEAN
, 8, TFS(&tfs_in_out_band
), 0x02,
3779 { &hf_q931_bearer_capability_duplex
,
3780 { "Duplex", "q931.bearer_capability.duplex",
3781 FT_BOOLEAN
, 8, TFS(&tfs_full_half
), 0x40,
3784 { &hf_q931_network_service
,
3785 { "Network service", "q931.network_service",
3786 FT_BOOLEAN
, 8, TFS(&tfs_user_provider
), 0x80,
3789 { &hf_q931_extension_condition_type
,
3790 { "Type", "q931.extension_condition_type",
3791 FT_BOOLEAN
, 8, TFS(&tfs_abnormal_normal
), 0x40,
3794 { &hf_q931_extension_condition
,
3795 { "Condition", "q931.extension_condition",
3796 FT_UINT8
, BASE_HEX
, VALS(q931_cause_condition_vals
), 0x03,
3799 { &hf_q931_pl_request
,
3800 { "Request", "q931.pl_request",
3801 FT_BOOLEAN
, 8, TFS(&tfs_pl_request
), 0x04,
3804 { &hf_q931_pl_binary_confirmation
,
3805 { "Confirmation", "q931.pl_binary_confirmation",
3806 FT_BOOLEAN
, 8, TFS(&tfs_link_end
), 0x02,
3809 { &hf_q931_pl_modulus
,
3810 { "Modulus", "q931.pl_modulus",
3811 FT_BOOLEAN
, 8, TFS(&tfs_pl_modulus
), 0x01,
3815 { "Data", "q931.data",
3816 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3819 { &hf_q931_information_element
,
3820 { "Information element", "q931.information_element",
3821 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3824 { &hf_q931_information_element_len
,
3825 { "Length", "q931.information_element_len",
3826 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
3829 { &hf_q931_date_time
,
3830 { "Date/time", "q931.date_time",
3831 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3834 { &hf_q931_more_data
,
3835 { "More data", "q931.more_data",
3836 FT_NONE
, BASE_NONE
, NULL
, 0x0,
3839 { &hf_q931_sending_complete
,
3840 { "Sending complete", "q931.sending_complete",
3841 FT_NONE
, BASE_NONE
, NULL
, 0x0,
3844 { &hf_q931_message_segment
,
3845 { "Message segment", "q931.message_segment",
3846 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3849 { &hf_q931_missing_info_element
,
3850 { "Missing information element", "q931.missing_info_element",
3851 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
3854 { &hf_q931_insufficient_info_element
,
3855 { "Insufficient information element", "q931.insufficient_info_element",
3856 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
3859 { &hf_q931_cumulative_transit_delay
,
3860 { "Cumulative transit delay", "q931.cumulative_transit_delay",
3861 FT_UINT16
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_milliseconds
), 0x0,
3864 { &hf_q931_requested_end_to_end_transit_delay
,
3865 { "Requested end-to-end transit delay", "q931.requested_end_to_end_transit_delay",
3866 FT_UINT16
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_milliseconds
), 0x0,
3869 { &hf_q931_maximum_end_to_end_transit_delay
,
3870 { "Maximum end-to-end transit delay", "q931.maximum_end_to_end_transit_delay",
3871 FT_UINT16
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_milliseconds
), 0x0,
3874 { &hf_q931_transit_delay
,
3875 { "Transit delay", "q931.transit_delay",
3876 FT_UINT16
, BASE_DEC
|BASE_UNIT_STRING
, UNS(&units_milliseconds
), 0x0,
3879 { &hf_q931_display_information
,
3880 { "Display information", "q931.display_information",
3881 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3884 { &hf_q931_keypad_facility
,
3885 { "Keypad facility", "q931.keypad_facility",
3886 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3889 { &hf_q931_avaya_display
,
3890 { "Avaya Display", "q931.avaya_display",
3891 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3894 { &hf_q931_locking_codeset
,
3895 { "Locking codeset", "q931.locking_codeset",
3896 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3899 { &hf_q931_protocol_negotiation
,
3900 { "Protocol negotiation", "q931.protocol_negotiation",
3901 FT_BOOLEAN
, 8, TFS(&tfs_protocol_negotiation
), 0x08,
3906 #define NUM_INDIVIDUAL_ELEMS 3
3907 static int *ett
[NUM_INDIVIDUAL_ELEMS
+ NUM_IE
];
3909 static ei_register_info ei
[] = {
3910 { &ei_q931_invalid_length
, { "q931.invalid_length", PI_MALFORMED
, PI_ERROR
, "Invalid length", EXPFILL
}},
3911 { &ei_q931_date_time
, { "q931.date_time.invalid", PI_MALFORMED
, PI_ERROR
, "Date/time: Invalid length", EXPFILL
}},
3912 { &ei_q931_information_element
, { "q931.information_element.unknown", PI_PROTOCOL
, PI_WARN
, "Unknown information element", EXPFILL
}},
3913 { &ei_q931_incomplete_ie
, { "q931.incomplete_ie", PI_MALFORMED
, PI_ERROR
, "Incomplete IE in the 1st segment", EXPFILL
}},
3916 module_t
*q931_module
;
3917 expert_module_t
* expert_q931
;
3920 ett
[1] = &ett_q931_segments
;
3921 ett
[2] = &ett_q931_segment
;
3923 last_offset
= NUM_INDIVIDUAL_ELEMS
;
3925 for (i
=0; i
< NUM_IE
; i
++, last_offset
++)
3927 ett
[last_offset
] = &ett_q931_ie
[i
];
3930 proto_q931
= proto_register_protocol("Q.931", "Q.931", "q931");
3931 proto_register_field_array (proto_q931
, hf
, array_length(hf
));
3932 proto_register_subtree_array(ett
, array_length(ett
));
3933 expert_q931
= expert_register_protocol(proto_q931
);
3934 expert_register_field_array(expert_q931
, ei
, array_length(ei
));
3936 reassembly_table_register(&q931_reassembly_table
,
3937 &addresses_reassembly_table_functions
);
3939 q931_handle
= register_dissector("q931", dissect_q931
, proto_q931
);
3940 q931_tpkt_handle
= register_dissector("q931.tpkt", dissect_q931_tpkt
, proto_q931
);
3941 q931_tpkt_pdu_handle
= create_dissector_handle(dissect_q931_tpkt_pdu
,
3943 q931_over_ip_handle
= register_dissector("q931.over_ip", dissect_q931_over_ip
, proto_q931
);
3944 register_dissector("q931.ie", dissect_q931_ie_cs0
, proto_q931
);
3945 register_dissector("q931.ie.cs7", dissect_q931_ie_cs7
, proto_q931
);
3947 /* subdissector code */
3948 codeset_dissector_table
= register_dissector_table("q931.codeset", "Q.931 Codeset", proto_q931
, FT_UINT8
, BASE_HEX
);
3949 ie_dissector_table
= register_dissector_table("q931.ie", "Q.931 IE", proto_q931
, FT_UINT16
, BASE_HEX
);
3950 q931_user_heur_subdissector_list
= register_heur_dissector_list_with_description("q931_user", "Q.931 IE User payload", proto_q931
);
3952 q931_module
= prefs_register_protocol(proto_q931
, NULL
);
3953 prefs_register_bool_preference(q931_module
, "desegment_h323_messages",
3954 "Reassemble Q.931 messages spanning multiple TCP segments",
3955 "Whether the Q.931 dissector should reassemble messages spanning multiple TCP segments."
3956 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
3958 prefs_register_bool_preference(q931_module
, "reassembly",
3959 "Reassemble segmented Q.931 messages",
3960 "Reassemble segmented Q.931 messages (Q.931 - Annex H)",
3962 prefs_register_bool_preference(q931_module
, "iso_iec_cause_coding",
3963 "Decode ISO/IEC cause coding standard as ITU-T",
3964 "Decode ISO/IEC cause coding standard as ITU-T",
3965 &g931_iso_iec_cause
);
3966 /* Register for tapping */
3967 q931_tap
= register_tap("q931");
3971 proto_reg_handoff_q931(void)
3973 dissector_add_uint("lapd.sapi", LAPD_SAPI_Q931
, q931_handle
);
3974 dissector_add_uint("sctp.ppi", H323_PAYLOAD_PROTOCOL_ID
, q931_over_ip_handle
);
3975 dissector_add_uint("osinl.incl", NLPID_Q_931
, q931_handle
);
3978 * Attempt to get a handle for the H.225 dissector.
3979 * If we can't, the handle we get is null, and we'll just
3980 * dissect putatively-H.255 Call Signaling stuff as User
3983 h225_handle
= find_dissector_add_dependency("h225", proto_q931
);
3988 heur_dissector_add("tcp", dissect_q931_tpkt_heur
, "Q.931 over TPKT over TCP", "q931_tcp", proto_q931
, HEURISTIC_ENABLE
);
3991 static void reset_q931_packet_info(q931_packet_info
*pi
)
3997 pi
->calling_number
= NULL
;
3998 pi
->called_number
= NULL
;
3999 pi
->cause_value
= 0xFF;
4004 * Editor modelines - https://www.wireshark.org/tools/modelines.html
4009 * indent-tabs-mode: nil
4012 * vi: set shiftwidth=4 tabstop=8 expandtab:
4013 * :indentSize=4:tabSize=8:noTabs=true: