diff options
author | Guy Harris <guy@alum.mit.edu> | 2006-04-22 20:26:16 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2006-04-22 20:26:16 +0000 |
commit | 51996714412f966065f1d53504680035d9924c64 (patch) | |
tree | 8f213a0cf3c74ecdae8926dd76b6826363541a3a | |
parent | ec5efe737034e83e668edcbc22a22148860cf449 (diff) |
Convert most other plugin dissectors to use the make-dissector-reg
scripts.
svn path=/trunk/; revision=17961
85 files changed, 3215 insertions, 909 deletions
diff --git a/plugins/acn/Makefile.am b/plugins/acn/Makefile.am index 09f5188b33..f088a1b0be 100644 --- a/plugins/acn/Makefile.am +++ b/plugins/acn/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/ACN +# Automake file for ACN plugin # # $Id$ # @@ -22,12 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = acn.la -acn_la_SOURCES = packet-acn.c moduleinfo.h acn.h +acn_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) acn_la_LDFLAGS = -module -avoid-version acn_la_LIBADD = @PLUGIN_LIBS@ @@ -36,6 +42,69 @@ acn_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ acn \ *~ @@ -44,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/acn/Makefile.common b/plugins/acn/Makefile.common new file mode 100644 index 0000000000..3c2c446a5b --- /dev/null +++ b/plugins/acn/Makefile.common @@ -0,0 +1,35 @@ +# Makefile.common for ACN plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = acn + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-acn.c + +# corresponding headers +DISSECTOR_INCLUDES = \ + acn.h diff --git a/plugins/acn/Makefile.nmake b/plugins/acn/Makefile.nmake index 00b0f38be9..58b4cc3ab4 100644 --- a/plugins/acn/Makefile.nmake +++ b/plugins/acn/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for ACN plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-acn.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -acn.dll acn.exp acn.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:acn.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +acn.dll acn.exp acn.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:acn.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/acn/packet-acn.c b/plugins/acn/packet-acn.c index a68ff22bdd..c572affc52 100644 --- a/plugins/acn/packet-acn.c +++ b/plugins/acn/packet-acn.c @@ -30,8 +30,6 @@ #include "config.h" #endif -#include "moduleinfo.h" - #include <stdio.h> #include <stdlib.h> #include <ctype.h> @@ -39,7 +37,6 @@ #include <string.h> #include <glib.h> -#include <gmodule.h> #include <epan/packet.h> #include <epan/addr_resolv.h> @@ -48,12 +45,6 @@ #include "acn.h" -/* Define version if we are not building ethereal statically */ - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - /* * See * @@ -1192,26 +1183,3 @@ proto_reg_handoff_acn(void) { dissector_add("udp.port",global_udp_port_acn,acn_handle); } - -/* 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_acn == -1) { /* execute protocol initialization only once */ - proto_register_acn(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_acn(); -} - -#endif - -/* End the functions we need for plugin stuff */ - diff --git a/plugins/agentx/Makefile.am b/plugins/agentx/Makefile.am index a9f37009a0..b632b9f7e2 100644 --- a/plugins/agentx/Makefile.am +++ b/plugins/agentx/Makefile.am @@ -1,11 +1,11 @@ # Makefile.am -# Automake file for Ethereal/plugins/agentx +# Automake file for AgentX plugin # # $Id$ # -# Ethereal - Network traffic analyzer / AgentX SNMP -# By Oleg Terletsky <oleg.terletsky@comverse.com> -# Copyright 2003 +# 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 @@ -22,12 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = agentx.la -agentx_la_SOURCES = packet-agentx.c moduleinfo.h +agentx_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) agentx_la_LDFLAGS = -module -avoid-version agentx_la_LIBADD = @PLUGIN_LIBS@ @@ -36,6 +42,69 @@ agentx_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ agentx \ *~ @@ -44,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/agentx/Makefile.common b/plugins/agentx/Makefile.common new file mode 100644 index 0000000000..27d567ccff --- /dev/null +++ b/plugins/agentx/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for AgentX plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = agentx + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-agentx.c diff --git a/plugins/agentx/Makefile.nmake b/plugins/agentx/Makefile.nmake index 6d4b31e8f8..2d4ef3428f 100644 --- a/plugins/agentx/Makefile.nmake +++ b/plugins/agentx/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for AgentX plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-agentx.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -agentx.dll agentx.exp agentx.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:agentx.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +agentx.dll agentx.exp agentx.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:agentx.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/agentx/packet-agentx.c b/plugins/agentx/packet-agentx.c index e10a48204e..2700087de1 100644 --- a/plugins/agentx/packet-agentx.c +++ b/plugins/agentx/packet-agentx.c @@ -29,11 +29,8 @@ #include "config.h" #endif -#include "moduleinfo.h" - #include <stdio.h> #include <stdlib.h> -#include <gmodule.h> #include <ctype.h> #include <time.h> #include <string.h> @@ -48,11 +45,6 @@ static guint global_agentx_tcp_port = 705; static guint agentx_tcp_port = 705; -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - - void proto_reg_handoff_agentx(void); @@ -1121,25 +1113,3 @@ proto_reg_handoff_agentx(void) dissector_add("tcp.port", agentx_tcp_port, agentx_handle); } - -/* 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_agentx == -1) { /* execute protocol initialization only once */ - proto_register_agentx(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_agentx(); -} - -#endif - -/* End the functions we need for plugin stuff */ diff --git a/plugins/artnet/Makefile.am b/plugins/artnet/Makefile.am index 5307ebe2cc..eeae82c615 100644 --- a/plugins/artnet/Makefile.am +++ b/plugins/artnet/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/ArtNET +# Automake file for ArtNET plugin # # $Id$ # @@ -22,12 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = artnet.la -artnet_la_SOURCES = packet-artnet.c moduleinfo.h +artnet_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) artnet_la_LDFLAGS = -module -avoid-version artnet_la_LIBADD = @PLUGIN_LIBS@ @@ -36,6 +42,69 @@ artnet_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ artnet \ *~ @@ -44,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/artnet/Makefile.common b/plugins/artnet/Makefile.common new file mode 100644 index 0000000000..b4b40a8f44 --- /dev/null +++ b/plugins/artnet/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for ArtNET plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = artnet + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-artnet.c diff --git a/plugins/artnet/Makefile.nmake b/plugins/artnet/Makefile.nmake index 6fc03762ff..3559b9c232 100644 --- a/plugins/artnet/Makefile.nmake +++ b/plugins/artnet/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for ArtNET plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-artnet.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -artnet.dll artnet.exp artnet.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:artnet.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +artnet.dll artnet.exp artnet.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:artnet.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/artnet/packet-artnet.c b/plugins/artnet/packet-artnet.c index 058c02513a..3a7a4ec394 100644 --- a/plugins/artnet/packet-artnet.c +++ b/plugins/artnet/packet-artnet.c @@ -30,11 +30,8 @@ #include "config.h" #endif -#include "moduleinfo.h" - #include <stdio.h> #include <stdlib.h> -#include <gmodule.h> #include <ctype.h> #include <time.h> #include <string.h> @@ -43,12 +40,6 @@ #include <epan/prefs.h> #include <epan/strutil.h> -/* Define version if we are not building ethereal statically */ - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - /* * See * @@ -2716,26 +2707,3 @@ proto_reg_handoff_artnet(void) { dissector_add("udp.port",global_udp_port_artnet,artnet_handle); } - -/* 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_artnet == -1) { /* execute protocol initialization only once */ - proto_register_artnet(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_artnet(); -} - -#endif - -/* End the functions we need for plugin stuff */ - diff --git a/plugins/asn1/Makefile.am b/plugins/asn1/Makefile.am index acf26c42b8..c5f802c7df 100644 --- a/plugins/asn1/Makefile.am +++ b/plugins/asn1/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/asn1 +# Automake file for ASN.1 plugin # # $Id$ # @@ -22,25 +22,96 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = asn1.la -asn1_la_SOURCES = packet-asn1.c moduleinfo.h +asn1_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) asn1_la_LDFLAGS = -module -avoid-version asn1_la_LIBADD = @PLUGIN_LIBS@ # 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 = $(GLIB_LIBS) +LIBS = + +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c CLEANFILES = \ - asn1 \ + asn1 \ *~ MAINTAINERCLEANFILES = \ Makefile.in -EXTRA_DIST = Makefile.nmake +EXTRA_DIST = \ + Makefile.common \ + Makefile.nmake diff --git a/plugins/asn1/Makefile.common b/plugins/asn1/Makefile.common new file mode 100644 index 0000000000..38e08cee00 --- /dev/null +++ b/plugins/asn1/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for ASN.1 plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = asn1 + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-asn1.c diff --git a/plugins/asn1/Makefile.nmake b/plugins/asn1/Makefile.nmake index d1ea5f513b..5cfcc8957b 100644 --- a/plugins/asn1/Makefile.nmake +++ b/plugins/asn1/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for ASN.1 plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-asn1.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -asn1.dll asn1.exp asn1.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:asn1.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +asn1.dll asn1.exp asn1.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:asn1.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/asn1/packet-asn1.c b/plugins/asn1/packet-asn1.c index 021417ea3d..bc9fd1d1dd 100644 --- a/plugins/asn1/packet-asn1.c +++ b/plugins/asn1/packet-asn1.c @@ -67,14 +67,13 @@ #include <sys/stat.h> #include <errno.h> -#include "moduleinfo.h" - #include <stdio.h> #include <stdlib.h> -#include <gmodule.h> #include <ctype.h> #include <time.h> #include <string.h> + +#include <glib.h> #include <epan/packet.h> #include <epan/addr_resolv.h> #include <epan/prefs.h> @@ -92,12 +91,6 @@ #include <epan/ipproto.h> -/* Define version if we are not building ethereal statically */ - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - /* buffer lengths */ #define BUFLS 32 #define BUFLM 64 @@ -5106,25 +5099,3 @@ proto_reg_handoff_asn1(void) { } #endif /* JUST_ONE_PORT */ } - -/* 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_asn1 == -1) { /* execute protocol initialization only once */ - proto_register_asn1(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_asn1(); -} - -#endif - -/* End the functions we need for plugin stuff */ diff --git a/plugins/ciscosm/Makefile.am b/plugins/ciscosm/Makefile.am index 47f756ada5..110d689306 100644 --- a/plugins/ciscosm/Makefile.am +++ b/plugins/ciscosm/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Cisco SS7 Session Management dissector +# Automake file for Cisco SS7 Session Management plugin # Copyright 2004, Duncan Sargeant <dunc-ethereal@rcpt.to> # # $Id$ @@ -23,12 +23,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = ciscosm.la -ciscosm_la_SOURCES = packet-sm.c moduleinfo.h +ciscosm_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) ciscosm_la_LDFLAGS = -module -avoid-version ciscosm_la_LIBADD = @PLUGIN_LIBS@ @@ -37,6 +43,69 @@ ciscosm_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ ciscosm \ *~ @@ -45,4 +114,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/ciscosm/Makefile.common b/plugins/ciscosm/Makefile.common new file mode 100644 index 0000000000..3db4adbb53 --- /dev/null +++ b/plugins/ciscosm/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for Cisco SS7 Session Management plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = ciscosm + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-sm.c diff --git a/plugins/ciscosm/Makefile.nmake b/plugins/ciscosm/Makefile.nmake index 922d3bbeb7..8ee9dd8e86 100644 --- a/plugins/ciscosm/Makefile.nmake +++ b/plugins/ciscosm/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for Cisco SS7 Session Management plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-sm.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -ciscosm.dll ciscosm.exp ciscosm.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:ciscosm.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +ciscosm.dll ciscosm.exp ciscosm.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:ciscosm.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/ciscosm/packet-sm.c b/plugins/ciscosm/packet-sm.c index 6dc593729e..977d410548 100644 --- a/plugins/ciscosm/packet-sm.c +++ b/plugins/ciscosm/packet-sm.c @@ -53,18 +53,8 @@ #include <stdlib.h> #include <string.h> -#include <gmodule.h> #include <epan/packet.h> -/* Define version if we are not building ethereal statically */ - -#include "moduleinfo.h" - -#ifndef ENABLE_STATIC - G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - - #define MESSAGE_TYPE_START 0 #define MESSAGE_TYPE_STOP 1 #define MESSAGE_TYPE_ACTIVE 2 @@ -241,29 +231,3 @@ proto_register_sm(void) proto_register_field_array(proto_sm, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } - -void -plugin_reg_handoff_sm(void) -{ - return; -} - -#ifndef ENABLE_STATIC - -G_MODULE_EXPORT void -plugin_register(void) -{ - /* register the new protocol, protocol fields, and subtrees */ - if (proto_sm == -1) { /* execute protocol initialization only once */ - proto_register_sm(); - } - -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void) -{ - plugin_reg_handoff_sm(); -} - -#endif diff --git a/plugins/docsis/Makefile.am b/plugins/docsis/Makefile.am index 46cc8355a2..863213d152 100644 --- a/plugins/docsis/Makefile.am +++ b/plugins/docsis/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/docsis subdissectors +# Automake file for DOCSIS plugin # # $Id$ # diff --git a/plugins/docsis/Makefile.common b/plugins/docsis/Makefile.common index 50e4723d7f..28cff17603 100644 --- a/plugins/docsis/Makefile.common +++ b/plugins/docsis/Makefile.common @@ -1,4 +1,4 @@ -# Makefile.common for Ethereal/docsis subdissectors +# Makefile.common for DOCSIS plugin # Contains the stuff from Makefile.am and Makefile.nmake that is # a) common to both files and # b) portable between both files @@ -28,40 +28,38 @@ PLUGIN_NAME = docsis # the dissector sources (without any helpers) DISSECTOR_SRC = \ + packet-bpkmattr.c \ + packet-bpkmreq.c \ + packet-bpkmrsp.c \ packet-intrngreq.c \ - packet-type29ucd.c \ + packet-dccack.c \ + packet-dccreq.c \ + packet-dccrsp.c \ + packet-dcd.c \ packet-docsis.c \ - packet-bpkmattr.c \ + packet-dsaack.c \ + packet-dsareq.c \ packet-dsarsp.c \ - packet-macmgmt.c \ - packet-rngrsp.c \ - packet-bpkmreq.c \ packet-dscack.c \ - packet-map.c \ - packet-tlv.c \ - packet-bpkmrsp.c \ packet-dscreq.c \ - packet-regack.c \ - packet-uccreq.c \ packet-dscrsp.c \ - packet-regreq.c \ - packet-uccrsp.c \ - packet-dsaack.c \ packet-dsdreq.c \ - packet-regrsp.c \ - packet-ucd.c \ - packet-dsareq.c \ packet-dsdrsp.c \ + packet-macmgmt.c \ + packet-map.c \ + packet-regack.c \ + packet-regreq.c \ + packet-regrsp.c \ packet-rngreq.c \ - packet-vendor.c \ - packet-dccack.c \ - packet-dccreq.c \ - packet-dccrsp.c \ - packet-dcd.c + packet-rngrsp.c \ + packet-tlv.c \ + packet-type29ucd.c \ + packet-uccreq.c \ + packet-uccrsp.c \ + packet-ucd.c \ + packet-vendor.c # corresponding headers DISSECTOR_INCLUDES = \ packet-docsis.h \ packet-tlv.h - - diff --git a/plugins/docsis/Makefile.nmake b/plugins/docsis/Makefile.nmake index 383dbf300d..121e9d277c 100644 --- a/plugins/docsis/Makefile.nmake +++ b/plugins/docsis/Makefile.nmake @@ -1,5 +1,5 @@ # Makefile.nmake -# nmake file for for Ethereal/docsis subdissectors +# nmake file for DOCSIS plugin # # $Id$ # diff --git a/plugins/enttec/Makefile.am b/plugins/enttec/Makefile.am index 5ee8c345d5..f2d5a9094f 100644 --- a/plugins/enttec/Makefile.am +++ b/plugins/enttec/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/ENTTEC +# Automake file for ENTTEC plugin # # $Id$ # @@ -22,12 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = enttec.la -enttec_la_SOURCES = packet-enttec.c moduleinfo.h +enttec_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) enttec_la_LDFLAGS = -module -avoid-version enttec_la_LIBADD = @PLUGIN_LIBS@ @@ -36,6 +42,69 @@ enttec_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ enttec \ *~ @@ -44,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/enttec/Makefile.common b/plugins/enttec/Makefile.common new file mode 100644 index 0000000000..98203ecd4e --- /dev/null +++ b/plugins/enttec/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for ENTTEC plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = enttec + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-enttec.c diff --git a/plugins/enttec/Makefile.nmake b/plugins/enttec/Makefile.nmake index 19032e1e2a..ab9421e0dd 100644 --- a/plugins/enttec/Makefile.nmake +++ b/plugins/enttec/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for ENTTEC plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-enttec.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -enttec.dll enttec.exp enttec.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:enttec.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +enttec.dll enttec.exp enttec.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:enttec.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/enttec/packet-enttec.c b/plugins/enttec/packet-enttec.c index 84799bcfea..86d66ad28e 100644 --- a/plugins/enttec/packet-enttec.c +++ b/plugins/enttec/packet-enttec.c @@ -30,11 +30,8 @@ #include "config.h" #endif -#include "moduleinfo.h" - #include <stdio.h> #include <stdlib.h> -#include <gmodule.h> #include <ctype.h> #include <time.h> #include <string.h> @@ -43,12 +40,6 @@ #include <epan/prefs.h> #include <epan/strutil.h> -/* Define version if we are not building ethereal statically */ - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - /* * See * @@ -581,26 +572,3 @@ proto_reg_handoff_enttec(void) { dissector_add("udp.port",global_udp_port_enttec,enttec_handle); dissector_add("tcp.port",global_tcp_port_enttec,enttec_handle); } - -/* 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_enttec == -1) { /* execute protocol initialization only once */ - proto_register_enttec(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_enttec(); -} - -#endif - -/* End the functions we need for plugin stuff */ - diff --git a/plugins/gryphon/Makefile.am b/plugins/gryphon/Makefile.am index 10e893f113..dacd3125b9 100644 --- a/plugins/gryphon/Makefile.am +++ b/plugins/gryphon/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/Gryphon +# Automake file for Gryphon plugin # By Steve Limkemann <stevelim@dgtech.com> # Copyright 1998 Steve Limkemann # @@ -24,12 +24,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = gryphon.la -gryphon_la_SOURCES = packet-gryphon.c packet-gryphon.h moduleinfo.h +gryphon_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) gryphon_la_LDFLAGS = -module -avoid-version gryphon_la_LIBADD = @PLUGIN_LIBS@ @@ -38,6 +44,69 @@ gryphon_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ gryphon \ *~ @@ -46,4 +115,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/gryphon/Makefile.common b/plugins/gryphon/Makefile.common new file mode 100644 index 0000000000..0ed9798987 --- /dev/null +++ b/plugins/gryphon/Makefile.common @@ -0,0 +1,35 @@ +# Makefile.common for Gryphon plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = gryphon + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-gryphon.c + +# corresponding headers +DISSECTOR_INCLUDES = \ + packet-gryphon.h diff --git a/plugins/gryphon/Makefile.nmake b/plugins/gryphon/Makefile.nmake index 883c905556..b3408f29fb 100644 --- a/plugins/gryphon/Makefile.nmake +++ b/plugins/gryphon/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for Gryphon plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-gryphon.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -gryphon.dll gryphon.exp gryphon.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:gryphon.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +gryphon.dll gryphon.exp gryphon.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:gryphon.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/gryphon/packet-gryphon.c b/plugins/gryphon/packet-gryphon.c index fe7b16fe92..cfe50083fd 100644 --- a/plugins/gryphon/packet-gryphon.c +++ b/plugins/gryphon/packet-gryphon.c @@ -28,23 +28,17 @@ #include "config.h" #endif -#include "moduleinfo.h" - #include <string.h> #include <ctype.h> #include <time.h> -#include <gmodule.h> +#include <glib.h> #include <epan/packet.h> #include <epan/emem.h> #include "packet-gryphon.h" #include <epan/dissectors/packet-tcp.h> #include <epan/prefs.h> -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - /* * See * @@ -2295,25 +2289,3 @@ proto_reg_handoff_gryphon(void) gryphon_handle = create_dissector_handle(dissect_gryphon, proto_gryphon); dissector_add("tcp.port", 7000, gryphon_handle); } - -/* 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_gryphon == -1) { /* execute protocol initialization only once */ - proto_register_gryphon(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_gryphon(); -} - -#endif - -/* End the functions we need for plugin stuff */ diff --git a/plugins/h223/Makefile.am b/plugins/h223/Makefile.am index 80d9a75ca3..1839af0e4c 100644 --- a/plugins/h223/Makefile.am +++ b/plugins/h223/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/H223 +# Automake file for H.223 plugin # # $Id$ # @@ -22,21 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = h223.la h223_la_SOURCES = \ - golay.h \ - golay.c \ + plugin.c \ moduleinfo.h \ - packet-h223.c \ - packet-h223.h \ - packet-srp.c \ - packet-srp.h \ - plugin.c - + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) h223_la_LDFLAGS = -module -avoid-version h223_la_LIBADD = @PLUGIN_LIBS@ @@ -45,6 +42,69 @@ h223_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ h223 \ *~ @@ -53,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/h223/Makefile.common b/plugins/h223/Makefile.common new file mode 100644 index 0000000000..08c5f54adf --- /dev/null +++ b/plugins/h223/Makefile.common @@ -0,0 +1,44 @@ +# Makefile.common for H.223 plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = h223 + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-h223.c \ + packet-srp.c + +# corresponding headers +DISSECTOR_INCLUDES = \ + golay.h \ + packet-h223.h \ + packet-srp.h + +# Dissector helpers. They're included in the source files in this +# directory, but they're not dissectors themselves, i.e. they're not +# used to generate "register.c"). +DISSECTOR_SUPPORT_SRC = \ + golay.c diff --git a/plugins/h223/Makefile.nmake b/plugins/h223/Makefile.nmake index 676fa66fd8..c3099ad192 100644 --- a/plugins/h223/Makefile.nmake +++ b/plugins/h223/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for H.223 plugin # # $Id$ # @@ -6,24 +8,72 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) +LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS) + !IFDEF ENABLE_LIBETHEREAL LINK_PLUGIN_WITH=..\..\epan\libethereal.lib CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS) -OBJECTS=packet-h223.obj packet-srp.obj plugin.obj golay.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) -h223.dll h223.exp h223.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:h223.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj + +h223.dll h223.exp h223.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:h223.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: - rm -f $(OBJECTS) h223.dll h223.exp h223.lib $(PDB_FILE) + rm -f $(OBJECTS) h223.dll h223.exp h223.lib *.pdb distclean: clean -maintainer-clean: distclean
\ No newline at end of file +maintainer-clean: distclean diff --git a/plugins/h223/plugin.c b/plugins/h223/plugin.c deleted file mode 100644 index 1296988112..0000000000 --- a/plugins/h223/plugin.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $Id$ - * - * Routines for H.223 packet dissection - * Copyright (c) 2005 MX Telecom Ltd <richardv@mxtelecom.com> - * - * 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 - -#include <gmodule.h> -#include <glib.h> -#include "moduleinfo.h" - -#include "packet-h223.h" -#include "packet-srp.h" - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; - -G_MODULE_EXPORT void plugin_register(void) -{ - /* register the new protocol, protocol fields, and subtrees */ - proto_register_h223(); - proto_register_srp(); - proto_register_ccsrl(); -} - -G_MODULE_EXPORT void plugin_reg_handoff(void){ - proto_reg_handoff_h223(); - proto_reg_handoff_srp(); -} -#endif diff --git a/plugins/irda/Makefile.am b/plugins/irda/Makefile.am index 0b4c1bab07..773a6ea450 100644 --- a/plugins/irda/Makefile.am +++ b/plugins/irda/Makefile.am @@ -1,34 +1,39 @@ # Makefile.am -# Automake file for Ethereal/IrDA +# Automake file for IrDA plugin # # $Id$ # # 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) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = irda.la -irda_la_SOURCES = packet-irda.c moduleinfo.h irda-appl.h packet-ircomm.c \ - packet-sir.c +irda_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) irda_la_LDFLAGS = -module -avoid-version irda_la_LIBADD = @PLUGIN_LIBS@ @@ -37,6 +42,69 @@ irda_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ irda \ *~ @@ -45,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/irda/Makefile.common b/plugins/irda/Makefile.common new file mode 100644 index 0000000000..92b0a50ba3 --- /dev/null +++ b/plugins/irda/Makefile.common @@ -0,0 +1,37 @@ +# Makefile.common for IrDA plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = irda + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-ircomm.c \ + packet-irda.c \ + packet-sir.c + +# corresponding headers +DISSECTOR_INCLUDES = \ + irda-appl.h diff --git a/plugins/irda/Makefile.nmake b/plugins/irda/Makefile.nmake index 1a51de7933..949fea2cc7 100644 --- a/plugins/irda/Makefile.nmake +++ b/plugins/irda/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for IrDA plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,16 +19,60 @@ 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-irda.obj packet-ircomm.obj packet-sir.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -irda.dll irda.exp irda.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:irda.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +ira.dll ira.exp ira.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:ira.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: - rm -f $(OBJECTS) irda.dll irda.exp irda.lib *.pdb + rm -f $(OBJECTS) ira.dll ira.exp ira.lib *.pdb distclean: clean diff --git a/plugins/irda/irda-appl.h b/plugins/irda/irda-appl.h index 683e03503e..038be597a3 100644 --- a/plugins/irda/irda-appl.h +++ b/plugins/irda/irda-appl.h @@ -102,10 +102,4 @@ extern void proto_register_irsir(void); { "IrLPT", irlpt_attr_dissector }, \ { NULL, NULL } -/* Protocol initialisation */ -#define REGISTER_SUB_PROTOCOLS() do { \ - proto_register_ircomm(); \ - proto_register_irsir(); \ - } while (0) - #endif /* __IRDA_APPL_H__ */ diff --git a/plugins/irda/packet-irda.c b/plugins/irda/packet-irda.c index e58d818498..db757e60be 100644 --- a/plugins/irda/packet-irda.c +++ b/plugins/irda/packet-irda.c @@ -31,14 +31,11 @@ # include "config.h" #endif -#include "moduleinfo.h" - #include <stdio.h> #include <stdlib.h> #include <string.h> #include <glib.h> -#include <gmodule.h> #include <epan/packet.h> #include <epan/proto.h> #include <epan/conversation.h> @@ -143,11 +140,6 @@ #define TTP_PARAMETERS 0x80 #define TTP_MORE 0x80 - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - /* Initialize the protocol and registered fields */ static int proto_irlap = -1; static int hf_lap_a = -1; @@ -1952,7 +1944,7 @@ static void init_irda(void) * This format is required because a script is used to build the C function * that calls all the protocol registrations. */ -static void proto_register_irda(void) +void proto_register_irda(void) { unsigned i; @@ -2314,7 +2306,7 @@ static void proto_register_irda(void) create the code that calls these routines. */ -static void proto_reg_handoff_irda(void) +void proto_reg_handoff_irda(void) { dissector_handle_t irda_handle; @@ -2322,31 +2314,3 @@ static void proto_reg_handoff_irda(void) dissector_add("wtap_encap", WTAP_ENCAP_IRDA, irda_handle); data_handle = find_dissector("data"); } - - -/* 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_irlap == -1) - { - /* execute protocol initialization only once */ - proto_register_irda(); - - REGISTER_SUB_PROTOCOLS(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void) -{ - proto_reg_handoff_irda(); -} - -#endif - -/* End the functions we need for plugin stuff */ diff --git a/plugins/lwres/Makefile.am b/plugins/lwres/Makefile.am index 6142029c8d..858065f3b5 100644 --- a/plugins/lwres/Makefile.am +++ b/plugins/lwres/Makefile.am @@ -1,11 +1,11 @@ # Makefile.am -# Automake file for Ethereal/lwres +# Automake file for lwres plugin # # $Id$ # # Ethereal - Network traffic analyzer / light waight resolver (part of Bind9) # By Steve Oleg Terletsky <oleg.terletsky@comverse.com> -# Copyright 20003 +# Copyright 2003 # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,12 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = lwres.la -lwres_la_SOURCES = packet-lwres.c moduleinfo.h +lwres_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) lwres_la_LDFLAGS = -module -avoid-version lwres_la_LIBADD = @PLUGIN_LIBS@ @@ -36,6 +42,69 @@ lwres_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ lwres \ *~ @@ -44,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/lwres/Makefile.common b/plugins/lwres/Makefile.common new file mode 100644 index 0000000000..c094695285 --- /dev/null +++ b/plugins/lwres/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for lwres plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = lwres + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-lwres.c diff --git a/plugins/lwres/Makefile.nmake b/plugins/lwres/Makefile.nmake index 97470f88a2..f059a5ec77 100644 --- a/plugins/lwres/Makefile.nmake +++ b/plugins/lwres/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for lwres plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-lwres.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -lwres.dll lwres.exp lwres.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:lwres.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +lwres.dll lwres.exp lwres.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:lwres.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/lwres/packet-lwres.c b/plugins/lwres/packet-lwres.c index f1df60f4e2..2fd5f2de05 100644 --- a/plugins/lwres/packet-lwres.c +++ b/plugins/lwres/packet-lwres.c @@ -28,15 +28,13 @@ #include "config.h" #endif -#include "moduleinfo.h" - #include <stdio.h> #include <stdlib.h> -#include <gmodule.h> #include <ctype.h> #include <time.h> #include <string.h> +#include <glib.h> #include <epan/packet.h> #include <epan/prefs.h> @@ -185,11 +183,6 @@ static int ett_ns_rec_item = -1; -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - - #define LWRES_UDP_PORT 921 static guint global_lwres_port = LWRES_UDP_PORT; @@ -205,7 +198,7 @@ static int proto_lwres = -1; /* Define many many headers for mgcp */ static const value_string message_types_values[] = { - { 1, "REQUEST " }, + { 1, "REQUEST " }, { 2, "RESPONSE" }, { 0 , NULL }, }; @@ -1517,25 +1510,3 @@ proto_reg_handoff_lwres(void) dissector_add("udp.port", lwres_port, lwres_handle); } - -/* 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_lwres == -1) { /* execute protocol initialization only once */ - proto_register_lwres(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_lwres(); -} - -#endif - -/* End the functions we need for plugin stuff */ diff --git a/plugins/megaco/Makefile.am b/plugins/megaco/Makefile.am index 019fc1676d..1183201f77 100644 --- a/plugins/megaco/Makefile.am +++ b/plugins/megaco/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Megaco Ethereal plugin +# Automake file for MEGACO plugin # # $Id$ # @@ -22,12 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = megaco.la -megaco_la_SOURCES = packet-megaco.c moduleinfo.h +megaco_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) megaco_la_LDFLAGS = -module -avoid-version megaco_la_LIBADD = @PLUGIN_LIBS@ @@ -36,6 +42,69 @@ megaco_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ megaco \ *~ @@ -44,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/megaco/Makefile.common b/plugins/megaco/Makefile.common new file mode 100644 index 0000000000..79df353589 --- /dev/null +++ b/plugins/megaco/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for MEGACO plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = megaco + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-megaco.c diff --git a/plugins/megaco/Makefile.nmake b/plugins/megaco/Makefile.nmake index f2d37a4f6d..e4ceac2b71 100644 --- a/plugins/megaco/Makefile.nmake +++ b/plugins/megaco/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for MEGACO plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-megaco.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -megaco.dll megaco.exp megaco.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:megaco.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +megaco.dll megaco.exp megaco.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:megaco.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/megaco/packet-megaco.c b/plugins/megaco/packet-megaco.c index 5bbdf518c6..6f59a49825 100644 --- a/plugins/megaco/packet-megaco.c +++ b/plugins/megaco/packet-megaco.c @@ -42,14 +42,13 @@ #include "config.h" #endif -#include "moduleinfo.h" - #include <stdio.h> #include <stdlib.h> -#include <gmodule.h> #include <ctype.h> #include <time.h> #include <string.h> + +#include <glib.h> #include <epan/packet.h> #include <epan/addr_resolv.h> #include <epan/prefs.h> @@ -57,10 +56,6 @@ #include <epan/sctpppids.h> #include <epan/dissectors/packet-tpkt.h> -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - #define PORT_MEGACO_TXT 2944 #define PORT_MEGACO_BIN 2945 @@ -2844,26 +2839,3 @@ static gint tvb_skip_wsp_return(tvbuff_t* tvb, gint offset){ counter++; return (counter); } - - -/* 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_megaco == -1) { /* execute protocol initialization only once */ - proto_register_megaco(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_megaco(); -} - -#endif - -/* End the functions we need for plugin stuff */ diff --git a/plugins/mgcp/Makefile.am b/plugins/mgcp/Makefile.am index ec1e3bf4ee..206ac4da4a 100644 --- a/plugins/mgcp/Makefile.am +++ b/plugins/mgcp/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/MGCP +# Automake file for MGCP plugin # # $Id$ # @@ -22,16 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = mgcp.la mgcp_la_SOURCES = \ - packet-mgcp.c \ - packet-mgcp.h \ - plugin-mgcp.c - + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) mgcp_la_LDFLAGS = -module -avoid-version mgcp_la_LIBADD = @PLUGIN_LIBS@ @@ -40,6 +42,69 @@ mgcp_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ mgcp \ *~ @@ -48,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/mgcp/Makefile.common b/plugins/mgcp/Makefile.common new file mode 100644 index 0000000000..fcac38b9cb --- /dev/null +++ b/plugins/mgcp/Makefile.common @@ -0,0 +1,35 @@ +# Makefile.common for MGCP plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = mgcp + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-mgcp.c + +# corresponding headers +DISSECTOR_INCLUDES = \ + packet-mgcp.h diff --git a/plugins/mgcp/Makefile.nmake b/plugins/mgcp/Makefile.nmake index 532dc12a4e..c40b9ea763 100644 --- a/plugins/mgcp/Makefile.nmake +++ b/plugins/mgcp/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for MGCP plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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 plugin-mgcp.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -mgcp.dll mgcp.exp mgcp.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:mgcp.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +mgcp.dll mgcp.exp mgcp.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:mgcp.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/mgcp/moduleinfo.h b/plugins/mgcp/moduleinfo.h new file mode 100644 index 0000000000..b026e28341 --- /dev/null +++ b/plugins/mgcp/moduleinfo.h @@ -0,0 +1,17 @@ +/* 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/plugin-mgcp.c b/plugins/mgcp/plugin-mgcp.c deleted file mode 100644 index 641642932f..0000000000 --- a/plugins/mgcp/plugin-mgcp.c +++ /dev/null @@ -1,59 +0,0 @@ -/* $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 */ diff --git a/plugins/opsi/Makefile.am b/plugins/opsi/Makefile.am index 0adcaf8b0a..ea833222e7 100644 --- a/plugins/opsi/Makefile.am +++ b/plugins/opsi/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/opsi +# Automake file for OPSI plugin # # $Id$ # @@ -22,12 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = opsi.la -opsi_la_SOURCES = packet-opsi.c packet-opsi.h moduleinfo.h +opsi_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) opsi_la_LDFLAGS = -module -avoid-version opsi_la_LIBADD = @PLUGIN_LIBS@ @@ -36,6 +42,69 @@ opsi_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ opsi \ *~ @@ -44,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/opsi/Makefile.common b/plugins/opsi/Makefile.common new file mode 100644 index 0000000000..d9e6877e19 --- /dev/null +++ b/plugins/opsi/Makefile.common @@ -0,0 +1,35 @@ +# Makefile.common for OPSI plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = opsi + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-opsi.c + +# corresponding headers +DISSECTOR_INCLUDES = \ + packet-opsi.h diff --git a/plugins/opsi/Makefile.nmake b/plugins/opsi/Makefile.nmake index cabc2f44cd..d50d3c01db 100644 --- a/plugins/opsi/Makefile.nmake +++ b/plugins/opsi/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for OPSI plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-opsi.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -opsi.dll opsi.exp opsi.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:opsi.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +opsi.dll opsi.exp opsi.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:opsi.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/opsi/packet-opsi.c b/plugins/opsi/packet-opsi.c index 4ef2796b50..a985746dad 100644 --- a/plugins/opsi/packet-opsi.c +++ b/plugins/opsi/packet-opsi.c @@ -27,9 +27,6 @@ # include "config.h" #endif -#include "moduleinfo.h" -#include <gmodule.h> - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -43,12 +40,6 @@ #include "packet-opsi.h" -/* Plugin exported constants */ -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - - /* Initialize the protocol and registered fields */ static int proto_opsi = -1; static int hf_opsi_major_version = -1; @@ -800,23 +791,3 @@ proto_reg_handoff_opsi(void) opsi_handle = create_dissector_handle(dissect_opsi, proto_opsi); dissector_add("tcp.port", TCP_PORT_OPSI, opsi_handle); } - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT void -plugin_register(void) -{ - /* register the new protocol, protocol fields, and subtrees */ - if (proto_opsi == -1) { /* execute protocol initialization only once */ - proto_register_opsi(); - } - -} -#endif - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT void -plugin_reg_handoff(void) -{ - proto_reg_handoff_opsi(); -} -#endif diff --git a/plugins/pcli/Makefile.am b/plugins/pcli/Makefile.am index 1aa126be2c..2fcdd070b7 100644 --- a/plugins/pcli/Makefile.am +++ b/plugins/pcli/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/Gryphon +# Automake file for Packet Cable Lawful Intercept plugin # # $Id$ # @@ -22,12 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = pcli.la -pcli_la_SOURCES = packet-pcli.c moduleinfo.h +pcli_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) pcli_la_LDFLAGS = -module -avoid-version pcli_la_LIBADD = @PLUGIN_LIBS@ @@ -36,6 +42,69 @@ pcli_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ pcli \ *~ @@ -44,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/pcli/Makefile.common b/plugins/pcli/Makefile.common new file mode 100644 index 0000000000..ccd47a16ca --- /dev/null +++ b/plugins/pcli/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for Packet Cable Lawful Intercept plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = pcli + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-pcli.c diff --git a/plugins/pcli/Makefile.nmake b/plugins/pcli/Makefile.nmake index 37b8d02965..4addf0dd36 100644 --- a/plugins/pcli/Makefile.nmake +++ b/plugins/pcli/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for Packet Cable Lawful Intercept plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-pcli.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -pcli.dll pcli.exp pcli.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:pcli.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +pcli.dll pcli.exp pcli.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:pcli.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/pcli/packet-pcli.c b/plugins/pcli/packet-pcli.c index aac945dc02..cb75364b64 100644 --- a/plugins/pcli/packet-pcli.c +++ b/plugins/pcli/packet-pcli.c @@ -32,25 +32,19 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "moduleinfo.h" #include <stdio.h> #include <stdlib.h> -#include <gmodule.h> #include <ctype.h> #include <time.h> #include <string.h> + +#include <glib.h> #include <epan/packet.h> #include <epan/addr_resolv.h> #include <epan/prefs.h> #include <epan/strutil.h> -/* Define version if we are not building ethereal statically */ - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - /* Define udp_port for lawful intercept */ #define UDP_PORT_PCLI 9000 @@ -169,26 +163,3 @@ proto_reg_handoff_pcli(void) { dissector_add("udp.port",global_udp_port_pcli,pcli_handle); } - -/* 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_pcli == -1) { /* execute protocol initialization only once */ - proto_register_pcli(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_pcli(); -} - -#endif - -/* End the functions we need for plugin stuff */ - diff --git a/plugins/profinet/Makefile.am b/plugins/profinet/Makefile.am index 3f24e71d92..191c1578b8 100644 --- a/plugins/profinet/Makefile.am +++ b/plugins/profinet/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/plugins/profinet +# Automake file for PROFINET plugin # # $Id$ # @@ -22,12 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = profinet.la -profinet_la_SOURCES = profinet.c packet-dcerpc-pn-io.c packet-pn-dcp.c packet-pn-ptcp.c moduleinfo.h +profinet_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) profinet_la_LDFLAGS = -module -avoid-version profinet_la_LIBADD = @PLUGIN_LIBS@ @@ -36,6 +42,69 @@ profinet_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ profinet \ *~ @@ -44,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/profinet/Makefile.common b/plugins/profinet/Makefile.common new file mode 100644 index 0000000000..b6a92bc785 --- /dev/null +++ b/plugins/profinet/Makefile.common @@ -0,0 +1,33 @@ +# Makefile.common for PROFINET plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = profinet + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-dcerpc-pn-io.c \ + packet-pn-dcp.c \ + packet-pn-ptcp.c diff --git a/plugins/profinet/Makefile.nmake b/plugins/profinet/Makefile.nmake index 7c3b086449..ee719e88e6 100644 --- a/plugins/profinet/Makefile.nmake +++ b/plugins/profinet/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for PROFINET plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,15 +19,65 @@ LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS) LINK_PLUGIN_WITH=..\..\epan\libethereal.lib CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS) +<<<<<<< .mine +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) +======= OBJECTS=profinet.obj packet-dcerpc-pn-io.obj packet-pn-dcp.obj packet-pn-ptcp.obj +>>>>>>> .r17941 + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -profinet.dll profinet.exp profinet.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:profinet.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +profinet.dll profinet.exp profinet.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:profinet.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: rm -f $(OBJECTS) profinet.dll profinet.exp profinet.lib *.pdb distclean: clean + +maintainer-clean: distclean diff --git a/plugins/profinet/profinet.c b/plugins/profinet/profinet.c deleted file mode 100644 index f3e6b806fa..0000000000 --- a/plugins/profinet/profinet.c +++ /dev/null @@ -1,79 +0,0 @@ -/* profinet-plugin.c - * Routines for the PROFINET plugin - * - * $Id$ - * - * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@ethereal.com> - * Copyright 1999 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. - */ - -/* Include files */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "moduleinfo.h" -#include <gmodule.h> - -#include <glib.h> - -/* Define version if we are not building ethereal statically */ - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - -gboolean plugin_registered = FALSE; - -/* XXX */ -extern void proto_register_pn_io (void); -extern void proto_reg_handoff_pn_io (void); -extern void proto_register_pn_dcp (void); -extern void proto_reg_handoff_pn_dcp (void); -extern void proto_register_pn_ptcp (void); -extern void proto_reg_handoff_pn_ptcp (void); - -/* 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 (plugin_registered == FALSE) { /* execute protocol initialization only once */ - proto_register_pn_io(); - proto_register_pn_dcp(); - proto_register_pn_ptcp(); - - plugin_registered = TRUE; - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_pn_io(); - proto_reg_handoff_pn_dcp(); - proto_reg_handoff_pn_ptcp(); -} - -#endif - -/* End the functions we need for plugin stuff */ - diff --git a/plugins/rdm/Makefile.am b/plugins/rdm/Makefile.am index 3ff02da81a..e19e104ca0 100644 --- a/plugins/rdm/Makefile.am +++ b/plugins/rdm/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/RDM +# Automake file for RDM plugin # # $Id$ # @@ -22,12 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = rdm.la -rdm_la_SOURCES = packet-rdm.c moduleinfo.h +rdm_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) rdm_la_LDFLAGS = -module -avoid-version rdm_la_LIBADD = @PLUGIN_LIBS@ @@ -36,6 +42,69 @@ rdm_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ rdm \ *~ @@ -44,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/rdm/Makefile.common b/plugins/rdm/Makefile.common new file mode 100644 index 0000000000..698e9b6a90 --- /dev/null +++ b/plugins/rdm/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for RDM plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = rdm + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-rdm.c diff --git a/plugins/rdm/Makefile.nmake b/plugins/rdm/Makefile.nmake index bd5ab123da..ba14d66219 100644 --- a/plugins/rdm/Makefile.nmake +++ b/plugins/rdm/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for RDM plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-rdm.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -rdm.dll rdm.exp rdm.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:rdm.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +rdm.dll rdm.exp rdm.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:rdm.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/rdm/packet-rdm.c b/plugins/rdm/packet-rdm.c index 6d7874b59a..7482c84e8c 100644 --- a/plugins/rdm/packet-rdm.c +++ b/plugins/rdm/packet-rdm.c @@ -30,25 +30,18 @@ #include "config.h" #endif -#include "moduleinfo.h" - #include <stdio.h> #include <stdlib.h> -#include <gmodule.h> #include <ctype.h> #include <time.h> #include <string.h> + +#include <glib.h> #include <epan/packet.h> #include <epan/addr_resolv.h> #include <epan/etypes.h> #include <epan/strutil.h> -/* Define version if we are not building ethereal statically */ - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - /* * See http://www.esta.org/tsp/E1-20inst.htm * @@ -262,26 +255,3 @@ proto_reg_handoff_rdm(void) { dissector_add("udp.port",0,rdm_handle); } - -/* 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_rdm == -1) { /* execute protocol initialization only once */ - proto_register_rdm(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_rdm(); -} - -#endif - -/* End the functions we need for plugin stuff */ - diff --git a/plugins/rlm/Makefile.am b/plugins/rlm/Makefile.am index 87eb3e8e2f..2ef1e642e1 100644 --- a/plugins/rlm/Makefile.am +++ b/plugins/rlm/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Cisco SS7 Redundant Link Management dissector +# Automake file for Cisco SS7 Redundant Link Management plugin # Copyright 2004, Duncan Sargeant <dunc-ethereal@rcpt.to> # # $Id$ @@ -23,12 +23,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = rlm.la -rlm_la_SOURCES = packet-rlm.c moduleinfo.h +rlm_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) rlm_la_LDFLAGS = -module -avoid-version rlm_la_LIBADD = @PLUGIN_LIBS@ @@ -37,6 +43,69 @@ rlm_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ rlm \ *~ @@ -45,4 +114,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/rlm/Makefile.common b/plugins/rlm/Makefile.common new file mode 100644 index 0000000000..d1a26db3b9 --- /dev/null +++ b/plugins/rlm/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for Cisco SS7 Redundant Link Management plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = rlm + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-rlm.c diff --git a/plugins/rlm/Makefile.nmake b/plugins/rlm/Makefile.nmake index 11357bc078..daf406dbdb 100644 --- a/plugins/rlm/Makefile.nmake +++ b/plugins/rlm/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for Cisco SS7 Redundant Link Management plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-rlm.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -rlm.dll rlm.exp rlm.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:rlm.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +rlm.dll rlm.exp rlm.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:rlm.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/rlm/packet-rlm.c b/plugins/rlm/packet-rlm.c index 10f5a2d7b6..e813b4c626 100644 --- a/plugins/rlm/packet-rlm.c +++ b/plugins/rlm/packet-rlm.c @@ -55,18 +55,9 @@ #include <stdlib.h> #include <string.h> -#include <gmodule.h> +#include <glib.h> #include <epan/packet.h> - /* Define version if we are not building ethereal statically */ - -#include "moduleinfo.h" - -#ifndef ENABLE_STATIC - G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - - /* Initialize the protocol and registered fields */ static int proto_rlm = -1; @@ -182,7 +173,7 @@ dissect_rlm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ void -plugin_reg_handoff_rlm(void) +proto_reg_handoff_rlm(void) { heur_dissector_add("udp", dissect_rlm, proto_rlm); heur_dissector_add("udp", dissect_udp_lapd, proto_get_id_by_filter_name("lapd")); @@ -234,27 +225,3 @@ proto_register_rlm(void) proto_register_field_array(proto_rlm, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } - -#ifndef ENABLE_STATIC - -G_MODULE_EXPORT void -plugin_register(void) -{ - /* register the new protocol, protocol fields, and subtrees */ - if (proto_rlm == -1) { /* execute protocol initialization only once */ - proto_register_rlm(); - } -} - - -/* If this dissector uses sub-dissector registration add a registration routine. - This format is required because a script is used to find these routines and - create the code that calls these routines. -*/ -G_MODULE_EXPORT void -plugin_reg_handoff(void) -{ - plugin_reg_handoff_rlm(); -} - -#endif diff --git a/plugins/rtnet/Makefile.am b/plugins/rtnet/Makefile.am index 71b1a54f30..acb836b7bf 100644 --- a/plugins/rtnet/Makefile.am +++ b/plugins/rtnet/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Ethereal/RTNET +# Automake file for RTNET plugin # # $Id$ # @@ -22,12 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = rtnet.la -rtnet_la_SOURCES = packet-rtnet.c moduleinfo.h +rtnet_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) rtnet_la_LDFLAGS = -module -avoid-version rtnet_la_LIBADD = @PLUGIN_LIBS@ @@ -36,6 +42,69 @@ rtnet_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ rtnet \ *~ @@ -44,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/rtnet/Makefile.common b/plugins/rtnet/Makefile.common new file mode 100644 index 0000000000..a129077cba --- /dev/null +++ b/plugins/rtnet/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for RTNET plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = rtnet + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-rtnet.c diff --git a/plugins/rtnet/Makefile.nmake b/plugins/rtnet/Makefile.nmake index ca1ff06ee8..ca480c3813 100644 --- a/plugins/rtnet/Makefile.nmake +++ b/plugins/rtnet/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for RTNET plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-rtnet.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -rtnet.dll rtnet.exp rtnet.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:rtnet.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +rtnet.dll rtnet.exp rtnet.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:rtnet.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/rtnet/packet-rtnet.c b/plugins/rtnet/packet-rtnet.c index d2efa414a3..72bf9ebd6d 100644 --- a/plugins/rtnet/packet-rtnet.c +++ b/plugins/rtnet/packet-rtnet.c @@ -35,21 +35,16 @@ #include <stdio.h> #include <stdlib.h> -#include <gmodule.h> #include <ctype.h> #include <time.h> #include <string.h> + +#include <glib.h> #include <epan/packet.h> #include <epan/addr_resolv.h> #include <epan/etypes.h> #include <epan/strutil.h> -/* Define version if we are not building ethereal statically */ - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - /* * See * @@ -1384,6 +1379,7 @@ proto_reg_handoff_rtcfg(void) { static dissector_handle_t rtcfg_handle; if( !rtcfg_initialized ){ + data_handle = find_dissector("data"); rtcfg_handle = create_dissector_handle(dissect_rtcfg, proto_rtcfg); rtcfg_initialized = TRUE; } else { @@ -1392,31 +1388,3 @@ proto_reg_handoff_rtcfg(void) { dissector_add("ethertype", ETHERTYPE_RTCFG, rtcfg_handle); } - -/* 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_rtmac == -1) { /* execute protocol initialization only once */ - proto_register_rtmac(); - } - if (proto_rtcfg == -1) { /* execute protocol initialization only once */ - proto_register_rtcfg(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_rtmac(); - proto_reg_handoff_rtcfg(); - data_handle = find_dissector("data"); -} - -#endif - -/* End the functions we need for plugin stuff */ - diff --git a/plugins/rudp/Makefile.am b/plugins/rudp/Makefile.am index 6625af01b0..e360d9b401 100644 --- a/plugins/rudp/Makefile.am +++ b/plugins/rudp/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Automake file for Cisco SS7 Reliable UDP dissector +# Automake file for Cisco SS7 Reliable UDP plugin # Copyright 2004, Duncan Sargeant <dunc-ethereal@rcpt.to> # # $Id$ @@ -23,12 +23,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = rudp.la -rudp_la_SOURCES = packet-rudp.c moduleinfo.h +rudp_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) rudp_la_LDFLAGS = -module -avoid-version rudp_la_LIBADD = @PLUGIN_LIBS@ @@ -37,6 +43,69 @@ rudp_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ rudp \ *~ @@ -45,4 +114,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/rudp/Makefile.common b/plugins/rudp/Makefile.common new file mode 100644 index 0000000000..4d95f0b63f --- /dev/null +++ b/plugins/rudp/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for Cisco SS7 Reliable UDP plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = rudp + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-rudp.c diff --git a/plugins/rudp/Makefile.nmake b/plugins/rudp/Makefile.nmake index bbab9d2224..74970a57b0 100644 --- a/plugins/rudp/Makefile.nmake +++ b/plugins/rudp/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for Cisco SS7 Reliable UDP plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-rudp.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -rudp.dll rudp.exp rudp.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:rudp.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +rudp.dll rudp.exp rudp.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:rudp.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/rudp/packet-rudp.c b/plugins/rudp/packet-rudp.c index 1355d325d5..cb45972501 100644 --- a/plugins/rudp/packet-rudp.c +++ b/plugins/rudp/packet-rudp.c @@ -46,17 +46,9 @@ # include "config.h" #endif -#include <gmodule.h> +#include <glib.h> #include <epan/packet.h> - /* Define version if we are not building ethereal statically */ - -#include "moduleinfo.h" - -#ifndef ENABLE_STATIC - G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - static int proto_rudp = -1; static int hf_rudp_flags = -1; @@ -230,22 +222,3 @@ proto_reg_handoff_rudp(void) { dissector_add("udp.port", 7000, rudp_handle); } - -#ifndef ENABLE_STATIC - -G_MODULE_EXPORT void -plugin_register(void) -{ - /* register the new protocol, protocol fields, and subtrees */ - if (proto_rudp == -1) { /* execute protocol initialization only once */ - proto_register_rudp(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_rudp(); -} - -#endif - diff --git a/plugins/v5ua/Makefile.am b/plugins/v5ua/Makefile.am index 89d433b572..0a683e06f9 100644 --- a/plugins/v5ua/Makefile.am +++ b/plugins/v5ua/Makefile.am @@ -22,12 +22,18 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -INCLUDES = -I$(top_srcdir) +INCLUDES = -I$(top_srcdir) -I$(includedir) + +include Makefile.common plugindir = @plugindir@ plugin_LTLIBRARIES = v5ua.la -v5ua_la_SOURCES = packet-v5ua.c moduleinfo.h +v5ua_la_SOURCES = \ + plugin.c \ + moduleinfo.h \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_INCLUDES) v5ua_la_LDFLAGS = -module -avoid-version v5ua_la_LIBADD = @PLUGIN_LIBS@ @@ -36,6 +42,69 @@ v5ua_la_LIBADD = @PLUGIN_LIBS@ # add them here. LIBS = +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(PYTHON); then \ + echo Making plugin.c with python ; \ + $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(DISSECTOR_SRC) ; \ + else \ + echo Making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + fi + +# +# Currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. We used to have to check +# whether or not to build the snmp dissector. If we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# Oh, yuk. We don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, Automake insists +# on putting *all* source into the distribution. +# +# We work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + CLEANFILES = \ v5ua \ *~ @@ -44,4 +113,5 @@ MAINTAINERCLEANFILES = \ Makefile.in EXTRA_DIST = \ + Makefile.common \ Makefile.nmake diff --git a/plugins/v5ua/Makefile.common b/plugins/v5ua/Makefile.common new file mode 100644 index 0000000000..4cc220a67d --- /dev/null +++ b/plugins/v5ua/Makefile.common @@ -0,0 +1,31 @@ +# Makefile.common for V5UA plugin +# Contains the stuff from Makefile.am and Makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $Id$ +# +# 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. + +# the name of the plugin +PLUGIN_NAME = v5ua + +# the dissector sources (without any helpers) +DISSECTOR_SRC = \ + packet-v5ua.c diff --git a/plugins/v5ua/Makefile.nmake b/plugins/v5ua/Makefile.nmake index 3f246bb329..b61f437fdb 100644 --- a/plugins/v5ua/Makefile.nmake +++ b/plugins/v5ua/Makefile.nmake @@ -1,3 +1,5 @@ +# Makefile.nmake +# nmake file for V5UA plugin # # $Id$ # @@ -6,6 +8,8 @@ include ..\..\config.nmake ############### no need to modify below this line ######### +include Makefile.common + CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS) @@ -15,12 +19,56 @@ 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-v5ua.obj +DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) + +OBJECTS=$(DISSECTOR_OBJECTS) plugin.obj -v5ua.dll v5ua.exp v5ua.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) - link -dll /out:v5ua.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ +v5ua.dll v5ua.exp v5ua.lib : $(OBJECTS) $(LINK_PLUGIN_WITH) + link -dll /out:v5ua.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \ $(GLIB_LIBS) +# +# Build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# We do this by scanning sources. If that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# Formatting conventions: The name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# +# For some unknown reason, having a big "for" loop in the Makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# Therefore, we have a script to generate the plugin.c file. +# The shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on Windows. Therefore, +# if Python is present (as indicated by PYTHON being defined), we run +# a faster Python script to do that work instead. +# +# The first argument is the directory in which the source files live. +# The second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# All subsequent arguments are the files to scan. +# +plugin.c: $(DISSECTOR_SRC) +!IFDEF PYTHON + @echo Making plugin.c (using python) + @$(PYTHON) ../../tools/make-dissector-reg.py . plugin $(DISSECTOR_SRC) +!ELSE + @echo Making plugin.c (using sh) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) +!ENDIF + !ENDIF clean: diff --git a/plugins/v5ua/packet-v5ua.c b/plugins/v5ua/packet-v5ua.c index 7dc1e1e7aa..a87ae634cb 100644 --- a/plugins/v5ua/packet-v5ua.c +++ b/plugins/v5ua/packet-v5ua.c @@ -29,30 +29,19 @@ # include "config.h" #endif -#include "moduleinfo.h" - -#include <gmodule.h> - -#ifndef ENABLE_STATIC -G_MODULE_EXPORT const gchar version[] = VERSION; -#endif - #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <ctype.h> #include <glib.h> -#include <ctype.h> #include <epan/packet.h> #include <epan/addr_resolv.h> #include <epan/strutil.h> #include <epan/sctpppids.h> /* include V5UA payload protocol ID */ -#include <epan/packet.h> - - /* Initialize the protocol and registered fields */ static int proto_v5ua = -1; @@ -2360,26 +2349,3 @@ proto_reg_handoff_v5ua(void) dissector_add("sctp.port", SCTP_PORT_V5UA, v5ua_handle); dissector_add("sctp.ppi", V5UA_PAYLOAD_PROTOCOL_ID, v5ua_handle); } - - -/* 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_v5ua == -1) { /* execute protocol initialization only once */ - proto_register_v5ua(); - } -} - -G_MODULE_EXPORT void -plugin_reg_handoff(void){ - proto_reg_handoff_v5ua(); -} - -#endif - -/* End the functions we need for plugin stuff */ |