2 * Routines for MTP2 User Adaptation Layer dissection
3 * It is hopefully (needs testing) compilant 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: packet-m2ua.c,v 1.12 2003/09/04 14:32:01 tuexen Exp $
11 * Ethereal - Network traffic analyzer
12 * By Gerald Combs <gerald@ethereal.com>
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 #include <epan/packet.h>
37 #include "sctpppids.h"
39 #define SCTP_PORT_M2UA 2904
40 #define NETWORK_BYTE_ORDER FALSE
44 /* Initialize the protocol and registered fields */
45 static int proto_m2ua = -1;
46 static int hf_version = -1;
47 static int hf_reserved = -1;
48 static int hf_message_class = -1;
49 static int hf_message_type = -1;
50 static int hf_message_length = -1;
51 static int hf_parameter_tag = -1;
52 static int hf_parameter_length = -1;
53 static int hf_parameter_value = -1;
54 static int hf_parameter_padding = -1;
55 static int hf_interface_id_int = -1;
56 static int hf_interface_id_text = -1;
57 static int hf_info_string = -1;
58 static int hf_diagnostic_information = -1;
59 static int hf_interface_id_start = -1;
60 static int hf_interface_id_stop = -1;
61 static int hf_heartbeat_data = -1;
62 static int hf_traffic_mode_type = -1;
63 static int hf_error_code = -1;
64 static int hf_status_type = -1;
65 static int hf_status_ident = -1;
66 static int hf_asp_id = -1;
67 static int hf_correlation_id = -1;
68 static int hf_data_2_li = -1;
69 static int hf_state = -1;
70 static int hf_event = -1;
71 static int hf_congestion_status = -1;
72 static int hf_discard_status = -1;
73 static int hf_action = -1;
74 static int hf_sequence_number = -1;
75 static int hf_retrieval_result = -1;
76 static int hf_local_lk_id = -1;
77 static int hf_sdt_reserved = -1;
78 static int hf_sdt_id = -1;
79 static int hf_sdl_reserved = -1;
80 static int hf_sdl_id = -1;
81 static int hf_registration_status = -1;
82 static int hf_deregistration_status = -1;
84 /* Initialize the subtree pointers */
85 static gint ett_m2ua = -1;
86 static gint ett_m2ua_parameter = -1;
88 static dissector_handle_t mtp3_handle;
91 dissect_parameters(tvbuff_t *, packet_info *, proto_tree *, proto_tree *);
93 #define ADD_PADDING(x) ((((x) + 3) >> 2) << 2)
95 #define VERSION_LENGTH 1
96 #define RESERVED_LENGTH 1
97 #define MESSAGE_CLASS_LENGTH 1
98 #define MESSAGE_TYPE_LENGTH 1
99 #define MESSAGE_LENGTH_LENGTH 4
100 #define COMMON_HEADER_LENGTH (VERSION_LENGTH + RESERVED_LENGTH + MESSAGE_CLASS_LENGTH + \
101 MESSAGE_TYPE_LENGTH + MESSAGE_LENGTH_LENGTH)
103 #define VERSION_OFFSET 0
104 #define RESERVED_OFFSET (VERSION_OFFSET + VERSION_LENGTH)
105 #define MESSAGE_CLASS_OFFSET (RESERVED_OFFSET + RESERVED_LENGTH)
106 #define MESSAGE_TYPE_OFFSET (MESSAGE_CLASS_OFFSET + MESSAGE_CLASS_LENGTH)
107 #define MESSAGE_LENGTH_OFFSET (MESSAGE_TYPE_OFFSET + MESSAGE_TYPE_LENGTH)
109 #define PROTOCOL_VERSION_RELEASE_1 1
111 static const value_string protocol_version_values[] = {
112 { PROTOCOL_VERSION_RELEASE_1, "Release 1" },
115 #define MESSAGE_CLASS_MGMT_MESSAGE 0
116 #define MESSAGE_CLASS_ASPSM_MESSAGE 3
117 #define MESSAGE_CLASS_ASPTM_MESSAGE 4
118 #define MESSAGE_CLASS_MAUP_MESSAGE 6
119 #define MESSAGE_CLASS_IIM_MESSAGE 10
121 static const value_string message_class_values[] = {
122 { MESSAGE_CLASS_MGMT_MESSAGE, "Management messages" },
123 { MESSAGE_CLASS_ASPSM_MESSAGE, "ASP state maintenance messages" },
124 { MESSAGE_CLASS_ASPTM_MESSAGE, "ASP traffic maintenance messages" },
125 { MESSAGE_CLASS_MAUP_MESSAGE, "MTP2 user adaptation messages" },
126 { MESSAGE_CLASS_IIM_MESSAGE, "Interface identifier management messages" },
130 #define MESSAGE_TYPE_ERR 0
131 #define MESSAGE_TYPE_NTFY 1
134 #define MESSAGE_TYPE_UP 1
135 #define MESSAGE_TYPE_DOWN 2
136 #define MESSAGE_TYPE_BEAT 3
137 #define MESSAGE_TYPE_UP_ACK 4
138 #define MESSAGE_TYPE_DOWN_ACK 5
139 #define MESSAGE_TYPE_BEAT_ACK 6
142 #define MESSAGE_TYPE_ACTIVE 1
143 #define MESSAGE_TYPE_INACTIVE 2
144 #define MESSAGE_TYPE_ACTIVE_ACK 3
145 #define MESSAGE_TYPE_INACTIVE_ACK 4
148 #define MESSAGE_TYPE_DATA 1
149 #define MESSAGE_TYPE_ESTAB_REQ 2
150 #define MESSAGE_TYPE_ESTAB_CONF 3
151 #define MESSAGE_TYPE_REL_REQ 4
152 #define MESSAGE_TYPE_REL_CONF 5
153 #define MESSAGE_TYPE_REL_IND 6
154 #define MESSAGE_TYPE_STATE_REQ 7
155 #define MESSAGE_TYPE_STATE_CONF 8
156 #define MESSAGE_TYPE_STATE_IND 9
157 #define MESSAGE_TYPE_DATA_RETR_REQ 10
158 #define MESSAGE_TYPE_DATA_RETR_CONF 11
159 #define MESSAGE_TYPE_DATA_RETR_IND 12
160 #define MESSAGE_TYPE_DATA_RETR_COMP_IND 13
161 #define MESSAGE_TYPE_CONG_IND 14
162 #define MESSAGE_TYPE_DATA_ACK 15
165 #define MESSAGE_TYPE_REG_REQ 1
166 #define MESSAGE_TYPE_REG_RSP 2
167 #define MESSAGE_TYPE_DEREG_REQ 3
168 #define MESSAGE_TYPE_DEREG_RSP 4
170 static const value_string message_class_type_values[] = {
171 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_ERR, "Error (ERR)" },
172 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_NTFY, "Notify (NTFY)" },
173 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP, "ASP up (UP)" },
174 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN, "ASP down (DOWN)" },
175 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT, "Heartbeat (BEAT)" },
176 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP_ACK, "ASP up ack (UP ACK)" },
177 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN_ACK, "ASP down ack (DOWN ACK)" },
178 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT_ACK, "Heartbeat ack (BEAT ACK)" },
179 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE , "ASP active (ACTIVE)" },
180 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE , "ASP inactive (INACTIVE)" },
181 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE_ACK , "ASP active ack (ACTIVE ACK)" },
182 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE_ACK , "ASP inactive ack (INACTIVE ACK)" },
183 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA, "DATA (DATA)" },
184 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_REQ, "Establish request (ESTAB_REQ)" },
185 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_CONF, "Establish confirm (ESTAB_CONF)" },
186 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_REQ, "Release request (REL_REQ)" },
187 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_CONF, "Release confirm (REL_CONF)" },
188 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_IND, "Release indication (REL_IND)" },
189 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_REQ, "State request (STATE_REQ)" },
190 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_CONF, "State confirm (STATE_CONF)" },
191 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_IND, "State indication (STATE_IND)" },
192 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_REQ, "Data retrieval request (DATA_RETR_REQ)" },
193 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_CONF, "Data retrieval confirm (DATA_RETR_CONF)" },
194 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_IND, "Data retrieval indication (DATA_RETR_IND)" },
195 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_COMP_IND, "Data retrieval complete indication (DATA_RETR_COMP_IND)" },
196 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_CONG_IND, "Congestion indication (CONG_IND)" },
197 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_ACK, "Data acknowledge (DATA_ACK)" },
198 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_REQ , "Registration request (REG_REQ)" },
199 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_RSP , "Registration response (REG_RSP)" },
200 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_REQ , "Deregistration request (DEREG_REQ)" },
201 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_RSP , "Deregistration response (DEREG_RSP)" },
204 static const value_string message_class_type_acro_values[] = {
205 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_ERR, "ERR" },
206 { MESSAGE_CLASS_MGMT_MESSAGE * 256 + MESSAGE_TYPE_NTFY, "NTFY" },
207 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP, "ASP_UP" },
208 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN, "ASP_DOWN" },
209 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT, "BEAT" },
210 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_UP_ACK, "ASP_UP_ACK" },
211 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_DOWN_ACK, "ASP_DOWN_ACK" },
212 { MESSAGE_CLASS_ASPSM_MESSAGE * 256 + MESSAGE_TYPE_BEAT_ACK, "BEAT_ACK" },
213 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE , "ASP_ACTIVE" },
214 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE , "ASP_INACTIVE" },
215 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_ACTIVE_ACK , "ASP_ACTIVE_ACK" },
216 { MESSAGE_CLASS_ASPTM_MESSAGE * 256 + MESSAGE_TYPE_INACTIVE_ACK , "ASP_INACTIVE_ACK" },
217 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA, "DATA" },
218 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_REQ, "ESTAB_REQ" },
219 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_ESTAB_CONF, "ESTAB_CONF" },
220 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_REQ, "REL_REQ" },
221 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_CONF, "REL_CONF" },
222 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_REL_IND, "REL_IND" },
223 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_REQ, "STATE_REQ" },
224 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_CONF, "STATE_CONF" },
225 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_STATE_IND, "STATE_IND" },
226 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_REQ, "DATA_RETR_REQ" },
227 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_CONF, "DATA_RETR_CONF" },
228 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_IND, "DATA_RETR_IND" },
229 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_RETR_COMP_IND, "DATA_RETR_COMP_IND" },
230 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_CONG_IND, "CONG_IND" },
231 { MESSAGE_CLASS_MAUP_MESSAGE * 256 + MESSAGE_TYPE_DATA_ACK, "DATA_ACK" },
232 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_REQ , "REG_REQ" },
233 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_REG_RSP , "REG_RSP" },
234 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_REQ , "DEREG_REQ" },
235 { MESSAGE_CLASS_IIM_MESSAGE * 256 + MESSAGE_TYPE_DEREG_RSP , "DEREG_RSP" },
239 dissect_common_header(tvbuff_t *common_header_tvb, packet_info *pinfo, proto_tree *m2ua_tree)
241 guint8 message_class, message_type;
243 /* Extract the common header */
244 message_class = tvb_get_guint8(common_header_tvb, MESSAGE_CLASS_OFFSET);
245 message_type = tvb_get_guint8(common_header_tvb, MESSAGE_TYPE_OFFSET);
247 if (check_col(pinfo->cinfo, COL_INFO))
248 col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(message_class * 256 + message_type, message_class_type_acro_values, "reserved"));
251 /* add the components of the common header to the protocol tree */
252 proto_tree_add_item(m2ua_tree, hf_version, common_header_tvb, VERSION_OFFSET, VERSION_LENGTH, NETWORK_BYTE_ORDER);
253 proto_tree_add_item(m2ua_tree, hf_reserved, common_header_tvb, RESERVED_OFFSET, RESERVED_LENGTH, NETWORK_BYTE_ORDER);
254 proto_tree_add_item(m2ua_tree, hf_message_class, common_header_tvb, MESSAGE_CLASS_OFFSET, MESSAGE_CLASS_LENGTH, NETWORK_BYTE_ORDER);
255 proto_tree_add_uint_format(m2ua_tree, hf_message_type, common_header_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, message_type,
256 "Message type: %s (%u)",
257 val_to_str(message_class * 256 + message_type, message_class_type_values, "reserved"), message_type);
258 proto_tree_add_item(m2ua_tree, hf_message_length, common_header_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, NETWORK_BYTE_ORDER);
262 #define PARAMETER_TAG_LENGTH 2
263 #define PARAMETER_LENGTH_LENGTH 2
264 #define PARAMETER_HEADER_LENGTH (PARAMETER_TAG_LENGTH + PARAMETER_LENGTH_LENGTH)
266 #define PARAMETER_TAG_OFFSET 0
267 #define PARAMETER_LENGTH_OFFSET (PARAMETER_TAG_OFFSET + PARAMETER_TAG_LENGTH)
268 #define PARAMETER_VALUE_OFFSET (PARAMETER_LENGTH_OFFSET + PARAMETER_LENGTH_LENGTH)
269 #define PARAMETER_HEADER_OFFSET PARAMETER_TAG_OFFSET
272 #define INT_INTERFACE_ID_OFFSET PARAMETER_VALUE_OFFSET
273 #define INT_INTERFACE_ID_LENGTH 4
276 dissect_interface_identifier_int_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
278 proto_tree_add_item(parameter_tree, hf_interface_id_int, parameter_tvb, INT_INTERFACE_ID_OFFSET, INT_INTERFACE_ID_LENGTH, NETWORK_BYTE_ORDER);
279 proto_item_append_text(parameter_item, " (%d)", tvb_get_ntohl(parameter_tvb, INT_INTERFACE_ID_OFFSET));
282 #define TEXT_INTERFACE_ID_OFFSET PARAMETER_VALUE_OFFSET
285 dissect_interface_identifier_text_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
287 guint16 interface_id_length;
289 interface_id_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
291 proto_tree_add_item(parameter_tree, hf_interface_id_text, parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length, NETWORK_BYTE_ORDER);
292 proto_item_append_text(parameter_item, " (%.*s)", interface_id_length,
293 (const char *)tvb_get_ptr(parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length));
296 #define INFO_STRING_OFFSET PARAMETER_VALUE_OFFSET
299 dissect_info_string_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
301 guint16 info_string_length;
303 info_string_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
304 proto_tree_add_item(parameter_tree, hf_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, NETWORK_BYTE_ORDER);
305 proto_item_append_text(parameter_item, " (%.*s)", info_string_length,
306 (const char *)tvb_get_ptr(parameter_tvb, INFO_STRING_OFFSET, info_string_length));
309 #define DIAGNOSTIC_INFO_OFFSET PARAMETER_VALUE_OFFSET
312 dissect_diagnostic_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
314 guint16 diag_info_length;
316 diag_info_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
317 proto_tree_add_item(parameter_tree, hf_diagnostic_information, parameter_tvb, DIAGNOSTIC_INFO_OFFSET, diag_info_length, NETWORK_BYTE_ORDER);
318 proto_item_append_text(parameter_item, " (%u byte%s)", diag_info_length, plurality(diag_info_length, "", "s"));
321 #define START_LENGTH 4
323 #define INTERVAL_LENGTH (START_LENGTH + END_LENGTH)
325 #define START_OFFSET 0
326 #define END_OFFSET (START_OFFSET + START_LENGTH)
329 dissect_interface_identifier_range_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
331 guint16 number_of_ranges, range_number;
334 number_of_ranges = (tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH) / INTERVAL_LENGTH;
335 offset = PARAMETER_VALUE_OFFSET;
336 for(range_number = 1; range_number <= number_of_ranges; range_number++) {
337 proto_tree_add_item(parameter_tree, hf_interface_id_start, parameter_tvb, offset + START_OFFSET, START_LENGTH, NETWORK_BYTE_ORDER);
338 proto_tree_add_item(parameter_tree, hf_interface_id_stop, parameter_tvb, offset + END_OFFSET, END_LENGTH, NETWORK_BYTE_ORDER);
339 offset += INTERVAL_LENGTH;
342 proto_item_append_text(parameter_item, " (%u range%s)", number_of_ranges, plurality(number_of_ranges, "", "s"));
345 #define HEARTBEAT_DATA_OFFSET PARAMETER_VALUE_OFFSET
348 dissect_heartbeat_data_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
350 guint16 heartbeat_data_length;
352 heartbeat_data_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
353 proto_tree_add_item(parameter_tree, hf_heartbeat_data, parameter_tvb, HEARTBEAT_DATA_OFFSET, heartbeat_data_length, NETWORK_BYTE_ORDER);
354 proto_item_append_text(parameter_item, " (%u byte%s)", heartbeat_data_length, plurality(heartbeat_data_length, "", "s"));
357 #define OVER_RIDE_TYPE 1
358 #define LOAD_SHARE_TYPE 2
359 #define BROADCAST_TYPE 3
361 static const value_string traffic_mode_type_values[] = {
362 { OVER_RIDE_TYPE , "Override" },
363 { LOAD_SHARE_TYPE, "Load-share" },
364 { BROADCAST_TYPE, "Broadcast" },
367 #define TRAFFIC_MODE_TYPE_LENGTH 4
368 #define TRAFFIC_MODE_TYPE_OFFSET PARAMETER_VALUE_OFFSET
371 dissect_traffic_mode_type_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
373 proto_tree_add_item(parameter_tree, hf_traffic_mode_type, parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET, TRAFFIC_MODE_TYPE_LENGTH, NETWORK_BYTE_ORDER);
374 proto_item_append_text(parameter_item, " (%s)",
375 val_to_str(tvb_get_ntohl(parameter_tvb, TRAFFIC_MODE_TYPE_OFFSET), traffic_mode_type_values, "unknown"));
378 #define INVALID_VERSION_ERROR_CODE 0x01
379 #define INVALID_INTERFACE_IDENTIFIER_ERROR_CODE 0x02
380 #define UNSUPPORTED_MESSAGE_CLASS_ERROR_CODE 0x03
381 #define UNSUPPORTED_MESSAGE_TYPE_ERROR_CODE 0x04
382 #define UNSUPPORTED_TRAFFIC_HANDLING_MODE_ERROR_CODE 0x05
383 #define UNEXPECTED_MESSAGE_ERROR_CODE 0x06
384 #define PROTOCOL_ERROR_ERROR_CODE 0x07
385 #define UNSUPPORTED_INTERFACE_IDENTIFIER_TYPE_ERROR_CODE 0x08
386 #define INVALID_STREAM_IDENTIFIER_ERROR_CODE 0x09
387 #define REFUSED_ERROR_CODE 0x0d
388 #define ASP_IDENTIFIER_REQUIRED_ERROR_CODE 0x0e
389 #define INVALID_ASP_IDENTIFIER_ERROR_CODE 0x0f
390 #define ASP_ACTIVE_FOR_INTERFACE_IDENTIFIER_ERROR_CODE 0x10
391 #define INVALID_PARAMETER_VALUE_ERROR_CODE 0x11
392 #define PARAMETER_FIELD_ERROR_CODE 0x12
393 #define UNEXPECTED_PARAMETER_ERROR_CODE 0x13
394 #define MISSING_PARAMETER_ERROR_CODE 0x16
396 static const value_string error_code_values[] = {
397 { INVALID_VERSION_ERROR_CODE, "Invalid version" },
398 { INVALID_INTERFACE_IDENTIFIER_ERROR_CODE, "Invalid interface identifier" },
399 { UNSUPPORTED_MESSAGE_CLASS_ERROR_CODE, "Unsupported message class" },
400 { UNSUPPORTED_MESSAGE_TYPE_ERROR_CODE, "Unsupported message type" },
401 { UNSUPPORTED_TRAFFIC_HANDLING_MODE_ERROR_CODE, "Unsupported traffic handling mode" },
402 { UNEXPECTED_MESSAGE_ERROR_CODE, "Unexpected message" },
403 { PROTOCOL_ERROR_ERROR_CODE, "Protocol error" },
404 { UNSUPPORTED_INTERFACE_IDENTIFIER_TYPE_ERROR_CODE, "Unsupported interface identifier type" },
405 { INVALID_STREAM_IDENTIFIER_ERROR_CODE, "Invalid stream identifier" },
406 { REFUSED_ERROR_CODE, "Refused - management blocking" },
407 { ASP_IDENTIFIER_REQUIRED_ERROR_CODE, "ASP identifier required" },
408 { INVALID_ASP_IDENTIFIER_ERROR_CODE, "Invalid ASP identifier" },
409 { ASP_ACTIVE_FOR_INTERFACE_IDENTIFIER_ERROR_CODE, "ASP active for interface identifier" },
410 { INVALID_PARAMETER_VALUE_ERROR_CODE, "Invalid parameter value" },
411 { PARAMETER_FIELD_ERROR_CODE, "Parameter field error" },
412 { UNEXPECTED_PARAMETER_ERROR_CODE, "Unexpected parameter" },
413 { MISSING_PARAMETER_ERROR_CODE, "Missing parameter" },
416 #define ERROR_CODE_LENGTH 4
417 #define ERROR_CODE_OFFSET PARAMETER_VALUE_OFFSET
420 dissect_error_code_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
422 proto_tree_add_item(parameter_tree, hf_error_code, parameter_tvb, ERROR_CODE_OFFSET, ERROR_CODE_LENGTH, NETWORK_BYTE_ORDER);
423 proto_item_append_text(parameter_item, " (%s)",
424 val_to_str(tvb_get_ntohl(parameter_tvb, ERROR_CODE_OFFSET), error_code_values, "unknown"));
427 #define AS_STATE_CHANGE_TYPE 1
430 static const value_string status_type_values[] = {
431 { AS_STATE_CHANGE_TYPE, "Application server state change" },
432 { OTHER_TYPE, "Other" },
435 #define RESERVED_INFO 1
436 #define AS_INACTIVE_INFO 2
437 #define AS_ACTIVE_INFO 3
438 #define AS_PENDING_INFO 4
440 #define INSUFFICIENT_ASP_RES_INFO 1
441 #define ALTERNATE_ASP_ACTIVE_INFO 2
442 #define ASP_FAILURE_INFO 3
444 static const value_string status_type_id_values[] = {
445 { AS_STATE_CHANGE_TYPE * 256 * 256 + RESERVED_INFO, "Reserved" },
446 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_INACTIVE_INFO, "Application server inactive" },
447 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_ACTIVE_INFO, "Application server active" },
448 { AS_STATE_CHANGE_TYPE * 256 * 256 + AS_PENDING_INFO, "Application server pending" },
449 { OTHER_TYPE * 256 * 256 + INSUFFICIENT_ASP_RES_INFO, "Insufficient ASP resources active in AS" },
450 { OTHER_TYPE * 256 * 256 + ALTERNATE_ASP_ACTIVE_INFO, "Alternate ASP active" },
451 { OTHER_TYPE * 256 * 256 + ASP_FAILURE_INFO, "ASP Failure" },
454 #define STATUS_TYPE_LENGTH 2
455 #define STATUS_IDENT_LENGTH 2
457 #define STATUS_TYPE_OFFSET PARAMETER_VALUE_OFFSET
458 #define STATUS_IDENT_OFFSET (STATUS_TYPE_OFFSET + STATUS_TYPE_LENGTH)
461 dissect_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
463 guint16 status_type, status_id;
465 status_type = tvb_get_ntohs(parameter_tvb, STATUS_TYPE_OFFSET);
466 status_id = tvb_get_ntohs(parameter_tvb, STATUS_IDENT_OFFSET);
468 proto_tree_add_item(parameter_tree, hf_status_type, parameter_tvb, STATUS_TYPE_OFFSET, STATUS_TYPE_LENGTH, NETWORK_BYTE_ORDER);
469 proto_tree_add_uint_format(parameter_tree, hf_status_ident, parameter_tvb, STATUS_IDENT_OFFSET, STATUS_IDENT_LENGTH,
470 status_id, "Status identification: %u (%s)", status_id,
471 val_to_str(status_type * 256 * 256 + status_id, status_type_id_values, "unknown"));
473 proto_item_append_text(parameter_item, " (%s)",
474 val_to_str(status_type * 256 * 256 + status_id, status_type_id_values, "unknown status information"));
477 #define ASP_IDENTIFIER_OFFSET PARAMETER_VALUE_OFFSET
478 #define ASP_IDENTIFIER_LENGTH 4
481 dissect_asp_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
483 proto_tree_add_item(parameter_tree, hf_asp_id, parameter_tvb, ASP_IDENTIFIER_OFFSET, ASP_IDENTIFIER_LENGTH, NETWORK_BYTE_ORDER);
484 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, ASP_IDENTIFIER_OFFSET));
487 #define CORRELATION_ID_LENGTH 4
488 #define CORRELATION_ID_OFFSET PARAMETER_VALUE_OFFSET
491 dissect_correlation_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
493 proto_tree_add_item(parameter_tree, hf_correlation_id, parameter_tvb, CORRELATION_ID_OFFSET, CORRELATION_ID_LENGTH, NETWORK_BYTE_ORDER);
494 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, CORRELATION_ID_OFFSET));
497 #define DATA_1_MTP3_OFFSET PARAMETER_VALUE_OFFSET
500 dissect_protocol_data_1_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_item *parameter_item)
502 tvbuff_t *payload_tvb;
503 guint32 payload_length;
505 payload_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
507 payload_tvb = tvb_new_subset(parameter_tvb, DATA_1_MTP3_OFFSET, payload_length, payload_length);
508 proto_item_set_len(parameter_item, PARAMETER_HEADER_LENGTH);
509 call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
512 #define DATA_2_LI_LENGTH 1
513 #define DATA_2_LI_OFFSET PARAMETER_VALUE_OFFSET
514 #define DATA_2_MTP3_OFFSET (DATA_2_LI_OFFSET + DATA_2_LI_LENGTH)
517 dissect_protocol_data_2_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree, proto_item *parameter_item)
519 tvbuff_t *payload_tvb;
520 guint32 payload_length;
522 payload_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH - DATA_2_LI_LENGTH;
524 proto_tree_add_item(parameter_tree, hf_data_2_li, parameter_tvb, DATA_2_LI_OFFSET, DATA_2_LI_LENGTH, NETWORK_BYTE_ORDER);
525 payload_tvb = tvb_new_subset(parameter_tvb, DATA_2_MTP3_OFFSET, payload_length, payload_length);
526 proto_item_set_len(parameter_item, PARAMETER_HEADER_LENGTH + DATA_2_LI_LENGTH);
527 call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
531 #define STATUS_LPO_SET 0x0
532 #define STATUS_LPO_CLEAR 0x1
533 #define STATUS_EMER_SET 0x2
534 #define STATUS_EMER_CLEAR 0x3
535 #define STATUS_FLUSH_BUFFERS 0x4
536 #define STATUS_CONTINUE 0x5
537 #define STATUS_CLEAR_RTB 0x6
538 #define STATUS_AUDIT 0x7
539 #define STATUS_CONG_CLEAR 0x8
540 #define STATUS_CONG_ACCEPT 0x9
541 #define STATUS_CONG_DISCARD 0xa
543 static const value_string state_values[] = {
544 { STATUS_LPO_SET, "Request local processor outage" },
545 { STATUS_LPO_CLEAR, "Request local processor outage recovered" },
546 { STATUS_EMER_SET, "Request emergency alignment" },
547 { STATUS_EMER_CLEAR, "Request normal alignment (cancel emergency)" },
548 { STATUS_FLUSH_BUFFERS, "Flush or clear receive, transmit and retransmit queues" },
549 { STATUS_CONTINUE, "Continue or Resume" },
550 { STATUS_CLEAR_RTB, "Clear the retransmit queue" },
551 { STATUS_AUDIT, "Audit state of link" },
552 { STATUS_CONG_CLEAR, "Congestion cleared" },
553 { STATUS_CONG_ACCEPT, "Congestion accept" },
554 { STATUS_CONG_DISCARD, "Congestion discard" },
557 #define STATE_LENGTH 4
558 #define STATE_OFFSET PARAMETER_VALUE_OFFSET
561 dissect_state_request_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
563 proto_tree_add_item(parameter_tree, hf_state, parameter_tvb, STATE_OFFSET, STATE_LENGTH, NETWORK_BYTE_ORDER);
564 proto_item_append_text(parameter_item, " (%s)", val_to_str(tvb_get_ntohl(parameter_tvb, STATE_OFFSET), state_values, "unknown"));
567 #define EVENT_RPO_ENTER 0x1
568 #define EVENT_RPO_EXIT 0x2
569 #define EVENT_LPO_ENTER 0x3
570 #define EVENT_LPO_EXIT 0x4
572 static const value_string event_values[] = {
573 { EVENT_RPO_ENTER, "Remote entered processor outage" },
574 { EVENT_RPO_EXIT, "Remote exited processor outage" },
575 { EVENT_LPO_ENTER, "Link entered processor outage" },
576 { EVENT_LPO_EXIT, "Link exited processor outage" },
579 #define EVENT_LENGTH 4
580 #define EVENT_OFFSET PARAMETER_VALUE_OFFSET
583 dissect_state_event_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
585 proto_tree_add_item(parameter_tree, hf_event, parameter_tvb, EVENT_OFFSET, EVENT_LENGTH, NETWORK_BYTE_ORDER);
586 proto_item_append_text(parameter_item, " (%s)", val_to_str(tvb_get_ntohl(parameter_tvb, STATE_OFFSET), event_values, "unknown"));
589 #define LEVEL_NONE 0x0
594 static const value_string level_values[] = {
595 { LEVEL_NONE, "No congestion" },
596 { LEVEL_1, "Congestion Level 1" },
597 { LEVEL_2, "Congestion Level 2" },
598 { LEVEL_3, "Congestion Level 3" },
601 #define CONGESTION_STATUS_LENGTH 4
602 #define CONGESTION_STATUS_OFFSET PARAMETER_VALUE_OFFSET
605 dissect_congestion_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
607 proto_tree_add_item(parameter_tree, hf_congestion_status, parameter_tvb, CONGESTION_STATUS_OFFSET, CONGESTION_STATUS_LENGTH, NETWORK_BYTE_ORDER);
608 proto_item_append_text(parameter_item, " (%s)", val_to_str(tvb_get_ntohl(parameter_tvb, CONGESTION_STATUS_OFFSET), level_values, "unknown"));
611 #define DISCARD_STATUS_LENGTH 4
612 #define DISCARD_STATUS_OFFSET PARAMETER_VALUE_OFFSET
615 dissect_discard_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
617 proto_tree_add_item(parameter_tree, hf_discard_status, parameter_tvb, DISCARD_STATUS_OFFSET, DISCARD_STATUS_LENGTH, NETWORK_BYTE_ORDER);
618 proto_item_append_text(parameter_item, " (%s)", val_to_str(tvb_get_ntohl(parameter_tvb, DISCARD_STATUS_OFFSET), level_values, "unknown"));
621 #define ACTION_RTRV_BSN 0x1
622 #define ACTION_RTRV_MSGS 0x2
624 static const value_string action_values[] = {
625 { ACTION_RTRV_BSN, "Retrieve the backward sequence number" },
626 { ACTION_RTRV_MSGS, "Retrieve the PDUs from the transmit and retransmit queues" },
630 #define ACTION_LENGTH 4
631 #define ACTION_OFFSET PARAMETER_VALUE_OFFSET
634 dissect_action_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
636 proto_tree_add_uint(parameter_tree, hf_action, parameter_tvb, ACTION_OFFSET, ACTION_LENGTH, NETWORK_BYTE_ORDER);
637 proto_item_append_text(parameter_item, " (%s)", val_to_str(tvb_get_ntohl(parameter_tvb, ACTION_OFFSET), action_values, "unknown"));
640 #define SEQUENCE_NUMBER_LENGTH 4
641 #define SEQUENCE_NUMBER_OFFSET PARAMETER_VALUE_OFFSET
644 dissect_sequence_number_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
646 proto_tree_add_item(parameter_tree, hf_sequence_number, parameter_tvb, SEQUENCE_NUMBER_OFFSET, SEQUENCE_NUMBER_LENGTH, NETWORK_BYTE_ORDER);
647 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, SEQUENCE_NUMBER_OFFSET));
650 #define RESULT_SUCCESS 0x0
651 #define RESULT_FAILURE 0x1
653 static const value_string retrieval_result_values[] = {
654 { RESULT_SUCCESS, "Action successful" },
655 { RESULT_FAILURE , "Action failed" },
659 #define RETRIEVAL_RESULT_LENGTH 4
660 #define RETRIEVAL_RESULT_OFFSET PARAMETER_VALUE_OFFSET
663 dissect_retrieval_result_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
665 proto_tree_add_item(parameter_tree, hf_retrieval_result, parameter_tvb, RETRIEVAL_RESULT_OFFSET, RETRIEVAL_RESULT_LENGTH, NETWORK_BYTE_ORDER);
666 proto_item_append_text(parameter_item, " (%s)", val_to_str(tvb_get_ntohl(parameter_tvb, RETRIEVAL_RESULT_OFFSET), retrieval_result_values, "unknown"));
670 dissect_link_key_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
672 tvbuff_t *parameters_tvb;
673 guint16 parameters_length;
675 parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
676 parameters_tvb = tvb_new_subset(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length, parameters_length);
677 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
680 #define LOCAL_LK_ID_LENGTH 4
681 #define LOCAL_LK_ID_OFFSET PARAMETER_VALUE_OFFSET
684 dissect_local_lk_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
686 proto_tree_add_item(parameter_tree, hf_local_lk_id, parameter_tvb, LOCAL_LK_ID_OFFSET, LOCAL_LK_ID_LENGTH, NETWORK_BYTE_ORDER);
687 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohl(parameter_tvb, LOCAL_LK_ID_OFFSET));
690 #define SDT_RESERVED_LENGTH 2
691 #define SDT_ID_LENGTH 2
692 #define SDT_RESERVED_OFFSET PARAMETER_VALUE_OFFSET
693 #define SDT_ID_OFFSET (SDT_RESERVED_OFFSET + SDT_RESERVED_LENGTH)
696 dissect_sdt_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
698 proto_tree_add_item(parameter_tree, hf_sdt_reserved, parameter_tvb, SDT_RESERVED_OFFSET, SDT_RESERVED_LENGTH, NETWORK_BYTE_ORDER);
699 proto_tree_add_item(parameter_tree, hf_sdt_id, parameter_tvb, SDT_ID_OFFSET, SDT_ID_LENGTH, NETWORK_BYTE_ORDER);
700 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohs(parameter_tvb, SDT_ID_OFFSET));
703 #define SDL_RESERVED_LENGTH 2
704 #define SDL_ID_LENGTH 2
705 #define SDL_RESERVED_OFFSET PARAMETER_VALUE_OFFSET
706 #define SDL_ID_OFFSET (SDL_RESERVED_OFFSET + SDL_RESERVED_LENGTH)
709 dissect_sdl_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
711 proto_tree_add_item(parameter_tree, hf_sdl_reserved, parameter_tvb, SDL_RESERVED_OFFSET, SDL_RESERVED_LENGTH, NETWORK_BYTE_ORDER);
712 proto_tree_add_item(parameter_tree, hf_sdl_id, parameter_tvb, SDL_ID_OFFSET, SDL_ID_LENGTH, NETWORK_BYTE_ORDER);
713 proto_item_append_text(parameter_item, " (%u)", tvb_get_ntohs(parameter_tvb, SDL_ID_OFFSET));
717 dissect_registration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
719 tvbuff_t *parameters_tvb;
720 guint16 parameters_length;
722 parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
723 parameters_tvb = tvb_new_subset(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length, parameters_length);
724 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
727 #define SUCCESSFULL_REGISTRATION_STATUS 0
728 #define UNKNOWN_REGISTRATION_STATUS 1
729 #define INVALID_SDLI_REGISTRATION_STATUS 2
730 #define INVALID_SDTI_REGISTRATION_STATUS 3
731 #define INVALID_LINK_KEY_REGISTRATION_STATUS 4
732 #define PERMISSION_DENIED_REGISTRATION_STATUS 5
733 #define OVERLAPPING_LINK_KEY_REGISTRATION_STATUS 6
734 #define LINK_KEY_NOT_PROVISIONED_REGISTRATION_STATUS 7
735 #define INSUFFICIENT_RESOURCES_REGISTRATION_STATUS 8
737 static const value_string registration_status_values[] = {
738 { SUCCESSFULL_REGISTRATION_STATUS, "Successfully registered" },
739 { UNKNOWN_REGISTRATION_STATUS, "Error - Unknown" },
740 { INVALID_SDLI_REGISTRATION_STATUS, "Error - Invalid SDLI" },
741 { INVALID_SDTI_REGISTRATION_STATUS, "Error - Invalid SDTI" },
742 { INVALID_LINK_KEY_REGISTRATION_STATUS, "Error - Invalid link key" },
743 { PERMISSION_DENIED_REGISTRATION_STATUS, "Error - Permission denied" },
744 { OVERLAPPING_LINK_KEY_REGISTRATION_STATUS, "Error - Overlapping (Non-unique) link key" },
745 { LINK_KEY_NOT_PROVISIONED_REGISTRATION_STATUS, "Error - Link key not provisioned" },
746 { INSUFFICIENT_RESOURCES_REGISTRATION_STATUS, "Error - Insufficient resources" },
749 #define REGISTRATION_STATUS_LENGTH 4
750 #define REGISTRATION_STATUS_OFFSET PARAMETER_VALUE_OFFSET
753 dissect_registration_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
755 proto_tree_add_item(parameter_tree, hf_registration_status, parameter_tvb, REGISTRATION_STATUS_OFFSET, REGISTRATION_STATUS_LENGTH, NETWORK_BYTE_ORDER);
756 proto_item_append_text(parameter_item, " (%s)", val_to_str(tvb_get_ntohl(parameter_tvb, REGISTRATION_STATUS_OFFSET), registration_status_values, "unknown"));
760 dissect_deregistration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
762 tvbuff_t *parameters_tvb;
763 guint16 parameters_length;
765 parameters_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
766 parameters_tvb = tvb_new_subset(parameter_tvb, PARAMETER_VALUE_OFFSET, parameters_length, parameters_length);
767 dissect_parameters(parameters_tvb, pinfo, tree, parameter_tree);
770 #define SUCCESSFULL_DEREGISTRATION_STATUS 0
771 #define UNKNOWN_DEREGISTRATION_STATUS 1
772 #define INVALID_INTERFACE_IDENTIFIER_DEREGISTRATION_STATUS 2
773 #define PERMISSION_DENIED_DEREGISTRATION_STATUS 3
774 #define NOT_REGISTRED_DEREGISTRATION_STATUS 4
776 static const value_string deregistration_status_values[] = {
777 { SUCCESSFULL_DEREGISTRATION_STATUS, "Successfully deregistered" },
778 { UNKNOWN_DEREGISTRATION_STATUS, "Error - Unknown" },
779 { INVALID_INTERFACE_IDENTIFIER_DEREGISTRATION_STATUS, "Error - Invalid interface identifier" },
780 { PERMISSION_DENIED_DEREGISTRATION_STATUS, "Error - Permission denied" },
781 { NOT_REGISTRED_DEREGISTRATION_STATUS, "Error - Not registered" },
784 #define DEREGISTRATION_STATUS_LENGTH 4
785 #define DEREGISTRATION_STATUS_OFFSET PARAMETER_VALUE_OFFSET
788 dissect_deregistration_status_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
790 proto_tree_add_item(parameter_tree, hf_deregistration_status, parameter_tvb, DEREGISTRATION_STATUS_OFFSET, DEREGISTRATION_STATUS_LENGTH, NETWORK_BYTE_ORDER);
791 proto_item_append_text(parameter_item, " (%s)", val_to_str(tvb_get_ntohl(parameter_tvb, DEREGISTRATION_STATUS_OFFSET), deregistration_status_values, "unknown"));
795 dissect_unknown_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
797 guint16 parameter_value_length;
799 parameter_value_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH;
800 if (parameter_value_length > 0)
801 proto_tree_add_item(parameter_tree, hf_parameter_value, parameter_tvb, PARAMETER_VALUE_OFFSET, parameter_value_length, NETWORK_BYTE_ORDER);
802 proto_item_append_text(parameter_item, " with tag %u and %u byte%s value",
803 tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET), parameter_value_length, plurality(parameter_value_length, "", "s"));
806 /* Common parameter tags */
807 #define INTERFACE_IDENTIFIER_INT_PARAMETER_TAG 0x0001
808 #define INTERFACE_IDENTIFIER_TEXT_PARAMETER_TAG 0x0003
809 #define INFO_STRING_PARAMETER_TAG 0x0004
810 #define DIAGNOSTIC_INFORMATION_PARAMETER_TAG 0x0007
811 #define INTERFACE_IDENTIFIER_RANGE_PARAMETER_TAG 0x0008
812 #define HEARTBEAT_DATA_PARAMETER_TAG 0x0009
813 #define TRAFFIC_MODE_TYPE_PARAMETER_TAG 0x000b
814 #define ERROR_CODE_PARAMETER_TAG 0x000c
815 #define STATUS_PARAMETER_TAG 0x000d
816 #define ASP_IDENTIFIER_PARAMETER_TAG 0x0011
817 #define CORRELATION_IDENTIFIER_PARAMETER_TAG 0x0013
819 /* M2PA specific parameter tags */
820 #define PROTOCOL_DATA_1_PARAMETER_TAG 0x0300
821 #define PROTOCOL_DATA_2_PARAMETER_TAG 0x0301
822 #define STATE_REQUEST_PARAMETER_TAG 0x0302
823 #define STATE_EVENT_PARAMETER_TAG 0x0303
824 #define CONGESTION_STATUS_PARAMETER_TAG 0x0304
825 #define DISCARD_STATUS_PARAMETER_TAG 0x0305
826 #define ACTION_PARAMETER_TAG 0x0306
827 #define SEQUENCE_NUMBER_PARAMETER_TAG 0x0307
828 #define RETRIEVAL_RESULT_PARAMETER_TAG 0x0308
829 #define LINK_KEY_PARAMETER_TAG 0x0309
830 #define LOCAL_LK_IDENTIFIER_PARAMETER_TAG 0x030a
831 #define SDT_IDENTIFIER_PARAMETER_TAG 0x030b
832 #define SDL_IDENTIFIER_PARAMETER_TAG 0x030c
833 #define REG_RESULT_PARAMETER_TAG 0x030d
834 #define REG_STATUS_PARAMETER_TAG 0x030e
835 #define DEREG_RESULT_PARAMETER_TAG 0x030f
836 #define DEREG_STATUS_PARAMETER_TAG 0x0310
838 static const value_string parameter_tag_values[] = {
839 { INTERFACE_IDENTIFIER_INT_PARAMETER_TAG, "Interface identifier (integer)" },
840 { INTERFACE_IDENTIFIER_TEXT_PARAMETER_TAG, "Interface identifier (text)" },
841 { INFO_STRING_PARAMETER_TAG, "Info string" },
842 { DIAGNOSTIC_INFORMATION_PARAMETER_TAG, "Diagnostic information" },
843 { INTERFACE_IDENTIFIER_RANGE_PARAMETER_TAG, "Interface identifier (integer range)" },
844 { HEARTBEAT_DATA_PARAMETER_TAG, "Heartbeat data" },
845 { TRAFFIC_MODE_TYPE_PARAMETER_TAG, "Traffic mode type" },
846 { ERROR_CODE_PARAMETER_TAG, "Error code" },
847 { STATUS_PARAMETER_TAG, "Status type / information" },
848 { ASP_IDENTIFIER_PARAMETER_TAG, "ASP identifier" },
849 { CORRELATION_IDENTIFIER_PARAMETER_TAG, "Correlation identifier" },
850 { PROTOCOL_DATA_1_PARAMETER_TAG, "Protocol data 1" },
851 { PROTOCOL_DATA_2_PARAMETER_TAG, "Protocol data 2" },
852 { STATE_REQUEST_PARAMETER_TAG, "State request" },
853 { STATE_EVENT_PARAMETER_TAG, "State event" },
854 { CONGESTION_STATUS_PARAMETER_TAG, "Congestion state" },
855 { DISCARD_STATUS_PARAMETER_TAG, "Discard state" },
856 { ACTION_PARAMETER_TAG, "Action" },
857 { SEQUENCE_NUMBER_PARAMETER_TAG, "Sequence number" },
858 { RETRIEVAL_RESULT_PARAMETER_TAG, "Retrieval result" },
859 { LINK_KEY_PARAMETER_TAG, "Link key" },
860 { LOCAL_LK_IDENTIFIER_PARAMETER_TAG, "Local LK identifier" },
861 { SDT_IDENTIFIER_PARAMETER_TAG, "SDT identifier" },
862 { SDL_IDENTIFIER_PARAMETER_TAG, "SDL identifer" },
863 { REG_RESULT_PARAMETER_TAG, "Registration result" },
864 { REG_STATUS_PARAMETER_TAG, "Registration status" },
865 { DEREG_RESULT_PARAMETER_TAG, "Deregistration result" },
866 { DEREG_STATUS_PARAMETER_TAG, "Deregistration status" },
870 dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
872 guint16 tag, length, padding_length;
873 proto_item *parameter_item;
874 proto_tree *parameter_tree;
876 /* extract tag and length from the parameter */
877 tag = tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET);
878 length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
880 /* calculate padding and total length */
881 padding_length = tvb_length(parameter_tvb) - length;
883 /* create proto_tree stuff */
884 parameter_item = proto_tree_add_text(m2ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, tvb_length(parameter_tvb),
885 val_to_str(tag, parameter_tag_values, "Unknown parameter"));
886 parameter_tree = proto_item_add_subtree(parameter_item, ett_m2ua_parameter);
888 /* add tag and length to the m2ua tree */
889 proto_tree_add_item(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, NETWORK_BYTE_ORDER);
890 proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, NETWORK_BYTE_ORDER);
893 case INTERFACE_IDENTIFIER_INT_PARAMETER_TAG:
894 dissect_interface_identifier_int_parameter(parameter_tvb, parameter_tree, parameter_item);
896 case INTERFACE_IDENTIFIER_TEXT_PARAMETER_TAG:
897 dissect_interface_identifier_text_parameter(parameter_tvb, parameter_tree, parameter_item);
899 case INFO_STRING_PARAMETER_TAG:
900 dissect_info_string_parameter(parameter_tvb, parameter_tree, parameter_item);
902 case DIAGNOSTIC_INFORMATION_PARAMETER_TAG:
903 dissect_diagnostic_information_parameter(parameter_tvb, parameter_tree, parameter_item);
905 case INTERFACE_IDENTIFIER_RANGE_PARAMETER_TAG:
906 dissect_interface_identifier_range_parameter(parameter_tvb, parameter_tree, parameter_item);
908 case HEARTBEAT_DATA_PARAMETER_TAG:
909 dissect_heartbeat_data_parameter(parameter_tvb, parameter_tree, parameter_item);
911 case TRAFFIC_MODE_TYPE_PARAMETER_TAG:
912 dissect_traffic_mode_type_parameter(parameter_tvb, parameter_tree, parameter_item);
914 case ERROR_CODE_PARAMETER_TAG:
915 dissect_error_code_parameter(parameter_tvb, parameter_tree, parameter_item);
917 case STATUS_PARAMETER_TAG:
918 dissect_status_parameter(parameter_tvb, parameter_tree, parameter_item);
920 case ASP_IDENTIFIER_PARAMETER_TAG:
921 dissect_asp_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
923 case CORRELATION_IDENTIFIER_PARAMETER_TAG:
924 dissect_correlation_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
926 case PROTOCOL_DATA_1_PARAMETER_TAG:
927 dissect_protocol_data_1_parameter(parameter_tvb, pinfo, tree, parameter_item);
929 case PROTOCOL_DATA_2_PARAMETER_TAG:
930 dissect_protocol_data_2_parameter(parameter_tvb, pinfo, tree, parameter_tree, parameter_item);
932 case STATE_REQUEST_PARAMETER_TAG:
933 dissect_state_request_parameter(parameter_tvb, parameter_tree, parameter_item);
935 case STATE_EVENT_PARAMETER_TAG:
936 dissect_state_event_parameter(parameter_tvb, parameter_tree, parameter_item);
938 case CONGESTION_STATUS_PARAMETER_TAG:
939 dissect_congestion_status_parameter(parameter_tvb, parameter_tree, parameter_item);
941 case DISCARD_STATUS_PARAMETER_TAG:
942 dissect_discard_status_parameter(parameter_tvb, parameter_tree, parameter_item);
944 case ACTION_PARAMETER_TAG:
945 dissect_action_parameter(parameter_tvb, parameter_tree, parameter_item);
947 case SEQUENCE_NUMBER_PARAMETER_TAG:
948 dissect_sequence_number_parameter(parameter_tvb, parameter_tree, parameter_item);
950 case RETRIEVAL_RESULT_PARAMETER_TAG:
951 dissect_retrieval_result_parameter(parameter_tvb, parameter_tree, parameter_item);
953 case LINK_KEY_PARAMETER_TAG:
954 dissect_link_key_parameter(parameter_tvb, pinfo, tree, parameter_tree);
956 case LOCAL_LK_IDENTIFIER_PARAMETER_TAG:
957 dissect_local_lk_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
959 case SDT_IDENTIFIER_PARAMETER_TAG:
960 dissect_sdt_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
962 case SDL_IDENTIFIER_PARAMETER_TAG:
963 dissect_sdl_identifier_parameter(parameter_tvb, parameter_tree, parameter_item);
965 case REG_RESULT_PARAMETER_TAG:
966 dissect_registration_result_parameter(parameter_tvb, pinfo, tree, parameter_tree);
968 case REG_STATUS_PARAMETER_TAG:
969 dissect_registration_status_parameter(parameter_tvb, parameter_tree, parameter_item);
971 case DEREG_RESULT_PARAMETER_TAG:
972 dissect_deregistration_result_parameter(parameter_tvb, pinfo, tree, parameter_tree);
974 case DEREG_STATUS_PARAMETER_TAG:
975 dissect_deregistration_status_parameter(parameter_tvb, parameter_tree, parameter_item);
978 dissect_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
982 if (padding_length > 0)
983 proto_tree_add_item(parameter_tree, hf_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, NETWORK_BYTE_ORDER);
988 dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
990 gint offset, length, total_length, remaining_length;
991 tvbuff_t *parameter_tvb;
994 while((remaining_length = tvb_reported_length_remaining(parameters_tvb, offset))) {
995 length = tvb_get_ntohs(parameters_tvb, offset + PARAMETER_LENGTH_OFFSET);
996 total_length = ADD_PADDING(length);
997 if (remaining_length >= length)
998 total_length = MIN(total_length, remaining_length);
999 /* create a tvb for the parameter including the padding bytes */
1000 parameter_tvb = tvb_new_subset(parameters_tvb, offset, total_length, total_length);
1001 dissect_parameter(parameter_tvb, pinfo, tree, m2ua_tree);
1002 /* get rid of the handled parameter */
1003 offset += total_length;
1009 dissect_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
1011 tvbuff_t *common_header_tvb, *parameters_tvb;
1013 common_header_tvb = tvb_new_subset(message_tvb, 0, COMMON_HEADER_LENGTH, COMMON_HEADER_LENGTH);
1014 parameters_tvb = tvb_new_subset(message_tvb, COMMON_HEADER_LENGTH, -1, -1);
1015 dissect_common_header(common_header_tvb, pinfo, m2ua_tree);
1016 dissect_parameters(parameters_tvb, pinfo, tree, m2ua_tree);
1020 dissect_m2ua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree)
1022 proto_item *m2ua_item;
1023 proto_tree *m2ua_tree;
1025 /* make entry in the Protocol column on summary display */
1026 if (check_col(pinfo->cinfo, COL_PROTOCOL))
1027 col_set_str(pinfo->cinfo, COL_PROTOCOL, "M2UA");
1029 /* In the interest of speed, if "tree" is NULL, don't do any work not
1030 necessary to generate protocol tree items. */
1032 /* create the m2ua protocol tree */
1033 m2ua_item = proto_tree_add_item(tree, proto_m2ua, message_tvb, 0, -1, FALSE);
1034 m2ua_tree = proto_item_add_subtree(m2ua_item, ett_m2ua);
1038 /* dissect the message */
1039 dissect_message(message_tvb, pinfo, tree, m2ua_tree);
1042 /* Register the protocol with Ethereal */
1044 proto_register_m2ua(void)
1047 /* Setup list of header fields */
1048 static hf_register_info hf[] = {
1049 { &hf_version, { "Version", "m2ua.version", FT_UINT8, BASE_DEC, VALS(protocol_version_values), 0x0, "", HFILL } },
1050 { &hf_reserved, { "Reserved", "m2ua.reserved", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL } },
1051 { &hf_message_class, { "Message class", "m2ua.message_class", FT_UINT8, BASE_DEC, VALS(message_class_values), 0x0, "", HFILL } },
1052 { &hf_message_type, { "Message Type", "m2ua.message_type", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } },
1053 { &hf_message_length, { "Message length", "m2ua.message_length", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } },
1054 { &hf_parameter_tag, { "Parameter Tag", "m2ua.parameter_tag", FT_UINT16, BASE_HEX, VALS(parameter_tag_values), 0x0, "", HFILL } },
1055 { &hf_parameter_length, { "Parameter length", "m2ua.parameter_length", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL } },
1056 { &hf_parameter_value, { "Parameter value", "m2ua.parameter_value", FT_BYTES, BASE_NONE, NULL, 0x0, "", HFILL } },
1057 { &hf_parameter_padding, { "Padding", "m2ua.parameter_padding", FT_BYTES, BASE_NONE, NULL, 0x0, "", HFILL } },
1058 { &hf_interface_id_int, { "Interface Identifier (integer)", "m2ua.interface_identifier_int", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } },
1059 { &hf_interface_id_text, { "Interface identifier (text)", "m2ua.interface_identifier_text", FT_STRING, BASE_DEC, NULL, 0x0, "", HFILL } },
1060 { &hf_info_string, { "Info string", "m2ua.info_string", FT_STRING, BASE_DEC, NULL, 0x0, "", HFILL } },
1061 { &hf_diagnostic_information, { "Diagnostic information", "m2ua.diagnostic_information", FT_BYTES, BASE_NONE, NULL, 0x0, "", HFILL } },
1062 { &hf_interface_id_start, { "Interface Identifier (start)", "m2ua.interface_identifier_start", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } },
1063 { &hf_interface_id_stop, { "Interface Identifier (stop)", "m2ua.interface_identifier_stop", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } },
1064 { &hf_heartbeat_data, { "Heartbeat data", "m2ua.heartbeat_data", FT_BYTES, BASE_NONE, NULL, 0x0, "", HFILL } },
1065 { &hf_traffic_mode_type, { "Traffic mode Type", "m2ua.traffic_mode_type", FT_UINT32, BASE_DEC, VALS(traffic_mode_type_values), 0x0, "", HFILL } },
1066 { &hf_error_code, { "Error code", "m2ua.error_code", FT_UINT32, BASE_DEC, VALS(error_code_values), 0x0, "", HFILL } },
1067 { &hf_status_type, { "Status type", "m2ua.status_type", FT_UINT16, BASE_DEC, VALS(status_type_values), 0x0, "", HFILL } },
1068 { &hf_status_ident, { "Status info", "m2ua.status_info", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL } },
1069 { &hf_asp_id, { "ASP identifier", "m2ua.asp_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } },
1070 { &hf_correlation_id, { "Correlation identifier", "m2ua.correlation identifier", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } },
1071 { &hf_data_2_li, { "Length indicator", "m2ua.data_2_li", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } },
1072 { &hf_state, { "State", "m2ua.state", FT_UINT32, BASE_DEC, VALS(state_values), 0x0, "", HFILL } },
1073 { &hf_event, { "Event", "m2ua.event", FT_UINT32, BASE_DEC, VALS(event_values), 0x0, "", HFILL } },
1074 { &hf_congestion_status, { "Congestion status", "m2ua.congestion_status", FT_UINT32, BASE_DEC, VALS(level_values), 0x0, "", HFILL } },
1075 { &hf_discard_status, { "Discard status", "m2ua.discard_status", FT_UINT32, BASE_DEC, VALS(level_values), 0x0, "", HFILL } },
1076 { &hf_action, { "Actions", "m2ua.action", FT_UINT32, BASE_DEC, VALS(action_values), 0x0, "", HFILL } },
1077 { &hf_sequence_number, { "Sequence number", "m2ua.sequence_number", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } },
1078 { &hf_retrieval_result, { "Retrieval result", "m2ua.retrieval_result", FT_UINT32, BASE_DEC, VALS(retrieval_result_values), 0x0, "", HFILL } },
1079 { &hf_local_lk_id, { "Local LK identifier", "m2ua.local_lk_identifier", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } },
1080 { &hf_sdt_reserved, { "Reserved", "m2ua.sdt_reserved", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL } },
1081 { &hf_sdt_id, { "SDT identifier", "m2ua.sdt_identifier", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL } },
1082 { &hf_sdl_reserved, { "Reserved", "m2ua.sdl_reserved", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL } },
1083 { &hf_sdl_id, { "SDL identifier", "m2ua.sdl_identifier", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL } },
1084 { &hf_registration_status, { "Registration status", "m2ua.registration_status", FT_UINT32, BASE_DEC, VALS(registration_status_values), 0x0, "", HFILL } },
1085 { &hf_deregistration_status, { "Deregistration status", "m2ua.deregistration_status", FT_UINT32, BASE_DEC, VALS(deregistration_status_values), 0x0, "", HFILL } },
1088 /* Setup protocol subtree array */
1089 static gint *ett[] = {
1091 &ett_m2ua_parameter,
1094 /* Register the protocol name and description */
1095 proto_m2ua = proto_register_protocol("MTP 2 User Adaptation Layer", "M2UA", "m2ua");
1097 /* Required function calls to register the header fields and subtrees used */
1098 proto_register_field_array(proto_m2ua, hf, array_length(hf));
1099 proto_register_subtree_array(ett, array_length(ett));
1104 proto_reg_handoff_m2ua(void)
1106 dissector_handle_t m2ua_handle;
1108 mtp3_handle = find_dissector("mtp3");
1109 m2ua_handle = create_dissector_handle(dissect_m2ua, proto_m2ua);
1110 dissector_add("sctp.ppi", M2UA_PAYLOAD_PROTOCOL_ID, m2ua_handle);
1111 dissector_add("sctp.port", SCTP_PORT_M2UA, m2ua_handle);