*
* Copyright 2000, Michael Tüxen <Michael.Tuexen@icn.siemens.de>
*
- * $Id: packet-m3ua.c,v 1.4 2001/01/25 06:14:14 guy Exp $
+ * $Id: packet-m3ua.c,v 1.8 2001/06/18 02:17:48 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@unicom.net>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
* Copied from README.developer
#endif
#include "packet.h"
-#include "packet-ip.h"
-
#define SCTP_PORT_M3UA 2905
#define M3UA_PAYLOAD_PROTO_ID 3
static gint ett_m3ua_parameter = -1;
static gint ett_m3ua_affected_destination = -1;
+static dissector_handle_t mtp3_handle;
+
static guint
nr_of_padding_bytes (guint length)
{
}
static void
-dissect_m3ua_protocol_data_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
+dissect_m3ua_protocol_data_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint16 length, protocol_data_length;
-
+ tvbuff_t *payload_tvb;
+
length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
-
protocol_data_length = length - PARAMETER_HEADER_LENGTH;
-
- proto_tree_add_text(parameter_tree, parameter_tvb, PROTOCOL_DATA_OFFSET, protocol_data_length,
- "Protocol data (%u byte%s)",
- protocol_data_length, plurality(protocol_data_length, "", "s"));
+ payload_tvb = tvb_new_subset(parameter_tvb, PROTOCOL_DATA_OFFSET,
+ protocol_data_length, protocol_data_length);
+
+ call_dissector(mtp3_handle, payload_tvb, pinfo, tree);
proto_item_set_text(parameter_item, "Protocol data (SS7 message of %u byte%s)",
protocol_data_length, plurality(protocol_data_length, "", "s"));
}
static void
-dissect_m3ua_parameter(tvbuff_t *parameter_tvb, proto_tree *m3ua_tree)
+dissect_m3ua_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
{
guint16 tag, length, padding_length, total_length;
proto_item *parameter_item;
dissect_m3ua_network_appearance_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case PROTOCOL_DATA_PARAMETER_TAG:
- dissect_m3ua_protocol_data_parameter(parameter_tvb, parameter_tree, parameter_item);
+ dissect_m3ua_protocol_data_parameter(parameter_tvb, pinfo, tree, parameter_tree, parameter_item);
break;
case INFO_PARAMETER_TAG:
dissect_m3ua_info_parameter(parameter_tvb, parameter_tree, parameter_item);
}
static void
-dissect_m3ua_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *m3ua_tree)
+dissect_m3ua_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
{
gint offset, length, padding_length, total_length;
tvbuff_t *common_header_tvb, *parameter_tvb;
total_length = length + padding_length;
/* create a tvb for the parameter including the padding bytes */
parameter_tvb = tvb_new_subset(message_tvb, offset, total_length, total_length);
- dissect_m3ua_parameter(parameter_tvb, m3ua_tree);
+ dissect_m3ua_parameter(parameter_tvb, pinfo, tree, m3ua_tree);
/* get rid of the handled parameter */
offset += total_length;
}
m3ua_tree = NULL;
};
/* dissect the message */
- dissect_m3ua_message(message_tvb, pinfo, m3ua_tree);
+ dissect_m3ua_message(message_tvb, pinfo, tree, m3ua_tree);
}
/* Register the protocol with Ethereal */
{ &hf_m3ua_version,
{ "Version", "m3ua.version",
FT_UINT8, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_reserved,
{ "Reserved", "m3ua.reserved",
FT_UINT8, BASE_HEX, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_message_class,
{ "Message class", "m3ua.message_class",
FT_UINT8, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_message_type,
{ "Message Type", "m3ua.message_type",
FT_UINT8, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_message_length,
{ "Message length", "m3ua.message_length",
FT_UINT32, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_parameter_tag,
{ "Parameter Tag", "m3ua.parameter_tag",
FT_UINT16, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_parameter_length,
{ "Parameter length", "m3ua.parameter_length",
FT_UINT16, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_network_appearance,
{ "Network appearance", "m3ua.network_appearance",
FT_UINT32, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_info_string,
{ "Info string", "m3ua.info_string",
FT_STRING, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_error_code,
{ "Error code", "m3ua.error_code",
FT_UINT32, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_status_type,
{ "Status type", "m3ua.status_type",
FT_UINT16, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_status_info,
{ "Status info", "m3ua.status_info",
FT_UINT16, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_unavailability_cause,
{ "Unavailability cause", "m3ua.unavailability_cause",
FT_UINT16, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_user_identity,
{ "User Identity", "m3ua.user_identity",
FT_UINT16, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_reason,
{ "Reason", "m3ua.reason",
FT_UINT32, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_traffic_mode_type,
{ "Traffic mode Type", "m3ua.traffic_mode_type",
FT_UINT32, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_routing_context,
{ "Routing context", "m3ua.routing_context",
FT_UINT32, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_mask,
{ "Mask", "m3ua.mask",
FT_UINT8, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_dpc,
{ "Affected DPC", "m3ua.affected_dpc",
FT_UINT24, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
{ &hf_m3ua_congestion_level,
{ "Congestion level", "m3ua.congestion_level",
FT_UINT8, BASE_DEC, NULL, 0x0,
- ""}
+ "", HFILL }
},
};
void
proto_reg_handoff_m3ua(void)
{
+ /*
+ * Get a handle for the MTP3 dissector.
+ */
+ mtp3_handle = find_dissector("mtp3");
+
dissector_add("sctp.ppi", M3UA_PAYLOAD_PROTO_ID, dissect_m3ua, proto_m3ua);
dissector_add("sctp.port", SCTP_PORT_M3UA, dissect_m3ua, proto_m3ua);
}