This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Dissecting data from two ports

0

By following the guide for how to write a dissecting plugin for Wireshark I managed to get a working dll that dissects the data I put in, but only one port. All guides I have found has a pre defined source port.

But my data comes through two different ports and the data blocks are slightly different depending on which port it comes from. This means that I need to construct different trees with subtrees depending on from which port the data comes from. It would be nice if I could check which port the data comes from before I dissect. Is there a way to do this? A more elegant solution than one dll for each port I wanna check. It would also make it easier if the ports would change in the future or if I want put another data block through a different port in the future.

A code like: - Check source port - case port 1 ... - case port 2 ...

Is this possible? Or any other idea how I could solve it?

asked 08 Sep '15, 10:54

Anchang's gravatar image

Anchang
11114
accept rate: 0%


One Answer:

1

You can get the port number from pinfo->match_uint. That will contain the port which was used to decide to call your dissector.

answered 08 Sep '15, 12:04

JeffMorriss's gravatar image

JeffMorriss ♦
6.2k572
accept rate: 27%

Ok, so it was that simple. Thank you very much for the fast answer!

(08 Sep '15, 12:34) Anchang

Your welcome. If this answered your question, please be sure to Accept the answer by clicking the little checkbox (that way the question will show up as having an answer--and won't show in the list of unanswered questions).

(08 Sep '15, 12:48) JeffMorriss ♦