Wireshark-dev: Re: [Wireshark-dev] How to register a UDP src port for one protocol and dst port

From: Andy Howell <andy@xxxxxxxxxxxx>
Date: Tue, 25 Nov 2014 16:58:49 -0600
On 11/25/2014 01:48 PM, Guy Harris wrote:
> 
> On Nov 24, 2014, at 5:39 PM, Andy Howell <andy@xxxxxxxxxxxx> wrote:
> 
>> I'm writing some dissectors for a set of UDP based protocols that use the same port
>> number as the source port in one direction, and the destination port in the other
>> direction. Its a different protocol going each way.
>> 
>> It seems that I can only call dissector_add_uint with "udp.port", not "udp.srcport"
>> or "udp.dstport". Is that correct?
> 
> Yes.
> 
>> Ideally I like to register a different dissector for each direction. Is that not
>> possible?
> 
> No.
> 
> But what you can do is register a dissector with that port number and then, in the
> dissector, check whether pinfo->match_uint is equal to pinfo->srcport (in which case
> the packet came *from* that port) or pinfo->destport (in which case the packet was sent
> *to* that port).
> 
> (Solving this problem, regardless of what mechanisms are available, if the source and
> destination port numbers are the same is left as an exercise to the reader.)
> 


Guy,

	Thanks. I'm pretty sure my source and destination ports should always be different, but
I'll put in a check for that.

Regards,

Andy