ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Dissector Registration Query

From: "Jaap Keuter" <jaap.keuter@xxxxxxxxx>
Date: Wed, 23 Jul 2008 07:23:53 +0200
Hi,
 
What about this
 
  dissect_my_protocol(...., gboolean tcp)
  {
    ....
  }
 
  dissect_my_protocol_tcp(....)
  {
    dissect_my_protocol(....., TRUE);
  }
  dissect_my_protocol_udp(....)
  {
    dissect_my_protocol(....., FALSE);
  }
 
  heur_dissector_add("tcp", dissect_my_protocol_tcp, proto_myprotocol);
  heur_dissector_add("udp", dissect_my_protocol_udp, proto_myprotocol);
 
Thanx,
Jaap

From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Kumar, Hemant
Sent: 2008-Jul-23 02:11
To: wireshark-dev@xxxxxxxxxxxxx
Subject: [Wireshark-dev] Dissector Registration Query

Hello All

 

I just wanted to know whether we can register our plugin dissector with Multiple protocols.

Basically my dissector should be able to dissect both UDP  and TCP packet payload.

I am implementing it as a Heuristic dissector  by :--

 

heur_dissector_add("tcp", dissect_mprotocol, proto_myprotocol);

 

 

If I add a line  heur_dissector_add("udp", dissect_mprotocol, proto_myprotocol);

Then will it work fine. If it does works then , once UDP and TCP throws the payload to my dissector

For dissection how I can confirm whether it is UDP or TCP based traffic once inside the main dissector

Function in the plugin .

 

 

Hoping to get a quick response on this.

 

Thanks a lot!!

 

Hemant