Wireshark-dev: Re: [Wireshark-dev] Doubt

From: Richard Sharpe <realrichardsharpe@xxxxxxxxx>
Date: Wed, 11 May 2022 19:54:47 -0700
On Wed, May 11, 2022 at 7:16 PM Riya Dixit <Riya.Dixit@xxxxxxx> wrote:
>
> I am beginner in writing a small dissector for PLDM protocol. And I am stuck at a situation where I should use a byte from a message [request message] and use that byte to dissect another message[response message]. What is the right way to solve it  & is there an example that I can look at to achieve this ?

There are many, many examples. All the files in epan/dissectors/packet_<proto>.c

However, it can be a bit daunting to get started. A very simple one is
epan/dissectors/packet-hyperscsi.c.

You should read doc/README.dissector and perhaps some of the others there.

In any case, if you have registered your dissector correctly, you will
get passed a *tvbuff_t that contains the data in the packet you have
to deal with.

You would use tvb_get_guint8(tvb, offset) to get a byte out of it.
However, it sounds like you need to associate requests and responses
if you need a byte from the request to help dissect the response, in
which case you are going to need to save the info, but that is going
to take more work ...

The dissector I pointed to above does nothing like that.




-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)(传说杜康是酒的发明者)