epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / epan / dissectors / packet-m3ua.c
blobea238befea4d88a0cba1e49d4271568673b58c54
1 /* packet-m3ua.c
2 * Routines for MTP3 User Adaptation Layer dissection
3 * It is hopefully (needs testing) compliant to
4 * https://tools.ietf.org/html/draft-ietf-sigtran-m3ua-05 (expired)
5 * https://tools.ietf.org/html/draft-ietf-sigtran-m3ua-06 (expired)
6 * https://tools.ietf.org/html/draft-ietf-sigtran-m3ua-07 (expired)
7 * https://tools.ietf.org/html/rfc3332
8 * https://datatracker.ietf.org/doc/rfc4666/
10 * Copyright 2000, 2001, 2002, 2003, 2004 Michael Tuexen <tuexen [AT] fh-muenster.de>
12 * Wireshark - Network traffic analyzer
13 * By Gerald Combs <gerald@wireshark.org>
14 * Copyright 1998 Gerald Combs
16 * Copied from README.developer
18 * SPDX-License-Identifier: GPL-2.0-or-later
21 #include "config.h"
23 #include <epan/packet.h>
24 #include <epan/prefs.h>
25 #include <epan/address_types.h>
26 #include <epan/sctpppids.h>
27 #include <wsutil/str_util.h>
28 #include <wsutil/ws_roundup.h>
29 #include "packet-mtp3.h"
30 #include "packet-sccp.h"
31 #include "packet-frame.h"
32 #include "packet-tcp.h"
33 #include "packet-q708.h"
34 #include <epan/tap.h>
36 void proto_register_m3ua(void);
37 void proto_reg_handoff_m3ua(void);
39 static int m3ua_pref_mtp3_standard;
41 #define SCTP_PORT_M3UA 2905
42 #define TCP_PORT_M3UA 2905
44 #define VERSION_LENGTH 1
45 #define RESERVED_LENGTH 1
46 #define MESSAGE_CLASS_LENGTH 1
47 #define MESSAGE_TYPE_LENGTH 1
48 #define MESSAGE_LENGTH_LENGTH 4
49 #define COMMON_HEADER_LENGTH (VERSION_LENGTH + RESERVED_LENGTH + MESSAGE_CLASS_LENGTH + \
50 MESSAGE_TYPE_LENGTH + MESSAGE_LENGTH_LENGTH)
52 #define VERSION_OFFSET 0
53 #define RESERVED_OFFSET (VERSION_OFFSET + VERSION_LENGTH)
54 #define MESSAGE_CLASS_OFFSET (RESERVED_OFFSET + RESERVED_LENGTH)
55 #define MESSAGE_TYPE_OFFSET (MESSAGE_CLASS_OFFSET + MESSAGE_CLASS_LENGTH)
56 #define MESSAGE_LENGTH_OFFSET (MESSAGE_TYPE_OFFSET + MESSAGE_TYPE_LENGTH)
58 #define PARAMETER_TAG_LENGTH 2
59 #define PARAMETER_LENGTH_LENGTH 2
60 #define PARAMETER_HEADER_LENGTH (PARAMETER_TAG_LENGTH + PARAMETER_LENGTH_LENGTH)
62 #define PARAMETER_TAG_OFFSET 0
63 #define PARAMETER_LENGTH_OFFSET (PARAMETER_TAG_OFFSET + PARAMETER_TAG_LENGTH)
64 #define PARAMETER_VALUE_OFFSET (PARAMETER_LENGTH_OFFSET + PARAMETER_LENGTH_LENGTH)
65 #define PARAMETER_HEADER_OFFSET PARAMETER_TAG_OFFSET
67 #define PROTOCOL_VERSION_RELEASE_1 1
69 static const value_string protocol_version_values[] = {
70 { PROTOCOL_VERSION_RELEASE_1, "Release 1" },
71 { 0, NULL } };
73 #define MESSAGE_CLASS_MGMT_MESSAGE 0
74 #define MESSAGE_CLASS_TFER_MESSAGE 1
75 #define MESSAGE_CLASS_SSNM_MESSAGE 2
76 #define MESSAGE_CLASS_ASPSM_MESSAGE 3
77 #define MESSAGE_CLASS_ASPTM_MESSAGE 4
78 #define MESSAGE_CLASS_RKM_MESSAGE 9
80 static const value_string message_class_values[] = {
81 { MESSAGE_CLASS_MGMT_MESSAGE, "Management messages" },
82 { MESSAGE_CLASS_TFER_MESSAGE, "Transfer messages" },
83 { MESSAGE_CLASS_SSNM_MESSAGE, "SS7 signalling network management messages" },
84 { MESSAGE_CLASS_ASPSM_MESSAGE, "ASP state maintenance messages" },
85 { MESSAGE_CLASS_ASPTM_MESSAGE, "ASP traffic maintenance messages" },
86 { MESSAGE_CLASS_RKM_MESSAGE, "Routing key management messages" },
87 { 0, NULL } };
89 static const value_string v5_message_class_values[] = {
90 { MESSAGE_CLASS_MGMT_MESSAGE, "Management messages" },
91 { MESSAGE_CLASS_TFER_MESSAGE, "Transfer messages" },
92 { MESSAGE_CLASS_SSNM_MESSAGE, "SS7 signalling network management messages" },
93 { MESSAGE_CLASS_ASPSM_MESSAGE, "ASP state maintenance messages" },
94 { MESSAGE_CLASS_ASPTM_MESSAGE, "ASP traffic maintenance messages" },
95 { 0, NULL } };
97 #define MESSAGE_TYPE_ERR 0
98 #define MESSAGE_TYPE_NTFY 1
100 #define MESSAGE_TYPE_DATA 1
102 #define MESSAGE_TYPE_DUNA 1
103 #define MESSAGE_TYPE_DAVA 2
104 #define MESSAGE_TYPE_DAUD 3
105 #define MESSAGE_TYPE_SCON 4
106 #define MESSAGE_TYPE_DUPU 5
107 #define MESSAGE_TYPE_DRST 6
109 #define MESSAGE_TYPE_UP 1
110 #define MESSAGE_TYPE_DOWN 2
111 #define MESSAGE_TYPE_BEAT 3
112 #define MESSAGE_TYPE_UP_ACK 4
113 #define MESSAGE_TYPE_DOWN_ACK 5
114 #define MESSAGE_TYPE_BEAT_ACK 6
116 #define MESSAGE_TYPE_ACTIVE 1
117 #define MESSAGE_TYPE_INACTIVE 2
118 #define MESSAGE_TYPE_ACTIVE_ACK 3
119 #define MESSAGE_TYPE_INACTIVE_ACK 4
121 #define MESSAGE_TYPE_REG_REQ 1
122 #define MESSAGE_TYPE_REG_RSP 2
123 #define MESSAGE_TYPE_DEREG_REQ 3
124 #define MESSAGE_TYPE_DEREG_RSP 4
126 static const value_string v5_message_class_type_values[] = {
127 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_ERR, "Error (ERR)" },
128 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_NTFY, "Notify (NTFY)" },
129 { MESSAGE_CLASS_TFER_MESSAGE * 256 + MESSAGE_TYPE_DATA, "Payload data (DATA)" },
130 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DUNA, "Destination unavailable (DUNA)" },
131 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DAVA, "Destination available (DAVA)" },
132 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DAUD, "Destination state audit (DAUD)" },
133 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_SCON, "SS7 Network congestion state (SCON)" },
134 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DUPU, "Destination userpart unavailable (DUPU)" },
135 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP, "ASP up (UP)" },
136 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN, "ASP down (DOWN)" },
137 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT, "Heartbeat (BEAT)" },
138 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP_ACK, "ASP up ack (UP ACK)" },
139 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN_ACK, "ASP down ack (DOWN ACK)" },
140 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT_ACK, "Heartbeat ack (BEAT ACK)" },
141 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE , "ASP active (ACTIVE)" },
142 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE , "ASP inactive (INACTIVE)" },
143 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE_ACK , "ASP active ack (ACTIVE ACK)" },
144 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE_ACK , "ASP inactive ack (INACTIVE ACK)" },
145 { 0, NULL } };
147 static const value_string message_class_type_values[] = {
148 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_ERR, "Error (ERR)" },
149 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_NTFY, "Notify (NTFY)" },
150 { MESSAGE_CLASS_TFER_MESSAGE * 256 + MESSAGE_TYPE_DATA, "Payload data (DATA)" },
151 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DUNA, "Destination unavailable (DUNA)" },
152 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DAVA, "Destination available (DAVA)" },
153 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DAUD, "Destination state audit (DAUD)" },
154 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_SCON, "SS7 Network congestion state (SCON)" },
155 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DUPU, "Destination userpart unavailable (DUPU)" },
156 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DRST, "Destination Restricted (DRST)" },
157 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP, "ASP up (ASPUP)" },
158 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN, "ASP down (ASPDN)" },
159 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT, "Heartbeat (BEAT)" },
160 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP_ACK, "ASP up ack (ASPUP_ACK)" },
161 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN_ACK, "ASP down ack (ASPDN_ACK)" },
162 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT_ACK, "Heartbeat ack (BEAT_ACK)" },
163 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE , "ASP active (ASPAC)" },
164 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE , "ASP inactive (ASPIA)" },
165 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE_ACK , "ASP active ack (ASPAC_ACK)" },
166 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE_ACK , "ASP inactive ack (ASPIA_ACK)" },
167 { MESSAGE_CLASS_RKM_MESSAGE * 256 + MESSAGE_TYPE_REG_REQ , "Registration request (REG_REQ)" },
168 { MESSAGE_CLASS_RKM_MESSAGE * 256 + MESSAGE_TYPE_REG_RSP , "Registration response (REG_RSP)" },
169 { MESSAGE_CLASS_RKM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_REQ , "Deregistration request (DEREG_REQ)" },
170 { MESSAGE_CLASS_RKM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_RSP , "Deregistration response (DEREG_RSP)" },
171 { 0, NULL } };
173 static const value_string v5_message_class_type_acro_values[] = {
174 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_ERR, "ERR" },
175 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_NTFY, "NTFY" },
176 { MESSAGE_CLASS_TFER_MESSAGE * 256 + MESSAGE_TYPE_DATA, "DATA" },
177 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DUNA, "DUNA" },
178 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DAVA, "DAVA" },
179 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DAUD, "DAUD" },
180 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_SCON, "SCON" },
181 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DUPU, "DUPU" },
182 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP, "ASP_UP" },
183 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN, "ASP_DOWN" },
184 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT, "BEAT" },
185 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP_ACK, "ASP_UP_ACK" },
186 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN_ACK, "ASP_DOWN_ACK" },
187 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT_ACK, "BEAT_ACK" },
188 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE , "ASP_ACTIVE" },
189 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE , "ASP_INACTIVE" },
190 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE_ACK , "ASP_ACTIVE_ACK" },
191 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE_ACK , "ASP_INACTIVE_ACK" },
192 { 0, NULL } };
194 static const value_string message_class_type_acro_values[] = {
195 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_ERR, "ERR" },
196 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_NTFY, "NTFY" },
197 { MESSAGE_CLASS_TFER_MESSAGE * 256 + MESSAGE_TYPE_DATA, "DATA" },
198 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DUNA, "DUNA" },
199 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DAVA, "DAVA" },
200 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DAUD, "DAUD" },
201 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_SCON, "SCON" },
202 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DUPU, "DUPU" },
203 { MESSAGE_CLASS_SSNM_MESSAGE * 256 + MESSAGE_TYPE_DRST, "DRST" },
204 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP, "ASPUP" },
205 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN, "ASPDN" },
206 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT, "BEAT" },
207 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP_ACK, "ASPUP_ACK" },
208 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN_ACK, "ASPDN_ACK" },
209 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT_ACK, "BEAT_ACK" },
210 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE , "ASPAC" },
211 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE , "ASPIA" },
212 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE_ACK , "ASPAC_ACK" },
213 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE_ACK , "ASPIA_ACK" },
214 { MESSAGE_CLASS_RKM_MESSAGE * 256 + MESSAGE_TYPE_REG_REQ , "REG_REQ" },
215 { MESSAGE_CLASS_RKM_MESSAGE * 256 + MESSAGE_TYPE_REG_RSP , "REG_RSP" },
216 { MESSAGE_CLASS_RKM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_REQ , "DEREG_REQ" },
217 { MESSAGE_CLASS_RKM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_RSP , "DEREG_RSP" },
218 { 0, NULL } };
220 /* Initialize the protocol and registered fields */
221 static int proto_m3ua;
222 static int hf_version;
223 static int hf_reserved;
224 static int hf_message_class;
225 static int hf_v5_message_class;
226 static int hf_message_type;
227 static int hf_message_length;
228 static int hf_v5_parameter_tag;
229 static int hf_v6_parameter_tag;
230 static int hf_v7_parameter_tag;
231 static int hf_parameter_tag;
232 static int hf_parameter_length;
233 static int hf_parameter_value;
234 static int hf_parameter_padding;
235 /* static int hf_parameter_trailer; */
236 static int hf_network_appearance;
237 static int hf_info_string;
238 static int hf_routing_context;
239 static int hf_diagnostic_information;
240 static int hf_heartbeat_data;
241 static int hf_v5_error_code;
242 static int hf_v6_error_code;
243 static int hf_v7_error_code;
244 static int hf_error_code;
245 static int hf_status_type;
246 static int hf_status_info;
247 static int hf_asp_identifier;
248 static int hf_affected_point_code_mask;
249 static int hf_affected_point_code_pc;
250 static int hf_cause;
251 static int hf_user;
252 static int hf_reason;
253 static int hf_v5_traffic_mode_type;
254 static int hf_v6_traffic_mode_type;
255 static int hf_v7_traffic_mode_type;
256 static int hf_traffic_mode_type;
257 static int hf_congestion_reserved;
258 static int hf_congestion_level;
259 static int hf_concerned_dest_reserved;
260 static int hf_concerned_dest_pc;
261 static int hf_local_rk_identifier;
262 static int hf_dpc_mask;
263 static int hf_dpc_pc;
264 static int hf_si;
265 static int hf_ssn;
266 static int hf_opc_list_mask;
267 static int hf_opc_list_pc;
268 static int hf_cic_range_mask;
269 static int hf_cic_range_pc;
270 static int hf_cic_range_upper;
271 static int hf_cic_range_lower;
272 static int hf_protocol_data_opc;
273 static int hf_protocol_data_dpc;
274 static int hf_protocol_data_mtp3_opc;
275 static int hf_protocol_data_mtp3_dpc;
276 static int hf_protocol_data_mtp3_pc;
277 static int hf_protocol_data_si;
278 static int hf_protocol_data_ni;
279 static int hf_protocol_data_mtp3_ni;
280 static int hf_protocol_data_mp;
281 static int hf_protocol_data_sls;
282 static int hf_protocol_data_mtp3_sls;
283 static int hf_correlation_identifier;
284 static int hf_registration_status;
285 static int hf_deregistration_status;
286 static int hf_registration_result_identifier;
287 static int hf_registration_result_status;
288 static int hf_registration_result_context;
289 static int hf_v6_deregistration_result_status;
290 static int hf_v6_deregistration_result_context;
291 static int hf_li;
292 static int hf_heuristic_standard;
294 static int m3ua_tap;
296 /* Initialize the subtree pointers */
297 static int ett_m3ua;
298 static int ett_parameter;
299 static int ett_mtp3_equiv;
300 static int ett_q708_opc;
301 static int ett_q708_dpc;
303 static module_t *m3ua_module;
304 static dissector_handle_t mtp3_handle;
305 static dissector_handle_t m3ua_sctp_handle;
306 static dissector_handle_t m3ua_tcp_handle;
307 static dissector_table_t si_dissector_table;
309 static bool m3ua_tcp_desegment = true;
311 static int ss7pc_address_type = -1;
313 /* stuff for supporting multiple versions */
314 typedef enum {
315 M3UA_V5,
316 M3UA_V6,
317 M3UA_V7,
318 M3UA_RFC
319 } Version_Type;
321 static int version = M3UA_RFC;
325 static void
326 dissect_parameters(tvbuff_t *, packet_info *, proto_tree *, proto_tree *);
328 static void
329 dissect_v5_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, proto_tree *m3ua_tree)
331 uint8_t message_class, message_type;
333 /* Extract the common header */
334 message_class = tvb_get_uint8(common_header_tvb, MESSAGE_CLASS_OFFSET);
335 message_type = tvb_get_uint8(common_header_tvb, MESSAGE_TYPE_OFFSET);
337 col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_class * 256 + message_type, v5_message_class_type_acro_values, "reserved"));
339 if (m3ua_tree) {
340 /* add the components of the common header to the protocol tree */
341 proto_tree_add_item(m3ua_tree, hf_version, common_header_tvb, VERSION_OFFSET, VERSION_LENGTH, ENC_BIG_ENDIAN);
342 proto_tree_add_item(m3ua_tree, hf_reserved, common_header_tvb, RESERVED_OFFSET, RESERVED_LENGTH, ENC_BIG_ENDIAN);
343 proto_tree_add_item(m3ua_tree, hf_v5_message_class, common_header_tvb, MESSAGE_CLASS_OFFSET, MESSAGE_CLASS_LENGTH, ENC_BIG_ENDIAN);
344 proto_tree_add_uint_format_value(m3ua_tree, hf_message_type, common_header_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, message_type,
345 "%s (%u)", val_to_str_const(message_class * 256 + message_type, v5_message_class_type_values, "reserved"), message_type);
346 proto_tree_add_item(m3ua_tree, hf_message_length, common_header_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN);
350 static void
351 dissect_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, proto_tree *m3ua_tree)
353 uint8_t message_class, message_type;
355 /* Extract the common header */
356 message_class = tvb_get_uint8(common_header_tvb, MESSAGE_CLASS_OFFSET);
357 message_type = tvb_get_uint8(common_header_tvb, MESSAGE_TYPE_OFFSET);
359 col_add_fstr(pinfo->cinfo, COL_INFO,"%s ", val_to_str_const(message_class * 256 + message_type, message_class_type_acro_values, "reserved"));
361 if (m3ua_tree) {
362 /* add the components of the common header to the protocol tree */
363 proto_tree_add_item(m3ua_tree, hf_version, common_header_tvb, VERSION_OFFSET, VERSION_LENGTH, ENC_BIG_ENDIAN);
364 proto_tree_add_item(m3ua_tree, hf_reserved, common_header_tvb, RESERVED_OFFSET, RESERVED_LENGTH, ENC_BIG_ENDIAN);
365 proto_tree_add_item(m3ua_tree, hf_message_class, common_header_tvb, MESSAGE_CLASS_OFFSET, MESSAGE_CLASS_LENGTH, ENC_BIG_ENDIAN);
366 proto_tree_add_uint_format_value(m3ua_tree, hf_message_type, common_header_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, message_type,
367 "%s (%u)", val_to_str_const(message_class * 256 + message_type, message_class_type_values, "reserved"), message_type);
368 proto_tree_add_item(m3ua_tree, hf_message_length, common_header_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN);
372 #define NETWORK_APPEARANCE_LENGTH 4
373 #define NETWORK_APPEARANCE_OFFSET PARAMETER_VALUE_OFFSET
375 static void
376 dissect_network_appearance_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
378 proto_tree_add_item(parameter_tree, hf_network_appearance, parameter_tvb, NETWORK_APPEARANCE_OFFSET, NETWORK_APPEARANCE_LENGTH, ENC_BIG_ENDIAN);
379 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, NETWORK_APPEARANCE_OFFSET));
382 #define V5_PROTOCOL_DATA_OFFSET PARAMETER_VALUE_OFFSET
384 static void
385 dissect_v5_protocol_data_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_item *parameter_item)
387 uint16_t length, protocol_data_length;
388 tvbuff_t *payload_tvb;
390 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
391 protocol_data_length = length - PARAMETER_HEADER_LENGTH;
392 payload_tvb = tvb_new_subset_length(parameter_tvb, V5_PROTOCOL_DATA_OFFSET, protocol_data_length);
393 proto_item_append_text(parameter_item, " (SS7 message of %u byte%s)", protocol_data_length, plurality(protocol_data_length, "", "s"));
394 proto_item_set_len(parameter_item, PARAMETER_HEADER_LENGTH);
395 call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
398 #define INFO_STRING_OFFSET PARAMETER_VALUE_OFFSET
400 static void
401 dissect_info_string_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
403 uint16_t info_string_length;
405 info_string_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
406 proto_tree_add_item(parameter_tree, hf_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, ENC_ASCII);
407 proto_item_append_text(parameter_item, " (%s)",
408 tvb_format_text(pinfo->pool, parameter_tvb, INFO_STRING_OFFSET, info_string_length));
411 #define AFFECTED_MASK_LENGTH 1
412 #define AFFECTED_DPC_LENGTH 3
413 #define AFFECTED_DESTINATION_LENGTH (AFFECTED_MASK_LENGTH + AFFECTED_DPC_LENGTH)
415 #define AFFECTED_MASK_OFFSET 0
416 #define AFFECTED_DPC_OFFSET 1
418 static void
419 dissect_affected_destinations_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
421 uint16_t number_of_destinations, destination_number;
422 int destination_offset;
423 proto_item *item;
425 number_of_destinations = (tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH) >> 2;
426 destination_offset = PARAMETER_VALUE_OFFSET;
427 for(destination_number=0; destination_number < number_of_destinations; destination_number++) {
428 proto_tree_add_item(parameter_tree, hf_affected_point_code_mask, parameter_tvb, destination_offset + AFFECTED_MASK_OFFSET, AFFECTED_MASK_LENGTH, ENC_BIG_ENDIAN);
429 item = proto_tree_add_item(parameter_tree, hf_affected_point_code_pc, parameter_tvb, destination_offset + AFFECTED_DPC_OFFSET, AFFECTED_DPC_LENGTH, ENC_BIG_ENDIAN);
430 if (mtp3_pc_structured())
431 proto_item_append_text(item, " (%s)", mtp3_pc_to_str(tvb_get_ntoh24(parameter_tvb, destination_offset + AFFECTED_DPC_OFFSET)));
432 destination_offset += AFFECTED_DESTINATION_LENGTH;
434 proto_item_append_text(parameter_item, " (%u destination%s)", number_of_destinations, plurality(number_of_destinations, "", "s"));
437 #define ROUTING_CONTEXT_LENGTH 4
439 static void
440 dissect_routing_context_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
442 uint16_t number_of_contexts, context_number;
443 int context_offset;
445 number_of_contexts = (tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH) >> 2;
446 context_offset = PARAMETER_VALUE_OFFSET;
447 for(context_number=0; context_number < number_of_contexts; context_number++) {
448 proto_tree_add_item(parameter_tree, hf_routing_context, parameter_tvb, context_offset, ROUTING_CONTEXT_LENGTH, ENC_BIG_ENDIAN);
449 context_offset += ROUTING_CONTEXT_LENGTH;
451 proto_item_append_text(parameter_item, " (%u context%s)", number_of_contexts, plurality(number_of_contexts, "", "s"));
454 #define DIAGNOSTIC_INFO_OFFSET PARAMETER_VALUE_OFFSET
456 static void
457 dissect_diagnostic_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
459 uint16_t diag_info_length;
461 diag_info_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
462 proto_tree_add_item(parameter_tree, hf_diagnostic_information, parameter_tvb, DIAGNOSTIC_INFO_OFFSET, diag_info_length, ENC_NA);
463 proto_item_append_text(parameter_item, " (%u byte%s)", diag_info_length, plurality(diag_info_length, "", "s"));
466 #define HEARTBEAT_DATA_OFFSET PARAMETER_VALUE_OFFSET
468 static void
469 dissect_heartbeat_data_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
471 uint16_t heartbeat_data_length;
473 heartbeat_data_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
474 proto_tree_add_item(parameter_tree, hf_heartbeat_data, parameter_tvb, HEARTBEAT_DATA_OFFSET, heartbeat_data_length, ENC_NA);
475 proto_item_append_text(parameter_item, " (%u byte%s)", heartbeat_data_length, plurality(heartbeat_data_length, "", "s"));
478 #define UNKNOWN_UNAVAIL_CAUSE 0
479 #define UNEQUIPPED_REMOTE_USER_UNAVAIL_CAUSE 1
480 #define INACCESSIBLE_REMOTE_USER_UNAVAIL_CAUSE 2
482 static const value_string unavailability_cause_values[] = {
483 { UNKNOWN_UNAVAIL_CAUSE, "Unknown" },
484 { UNEQUIPPED_REMOTE_USER_UNAVAIL_CAUSE, "Unequipped remote user" },
485 { INACCESSIBLE_REMOTE_USER_UNAVAIL_CAUSE, "Inaccessible remote user" },
486 {0, NULL } };
488 #define RESERVED_0_USER_ID 0
489 #define RESERVED_1_USER_ID 1
490 #define RESERVED_2_USER_ID 2
491 #define SCCP_USER_ID 3
492 #define TUP_USER_ID 4
493 #define ISUP_USER_ID 5
494 #define RESERVED_6_USER_ID 6
495 #define RESERVED_7_USER_ID 7
496 #define RESERVED_8_USER_ID 8
497 #define BROADBAND_ISUP_USER_ID 9
498 #define SATELLITE_ISUP_USER_ID 10
499 #define RESERVED_11_USER_ID 11
500 #define AAL_2_SIGNALING_USER_ID 12
501 #define BICC_USER_ID 13
502 #define GATEWAY_CONTROL_PROTOCOL_USER_ID 14
503 #define RESERVED_15_USER_ID 15
505 static const value_string user_identity_values[] = {
506 { RESERVED_0_USER_ID, "Reserved" },
507 { RESERVED_1_USER_ID, "Reserved" },
508 { RESERVED_2_USER_ID, "Reserved" },
509 { SCCP_USER_ID, "SCCP" },
510 { TUP_USER_ID, "TUP" },
511 { ISUP_USER_ID, "ISUP" },
512 { RESERVED_6_USER_ID, "Reserved" },
513 { RESERVED_7_USER_ID, "Reserved" },
514 { RESERVED_8_USER_ID, "Reserved" },
515 { BROADBAND_ISUP_USER_ID, "Broadband ISUP" },
516 { SATELLITE_ISUP_USER_ID, "Satellite ISUP" },
517 { RESERVED_11_USER_ID, "Reserved" },
518 { AAL_2_SIGNALING_USER_ID,"AAL type2 Signaling"},
519 { BICC_USER_ID, "Bearer Independent Call Control (BICC)"},
520 { GATEWAY_CONTROL_PROTOCOL_USER_ID, "Gateway Control Protocol"},
521 { RESERVED_15_USER_ID, "Reserved" },
523 {0, NULL } };
525 #define CAUSE_LENGTH 2
526 #define USER_LENGTH 2
528 #define CAUSE_OFFSET PARAMETER_VALUE_OFFSET
529 #define USER_OFFSET (CAUSE_OFFSET + CAUSE_LENGTH)
531 static void
532 dissect_user_cause_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
534 proto_tree_add_item(parameter_tree, hf_cause, parameter_tvb, CAUSE_OFFSET, CAUSE_LENGTH, ENC_BIG_ENDIAN);
535 proto_tree_add_item(parameter_tree, hf_user, parameter_tvb, USER_OFFSET, USER_LENGTH, ENC_BIG_ENDIAN);
536 proto_item_append_text(parameter_item, " (%s: %s)",
537 val_to_str_const(tvb_get_ntohs(parameter_tvb, USER_OFFSET), user_identity_values, "Unknown user"),
538 val_to_str_const(tvb_get_ntohs(parameter_tvb, CAUSE_OFFSET), unavailability_cause_values, "unknown cause"));
541 #define UNSPECIFIED_REASON 0
542 #define USER_UNAVAILABLE_REASON 1
543 #define MANAGEMENT_BLOCKING_REASON 2
545 static const value_string reason_values[] = {
546 { UNSPECIFIED_REASON, "Unspecified" },
547 { USER_UNAVAILABLE_REASON, "User unavailable" },
548 { MANAGEMENT_BLOCKING_REASON, "Management blocking" },
549 {0, NULL } };
551 #define REASON_LENGTH 4
552 #define REASON_OFFSET PARAMETER_VALUE_OFFSET
554 static void
555 dissect_reason_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
557 proto_tree_add_item(parameter_tree, hf_reason, parameter_tvb, REASON_OFFSET, REASON_LENGTH, ENC_BIG_ENDIAN);
558 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, REASON_OFFSET), reason_values, "unknown"));
561 #define TRAFFIC_MODE_TYPE_LENGTH 4
562 #define TRAFFIC_MODE_TYPE_OFFSET PARAMETER_VALUE_OFFSET
564 static const value_string v5_traffic_mode_type_values[] = {
565 { 1, "Over-ride" },
566 { 2, "Load-share" },
567 { 3, "Over-ride (standby)" },
568 { 4, "Load-share (standby)" },
569 { 0, NULL } };
571 static void
572 dissect_v5_traffic_mode_type_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
574 proto_tree_add_item(parameter_tree, hf_v5_traffic_mode_type, parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET, TRAFFIC_MODE_TYPE_LENGTH, ENC_BIG_ENDIAN);
575 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET), v5_traffic_mode_type_values, "unknown"));
578 static const value_string v6_traffic_mode_type_values[] = {
579 { 1, "Over-ride" },
580 { 2, "Load-share" },
581 { 3, "Over-ride (standby)" },
582 { 4, "Load-share (standby)" },
583 { 0, NULL } };
585 static void
586 dissect_v6_traffic_mode_type_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
588 proto_tree_add_item(parameter_tree, hf_v6_traffic_mode_type, parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET, TRAFFIC_MODE_TYPE_LENGTH, ENC_BIG_ENDIAN);
589 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET), v6_traffic_mode_type_values, "unknown"));
592 static const value_string v7_traffic_mode_type_values[] = {
593 { 1, "Over-ride" },
594 { 2, "Load-share" },
595 { 0, NULL } };
597 static void
598 dissect_v7_traffic_mode_type_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
600 proto_tree_add_item(parameter_tree, hf_v7_traffic_mode_type, parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET, TRAFFIC_MODE_TYPE_LENGTH, ENC_BIG_ENDIAN);
601 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET), v7_traffic_mode_type_values, "unknown"));
604 static const value_string traffic_mode_type_values[] = {
605 { 1, "Over-ride" },
606 { 2, "Load-share" },
607 { 3, "Broadcast" },
608 { 0, NULL } };
610 static void
611 dissect_traffic_mode_type_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
613 proto_tree_add_item(parameter_tree, hf_traffic_mode_type, parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET, TRAFFIC_MODE_TYPE_LENGTH, ENC_BIG_ENDIAN);
614 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET), traffic_mode_type_values, "unknown"));
617 #define ERROR_CODE_LENGTH 4
618 #define ERROR_CODE_OFFSET PARAMETER_VALUE_OFFSET
620 static const value_string v5_error_code_values[] = {
621 { 1, "Invalid version" },
622 { 2, "Invalid network appearance" },
623 { 3, "Unsupported message class" },
624 { 4, "Unsupported message type" },
625 { 5, "Invalid traffic handling mode" },
626 { 6, "Unexpected message" },
627 { 7, "Protocol error" },
628 { 8, "Invalid routing context" },
629 { 0, NULL } };
631 static void
632 dissect_v5_error_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
634 proto_tree_add_item(parameter_tree, hf_v5_error_code, parameter_tvb, ERROR_CODE_OFFSET, ERROR_CODE_LENGTH, ENC_BIG_ENDIAN);
635 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, ERROR_CODE_OFFSET), v5_error_code_values, "unknown"));
638 static const value_string v6_error_code_values[] = {
639 { 1, "Invalid version" },
640 { 2, "Invalid network appearance" },
641 { 3, "Unsupported message class" },
642 { 4, "Unsupported message type" },
643 { 5, "Invalid traffic handling mode" },
644 { 6, "Unexpected message" },
645 { 7, "Protocol error" },
646 { 8, "Invalid routing context" },
647 { 9, "Invalid stream identifier" },
648 { 10, "Invalid parameter value" },
649 { 0, NULL } };
652 static void
653 dissect_v6_error_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
655 proto_tree_add_item(parameter_tree, hf_v6_error_code, parameter_tvb, ERROR_CODE_OFFSET, ERROR_CODE_LENGTH, ENC_BIG_ENDIAN);
656 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, ERROR_CODE_OFFSET), v6_error_code_values, "unknown"));
659 static const value_string v7_error_code_values[] = {
660 { 1, "Invalid version" },
661 { 2, "Invalid network appearance" },
662 { 3, "Unsupported message class" },
663 { 4, "Unsupported message type" },
664 { 5, "Invalid traffic handling mode" },
665 { 6, "Unexpected message" },
666 { 7, "Protocol error" },
667 { 8, "Invalid routing context" },
668 { 9, "Invalid stream identifier" },
669 { 10, "Invalid parameter value" },
670 { 11, "Refused - Management Blocking" },
671 { 12, "Unknown Routing Context" },
672 { 0, NULL } };
675 static void
676 dissect_v7_error_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
678 proto_tree_add_item(parameter_tree, hf_v7_error_code, parameter_tvb, ERROR_CODE_OFFSET, ERROR_CODE_LENGTH, ENC_BIG_ENDIAN);
679 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, ERROR_CODE_OFFSET), v7_error_code_values, "unknown"));
682 static const value_string error_code_values[] = {
683 { 0x01, "Invalid version" },
684 { 0x03, "Unsupported message class" },
685 { 0x04, "Unsupported message type" },
686 { 0x05, "Unsupported traffic handling mode" },
687 { 0x06, "Unexpected message" },
688 { 0x07, "Protocol error" },
689 { 0x09, "Invalid stream identifier" },
690 { 0x0d, "Refused - management blocking" },
691 { 0x0e, "ASP identifier required" },
692 { 0x0f, "Invalid ASP identifier" },
693 { 0x11, "Invalid parameter value" },
694 { 0x12, "Parameter field error" },
695 { 0x13, "Unexpected parameter" },
696 { 0x14, "Destination status unknown" },
697 { 0x15, "Invalid network appearance" },
698 { 0x16, "Missing parameter" },
699 { 0x19, "Invalid routing context" },
700 { 0x1a, "No configured AS for ASP" },
701 { 0, NULL } };
703 static void
704 dissect_error_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
706 proto_tree_add_item(parameter_tree, hf_error_code, parameter_tvb, ERROR_CODE_OFFSET, ERROR_CODE_LENGTH, ENC_BIG_ENDIAN);
707 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, ERROR_CODE_OFFSET), error_code_values, "unknown"));
710 #define AS_STATE_CHANGE_TYPE 1
711 #define OTHER_TYPE 2
713 static const value_string status_type_values[] = {
714 { AS_STATE_CHANGE_TYPE, "Application server state change" },
715 { OTHER_TYPE, "Other" },
716 { 0, NULL } };
718 #define RESERVED_INFO 1
719 #define AS_INACTIVE_INFO 2
720 #define AS_ACTIVE_INFO 3
721 #define AS_PENDING_INFO 4
723 #define INSUFFICIENT_ASP_RES_INFO 1
724 #define ALTERNATE_ASP_ACTIVE_INFO 2
725 #define ASP_FAILURE_INFO 3
727 static const value_string v567_status_type_info_values[] = {
728 { AS_STATE_CHANGE_TYPE * 256 * 256 + RESERVED_INFO, "Reserved" },
729 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_INACTIVE_INFO, "Application server inactive" },
730 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_ACTIVE_INFO, "Application server active" },
731 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_PENDING_INFO, "Application server pending" },
732 { OTHER_TYPE * 256 * 256 + INSUFFICIENT_ASP_RES_INFO, "Insufficient ASP resources active in AS" },
733 { OTHER_TYPE * 256 * 256 + ALTERNATE_ASP_ACTIVE_INFO, "Alternate ASP active" },
734 {0, NULL } };
737 #define STATUS_TYPE_LENGTH 2
738 #define STATUS_INFO_LENGTH 2
740 #define STATUS_TYPE_OFFSET PARAMETER_VALUE_OFFSET
741 #define STATUS_INFO_OFFSET (STATUS_TYPE_OFFSET + STATUS_TYPE_LENGTH)
743 static void
744 dissect_v567_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
746 uint16_t status_type, status_info;
748 status_type = tvb_get_ntohs(parameter_tvb, STATUS_TYPE_OFFSET);
749 status_info = tvb_get_ntohs(parameter_tvb, STATUS_INFO_OFFSET);
751 proto_tree_add_item(parameter_tree, hf_status_type, parameter_tvb, STATUS_TYPE_OFFSET, STATUS_TYPE_LENGTH, ENC_BIG_ENDIAN);
752 proto_tree_add_uint_format_value(parameter_tree, hf_status_info, parameter_tvb, STATUS_INFO_OFFSET, STATUS_INFO_LENGTH, status_info,
753 "%s (%u)", val_to_str_const(status_type * 256 * 256 + status_info, v567_status_type_info_values, "unknown"), status_info);
755 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(status_type * 256 * 256 + status_info, v567_status_type_info_values, "unknown status information"));
758 static const value_string status_type_info_values[] = {
759 { AS_STATE_CHANGE_TYPE * 256 * 256 + RESERVED_INFO, "Reserved" },
760 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_INACTIVE_INFO, "Application server inactive" },
761 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_ACTIVE_INFO, "Application server active" },
762 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_PENDING_INFO, "Application server pending" },
763 { OTHER_TYPE * 256 * 256 + INSUFFICIENT_ASP_RES_INFO, "Insufficient ASP resources active in AS" },
764 { OTHER_TYPE * 256 * 256 + ALTERNATE_ASP_ACTIVE_INFO, "Alternate ASP active" },
765 { OTHER_TYPE * 256 * 256 + ASP_FAILURE_INFO, "ASP Failure" },
766 {0, NULL } };
768 static void
769 dissect_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
771 uint16_t status_type, status_info;
773 status_type = tvb_get_ntohs(parameter_tvb, STATUS_TYPE_OFFSET);
774 status_info = tvb_get_ntohs(parameter_tvb, STATUS_INFO_OFFSET);
776 proto_tree_add_item(parameter_tree, hf_status_type, parameter_tvb, STATUS_TYPE_OFFSET, STATUS_TYPE_LENGTH, ENC_BIG_ENDIAN);
777 proto_tree_add_uint_format_value(parameter_tree, hf_status_info, parameter_tvb, STATUS_INFO_OFFSET, STATUS_INFO_LENGTH, status_info,
778 "%s (%u)", val_to_str_const(status_type * 256 * 256 + status_info, status_type_info_values, "unknown"), status_info);
780 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(status_type * 256 * 256 + status_info, status_type_info_values, "unknown status information"));
783 static const value_string congestion_level_values[] = {
784 { 0, "No congestion or undefined" },
785 { 1, "Congestion level 1" },
786 { 2, "Congestion level 2" },
787 { 3, "Congestion level 3" },
788 { 0, NULL } };
790 #define CONG_IND_RESERVED_LENGTH 3
791 #define CONG_IND_LEVEL_LENGTH 1
793 #define CONG_IND_RESERVED_OFFSET PARAMETER_VALUE_OFFSET
794 #define CONG_IND_LEVEL_OFFSET (CONG_IND_RESERVED_OFFSET + CONG_IND_RESERVED_LENGTH)
796 static void
797 dissect_congestion_indication_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
799 proto_tree_add_item(parameter_tree, hf_congestion_reserved, parameter_tvb, CONG_IND_RESERVED_OFFSET, CONG_IND_RESERVED_LENGTH, ENC_NA);
800 proto_tree_add_item(parameter_tree, hf_congestion_level, parameter_tvb, CONG_IND_LEVEL_OFFSET, CONG_IND_LEVEL_LENGTH, ENC_BIG_ENDIAN);
801 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_uint8(parameter_tvb, CONG_IND_LEVEL_OFFSET), congestion_level_values, "unknown"));
804 #define ASP_IDENTIFIER_OFFSET PARAMETER_VALUE_OFFSET
805 #define ASP_IDENTIFIER_LENGTH 4
807 static void
808 dissect_asp_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
810 proto_tree_add_item(parameter_tree, hf_asp_identifier, parameter_tvb, ASP_IDENTIFIER_OFFSET, ASP_IDENTIFIER_LENGTH, ENC_BIG_ENDIAN);
811 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, ASP_IDENTIFIER_OFFSET));
814 #define PROTOCOL_DATA_1_OFFSET PARAMETER_VALUE_OFFSET
816 static void
817 dissect_protocol_data_1_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_item *parameter_item)
819 uint16_t protocol_data_length;
820 tvbuff_t *payload_tvb;
822 protocol_data_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
823 payload_tvb = tvb_new_subset_length(parameter_tvb, PROTOCOL_DATA_1_OFFSET, protocol_data_length);
824 proto_item_append_text(parameter_item, " (SS7 message of %u byte%s)", protocol_data_length, plurality(protocol_data_length, "", "s"));
825 proto_item_set_len(parameter_item, PARAMETER_HEADER_LENGTH);
826 call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
829 #define LI_OCTETT_LENGTH 1
830 #define LI_OCTETT_OFFSET PARAMETER_VALUE_OFFSET
831 #define PROTOCOL_DATA_2_OFFSET (PARAMETER_VALUE_OFFSET + LI_OCTETT_LENGTH)
833 static void
834 dissect_protocol_data_2_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree, proto_item *parameter_item)
836 uint16_t protocol_data_length;
837 tvbuff_t *payload_tvb;
839 protocol_data_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH - LI_OCTETT_LENGTH;
840 payload_tvb = tvb_new_subset_length(parameter_tvb, PROTOCOL_DATA_2_OFFSET, protocol_data_length);
841 proto_tree_add_item(parameter_tree, hf_li, parameter_tvb, LI_OCTETT_OFFSET, LI_OCTETT_LENGTH, ENC_BIG_ENDIAN);
842 proto_item_append_text(parameter_item, " (SS7 message of %u byte%s)", protocol_data_length, plurality(protocol_data_length, "", "s"));
843 proto_item_set_len(parameter_item, PARAMETER_HEADER_LENGTH + LI_OCTETT_LENGTH);
844 call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
849 #define CON_DEST_RESERVED_LENGTH 1
850 #define CON_DEST_PC_LENGTH 3
852 #define CON_DEST_RESERVED_OFFSET PARAMETER_VALUE_OFFSET
853 #define CON_DEST_PC_OFFSET (CON_DEST_RESERVED_OFFSET + CON_DEST_RESERVED_LENGTH)
855 static void
856 dissect_concerned_destination_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
858 proto_item *item;
860 proto_tree_add_item(parameter_tree, hf_concerned_dest_reserved, parameter_tvb, CON_DEST_RESERVED_OFFSET, CON_DEST_RESERVED_LENGTH, ENC_NA);
861 item = proto_tree_add_item(parameter_tree, hf_concerned_dest_pc, parameter_tvb, CON_DEST_PC_OFFSET, CON_DEST_PC_LENGTH, ENC_BIG_ENDIAN);
862 if (mtp3_pc_structured())
863 proto_item_append_text(item, " (%s)", mtp3_pc_to_str(tvb_get_ntoh24(parameter_tvb, CON_DEST_PC_OFFSET)));
864 proto_item_append_text(parameter_item, " (%s)", mtp3_pc_to_str(tvb_get_ntoh24(parameter_tvb, CON_DEST_PC_OFFSET)));
867 static void
868 // NOLINTNEXTLINE(misc-no-recursion)
869 dissect_routing_key_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
871 tvbuff_t *parameters_tvb;
872 uint16_t length, parameters_length;
874 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
875 parameters_length = length - PARAMETER_HEADER_LENGTH;
876 parameters_tvb = tvb_new_subset_length(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length);
877 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
880 static const value_string registration_result_status_values[] = {
881 { 0, "Successfully Registered" } ,
882 { 1, "Error - Unknown" } ,
883 { 2, "Error - Invalid DPC" } ,
884 { 3, "Error - Invalid Network Appearance" } ,
885 { 4, "Error - Invalid Routing Key" } ,
886 { 5, "Error - Permission Denied" } ,
887 { 6, "Error - Overlapping (Non-unique) Routing Key" } ,
888 { 7, "Error - Routing Key not Provisioned" } ,
889 { 8, "Error - Insufficient Resources" } ,
890 { 0, NULL } };
892 #define REG_RES_IDENTIFIER_LENGTH 4
893 #define REG_RES_STATUS_LENGTH 4
894 #define REG_RES_CONTEXT_LENGTH 4
896 #define REG_RES_IDENTIFIER_OFFSET PARAMETER_VALUE_OFFSET
897 #define REG_RES_STATUS_OFFSET (REG_RES_IDENTIFIER_OFFSET + REG_RES_IDENTIFIER_LENGTH)
898 #define REG_RES_CONTEXT_OFFSET (REG_RES_STATUS_OFFSET + REG_RES_STATUS_LENGTH)
900 static void
901 dissect_v67_registration_result_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
903 proto_tree_add_item(parameter_tree, hf_registration_result_identifier, parameter_tvb, REG_RES_IDENTIFIER_OFFSET, REG_RES_IDENTIFIER_LENGTH, ENC_BIG_ENDIAN);
904 proto_tree_add_item(parameter_tree, hf_registration_result_status, parameter_tvb, REG_RES_STATUS_OFFSET, REG_RES_STATUS_LENGTH, ENC_BIG_ENDIAN);
905 proto_tree_add_item(parameter_tree, hf_registration_result_context, parameter_tvb, REG_RES_CONTEXT_OFFSET, REG_RES_CONTEXT_LENGTH, ENC_BIG_ENDIAN);
908 static void
909 // NOLINTNEXTLINE(misc-no-recursion)
910 dissect_registration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
912 tvbuff_t *parameters_tvb;
913 uint16_t length, parameters_length;
915 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
916 parameters_length = length - PARAMETER_HEADER_LENGTH;
917 parameters_tvb = tvb_new_subset_length(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length);
918 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
921 static const value_string v6_deregistration_result_status_values[] = {
922 { 0, "Successfully De-registered" } ,
923 { 1, "Error - Unknown" } ,
924 { 2, "Error - Invalid Routing context" } ,
925 { 3, "Error - Permission Denied" } ,
926 { 4, "Error - Not registered" } ,
927 { 0, NULL } };
929 #define DEREG_RES_CONTEXT_LENGTH 4
930 #define DEREG_RES_STATUS_LENGTH 4
932 #define DEREG_RES_CONTEXT_OFFSET PARAMETER_VALUE_OFFSET
933 #define DEREG_RES_STATUS_OFFSET (DEREG_RES_CONTEXT_OFFSET + DEREG_RES_CONTEXT_LENGTH)
935 static void
936 dissect_v67_deregistration_result_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
938 proto_tree_add_item(parameter_tree, hf_v6_deregistration_result_context, parameter_tvb, DEREG_RES_CONTEXT_OFFSET, DEREG_RES_CONTEXT_LENGTH, ENC_BIG_ENDIAN);
939 proto_tree_add_item(parameter_tree, hf_v6_deregistration_result_status, parameter_tvb, DEREG_RES_STATUS_OFFSET, DEREG_RES_STATUS_LENGTH, ENC_BIG_ENDIAN);
942 static void
943 // NOLINTNEXTLINE(misc-no-recursion)
944 dissect_deregistration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
946 tvbuff_t *parameters_tvb;
947 uint16_t length, parameters_length;
949 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
950 parameters_length = length - PARAMETER_HEADER_LENGTH;
951 parameters_tvb = tvb_new_subset_length(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length);
952 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
956 #define LOCAL_RK_IDENTIFIER_OFFSET PARAMETER_VALUE_OFFSET
957 #define LOCAL_RK_IDENTIFIER_LENGTH 4
959 static void
960 dissect_local_routing_key_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
962 proto_tree_add_item(parameter_tree, hf_local_rk_identifier, parameter_tvb, LOCAL_RK_IDENTIFIER_OFFSET, LOCAL_RK_IDENTIFIER_LENGTH, ENC_BIG_ENDIAN);
963 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, LOCAL_RK_IDENTIFIER_OFFSET));
966 #define DPC_MASK_LENGTH 1
967 #define DPC_PC_LENGTH 3
969 #define DPC_MASK_OFFSET PARAMETER_VALUE_OFFSET
970 #define DPC_PC_OFFSET (DPC_MASK_OFFSET + DPC_MASK_LENGTH)
972 static void
973 dissect_destination_point_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
975 proto_item *item;
977 proto_tree_add_item(parameter_tree, hf_dpc_mask, parameter_tvb, DPC_MASK_OFFSET, DPC_MASK_LENGTH, ENC_BIG_ENDIAN);
978 item = proto_tree_add_item(parameter_tree, hf_dpc_pc, parameter_tvb, DPC_PC_OFFSET, DPC_PC_LENGTH, ENC_BIG_ENDIAN);
979 if (mtp3_pc_structured())
980 proto_item_append_text(item, " (%s)", mtp3_pc_to_str(tvb_get_ntoh24(parameter_tvb, DPC_PC_OFFSET)));
981 proto_item_append_text(parameter_item, " (%s)", mtp3_pc_to_str(tvb_get_ntoh24(parameter_tvb, DPC_PC_OFFSET)));
984 #define SI_LENGTH 1
986 static void
987 dissect_service_indicators_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
989 uint16_t length, number_of_sis, si_number;
990 int si_offset;
992 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
993 number_of_sis = length - PARAMETER_HEADER_LENGTH;
995 si_offset = PARAMETER_VALUE_OFFSET;
996 for(si_number=0; si_number < number_of_sis; si_number++) {
997 proto_tree_add_item(parameter_tree, hf_si, parameter_tvb, si_offset, SI_LENGTH, ENC_BIG_ENDIAN);
998 si_offset += SI_LENGTH;
1000 proto_item_append_text(parameter_item, " (%u indicator%s)", number_of_sis, plurality(number_of_sis, "", "s"));
1003 #define SSN_LENGTH 1
1005 static void
1006 dissect_subsystem_numbers_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1008 uint16_t length, number_of_ssns, ssn_number;
1009 int ssn_offset;
1011 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
1012 number_of_ssns = length - PARAMETER_HEADER_LENGTH;
1014 ssn_offset = PARAMETER_VALUE_OFFSET;
1015 for(ssn_number=0; ssn_number < number_of_ssns; ssn_number++) {
1016 proto_tree_add_item(parameter_tree, hf_ssn, parameter_tvb, ssn_offset, SSN_LENGTH, ENC_BIG_ENDIAN);
1017 ssn_offset += SSN_LENGTH;
1019 proto_item_append_text(parameter_item, " (%u number%s)", number_of_ssns, plurality(number_of_ssns, "", "s"));
1023 #define OPC_MASK_LENGTH 1
1024 #define OPC_PC_LENGTH 3
1025 #define OPC_LENGTH (OPC_MASK_LENGTH + OPC_PC_LENGTH)
1026 #define OPC_MASK_OFFSET 0
1027 #define OPC_PC_OFFSET (OPC_MASK_OFFSET + OPC_MASK_LENGTH)
1029 static void
1030 dissect_originating_point_code_list_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1032 uint16_t length, number_of_point_codes, point_code_number;
1033 int point_code_offset;
1034 proto_item *item;
1036 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
1037 number_of_point_codes = (length - PARAMETER_HEADER_LENGTH) / 4;
1039 point_code_offset = PARAMETER_VALUE_OFFSET;
1040 for(point_code_number=0; point_code_number < number_of_point_codes; point_code_number++) {
1041 proto_tree_add_item(parameter_tree, hf_opc_list_mask, parameter_tvb, point_code_offset + OPC_MASK_OFFSET, OPC_MASK_LENGTH, ENC_BIG_ENDIAN);
1042 item = proto_tree_add_item(parameter_tree, hf_opc_list_pc, parameter_tvb, point_code_offset + OPC_PC_OFFSET, OPC_PC_LENGTH, ENC_BIG_ENDIAN);
1043 if (mtp3_pc_structured())
1044 proto_item_append_text(item, " (%s)", mtp3_pc_to_str(tvb_get_ntoh24(parameter_tvb, point_code_offset + OPC_PC_OFFSET)));
1045 point_code_offset += OPC_LENGTH;
1047 proto_item_append_text(parameter_item, " (%u point code%s)", number_of_point_codes, plurality(number_of_point_codes, "", "s"));
1050 #define CIC_RANGE_MASK_LENGTH 1
1051 #define CIC_RANGE_PC_LENGTH 3
1052 #define CIC_RANGE_LOWER_LENGTH 2
1053 #define CIC_RANGE_UPPER_LENGTH 2
1054 #define CIC_RANGE_LENGTH (CIC_RANGE_MASK_LENGTH + CIC_RANGE_PC_LENGTH + CIC_RANGE_LOWER_LENGTH + CIC_RANGE_UPPER_LENGTH)
1055 #define CIC_RANGE_MASK_OFFSET 0
1056 #define CIC_RANGE_PC_OFFSET (CIC_RANGE_MASK_OFFSET + CIC_RANGE_MASK_LENGTH)
1057 #define CIC_RANGE_LOWER_OFFSET (CIC_RANGE_PC_OFFSET + CIC_RANGE_PC_LENGTH)
1058 #define CIC_RANGE_UPPER_OFFSET (CIC_RANGE_LOWER_OFFSET + CIC_RANGE_LOWER_LENGTH)
1060 static void
1061 dissect_circuit_range_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1063 uint16_t length, number_of_point_codes, point_code_number, cic_low, cic_high;
1064 uint32_t pc;
1065 int point_code_offset;
1066 proto_item *pc_item, *cic_range_item;
1067 proto_tree *cic_range_tree;
1068 char *pc_string;
1070 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
1071 number_of_point_codes = (length - PARAMETER_HEADER_LENGTH) / CIC_RANGE_LENGTH;
1073 point_code_offset = PARAMETER_VALUE_OFFSET;
1074 for(point_code_number = 0; point_code_number < number_of_point_codes; point_code_number++) {
1075 cic_range_tree = proto_tree_add_subtree(parameter_tree, parameter_tvb, point_code_offset + CIC_RANGE_MASK_OFFSET, CIC_RANGE_LENGTH, ett_parameter, &cic_range_item, "CIC range");
1077 proto_tree_add_item(cic_range_tree, hf_cic_range_mask, parameter_tvb, point_code_offset + CIC_RANGE_MASK_OFFSET, CIC_RANGE_MASK_LENGTH, ENC_BIG_ENDIAN);
1079 pc = tvb_get_ntoh24(parameter_tvb, point_code_offset + CIC_RANGE_PC_OFFSET);
1080 pc_string = mtp3_pc_to_str(pc);
1081 pc_item = proto_tree_add_item(cic_range_tree, hf_cic_range_pc, parameter_tvb, point_code_offset + CIC_RANGE_PC_OFFSET, CIC_RANGE_PC_LENGTH, ENC_BIG_ENDIAN);
1082 if (mtp3_pc_structured())
1083 proto_item_append_text(pc_item, " (%s)", pc_string);
1085 cic_low = tvb_get_ntohs(parameter_tvb, point_code_offset + CIC_RANGE_LOWER_OFFSET);
1086 proto_tree_add_item(cic_range_tree, hf_cic_range_lower, parameter_tvb, point_code_offset + CIC_RANGE_LOWER_OFFSET, CIC_RANGE_LOWER_LENGTH, ENC_BIG_ENDIAN);
1087 cic_high = tvb_get_ntohs(parameter_tvb, point_code_offset + CIC_RANGE_UPPER_OFFSET);
1088 proto_tree_add_item(cic_range_tree, hf_cic_range_upper, parameter_tvb, point_code_offset + CIC_RANGE_UPPER_OFFSET, CIC_RANGE_UPPER_LENGTH, ENC_BIG_ENDIAN);
1090 proto_item_append_text(cic_range_item, " (%s: %d-%d)", pc_string, cic_low, cic_high);
1091 point_code_offset += CIC_RANGE_LENGTH;
1093 proto_item_append_text(parameter_item, " (%u range%s)", number_of_point_codes, plurality(number_of_point_codes, "", "s"));
1096 #define DATA_OPC_LENGTH 4
1097 #define DATA_DPC_LENGTH 4
1098 #define DATA_SI_LENGTH 1
1099 #define DATA_NI_LENGTH 1
1100 #define DATA_MP_LENGTH 1
1101 #define DATA_SLS_LENGTH 1
1102 #define DATA_HDR_LENGTH (DATA_OPC_LENGTH + DATA_DPC_LENGTH + DATA_SI_LENGTH + DATA_NI_LENGTH + DATA_MP_LENGTH + DATA_SLS_LENGTH)
1104 #define DATA_OPC_OFFSET PARAMETER_VALUE_OFFSET
1105 #define DATA_DPC_OFFSET (DATA_OPC_OFFSET + DATA_OPC_LENGTH)
1106 #define DATA_SI_OFFSET (DATA_DPC_OFFSET + DATA_DPC_LENGTH)
1107 #define DATA_NI_OFFSET (DATA_SI_OFFSET + DATA_SI_LENGTH)
1108 #define DATA_MP_OFFSET (DATA_NI_OFFSET + DATA_NI_LENGTH)
1109 #define DATA_SLS_OFFSET (DATA_MP_OFFSET + DATA_MP_LENGTH)
1110 #define DATA_ULP_OFFSET (DATA_SLS_OFFSET + DATA_SLS_LENGTH)
1112 static unsigned
1113 m3ua_heur_mtp3_standard(tvbuff_t *tvb, packet_info *pinfo, uint32_t opc, uint32_t dpc, uint8_t si)
1115 switch (si) {
1116 case MTP_SI_SCCP:
1118 if (opc < ITU_PC_MASK && dpc < ITU_PC_MASK &&
1119 looks_like_valid_sccp(pinfo->num, tvb, ITU_STANDARD)) {
1121 return ITU_STANDARD;
1123 /* Network 0 is reserved in ANSI */
1124 /* Could also check that cluster!=0 for small networks (networks 1-5) */
1125 if ((opc & ANSI_NETWORK_MASK) > 0 && (dpc & ANSI_NETWORK_MASK) > 0 &&
1126 looks_like_valid_sccp(pinfo->num, tvb, ANSI_STANDARD)) {
1128 return ANSI_STANDARD;
1130 if (looks_like_valid_sccp(pinfo->num, tvb, CHINESE_ITU_STANDARD)) {
1131 return CHINESE_ITU_STANDARD;
1133 if (opc < JAPAN_PC_MASK && dpc < JAPAN_PC_MASK &&
1134 looks_like_valid_sccp(pinfo->num, tvb, JAPAN_STANDARD)) {
1136 return JAPAN_STANDARD;
1139 return HEURISTIC_FAILED_STANDARD;
1142 default:
1143 return HEURISTIC_FAILED_STANDARD;
1147 static void
1148 m3ua_reset_mtp3_standard(void)
1150 mtp3_standard = m3ua_pref_mtp3_standard;
1153 static void
1154 dissect_protocol_data_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree, proto_item *parameter_item)
1156 uint16_t ulp_length;
1157 tvbuff_t *payload_tvb;
1158 proto_item *item, *gen_item;
1159 mtp3_tap_rec_t* mtp3_tap;
1160 proto_tree *q708_tree;
1161 int heuristic_standard;
1162 uint8_t si;
1163 uint32_t opc, dpc;
1165 mtp3_tap = wmem_new0(pinfo->pool, mtp3_tap_rec_t);
1167 si = tvb_get_uint8(parameter_tvb, DATA_SI_OFFSET);
1168 ulp_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH - DATA_HDR_LENGTH;
1169 payload_tvb = tvb_new_subset_length(parameter_tvb, DATA_ULP_OFFSET, ulp_length);
1170 dpc = tvb_get_ntohl(parameter_tvb, DATA_DPC_OFFSET);
1171 opc = tvb_get_ntohl(parameter_tvb, DATA_OPC_OFFSET);
1173 m3ua_pref_mtp3_standard = mtp3_standard;
1175 if (mtp3_heuristic_standard) {
1176 heuristic_standard = m3ua_heur_mtp3_standard(payload_tvb, pinfo, opc, dpc, si);
1177 if (heuristic_standard == HEURISTIC_FAILED_STANDARD) {
1178 gen_item = proto_tree_add_uint_format(tree, hf_heuristic_standard, parameter_tvb, 0, 0, heuristic_standard,
1179 "Could not determine Heuristic using %s", val_to_str_const(mtp3_standard, mtp3_standard_vals, "unknown"));
1180 } else {
1181 gen_item = proto_tree_add_uint_format(tree, hf_heuristic_standard, parameter_tvb, 0, 0, heuristic_standard,
1182 "%s", val_to_str_const(heuristic_standard, mtp3_standard_vals, "unknown"));
1184 mtp3_standard = heuristic_standard;
1186 /* Register a frame-end routine to ensure mtp3_standard is set
1187 * back even if an exception is thrown.
1189 register_frame_end_routine(pinfo, m3ua_reset_mtp3_standard);
1191 proto_item_set_generated(gen_item);
1194 mtp3_tap->addr_dpc.type = (Standard_Type)mtp3_standard;
1195 mtp3_tap->addr_dpc.pc = dpc;
1196 mtp3_tap->addr_dpc.ni = tvb_get_uint8(parameter_tvb, DATA_NI_OFFSET);
1197 set_address(&pinfo->dst, ss7pc_address_type, sizeof(mtp3_addr_pc_t), (uint8_t *) &mtp3_tap->addr_dpc);
1200 mtp3_tap->addr_opc.type = (Standard_Type)mtp3_standard;
1201 mtp3_tap->addr_opc.pc = opc;
1202 mtp3_tap->addr_opc.ni = tvb_get_uint8(parameter_tvb, DATA_NI_OFFSET);
1203 set_address(&pinfo->src, ss7pc_address_type, sizeof(mtp3_addr_pc_t), (uint8_t *) &mtp3_tap->addr_opc);
1205 mtp3_tap->mtp3_si_code = tvb_get_uint8(parameter_tvb, DATA_SI_OFFSET);
1206 mtp3_tap->size = 0;
1208 tap_queue_packet(m3ua_tap, pinfo, mtp3_tap);
1210 ulp_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH - DATA_HDR_LENGTH;
1212 if (parameter_tree) {
1213 item = proto_tree_add_item(parameter_tree, hf_protocol_data_opc, parameter_tvb, DATA_OPC_OFFSET, DATA_OPC_LENGTH, ENC_BIG_ENDIAN);
1214 if (mtp3_pc_structured())
1215 proto_item_append_text(item, " (%s)", mtp3_pc_to_str(opc));
1216 if(mtp3_tap->addr_opc.ni == MTP3_NI_INT0) {
1217 q708_tree = proto_item_add_subtree(item,ett_q708_opc);
1218 /* Q.708 (1984-10) Numbering of International Signalling Point Codes */
1219 analyze_q708_ispc(parameter_tvb, q708_tree, DATA_OPC_OFFSET, DATA_OPC_LENGTH, opc);
1222 item = proto_tree_add_item(parameter_tree, hf_protocol_data_dpc, parameter_tvb, DATA_DPC_OFFSET, DATA_DPC_LENGTH, ENC_BIG_ENDIAN);
1223 if (mtp3_pc_structured())
1224 proto_item_append_text(item, " (%s)", mtp3_pc_to_str(dpc));
1225 if(mtp3_tap->addr_dpc.ni == MTP3_NI_INT0) {
1226 q708_tree = proto_item_add_subtree(item,ett_q708_dpc);
1227 analyze_q708_ispc(parameter_tvb, q708_tree, DATA_DPC_OFFSET, DATA_DPC_LENGTH, dpc);
1230 proto_tree_add_item(parameter_tree, hf_protocol_data_si, parameter_tvb, DATA_SI_OFFSET, DATA_SI_LENGTH, ENC_BIG_ENDIAN);
1231 proto_tree_add_item(parameter_tree, hf_protocol_data_ni, parameter_tvb, DATA_NI_OFFSET, DATA_NI_LENGTH, ENC_BIG_ENDIAN);
1232 proto_tree_add_item(parameter_tree, hf_protocol_data_mp, parameter_tvb, DATA_MP_OFFSET, DATA_MP_LENGTH, ENC_BIG_ENDIAN);
1233 proto_tree_add_item(parameter_tree, hf_protocol_data_sls, parameter_tvb, DATA_SLS_OFFSET, DATA_SLS_LENGTH, ENC_BIG_ENDIAN);
1235 proto_item_append_text(parameter_item, " (SS7 message of %u byte%s)", ulp_length, plurality(ulp_length, "", "s"));
1236 proto_item_set_len(parameter_item, PARAMETER_HEADER_LENGTH + DATA_HDR_LENGTH);
1238 parameter_tree = proto_tree_add_subtree(parameter_tree,parameter_tvb,0,0,ett_mtp3_equiv,&item,"MTP3 equivalents");
1239 proto_item_set_generated(item);
1241 item = proto_tree_add_item(parameter_tree, hf_protocol_data_mtp3_opc, parameter_tvb, DATA_OPC_OFFSET, DATA_OPC_LENGTH, ENC_BIG_ENDIAN);
1242 proto_item_set_generated(item);
1243 item = proto_tree_add_item(parameter_tree, hf_protocol_data_mtp3_dpc, parameter_tvb, DATA_DPC_OFFSET, DATA_OPC_LENGTH, ENC_BIG_ENDIAN);
1244 proto_item_set_generated(item);
1245 item = proto_tree_add_item(parameter_tree, hf_protocol_data_mtp3_pc, parameter_tvb, DATA_OPC_OFFSET, DATA_OPC_LENGTH, ENC_BIG_ENDIAN);
1246 proto_item_set_generated(item);
1247 item = proto_tree_add_item(parameter_tree, hf_protocol_data_mtp3_pc, parameter_tvb, DATA_DPC_OFFSET, DATA_OPC_LENGTH, ENC_BIG_ENDIAN);
1248 proto_item_set_generated(item);
1249 item = proto_tree_add_item(parameter_tree, hf_protocol_data_mtp3_ni, parameter_tvb, DATA_NI_OFFSET, DATA_NI_LENGTH, ENC_BIG_ENDIAN);
1250 proto_item_set_generated(item);
1251 item = proto_tree_add_item(parameter_tree, hf_protocol_data_mtp3_sls, parameter_tvb, DATA_SLS_OFFSET, DATA_SLS_LENGTH, ENC_BIG_ENDIAN);
1252 proto_item_set_generated(item);
1254 }/* parameter_tree */
1256 payload_tvb = tvb_new_subset_length(parameter_tvb, DATA_ULP_OFFSET, ulp_length);
1257 if (!dissector_try_uint(si_dissector_table, tvb_get_uint8(parameter_tvb, DATA_SI_OFFSET), payload_tvb, pinfo, tree))
1258 call_data_dissector(payload_tvb, pinfo, tree);
1260 mtp3_standard = m3ua_pref_mtp3_standard;
1263 #define CORR_ID_OFFSET PARAMETER_VALUE_OFFSET
1264 #define CORR_ID_LENGTH 4
1266 static void
1267 dissect_correlation_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1269 proto_tree_add_item(parameter_tree, hf_correlation_identifier, parameter_tvb, CORR_ID_OFFSET, CORR_ID_LENGTH, ENC_BIG_ENDIAN);
1270 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, CORR_ID_OFFSET));
1273 #define REG_STATUS_LENGTH 4
1274 #define REG_STATUS_OFFSET PARAMETER_VALUE_OFFSET
1276 static const value_string registration_status_values[] = {
1277 { 0, "Successfully Registered" },
1278 { 1, "Error - Unknown" },
1279 { 2, "Error - Invalid DPC" },
1280 { 3, "Error - Invalid Network Appearance" },
1281 { 4, "Error - Invalid Routing Key" },
1282 { 5, "Error - Permission Denied" },
1283 { 6, "Error - Cannot Support Unique Routing" },
1284 { 7, "Error - Routing Key not Currently Provisioned" },
1285 { 8, "Error - Insufficient Resources" },
1286 { 9, "Error - Unsupported RK parameter Field" },
1287 { 10, "Error - Unsupported/Invalid Traffic Handling Mode" },
1288 { 11, "Error - Routing Key Change Refused" },
1289 { 12, "Error - Routing Key Already Registered" },
1290 { 0, NULL } };
1292 static void
1293 dissect_registration_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1295 proto_tree_add_item(parameter_tree, hf_registration_status, parameter_tvb, REG_STATUS_OFFSET, REG_STATUS_LENGTH, ENC_BIG_ENDIAN);
1296 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, REG_STATUS_OFFSET), registration_status_values, "unknown"));
1299 #define DEREG_STATUS_LENGTH 4
1300 #define DEREG_STATUS_OFFSET PARAMETER_VALUE_OFFSET
1302 static const value_string deregistration_status_values[] = {
1303 { 0, "Successfully Deregistered" },
1304 { 1, "Error - Unknown" },
1305 { 2, "Error - Invalid Routing Context" },
1306 { 3, "Error - Permission Denied" },
1307 { 4, "Error - Not Registered" },
1308 { 5, "Error - ASP Currently Active for Routing Context" },
1309 { 0, NULL } };
1311 static void
1312 dissect_deregistration_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1314 proto_tree_add_item(parameter_tree, hf_deregistration_status, parameter_tvb, DEREG_STATUS_OFFSET, DEREG_STATUS_LENGTH, ENC_BIG_ENDIAN);
1315 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, DEREG_STATUS_OFFSET), deregistration_status_values, "unknown"));
1318 static void
1319 // NOLINTNEXTLINE(misc-no-recursion)
1320 dissect_registration_results_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
1322 tvbuff_t *parameters_tvb;
1323 uint16_t parameters_length;
1325 parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
1326 parameters_tvb = tvb_new_subset_length(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length);
1327 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
1330 static void
1331 // NOLINTNEXTLINE(misc-no-recursion)
1332 dissect_deregistration_results_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
1334 tvbuff_t *parameters_tvb;
1335 uint16_t parameters_length;
1337 parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
1338 parameters_tvb = tvb_new_subset_length(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length);
1339 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
1342 static void
1343 dissect_unknown_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
1345 uint16_t tag, parameter_value_length;
1347 tag = tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET);
1348 parameter_value_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
1349 proto_tree_add_item(parameter_tree, hf_parameter_value, parameter_tvb, PARAMETER_VALUE_OFFSET, parameter_value_length, ENC_NA);
1350 proto_item_append_text(parameter_item, " (tag %u and %u byte%s value)", tag, parameter_value_length, plurality(parameter_value_length, "", "s"));
1353 #define V5_NETWORK_APPEARANCE_PARAMETER_TAG 1
1354 #define V5_PROTOCOL_DATA_PARAMETER_TAG 3
1355 #define V5_INFO_PARAMETER_TAG 4
1356 #define V5_AFFECTED_DESTINATIONS_PARAMETER_TAG 5
1357 #define V5_ROUTING_CONTEXT_PARAMETER_TAG 6
1358 #define V5_DIAGNOSTIC_INFORMATION_PARAMETER_TAG 7
1359 #define V5_HEARTBEAT_DATA_PARAMETER_TAG 8
1360 #define V5_USER_CAUSE_PARAMETER_TAG 9
1361 #define V5_REASON_PARAMETER_TAG 10
1362 #define V5_TRAFFIC_MODE_TYPE_PARAMETER_TAG 11
1363 #define V5_ERROR_CODE_PARAMETER_TAG 12
1364 #define V5_STATUS_PARAMETER_TAG 13
1365 #define V5_CONGESTION_INDICATION_PARAMETER_TAG 14
1367 static const value_string v5_parameter_tag_values[] = {
1368 { V5_NETWORK_APPEARANCE_PARAMETER_TAG, "Network appearance" },
1369 { V5_PROTOCOL_DATA_PARAMETER_TAG, "Protocol data" },
1370 { V5_INFO_PARAMETER_TAG, "Info" },
1371 { V5_AFFECTED_DESTINATIONS_PARAMETER_TAG, "Affected destinations" },
1372 { V5_ROUTING_CONTEXT_PARAMETER_TAG, "Routing context" },
1373 { V5_DIAGNOSTIC_INFORMATION_PARAMETER_TAG, "Diagnostic information" },
1374 { V5_HEARTBEAT_DATA_PARAMETER_TAG, "Heartbeat data" },
1375 { V5_USER_CAUSE_PARAMETER_TAG, "User / Cause" },
1376 { V5_REASON_PARAMETER_TAG, "Reason" },
1377 { V5_TRAFFIC_MODE_TYPE_PARAMETER_TAG, "Traffic mode type" },
1378 { V5_ERROR_CODE_PARAMETER_TAG, "Error code" },
1379 { V5_STATUS_PARAMETER_TAG, "Status" },
1380 { V5_CONGESTION_INDICATION_PARAMETER_TAG, "Congestion indication" },
1381 { 0, NULL } };
1383 static void
1384 dissect_v5_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
1386 uint16_t tag, length, padding_length;
1387 proto_item *parameter_item;
1388 proto_tree *parameter_tree;
1390 /* extract tag and length from the parameter */
1391 tag = tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET);
1392 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
1393 padding_length = tvb_reported_length(parameter_tvb) - length;
1395 if (!tree && tag != V5_PROTOCOL_DATA_PARAMETER_TAG)
1396 return; /* Nothing to do here */
1398 /* create proto_tree stuff */
1399 parameter_tree = proto_tree_add_subtree(m3ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, -1, ett_parameter, &parameter_item,
1400 val_to_str_const(tag, v5_parameter_tag_values, "Unknown parameter"));
1402 /* add tag and length to the parameter tree */
1403 proto_tree_add_item(parameter_tree, hf_v5_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, ENC_BIG_ENDIAN);
1404 proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
1406 switch(tag) {
1407 case V5_NETWORK_APPEARANCE_PARAMETER_TAG:
1408 dissect_network_appearance_parameter(parameter_tvb, parameter_tree, parameter_item);
1409 break;
1410 case V5_PROTOCOL_DATA_PARAMETER_TAG:
1411 dissect_v5_protocol_data_parameter(parameter_tvb, pinfo, tree, parameter_item);
1412 break;
1413 case V5_INFO_PARAMETER_TAG:
1414 dissect_info_string_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
1415 break;
1416 case V5_AFFECTED_DESTINATIONS_PARAMETER_TAG:
1417 dissect_affected_destinations_parameter(parameter_tvb, parameter_tree, parameter_item);
1418 break;
1419 case V5_ROUTING_CONTEXT_PARAMETER_TAG:
1420 dissect_routing_context_parameter(parameter_tvb, parameter_tree, parameter_item);
1421 break;
1422 case V5_DIAGNOSTIC_INFORMATION_PARAMETER_TAG:
1423 dissect_diagnostic_information_parameter(parameter_tvb, parameter_tree, parameter_item);
1424 break;
1425 case V5_HEARTBEAT_DATA_PARAMETER_TAG:
1426 dissect_heartbeat_data_parameter(parameter_tvb, parameter_tree, parameter_item);
1427 break;
1428 case V5_USER_CAUSE_PARAMETER_TAG:
1429 dissect_user_cause_parameter(parameter_tvb, parameter_tree, parameter_item);
1430 break;
1431 case V5_REASON_PARAMETER_TAG:
1432 dissect_reason_parameter(parameter_tvb, parameter_tree, parameter_item);
1433 break;
1434 case V5_TRAFFIC_MODE_TYPE_PARAMETER_TAG:
1435 dissect_v5_traffic_mode_type_parameter(parameter_tvb, parameter_tree, parameter_item);
1436 break;
1437 case V5_ERROR_CODE_PARAMETER_TAG:
1438 dissect_v5_error_code_parameter(parameter_tvb, parameter_tree, parameter_item);
1439 break;
1440 case V5_STATUS_PARAMETER_TAG:
1441 dissect_v567_status_parameter(parameter_tvb, parameter_tree, parameter_item);
1442 break;
1443 case V5_CONGESTION_INDICATION_PARAMETER_TAG:
1444 dissect_congestion_indication_parameter(parameter_tvb, parameter_tree, parameter_item);
1445 break;
1446 default:
1447 dissect_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
1448 break;
1450 if (padding_length > 0)
1451 proto_tree_add_item(parameter_tree, hf_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
1454 #define V6_NETWORK_APPEARANCE_PARAMETER_TAG 1
1455 #define V6_PROTOCOL_DATA_1_PARAMETER_TAG 2
1456 #define V6_PROTOCOL_DATA_2_PARAMETER_TAG 3
1457 #define V6_INFO_PARAMETER_TAG 4
1458 #define V6_AFFECTED_DESTINATIONS_PARAMETER_TAG 5
1459 #define V6_ROUTING_CONTEXT_PARAMETER_TAG 6
1460 #define V6_DIAGNOSTIC_INFORMATION_PARAMETER_TAG 7
1461 #define V6_HEARTBEAT_DATA_PARAMETER_TAG 8
1462 #define V6_USER_CAUSE_PARAMETER_TAG 9
1463 #define V6_REASON_PARAMETER_TAG 10
1464 #define V6_TRAFFIC_MODE_TYPE_PARAMETER_TAG 11
1465 #define V6_ERROR_CODE_PARAMETER_TAG 12
1466 #define V6_STATUS_PARAMETER_TAG 13
1467 #define V6_CONGESTION_INDICATION_PARAMETER_TAG 14
1468 #define V6_CONCERNED_DESTINATION_PARAMETER_TAG 15
1469 #define V6_ROUTING_KEY_PARAMETER_TAG 16
1470 #define V6_REGISTRATION_RESULT_PARAMETER_TAG 17
1471 #define V6_DEREGISTRATION_RESULT_PARAMETER_TAG 18
1472 #define V6_LOCAL_ROUTING_KEY_IDENTIFIER_PARAMETER_TAG 19
1473 #define V6_DESTINATION_POINT_CODE_PARAMETER_TAG 20
1474 #define V6_SERVICE_INDICATORS_PARAMETER_TAG 21
1475 #define V6_SUBSYSTEM_NUMBERS_PARAMETER_TAG 22
1476 #define V6_ORIGINATING_POINT_CODE_LIST_PARAMETER_TAG 23
1477 #define V6_CIRCUIT_RANGE_PARAMETER_TAG 24
1478 #define V6_REGISTRATION_RESULTS_PARAMETER_TAG 25
1479 #define V6_DEREGISTRATION_RESULTS_PARAMETER_TAG 26
1481 static const value_string v6_parameter_tag_values[] = {
1482 { V6_NETWORK_APPEARANCE_PARAMETER_TAG, "Network appearance" },
1483 { V6_PROTOCOL_DATA_1_PARAMETER_TAG, "Protocol data 1" },
1484 { V6_PROTOCOL_DATA_2_PARAMETER_TAG, "Protocol data 2" },
1485 { V6_INFO_PARAMETER_TAG, "Info" },
1486 { V6_AFFECTED_DESTINATIONS_PARAMETER_TAG, "Affected destinations" },
1487 { V6_ROUTING_CONTEXT_PARAMETER_TAG, "Routing context" },
1488 { V6_DIAGNOSTIC_INFORMATION_PARAMETER_TAG, "Diagnostic information" },
1489 { V6_HEARTBEAT_DATA_PARAMETER_TAG, "Heartbeat data" },
1490 { V6_USER_CAUSE_PARAMETER_TAG, "User / Cause" },
1491 { V6_REASON_PARAMETER_TAG, "Reason" },
1492 { V6_TRAFFIC_MODE_TYPE_PARAMETER_TAG, "Traffic mode type" },
1493 { V6_ERROR_CODE_PARAMETER_TAG, "Error code" },
1494 { V6_STATUS_PARAMETER_TAG, "Status" },
1495 { V6_CONGESTION_INDICATION_PARAMETER_TAG, "Congestion indication" },
1496 { V6_CONCERNED_DESTINATION_PARAMETER_TAG, "Concerned destination" },
1497 { V6_ROUTING_KEY_PARAMETER_TAG, "Routing Key" },
1498 { V6_REGISTRATION_RESULT_PARAMETER_TAG, "Registration result" },
1499 { V6_DEREGISTRATION_RESULT_PARAMETER_TAG, "De-registration result" },
1500 { V6_LOCAL_ROUTING_KEY_IDENTIFIER_PARAMETER_TAG, "Local routing key identifier" },
1501 { V6_DESTINATION_POINT_CODE_PARAMETER_TAG, "Destination point code" },
1502 { V6_SERVICE_INDICATORS_PARAMETER_TAG, "Service indicators" },
1503 { V6_SUBSYSTEM_NUMBERS_PARAMETER_TAG, "Subsystem numbers" },
1504 { V6_ORIGINATING_POINT_CODE_LIST_PARAMETER_TAG, "Originating point code list" },
1505 { V6_CIRCUIT_RANGE_PARAMETER_TAG, "Circuit range" },
1506 { V6_REGISTRATION_RESULTS_PARAMETER_TAG, "Registration results" },
1507 { V6_DEREGISTRATION_RESULTS_PARAMETER_TAG, "De-registration results" },
1508 { 0, NULL } };
1510 static void
1511 // NOLINTNEXTLINE(misc-no-recursion)
1512 dissect_v6_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
1514 uint16_t tag, length, padding_length;
1515 proto_item *parameter_item;
1516 proto_tree *parameter_tree;
1518 /* extract tag and length from the parameter */
1519 tag = tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET);
1520 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
1521 padding_length = tvb_reported_length(parameter_tvb) - length;
1523 if (!tree && tag != V6_PROTOCOL_DATA_1_PARAMETER_TAG && tag != V6_PROTOCOL_DATA_2_PARAMETER_TAG)
1524 return; /* Nothing to do here */
1526 /* create proto_tree stuff */
1527 parameter_tree = proto_tree_add_subtree(m3ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, -1,
1528 ett_parameter, &parameter_item, val_to_str_const(tag, v6_parameter_tag_values, "Unknown parameter"));
1530 /* add tag and length to the parameter tree */
1531 proto_tree_add_item(parameter_tree, hf_v6_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, ENC_BIG_ENDIAN);
1532 proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
1534 switch(tag) {
1535 case V6_NETWORK_APPEARANCE_PARAMETER_TAG:
1536 dissect_network_appearance_parameter(parameter_tvb, parameter_tree, parameter_item);
1537 break;
1538 case V6_PROTOCOL_DATA_1_PARAMETER_TAG:
1539 dissect_protocol_data_1_parameter(parameter_tvb, pinfo, tree, parameter_item);
1540 break;
1541 case V6_PROTOCOL_DATA_2_PARAMETER_TAG:
1542 dissect_protocol_data_2_parameter(parameter_tvb, pinfo, tree, parameter_tree, parameter_item);
1543 break;
1544 case V6_INFO_PARAMETER_TAG:
1545 dissect_info_string_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
1546 break;
1547 case V6_AFFECTED_DESTINATIONS_PARAMETER_TAG:
1548 dissect_affected_destinations_parameter(parameter_tvb, parameter_tree, parameter_item);
1549 break;
1550 case V6_ROUTING_CONTEXT_PARAMETER_TAG:
1551 dissect_routing_context_parameter(parameter_tvb, parameter_tree, parameter_item);
1552 break;
1553 case V6_DIAGNOSTIC_INFORMATION_PARAMETER_TAG:
1554 dissect_diagnostic_information_parameter(parameter_tvb, parameter_tree, parameter_item);
1555 break;
1556 case V6_HEARTBEAT_DATA_PARAMETER_TAG:
1557 dissect_heartbeat_data_parameter(parameter_tvb, parameter_tree, parameter_item);
1558 break;
1559 case V6_USER_CAUSE_PARAMETER_TAG:
1560 dissect_user_cause_parameter(parameter_tvb, parameter_tree, parameter_item);
1561 break;
1562 case V6_REASON_PARAMETER_TAG:
1563 dissect_reason_parameter(parameter_tvb, parameter_tree, parameter_item);
1564 break;
1565 case V6_TRAFFIC_MODE_TYPE_PARAMETER_TAG:
1566 dissect_v6_traffic_mode_type_parameter(parameter_tvb, parameter_tree, parameter_item);
1567 break;
1568 case V6_ERROR_CODE_PARAMETER_TAG:
1569 dissect_v6_error_code_parameter(parameter_tvb, parameter_tree, parameter_item);
1570 break;
1571 case V6_STATUS_PARAMETER_TAG:
1572 dissect_v567_status_parameter(parameter_tvb, parameter_tree, parameter_item);
1573 break;
1574 case V6_CONGESTION_INDICATION_PARAMETER_TAG:
1575 dissect_congestion_indication_parameter(parameter_tvb, parameter_tree, parameter_item);
1576 break;
1577 case V6_CONCERNED_DESTINATION_PARAMETER_TAG:
1578 dissect_concerned_destination_parameter(parameter_tvb, parameter_tree, parameter_item);
1579 break;
1580 case V6_ROUTING_KEY_PARAMETER_TAG:
1581 dissect_routing_key_parameter(parameter_tvb, pinfo, tree, parameter_tree);
1582 break;
1583 case V6_REGISTRATION_RESULT_PARAMETER_TAG:
1584 dissect_v67_registration_result_parameter(parameter_tvb, parameter_tree);
1585 break;
1586 case V6_DEREGISTRATION_RESULT_PARAMETER_TAG:
1587 dissect_v67_deregistration_result_parameter(parameter_tvb, parameter_tree);
1588 break;
1589 case V6_LOCAL_ROUTING_KEY_IDENTIFIER_PARAMETER_TAG:
1590 dissect_local_routing_key_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
1591 break;
1592 case V6_DESTINATION_POINT_CODE_PARAMETER_TAG:
1593 dissect_destination_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
1594 break;
1595 case V6_SERVICE_INDICATORS_PARAMETER_TAG:
1596 dissect_service_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
1597 break;
1598 case V6_SUBSYSTEM_NUMBERS_PARAMETER_TAG:
1599 dissect_subsystem_numbers_parameter(parameter_tvb, parameter_tree, parameter_item);
1600 break;
1601 case V6_ORIGINATING_POINT_CODE_LIST_PARAMETER_TAG:
1602 dissect_originating_point_code_list_parameter(parameter_tvb, parameter_tree, parameter_item);
1603 break;
1604 case V6_CIRCUIT_RANGE_PARAMETER_TAG:
1605 dissect_circuit_range_parameter(parameter_tvb, parameter_tree, parameter_item);
1606 break;
1607 case V6_REGISTRATION_RESULTS_PARAMETER_TAG:
1608 dissect_registration_results_parameter(parameter_tvb, pinfo, tree, parameter_tree);
1609 break;
1610 case V6_DEREGISTRATION_RESULTS_PARAMETER_TAG:
1611 dissect_deregistration_results_parameter(parameter_tvb, pinfo, tree, parameter_tree);
1612 break;
1613 default:
1614 dissect_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
1615 break;
1618 if (padding_length > 0)
1619 proto_tree_add_item(parameter_tree, hf_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
1622 #define V7_NETWORK_APPEARANCE_PARAMETER_TAG 0x80
1623 #define V7_PROTOCOL_DATA_1_PARAMETER_TAG 0x81
1624 #define V7_PROTOCOL_DATA_2_PARAMETER_TAG 0x82
1625 #define V7_INFO_PARAMETER_TAG 0x04
1626 #define V7_AFFECTED_DESTINATIONS_PARAMETER_TAG 0x83
1627 #define V7_ROUTING_CONTEXT_PARAMETER_TAG 0x06
1628 #define V7_DIAGNOSTIC_INFORMATION_PARAMETER_TAG 0x07
1629 #define V7_HEARTBEAT_DATA_PARAMETER_TAG 0x09
1630 #define V7_USER_CAUSE_PARAMETER_TAG 0x84
1631 #define V7_REASON_PARAMETER_TAG 0x0a
1632 #define V7_TRAFFIC_MODE_TYPE_PARAMETER_TAG 0x0b
1633 #define V7_ERROR_CODE_PARAMETER_TAG 0x0c
1634 #define V7_STATUS_PARAMETER_TAG 0x0d
1635 #define V7_CONGESTION_INDICATION_PARAMETER_TAG 0x85
1636 #define V7_CONCERNED_DESTINATION_PARAMETER_TAG 0x86
1637 #define V7_ROUTING_KEY_PARAMETER_TAG 0x87
1638 #define V7_REGISTRATION_RESULT_PARAMETER_TAG 0x88
1639 #define V7_DEREGISTRATION_RESULT_PARAMETER_TAG 0x89
1640 #define V7_LOCAL_ROUTING_KEY_IDENTIFIER_PARAMETER_TAG 0x8a
1641 #define V7_DESTINATION_POINT_CODE_PARAMETER_TAG 0x8b
1642 #define V7_SERVICE_INDICATORS_PARAMETER_TAG 0x8c
1643 #define V7_SUBSYSTEM_NUMBERS_PARAMETER_TAG 0x8d
1644 #define V7_ORIGINATING_POINT_CODE_LIST_PARAMETER_TAG 0x8e
1645 #define V7_CIRCUIT_RANGE_PARAMETER_TAG 0x8f
1646 #define V7_REGISTRATION_RESULTS_PARAMETER_TAG 0x90
1647 #define V7_DEREGISTRATION_RESULTS_PARAMETER_TAG 0x91
1649 static const value_string v7_parameter_tag_values[] = {
1650 { V7_NETWORK_APPEARANCE_PARAMETER_TAG, "Network appearance" },
1651 { V7_PROTOCOL_DATA_1_PARAMETER_TAG, "Protocol data 1" },
1652 { V7_PROTOCOL_DATA_2_PARAMETER_TAG, "Protocol data 2" },
1653 { V7_INFO_PARAMETER_TAG, "Info" },
1654 { V7_AFFECTED_DESTINATIONS_PARAMETER_TAG, "Affected destinations" },
1655 { V7_ROUTING_CONTEXT_PARAMETER_TAG, "Routing context" },
1656 { V7_DIAGNOSTIC_INFORMATION_PARAMETER_TAG, "Diagnostic information" },
1657 { V7_HEARTBEAT_DATA_PARAMETER_TAG, "Heartbeat data" },
1658 { V7_USER_CAUSE_PARAMETER_TAG, "User / Cause" },
1659 { V7_REASON_PARAMETER_TAG, "Reason" },
1660 { V7_TRAFFIC_MODE_TYPE_PARAMETER_TAG, "Traffic mode type" },
1661 { V7_ERROR_CODE_PARAMETER_TAG, "Error code" },
1662 { V7_STATUS_PARAMETER_TAG, "Status" },
1663 { V7_CONGESTION_INDICATION_PARAMETER_TAG, "Congestion indication" },
1664 { V7_CONCERNED_DESTINATION_PARAMETER_TAG, "Concerned destination" },
1665 { V7_ROUTING_KEY_PARAMETER_TAG, "Routing Key" },
1666 { V7_REGISTRATION_RESULT_PARAMETER_TAG, "Registration result" },
1667 { V7_DEREGISTRATION_RESULT_PARAMETER_TAG, "De-registration result" },
1668 { V7_LOCAL_ROUTING_KEY_IDENTIFIER_PARAMETER_TAG, "Local routing key identifier" },
1669 { V7_DESTINATION_POINT_CODE_PARAMETER_TAG, "Destination point code" },
1670 { V7_SERVICE_INDICATORS_PARAMETER_TAG, "Service indicators" },
1671 { V7_SUBSYSTEM_NUMBERS_PARAMETER_TAG, "Subsystem numbers" },
1672 { V7_ORIGINATING_POINT_CODE_LIST_PARAMETER_TAG, "Originating point code list" },
1673 { V7_CIRCUIT_RANGE_PARAMETER_TAG, "Circuit range" },
1674 { V7_REGISTRATION_RESULTS_PARAMETER_TAG, "Registration results" },
1675 { V7_DEREGISTRATION_RESULTS_PARAMETER_TAG, "De-registration results" },
1676 { 0, NULL } };
1678 static void
1679 // NOLINTNEXTLINE(misc-no-recursion)
1680 dissect_v7_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
1682 uint16_t tag, length, padding_length;
1683 proto_item *parameter_item;
1684 proto_tree *parameter_tree;
1686 /* extract tag and length from the parameter */
1687 tag = tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET);
1688 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
1689 padding_length = tvb_reported_length(parameter_tvb) - length;
1691 if (!tree && tag != V7_PROTOCOL_DATA_1_PARAMETER_TAG && tag != V7_PROTOCOL_DATA_2_PARAMETER_TAG)
1692 return; /* Nothing to do here */
1694 /* create proto_tree stuff */
1695 parameter_tree = proto_tree_add_subtree(m3ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, -1,
1696 ett_parameter, &parameter_item, val_to_str_const(tag, v7_parameter_tag_values, "Unknown parameter"));
1698 /* add tag and length to the parameter tree */
1699 proto_tree_add_item(parameter_tree, hf_v7_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, ENC_BIG_ENDIAN);
1700 proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
1702 switch(tag) {
1703 case V7_NETWORK_APPEARANCE_PARAMETER_TAG:
1704 dissect_network_appearance_parameter(parameter_tvb, parameter_tree, parameter_item);
1705 break;
1706 case V7_PROTOCOL_DATA_1_PARAMETER_TAG:
1707 dissect_protocol_data_1_parameter(parameter_tvb, pinfo, tree, parameter_item);
1708 break;
1709 case V7_PROTOCOL_DATA_2_PARAMETER_TAG:
1710 dissect_protocol_data_2_parameter(parameter_tvb, pinfo, tree, parameter_tree, parameter_item);
1711 break;
1712 case V7_INFO_PARAMETER_TAG:
1713 dissect_info_string_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
1714 break;
1715 case V7_AFFECTED_DESTINATIONS_PARAMETER_TAG:
1716 dissect_affected_destinations_parameter(parameter_tvb, parameter_tree, parameter_item);
1717 break;
1718 case V7_ROUTING_CONTEXT_PARAMETER_TAG:
1719 dissect_routing_context_parameter(parameter_tvb, parameter_tree, parameter_item);
1720 break;
1721 case V7_DIAGNOSTIC_INFORMATION_PARAMETER_TAG:
1722 dissect_diagnostic_information_parameter(parameter_tvb, parameter_tree, parameter_item);
1723 break;
1724 case V7_HEARTBEAT_DATA_PARAMETER_TAG:
1725 dissect_heartbeat_data_parameter(parameter_tvb, parameter_tree, parameter_item);
1726 break;
1727 case V7_USER_CAUSE_PARAMETER_TAG:
1728 dissect_user_cause_parameter(parameter_tvb, parameter_tree, parameter_item);
1729 break;
1730 case V7_REASON_PARAMETER_TAG:
1731 dissect_reason_parameter(parameter_tvb, parameter_tree, parameter_item);
1732 break;
1733 case V7_TRAFFIC_MODE_TYPE_PARAMETER_TAG:
1734 dissect_v7_traffic_mode_type_parameter(parameter_tvb, parameter_tree, parameter_item);
1735 break;
1736 case V7_ERROR_CODE_PARAMETER_TAG:
1737 dissect_v7_error_code_parameter(parameter_tvb, parameter_tree, parameter_item);
1738 break;
1739 case V7_STATUS_PARAMETER_TAG:
1740 dissect_v567_status_parameter(parameter_tvb, parameter_tree, parameter_item);
1741 break;
1742 case V7_CONGESTION_INDICATION_PARAMETER_TAG:
1743 dissect_congestion_indication_parameter(parameter_tvb, parameter_tree, parameter_item);
1744 break;
1745 case V7_CONCERNED_DESTINATION_PARAMETER_TAG:
1746 dissect_concerned_destination_parameter(parameter_tvb, parameter_tree, parameter_item);
1747 break;
1748 case V7_ROUTING_KEY_PARAMETER_TAG:
1749 dissect_routing_key_parameter(parameter_tvb, pinfo, tree, parameter_tree);
1750 break;
1751 case V7_REGISTRATION_RESULT_PARAMETER_TAG:
1752 dissect_v67_registration_result_parameter(parameter_tvb, parameter_tree);
1753 break;
1754 case V7_DEREGISTRATION_RESULT_PARAMETER_TAG:
1755 dissect_v67_deregistration_result_parameter(parameter_tvb, parameter_tree);
1756 break;
1757 case V7_LOCAL_ROUTING_KEY_IDENTIFIER_PARAMETER_TAG:
1758 dissect_local_routing_key_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
1759 break;
1760 case V7_DESTINATION_POINT_CODE_PARAMETER_TAG:
1761 dissect_destination_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
1762 break;
1763 case V7_SERVICE_INDICATORS_PARAMETER_TAG:
1764 dissect_service_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
1765 break;
1766 case V7_SUBSYSTEM_NUMBERS_PARAMETER_TAG:
1767 dissect_subsystem_numbers_parameter(parameter_tvb, parameter_tree, parameter_item);
1768 break;
1769 case V7_ORIGINATING_POINT_CODE_LIST_PARAMETER_TAG:
1770 dissect_originating_point_code_list_parameter(parameter_tvb, parameter_tree, parameter_item);
1771 break;
1772 case V7_CIRCUIT_RANGE_PARAMETER_TAG:
1773 dissect_circuit_range_parameter(parameter_tvb, parameter_tree, parameter_item);
1774 break;
1775 case V7_REGISTRATION_RESULTS_PARAMETER_TAG:
1776 dissect_registration_results_parameter(parameter_tvb, pinfo, tree, parameter_tree);
1777 break;
1778 case V7_DEREGISTRATION_RESULTS_PARAMETER_TAG:
1779 dissect_deregistration_results_parameter(parameter_tvb, pinfo, tree, parameter_tree);
1780 break;
1781 default:
1782 dissect_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
1783 break;
1786 if (padding_length > 0)
1787 proto_tree_add_item(parameter_tree, hf_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
1790 #define INFO_STRING_PARAMETER_TAG 0x0004
1791 #define ROUTING_CONTEXT_PARAMETER_TAG 0x0006
1792 #define DIAGNOSTIC_INFORMATION_PARAMETER_TAG 0x0007
1793 #define HEARTBEAT_DATA_PARAMETER_TAG 0x0009
1794 #define TRAFFIC_MODE_TYPE_PARAMETER_TAG 0x000b
1795 #define ERROR_CODE_PARAMETER_TAG 0x000c
1796 #define STATUS_PARAMETER_TAG 0x000d
1797 #define ASP_IDENTIFIER_PARAMETER_TAG 0x0011
1798 #define AFFECTED_POINT_CODE_PARAMETER_TAG 0x0012
1799 #define CORRELATION_IDENTIFIER_PARAMETER_TAG 0x0013
1801 #define NETWORK_APPEARANCE_PARAMETER_TAG 0x0200
1802 #define USER_CAUSE_PARAMETER_TAG 0x0204
1803 #define CONGESTION_INDICATIONS_PARAMETER_TAG 0x0205
1804 #define CONCERNED_DESTINATION_PARAMETER_TAG 0x0206
1805 #define ROUTING_KEY_PARAMETER_TAG 0x0207
1806 #define REGISTRATION_RESULT_PARAMETER_TAG 0x0208
1807 #define DEREGISTRATION_RESULT_PARAMETER_TAG 0x0209
1808 #define LOCAL_ROUTING_KEY_IDENTIFIER_PARAMETER_TAG 0x020a
1809 #define DESTINATION_POINT_CODE_PARAMETER_TAG 0x020b
1810 #define SERVICE_INDICATORS_PARAMETER_TAG 0x020c
1811 #define ORIGINATING_POINT_CODE_LIST_PARAMETER_TAG 0x020e
1812 #define CIRCUIT_RANGE_PARAMETER_TAG 0x020f
1813 #define PROTOCOL_DATA_PARAMETER_TAG 0x0210
1814 #define REGISTRATION_STATUS_PARAMETER_TAG 0x0212
1815 #define DEREGISTRATION_STATUS_PARAMETER_TAG 0x0213
1817 static const value_string parameter_tag_values[] = {
1818 { INFO_STRING_PARAMETER_TAG, "Info string" } ,
1819 { ROUTING_CONTEXT_PARAMETER_TAG, "Routing context" } ,
1820 { DIAGNOSTIC_INFORMATION_PARAMETER_TAG, "Diagnostic Information" } ,
1821 { HEARTBEAT_DATA_PARAMETER_TAG, "Heartbeat data" } ,
1822 { TRAFFIC_MODE_TYPE_PARAMETER_TAG, "Traffic mode type" } ,
1823 { ERROR_CODE_PARAMETER_TAG, "Error code" } ,
1824 { STATUS_PARAMETER_TAG, "Status" } ,
1825 { ASP_IDENTIFIER_PARAMETER_TAG, "ASP identifier" } ,
1826 { AFFECTED_POINT_CODE_PARAMETER_TAG, "Affected point code" } ,
1827 { CORRELATION_IDENTIFIER_PARAMETER_TAG, "Correlation identifier" } ,
1828 { NETWORK_APPEARANCE_PARAMETER_TAG, "Network appearance" } ,
1829 { USER_CAUSE_PARAMETER_TAG, "User / cause" } ,
1830 { CONGESTION_INDICATIONS_PARAMETER_TAG, "Congestion indications" } ,
1831 { CONCERNED_DESTINATION_PARAMETER_TAG, "Concerned destination" } ,
1832 { ROUTING_KEY_PARAMETER_TAG, "Routing key" } ,
1833 { REGISTRATION_RESULT_PARAMETER_TAG, "Registration result" } ,
1834 { DEREGISTRATION_RESULT_PARAMETER_TAG, "Deregistration result" } ,
1835 { LOCAL_ROUTING_KEY_IDENTIFIER_PARAMETER_TAG, "Local routing key identifier" } ,
1836 { DESTINATION_POINT_CODE_PARAMETER_TAG, "Destination point code" } ,
1837 { SERVICE_INDICATORS_PARAMETER_TAG, "Service indicators" } ,
1838 { ORIGINATING_POINT_CODE_LIST_PARAMETER_TAG, "Originating point code list" } ,
1839 { CIRCUIT_RANGE_PARAMETER_TAG, "Circuit range" } ,
1840 { PROTOCOL_DATA_PARAMETER_TAG, "Protocol data" } ,
1841 { REGISTRATION_STATUS_PARAMETER_TAG, "Registration status" } ,
1842 { DEREGISTRATION_STATUS_PARAMETER_TAG, "Deregistration status" } ,
1843 { 0, NULL } };
1845 static void
1846 // NOLINTNEXTLINE(misc-no-recursion)
1847 dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
1849 uint16_t tag, length, padding_length;
1850 proto_item *parameter_item;
1851 proto_tree *parameter_tree;
1853 /* extract tag and length from the parameter */
1854 tag = tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET);
1855 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
1856 padding_length = tvb_reported_length(parameter_tvb) - length;
1859 if (!tree && tag != PROTOCOL_DATA_PARAMETER_TAG)
1860 return; /* Nothing to do here */
1862 /* create proto_tree stuff */
1863 parameter_tree = proto_tree_add_subtree(m3ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, -1,
1864 ett_parameter, &parameter_item, val_to_str_const(tag, parameter_tag_values, "Unknown parameter"));
1866 /* add tag and length to the parameter tree */
1867 proto_tree_add_item(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, ENC_BIG_ENDIAN);
1868 proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
1870 switch(tag) {
1871 case INFO_STRING_PARAMETER_TAG:
1872 dissect_info_string_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
1873 break;
1874 case ROUTING_CONTEXT_PARAMETER_TAG:
1875 dissect_routing_context_parameter(parameter_tvb, parameter_tree, parameter_item);
1876 break;
1877 case DIAGNOSTIC_INFORMATION_PARAMETER_TAG:
1878 dissect_diagnostic_information_parameter(parameter_tvb, parameter_tree, parameter_item);
1879 break;
1880 case HEARTBEAT_DATA_PARAMETER_TAG:
1881 dissect_heartbeat_data_parameter(parameter_tvb, parameter_tree, parameter_item);
1882 break;
1883 case TRAFFIC_MODE_TYPE_PARAMETER_TAG:
1884 dissect_traffic_mode_type_parameter(parameter_tvb, parameter_tree, parameter_item);
1885 break;
1886 case ERROR_CODE_PARAMETER_TAG:
1887 dissect_error_code_parameter(parameter_tvb, parameter_tree, parameter_item);
1888 break;
1889 case STATUS_PARAMETER_TAG:
1890 dissect_status_parameter(parameter_tvb, parameter_tree, parameter_item);
1891 break;
1892 case ASP_IDENTIFIER_PARAMETER_TAG:
1893 dissect_asp_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
1894 break;
1895 case AFFECTED_POINT_CODE_PARAMETER_TAG:
1896 dissect_affected_destinations_parameter(parameter_tvb, parameter_tree, parameter_item);
1897 break;
1898 case NETWORK_APPEARANCE_PARAMETER_TAG:
1899 dissect_network_appearance_parameter(parameter_tvb, parameter_tree, parameter_item);
1900 break;
1901 case USER_CAUSE_PARAMETER_TAG:
1902 dissect_user_cause_parameter(parameter_tvb, parameter_tree, parameter_item);
1903 break;
1904 case CONGESTION_INDICATIONS_PARAMETER_TAG:
1905 dissect_congestion_indication_parameter(parameter_tvb, parameter_tree, parameter_item);
1906 break;
1907 case CONCERNED_DESTINATION_PARAMETER_TAG:
1908 dissect_concerned_destination_parameter(parameter_tvb, parameter_tree, parameter_item);
1909 break;
1910 case ROUTING_KEY_PARAMETER_TAG:
1911 dissect_routing_key_parameter(parameter_tvb, pinfo, tree, parameter_tree);
1912 break;
1913 case REGISTRATION_RESULT_PARAMETER_TAG:
1914 dissect_registration_result_parameter(parameter_tvb, pinfo, tree, parameter_tree);
1915 break;
1916 case DEREGISTRATION_RESULT_PARAMETER_TAG:
1917 dissect_deregistration_result_parameter(parameter_tvb, pinfo, tree, parameter_tree);
1918 break;
1919 case LOCAL_ROUTING_KEY_IDENTIFIER_PARAMETER_TAG:
1920 dissect_local_routing_key_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
1921 break;
1922 case DESTINATION_POINT_CODE_PARAMETER_TAG:
1923 dissect_destination_point_code_parameter(parameter_tvb, parameter_tree, parameter_item);
1924 break;
1925 case SERVICE_INDICATORS_PARAMETER_TAG:
1926 dissect_service_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
1927 break;
1928 case ORIGINATING_POINT_CODE_LIST_PARAMETER_TAG:
1929 dissect_originating_point_code_list_parameter(parameter_tvb, parameter_tree, parameter_item);
1930 break;
1931 case CIRCUIT_RANGE_PARAMETER_TAG:
1932 dissect_circuit_range_parameter(parameter_tvb, parameter_tree, parameter_item);
1933 break;
1934 case PROTOCOL_DATA_PARAMETER_TAG:
1935 dissect_protocol_data_parameter(parameter_tvb, pinfo, tree, parameter_tree, parameter_item);
1936 break;
1937 case CORRELATION_IDENTIFIER_PARAMETER_TAG:
1938 dissect_correlation_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
1939 break;
1940 case REGISTRATION_STATUS_PARAMETER_TAG:
1941 dissect_registration_status_parameter(parameter_tvb, parameter_tree, parameter_item);
1942 break;
1943 case DEREGISTRATION_STATUS_PARAMETER_TAG:
1944 dissect_deregistration_status_parameter(parameter_tvb, parameter_tree, parameter_item);
1945 break;
1946 default:
1947 dissect_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
1948 break;
1951 if (padding_length > 0)
1952 proto_tree_add_item(parameter_tree, hf_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
1955 static void
1956 // NOLINTNEXTLINE(misc-no-recursion)
1957 dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
1959 int offset, length, total_length, remaining_length;
1960 tvbuff_t *parameter_tvb;
1962 offset = 0;
1963 while((remaining_length = tvb_reported_length_remaining(parameters_tvb, offset))) {
1964 length = tvb_get_ntohs(parameters_tvb, offset + PARAMETER_LENGTH_OFFSET);
1965 total_length = WS_ROUNDUP_4(length);
1966 if (remaining_length >= length)
1967 total_length = MIN(total_length, remaining_length);
1968 /* create a tvb for the parameter including the padding bytes */
1969 parameter_tvb = tvb_new_subset_length(parameters_tvb, offset, total_length);
1970 increment_dissection_depth(pinfo);
1971 switch(version) {
1972 case M3UA_V5:
1973 dissect_v5_parameter(parameter_tvb, pinfo, tree, m3ua_tree);
1974 break;
1975 case M3UA_V6:
1976 dissect_v6_parameter(parameter_tvb, pinfo, tree, m3ua_tree);
1977 break;
1978 case M3UA_V7:
1979 dissect_v7_parameter(parameter_tvb, pinfo, tree, m3ua_tree);
1980 break;
1981 case M3UA_RFC:
1982 dissect_parameter(parameter_tvb, pinfo, tree, m3ua_tree);
1983 break;
1985 decrement_dissection_depth(pinfo);
1986 /* get rid of the handled parameter */
1987 offset += total_length;
1992 static void
1993 // NOLINTNEXTLINE(misc-no-recursion)
1994 dissect_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
1996 tvbuff_t *common_header_tvb, *parameters_tvb;
1998 common_header_tvb = tvb_new_subset_length(message_tvb, 0, COMMON_HEADER_LENGTH);
1999 parameters_tvb = tvb_new_subset_remaining(message_tvb, COMMON_HEADER_LENGTH);
2000 if (version == M3UA_V5)
2001 dissect_v5_common_header(common_header_tvb, pinfo, m3ua_tree);
2002 else
2003 dissect_common_header(common_header_tvb, pinfo, m3ua_tree);
2005 /* Need to dissect (certain) parameters even when !tree, so subdissectors
2006 * (e.g., MTP3) are always called.
2008 dissect_parameters(parameters_tvb, pinfo, tree, m3ua_tree);
2011 static int
2012 dissect_m3ua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2014 proto_item *m3ua_item;
2015 proto_tree *m3ua_tree;
2018 /* make entry in the Protocol column on summary display */
2019 switch(version) {
2020 case M3UA_V5:
2021 col_set_str(pinfo->cinfo, COL_PROTOCOL, "M3UA (ID 05)");
2022 break;
2023 case M3UA_V6:
2024 col_set_str(pinfo->cinfo, COL_PROTOCOL, "M3UA (ID 06)");
2025 break;
2026 case M3UA_V7:
2027 col_set_str(pinfo->cinfo, COL_PROTOCOL, "M3UA (ID 07)");
2028 break;
2029 case M3UA_RFC:
2030 col_set_str(pinfo->cinfo, COL_PROTOCOL, "M3UA (RFC 4666)");
2031 break;
2034 /* create the m3ua protocol tree */
2035 m3ua_item = proto_tree_add_item(tree, proto_m3ua, message_tvb, 0, -1, ENC_NA);
2036 m3ua_tree = proto_item_add_subtree(m3ua_item, ett_m3ua);
2038 /* dissect the message */
2039 dissect_message(message_tvb, pinfo, tree, m3ua_tree);
2040 return tvb_captured_length(message_tvb);
2043 static unsigned
2044 get_dissect_m3ua_tcp_len(packet_info *pinfo _U_, tvbuff_t *tvb,
2045 int offset, void *data _U_)
2047 return tvb_get_ntohl(tvb, offset + 4);
2050 static int
2051 dissect_m3ua_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2053 tcp_dissect_pdus(tvb, pinfo, tree, m3ua_tcp_desegment, COMMON_HEADER_LENGTH,
2054 get_dissect_m3ua_tcp_len, dissect_m3ua, data);
2055 return tvb_reported_length(tvb);
2058 /* Register the protocol with Wireshark */
2059 void
2060 proto_register_m3ua(void)
2063 /* Setup list of header fields */
2064 static hf_register_info hf[] = {
2065 { &hf_version, { "Version", "m3ua.version", FT_UINT8, BASE_DEC, VALS(protocol_version_values), 0x0, NULL, HFILL } },
2066 { &hf_reserved, { "Reserved", "m3ua.reserved", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
2067 { &hf_v5_message_class, { "Message class", "m3ua.message_class", FT_UINT8, BASE_DEC, VALS(v5_message_class_values), 0x0, NULL, HFILL } },
2068 { &hf_message_class, { "Message class", "m3ua.message_class", FT_UINT8, BASE_DEC, VALS(message_class_values), 0x0, NULL, HFILL } },
2069 { &hf_message_type, { "Message Type", "m3ua.message_type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2070 { &hf_message_length, { "Message length", "m3ua.message_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2071 { &hf_v5_parameter_tag, { "Parameter Tag", "m3ua.parameter_tag", FT_UINT16, BASE_DEC, VALS(v5_parameter_tag_values), 0x0, NULL, HFILL } },
2072 { &hf_v6_parameter_tag, { "Parameter Tag", "m3ua.parameter_tag", FT_UINT16, BASE_DEC, VALS(v6_parameter_tag_values), 0x0, NULL, HFILL } },
2073 { &hf_v7_parameter_tag, { "Parameter Tag", "m3ua.parameter_tag", FT_UINT16, BASE_DEC, VALS(v7_parameter_tag_values), 0x0, NULL, HFILL } },
2074 { &hf_parameter_tag, { "Parameter Tag", "m3ua.parameter_tag", FT_UINT16, BASE_DEC, VALS(parameter_tag_values), 0x0, NULL, HFILL } },
2075 { &hf_parameter_length, { "Parameter length", "m3ua.parameter_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2076 { &hf_parameter_value, { "Parameter value", "m3ua.parameter_value", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2077 { &hf_parameter_padding, { "Padding", "m3ua.parameter_padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2078 #if 0
2079 { &hf_parameter_trailer, { "Trailer", "m3ua.parameter_trailer", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2080 #endif
2081 { &hf_network_appearance, { "Network appearance", "m3ua.network_appearance", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2082 { &hf_info_string, { "Info string", "m3ua.info_string", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2083 { &hf_routing_context, { "Routing context", "m3ua.routing_context", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2084 { &hf_diagnostic_information, { "Diagnostic information", "m3ua.diagnostic_information", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2085 { &hf_heartbeat_data, { "Heartbeat data", "m3ua.heartbeat_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2086 { &hf_v5_error_code, { "Error code", "m3ua.error_code", FT_UINT32, BASE_DEC, VALS(v5_error_code_values), 0x0, NULL, HFILL } },
2087 { &hf_v6_error_code, { "Error code", "m3ua.error_code", FT_UINT32, BASE_DEC, VALS(v6_error_code_values), 0x0, NULL, HFILL } },
2088 { &hf_v7_error_code, { "Error code", "m3ua.error_code", FT_UINT32, BASE_DEC, VALS(v7_error_code_values), 0x0, NULL, HFILL } },
2089 { &hf_error_code, { "Error code", "m3ua.error_code", FT_UINT32, BASE_DEC, VALS(error_code_values), 0x0, NULL, HFILL } },
2090 { &hf_status_type, { "Status type", "m3ua.status_type", FT_UINT16, BASE_DEC, VALS(status_type_values), 0x0, NULL, HFILL } },
2091 { &hf_status_info, { "Status info", "m3ua.status_info", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2092 { &hf_asp_identifier, { "ASP identifier", "m3ua.asp_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2093 { &hf_affected_point_code_mask, { "Mask", "m3ua.affected_point_code_mask", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2094 { &hf_affected_point_code_pc, { "Affected point code", "m3ua.affected_point_code_pc", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2095 { &hf_cause, { "Unavailability cause", "m3ua.unavailability_cause", FT_UINT16, BASE_DEC, VALS(unavailability_cause_values), 0x0, NULL, HFILL } },
2096 { &hf_user, { "User Identity", "m3ua.user_identity", FT_UINT16, BASE_DEC, VALS(user_identity_values), 0x0, NULL, HFILL } },
2097 { &hf_reason, { "Reason", "m3ua.reason", FT_UINT32, BASE_DEC, VALS(reason_values), 0x0, NULL, HFILL } },
2098 { &hf_v5_traffic_mode_type, { "Traffic mode Type", "m3ua.traffic_mode_type", FT_UINT32, BASE_DEC, VALS(v5_traffic_mode_type_values), 0x0, NULL, HFILL } },
2099 { &hf_v6_traffic_mode_type, { "Traffic mode Type", "m3ua.traffic_mode_type", FT_UINT32, BASE_DEC, VALS(v6_traffic_mode_type_values), 0x0, NULL, HFILL } },
2100 { &hf_v7_traffic_mode_type, { "Traffic mode Type", "m3ua.traffic_mode_type", FT_UINT32, BASE_DEC, VALS(v7_traffic_mode_type_values), 0x0, NULL, HFILL } },
2101 { &hf_traffic_mode_type, { "Traffic mode Type", "m3ua.traffic_mode_type", FT_UINT32, BASE_DEC, VALS(traffic_mode_type_values), 0x0, NULL, HFILL } },
2102 { &hf_congestion_reserved, { "Reserved", "m3ua.congestion_reserved", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2103 { &hf_congestion_level, { "Congestion level", "m3ua.congestion_level", FT_UINT8, BASE_DEC, VALS(congestion_level_values), 0x0, NULL, HFILL } },
2104 { &hf_concerned_dest_reserved, { "Reserved", "m3ua.concerned_reserved", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2105 { &hf_concerned_dest_pc, { "Concerned DPC", "m3ua.concerned_dpc", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2106 { &hf_local_rk_identifier, { "Local routing key identifier", "m3ua.local_rk_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2107 { &hf_dpc_mask, { "Mask", "m3ua.dpc_mask", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2108 { &hf_dpc_pc, { "Destination point code", "m3ua.dpc_pc", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2109 { &hf_si, { "Service indicator", "m3ua.si", FT_UINT8, BASE_DEC, VALS(user_identity_values), 0x0, NULL, HFILL } },
2110 { &hf_ssn, { "Subsystem number", "m3ua.ssn", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2111 { &hf_opc_list_mask, { "Mask", "m3ua.opc_list_mask", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2112 { &hf_opc_list_pc, { "Originating point code", "m3ua.opc_list_pc", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2113 { &hf_cic_range_mask, { "Mask", "m3ua.cic_range_mask", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2114 { &hf_cic_range_pc, { "Originating point code", "m3ua.cic_range_pc", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2115 { &hf_cic_range_lower, { "Lower CIC value", "m3ua.cic_range_lower", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2116 { &hf_cic_range_upper, { "Upper CIC value", "m3ua.cic_range_upper", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2117 { &hf_li, { "Length indicator", "m3ua.protocol_data_2_li", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2118 { &hf_protocol_data_opc, { "OPC", "m3ua.protocol_data_opc", FT_UINT32, BASE_DEC, NULL, 0x0, "Originating Point Code", HFILL } },
2119 { &hf_protocol_data_dpc, { "DPC", "m3ua.protocol_data_dpc", FT_UINT32, BASE_DEC, NULL, 0x0, "Destination Point Code", HFILL } },
2120 { &hf_protocol_data_mtp3_opc, { "OPC", "mtp3.opc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2121 { &hf_protocol_data_mtp3_dpc, { "DPC", "mtp3.dpc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2122 { &hf_protocol_data_mtp3_pc, { "PC", "mtp3.pc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2123 { &hf_protocol_data_si, { "SI", "m3ua.protocol_data_si", FT_UINT8, BASE_DEC, VALS(mtp3_service_indicator_code_short_vals), 0x0, "Service Indicator", HFILL } },
2124 { &hf_protocol_data_ni, { "NI", "m3ua.protocol_data_ni", FT_UINT8, BASE_DEC, VALS(mtp3_network_indicator_vals), 0x0, "Network Indicator", HFILL } },
2125 { &hf_protocol_data_mtp3_ni, { "NI", "mtp3.ni", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2126 { &hf_protocol_data_mp, { "MP", "m3ua.protocol_data_mp", FT_UINT8, BASE_DEC, NULL, 0x0, "Message Priority", HFILL } },
2127 { &hf_protocol_data_sls, { "SLS", "m3ua.protocol_data_sls", FT_UINT8, BASE_DEC, NULL, 0x0, "Signalling Link Selection", HFILL } },
2128 { &hf_protocol_data_mtp3_sls, { "SLS", "mtp3.sls", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2129 { &hf_correlation_identifier, { "Correlation Identifier", "m3ua.correlation_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2130 { &hf_registration_status, { "Registration status", "m3ua.registration_status", FT_UINT32, BASE_DEC, VALS(registration_status_values), 0x0, NULL, HFILL } },
2131 { &hf_deregistration_status, { "Deregistration status", "m3ua.deregistration_status", FT_UINT32, BASE_DEC, VALS(deregistration_status_values), 0x0, NULL, HFILL } },
2132 { &hf_registration_result_identifier, { "Local RK-identifier value", "m3ua.registration_result_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2133 { &hf_registration_result_status, { "Registration status", "m3ua.registration_results_status", FT_UINT32, BASE_DEC, VALS(registration_result_status_values), 0x0, NULL, HFILL } },
2134 { &hf_registration_result_context, { "Routing context", "m3ua.registration_result_routing_context", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2135 { &hf_v6_deregistration_result_status, { "De-Registration status", "m3ua.deregistration_results_status", FT_UINT32, BASE_DEC, VALS(v6_deregistration_result_status_values), 0x0, NULL, HFILL } },
2136 { &hf_v6_deregistration_result_context, { "Routing context", "m3ua.deregistration_result_routing_context", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2137 { &hf_heuristic_standard, { "Heuristic standard", "m3ua.heuristic_standard", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
2140 /* Setup protocol subtree array */
2141 static int *ett[] = {
2142 &ett_m3ua,
2143 &ett_parameter,
2144 &ett_mtp3_equiv,
2145 &ett_q708_opc,
2146 &ett_q708_dpc,
2149 static const enum_val_t options[] = {
2150 { "draft-5", "Internet Draft version 5", M3UA_V5 },
2151 { "draft-6", "Internet Draft version 6", M3UA_V6 },
2152 { "draft-7", "Internet Draft version 7", M3UA_V7 },
2153 { "rfc4666", "RFC 4666", M3UA_RFC },
2154 { NULL, NULL, 0 }
2157 /* Register the protocol name and description */
2158 proto_m3ua = proto_register_protocol("MTP 3 User Adaptation Layer", "M3UA", "m3ua");
2159 m3ua_sctp_handle = register_dissector_with_description("m3ua", "M3UA over SCTP", dissect_m3ua, proto_m3ua);
2160 m3ua_tcp_handle = register_dissector_with_description("m3ua.tcp", "M3UA over TCP", dissect_m3ua_tcp, proto_m3ua);
2162 m3ua_module = prefs_register_protocol(proto_m3ua, NULL);
2163 prefs_register_enum_preference(m3ua_module, "version", "M3UA Version", "Version used by Wireshark", &version, options, false);
2164 prefs_register_static_text_preference(m3ua_module, "text_mtp3_standard", "The SS7 standard used can be changed in the MTP3 preferences", "The SS7 standard used can be changed in the MTP3 preferences");
2165 prefs_register_bool_preference(m3ua_module, "desegment",
2166 "Desegment all M3UA messages spanning multiple TCP segments",
2167 "Whether the M3UA dissector should desegment all messages spanning multiple TCP segments",
2168 &m3ua_tcp_desegment);
2170 /* Required function calls to register the header fields and subtrees used */
2171 proto_register_field_array(proto_m3ua, hf, array_length(hf));
2172 proto_register_subtree_array(ett, array_length(ett));
2174 m3ua_tap = register_tap("m3ua");
2178 void
2179 proto_reg_handoff_m3ua(void)
2183 * Get a handle for the MTP3 dissector.
2185 mtp3_handle = find_dissector_add_dependency("mtp3", proto_m3ua);
2186 dissector_add_uint("sctp.ppi", M3UA_PAYLOAD_PROTOCOL_ID, m3ua_sctp_handle);
2187 dissector_add_uint("sctp.port", SCTP_PORT_M3UA, m3ua_sctp_handle);
2188 dissector_add_uint("tcp.port", TCP_PORT_M3UA, m3ua_tcp_handle);
2190 si_dissector_table = find_dissector_table("mtp3.service_indicator");
2192 ss7pc_address_type = address_type_get_by_name("AT_SS7PC");
2196 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2198 * Local Variables:
2199 * c-basic-offset: 2
2200 * tab-width: 8
2201 * indent-tabs-mode: nil
2202 * End:
2204 * ex: set shiftwidth=2 tabstop=8 expandtab:
2205 * :indentSize=2:tabSize=8:noTabs=true: