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.