aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mgcp
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2006-02-14 14:51:18 +0000
committerJörg Mayer <jmayer@loplof.de>2006-02-14 14:51:18 +0000
commite10101b7741a7a3773bf0233baf0e2ae2f441c31 (patch)
treec9c6df176a51d1122276e17d46c1c3ba8e3507d8 /plugins/mgcp
parente35eef9c0ac5445a6e80682f53e8a05c2e49953a (diff)
Experiment with a somewhat generic packet-to-plugin wrapper
svn path=/trunk/; revision=17300
Diffstat (limited to 'plugins/mgcp')
-rw-r--r--plugins/mgcp/Makefile.am6
-rw-r--r--plugins/mgcp/Makefile.nmake2
-rw-r--r--plugins/mgcp/moduleinfo.h17
-rw-r--r--plugins/mgcp/packet-mgcp.c33
-rw-r--r--plugins/mgcp/packet-mgcp.h3
-rw-r--r--plugins/mgcp/plugin-mgcp.c59
6 files changed, 68 insertions, 52 deletions
diff --git a/plugins/mgcp/Makefile.am b/plugins/mgcp/Makefile.am
index ebbff9cd71..ec1e3bf4ee 100644
--- a/plugins/mgcp/Makefile.am
+++ b/plugins/mgcp/Makefile.am
@@ -27,7 +27,11 @@ INCLUDES = -I$(top_srcdir)
plugindir = @plugindir@
plugin_LTLIBRARIES = mgcp.la
-mgcp_la_SOURCES = packet-mgcp.c packet-mgcp.h moduleinfo.h
+mgcp_la_SOURCES = \
+ packet-mgcp.c \
+ packet-mgcp.h \
+ plugin-mgcp.c
+
mgcp_la_LDFLAGS = -module -avoid-version
mgcp_la_LIBADD = @PLUGIN_LIBS@
diff --git a/plugins/mgcp/Makefile.nmake b/plugins/mgcp/Makefile.nmake
index 4a7a74ef48..3502ce46e7 100644
--- a/plugins/mgcp/Makefile.nmake
+++ b/plugins/mgcp/Makefile.nmake
@@ -15,7 +15,7 @@ LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
-OBJECTS=packet-mgcp.obj
+OBJECTS=packet-mgcp.obj mgcp-plugin.obj
mgcp.dll mgcp.exp mgcp.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
link -dll /out:mgcp.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
diff --git a/plugins/mgcp/moduleinfo.h b/plugins/mgcp/moduleinfo.h
deleted file mode 100644
index b026e28341..0000000000
--- a/plugins/mgcp/moduleinfo.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Included *after* config.h, in order to re-define these macros */
-
-#ifdef PACKAGE
-#undef PACKAGE
-#endif
-
-/* Name of package */
-#define PACKAGE "mgcp"
-
-
-#ifdef VERSION
-#undef VERSION
-#endif
-
-/* Version number of package */
-#define VERSION "0.0.10"
-
diff --git a/plugins/mgcp/packet-mgcp.c b/plugins/mgcp/packet-mgcp.c
index 12df9ecda9..9d478eea2e 100644
--- a/plugins/mgcp/packet-mgcp.c
+++ b/plugins/mgcp/packet-mgcp.c
@@ -37,9 +37,6 @@
#include "config.h"
#endif
-#include "moduleinfo.h"
-
-#include <gmodule.h>
#include <ctype.h>
#include <string.h>
#include <epan/packet.h>
@@ -50,17 +47,11 @@
#include <epan/tap.h>
#include "packet-mgcp.h"
-#ifndef ENABLE_STATIC
-G_MODULE_EXPORT const gchar version[] = VERSION;
-#endif
-
#define TCP_PORT_MGCP_GATEWAY 2427
#define UDP_PORT_MGCP_GATEWAY 2427
#define TCP_PORT_MGCP_CALLAGENT 2727
#define UDP_PORT_MGCP_CALLAGENT 2727
-void proto_reg_handoff_mgcp(void);
-
/* Define the mgcp proto */
static int proto_mgcp = -1;
@@ -2250,27 +2241,3 @@ static gint tvb_find_dot_line(tvbuff_t* tvb, gint offset, gint len, gint* next_o
return tvb_current_len;
}
-/* Start the functions we need for the plugin stuff */
-
-#ifndef ENABLE_STATIC
-
-G_MODULE_EXPORT void
-plugin_register(void)
-{
- /* Register the new protocol, protocol fields, and subtrees */
- if (proto_mgcp == -1)
- {
- /* Execute protocol initialization only once */
- proto_register_mgcp();
- }
-}
-
-G_MODULE_EXPORT void
-plugin_reg_handoff(void)
-{
- proto_reg_handoff_mgcp();
-}
-
-#endif
-
-/* End the functions we need for plugin stuff */
diff --git a/plugins/mgcp/packet-mgcp.h b/plugins/mgcp/packet-mgcp.h
index b98b06a7a6..e01adce9ac 100644
--- a/plugins/mgcp/packet-mgcp.h
+++ b/plugins/mgcp/packet-mgcp.h
@@ -62,3 +62,6 @@ typedef struct _mgcp_call_t
gboolean responded;
} mgcp_call_t;
+void proto_register_mgcp(void);
+void proto_reg_handoff_mgcp(void);
+
diff --git a/plugins/mgcp/plugin-mgcp.c b/plugins/mgcp/plugin-mgcp.c
new file mode 100644
index 0000000000..641642932f
--- /dev/null
+++ b/plugins/mgcp/plugin-mgcp.c
@@ -0,0 +1,59 @@
+/* $Id$
+ *
+ * Module wrapper: Turn a normal dissector into a plugin
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifndef ENABLE_STATIC
+
+#ifdef PACKAGE
+# undef PACKAGE
+#endif
+#ifdef VERSION
+# undef VERSION
+#endif
+
+/* Name of plugin */
+#define PACKAGE "mgcp"
+/* Version number of package */
+#define VERSION "0.0.10"
+
+#include <gmodule.h>
+#include <glib.h>
+#include <epan/nstime.h>
+
+#include "packet-mgcp.h"
+
+G_MODULE_EXPORT const gchar version[] = VERSION;
+
+G_MODULE_EXPORT void plugin_register(void)
+{
+ /* register the new protocol, protocol fields, and subtrees */
+ proto_register_mgcp();
+}
+
+G_MODULE_EXPORT void plugin_reg_handoff(void){
+ proto_reg_handoff_mgcp();
+}
+#endif /* ENABLE_STATIC */