aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/rudp
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-03-25 11:21:07 +0000
committerGuy Harris <guy@alum.mit.edu>2004-03-25 11:21:07 +0000
commita1467c86e11071c4bd0eb71133684434f48cf094 (patch)
tree5e3c4e04a24380aac59d752a21708a2afa46a051 /plugins/rudp
parenta6ed2d499af391480d9853833e22f153c502dc4b (diff)
From Duncan Sargeant: Cisco SS7 RUDP, RLM, and Session Management
support. svn path=/trunk/; revision=10480
Diffstat (limited to 'plugins/rudp')
-rw-r--r--plugins/rudp/Makefile.am44
-rw-r--r--plugins/rudp/Makefile.nmake21
-rw-r--r--plugins/rudp/moduleinfo.h16
-rw-r--r--plugins/rudp/packet-rudp.c231
4 files changed, 312 insertions, 0 deletions
diff --git a/plugins/rudp/Makefile.am b/plugins/rudp/Makefile.am
new file mode 100644
index 0000000000..b681bf0eb5
--- /dev/null
+++ b/plugins/rudp/Makefile.am
@@ -0,0 +1,44 @@
+# Makefile.am
+# Automake file for Cisco SS7 Reliable UDP dissector
+# Copyright 2004, Duncan Sargeant <dunc-ethereal@rcpt.to>
+#
+# $Id: Makefile.am,v 1.1 2004/03/25 11:21:07 guy Exp $
+#
+# Ethereal - Network traffic analyzer
+# By Gerald Combs <gerald@ethereal.com>
+# 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.
+#
+
+INCLUDES = -I$(top_srcdir)
+
+plugindir = @plugindir@
+
+plugin_LTLIBRARIES = rudp.la
+rudp_la_SOURCES = packet-rudp.c moduleinfo.h
+rudp_la_LDFLAGS = -module -avoid-version
+
+# Libs must be cleared, or else libtool won't create a shared module.
+# If your module needs to be linked against any particular libraries,
+# add them here.
+LIBS =
+
+CLEANFILES = \
+ rudp \
+ *~
+
+EXTRA_DIST = \
+ Makefile.nmake
diff --git a/plugins/rudp/Makefile.nmake b/plugins/rudp/Makefile.nmake
new file mode 100644
index 0000000000..aefe44ab37
--- /dev/null
+++ b/plugins/rudp/Makefile.nmake
@@ -0,0 +1,21 @@
+#
+# $Id: Makefile.nmake,v 1.1 2004/03/25 11:21:07 guy Exp $
+#
+
+include ..\..\config.nmake
+
+############### no need to modify below this line #########
+
+CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
+ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
+
+OBJECTS=packet-rudp.obj
+
+rudp.dll rudp.exp rudp.lib : $(OBJECTS) ..\plugin_api.obj
+ link -dll /out:rudp.dll $(OBJECTS) ..\plugin_api.obj \
+ $(GLIB_LIBS)
+
+clean:
+ rm -f $(OBJECTS) rudp.dll rudp.exp rudp.lib $(PDB_FILE)
+
+distclean: clean
diff --git a/plugins/rudp/moduleinfo.h b/plugins/rudp/moduleinfo.h
new file mode 100644
index 0000000000..23edc6ef5d
--- /dev/null
+++ b/plugins/rudp/moduleinfo.h
@@ -0,0 +1,16 @@
+/* Included *after* config.h, in order to re-define these macros */
+
+#ifdef PACKAGE
+#undef PACKAGE
+#endif
+
+/* Name of package */
+#define PACKAGE "rudp"
+
+
+#ifdef VERSION
+#undef VERSION
+#endif
+
+/* Version number of package */
+#define VERSION "0.0.1"
diff --git a/plugins/rudp/packet-rudp.c b/plugins/rudp/packet-rudp.c
new file mode 100644
index 0000000000..c3fb4815de
--- /dev/null
+++ b/plugins/rudp/packet-rudp.c
@@ -0,0 +1,231 @@
+/* packet-rudp.c
+ * Routines for Reliable UDP Protocol.
+ * Copyright 2004, Duncan Sargeant <dunc-ethereal@rcpt.to>
+ *
+ * $Id: packet-rudp.c,v 1.1 2004/03/25 11:21:07 guy Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@ethereal.com>
+ * Copyright 1998 Gerald Combs
+ *
+ * Copied from packet-data.c, README.developer, and various other files.
+ *
+ * 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.
+
+
+ * Reliable UDP is a lightweight protocol for providing TCP-like flow
+ * control over UDP. Cisco published an PFC a long time ago, and
+ * their actual implementation is slightly different, having no
+ * checksum field.
+ *
+ * I've cheated here - RUDP could be used for anything, but I've only
+ * seen it used to switched telephony calls, so we just call the Cisco SM
+ * dissector from here.
+ *
+ * Here are some links:
+ *
+ * http://www.watersprings.org/pub/id/draft-ietf-sigtran-reliable-udp-00.txt
+ * http://www.javvin.com/protocolRUDP.html
+ * http://www.cisco.com/univercd/cc/td/doc/product/access/sc/rel7/omts/omts_apb.htm#30052
+
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <gmodule.h>
+#include <epan/packet.h>
+
+#include "plugins/plugin_api.h"
+#include "plugins/plugin_api_defs.h"
+ /* Define version if we are not building ethereal statically */
+
+#ifndef ENABLE_STATIC
+ G_MODULE_EXPORT const gchar version[] = VERSION;
+#endif
+
+static int proto_rudp = -1;
+
+static int hf_rudp_flags = -1;
+static int hf_rudp_flags_syn = -1;
+static int hf_rudp_flags_ack = -1;
+static int hf_rudp_flags_eak = -1;
+static int hf_rudp_flags_rst = -1;
+static int hf_rudp_flags_nul = -1;
+static int hf_rudp_flags_chk = -1;
+static int hf_rudp_flags_tcs = -1;
+static int hf_rudp_flags_0 = -1;
+static int hf_rudp_hlen = -1;
+static int hf_rudp_seq = -1;
+static int hf_rudp_ack = -1;
+/* static int hf_rudp_cksum = -1; */
+
+static gint ett_rudp = -1;
+static gint ett_rudp_flags = -1;
+
+
+static void
+dissect_rudp(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
+{
+ tvbuff_t * next_tvb = NULL;
+ proto_tree *rudp_tree = NULL, *flags_tree;
+ proto_item *ti = NULL;
+ int flags[] = { hf_rudp_flags_syn, hf_rudp_flags_ack, hf_rudp_flags_eak,
+ hf_rudp_flags_rst, hf_rudp_flags_nul, hf_rudp_flags_chk,
+ hf_rudp_flags_tcs, hf_rudp_flags_0 };
+ int i;
+ guint8 hlen;
+
+ hlen = tvb_get_guint8(tvb, 1);
+
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "RUDP");
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_rudp, tvb, 0, hlen, FALSE);
+ rudp_tree = proto_item_add_subtree(ti, ett_rudp);
+
+ ti = proto_tree_add_item(rudp_tree, hf_rudp_flags, tvb, 0, 1, FALSE);
+ flags_tree = proto_item_add_subtree(ti, ett_rudp_flags);
+
+ for (i = 0; i < 8; i++)
+ proto_tree_add_item(flags_tree, flags[i], tvb, 0, 1, FALSE);
+
+ proto_tree_add_item(rudp_tree, hf_rudp_hlen, tvb, 1, 1, FALSE);
+ proto_tree_add_item(rudp_tree, hf_rudp_seq, tvb, 2, 1, FALSE);
+ proto_tree_add_item(rudp_tree, hf_rudp_ack, tvb, 3, 1, FALSE);
+ }
+
+ next_tvb = tvb_new_subset(tvb, hlen, -1, -1);
+ if (tvb_length(next_tvb) && find_dissector("sm"))
+ call_dissector(find_dissector("sm"), next_tvb, pinfo, tree);
+}
+
+G_MODULE_EXPORT void
+plugin_init(plugin_address_table_t *pat
+#ifndef PLUGINS_NEED_ADDRESS_TABLE
+_U_
+#endif
+)
+{
+
+ static hf_register_info hf[] = {
+ { &hf_rudp_flags,
+ { "RUDP Header flags", "rudp.flags",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "" }
+ },
+ { &hf_rudp_flags_syn,
+ { "Syn", "rudp.flags.syn",
+ FT_BOOLEAN, 8, NULL, 0x80,
+ "" }
+ },
+ { &hf_rudp_flags_ack,
+ { "Ack", "rudp.flags.ack",
+ FT_BOOLEAN, 8, NULL, 0x40,
+ "" }
+ },
+ { &hf_rudp_flags_eak,
+ { "Eak", "rudp.flags.eak",
+ FT_BOOLEAN, 8, NULL, 0x20,
+ "Extended Ack" }
+ },
+ { &hf_rudp_flags_rst,
+ { "RST", "rudp.flags.rst",
+ FT_BOOLEAN, 8, NULL, 0x10,
+ "Reset flag" }
+ },
+ { &hf_rudp_flags_nul,
+ { "NULL", "rudp.flags.nul",
+ FT_BOOLEAN, 8, NULL, 0x08,
+ "Null flag" }
+ },
+ { &hf_rudp_flags_chk,
+ { "CHK", "rudp.flags.chk",
+ FT_BOOLEAN, 8, NULL, 0x04,
+ "Checksum is on header or body" }
+ },
+ { &hf_rudp_flags_tcs,
+ { "TCS", "rudp.flags.tcs",
+ FT_BOOLEAN, 8, NULL, 0x02,
+ "Transfer Connection System" }
+ },
+ { &hf_rudp_flags_0,
+ { "0", "rudp.flags.0",
+ FT_BOOLEAN, 8, NULL, 0x01,
+ "" }
+ },
+ { &hf_rudp_hlen,
+ { "Header Length", "rudp.hlen",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "" }
+ },
+ { &hf_rudp_seq,
+ { "Seq", "rudp.seq",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "Sequence Number" }
+ },
+ { &hf_rudp_ack,
+ { "Ack", "rudp.ack",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ "Acknowledgement Number" }
+ },
+ /*
+
+ A checksum is specified in the RFC, but Cisco don't use one.
+
+ { &hf_rudp_cksum,
+ { "Checksum", "rudp.cksum",
+ FT_UINT16, 8, NULL, 0x0,
+ "" }
+ },
+ */
+ };
+
+
+/* Setup protocol subtree array */
+ static gint *ett[] = {
+ &ett_rudp,
+ &ett_rudp_flags,
+ };
+
+
+ if (proto_rudp == -1) {
+ proto_rudp = proto_register_protocol (
+ "Reliable UDP", /* name */
+ "RUDP", /* short name */
+ "rudp" /* abbrev */
+ );
+ }
+
+ plugin_address_table_init(pat);
+
+ proto_register_field_array(proto_rudp, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+}
+
+G_MODULE_EXPORT void
+plugin_reg_handoff(void) {
+ static dissector_handle_t rudp_handle = NULL;
+
+ if (!rudp_handle) {
+ rudp_handle = create_dissector_handle(dissect_rudp, proto_rudp);
+ }
+
+ dissector_add("udp.port", 7000, rudp_handle);
+}