aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2010-06-04 12:14:18 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2010-06-04 12:14:18 +0000
commit946f225f9c3f736d7b9fede90abea59991cde53c (patch)
tree2eb9b02cd9d94067337729d261b72de274989418
parent525deb3f70a2eb9946aff36fa9049a162677d62d (diff)
downloadwireshark-946f225f9c3f736d7b9fede90abea59991cde53c.tar.gz
wireshark-946f225f9c3f736d7b9fede90abea59991cde53c.tar.bz2
wireshark-946f225f9c3f736d7b9fede90abea59991cde53c.zip
From Holger Freyther via bug 4841:
Add a new dissector for the NexusWare C7 MTP over UDP/TCP protocol. One of NexusWare's example applications provide a way to forward MTP Level 3 messages via UDP/TCP. This is a dissector for this protocol (which is lacking an IANA assigned port). svn path=/trunk/; revision=33082
-rw-r--r--AUTHORS4
-rw-r--r--epan/CMakeLists.txt1
-rw-r--r--epan/dissectors/Makefile.common1
-rw-r--r--epan/dissectors/packet-nwmtp.c156
4 files changed, 162 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index 515226c629..59aa1325ab 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -3078,6 +3078,10 @@ Michael Bernhard <michael.bernhard [AT] bfh.ch> {
IEC 61850 dissector
}
+Holger Freyther <zecke [AT] selfish.org> {
+ NexusWare C7 MTP over UDP dissector
+}
+
and by:
Pavel Roskin <proski [AT] gnu.org>
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt
index 3170cda278..1110a2a225 100644
--- a/epan/CMakeLists.txt
+++ b/epan/CMakeLists.txt
@@ -791,6 +791,7 @@ set(DISSECTOR_SRC
dissectors/packet-ntlmssp.c
dissectors/packet-ntp.c
dissectors/packet-null.c
+ dissectors/packet-nwmtp.c
dissectors/packet-oicq.c
dissectors/packet-olsr.c
dissectors/packet-omapi.c
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common
index b18f42e1af..fe07804221 100644
--- a/epan/dissectors/Makefile.common
+++ b/epan/dissectors/Makefile.common
@@ -688,6 +688,7 @@ DISSECTOR_SRC = \
packet-netsync.c \
packet-nettl.c \
packet-newmail.c \
+ packet-nwmtp.c \
packet-nfs.c \
packet-nfsacl.c \
packet-nfsauth.c \
diff --git a/epan/dissectors/packet-nwmtp.c b/epan/dissectors/packet-nwmtp.c
new file mode 100644
index 0000000000..0093462362
--- /dev/null
+++ b/epan/dissectors/packet-nwmtp.c
@@ -0,0 +1,156 @@
+/* packet-nwmtp.c
+ * Routines for NexusWare MTP3 over UDP transport
+ * Copyright 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * Copyright 2010 by On-Waves
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <glib.h>
+
+#include <epan/packet.h>
+
+
+static dissector_handle_t mtp_handle;
+static gint proto_nwmtp = -1;
+
+static int hf_nwmtp_transp_type = -1;
+static int hf_nwmtp_user_context = -1;
+static int hf_nwmtp_data_type = -1;
+static int hf_nwmtp_data_index = -1;
+static int hf_nwmtp_data_length = -1;
+
+/* subtree pointer */
+static gint ett_mwmtp = -1;
+
+static const value_string nwmtp_transport_type_vals[] = {
+ { 2, "UDP" },
+ { 3, "TCP" },
+ { 0, NULL },
+};
+
+static const value_string nwmtp_data_type_vals[] = {
+ { 0, "MSU Prio 0" },
+ { 1, "MSU Prio 1" },
+ { 2, "MSU Prio 2" },
+ { 3, "MSU Prio 3" },
+ {16, "Retrieved MSU Prio 0" },
+ {17, "Retrieved MSU Prio 0" },
+ {18, "Retrieved MSU Prio 0" },
+ {32, "Retrieval complete" },
+ {33, "Retrieval impossible" },
+ { 0, NULL },
+};
+
+static void dissect_nwmtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ int offset = 0;
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "NW MTP");
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ proto_item *ti;
+ proto_item *nwmtp_tree;
+ guint32 len;
+ tvbuff_t *next_tvb;
+
+ len = tvb_get_ntohl(tvb, offset + 8);
+
+ if (tree) {
+ ti = proto_tree_add_protocol_format(tree, proto_nwmtp,
+ tvb, offset, len + 12,
+ "NexusWare C7 UDP Protocol");
+
+ nwmtp_tree = proto_item_add_subtree(ti, ett_mwmtp);
+ proto_tree_add_item(nwmtp_tree, hf_nwmtp_transp_type,
+ tvb, offset, 1, FALSE);
+ proto_tree_add_item(nwmtp_tree, hf_nwmtp_data_type,
+ tvb, offset + 1, 1, FALSE);
+ proto_tree_add_item(nwmtp_tree, hf_nwmtp_data_index,
+ tvb, offset + 2, 2, FALSE);
+ proto_tree_add_item(nwmtp_tree, hf_nwmtp_user_context,
+ tvb, offset + 4, 4, FALSE);
+ proto_tree_add_item(nwmtp_tree, hf_nwmtp_data_length,
+ tvb, offset + 8, 4, FALSE);
+ }
+
+ next_tvb = tvb_new_subset(tvb, offset + 12, len, len);
+ call_dissector(mtp_handle, next_tvb, pinfo, tree);
+ offset += len + 12;
+ }
+}
+
+void proto_register_mwmtp(void)
+{
+ static hf_register_info hf[] = {
+ {&hf_nwmtp_transp_type,
+ {"Transport Type", "nwmtp.transp_type",
+ FT_UINT8, BASE_DEC, VALS(nwmtp_transport_type_vals), 0x0,
+ "The Transport Type", HFILL}
+ },
+ {&hf_nwmtp_data_type,
+ {"Data Type", "nwmtp.data_type",
+ FT_UINT8, BASE_DEC, VALS(nwmtp_data_type_vals), 0x0,
+ "The Data Type", HFILL}
+ },
+ {&hf_nwmtp_data_index,
+ {"Link Index", "nwmtp.link_index",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ "Link Index", HFILL}
+ },
+ {&hf_nwmtp_user_context,
+ {"User Context", "nwmtp.user_context",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ "Use Context", HFILL}
+ },
+ {&hf_nwmtp_data_length,
+ {"Length", "nwmtp.data_length",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ "Data Length", HFILL}
+ },
+ };
+
+ static gint *ett[] = {
+ &ett_mwmtp,
+ };
+
+ proto_nwmtp =
+ proto_register_protocol("NexusWare C7 MTP", "MTP over NW UDP", "nw_mtp");
+
+ proto_register_field_array(proto_nwmtp, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+ register_dissector("nw_mtp", dissect_nwmtp, proto_nwmtp);
+}
+
+void proto_reg_handoff_nwmtp(void)
+{
+ dissector_handle_t nwmtp_handle;
+
+ nwmtp_handle = create_dissector_handle(dissect_nwmtp, proto_nwmtp);
+ /* For decode as */
+ dissector_add_handle("udp.port", nwmtp_handle);
+ mtp_handle = find_dissector("mtp3");
+}