Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] [RFC] CANOpen dissector

From: Stephen Fisher <steve@xxxxxxxxxxxxxxxxxx>
Date: Fri, 2 Dec 2011 09:48:50 -0700
On Fri, Dec 02, 2011 at 04:21:15PM +0100, Yegor Yefremov wrote:

> I'm writing a CANOpen dissector 
> (http://en.wikipedia.org/wiki/CANopen). The dissector itself is almost 
> ready. The main problem I have is, how do I hook this dissector on to 
> SocketCan one? CAN has no ports, so I can't decide on this basis. My 
> suggestion were to create a drop-down list in SocketCan dissector to 
> select high-level CAN protocol (like CANOpen, DeviceNet etc.). What do 
> you think about this?

Does the SocketCan protocol have any indication which protocol is next 
(CANOpen, DeviceNet, etc)?  If so, you can use the call_dissector() to 
pass a tvbuff to the next dissector (from SocketCan to CANOpen for 
example).  You would "break off" the rest of the packet that SocketCan 
is dissecting with something like tvb_new_subset() which creates a new 
tvbuff out of a backing tvbuff based on certain offset and length.