Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-m2ua.c
blobba5e8545d06824b7d0f6ceff37f245e73980e6ca
1 /* packet-m2ua.c
2 * Routines for MTP2 User Adaptation Layer dissection
3 * It is hopefully (needs testing) compliant to
4 * https://tools.ietf.org/html/rfc3331
5 * To do: - provide better handling of length parameters
7 * Copyright 2002, Michael Tuexen <tuexen [AT] fh-muenster.de>
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * Copied from README.developer
15 * SPDX-License-Identifier: GPL-2.0-or-later
18 #include "config.h"
20 #include <epan/packet.h>
21 #include <epan/prefs.h>
22 #include <epan/sctpppids.h>
24 #include <wsutil/str_util.h>
25 #include <wsutil/ws_roundup.h>
27 void proto_register_m2ua(void);
28 void proto_reg_handoff_m2ua(void);
30 #define SCTP_PORT_M2UA 2904
32 /* Initialize the protocol and registered fields */
33 static int proto_m2ua;
34 static int hf_version;
35 static int hf_reserved;
36 static int hf_message_class;
37 static int hf_message_type;
38 static int hf_message_length;
39 static int hf_parameter_tag;
40 static int hf_parameter_length;
41 static int hf_parameter_value;
42 static int hf_parameter_padding;
43 static int hf_interface_id_int;
44 static int hf_interface_id_text;
45 static int hf_info_string;
46 static int hf_diagnostic_information;
47 static int hf_interface_id_start;
48 static int hf_interface_id_stop;
49 static int hf_heartbeat_data;
50 static int hf_traffic_mode_type;
51 static int hf_error_code;
52 static int hf_status_type;
53 static int hf_status_ident;
54 static int hf_asp_id;
55 static int hf_correlation_id;
56 static int hf_data_2_li;
57 static int hf_state;
58 static int hf_event;
59 static int hf_congestion_status;
60 static int hf_discard_status;
61 static int hf_action;
62 static int hf_sequence_number;
63 static int hf_retrieval_result;
64 static int hf_local_lk_id;
65 static int hf_sdt_reserved;
66 static int hf_sdt_id;
67 static int hf_sdl_reserved;
68 static int hf_sdl_id;
69 static int hf_registration_status;
70 static int hf_deregistration_status;
72 /* Initialize the subtree pointers */
73 static int ett_m2ua;
74 static int ett_m2ua_parameter;
76 static dissector_handle_t mtp3_handle;
77 static dissector_handle_t m2ua_handle;
79 static void
80 dissect_parameters(tvbuff_t *, packet_info *, proto_tree *, proto_tree *);
82 #define VERSION_LENGTH 1
83 #define RESERVED_LENGTH 1
84 #define MESSAGE_CLASS_LENGTH 1
85 #define MESSAGE_TYPE_LENGTH 1
86 #define MESSAGE_LENGTH_LENGTH 4
87 #define COMMON_HEADER_LENGTH (VERSION_LENGTH + RESERVED_LENGTH + MESSAGE_CLASS_LENGTH + \
88 MESSAGE_TYPE_LENGTH + MESSAGE_LENGTH_LENGTH)
90 #define VERSION_OFFSET 0
91 #define RESERVED_OFFSET (VERSION_OFFSET + VERSION_LENGTH)
92 #define MESSAGE_CLASS_OFFSET (RESERVED_OFFSET + RESERVED_LENGTH)
93 #define MESSAGE_TYPE_OFFSET (MESSAGE_CLASS_OFFSET + MESSAGE_CLASS_LENGTH)
94 #define MESSAGE_LENGTH_OFFSET (MESSAGE_TYPE_OFFSET + MESSAGE_TYPE_LENGTH)
96 #define PROTOCOL_VERSION_RELEASE_1 1
98 static const value_string protocol_version_values[] = {
99 { PROTOCOL_VERSION_RELEASE_1, "Release 1" },
100 { 0, NULL } };
102 #define MESSAGE_CLASS_MGMT_MESSAGE 0
103 #define MESSAGE_CLASS_ASPSM_MESSAGE 3
104 #define MESSAGE_CLASS_ASPTM_MESSAGE 4
105 #define MESSAGE_CLASS_MAUP_MESSAGE 6
106 #define MESSAGE_CLASS_IIM_MESSAGE 10
108 static const value_string message_class_values[] = {
109 { MESSAGE_CLASS_MGMT_MESSAGE, "Management messages" },
110 { MESSAGE_CLASS_ASPSM_MESSAGE, "ASP state maintenance messages" },
111 { MESSAGE_CLASS_ASPTM_MESSAGE, "ASP traffic maintenance messages" },
112 { MESSAGE_CLASS_MAUP_MESSAGE, "MTP2 user adaptation messages" },
113 { MESSAGE_CLASS_IIM_MESSAGE, "Interface identifier management messages" },
114 { 0, NULL } };
116 /* MGMT */
117 #define MESSAGE_TYPE_ERR 0
118 #define MESSAGE_TYPE_NTFY 1
120 /* ASPSM */
121 #define MESSAGE_TYPE_UP 1
122 #define MESSAGE_TYPE_DOWN 2
123 #define MESSAGE_TYPE_BEAT 3
124 #define MESSAGE_TYPE_UP_ACK 4
125 #define MESSAGE_TYPE_DOWN_ACK 5
126 #define MESSAGE_TYPE_BEAT_ACK 6
128 /* ASPTM */
129 #define MESSAGE_TYPE_ACTIVE 1
130 #define MESSAGE_TYPE_INACTIVE 2
131 #define MESSAGE_TYPE_ACTIVE_ACK 3
132 #define MESSAGE_TYPE_INACTIVE_ACK 4
134 /* MAUP */
135 #define MESSAGE_TYPE_DATA 1
136 #define MESSAGE_TYPE_ESTAB_REQ 2
137 #define MESSAGE_TYPE_ESTAB_CONF 3
138 #define MESSAGE_TYPE_REL_REQ 4
139 #define MESSAGE_TYPE_REL_CONF 5
140 #define MESSAGE_TYPE_REL_IND 6
141 #define MESSAGE_TYPE_STATE_REQ 7
142 #define MESSAGE_TYPE_STATE_CONF 8
143 #define MESSAGE_TYPE_STATE_IND 9
144 #define MESSAGE_TYPE_DATA_RETR_REQ 10
145 #define MESSAGE_TYPE_DATA_RETR_CONF 11
146 #define MESSAGE_TYPE_DATA_RETR_IND 12
147 #define MESSAGE_TYPE_DATA_RETR_COMP_IND 13
148 #define MESSAGE_TYPE_CONG_IND 14
149 #define MESSAGE_TYPE_DATA_ACK 15
151 /* IIM */
152 #define MESSAGE_TYPE_REG_REQ 1
153 #define MESSAGE_TYPE_REG_RSP 2
154 #define MESSAGE_TYPE_DEREG_REQ 3
155 #define MESSAGE_TYPE_DEREG_RSP 4
157 static const value_string message_class_type_values[] = {
158 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_ERR, "Error (ERR)" },
159 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_NTFY, "Notify (NTFY)" },
160 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP, "ASP up (UP)" },
161 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN, "ASP down (DOWN)" },
162 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT, "Heartbeat (BEAT)" },
163 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP_ACK, "ASP up ack (UP ACK)" },
164 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN_ACK, "ASP down ack (DOWN ACK)" },
165 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT_ACK, "Heartbeat ack (BEAT ACK)" },
166 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE , "ASP active (ACTIVE)" },
167 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE , "ASP inactive (INACTIVE)" },
168 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE_ACK , "ASP active ack (ACTIVE ACK)" },
169 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE_ACK , "ASP inactive ack (INACTIVE ACK)" },
170 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA, "DATA (DATA)" },
171 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_REQ, "Establish request (ESTAB_REQ)" },
172 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_CONF, "Establish confirm (ESTAB_CONF)" },
173 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_REQ, "Release request (REL_REQ)" },
174 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_CONF, "Release confirm (REL_CONF)" },
175 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_IND, "Release indication (REL_IND)" },
176 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_REQ, "State request (STATE_REQ)" },
177 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_CONF, "State confirm (STATE_CONF)" },
178 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_IND, "State indication (STATE_IND)" },
179 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_REQ, "Data retrieval request (DATA_RETR_REQ)" },
180 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_CONF, "Data retrieval confirm (DATA_RETR_CONF)" },
181 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_IND, "Data retrieval indication (DATA_RETR_IND)" },
182 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_COMP_IND, "Data retrieval complete indication (DATA_RETR_COMP_IND)" },
183 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_CONG_IND, "Congestion indication (CONG_IND)" },
184 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_ACK, "Data acknowledge (DATA_ACK)" },
185 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_REQ , "Registration request (REG_REQ)" },
186 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_RSP , "Registration response (REG_RSP)" },
187 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_REQ , "Deregistration request (DEREG_REQ)" },
188 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_RSP , "Deregistration response (DEREG_RSP)" },
189 { 0, NULL } };
191 static const value_string message_class_type_acro_values[] = {
192 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_ERR, "ERR" },
193 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_NTFY, "NTFY" },
194 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP, "ASP_UP" },
195 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN, "ASP_DOWN" },
196 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT, "BEAT" },
197 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP_ACK, "ASP_UP_ACK" },
198 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN_ACK, "ASP_DOWN_ACK" },
199 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT_ACK, "BEAT_ACK" },
200 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE , "ASP_ACTIVE" },
201 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE , "ASP_INACTIVE" },
202 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE_ACK , "ASP_ACTIVE_ACK" },
203 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE_ACK , "ASP_INACTIVE_ACK" },
204 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA, "DATA" },
205 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_REQ, "ESTAB_REQ" },
206 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_CONF, "ESTAB_CONF" },
207 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_REQ, "REL_REQ" },
208 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_CONF, "REL_CONF" },
209 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_IND, "REL_IND" },
210 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_REQ, "STATE_REQ" },
211 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_CONF, "STATE_CONF" },
212 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_IND, "STATE_IND" },
213 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_REQ, "DATA_RETR_REQ" },
214 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_CONF, "DATA_RETR_CONF" },
215 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_IND, "DATA_RETR_IND" },
216 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_COMP_IND, "DATA_RETR_COMP_IND" },
217 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_CONG_IND, "CONG_IND" },
218 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_ACK, "DATA_ACK" },
219 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_REQ , "REG_REQ" },
220 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_RSP , "REG_RSP" },
221 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_REQ , "DEREG_REQ" },
222 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_RSP , "DEREG_RSP" },
223 { 0, NULL } };
225 static void
226 dissect_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, proto_tree *m2ua_tree)
228 uint8_t message_class, message_type;
230 /* Extract the common header */
231 message_class = tvb_get_uint8(common_header_tvb, MESSAGE_CLASS_OFFSET);
232 message_type = tvb_get_uint8(common_header_tvb, MESSAGE_TYPE_OFFSET);
234 col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_class * 256 + message_type, message_class_type_acro_values, "reserved"));
236 if (m2ua_tree) {
237 /* add the components of the common header to the protocol tree */
238 proto_tree_add_item(m2ua_tree, hf_version, common_header_tvb, VERSION_OFFSET, VERSION_LENGTH, ENC_BIG_ENDIAN);
239 proto_tree_add_item(m2ua_tree, hf_reserved, common_header_tvb, RESERVED_OFFSET, RESERVED_LENGTH, ENC_BIG_ENDIAN);
240 proto_tree_add_item(m2ua_tree, hf_message_class, common_header_tvb, MESSAGE_CLASS_OFFSET, MESSAGE_CLASS_LENGTH, ENC_BIG_ENDIAN);
241 proto_tree_add_uint_format_value(m2ua_tree, hf_message_type, common_header_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, message_type,
242 "%s (%u)",
243 val_to_str_const(message_class * 256 + message_type, message_class_type_values, "reserved"), message_type);
244 proto_tree_add_item(m2ua_tree, hf_message_length, common_header_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN);
248 #define PARAMETER_TAG_LENGTH 2
249 #define PARAMETER_LENGTH_LENGTH 2
250 #define PARAMETER_HEADER_LENGTH (PARAMETER_TAG_LENGTH + PARAMETER_LENGTH_LENGTH)
252 #define PARAMETER_TAG_OFFSET 0
253 #define PARAMETER_LENGTH_OFFSET (PARAMETER_TAG_OFFSET + PARAMETER_TAG_LENGTH)
254 #define PARAMETER_VALUE_OFFSET (PARAMETER_LENGTH_OFFSET + PARAMETER_LENGTH_LENGTH)
255 #define PARAMETER_HEADER_OFFSET PARAMETER_TAG_OFFSET
258 #define INT_INTERFACE_ID_OFFSET PARAMETER_VALUE_OFFSET
259 #define INT_INTERFACE_ID_LENGTH 4
261 static void
262 dissect_interface_identifier_int_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
264 proto_tree_add_item(parameter_tree, hf_interface_id_int, parameter_tvb, INT_INTERFACE_ID_OFFSET, INT_INTERFACE_ID_LENGTH, ENC_BIG_ENDIAN);
265 proto_item_append_text(parameter_item, " (%d)", tvb_get_ntohl(parameter_tvb, INT_INTERFACE_ID_OFFSET));
268 #define TEXT_INTERFACE_ID_OFFSET PARAMETER_VALUE_OFFSET
270 static void
271 dissect_interface_identifier_text_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
273 uint16_t interface_id_length;
275 interface_id_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
277 proto_tree_add_item(parameter_tree, hf_interface_id_text, parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length, ENC_ASCII);
278 proto_item_append_text(parameter_item, " (%s)",
279 tvb_format_text(pinfo->pool, parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length));
282 #define INFO_STRING_OFFSET PARAMETER_VALUE_OFFSET
284 static void
285 dissect_info_string_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
287 uint16_t info_string_length;
289 info_string_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
290 proto_tree_add_item(parameter_tree, hf_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, ENC_ASCII);
291 proto_item_append_text(parameter_item, " (%s)",
292 tvb_format_text(pinfo->pool, parameter_tvb, INFO_STRING_OFFSET, info_string_length));
295 #define DIAGNOSTIC_INFO_OFFSET PARAMETER_VALUE_OFFSET
297 static void
298 dissect_diagnostic_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
300 uint16_t diag_info_length;
302 diag_info_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
303 proto_tree_add_item(parameter_tree, hf_diagnostic_information, parameter_tvb, DIAGNOSTIC_INFO_OFFSET, diag_info_length, ENC_NA);
304 proto_item_append_text(parameter_item, " (%u byte%s)", diag_info_length, plurality(diag_info_length, "", "s"));
307 #define START_LENGTH 4
308 #define END_LENGTH 4
309 #define INTERVAL_LENGTH (START_LENGTH + END_LENGTH)
311 #define START_OFFSET 0
312 #define END_OFFSET (START_OFFSET + START_LENGTH)
314 static void
315 dissect_interface_identifier_range_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
317 uint16_t number_of_ranges, range_number;
318 int offset;
320 number_of_ranges = (tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH) / INTERVAL_LENGTH;
321 offset = PARAMETER_VALUE_OFFSET;
322 for(range_number = 0; range_number < number_of_ranges; range_number++) {
323 proto_tree_add_item(parameter_tree, hf_interface_id_start, parameter_tvb, offset + START_OFFSET, START_LENGTH, ENC_BIG_ENDIAN);
324 proto_tree_add_item(parameter_tree, hf_interface_id_stop, parameter_tvb, offset + END_OFFSET, END_LENGTH, ENC_BIG_ENDIAN);
325 offset += INTERVAL_LENGTH;
328 proto_item_append_text(parameter_item, " (%u range%s)", number_of_ranges, plurality(number_of_ranges, "", "s"));
331 #define HEARTBEAT_DATA_OFFSET PARAMETER_VALUE_OFFSET
333 static void
334 dissect_heartbeat_data_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
336 uint16_t heartbeat_data_length;
338 heartbeat_data_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
339 proto_tree_add_item(parameter_tree, hf_heartbeat_data, parameter_tvb, HEARTBEAT_DATA_OFFSET, heartbeat_data_length, ENC_NA);
340 proto_item_append_text(parameter_item, " (%u byte%s)", heartbeat_data_length, plurality(heartbeat_data_length, "", "s"));
343 #define OVER_RIDE_TYPE 1
344 #define LOAD_SHARE_TYPE 2
345 #define BROADCAST_TYPE 3
347 static const value_string traffic_mode_type_values[] = {
348 { OVER_RIDE_TYPE , "Override" },
349 { LOAD_SHARE_TYPE, "Load-share" },
350 { BROADCAST_TYPE, "Broadcast" },
351 { 0, NULL } };
353 #define TRAFFIC_MODE_TYPE_LENGTH 4
354 #define TRAFFIC_MODE_TYPE_OFFSET PARAMETER_VALUE_OFFSET
356 static void
357 dissect_traffic_mode_type_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
359 proto_tree_add_item(parameter_tree, hf_traffic_mode_type, parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET, TRAFFIC_MODE_TYPE_LENGTH, ENC_BIG_ENDIAN);
360 proto_item_append_text(parameter_item, " (%s)",
361 val_to_str_const(tvb_get_ntohl(parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET), traffic_mode_type_values, "unknown"));
364 #define INVALID_VERSION_ERROR_CODE 0x01
365 #define INVALID_INTERFACE_IDENTIFIER_ERROR_CODE 0x02
366 #define UNSUPPORTED_MESSAGE_CLASS_ERROR_CODE 0x03
367 #define UNSUPPORTED_MESSAGE_TYPE_ERROR_CODE 0x04
368 #define UNSUPPORTED_TRAFFIC_HANDLING_MODE_ERROR_CODE 0x05
369 #define UNEXPECTED_MESSAGE_ERROR_CODE 0x06
370 #define PROTOCOL_ERROR_ERROR_CODE 0x07
371 #define UNSUPPORTED_INTERFACE_IDENTIFIER_TYPE_ERROR_CODE 0x08
372 #define INVALID_STREAM_IDENTIFIER_ERROR_CODE 0x09
373 #define REFUSED_ERROR_CODE 0x0d
374 #define ASP_IDENTIFIER_REQUIRED_ERROR_CODE 0x0e
375 #define INVALID_ASP_IDENTIFIER_ERROR_CODE 0x0f
376 #define ASP_ACTIVE_FOR_INTERFACE_IDENTIFIER_ERROR_CODE 0x10
377 #define INVALID_PARAMETER_VALUE_ERROR_CODE 0x11
378 #define PARAMETER_FIELD_ERROR_CODE 0x12
379 #define UNEXPECTED_PARAMETER_ERROR_CODE 0x13
380 #define MISSING_PARAMETER_ERROR_CODE 0x16
382 static const value_string error_code_values[] = {
383 { INVALID_VERSION_ERROR_CODE, "Invalid version" },
384 { INVALID_INTERFACE_IDENTIFIER_ERROR_CODE, "Invalid interface identifier" },
385 { UNSUPPORTED_MESSAGE_CLASS_ERROR_CODE, "Unsupported message class" },
386 { UNSUPPORTED_MESSAGE_TYPE_ERROR_CODE, "Unsupported message type" },
387 { UNSUPPORTED_TRAFFIC_HANDLING_MODE_ERROR_CODE, "Unsupported traffic handling mode" },
388 { UNEXPECTED_MESSAGE_ERROR_CODE, "Unexpected message" },
389 { PROTOCOL_ERROR_ERROR_CODE, "Protocol error" },
390 { UNSUPPORTED_INTERFACE_IDENTIFIER_TYPE_ERROR_CODE, "Unsupported interface identifier type" },
391 { INVALID_STREAM_IDENTIFIER_ERROR_CODE, "Invalid stream identifier" },
392 { REFUSED_ERROR_CODE, "Refused - management blocking" },
393 { ASP_IDENTIFIER_REQUIRED_ERROR_CODE, "ASP identifier required" },
394 { INVALID_ASP_IDENTIFIER_ERROR_CODE, "Invalid ASP identifier" },
395 { ASP_ACTIVE_FOR_INTERFACE_IDENTIFIER_ERROR_CODE, "ASP active for interface identifier" },
396 { INVALID_PARAMETER_VALUE_ERROR_CODE, "Invalid parameter value" },
397 { PARAMETER_FIELD_ERROR_CODE, "Parameter field error" },
398 { UNEXPECTED_PARAMETER_ERROR_CODE, "Unexpected parameter" },
399 { MISSING_PARAMETER_ERROR_CODE, "Missing parameter" },
400 { 0, NULL } };
402 #define ERROR_CODE_LENGTH 4
403 #define ERROR_CODE_OFFSET PARAMETER_VALUE_OFFSET
405 static void
406 dissect_error_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
408 proto_tree_add_item(parameter_tree, hf_error_code, parameter_tvb, ERROR_CODE_OFFSET, ERROR_CODE_LENGTH, ENC_BIG_ENDIAN);
409 proto_item_append_text(parameter_item, " (%s)",
410 val_to_str_const(tvb_get_ntohl(parameter_tvb, ERROR_CODE_OFFSET), error_code_values, "unknown"));
413 #define AS_STATE_CHANGE_TYPE 1
414 #define OTHER_TYPE 2
416 static const value_string status_type_values[] = {
417 { AS_STATE_CHANGE_TYPE, "Application server state change" },
418 { OTHER_TYPE, "Other" },
419 { 0, NULL } };
421 #define RESERVED_INFO 1
422 #define AS_INACTIVE_INFO 2
423 #define AS_ACTIVE_INFO 3
424 #define AS_PENDING_INFO 4
426 #define INSUFFICIENT_ASP_RES_INFO 1
427 #define ALTERNATE_ASP_ACTIVE_INFO 2
428 #define ASP_FAILURE_INFO 3
430 static const value_string status_type_id_values[] = {
431 { AS_STATE_CHANGE_TYPE * 256 * 256 + RESERVED_INFO, "Reserved" },
432 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_INACTIVE_INFO, "Application server inactive" },
433 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_ACTIVE_INFO, "Application server active" },
434 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_PENDING_INFO, "Application server pending" },
435 { OTHER_TYPE * 256 * 256 + INSUFFICIENT_ASP_RES_INFO, "Insufficient ASP resources active in AS" },
436 { OTHER_TYPE * 256 * 256 + ALTERNATE_ASP_ACTIVE_INFO, "Alternate ASP active" },
437 { OTHER_TYPE * 256 * 256 + ASP_FAILURE_INFO, "ASP Failure" },
438 {0, NULL } };
440 #define STATUS_TYPE_LENGTH 2
441 #define STATUS_IDENT_LENGTH 2
443 #define STATUS_TYPE_OFFSET PARAMETER_VALUE_OFFSET
444 #define STATUS_IDENT_OFFSET (STATUS_TYPE_OFFSET + STATUS_TYPE_LENGTH)
446 static void
447 dissect_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
449 uint16_t status_type, status_id;
451 status_type = tvb_get_ntohs(parameter_tvb, STATUS_TYPE_OFFSET);
452 status_id = tvb_get_ntohs(parameter_tvb, STATUS_IDENT_OFFSET);
454 proto_tree_add_item(parameter_tree, hf_status_type, parameter_tvb, STATUS_TYPE_OFFSET, STATUS_TYPE_LENGTH, ENC_BIG_ENDIAN);
455 proto_tree_add_uint_format(parameter_tree, hf_status_ident, parameter_tvb, STATUS_IDENT_OFFSET, STATUS_IDENT_LENGTH,
456 status_id, "Status identification: %u (%s)", status_id,
457 val_to_str_const(status_type * 256 * 256 + status_id, status_type_id_values, "unknown"));
459 proto_item_append_text(parameter_item, " (%s)",
460 val_to_str_const(status_type * 256 * 256 + status_id, status_type_id_values, "unknown status information"));
463 #define ASP_IDENTIFIER_OFFSET PARAMETER_VALUE_OFFSET
464 #define ASP_IDENTIFIER_LENGTH 4
466 static void
467 dissect_asp_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
469 proto_tree_add_item(parameter_tree, hf_asp_id, parameter_tvb, ASP_IDENTIFIER_OFFSET, ASP_IDENTIFIER_LENGTH, ENC_BIG_ENDIAN);
470 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, ASP_IDENTIFIER_OFFSET));
473 #define CORRELATION_ID_LENGTH 4
474 #define CORRELATION_ID_OFFSET PARAMETER_VALUE_OFFSET
476 static void
477 dissect_correlation_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
479 proto_tree_add_item(parameter_tree, hf_correlation_id, parameter_tvb, CORRELATION_ID_OFFSET, CORRELATION_ID_LENGTH, ENC_BIG_ENDIAN);
480 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, CORRELATION_ID_OFFSET));
483 #define DATA_1_MTP3_OFFSET PARAMETER_VALUE_OFFSET
485 static void
486 dissect_protocol_data_1_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_item *parameter_item)
488 tvbuff_t *payload_tvb;
489 uint32_t payload_length;
491 payload_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
493 payload_tvb = tvb_new_subset_length(parameter_tvb, DATA_1_MTP3_OFFSET, payload_length);
494 proto_item_set_len(parameter_item, PARAMETER_HEADER_LENGTH);
495 call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
497 proto_item_set_text(parameter_item, "Data 1 parameter");
500 #define DATA_2_LI_LENGTH 1
501 #define DATA_2_LI_OFFSET PARAMETER_VALUE_OFFSET
502 #define DATA_2_MTP3_OFFSET (DATA_2_LI_OFFSET + DATA_2_LI_LENGTH)
504 static void
505 dissect_protocol_data_2_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree, proto_item *parameter_item)
507 tvbuff_t *payload_tvb;
508 uint32_t payload_length;
510 payload_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH - DATA_2_LI_LENGTH;
512 proto_tree_add_item(parameter_tree, hf_data_2_li, parameter_tvb, DATA_2_LI_OFFSET, DATA_2_LI_LENGTH, ENC_BIG_ENDIAN);
513 payload_tvb = tvb_new_subset_length(parameter_tvb, DATA_2_MTP3_OFFSET, payload_length);
514 proto_item_set_len(parameter_item, PARAMETER_HEADER_LENGTH + DATA_2_LI_LENGTH);
515 call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
519 #define STATUS_LPO_SET 0x0
520 #define STATUS_LPO_CLEAR 0x1
521 #define STATUS_EMER_SET 0x2
522 #define STATUS_EMER_CLEAR 0x3
523 #define STATUS_FLUSH_BUFFERS 0x4
524 #define STATUS_CONTINUE 0x5
525 #define STATUS_CLEAR_RTB 0x6
526 #define STATUS_AUDIT 0x7
527 #define STATUS_CONG_CLEAR 0x8
528 #define STATUS_CONG_ACCEPT 0x9
529 #define STATUS_CONG_DISCARD 0xa
531 static const value_string state_values[] = {
532 { STATUS_LPO_SET, "Request local processor outage" },
533 { STATUS_LPO_CLEAR, "Request local processor outage recovered" },
534 { STATUS_EMER_SET, "Request emergency alignment" },
535 { STATUS_EMER_CLEAR, "Request normal alignment (cancel emergency)" },
536 { STATUS_FLUSH_BUFFERS, "Flush or clear receive, transmit and retransmit queues" },
537 { STATUS_CONTINUE, "Continue or Resume" },
538 { STATUS_CLEAR_RTB, "Clear the retransmit queue" },
539 { STATUS_AUDIT, "Audit state of link" },
540 { STATUS_CONG_CLEAR, "Congestion cleared" },
541 { STATUS_CONG_ACCEPT, "Congestion accept" },
542 { STATUS_CONG_DISCARD, "Congestion discard" },
543 {0, NULL } };
545 #define STATE_LENGTH 4
546 #define STATE_OFFSET PARAMETER_VALUE_OFFSET
548 static void
549 dissect_state_request_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
551 proto_tree_add_item(parameter_tree, hf_state, parameter_tvb, STATE_OFFSET, STATE_LENGTH, ENC_BIG_ENDIAN);
552 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, STATE_OFFSET), state_values, "unknown"));
555 #define EVENT_RPO_ENTER 0x1
556 #define EVENT_RPO_EXIT 0x2
557 #define EVENT_LPO_ENTER 0x3
558 #define EVENT_LPO_EXIT 0x4
560 static const value_string event_values[] = {
561 { EVENT_RPO_ENTER, "Remote entered processor outage" },
562 { EVENT_RPO_EXIT, "Remote exited processor outage" },
563 { EVENT_LPO_ENTER, "Link entered processor outage" },
564 { EVENT_LPO_EXIT, "Link exited processor outage" },
565 {0, NULL } };
567 #define EVENT_LENGTH 4
568 #define EVENT_OFFSET PARAMETER_VALUE_OFFSET
570 static void
571 dissect_state_event_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
573 proto_tree_add_item(parameter_tree, hf_event, parameter_tvb, EVENT_OFFSET, EVENT_LENGTH, ENC_BIG_ENDIAN);
574 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, STATE_OFFSET), event_values, "unknown"));
577 #define LEVEL_NONE 0x0
578 #define LEVEL_1 0x1
579 #define LEVEL_2 0x2
580 #define LEVEL_3 0x3
582 static const value_string level_values[] = {
583 { LEVEL_NONE, "No congestion" },
584 { LEVEL_1, "Congestion Level 1" },
585 { LEVEL_2, "Congestion Level 2" },
586 { LEVEL_3, "Congestion Level 3" },
587 {0, NULL } };
589 #define CONGESTION_STATUS_LENGTH 4
590 #define CONGESTION_STATUS_OFFSET PARAMETER_VALUE_OFFSET
592 static void
593 dissect_congestion_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
595 proto_tree_add_item(parameter_tree, hf_congestion_status, parameter_tvb, CONGESTION_STATUS_OFFSET, CONGESTION_STATUS_LENGTH, ENC_BIG_ENDIAN);
596 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, CONGESTION_STATUS_OFFSET), level_values, "unknown"));
599 #define DISCARD_STATUS_LENGTH 4
600 #define DISCARD_STATUS_OFFSET PARAMETER_VALUE_OFFSET
602 static void
603 dissect_discard_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
605 proto_tree_add_item(parameter_tree, hf_discard_status, parameter_tvb, DISCARD_STATUS_OFFSET, DISCARD_STATUS_LENGTH, ENC_BIG_ENDIAN);
606 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, DISCARD_STATUS_OFFSET), level_values, "unknown"));
609 #define ACTION_RTRV_BSN 0x1
610 #define ACTION_RTRV_MSGS 0x2
612 static const value_string action_values[] = {
613 { ACTION_RTRV_BSN, "Retrieve the backward sequence number" },
614 { ACTION_RTRV_MSGS, "Retrieve the PDUs from the transmit and retransmit queues" },
615 {0, NULL } };
618 #define ACTION_LENGTH 4
619 #define ACTION_OFFSET PARAMETER_VALUE_OFFSET
621 static void
622 dissect_action_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
624 proto_tree_add_item(parameter_tree, hf_action, parameter_tvb, ACTION_OFFSET, ACTION_LENGTH, ENC_BIG_ENDIAN);
625 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, ACTION_OFFSET), action_values, "unknown"));
628 #define SEQUENCE_NUMBER_LENGTH 4
629 #define SEQUENCE_NUMBER_OFFSET PARAMETER_VALUE_OFFSET
631 static void
632 dissect_sequence_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
634 proto_tree_add_item(parameter_tree, hf_sequence_number, parameter_tvb, SEQUENCE_NUMBER_OFFSET, SEQUENCE_NUMBER_LENGTH, ENC_BIG_ENDIAN);
635 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, SEQUENCE_NUMBER_OFFSET));
638 #define RESULT_SUCCESS 0x0
639 #define RESULT_FAILURE 0x1
641 static const value_string retrieval_result_values[] = {
642 { RESULT_SUCCESS, "Action successful" },
643 { RESULT_FAILURE , "Action failed" },
644 { 0, NULL } };
647 #define RETRIEVAL_RESULT_LENGTH 4
648 #define RETRIEVAL_RESULT_OFFSET PARAMETER_VALUE_OFFSET
650 static void
651 dissect_retrieval_result_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
653 proto_tree_add_item(parameter_tree, hf_retrieval_result, parameter_tvb, RETRIEVAL_RESULT_OFFSET, RETRIEVAL_RESULT_LENGTH, ENC_BIG_ENDIAN);
654 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, RETRIEVAL_RESULT_OFFSET), retrieval_result_values, "unknown"));
657 static void
658 // NOLINTNEXTLINE(misc-no-recursion)
659 dissect_link_key_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
661 tvbuff_t *parameters_tvb;
662 uint16_t parameters_length;
664 parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
665 parameters_tvb = tvb_new_subset_length(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length);
666 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
669 #define LOCAL_LK_ID_LENGTH 4
670 #define LOCAL_LK_ID_OFFSET PARAMETER_VALUE_OFFSET
672 static void
673 dissect_local_lk_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
675 proto_tree_add_item(parameter_tree, hf_local_lk_id, parameter_tvb, LOCAL_LK_ID_OFFSET, LOCAL_LK_ID_LENGTH, ENC_BIG_ENDIAN);
676 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, LOCAL_LK_ID_OFFSET));
679 #define SDT_RESERVED_LENGTH 2
680 #define SDT_ID_LENGTH 2
681 #define SDT_RESERVED_OFFSET PARAMETER_VALUE_OFFSET
682 #define SDT_ID_OFFSET (SDT_RESERVED_OFFSET + SDT_RESERVED_LENGTH)
684 static void
685 dissect_sdt_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
687 proto_tree_add_item(parameter_tree, hf_sdt_reserved, parameter_tvb, SDT_RESERVED_OFFSET, SDT_RESERVED_LENGTH, ENC_BIG_ENDIAN);
688 proto_tree_add_item(parameter_tree, hf_sdt_id, parameter_tvb, SDT_ID_OFFSET, SDT_ID_LENGTH, ENC_BIG_ENDIAN);
689 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohs(parameter_tvb, SDT_ID_OFFSET));
692 #define SDL_RESERVED_LENGTH 2
693 #define SDL_ID_LENGTH 2
694 #define SDL_RESERVED_OFFSET PARAMETER_VALUE_OFFSET
695 #define SDL_ID_OFFSET (SDL_RESERVED_OFFSET + SDL_RESERVED_LENGTH)
697 static void
698 dissect_sdl_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
700 proto_tree_add_item(parameter_tree, hf_sdl_reserved, parameter_tvb, SDL_RESERVED_OFFSET, SDL_RESERVED_LENGTH, ENC_BIG_ENDIAN);
701 proto_tree_add_item(parameter_tree, hf_sdl_id, parameter_tvb, SDL_ID_OFFSET, SDL_ID_LENGTH, ENC_BIG_ENDIAN);
702 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohs(parameter_tvb, SDL_ID_OFFSET));
705 static void
706 // NOLINTNEXTLINE(misc-no-recursion)
707 dissect_registration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
709 tvbuff_t *parameters_tvb;
710 uint16_t parameters_length;
712 parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
713 parameters_tvb = tvb_new_subset_length(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length);
714 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
717 #define SUCCESSFULL_REGISTRATION_STATUS 0
718 #define UNKNOWN_REGISTRATION_STATUS 1
719 #define INVALID_SDLI_REGISTRATION_STATUS 2
720 #define INVALID_SDTI_REGISTRATION_STATUS 3
721 #define INVALID_LINK_KEY_REGISTRATION_STATUS 4
722 #define PERMISSION_DENIED_REGISTRATION_STATUS 5
723 #define OVERLAPPING_LINK_KEY_REGISTRATION_STATUS 6
724 #define LINK_KEY_NOT_PROVISIONED_REGISTRATION_STATUS 7
725 #define INSUFFICIENT_RESOURCES_REGISTRATION_STATUS 8
727 static const value_string registration_status_values[] = {
728 { SUCCESSFULL_REGISTRATION_STATUS, "Successfully registered" },
729 { UNKNOWN_REGISTRATION_STATUS, "Error - Unknown" },
730 { INVALID_SDLI_REGISTRATION_STATUS, "Error - Invalid SDLI" },
731 { INVALID_SDTI_REGISTRATION_STATUS, "Error - Invalid SDTI" },
732 { INVALID_LINK_KEY_REGISTRATION_STATUS, "Error - Invalid link key" },
733 { PERMISSION_DENIED_REGISTRATION_STATUS, "Error - Permission denied" },
734 { OVERLAPPING_LINK_KEY_REGISTRATION_STATUS, "Error - Overlapping (Non-unique) link key" },
735 { LINK_KEY_NOT_PROVISIONED_REGISTRATION_STATUS, "Error - Link key not provisioned" },
736 { INSUFFICIENT_RESOURCES_REGISTRATION_STATUS, "Error - Insufficient resources" },
737 { 0, NULL } };
739 #define REGISTRATION_STATUS_LENGTH 4
740 #define REGISTRATION_STATUS_OFFSET PARAMETER_VALUE_OFFSET
742 static void
743 dissect_registration_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
745 proto_tree_add_item(parameter_tree, hf_registration_status, parameter_tvb, REGISTRATION_STATUS_OFFSET, REGISTRATION_STATUS_LENGTH, ENC_BIG_ENDIAN);
746 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, REGISTRATION_STATUS_OFFSET), registration_status_values, "unknown"));
749 static void
750 // NOLINTNEXTLINE(misc-no-recursion)
751 dissect_deregistration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
753 tvbuff_t *parameters_tvb;
754 uint16_t parameters_length;
756 parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
757 parameters_tvb = tvb_new_subset_length(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length);
758 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
761 #define SUCCESSFULL_DEREGISTRATION_STATUS 0
762 #define UNKNOWN_DEREGISTRATION_STATUS 1
763 #define INVALID_INTERFACE_IDENTIFIER_DEREGISTRATION_STATUS 2
764 #define PERMISSION_DENIED_DEREGISTRATION_STATUS 3
765 #define NOT_REGISTRED_DEREGISTRATION_STATUS 4
767 static const value_string deregistration_status_values[] = {
768 { SUCCESSFULL_DEREGISTRATION_STATUS, "Successfully deregistered" },
769 { UNKNOWN_DEREGISTRATION_STATUS, "Error - Unknown" },
770 { INVALID_INTERFACE_IDENTIFIER_DEREGISTRATION_STATUS, "Error - Invalid interface identifier" },
771 { PERMISSION_DENIED_DEREGISTRATION_STATUS, "Error - Permission denied" },
772 { NOT_REGISTRED_DEREGISTRATION_STATUS, "Error - Not registered" },
773 { 0, NULL } };
775 #define DEREGISTRATION_STATUS_LENGTH 4
776 #define DEREGISTRATION_STATUS_OFFSET PARAMETER_VALUE_OFFSET
778 static void
779 dissect_deregistration_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
781 proto_tree_add_item(parameter_tree, hf_deregistration_status, parameter_tvb, DEREGISTRATION_STATUS_OFFSET, DEREGISTRATION_STATUS_LENGTH, ENC_BIG_ENDIAN);
782 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, DEREGISTRATION_STATUS_OFFSET), deregistration_status_values, "unknown"));
785 static void
786 dissect_unknown_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
788 uint16_t parameter_value_length;
790 parameter_value_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
791 if (parameter_value_length > 0)
792 proto_tree_add_item(parameter_tree, hf_parameter_value, parameter_tvb, PARAMETER_VALUE_OFFSET, parameter_value_length, ENC_NA);
793 proto_item_append_text(parameter_item, " with tag %u and %u byte%s value",
794 tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET), parameter_value_length, plurality(parameter_value_length, "", "s"));
797 /* Common parameter tags */
798 #define INTERFACE_IDENTIFIER_INT_PARAMETER_TAG 0x0001
799 #define INTERFACE_IDENTIFIER_TEXT_PARAMETER_TAG 0x0003
800 #define INFO_STRING_PARAMETER_TAG 0x0004
801 #define DIAGNOSTIC_INFORMATION_PARAMETER_TAG 0x0007
802 #define INTERFACE_IDENTIFIER_RANGE_PARAMETER_TAG 0x0008
803 #define HEARTBEAT_DATA_PARAMETER_TAG 0x0009
804 #define TRAFFIC_MODE_TYPE_PARAMETER_TAG 0x000b
805 #define ERROR_CODE_PARAMETER_TAG 0x000c
806 #define STATUS_PARAMETER_TAG 0x000d
807 #define ASP_IDENTIFIER_PARAMETER_TAG 0x0011
808 #define CORRELATION_IDENTIFIER_PARAMETER_TAG 0x0013
810 /* M2PA specific parameter tags */
811 #define PROTOCOL_DATA_1_PARAMETER_TAG 0x0300
812 #define PROTOCOL_DATA_2_PARAMETER_TAG 0x0301
813 #define STATE_REQUEST_PARAMETER_TAG 0x0302
814 #define STATE_EVENT_PARAMETER_TAG 0x0303
815 #define CONGESTION_STATUS_PARAMETER_TAG 0x0304
816 #define DISCARD_STATUS_PARAMETER_TAG 0x0305
817 #define ACTION_PARAMETER_TAG 0x0306
818 #define SEQUENCE_NUMBER_PARAMETER_TAG 0x0307
819 #define RETRIEVAL_RESULT_PARAMETER_TAG 0x0308
820 #define LINK_KEY_PARAMETER_TAG 0x0309
821 #define LOCAL_LK_IDENTIFIER_PARAMETER_TAG 0x030a
822 #define SDT_IDENTIFIER_PARAMETER_TAG 0x030b
823 #define SDL_IDENTIFIER_PARAMETER_TAG 0x030c
824 #define REG_RESULT_PARAMETER_TAG 0x030d
825 #define REG_STATUS_PARAMETER_TAG 0x030e
826 #define DEREG_RESULT_PARAMETER_TAG 0x030f
827 #define DEREG_STATUS_PARAMETER_TAG 0x0310
829 static const value_string parameter_tag_values[] = {
830 { INTERFACE_IDENTIFIER_INT_PARAMETER_TAG, "Interface identifier (integer)" },
831 { INTERFACE_IDENTIFIER_TEXT_PARAMETER_TAG, "Interface identifier (text)" },
832 { INFO_STRING_PARAMETER_TAG, "Info string" },
833 { DIAGNOSTIC_INFORMATION_PARAMETER_TAG, "Diagnostic information" },
834 { INTERFACE_IDENTIFIER_RANGE_PARAMETER_TAG, "Interface identifier (integer range)" },
835 { HEARTBEAT_DATA_PARAMETER_TAG, "Heartbeat data" },
836 { TRAFFIC_MODE_TYPE_PARAMETER_TAG, "Traffic mode type" },
837 { ERROR_CODE_PARAMETER_TAG, "Error code" },
838 { STATUS_PARAMETER_TAG, "Status type / information" },
839 { ASP_IDENTIFIER_PARAMETER_TAG, "ASP identifier" },
840 { CORRELATION_IDENTIFIER_PARAMETER_TAG, "Correlation identifier" },
841 { PROTOCOL_DATA_1_PARAMETER_TAG, "Protocol data 1" },
842 { PROTOCOL_DATA_2_PARAMETER_TAG, "Protocol data 2" },
843 { STATE_REQUEST_PARAMETER_TAG, "State request" },
844 { STATE_EVENT_PARAMETER_TAG, "State event" },
845 { CONGESTION_STATUS_PARAMETER_TAG, "Congestion state" },
846 { DISCARD_STATUS_PARAMETER_TAG, "Discard state" },
847 { ACTION_PARAMETER_TAG, "Action" },
848 { SEQUENCE_NUMBER_PARAMETER_TAG, "Sequence number" },
849 { RETRIEVAL_RESULT_PARAMETER_TAG, "Retrieval result" },
850 { LINK_KEY_PARAMETER_TAG, "Link key" },
851 { LOCAL_LK_IDENTIFIER_PARAMETER_TAG, "Local LK identifier" },
852 { SDT_IDENTIFIER_PARAMETER_TAG, "SDT identifier" },
853 { SDL_IDENTIFIER_PARAMETER_TAG, "SDL identifier" },
854 { REG_RESULT_PARAMETER_TAG, "Registration result" },
855 { REG_STATUS_PARAMETER_TAG, "Registration status" },
856 { DEREG_RESULT_PARAMETER_TAG, "Deregistration result" },
857 { DEREG_STATUS_PARAMETER_TAG, "Deregistration status" },
858 { 0, NULL } };
861 * Default preference for 'Protocol Data 1 Parameter Tag' is RFC3331 value
862 * defined above (PROTOCOL_DATA_1_PARAMETER_TAG)
864 * The other option is the old Draft 7 value defined below.
866 #define PROTOCOL_DATA_1_DRAFT_7 0x000e
867 static int protocol_data_1_global = PROTOCOL_DATA_1_PARAMETER_TAG;
869 static void
870 // NOLINTNEXTLINE(misc-no-recursion)
871 dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
873 uint16_t tag, length, padding_length;
874 proto_item *parameter_item;
875 proto_tree *parameter_tree;
877 /* extract tag and length from the parameter */
878 tag = tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET);
879 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
881 /* calculate padding and total length */
882 padding_length = tvb_reported_length(parameter_tvb) - length;
884 /* create proto_tree stuff */
885 parameter_tree = proto_tree_add_subtree(m2ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, -1,
886 ett_m2ua_parameter, &parameter_item, val_to_str_const(tag, parameter_tag_values, "Unknown parameter"));
888 if ((protocol_data_1_global == PROTOCOL_DATA_1_DRAFT_7) &&
889 (tag == PROTOCOL_DATA_1_DRAFT_7))
891 /* add tag and length to the m2ua tree */
892 proto_tree_add_uint_format_value(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH,
893 tag, "Protocol data 1 (0x000e)");
895 proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
896 tag = PROTOCOL_DATA_1_PARAMETER_TAG;
898 else
900 /* add tag and length to the m2ua tree */
901 proto_tree_add_item(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, ENC_BIG_ENDIAN);
902 proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
905 switch(tag) {
906 case INTERFACE_IDENTIFIER_INT_PARAMETER_TAG:
907 dissect_interface_identifier_int_parameter(parameter_tvb, parameter_tree, parameter_item);
908 break;
909 case INTERFACE_IDENTIFIER_TEXT_PARAMETER_TAG:
910 dissect_interface_identifier_text_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
911 break;
912 case INFO_STRING_PARAMETER_TAG:
913 dissect_info_string_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item);
914 break;
915 case DIAGNOSTIC_INFORMATION_PARAMETER_TAG:
916 dissect_diagnostic_information_parameter(parameter_tvb, parameter_tree, parameter_item);
917 break;
918 case INTERFACE_IDENTIFIER_RANGE_PARAMETER_TAG:
919 dissect_interface_identifier_range_parameter(parameter_tvb, parameter_tree, parameter_item);
920 break;
921 case HEARTBEAT_DATA_PARAMETER_TAG:
922 dissect_heartbeat_data_parameter(parameter_tvb, parameter_tree, parameter_item);
923 break;
924 case TRAFFIC_MODE_TYPE_PARAMETER_TAG:
925 dissect_traffic_mode_type_parameter(parameter_tvb, parameter_tree, parameter_item);
926 break;
927 case ERROR_CODE_PARAMETER_TAG:
928 dissect_error_code_parameter(parameter_tvb, parameter_tree, parameter_item);
929 break;
930 case STATUS_PARAMETER_TAG:
931 dissect_status_parameter(parameter_tvb, parameter_tree, parameter_item);
932 break;
933 case ASP_IDENTIFIER_PARAMETER_TAG:
934 dissect_asp_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
935 break;
936 case CORRELATION_IDENTIFIER_PARAMETER_TAG:
937 dissect_correlation_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
938 break;
939 case PROTOCOL_DATA_1_PARAMETER_TAG:
940 dissect_protocol_data_1_parameter(parameter_tvb, pinfo, tree, parameter_item);
941 break;
942 case PROTOCOL_DATA_2_PARAMETER_TAG:
943 dissect_protocol_data_2_parameter(parameter_tvb, pinfo, tree, parameter_tree, parameter_item);
944 break;
945 case STATE_REQUEST_PARAMETER_TAG:
946 dissect_state_request_parameter(parameter_tvb, parameter_tree, parameter_item);
947 break;
948 case STATE_EVENT_PARAMETER_TAG:
949 dissect_state_event_parameter(parameter_tvb, parameter_tree, parameter_item);
950 break;
951 case CONGESTION_STATUS_PARAMETER_TAG:
952 dissect_congestion_status_parameter(parameter_tvb, parameter_tree, parameter_item);
953 break;
954 case DISCARD_STATUS_PARAMETER_TAG:
955 dissect_discard_status_parameter(parameter_tvb, parameter_tree, parameter_item);
956 break;
957 case ACTION_PARAMETER_TAG:
958 dissect_action_parameter(parameter_tvb, parameter_tree, parameter_item);
959 break;
960 case SEQUENCE_NUMBER_PARAMETER_TAG:
961 dissect_sequence_number_parameter(parameter_tvb, parameter_tree, parameter_item);
962 break;
963 case RETRIEVAL_RESULT_PARAMETER_TAG:
964 dissect_retrieval_result_parameter(parameter_tvb, parameter_tree, parameter_item);
965 break;
966 case LINK_KEY_PARAMETER_TAG:
967 dissect_link_key_parameter(parameter_tvb, pinfo, tree, parameter_tree);
968 break;
969 case LOCAL_LK_IDENTIFIER_PARAMETER_TAG:
970 dissect_local_lk_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
971 break;
972 case SDT_IDENTIFIER_PARAMETER_TAG:
973 dissect_sdt_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
974 break;
975 case SDL_IDENTIFIER_PARAMETER_TAG:
976 dissect_sdl_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
977 break;
978 case REG_RESULT_PARAMETER_TAG:
979 dissect_registration_result_parameter(parameter_tvb, pinfo, tree, parameter_tree);
980 break;
981 case REG_STATUS_PARAMETER_TAG:
982 dissect_registration_status_parameter(parameter_tvb, parameter_tree, parameter_item);
983 break;
984 case DEREG_RESULT_PARAMETER_TAG:
985 dissect_deregistration_result_parameter(parameter_tvb, pinfo, tree, parameter_tree);
986 break;
987 case DEREG_STATUS_PARAMETER_TAG:
988 dissect_deregistration_status_parameter(parameter_tvb, parameter_tree, parameter_item);
989 break;
990 default:
991 dissect_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
992 break;
995 if (padding_length > 0)
996 proto_tree_add_item(parameter_tree, hf_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
1000 static void
1001 // NOLINTNEXTLINE(misc-no-recursion)
1002 dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
1004 int offset, length, total_length, remaining_length;
1005 tvbuff_t *parameter_tvb;
1007 offset = 0;
1008 while((remaining_length = tvb_reported_length_remaining(parameters_tvb, offset))) {
1009 length = tvb_get_ntohs(parameters_tvb, offset + PARAMETER_LENGTH_OFFSET);
1010 total_length = WS_ROUNDUP_4(length);
1011 if (remaining_length >= length)
1012 total_length = MIN(total_length, remaining_length);
1013 /* create a tvb for the parameter including the padding bytes */
1014 parameter_tvb = tvb_new_subset_length(parameters_tvb, offset, total_length);
1015 increment_dissection_depth(pinfo);
1016 dissect_parameter(parameter_tvb, pinfo, tree, m2ua_tree);
1017 decrement_dissection_depth(pinfo);
1018 /* get rid of the handled parameter */
1019 offset += total_length;
1024 static void
1025 dissect_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
1027 tvbuff_t *common_header_tvb, *parameters_tvb;
1029 common_header_tvb = tvb_new_subset_length(message_tvb, 0, COMMON_HEADER_LENGTH);
1030 parameters_tvb = tvb_new_subset_remaining(message_tvb, COMMON_HEADER_LENGTH);
1031 dissect_common_header(common_header_tvb, pinfo, m2ua_tree);
1032 dissect_parameters(parameters_tvb, pinfo, tree, m2ua_tree);
1035 static int
1036 dissect_m2ua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1038 proto_item *m2ua_item;
1039 proto_tree *m2ua_tree;
1041 /* make entry in the Protocol column on summary display */
1042 col_set_str(pinfo->cinfo, COL_PROTOCOL, "M2UA");
1044 /* create the m2ua protocol tree */
1045 m2ua_item = proto_tree_add_item(tree, proto_m2ua, message_tvb, 0, -1, ENC_NA);
1046 m2ua_tree = proto_item_add_subtree(m2ua_item, ett_m2ua);
1048 /* dissect the message */
1049 dissect_message(message_tvb, pinfo, tree, m2ua_tree);
1050 return tvb_captured_length(message_tvb);
1053 /* Register the protocol with Wireshark */
1054 void
1055 proto_register_m2ua(void)
1058 /* Setup list of header fields */
1059 static hf_register_info hf[] = {
1060 { &hf_version, { "Version", "m2ua.version", FT_UINT8, BASE_DEC, VALS(protocol_version_values), 0x0, NULL, HFILL } },
1061 { &hf_reserved, { "Reserved", "m2ua.reserved", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
1062 { &hf_message_class, { "Message class", "m2ua.message_class", FT_UINT8, BASE_DEC, VALS(message_class_values), 0x0, NULL, HFILL } },
1063 { &hf_message_type, { "Message Type", "m2ua.message_type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1064 { &hf_message_length, { "Message length", "m2ua.message_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1065 { &hf_parameter_tag, { "Parameter Tag", "m2ua.parameter_tag", FT_UINT16, BASE_HEX, VALS(parameter_tag_values), 0x0, NULL, HFILL } },
1066 { &hf_parameter_length, { "Parameter length", "m2ua.parameter_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1067 { &hf_parameter_value, { "Parameter value", "m2ua.parameter_value", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1068 { &hf_parameter_padding, { "Padding", "m2ua.parameter_padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1069 { &hf_interface_id_int, { "Interface Identifier (integer)", "m2ua.interface_identifier_int", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1070 { &hf_interface_id_text, { "Interface identifier (text)", "m2ua.interface_identifier_text", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1071 { &hf_info_string, { "Info string", "m2ua.info_string", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1072 { &hf_diagnostic_information, { "Diagnostic information", "m2ua.diagnostic_information", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1073 { &hf_interface_id_start, { "Interface Identifier (start)", "m2ua.interface_identifier_start", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1074 { &hf_interface_id_stop, { "Interface Identifier (stop)", "m2ua.interface_identifier_stop", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1075 { &hf_heartbeat_data, { "Heartbeat data", "m2ua.heartbeat_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1076 { &hf_traffic_mode_type, { "Traffic mode Type", "m2ua.traffic_mode_type", FT_UINT32, BASE_DEC, VALS(traffic_mode_type_values), 0x0, NULL, HFILL } },
1077 { &hf_error_code, { "Error code", "m2ua.error_code", FT_UINT32, BASE_DEC, VALS(error_code_values), 0x0, NULL, HFILL } },
1078 { &hf_status_type, { "Status type", "m2ua.status_type", FT_UINT16, BASE_DEC, VALS(status_type_values), 0x0, NULL, HFILL } },
1079 { &hf_status_ident, { "Status info", "m2ua.status_info", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1080 { &hf_asp_id, { "ASP identifier", "m2ua.asp_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1081 { &hf_correlation_id, { "Correlation identifier", "m2ua.correlation_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1082 { &hf_data_2_li, { "Length indicator", "m2ua.data_2_li", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1083 { &hf_state, { "State", "m2ua.state", FT_UINT32, BASE_DEC, VALS(state_values), 0x0, NULL, HFILL } },
1084 { &hf_event, { "Event", "m2ua.event", FT_UINT32, BASE_DEC, VALS(event_values), 0x0, NULL, HFILL } },
1085 { &hf_congestion_status, { "Congestion status", "m2ua.congestion_status", FT_UINT32, BASE_DEC, VALS(level_values), 0x0, NULL, HFILL } },
1086 { &hf_discard_status, { "Discard status", "m2ua.discard_status", FT_UINT32, BASE_DEC, VALS(level_values), 0x0, NULL, HFILL } },
1087 { &hf_action, { "Actions", "m2ua.action", FT_UINT32, BASE_DEC, VALS(action_values), 0x0, NULL, HFILL } },
1088 { &hf_sequence_number, { "Sequence number", "m2ua.sequence_number", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1089 { &hf_retrieval_result, { "Retrieval result", "m2ua.retrieval_result", FT_UINT32, BASE_DEC, VALS(retrieval_result_values), 0x0, NULL, HFILL } },
1090 { &hf_local_lk_id, { "Local LK identifier", "m2ua.local_lk_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1091 { &hf_sdt_reserved, { "Reserved", "m2ua.sdt_reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
1092 { &hf_sdt_id, { "SDT identifier", "m2ua.sdt_identifier", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1093 { &hf_sdl_reserved, { "Reserved", "m2ua.sdl_reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
1094 { &hf_sdl_id, { "SDL identifier", "m2ua.sdl_identifier", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1095 { &hf_registration_status, { "Registration status", "m2ua.registration_status", FT_UINT32, BASE_DEC, VALS(registration_status_values), 0x0, NULL, HFILL } },
1096 { &hf_deregistration_status, { "Deregistration status", "m2ua.deregistration_status", FT_UINT32, BASE_DEC, VALS(deregistration_status_values), 0x0, NULL, HFILL } },
1099 /* Setup protocol subtree array */
1100 static int *ett[] = {
1101 &ett_m2ua,
1102 &ett_m2ua_parameter,
1105 static const enum_val_t protocol_data_1_options[] = {
1106 { "draft-7", "0x000e (Draft 7)", PROTOCOL_DATA_1_DRAFT_7 },
1107 { "rfc3331", "0x0300 (RFC3331)", PROTOCOL_DATA_1_PARAMETER_TAG },
1108 { NULL, NULL, 0 }
1111 module_t *m2ua_module;
1113 /* Register the protocol name and description */
1114 proto_m2ua = proto_register_protocol("MTP 2 User Adaptation Layer", "M2UA", "m2ua");
1115 m2ua_handle = register_dissector("m2ua", dissect_m2ua, proto_m2ua);
1117 /* Required function calls to register the header fields and subtrees used */
1118 proto_register_field_array(proto_m2ua, hf, array_length(hf));
1119 proto_register_subtree_array(ett, array_length(ett));
1121 m2ua_module = prefs_register_protocol(proto_m2ua, NULL);
1123 prefs_register_enum_preference(m2ua_module,
1124 "protocol_data_1_tag",
1125 "Protocol Data 1 Parameter Tag",
1126 "The value of the parameter tag for protocol data 1",
1127 &protocol_data_1_global,
1128 protocol_data_1_options,
1129 false);
1132 void
1133 proto_reg_handoff_m2ua(void)
1135 mtp3_handle = find_dissector_add_dependency("mtp3", proto_m2ua);
1136 dissector_add_uint("sctp.ppi", M2UA_PAYLOAD_PROTOCOL_ID, m2ua_handle);
1137 dissector_add_uint("sctp.port", SCTP_PORT_M2UA, m2ua_handle);
1141 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1143 * Local Variables:
1144 * c-basic-offset: 2
1145 * tab-width: 8
1146 * indent-tabs-mode: nil
1147 * End:
1149 * ex: set shiftwidth=2 tabstop=8 expandtab:
1150 * :indentSize=2:tabSize=8:noTabs=true: