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] Chained CAN dissecector: Can not get reference for CAN disse

From: Sebastian Schildt <sebastian@xxxxxxxxxxxxxx>
Date: Tue, 15 Dec 2015 14:38:13 +0100
Hi,

Thanks for the answers, now I at least understand what is going on. Unfortunately it seems,  the data parameter in the dissector call is not promoted to Lua (maybe somthing for another enhancement :) ). So I will probably try to implement Pascal's solution first.

Sebastian

Am 15.12.2015 um 12:53 schrieb Michael Mann <mmann78@xxxxxxxxxxxx>:

The CAN ID is passed as the "data" parameter to the subdissector from the CAN dissector.  The C code of a subdissector to handle it would be as follows:
 
struct can_identifier
{
    guint32 id;
};
 
static int subdissector_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
    struct can_identifier can_id;
    can_id = *((struct can_identifier*)data);
    if (can_id.id != 42)
    {
        return 0;
    }
    ...
}
 
I'm not as familiar with Lua to know how to setup the equivalent, but you shouldn't need to "override" the CAN dissector to get the CAN ID.