Disallow invalid char's in the filename passed to idl2wrs. Fixes bug 1129.
[obnox/wireshark/wip.git] / doc / README.plugins
index 30b36705f9fb63c552376862feeab14ddcdf34a3..19ff49e12c93fc3371665026caf0794d4b31773f 100644 (file)
@@ -4,7 +4,7 @@ $Id$
 
 Writing a "plugin" dissector is not very different from writing a
 standard one.  In fact all of the functions described in
-README.developer can be used in the plugins exactly as the are used in
+README.developer can be used in the plugins exactly as they are used in
 standard dissectors.
 
 (Note, however, that not all OSes on which Wireshark runs can support
@@ -23,6 +23,7 @@ contain minimally the following files:
 AUTHORS
 COPYING
 ChangeLog
+CMakeLists.txt
 Makefile.am
 Makefile.common
 Makefile.nmake
@@ -31,43 +32,52 @@ moduleinfo.nmake
 plugin.rc.in
 The source files and header files for your dissector
 
-Examples of these files can be found in plugins/h223.
+Examples of these files can be found in plugins/gryphon.
 
 2.1 AUTHORS, COPYING, and ChangeLog
 
-The AUTHORS, COPYING, and ChangeLog are the standard sort of GPL project 
+The AUTHORS, COPYING, and ChangeLog are the standard sort of GPL project
 files.
 
-2.2 Makefile.am 
+2.2 CMakeLists.txt
 
-For your plugins/xxx/Makefile.am file, see the corresponding file in 
-plugins/h223. Replace all occurrences of "h223" in those files with "xxx".
+For your plugins/xxx/CMakeLists.txt file, see the corresponding file in
+plugins/gryphon. Replace all occurrences of "gryphon" in those files
+with "xxx" and add your source files to the DISSECTOR_SRC variable.
 
-2.3 Makefile.common
+2.3 Makefile.am
 
-Your plugins/xxx/Makefile.common should list the source files for your
-dissector in the DISSECTOR_SRC variable, and all supporting source files
-in the DISSECTOR_SUPPORT_SRC variable.
-The header files for your dissector, if any, must be listed in the 
-DISSECTOR_INCLUDES variable. The DISSECTOR_INCLUDES variable should not 
-include moduleinfo.h. 
+For your plugins/xxx/Makefile.am file, see the corresponding file in
+plugins/gryphon. Replace all occurrences of "gryphon" in those files
+with "xxx".
 
-2.4 Makefile.nmake
+2.4 Makefile.common
 
-For your plugins/xxx/Makefile.nmake file, see the corresponding file in 
-plugins/h223. No modifications are needed here.
+Your plugins/xxx/Makefile.common should only list the main source file(s),
+which exports register_*() and handoff_*(), for your dissector in the
+DISSECTOR_SRC variable. All other supporting source files should be listed
+in the DISSECTOR_SUPPORT_SRC variable, and this variable added to the
+xxx_la_SOURCES variable in Makefile.am.
+The header files for your dissector, if any, must be listed in the
+DISSECTOR_INCLUDES variable. The DISSECTOR_INCLUDES variable should not
+include moduleinfo.h.
 
-2.5 moduleinfo.h
+2.5 Makefile.nmake
 
-Your plugins/xxx/moduleinfo.h file is used to set the version information 
-for the plugin. 
+For your plugins/xxx/Makefile.nmake file, see the corresponding file in
+plugins/gryphon. No modifications are needed here.
 
-2.6 moduleinfo.nmake
+2.6 moduleinfo.h
+
+Your plugins/xxx/moduleinfo.h file is used to set the version information
+for the plugin.
+
+2.7 moduleinfo.nmake
 
 Your plugins/xxx/moduleinfo.nmake is used to set the version information
 for building the plugin. Its contents should match that in moduleinfo.h
 
-2.7 plugin.rc.in
+2.8 plugin.rc.in
 
 Your plugins/xxx/plugin.rc.in is the Windows resource template file
 used to add the plugin specific information as resources to the DLL.
@@ -75,128 +85,95 @@ No modifications are needed here.
 
 3. Changes to existing Wireshark files
 
-You will also need to change the plugins/Makefile.am, the 
-plugins/Makefile.nmake, the toplevel Makefile.am file, and the 
-toplevel configure.in file.
+You will also need to change the following files:
+       configure.in
+       CMakeLists.txt
+       epan/Makefile.am
+       Makefile.am
+       packaging/nsis/Makefile.nmake
+       packaging/nsis/wireshark.nsi
+       plugins/Makefile.am
+       plugins/Makefile.nmake
+
+You might also want to search your Wireshark development directory for
+occurrences of an existing plugin name, in case this document is out of
+date with the current directory structure. For example,
+
+       grep -rl gryphon .
+
+could be used from a shell prompt.
 
 3.1  Changes to plugins/Makefile.am
 
-The plugins directory contains a Makefile.am.  You need to change the 
+The plugins directory contains a Makefile.am.  You need to change the
 SUBDIRS directive to reflect the addition of your plugin:
 
-SUBDIRS = \
+SUBDIRS = $(_CUSTOM_SUBDIRS_) \
+       ...
        gryphon \
-       mgcp \
-       xxx
-
+       irda \
+       xxx \
 
 3.2 Changes to plugins/Makefile.nmake
 
-To the Makefile.nmake you need to add your plugin to the all: rule
-
-all: \
-       gryphon \
-       mgcp \
-       xxx
-
-then add a rule for your plugin:
-
-xxx:
-       cd xxx
-       $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
-       cd ..
-
-and add to the clean rules support for cleaning up after your 
-plugin:
-
-clean:
-       cd gryphon
-       $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
-       cd ../mgcp
-       $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean   
-       cd ..
-       cd xxx
-       $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
-       cd ..
-
-
-distclean: clean
-       cd gryphon
-       $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
-       cd ../mgcp
-       $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean       
-       cd ..
-       cd xxx
-       $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
-       cd ..
-
-
-maintainer-clean: clean
-       cd gryphon
-       $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
-       cd ../mgcp
-       $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean        
-       cd ..
-       cd xxx
-       $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
-       cd ..
-
-Finally add a copy command to install-plugins rule:
-
-        xcopy mgcp\*.dll $(VERSION) /d
-        xcopy xxx\*.dll $(VERSION) /d
+In plugins/Makefile.nmake you need to add to the PLUGINS_LIST  
+(in alphabetical order) the name of your dissector (actually:
+the name of the plugins sub-directory which contains your dissector).
 
 3.3 Changes to the top level Makefile.am
 
-Unfortunately there are quite some several places in the top level
-Makefile.am that need to be altered for adding a plugin.
-
-Add your plugin to the plugin_libs and plugin_ldadd:
+Add your plugin (in alphabetical order) to the plugin_ldadd:
 
-plugin_libs = \
-        plugins/gryphon/gryphon.la \
-        plugins/mgcp/mgcp.la    \
-        plugins/xxx/xxx.la
+if HAVE_PLUGINS
 
-if ENABLE_STATIC
-plugin_ldadd = (plugin_libs)
-
-else          # ENABLE_STATIC
 plugin_ldadd = \
-        "-dlopen" self  \
-        "-dlopen" plugins/gryphon/gryphon.la \
-        "-dlopen" plugins/mgcp/mgcp.la \
-        "-dlopen" plugins/xxx/xxx.la 
+       ...
+       -dlopen plugins/gryphon/gryphon.la      \
+       -dlopen plugins/irda/irda.la    \
+       -dlopen plugins/xxx/xxx.la      \
+       ...
 
-3.4  Changes to top level configure.in
+3.4  Changes to the top level configure.in
 
-You need to add your plugins Makefile to the AC_OUTPUT rule in the 
-configure.in
+You need to add your plugins Makefile (in alphbetical order) to the AC_OUTPUT
+rule in the configure.in
 
 AC_OUTPUT(
-  Makefile
-  doc/Makefile
-  gtk/Makefile
-  packaging/Makefile
-  packaging/nsis/Makefile
-  packaging/rpm/Makefile
-  packaging/rpm/wireshark.spec
-  packaging/svr4/Makefile
-  packaging/svr4/checkinstall
-  packaging/svr4/pkginfo
-  plugins/Makefile
+  ...
   plugins/gryphon/Makefile
-  plugins/mgcp/Makefile
+  plugins/irda/Makefile
   plugins/xxx/Makefile
-  tools/Makefile
-  tools/lemon/Makefile
+  ...
   ,)
 
-3.5  Changes to the installers
+3.5  Changes to epan/Makefile.am
+
+Add the relative path of your plugin (in alphbetical order) to plugin_src:
+
+plugin_src = \
+        ...
+       ../plugins/gryphon/packet-gryphon.c \
+       ../plugins/irda/packet-irda.c \
+       ../plugins/xxx/packet-xxx.c \
+        ...
+
+3.6  Changes to CMakeLists.txt
+
+Add your plugin (in alphabetical order) to the PLUGIN_SRC_DIRS:
+
+if(ENABLE_PLUGINS)
+        ...
+        set(PLUGIN_SRC_DIRS
+                ...
+                plugins/gryphon
+                plugins/irda
+                plugins/xxx
+                ...
+
+3.7  Changes to the installers
 
 If you want to include your plugin in an installer you have to add lines
-in the NSIS installer Makefile.nmake and wireshark.nsi files, and U3
-installer makefile.nmake file.
+in the NSIS installer Makefile.nmake and wireshark.nsi files.
 
 For the NSIS installer:
 
@@ -208,7 +185,10 @@ For the NSIS installer:
                File "..\..\plugins\xxx\xxx.dll"
 
        to the list of "File" statements in the "Dissector Plugins"
-       section.
+       section in packaging/nsis/wireshark.nsi.
+
+The U3 and PortableApps installers build their manifests, including plugins,
+from packaging/nsis/wireshark.nsi via the packaging/ws-manifest.pl script.
 
 4. Development and plugins on Unix
 
@@ -217,38 +197,38 @@ Plugins make some aspects of development easier and some harder.
 The first thing is that you'll have to run autogen.sh and configure
 once more to setup your build environment.
 
-The good news is that if you are working on a single plugin 
-then you will find recompiling the plugin MUCH faster than 
+The good news is that if you are working on a single plugin
+then you will find recompiling the plugin MUCH faster than
 recompiling a dissector and then linking it back into Wireshark.
 
-The bad news is that Wireshark will not use the plugins unless the 
+The bad news is that Wireshark will not use the plugins unless the
 plugins are installed in one of the places it expects them to find.
 
 One way of dealing with this problem is to set an environment variable
 when running Wireshark: WIRESHARK_RUN_FROM_BUILD_DIRECTORY=1.
 
-Another way to deal with this problem is to set up a working root for 
+Another way to deal with this problem is to set up a working root for
 wireshark, say in $HOME/build/root and build wireshark to install
 there
 
 ./configure --prefix=${HOME}/build/root;make install
 
-then subsequent rebuilds/installs of your plugin can be accomplished 
-by going to the plugins/xxx directory and running 
+then subsequent rebuilds/installs of your plugin can be accomplished
+by going to the plugins/xxx directory and running
 
 make install
 
 5. Update "old style" plugins
 
-5.1 How to update an "old style" plugin (using plugin_register and 
+5.1 How to update an "old style" plugin (using plugin_register and
     plugin_reg_handoff functions).
 
 The plugin registration has changed with the extension of the build
-scripts. These now generate the additional code needed for plugin 
+scripts. These now generate the additional code needed for plugin
 encapsulation in plugin.c. When using the new style build scripts,
 stips the parts outlined below:
 
-    o Remove the following include statments:
+    o Remove the following include statements:
 
         #include <gmodule.h>
         #include "moduleinfo.h"