Thanks a lot for guiding me, it really helped me.
I am running into an error, I created a file packet-pldm-base.c and made its declaration in cmakelist.txt as we do for any other dissector but I am getting error while doing "make"( pfa image).
I have attached image of proto_register and proto_register_handoff of both the files.
In dissector_add_uint() should the first two field be same for both dissector or wht way they should be.
It will be great if you could guide me please.
-----Original Message-----
From: Wireshark-dev <wireshark-dev-bounces@xxxxxxxxxxxxx> On Behalf Of Guy Harris
Sent: 21 July 2022 13:35
To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
Subject: [EXTERNAL] Re: [Wireshark-dev] splitting dissector code
On Jul 21, 2022, at 12:31 AM, Riya Dixit <Riya.Dixit@xxxxxxx> wrote:
> You are referring to right document, can I not have one main file dissecting up till the common byte for all pldm message and them write a different function for different spec like bios, base in different files and call that function in the main dissector code.
Yes, you can. For dissecting IPv4, packet-ip.c dissects the IPv4 header, and then calls different functions, depending on the protocol number in the IPv4 header, and passes it what remains of the packet after the IPv4 header; those other functions are in other files.
In the case of PLDM, the base level dissector (registered by proto_register_pldm() and proto_register_handoff_pldm(), in the source file packet-pldm.c) would dissect everything up to the PLDM Type field. Then, based on the value of that field, it would choose the appropriate named field for the PLDM Command Code field (as the meanings of particular values for that field depend on the type) and dissect that, and, for a response, do the same for the PLDM Completion Code field.
The base-level dissector would register a dissector table for each type; that would allow the source file for a particular type to register dissectors for particular command types for that type. The base-level dissector would then pick the appropriate dissector table, based on the type, and look up the command code in that dissector table and call the appropriate dissector, passing it a tvbuff containing the PLDM Message Payload.
The dissectors for PLDM Messaging Control and Discovery payloads would presumably be in the packet-pldm.c file, as those payloads are defined by the base specification.
The dissectors for other types would be in their own files, and would register their payload dissectors in the appropriate dissector table for that type. Those files would have their own proto_register and proto_register_handoff routines, which would *not* be called proto_register_pldm() and proto_register_handoff_pldm() - they would have names such as, for example, proto_register_pldm_bios_c_and_c() and proto_register_handoff_pldm_c_and_c().
___________________________________________________________________________
Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives: https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
Attachment:
Screenshot 2022-07-26 125237.png
Description: Screenshot 2022-07-26 125237.png
Attachment:
Screenshot (359).png
Description: Screenshot (359).png
Attachment:
Screenshot (360).png
Description: Screenshot (360).png