Ethereal-dev: Re: [ethereal-dev] Plugin Questions

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

From: "Gerrit Gehnen" <G.Gehnen@xxxxxxxx>
Date: Mon, 08 May 2000 17:03:18 +0200
Guy Harris schrieb:
> 
> The COTP dissector checks that list *if* the COTP packet was
> encapsulated in a CLNP packet using the Inactive Subset of CLNP; given
> that we *currently* check for the Sinec H1 protocol only for COTP
> packets encapsulated in CLNP packets using the Inactive Subset, that's
> the only way to make the Sinec H1 dissector a heuristic dissector, but
> if the other dissector Gerrit wants to register with COTP isn't so
> encapsulated, either
> 
>         1) we need to call the Sinec H1 dissector for *all* COTP
>            packets, not just those so encapsulated, and perhaps inform
>            it by some other means that the Inactive Subset is being used
>            (in which case, if the Inactive Subset *isn't* used for this
>            packet, the H1 dissector would just return FALSE)
> 
> or
> 
>         2) we need to have an additional separate heuristic dissector
>            list for COTP packets not so encapsulated.

The "other dissector" is another PLC-protocol ontop of COTP. It's a 
proprietary protocol (not ours....) so I can't publish the code.
To make life more easy for me it should be a plugin.
Integration of the plugincode to packet-clnp.c is no problem, just 
copy&paste from packet-tcp.c. 

Heuristic dissection is good for additional high-level protocols,
just because you don't need to touch the base dissectors. But given by
the
small number of protocols using COTP is this not a real problem 
if the protocols are built into ethereal.

What we *really* need, is to extend this scheme to the plugin-mechanism.
>From the technical point of view no problem, because the
plugin-mechanism
uses a list already. We have simply to modify a single
line (code from packet-tcp - pseudo-diff, because I don't have a real 
diff at hand):
---snip----
#ifdef HAVE_PLUGINS
    {
      plugin *pt_plug = plugin_list;

      if (enabled_plugins_number > 0) {
	while (pt_plug) {
	  if (pt_plug->enabled && !strcmp(pt_plug->protocol, "tcp") &&
	      tree && dfilter_apply(pt_plug->filter, tree, pd)) {
<	    pt_plug->dissector(pd, offset, fd, tree);
<	    return;
>	    if (pt_plug->dissector(pd, offset, fd, tree))
>	    	return;
	  }
	  pt_plug = pt_plug->next;
	}
      }
    }
#endif
---snap-----
The drawback is, that *all* plugins are required to return a TRUE/FALSE
pair for the result of the dissection.

 Gerrit Gehnen

-- 
Dr.-Ing. Gerrit Gehnen      Abt. LT
ATR Industrie-Elektronik    Textilstraße 2, 41751 Viersen, Germany
Tel. (+49)2162 485-362      Fax (+49)2162 485-100
http://www.atrie.de