Ethereal-dev: Re: [Ethereal-dev] patch for 802.11 dissector

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

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Mon, 22 Sep 2003 19:49:04 -0700

On Sep 22, 2003, at 1:31 AM, Motonori Shindo wrote:

Since you changed the signature of dissect_vendor_specific_ie(), you'd
also have to change packet-eapol.c which makes use of this
function.

Sigh.

That's why this is not a good idea:

	% egrep dissect_vendor_specific_ie packet-eapol.c
extern void dissect_vendor_specific_ie(proto_tree * tree, tvbuff_t * tvb,

Because that was separately declared in "packet-eapol.c", rather than declared in a header file included both by "packet-eapol.c" and "packet-ieee80211.c", the function prototype didn't actually provide all the type checking it could - the compiler couldn't check whether the definition in "packet-ieee80211.c" matched the use in "packet-eapol.c".

Declarations of external functions shouldn't be put in ".c" files, they should be put in a ".h" file included by the module that declares the function and the modules that use it. (If there's only one module that uses it, and that module also declares it, and it's not being exported to plugins, it shouldn't *be* an external function, it should be static.)

 Will you take care of it?

I've checked in a change to make "dissect_vendor_specific_ie()" private to "packet-ieee80211.c", and to have "packet-ieee80211.c" export - complete with a declaration in "packet-ieee80211.h" - a routine to dissect a set of tagged parameters, and made the EAPOL dissector call that routine (which means that if the 802.11 dissector handles the RSN Information Element from 802.11i draft 3.0, the EAPOL dissector will do so as well, without having to be changed).