Wireshark mailing list archives

Re: How to get UDP port numbers in sub-dissector


From: Chris Maynard <chris.maynard () gtech com>
Date: Mon, 23 May 2011 17:20:59 +0000 (UTC)

eymanm <eymanm@...> writes:

I'm making a dissector for a protocol that is based on UDP. I'd like to show
the source and destination ports in the Info column, pretty much the same way as
it shown by the UDP dissector. Can somebody suggest how to get the  port numbers
when I'm dissecting the payload?

If you want to leave the column information supplied by the UDP dissector alone,
you can either call col_set_fence(pinfo->cinfo, COL_INFO) before adding or
setting your own column information, or you can avoid column adds/sets and use
col_append_*() functions instead.

If you really need access to the UDP ports though, you can get them from
pinfo->srcport and pinfo->destport.


___________________________________________________________________________
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: