diff options
author | oabad <oabad@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-07-16 20:44:28 +0000 |
---|---|---|
committer | oabad <oabad@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-07-16 20:44:28 +0000 |
commit | f6d92d8c1daf3bb73a65de1e6fa6d023e105061d (patch) | |
tree | 2f90d3f158791ef39e872ba9bebb23b632e1a722 /ethereal_gen.py | |
parent | 00157ae17640a310a113c12bb280b71299969e49 (diff) |
Changes to generate plugins instead of standard dissectors.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@3732 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'ethereal_gen.py')
-rw-r--r-- | ethereal_gen.py | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/ethereal_gen.py b/ethereal_gen.py index 03c12f2650..38c4d102a8 100644 --- a/ethereal_gen.py +++ b/ethereal_gen.py @@ -1,6 +1,6 @@ # -*- python -*- # -# $Id: ethereal_gen.py,v 1.5 2001/07/12 19:51:42 oabad Exp $ +# $Id: ethereal_gen.py,v 1.6 2001/07/16 20:44:28 oabad Exp $ # # # ethereal_gen.py (part of idl2eth) @@ -195,6 +195,7 @@ class ethereal_gen_C: self.gen_proto_register() self.gen_proto_reg_handoff(oplist) + self.gen_plugin_init() #self.dumpvars() # debug @@ -976,6 +977,13 @@ class ethereal_gen_C: # + # generate code for plugin initialisation + # + + def gen_plugin_init(self): + self.st.out(self.template_plugin_init, description=self.description, protocol_name=self.protoname, dissector_name=self.dissname) + + # # generate register_giop_user_module code, and register only # unique interfaces that contain operations. Also output # a heuristic register in case we want to use that. @@ -1209,9 +1217,32 @@ static guint32 boundary = GIOP_HEADER_SIZE; /* initial value */ /* TODO - Use registered fields */ """ - + # + # plugin_init and plugin_reg_handoff templates + # + + template_plugin_init = """ +#ifndef __ETHEREAL_STATIC__ + +G_MODULE_EXPORT void +plugin_reg_handoff(void){ + proto_register_handoff_giop_@dissector_name@(); +} + +G_MODULE_EXPORT void +plugin_init(plugin_address_table_t *pat){ + /* initialise the table of pointers needed in Win32 DLLs */ + plugin_address_table_init(pat); + if (proto_@dissector_name@ == -1) { + proto_register_giop_@dissector_name@(); + } +} + +#endif + +""" # # proto_register_<dissector name>(void) templates @@ -1648,8 +1679,11 @@ for (i_@aname@=0; i_@aname@ < @aval@; i_@aname@++) { # include "config.h" #endif +#include "plugins/plugin_api.h" + #include <stdio.h> #include <stdlib.h> +#include <gmodule.h> #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> @@ -1674,6 +1708,10 @@ for (i_@aname@=0; i_@aname@ < @aval@; i_@aname@++) { #include "proto.h" #include "packet-giop.h" +#ifndef __ETHEREAL_STATIC__ +G_MODULE_EXPORT const gchar version[] = "0.0.1"; +#endif + """ |