Wireshark mailing list archives
Re: How to register a UDP src port for one protocol and dst port for another?
From: Andy Howell <andy () gamubaru com>
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 () gamubaru com> 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 ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- How to register a UDP src port for one protocol and dst port for another? Andy Howell (Nov 25)
- Re: How to register a UDP src port for one protocol and dst port for another? Guy Harris (Nov 25)
- Re: How to register a UDP src port for one protocol and dst port for another? Andy Howell (Nov 25)
- Re: How to register a UDP src port for one protocol and dst port for another? Guy Harris (Nov 25)