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

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

From: Lars Roland <lars.roland@xxxxxxx>
Date: Sat, 05 Mar 2005 07:28:49 +0100
Hello all,

I've just checked in the final preparations for dropping the old plugin api. I'd like to get rid of it after next release. Or should we get rid of it even before?

This step introduces new_plugin_init() which replaces plugin_init() in all plugins. 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.

The official plugin have been updated already. Anyone with private plugins is encouraged to update them.

doc/README.plugins has been updated, too.

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
new_plugin_init(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

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

I hope this information is sufficient for everybody.

Regards,
Lars