Ethereal-dev: Re: [ethereal-dev] Dynamic dissectors

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Wed, 22 Dec 1999 16:34:07 -0800 (PST)
> Another point, is there a way to get a "callback" when a file is
> reloaded, or reanalysed? In that way I can clear the dissectors again.

To quote the comment before "register_init_routine()" in "packet.c":

/* Allow protocols to register "init" routines, which are called before
   we make a pass through a capture file and dissect all its packets
   (e.g., when we read in a new capture file, or run a "filter packets"
   or "colorize packets" pass over the current capture file). */

so if that's what you want (it's called when a file is reloaded or a new
file is loaded - and when a new pass is made over the capture, if that's
what you mean by "reanalysed"), then:

	write a routine "icq_init_protocol()" that takes no arguments
	and returns no value, and which clears the dissectors;

	call

		register_init_routine(&icq_init_protocol);

	in "proto_register_icq()".

Note that it'll be called before the *first* capture is read in, so it
needs to behave sensibly even if there's nothing to clear....