ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] Catch called dissector error....

From: Sebastiano Di Paola <sebastiano.dipaola@xxxxxxxxx>
Date: Sat, 30 Mar 2013 13:09:01 +0100
Hi all,
I would like to know if there is a way to call a dissector and check it's return value..I mean the behavior I would like to achieve is the following...
I have a blob of data that usually is json, but I don't have any chance to know it without trying to parse it...
So I would like to do...

<snip>
decode other part of the packet and create the subtree where to append the maybe json data...

try {
    decode the blob
}
catch { 
    cannot decode...maybe it's not json..or wrongly formatted
    and then append to the current "subtree" as a blob 
}

Is it possible to do it ? I mean trap the json dissector error/execption and then append the undecode/unkonw data as unknown to the same subtree?

Kind regards.
Ciao.
Seba