HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-m2ua.c
blob33243bf3282b0b809d33074442e9b7231926b495
1 /* packet-m2ua.c
2 * Routines for MTP2 User Adaptation Layer dissection
3 * It is hopefully (needs testing) compliant to
4 * http://www.ietf.org/rfc/rfc3331.txt
5 * To do: - provide better handling of length parameters
7 * Copyright 2002, Michael Tuexen <tuexen [AT] fh-muenster.de>
9 * $Id$
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
15 * Copied from README.developer
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version 2
20 * of the License, or (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 #include "config.h"
34 #include <epan/packet.h>
35 #include <epan/prefs.h>
36 #include <epan/sctpppids.h>
38 #define SCTP_PORT_M2UA 2904
40 /* Initialize the protocol and registered fields */
41 static int proto_m2ua = -1;
42 static int hf_version = -1;
43 static int hf_reserved = -1;
44 static int hf_message_class = -1;
45 static int hf_message_type = -1;
46 static int hf_message_length = -1;
47 static int hf_parameter_tag = -1;
48 static int hf_parameter_length = -1;
49 static int hf_parameter_value = -1;
50 static int hf_parameter_padding = -1;
51 static int hf_interface_id_int = -1;
52 static int hf_interface_id_text = -1;
53 static int hf_info_string = -1;
54 static int hf_diagnostic_information = -1;
55 static int hf_interface_id_start = -1;
56 static int hf_interface_id_stop = -1;
57 static int hf_heartbeat_data = -1;
58 static int hf_traffic_mode_type = -1;
59 static int hf_error_code = -1;
60 static int hf_status_type = -1;
61 static int hf_status_ident = -1;
62 static int hf_asp_id = -1;
63 static int hf_correlation_id = -1;
64 static int hf_data_2_li = -1;
65 static int hf_state = -1;
66 static int hf_event = -1;
67 static int hf_congestion_status = -1;
68 static int hf_discard_status = -1;
69 static int hf_action = -1;
70 static int hf_sequence_number = -1;
71 static int hf_retrieval_result = -1;
72 static int hf_local_lk_id = -1;
73 static int hf_sdt_reserved = -1;
74 static int hf_sdt_id = -1;
75 static int hf_sdl_reserved = -1;
76 static int hf_sdl_id = -1;
77 static int hf_registration_status = -1;
78 static int hf_deregistration_status = -1;
80 /* Initialize the subtree pointers */
81 static gint ett_m2ua = -1;
82 static gint ett_m2ua_parameter = -1;
84 static dissector_handle_t mtp3_handle;
86 static void
87 dissect_parameters(tvbuff_t *, packet_info *, proto_tree *, proto_tree *);
89 #define ADD_PADDING(x) ((((x) + 3) >> 2) << 2)
91 #define VERSION_LENGTH 1
92 #define RESERVED_LENGTH 1
93 #define MESSAGE_CLASS_LENGTH 1
94 #define MESSAGE_TYPE_LENGTH 1
95 #define MESSAGE_LENGTH_LENGTH 4
96 #define COMMON_HEADER_LENGTH (VERSION_LENGTH + RESERVED_LENGTH + MESSAGE_CLASS_LENGTH + \
97 MESSAGE_TYPE_LENGTH + MESSAGE_LENGTH_LENGTH)
99 #define VERSION_OFFSET 0
100 #define RESERVED_OFFSET (VERSION_OFFSET + VERSION_LENGTH)
101 #define MESSAGE_CLASS_OFFSET (RESERVED_OFFSET + RESERVED_LENGTH)
102 #define MESSAGE_TYPE_OFFSET (MESSAGE_CLASS_OFFSET + MESSAGE_CLASS_LENGTH)
103 #define MESSAGE_LENGTH_OFFSET (MESSAGE_TYPE_OFFSET + MESSAGE_TYPE_LENGTH)
105 #define PROTOCOL_VERSION_RELEASE_1 1
107 static const value_string protocol_version_values[] = {
108 { PROTOCOL_VERSION_RELEASE_1, "Release 1" },
109 { 0, NULL } };
111 #define MESSAGE_CLASS_MGMT_MESSAGE 0
112 #define MESSAGE_CLASS_ASPSM_MESSAGE 3
113 #define MESSAGE_CLASS_ASPTM_MESSAGE 4
114 #define MESSAGE_CLASS_MAUP_MESSAGE 6
115 #define MESSAGE_CLASS_IIM_MESSAGE 10
117 static const value_string message_class_values[] = {
118 { MESSAGE_CLASS_MGMT_MESSAGE, "Management messages" },
119 { MESSAGE_CLASS_ASPSM_MESSAGE, "ASP state maintenance messages" },
120 { MESSAGE_CLASS_ASPTM_MESSAGE, "ASP traffic maintenance messages" },
121 { MESSAGE_CLASS_MAUP_MESSAGE, "MTP2 user adaptation messages" },
122 { MESSAGE_CLASS_IIM_MESSAGE, "Interface identifier management messages" },
123 { 0, NULL } };
125 /* MGMT */
126 #define MESSAGE_TYPE_ERR 0
127 #define MESSAGE_TYPE_NTFY 1
129 /* ASPSM */
130 #define MESSAGE_TYPE_UP 1
131 #define MESSAGE_TYPE_DOWN 2
132 #define MESSAGE_TYPE_BEAT 3
133 #define MESSAGE_TYPE_UP_ACK 4
134 #define MESSAGE_TYPE_DOWN_ACK 5
135 #define MESSAGE_TYPE_BEAT_ACK 6
137 /* ASPTM */
138 #define MESSAGE_TYPE_ACTIVE 1
139 #define MESSAGE_TYPE_INACTIVE 2
140 #define MESSAGE_TYPE_ACTIVE_ACK 3
141 #define MESSAGE_TYPE_INACTIVE_ACK 4
143 /* MAUP */
144 #define MESSAGE_TYPE_DATA 1
145 #define MESSAGE_TYPE_ESTAB_REQ 2
146 #define MESSAGE_TYPE_ESTAB_CONF 3
147 #define MESSAGE_TYPE_REL_REQ 4
148 #define MESSAGE_TYPE_REL_CONF 5
149 #define MESSAGE_TYPE_REL_IND 6
150 #define MESSAGE_TYPE_STATE_REQ 7
151 #define MESSAGE_TYPE_STATE_CONF 8
152 #define MESSAGE_TYPE_STATE_IND 9
153 #define MESSAGE_TYPE_DATA_RETR_REQ 10
154 #define MESSAGE_TYPE_DATA_RETR_CONF 11
155 #define MESSAGE_TYPE_DATA_RETR_IND 12
156 #define MESSAGE_TYPE_DATA_RETR_COMP_IND 13
157 #define MESSAGE_TYPE_CONG_IND 14
158 #define MESSAGE_TYPE_DATA_ACK 15
160 /* IIM */
161 #define MESSAGE_TYPE_REG_REQ 1
162 #define MESSAGE_TYPE_REG_RSP 2
163 #define MESSAGE_TYPE_DEREG_REQ 3
164 #define MESSAGE_TYPE_DEREG_RSP 4
166 static const value_string message_class_type_values[] = {
167 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_ERR, "Error (ERR)" },
168 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_NTFY, "Notify (NTFY)" },
169 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP, "ASP up (UP)" },
170 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN, "ASP down (DOWN)" },
171 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT, "Heartbeat (BEAT)" },
172 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP_ACK, "ASP up ack (UP ACK)" },
173 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN_ACK, "ASP down ack (DOWN ACK)" },
174 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT_ACK, "Heartbeat ack (BEAT ACK)" },
175 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE , "ASP active (ACTIVE)" },
176 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE , "ASP inactive (INACTIVE)" },
177 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE_ACK , "ASP active ack (ACTIVE ACK)" },
178 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE_ACK , "ASP inactive ack (INACTIVE ACK)" },
179 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA, "DATA (DATA)" },
180 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_REQ, "Establish request (ESTAB_REQ)" },
181 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_CONF, "Establish confirm (ESTAB_CONF)" },
182 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_REQ, "Release request (REL_REQ)" },
183 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_CONF, "Release confirm (REL_CONF)" },
184 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_IND, "Release indication (REL_IND)" },
185 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_REQ, "State request (STATE_REQ)" },
186 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_CONF, "State confirm (STATE_CONF)" },
187 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_IND, "State indication (STATE_IND)" },
188 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_REQ, "Data retrieval request (DATA_RETR_REQ)" },
189 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_CONF, "Data retrieval confirm (DATA_RETR_CONF)" },
190 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_IND, "Data retrieval indication (DATA_RETR_IND)" },
191 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_COMP_IND, "Data retrieval complete indication (DATA_RETR_COMP_IND)" },
192 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_CONG_IND, "Congestion indication (CONG_IND)" },
193 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_ACK, "Data acknowledge (DATA_ACK)" },
194 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_REQ , "Registration request (REG_REQ)" },
195 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_RSP , "Registration response (REG_RSP)" },
196 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_REQ , "Deregistration request (DEREG_REQ)" },
197 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_RSP , "Deregistration response (DEREG_RSP)" },
198 { 0, NULL } };
200 static const value_string message_class_type_acro_values[] = {
201 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_ERR, "ERR" },
202 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_NTFY, "NTFY" },
203 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP, "ASP_UP" },
204 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN, "ASP_DOWN" },
205 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT, "BEAT" },
206 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP_ACK, "ASP_UP_ACK" },
207 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN_ACK, "ASP_DOWN_ACK" },
208 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT_ACK, "BEAT_ACK" },
209 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE , "ASP_ACTIVE" },
210 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE , "ASP_INACTIVE" },
211 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE_ACK , "ASP_ACTIVE_ACK" },
212 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE_ACK , "ASP_INACTIVE_ACK" },
213 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA, "DATA" },
214 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_REQ, "ESTAB_REQ" },
215 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_CONF, "ESTAB_CONF" },
216 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_REQ, "REL_REQ" },
217 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_CONF, "REL_CONF" },
218 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_IND, "REL_IND" },
219 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_REQ, "STATE_REQ" },
220 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_CONF, "STATE_CONF" },
221 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_IND, "STATE_IND" },
222 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_REQ, "DATA_RETR_REQ" },
223 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_CONF, "DATA_RETR_CONF" },
224 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_IND, "DATA_RETR_IND" },
225 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_COMP_IND, "DATA_RETR_COMP_IND" },
226 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_CONG_IND, "CONG_IND" },
227 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_ACK, "DATA_ACK" },
228 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_REQ , "REG_REQ" },
229 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_RSP , "REG_RSP" },
230 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_REQ , "DEREG_REQ" },
231 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_RSP , "DEREG_RSP" },
232 { 0, NULL } };
234 static void
235 dissect_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, proto_tree *m2ua_tree)
237 guint8 message_class, message_type;
239 /* Extract the common header */
240 message_class = tvb_get_guint8(common_header_tvb, MESSAGE_CLASS_OFFSET);
241 message_type = tvb_get_guint8(common_header_tvb, MESSAGE_TYPE_OFFSET);
243 col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(message_class * 256 + message_type, message_class_type_acro_values, "reserved"));
245 if (m2ua_tree) {
246 /* add the components of the common header to the protocol tree */
247 proto_tree_add_item(m2ua_tree, hf_version, common_header_tvb, VERSION_OFFSET, VERSION_LENGTH, ENC_BIG_ENDIAN);
248 proto_tree_add_item(m2ua_tree, hf_reserved, common_header_tvb, RESERVED_OFFSET, RESERVED_LENGTH, ENC_BIG_ENDIAN);
249 proto_tree_add_item(m2ua_tree, hf_message_class, common_header_tvb, MESSAGE_CLASS_OFFSET, MESSAGE_CLASS_LENGTH, ENC_BIG_ENDIAN);
250 proto_tree_add_uint_format_value(m2ua_tree, hf_message_type, common_header_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, message_type,
251 "%s (%u)",
252 val_to_str_const(message_class * 256 + message_type, message_class_type_values, "reserved"), message_type);
253 proto_tree_add_item(m2ua_tree, hf_message_length, common_header_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN);
257 #define PARAMETER_TAG_LENGTH 2
258 #define PARAMETER_LENGTH_LENGTH 2
259 #define PARAMETER_HEADER_LENGTH (PARAMETER_TAG_LENGTH + PARAMETER_LENGTH_LENGTH)
261 #define PARAMETER_TAG_OFFSET 0
262 #define PARAMETER_LENGTH_OFFSET (PARAMETER_TAG_OFFSET + PARAMETER_TAG_LENGTH)
263 #define PARAMETER_VALUE_OFFSET (PARAMETER_LENGTH_OFFSET + PARAMETER_LENGTH_LENGTH)
264 #define PARAMETER_HEADER_OFFSET PARAMETER_TAG_OFFSET
267 #define INT_INTERFACE_ID_OFFSET PARAMETER_VALUE_OFFSET
268 #define INT_INTERFACE_ID_LENGTH 4
270 static void
271 dissect_interface_identifier_int_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
273 proto_tree_add_item(parameter_tree, hf_interface_id_int, parameter_tvb, INT_INTERFACE_ID_OFFSET, INT_INTERFACE_ID_LENGTH, ENC_BIG_ENDIAN);
274 proto_item_append_text(parameter_item, " (%d)", tvb_get_ntohl(parameter_tvb, INT_INTERFACE_ID_OFFSET));
277 #define TEXT_INTERFACE_ID_OFFSET PARAMETER_VALUE_OFFSET
279 static void
280 dissect_interface_identifier_text_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
282 guint16 interface_id_length;
284 interface_id_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
286 proto_tree_add_item(parameter_tree, hf_interface_id_text, parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length, ENC_ASCII|ENC_NA);
287 proto_item_append_text(parameter_item, " (%.*s)", interface_id_length,
288 tvb_get_string(wmem_packet_scope(), parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length));
291 #define INFO_STRING_OFFSET PARAMETER_VALUE_OFFSET
293 static void
294 dissect_info_string_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
296 guint16 info_string_length;
298 info_string_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
299 proto_tree_add_item(parameter_tree, hf_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, ENC_ASCII|ENC_NA);
300 proto_item_append_text(parameter_item, " (%.*s)", info_string_length,
301 tvb_get_string(wmem_packet_scope(), parameter_tvb, INFO_STRING_OFFSET, info_string_length));
304 #define DIAGNOSTIC_INFO_OFFSET PARAMETER_VALUE_OFFSET
306 static void
307 dissect_diagnostic_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
309 guint16 diag_info_length;
311 diag_info_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
312 proto_tree_add_item(parameter_tree, hf_diagnostic_information, parameter_tvb, DIAGNOSTIC_INFO_OFFSET, diag_info_length, ENC_NA);
313 proto_item_append_text(parameter_item, " (%u byte%s)", diag_info_length, plurality(diag_info_length, "", "s"));
316 #define START_LENGTH 4
317 #define END_LENGTH 4
318 #define INTERVAL_LENGTH (START_LENGTH + END_LENGTH)
320 #define START_OFFSET 0
321 #define END_OFFSET (START_OFFSET + START_LENGTH)
323 static void
324 dissect_interface_identifier_range_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
326 guint16 number_of_ranges, range_number;
327 gint offset;
329 number_of_ranges = (tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH) / INTERVAL_LENGTH;
330 offset = PARAMETER_VALUE_OFFSET;
331 for(range_number = 0; range_number < number_of_ranges; range_number++) {
332 proto_tree_add_item(parameter_tree, hf_interface_id_start, parameter_tvb, offset + START_OFFSET, START_LENGTH, ENC_BIG_ENDIAN);
333 proto_tree_add_item(parameter_tree, hf_interface_id_stop, parameter_tvb, offset + END_OFFSET, END_LENGTH, ENC_BIG_ENDIAN);
334 offset += INTERVAL_LENGTH;
337 proto_item_append_text(parameter_item, " (%u range%s)", number_of_ranges, plurality(number_of_ranges, "", "s"));
340 #define HEARTBEAT_DATA_OFFSET PARAMETER_VALUE_OFFSET
342 static void
343 dissect_heartbeat_data_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
345 guint16 heartbeat_data_length;
347 heartbeat_data_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
348 proto_tree_add_item(parameter_tree, hf_heartbeat_data, parameter_tvb, HEARTBEAT_DATA_OFFSET, heartbeat_data_length, ENC_NA);
349 proto_item_append_text(parameter_item, " (%u byte%s)", heartbeat_data_length, plurality(heartbeat_data_length, "", "s"));
352 #define OVER_RIDE_TYPE 1
353 #define LOAD_SHARE_TYPE 2
354 #define BROADCAST_TYPE 3
356 static const value_string traffic_mode_type_values[] = {
357 { OVER_RIDE_TYPE , "Override" },
358 { LOAD_SHARE_TYPE, "Load-share" },
359 { BROADCAST_TYPE, "Broadcast" },
360 { 0, NULL } };
362 #define TRAFFIC_MODE_TYPE_LENGTH 4
363 #define TRAFFIC_MODE_TYPE_OFFSET PARAMETER_VALUE_OFFSET
365 static void
366 dissect_traffic_mode_type_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
368 proto_tree_add_item(parameter_tree, hf_traffic_mode_type, parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET, TRAFFIC_MODE_TYPE_LENGTH, ENC_BIG_ENDIAN);
369 proto_item_append_text(parameter_item, " (%s)",
370 val_to_str_const(tvb_get_ntohl(parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET), traffic_mode_type_values, "unknown"));
373 #define INVALID_VERSION_ERROR_CODE 0x01
374 #define INVALID_INTERFACE_IDENTIFIER_ERROR_CODE 0x02
375 #define UNSUPPORTED_MESSAGE_CLASS_ERROR_CODE 0x03
376 #define UNSUPPORTED_MESSAGE_TYPE_ERROR_CODE 0x04
377 #define UNSUPPORTED_TRAFFIC_HANDLING_MODE_ERROR_CODE 0x05
378 #define UNEXPECTED_MESSAGE_ERROR_CODE 0x06
379 #define PROTOCOL_ERROR_ERROR_CODE 0x07
380 #define UNSUPPORTED_INTERFACE_IDENTIFIER_TYPE_ERROR_CODE 0x08
381 #define INVALID_STREAM_IDENTIFIER_ERROR_CODE 0x09
382 #define REFUSED_ERROR_CODE 0x0d
383 #define ASP_IDENTIFIER_REQUIRED_ERROR_CODE 0x0e
384 #define INVALID_ASP_IDENTIFIER_ERROR_CODE 0x0f
385 #define ASP_ACTIVE_FOR_INTERFACE_IDENTIFIER_ERROR_CODE 0x10
386 #define INVALID_PARAMETER_VALUE_ERROR_CODE 0x11
387 #define PARAMETER_FIELD_ERROR_CODE 0x12
388 #define UNEXPECTED_PARAMETER_ERROR_CODE 0x13
389 #define MISSING_PARAMETER_ERROR_CODE 0x16
391 static const value_string error_code_values[] = {
392 { INVALID_VERSION_ERROR_CODE, "Invalid version" },
393 { INVALID_INTERFACE_IDENTIFIER_ERROR_CODE, "Invalid interface identifier" },
394 { UNSUPPORTED_MESSAGE_CLASS_ERROR_CODE, "Unsupported message class" },
395 { UNSUPPORTED_MESSAGE_TYPE_ERROR_CODE, "Unsupported message type" },
396 { UNSUPPORTED_TRAFFIC_HANDLING_MODE_ERROR_CODE, "Unsupported traffic handling mode" },
397 { UNEXPECTED_MESSAGE_ERROR_CODE, "Unexpected message" },
398 { PROTOCOL_ERROR_ERROR_CODE, "Protocol error" },
399 { UNSUPPORTED_INTERFACE_IDENTIFIER_TYPE_ERROR_CODE, "Unsupported interface identifier type" },
400 { INVALID_STREAM_IDENTIFIER_ERROR_CODE, "Invalid stream identifier" },
401 { REFUSED_ERROR_CODE, "Refused - management blocking" },
402 { ASP_IDENTIFIER_REQUIRED_ERROR_CODE, "ASP identifier required" },
403 { INVALID_ASP_IDENTIFIER_ERROR_CODE, "Invalid ASP identifier" },
404 { ASP_ACTIVE_FOR_INTERFACE_IDENTIFIER_ERROR_CODE, "ASP active for interface identifier" },
405 { INVALID_PARAMETER_VALUE_ERROR_CODE, "Invalid parameter value" },
406 { PARAMETER_FIELD_ERROR_CODE, "Parameter field error" },
407 { UNEXPECTED_PARAMETER_ERROR_CODE, "Unexpected parameter" },
408 { MISSING_PARAMETER_ERROR_CODE, "Missing parameter" },
409 { 0, NULL } };
411 #define ERROR_CODE_LENGTH 4
412 #define ERROR_CODE_OFFSET PARAMETER_VALUE_OFFSET
414 static void
415 dissect_error_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
417 proto_tree_add_item(parameter_tree, hf_error_code, parameter_tvb, ERROR_CODE_OFFSET, ERROR_CODE_LENGTH, ENC_BIG_ENDIAN);
418 proto_item_append_text(parameter_item, " (%s)",
419 val_to_str_const(tvb_get_ntohl(parameter_tvb, ERROR_CODE_OFFSET), error_code_values, "unknown"));
422 #define AS_STATE_CHANGE_TYPE 1
423 #define OTHER_TYPE 2
425 static const value_string status_type_values[] = {
426 { AS_STATE_CHANGE_TYPE, "Application server state change" },
427 { OTHER_TYPE, "Other" },
428 { 0, NULL } };
430 #define RESERVED_INFO 1
431 #define AS_INACTIVE_INFO 2
432 #define AS_ACTIVE_INFO 3
433 #define AS_PENDING_INFO 4
435 #define INSUFFICIENT_ASP_RES_INFO 1
436 #define ALTERNATE_ASP_ACTIVE_INFO 2
437 #define ASP_FAILURE_INFO 3
439 static const value_string status_type_id_values[] = {
440 { AS_STATE_CHANGE_TYPE * 256 * 256 + RESERVED_INFO, "Reserved" },
441 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_INACTIVE_INFO, "Application server inactive" },
442 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_ACTIVE_INFO, "Application server active" },
443 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_PENDING_INFO, "Application server pending" },
444 { OTHER_TYPE * 256 * 256 + INSUFFICIENT_ASP_RES_INFO, "Insufficient ASP resources active in AS" },
445 { OTHER_TYPE * 256 * 256 + ALTERNATE_ASP_ACTIVE_INFO, "Alternate ASP active" },
446 { OTHER_TYPE * 256 * 256 + ASP_FAILURE_INFO, "ASP Failure" },
447 {0, NULL } };
449 #define STATUS_TYPE_LENGTH 2
450 #define STATUS_IDENT_LENGTH 2
452 #define STATUS_TYPE_OFFSET PARAMETER_VALUE_OFFSET
453 #define STATUS_IDENT_OFFSET (STATUS_TYPE_OFFSET + STATUS_TYPE_LENGTH)
455 static void
456 dissect_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
458 guint16 status_type, status_id;
460 status_type = tvb_get_ntohs(parameter_tvb, STATUS_TYPE_OFFSET);
461 status_id = tvb_get_ntohs(parameter_tvb, STATUS_IDENT_OFFSET);
463 proto_tree_add_item(parameter_tree, hf_status_type, parameter_tvb, STATUS_TYPE_OFFSET, STATUS_TYPE_LENGTH, ENC_BIG_ENDIAN);
464 proto_tree_add_uint_format(parameter_tree, hf_status_ident, parameter_tvb, STATUS_IDENT_OFFSET, STATUS_IDENT_LENGTH,
465 status_id, "Status identification: %u (%s)", status_id,
466 val_to_str_const(status_type * 256 * 256 + status_id, status_type_id_values, "unknown"));
468 proto_item_append_text(parameter_item, " (%s)",
469 val_to_str_const(status_type * 256 * 256 + status_id, status_type_id_values, "unknown status information"));
472 #define ASP_IDENTIFIER_OFFSET PARAMETER_VALUE_OFFSET
473 #define ASP_IDENTIFIER_LENGTH 4
475 static void
476 dissect_asp_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
478 proto_tree_add_item(parameter_tree, hf_asp_id, parameter_tvb, ASP_IDENTIFIER_OFFSET, ASP_IDENTIFIER_LENGTH, ENC_BIG_ENDIAN);
479 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, ASP_IDENTIFIER_OFFSET));
482 #define CORRELATION_ID_LENGTH 4
483 #define CORRELATION_ID_OFFSET PARAMETER_VALUE_OFFSET
485 static void
486 dissect_correlation_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
488 proto_tree_add_item(parameter_tree, hf_correlation_id, parameter_tvb, CORRELATION_ID_OFFSET, CORRELATION_ID_LENGTH, ENC_BIG_ENDIAN);
489 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, CORRELATION_ID_OFFSET));
492 #define DATA_1_MTP3_OFFSET PARAMETER_VALUE_OFFSET
494 static void
495 dissect_protocol_data_1_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_item *parameter_item)
497 tvbuff_t *payload_tvb;
498 guint32 payload_length;
500 payload_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
502 payload_tvb = tvb_new_subset(parameter_tvb, DATA_1_MTP3_OFFSET, payload_length, payload_length);
503 proto_item_set_len(parameter_item, PARAMETER_HEADER_LENGTH);
504 call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
506 proto_item_set_text(parameter_item, "Data 1 parameter");
509 #define DATA_2_LI_LENGTH 1
510 #define DATA_2_LI_OFFSET PARAMETER_VALUE_OFFSET
511 #define DATA_2_MTP3_OFFSET (DATA_2_LI_OFFSET + DATA_2_LI_LENGTH)
513 static void
514 dissect_protocol_data_2_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree, proto_item *parameter_item)
516 tvbuff_t *payload_tvb;
517 guint32 payload_length;
519 payload_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH - DATA_2_LI_LENGTH;
521 proto_tree_add_item(parameter_tree, hf_data_2_li, parameter_tvb, DATA_2_LI_OFFSET, DATA_2_LI_LENGTH, ENC_BIG_ENDIAN);
522 payload_tvb = tvb_new_subset(parameter_tvb, DATA_2_MTP3_OFFSET, payload_length, payload_length);
523 proto_item_set_len(parameter_item, PARAMETER_HEADER_LENGTH + DATA_2_LI_LENGTH);
524 call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
528 #define STATUS_LPO_SET 0x0
529 #define STATUS_LPO_CLEAR 0x1
530 #define STATUS_EMER_SET 0x2
531 #define STATUS_EMER_CLEAR 0x3
532 #define STATUS_FLUSH_BUFFERS 0x4
533 #define STATUS_CONTINUE 0x5
534 #define STATUS_CLEAR_RTB 0x6
535 #define STATUS_AUDIT 0x7
536 #define STATUS_CONG_CLEAR 0x8
537 #define STATUS_CONG_ACCEPT 0x9
538 #define STATUS_CONG_DISCARD 0xa
540 static const value_string state_values[] = {
541 { STATUS_LPO_SET, "Request local processor outage" },
542 { STATUS_LPO_CLEAR, "Request local processor outage recovered" },
543 { STATUS_EMER_SET, "Request emergency alignment" },
544 { STATUS_EMER_CLEAR, "Request normal alignment (cancel emergency)" },
545 { STATUS_FLUSH_BUFFERS, "Flush or clear receive, transmit and retransmit queues" },
546 { STATUS_CONTINUE, "Continue or Resume" },
547 { STATUS_CLEAR_RTB, "Clear the retransmit queue" },
548 { STATUS_AUDIT, "Audit state of link" },
549 { STATUS_CONG_CLEAR, "Congestion cleared" },
550 { STATUS_CONG_ACCEPT, "Congestion accept" },
551 { STATUS_CONG_DISCARD, "Congestion discard" },
552 {0, NULL } };
554 #define STATE_LENGTH 4
555 #define STATE_OFFSET PARAMETER_VALUE_OFFSET
557 static void
558 dissect_state_request_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
560 proto_tree_add_item(parameter_tree, hf_state, parameter_tvb, STATE_OFFSET, STATE_LENGTH, ENC_BIG_ENDIAN);
561 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, STATE_OFFSET), state_values, "unknown"));
564 #define EVENT_RPO_ENTER 0x1
565 #define EVENT_RPO_EXIT 0x2
566 #define EVENT_LPO_ENTER 0x3
567 #define EVENT_LPO_EXIT 0x4
569 static const value_string event_values[] = {
570 { EVENT_RPO_ENTER, "Remote entered processor outage" },
571 { EVENT_RPO_EXIT, "Remote exited processor outage" },
572 { EVENT_LPO_ENTER, "Link entered processor outage" },
573 { EVENT_LPO_EXIT, "Link exited processor outage" },
574 {0, NULL } };
576 #define EVENT_LENGTH 4
577 #define EVENT_OFFSET PARAMETER_VALUE_OFFSET
579 static void
580 dissect_state_event_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
582 proto_tree_add_item(parameter_tree, hf_event, parameter_tvb, EVENT_OFFSET, EVENT_LENGTH, ENC_BIG_ENDIAN);
583 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, STATE_OFFSET), event_values, "unknown"));
586 #define LEVEL_NONE 0x0
587 #define LEVEL_1 0x1
588 #define LEVEL_2 0x2
589 #define LEVEL_3 0x3
591 static const value_string level_values[] = {
592 { LEVEL_NONE, "No congestion" },
593 { LEVEL_1, "Congestion Level 1" },
594 { LEVEL_2, "Congestion Level 2" },
595 { LEVEL_3, "Congestion Level 3" },
596 {0, NULL } };
598 #define CONGESTION_STATUS_LENGTH 4
599 #define CONGESTION_STATUS_OFFSET PARAMETER_VALUE_OFFSET
601 static void
602 dissect_congestion_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
604 proto_tree_add_item(parameter_tree, hf_congestion_status, parameter_tvb, CONGESTION_STATUS_OFFSET, CONGESTION_STATUS_LENGTH, ENC_BIG_ENDIAN);
605 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, CONGESTION_STATUS_OFFSET), level_values, "unknown"));
608 #define DISCARD_STATUS_LENGTH 4
609 #define DISCARD_STATUS_OFFSET PARAMETER_VALUE_OFFSET
611 static void
612 dissect_discard_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
614 proto_tree_add_item(parameter_tree, hf_discard_status, parameter_tvb, DISCARD_STATUS_OFFSET, DISCARD_STATUS_LENGTH, ENC_BIG_ENDIAN);
615 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, DISCARD_STATUS_OFFSET), level_values, "unknown"));
618 #define ACTION_RTRV_BSN 0x1
619 #define ACTION_RTRV_MSGS 0x2
621 static const value_string action_values[] = {
622 { ACTION_RTRV_BSN, "Retrieve the backward sequence number" },
623 { ACTION_RTRV_MSGS, "Retrieve the PDUs from the transmit and retransmit queues" },
624 {0, NULL } };
627 #define ACTION_LENGTH 4
628 #define ACTION_OFFSET PARAMETER_VALUE_OFFSET
630 static void
631 dissect_action_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
633 proto_tree_add_item(parameter_tree, hf_action, parameter_tvb, ACTION_OFFSET, ACTION_LENGTH, ENC_BIG_ENDIAN);
634 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, ACTION_OFFSET), action_values, "unknown"));
637 #define SEQUENCE_NUMBER_LENGTH 4
638 #define SEQUENCE_NUMBER_OFFSET PARAMETER_VALUE_OFFSET
640 static void
641 dissect_sequence_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
643 proto_tree_add_item(parameter_tree, hf_sequence_number, parameter_tvb, SEQUENCE_NUMBER_OFFSET, SEQUENCE_NUMBER_LENGTH, ENC_BIG_ENDIAN);
644 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, SEQUENCE_NUMBER_OFFSET));
647 #define RESULT_SUCCESS 0x0
648 #define RESULT_FAILURE 0x1
650 static const value_string retrieval_result_values[] = {
651 { RESULT_SUCCESS, "Action successful" },
652 { RESULT_FAILURE , "Action failed" },
653 { 0, NULL } };
656 #define RETRIEVAL_RESULT_LENGTH 4
657 #define RETRIEVAL_RESULT_OFFSET PARAMETER_VALUE_OFFSET
659 static void
660 dissect_retrieval_result_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
662 proto_tree_add_item(parameter_tree, hf_retrieval_result, parameter_tvb, RETRIEVAL_RESULT_OFFSET, RETRIEVAL_RESULT_LENGTH, ENC_BIG_ENDIAN);
663 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, RETRIEVAL_RESULT_OFFSET), retrieval_result_values, "unknown"));
666 static void
667 dissect_link_key_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
669 tvbuff_t *parameters_tvb;
670 guint16 parameters_length;
672 parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
673 parameters_tvb = tvb_new_subset(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length, parameters_length);
674 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
677 #define LOCAL_LK_ID_LENGTH 4
678 #define LOCAL_LK_ID_OFFSET PARAMETER_VALUE_OFFSET
680 static void
681 dissect_local_lk_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
683 proto_tree_add_item(parameter_tree, hf_local_lk_id, parameter_tvb, LOCAL_LK_ID_OFFSET, LOCAL_LK_ID_LENGTH, ENC_BIG_ENDIAN);
684 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, LOCAL_LK_ID_OFFSET));
687 #define SDT_RESERVED_LENGTH 2
688 #define SDT_ID_LENGTH 2
689 #define SDT_RESERVED_OFFSET PARAMETER_VALUE_OFFSET
690 #define SDT_ID_OFFSET (SDT_RESERVED_OFFSET + SDT_RESERVED_LENGTH)
692 static void
693 dissect_sdt_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
695 proto_tree_add_item(parameter_tree, hf_sdt_reserved, parameter_tvb, SDT_RESERVED_OFFSET, SDT_RESERVED_LENGTH, ENC_BIG_ENDIAN);
696 proto_tree_add_item(parameter_tree, hf_sdt_id, parameter_tvb, SDT_ID_OFFSET, SDT_ID_LENGTH, ENC_BIG_ENDIAN);
697 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohs(parameter_tvb, SDT_ID_OFFSET));
700 #define SDL_RESERVED_LENGTH 2
701 #define SDL_ID_LENGTH 2
702 #define SDL_RESERVED_OFFSET PARAMETER_VALUE_OFFSET
703 #define SDL_ID_OFFSET (SDL_RESERVED_OFFSET + SDL_RESERVED_LENGTH)
705 static void
706 dissect_sdl_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
708 proto_tree_add_item(parameter_tree, hf_sdl_reserved, parameter_tvb, SDL_RESERVED_OFFSET, SDL_RESERVED_LENGTH, ENC_BIG_ENDIAN);
709 proto_tree_add_item(parameter_tree, hf_sdl_id, parameter_tvb, SDL_ID_OFFSET, SDL_ID_LENGTH, ENC_BIG_ENDIAN);
710 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohs(parameter_tvb, SDL_ID_OFFSET));
713 static void
714 dissect_registration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
716 tvbuff_t *parameters_tvb;
717 guint16 parameters_length;
719 parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
720 parameters_tvb = tvb_new_subset(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length, parameters_length);
721 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
724 #define SUCCESSFULL_REGISTRATION_STATUS 0
725 #define UNKNOWN_REGISTRATION_STATUS 1
726 #define INVALID_SDLI_REGISTRATION_STATUS 2
727 #define INVALID_SDTI_REGISTRATION_STATUS 3
728 #define INVALID_LINK_KEY_REGISTRATION_STATUS 4
729 #define PERMISSION_DENIED_REGISTRATION_STATUS 5
730 #define OVERLAPPING_LINK_KEY_REGISTRATION_STATUS 6
731 #define LINK_KEY_NOT_PROVISIONED_REGISTRATION_STATUS 7
732 #define INSUFFICIENT_RESOURCES_REGISTRATION_STATUS 8
734 static const value_string registration_status_values[] = {
735 { SUCCESSFULL_REGISTRATION_STATUS, "Successfully registered" },
736 { UNKNOWN_REGISTRATION_STATUS, "Error - Unknown" },
737 { INVALID_SDLI_REGISTRATION_STATUS, "Error - Invalid SDLI" },
738 { INVALID_SDTI_REGISTRATION_STATUS, "Error - Invalid SDTI" },
739 { INVALID_LINK_KEY_REGISTRATION_STATUS, "Error - Invalid link key" },
740 { PERMISSION_DENIED_REGISTRATION_STATUS, "Error - Permission denied" },
741 { OVERLAPPING_LINK_KEY_REGISTRATION_STATUS, "Error - Overlapping (Non-unique) link key" },
742 { LINK_KEY_NOT_PROVISIONED_REGISTRATION_STATUS, "Error - Link key not provisioned" },
743 { INSUFFICIENT_RESOURCES_REGISTRATION_STATUS, "Error - Insufficient resources" },
744 { 0, NULL } };
746 #define REGISTRATION_STATUS_LENGTH 4
747 #define REGISTRATION_STATUS_OFFSET PARAMETER_VALUE_OFFSET
749 static void
750 dissect_registration_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
752 proto_tree_add_item(parameter_tree, hf_registration_status, parameter_tvb, REGISTRATION_STATUS_OFFSET, REGISTRATION_STATUS_LENGTH, ENC_BIG_ENDIAN);
753 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, REGISTRATION_STATUS_OFFSET), registration_status_values, "unknown"));
756 static void
757 dissect_deregistration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
759 tvbuff_t *parameters_tvb;
760 guint16 parameters_length;
762 parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
763 parameters_tvb = tvb_new_subset(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length, parameters_length);
764 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
767 #define SUCCESSFULL_DEREGISTRATION_STATUS 0
768 #define UNKNOWN_DEREGISTRATION_STATUS 1
769 #define INVALID_INTERFACE_IDENTIFIER_DEREGISTRATION_STATUS 2
770 #define PERMISSION_DENIED_DEREGISTRATION_STATUS 3
771 #define NOT_REGISTRED_DEREGISTRATION_STATUS 4
773 static const value_string deregistration_status_values[] = {
774 { SUCCESSFULL_DEREGISTRATION_STATUS, "Successfully deregistered" },
775 { UNKNOWN_DEREGISTRATION_STATUS, "Error - Unknown" },
776 { INVALID_INTERFACE_IDENTIFIER_DEREGISTRATION_STATUS, "Error - Invalid interface identifier" },
777 { PERMISSION_DENIED_DEREGISTRATION_STATUS, "Error - Permission denied" },
778 { NOT_REGISTRED_DEREGISTRATION_STATUS, "Error - Not registered" },
779 { 0, NULL } };
781 #define DEREGISTRATION_STATUS_LENGTH 4
782 #define DEREGISTRATION_STATUS_OFFSET PARAMETER_VALUE_OFFSET
784 static void
785 dissect_deregistration_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
787 proto_tree_add_item(parameter_tree, hf_deregistration_status, parameter_tvb, DEREGISTRATION_STATUS_OFFSET, DEREGISTRATION_STATUS_LENGTH, ENC_BIG_ENDIAN);
788 proto_item_append_text(parameter_item, " (%s)", val_to_str_const(tvb_get_ntohl(parameter_tvb, DEREGISTRATION_STATUS_OFFSET), deregistration_status_values, "unknown"));
791 static void
792 dissect_unknown_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
794 guint16 parameter_value_length;
796 parameter_value_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
797 if (parameter_value_length > 0)
798 proto_tree_add_item(parameter_tree, hf_parameter_value, parameter_tvb, PARAMETER_VALUE_OFFSET, parameter_value_length, ENC_NA);
799 proto_item_append_text(parameter_item, " with tag %u and %u byte%s value",
800 tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET), parameter_value_length, plurality(parameter_value_length, "", "s"));
803 /* Common parameter tags */
804 #define INTERFACE_IDENTIFIER_INT_PARAMETER_TAG 0x0001
805 #define INTERFACE_IDENTIFIER_TEXT_PARAMETER_TAG 0x0003
806 #define INFO_STRING_PARAMETER_TAG 0x0004
807 #define DIAGNOSTIC_INFORMATION_PARAMETER_TAG 0x0007
808 #define INTERFACE_IDENTIFIER_RANGE_PARAMETER_TAG 0x0008
809 #define HEARTBEAT_DATA_PARAMETER_TAG 0x0009
810 #define TRAFFIC_MODE_TYPE_PARAMETER_TAG 0x000b
811 #define ERROR_CODE_PARAMETER_TAG 0x000c
812 #define STATUS_PARAMETER_TAG 0x000d
813 #define ASP_IDENTIFIER_PARAMETER_TAG 0x0011
814 #define CORRELATION_IDENTIFIER_PARAMETER_TAG 0x0013
816 /* M2PA specific parameter tags */
817 #define PROTOCOL_DATA_1_PARAMETER_TAG 0x0300
818 #define PROTOCOL_DATA_2_PARAMETER_TAG 0x0301
819 #define STATE_REQUEST_PARAMETER_TAG 0x0302
820 #define STATE_EVENT_PARAMETER_TAG 0x0303
821 #define CONGESTION_STATUS_PARAMETER_TAG 0x0304
822 #define DISCARD_STATUS_PARAMETER_TAG 0x0305
823 #define ACTION_PARAMETER_TAG 0x0306
824 #define SEQUENCE_NUMBER_PARAMETER_TAG 0x0307
825 #define RETRIEVAL_RESULT_PARAMETER_TAG 0x0308
826 #define LINK_KEY_PARAMETER_TAG 0x0309
827 #define LOCAL_LK_IDENTIFIER_PARAMETER_TAG 0x030a
828 #define SDT_IDENTIFIER_PARAMETER_TAG 0x030b
829 #define SDL_IDENTIFIER_PARAMETER_TAG 0x030c
830 #define REG_RESULT_PARAMETER_TAG 0x030d
831 #define REG_STATUS_PARAMETER_TAG 0x030e
832 #define DEREG_RESULT_PARAMETER_TAG 0x030f
833 #define DEREG_STATUS_PARAMETER_TAG 0x0310
835 static const value_string parameter_tag_values[] = {
836 { INTERFACE_IDENTIFIER_INT_PARAMETER_TAG, "Interface identifier (integer)" },
837 { INTERFACE_IDENTIFIER_TEXT_PARAMETER_TAG, "Interface identifier (text)" },
838 { INFO_STRING_PARAMETER_TAG, "Info string" },
839 { DIAGNOSTIC_INFORMATION_PARAMETER_TAG, "Diagnostic information" },
840 { INTERFACE_IDENTIFIER_RANGE_PARAMETER_TAG, "Interface identifier (integer range)" },
841 { HEARTBEAT_DATA_PARAMETER_TAG, "Heartbeat data" },
842 { TRAFFIC_MODE_TYPE_PARAMETER_TAG, "Traffic mode type" },
843 { ERROR_CODE_PARAMETER_TAG, "Error code" },
844 { STATUS_PARAMETER_TAG, "Status type / information" },
845 { ASP_IDENTIFIER_PARAMETER_TAG, "ASP identifier" },
846 { CORRELATION_IDENTIFIER_PARAMETER_TAG, "Correlation identifier" },
847 { PROTOCOL_DATA_1_PARAMETER_TAG, "Protocol data 1" },
848 { PROTOCOL_DATA_2_PARAMETER_TAG, "Protocol data 2" },
849 { STATE_REQUEST_PARAMETER_TAG, "State request" },
850 { STATE_EVENT_PARAMETER_TAG, "State event" },
851 { CONGESTION_STATUS_PARAMETER_TAG, "Congestion state" },
852 { DISCARD_STATUS_PARAMETER_TAG, "Discard state" },
853 { ACTION_PARAMETER_TAG, "Action" },
854 { SEQUENCE_NUMBER_PARAMETER_TAG, "Sequence number" },
855 { RETRIEVAL_RESULT_PARAMETER_TAG, "Retrieval result" },
856 { LINK_KEY_PARAMETER_TAG, "Link key" },
857 { LOCAL_LK_IDENTIFIER_PARAMETER_TAG, "Local LK identifier" },
858 { SDT_IDENTIFIER_PARAMETER_TAG, "SDT identifier" },
859 { SDL_IDENTIFIER_PARAMETER_TAG, "SDL identifier" },
860 { REG_RESULT_PARAMETER_TAG, "Registration result" },
861 { REG_STATUS_PARAMETER_TAG, "Registration status" },
862 { DEREG_RESULT_PARAMETER_TAG, "Deregistration result" },
863 { DEREG_STATUS_PARAMETER_TAG, "Deregistration status" },
864 { 0, NULL } };
867 * Default preference for 'Protocol Data 1 Parameter Tag' is RFC3331 value
868 * defined above (PROTOCOL_DATA_1_PARAMETER_TAG)
870 * The other option is the old Draft 7 value defined below.
872 #define PROTOCOL_DATA_1_DRAFT_7 0x000e
873 static gint protocol_data_1_global = PROTOCOL_DATA_1_PARAMETER_TAG;
875 static void
876 dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
878 guint16 tag, length, padding_length;
879 proto_item *parameter_item;
880 proto_tree *parameter_tree;
882 /* extract tag and length from the parameter */
883 tag = tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET);
884 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
886 /* calculate padding and total length */
887 padding_length = tvb_length(parameter_tvb) - length;
889 /* create proto_tree stuff */
890 parameter_item = proto_tree_add_text(m2ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, tvb_length(parameter_tvb), "%s",
891 val_to_str_const(tag, parameter_tag_values, "Unknown parameter"));
892 parameter_tree = proto_item_add_subtree(parameter_item, ett_m2ua_parameter);
894 if ((protocol_data_1_global == PROTOCOL_DATA_1_DRAFT_7) &&
895 (tag == PROTOCOL_DATA_1_DRAFT_7))
897 proto_item *hidden_item;
898 hidden_item = proto_tree_add_uint(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, tag);
899 PROTO_ITEM_SET_HIDDEN(hidden_item);
901 /* add tag and length to the m2ua tree */
902 proto_tree_add_text(parameter_tree, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH,
903 "Parameter Tag: Protocol data 1 (0x000e)");
905 proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
906 tag = PROTOCOL_DATA_1_PARAMETER_TAG;
908 else
910 /* add tag and length to the m2ua tree */
911 proto_tree_add_item(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, ENC_BIG_ENDIAN);
912 proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
915 switch(tag) {
916 case INTERFACE_IDENTIFIER_INT_PARAMETER_TAG:
917 dissect_interface_identifier_int_parameter(parameter_tvb, parameter_tree, parameter_item);
918 break;
919 case INTERFACE_IDENTIFIER_TEXT_PARAMETER_TAG:
920 dissect_interface_identifier_text_parameter(parameter_tvb, parameter_tree, parameter_item);
921 break;
922 case INFO_STRING_PARAMETER_TAG:
923 dissect_info_string_parameter(parameter_tvb, parameter_tree, parameter_item);
924 break;
925 case DIAGNOSTIC_INFORMATION_PARAMETER_TAG:
926 dissect_diagnostic_information_parameter(parameter_tvb, parameter_tree, parameter_item);
927 break;
928 case INTERFACE_IDENTIFIER_RANGE_PARAMETER_TAG:
929 dissect_interface_identifier_range_parameter(parameter_tvb, parameter_tree, parameter_item);
930 break;
931 case HEARTBEAT_DATA_PARAMETER_TAG:
932 dissect_heartbeat_data_parameter(parameter_tvb, parameter_tree, parameter_item);
933 break;
934 case TRAFFIC_MODE_TYPE_PARAMETER_TAG:
935 dissect_traffic_mode_type_parameter(parameter_tvb, parameter_tree, parameter_item);
936 break;
937 case ERROR_CODE_PARAMETER_TAG:
938 dissect_error_code_parameter(parameter_tvb, parameter_tree, parameter_item);
939 break;
940 case STATUS_PARAMETER_TAG:
941 dissect_status_parameter(parameter_tvb, parameter_tree, parameter_item);
942 break;
943 case ASP_IDENTIFIER_PARAMETER_TAG:
944 dissect_asp_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
945 break;
946 case CORRELATION_IDENTIFIER_PARAMETER_TAG:
947 dissect_correlation_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
948 break;
949 case PROTOCOL_DATA_1_PARAMETER_TAG:
950 dissect_protocol_data_1_parameter(parameter_tvb, pinfo, tree, parameter_item);
951 break;
952 case PROTOCOL_DATA_2_PARAMETER_TAG:
953 dissect_protocol_data_2_parameter(parameter_tvb, pinfo, tree, parameter_tree, parameter_item);
954 break;
955 case STATE_REQUEST_PARAMETER_TAG:
956 dissect_state_request_parameter(parameter_tvb, parameter_tree, parameter_item);
957 break;
958 case STATE_EVENT_PARAMETER_TAG:
959 dissect_state_event_parameter(parameter_tvb, parameter_tree, parameter_item);
960 break;
961 case CONGESTION_STATUS_PARAMETER_TAG:
962 dissect_congestion_status_parameter(parameter_tvb, parameter_tree, parameter_item);
963 break;
964 case DISCARD_STATUS_PARAMETER_TAG:
965 dissect_discard_status_parameter(parameter_tvb, parameter_tree, parameter_item);
966 break;
967 case ACTION_PARAMETER_TAG:
968 dissect_action_parameter(parameter_tvb, parameter_tree, parameter_item);
969 break;
970 case SEQUENCE_NUMBER_PARAMETER_TAG:
971 dissect_sequence_number_parameter(parameter_tvb, parameter_tree, parameter_item);
972 break;
973 case RETRIEVAL_RESULT_PARAMETER_TAG:
974 dissect_retrieval_result_parameter(parameter_tvb, parameter_tree, parameter_item);
975 break;
976 case LINK_KEY_PARAMETER_TAG:
977 dissect_link_key_parameter(parameter_tvb, pinfo, tree, parameter_tree);
978 break;
979 case LOCAL_LK_IDENTIFIER_PARAMETER_TAG:
980 dissect_local_lk_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
981 break;
982 case SDT_IDENTIFIER_PARAMETER_TAG:
983 dissect_sdt_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
984 break;
985 case SDL_IDENTIFIER_PARAMETER_TAG:
986 dissect_sdl_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
987 break;
988 case REG_RESULT_PARAMETER_TAG:
989 dissect_registration_result_parameter(parameter_tvb, pinfo, tree, parameter_tree);
990 break;
991 case REG_STATUS_PARAMETER_TAG:
992 dissect_registration_status_parameter(parameter_tvb, parameter_tree, parameter_item);
993 break;
994 case DEREG_RESULT_PARAMETER_TAG:
995 dissect_deregistration_result_parameter(parameter_tvb, pinfo, tree, parameter_tree);
996 break;
997 case DEREG_STATUS_PARAMETER_TAG:
998 dissect_deregistration_status_parameter(parameter_tvb, parameter_tree, parameter_item);
999 break;
1000 default:
1001 dissect_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
1002 break;
1005 if (padding_length > 0)
1006 proto_tree_add_item(parameter_tree, hf_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
1010 static void
1011 dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
1013 gint offset, length, total_length, remaining_length;
1014 tvbuff_t *parameter_tvb;
1016 offset = 0;
1017 while((remaining_length = tvb_reported_length_remaining(parameters_tvb, offset))) {
1018 length = tvb_get_ntohs(parameters_tvb, offset + PARAMETER_LENGTH_OFFSET);
1019 total_length = ADD_PADDING(length);
1020 if (remaining_length >= length)
1021 total_length = MIN(total_length, remaining_length);
1022 /* create a tvb for the parameter including the padding bytes */
1023 parameter_tvb = tvb_new_subset(parameters_tvb, offset, total_length, total_length);
1024 dissect_parameter(parameter_tvb, pinfo, tree, m2ua_tree);
1025 /* get rid of the handled parameter */
1026 offset += total_length;
1031 static void
1032 dissect_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
1034 tvbuff_t *common_header_tvb, *parameters_tvb;
1036 common_header_tvb = tvb_new_subset(message_tvb, 0, COMMON_HEADER_LENGTH, COMMON_HEADER_LENGTH);
1037 parameters_tvb = tvb_new_subset_remaining(message_tvb, COMMON_HEADER_LENGTH);
1038 dissect_common_header(common_header_tvb, pinfo, m2ua_tree);
1039 dissect_parameters(parameters_tvb, pinfo, tree, m2ua_tree);
1042 static void
1043 dissect_m2ua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree)
1045 proto_item *m2ua_item;
1046 proto_tree *m2ua_tree;
1048 /* make entry in the Protocol column on summary display */
1049 col_set_str(pinfo->cinfo, COL_PROTOCOL, "M2UA");
1051 /* In the interest of speed, if "tree" is NULL, don't do any work not
1052 necessary to generate protocol tree items. */
1053 if (tree) {
1054 /* create the m2ua protocol tree */
1055 m2ua_item = proto_tree_add_item(tree, proto_m2ua, message_tvb, 0, -1, ENC_NA);
1056 m2ua_tree = proto_item_add_subtree(m2ua_item, ett_m2ua);
1057 } else {
1058 m2ua_tree = NULL;
1060 /* dissect the message */
1061 dissect_message(message_tvb, pinfo, tree, m2ua_tree);
1064 /* Register the protocol with Wireshark */
1065 void
1066 proto_register_m2ua(void)
1069 /* Setup list of header fields */
1070 static hf_register_info hf[] = {
1071 { &hf_version, { "Version", "m2ua.version", FT_UINT8, BASE_DEC, VALS(protocol_version_values), 0x0, NULL, HFILL } },
1072 { &hf_reserved, { "Reserved", "m2ua.reserved", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
1073 { &hf_message_class, { "Message class", "m2ua.message_class", FT_UINT8, BASE_DEC, VALS(message_class_values), 0x0, NULL, HFILL } },
1074 { &hf_message_type, { "Message Type", "m2ua.message_type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1075 { &hf_message_length, { "Message length", "m2ua.message_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1076 { &hf_parameter_tag, { "Parameter Tag", "m2ua.parameter_tag", FT_UINT16, BASE_HEX, VALS(parameter_tag_values), 0x0, NULL, HFILL } },
1077 { &hf_parameter_length, { "Parameter length", "m2ua.parameter_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1078 { &hf_parameter_value, { "Parameter value", "m2ua.parameter_value", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1079 { &hf_parameter_padding, { "Padding", "m2ua.parameter_padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1080 { &hf_interface_id_int, { "Interface Identifier (integer)", "m2ua.interface_identifier_int", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1081 { &hf_interface_id_text, { "Interface identifier (text)", "m2ua.interface_identifier_text", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1082 { &hf_info_string, { "Info string", "m2ua.info_string", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1083 { &hf_diagnostic_information, { "Diagnostic information", "m2ua.diagnostic_information", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1084 { &hf_interface_id_start, { "Interface Identifier (start)", "m2ua.interface_identifier_start", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1085 { &hf_interface_id_stop, { "Interface Identifier (stop)", "m2ua.interface_identifier_stop", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1086 { &hf_heartbeat_data, { "Heartbeat data", "m2ua.heartbeat_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
1087 { &hf_traffic_mode_type, { "Traffic mode Type", "m2ua.traffic_mode_type", FT_UINT32, BASE_DEC, VALS(traffic_mode_type_values), 0x0, NULL, HFILL } },
1088 { &hf_error_code, { "Error code", "m2ua.error_code", FT_UINT32, BASE_DEC, VALS(error_code_values), 0x0, NULL, HFILL } },
1089 { &hf_status_type, { "Status type", "m2ua.status_type", FT_UINT16, BASE_DEC, VALS(status_type_values), 0x0, NULL, HFILL } },
1090 { &hf_status_ident, { "Status info", "m2ua.status_info", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1091 { &hf_asp_id, { "ASP identifier", "m2ua.asp_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1092 { &hf_correlation_id, { "Correlation identifier", "m2ua.correlation_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1093 { &hf_data_2_li, { "Length indicator", "m2ua.data_2_li", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1094 { &hf_state, { "State", "m2ua.state", FT_UINT32, BASE_DEC, VALS(state_values), 0x0, NULL, HFILL } },
1095 { &hf_event, { "Event", "m2ua.event", FT_UINT32, BASE_DEC, VALS(event_values), 0x0, NULL, HFILL } },
1096 { &hf_congestion_status, { "Congestion status", "m2ua.congestion_status", FT_UINT32, BASE_DEC, VALS(level_values), 0x0, NULL, HFILL } },
1097 { &hf_discard_status, { "Discard status", "m2ua.discard_status", FT_UINT32, BASE_DEC, VALS(level_values), 0x0, NULL, HFILL } },
1098 { &hf_action, { "Actions", "m2ua.action", FT_UINT32, BASE_DEC, VALS(action_values), 0x0, NULL, HFILL } },
1099 { &hf_sequence_number, { "Sequence number", "m2ua.sequence_number", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1100 { &hf_retrieval_result, { "Retrieval result", "m2ua.retrieval_result", FT_UINT32, BASE_DEC, VALS(retrieval_result_values), 0x0, NULL, HFILL } },
1101 { &hf_local_lk_id, { "Local LK identifier", "m2ua.local_lk_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1102 { &hf_sdt_reserved, { "Reserved", "m2ua.sdt_reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
1103 { &hf_sdt_id, { "SDT identifier", "m2ua.sdt_identifier", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1104 { &hf_sdl_reserved, { "Reserved", "m2ua.sdl_reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
1105 { &hf_sdl_id, { "SDL identifier", "m2ua.sdl_identifier", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
1106 { &hf_registration_status, { "Registration status", "m2ua.registration_status", FT_UINT32, BASE_DEC, VALS(registration_status_values), 0x0, NULL, HFILL } },
1107 { &hf_deregistration_status, { "Deregistration status", "m2ua.deregistration_status", FT_UINT32, BASE_DEC, VALS(deregistration_status_values), 0x0, NULL, HFILL } },
1110 /* Setup protocol subtree array */
1111 static gint *ett[] = {
1112 &ett_m2ua,
1113 &ett_m2ua_parameter,
1116 static const enum_val_t protocol_data_1_options[] = {
1117 { "draft-7", "0x000e (Draft 7)", PROTOCOL_DATA_1_DRAFT_7 },
1118 { "rfc3331", "0x0300 (RFC3331)", PROTOCOL_DATA_1_PARAMETER_TAG },
1119 { NULL, NULL, 0 }
1122 module_t *m2ua_module;
1124 /* Register the protocol name and description */
1125 proto_m2ua = proto_register_protocol("MTP 2 User Adaptation Layer", "M2UA", "m2ua");
1127 /* Required function calls to register the header fields and subtrees used */
1128 proto_register_field_array(proto_m2ua, hf, array_length(hf));
1129 proto_register_subtree_array(ett, array_length(ett));
1131 m2ua_module = prefs_register_protocol(proto_m2ua, NULL);
1133 prefs_register_enum_preference(m2ua_module,
1134 "protocol_data_1_tag",
1135 "Protocol Data 1 Parameter Tag",
1136 "The value of the parameter tag for protocol data 1",
1137 &protocol_data_1_global,
1138 protocol_data_1_options,
1139 FALSE);
1142 void
1143 proto_reg_handoff_m2ua(void)
1145 dissector_handle_t m2ua_handle;
1147 mtp3_handle = find_dissector("mtp3");
1148 m2ua_handle = create_dissector_handle(dissect_m2ua, proto_m2ua);
1149 dissector_add_uint("sctp.ppi", M2UA_PAYLOAD_PROTOCOL_ID, m2ua_handle);
1150 dissector_add_uint("sctp.port", SCTP_PORT_M2UA, m2ua_handle);