ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: Re: [Ethereal-dev] new init functions for plugins (preparation of removal of old

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Tue, 8 Mar 2005 13:05:49 +0100 (CET)
On Tue, 8 Mar 2005, Ulf Lamping wrote:

> Lars Roland wrote:
>
> > Hello all,
> >
> > I've just checked in the final preparations for dropping the old
> > plugin api.
>
> I'm glad to see this happen :-)
>
> > I'd like to get rid of it after next release. Or should we get rid of
> > it even before?
>
> Letting the plugin builders have a chance to update might be a good idea
> (at least for one release cycle), however, the changes in the plugin
> sources are almost trivial.

I second that.

> >
> > This step introduces new_plugin_init() which replaces plugin_init() in
> > all plugins.
>
> Hmmm, when grep through the code, I can only find plugin_register, but
> no plugin_init() or new_plugin_init() ?!?

So it seems, plugin_init() is superseded by plugin_register().

> > Plugins using plugin_init() will still work as long as the old api is
> > supported, but a warning will pop up, if ethereal loads such a plugin.
>
> You might consider add something like: "Please contact your plugin
> manufacturer for an updated plugin version." to the dialog box text.

Good idea.

> >
> > The official plugin have been updated already. Anyone with private
> > plugins is encouraged to update them.
>
> Just did that. After replacing plugin_init with plugin_register it's
> working again without a warning :-)
>
> >
> > doc/README.plugins has been updated, too.
>
> There's only one appearance of plugin_init(), that confused me.

Yep, typo at line 77.

> >
> > How to update a plugin:
>
> Don't bury this info in this mail, but add (append?) it to the
> README.developer file might be a good idea.

Better still, add it to README.plugin, like so

-----------------------8<------------------------

5	How to update a plugin

--- Remove following include statements from all plugin sources ---

#include "plugins/plugin_api.h"
#include "plugins/plugin_api_defs.h"

--- Change init function from this ---

G_MODULE_EXPORT void
plugin_init(plugin_address_table_t *pat
#ifndef PLUGINS_NEED_ADDRESS_TABLE
_U_
#endif
){
   /* initialise the table of pointers needed in Win32 DLLs */
   plugin_address_table_init(pat);
   /* register the new protocol, protocol fields, and subtrees */
   if (proto_xxx == -1) { /* execute protocol initialization only once */
     proto_register_xxx();
   }
}

------ to this ------

G_MODULE_EXPORT void
plugin_register(void)
{
   /* register the new protocol, protocol fields, and subtrees */
   if (proto_xxx == -1) { /* execute protocol initialization only once */
     proto_register_xxx();
   }
}

--- Changes to plugin's Makefile.nmake ---
change
!IFDEF LINK_PLUGINS_WITH_LIBETHEREAL
to
!IFDEF ENABLE_LIBETHEREAL

remove
!ELSE
LINK_PLUGIN_WITH=..\plugin_api.obj

move
!ENDIF
to the line just before the clean target

----------------

--------------------8<---------------------

Regards,
Jaap