LUA CAN SubDissector get CAN_ID
Is it possible to get the parent dissector data into the child dissector? More specifically, I am trying to write a can dissector for a custom CAN protocol, but I need the CAN SID in order to fully dissect the data.
I've tried several things to get there, including chaining it under different dissectors, but without any luck.
The simplified setup I've got so far:
```lua
local custom_can = Proto("custom-can","Custom CAN Protocol")
function custom_can.dissector(tvbuf,pktinfo,root)
-- Here I want to get the CAN ID...
end
DissectorTable.get("can.subdissector"):add_for_decode_as(custom_can)
```
I've also tried it with the can.id parent dissector:
``` lua
DissectorTable.get("can.id"):add('0-6', custom_can)
```
Again without any luck.
I do not want to write a complete can dissector from scratch if possible, just add it on top of the existing CAN dissector. However as far as I can see, I only get the data section from a CAN frame in the subdissector?
In C there is an option to get a void pointer and cast that to a can struct, but I do want to do it in lua if possible.: C-canopen-dissector
Is there a way to accomplish this in lua?
Thanks in advance for any help!