Wireshark-dev: Re: [Wireshark-dev] Disabling a dissector doesn't seem to quite work.
From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Mon, 17 Sep 2012 23:18:49 +0200
On Sun, Sep 16, 2012 at 01:39:41PM -0700, Guy Harris wrote:
> On Sep 16, 2012, at 12:49 AM, Joerg Mayer <jmayer@xxxxxxxxx> wrote:
> 
> > On Sat, Sep 15, 2012 at 03:44:59PM -0700, Guy Harris wrote:
> >>> My understanding of dissectors registering to port 0 was simply a method for
> >>> allowing "Decode As" to work.
> >> 
> >> The right way for a dissector to say "I run atop {TCP,UDP,...} but I don't have a standard port number, so use "Decode As..."" is to call dissector_add() with a dissector handle and a dissector table name.
> > 
> > As dissector_add happens to be a) used nowhere and b) #defined to dissector_add_uint,
> > that may have been the case but is definitely not what today's code looks like.
> 
> Sorry, I meant "dissector_add_handle()", not "dissector_add()".

Ah, OK, thanks! How about the "easy" way out: Check at the beginning of
dissector_add_uint for pattern == 0 and go directly to the end of the function
where dissector_add_handle gets called if this is the case?
This will not only fix the current incorrect usage but also future cases.

> > If there's no opposition, I will remove that #define.
> 
> We might as well, unless
> 
> 	1) there's a way (at least with GCC-compatible compilers) to deprecate a macro (as opposed to a function)
> 
> and
> 
> 	2) we want to deprecate the old APIs for one release before removing it.

IIRC, this has not been used for ages inside the WS source tree.
It is also checked for by "checkAPIs.pl -g deprecated", so if external plugin
authors ignore this, it's up to them to find out why their code no longer
compiles (although we might want to add this to the release notes).

Ciao
   Jörg

-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.