2015-12-15 11:37 GMT+01:00 Sebastian Schildt <[email protected]>:
>
> Hello Wiresharkers,
>
> I have a problem (obviously :) ) . I want to create a CAN dissector (in
> Lua). What I already achieved is creating a Can subdissector: So my
> dissector gets called for CAN payload. However, I need access to the CAN
> identfier, so I figured my dissector needs to be on the same "level" as the
> CAN dissector (right?)
>
> Therefore I tried to use the "chained dissector" pattern, where my
> dissector would call the CAN dissector and then does some further
> processing. For this my dissector must call the CAN dissector, but I do not
> know how to get a reference to it.
>
> I tried
>
> original_can_dissector = Dissector.get("CAN")
> or
> original_can_dissector = Dissector.get("can")
>
> that did not work, then I used lua to print
>
> for key,value in pairs(Dissector.list()) do print(key,value) end
>
> but I did not find any reference to CAN. Is the CAN dissector hidden in
> some DissectorTable? But then which one? I couldn't find it.
>
> The relevant lines in the C code seem to be
> proto_can = proto_register_protocol(
> "Controller Area Network", /* name */
> "CAN", /* short name */
> "can" /* abbrev */
> );
> And
> dissector_handle_t can_handle;
>
> can_handle = create_dissector_handle(dissect_socketcan, proto_can);
> dissector_add_uint("wtap_encap", WTAP_ENCAP_SOCKETCAN, can_handle);
> dissector_add_uint("sll.ltype", LINUX_SLL_P_CAN, can_handle);
>
> but I am not very familiar with Wireshark source, so I am guestimating
> here.
> Also, after solving the problem of getting a reference to the original CAN
> dissector I guess I need to replicate the add_uint calls in Lua to register
> my own dissector. If anyone has the correct syntax up his sleeve I'd also
> appreciate it :)
>
Hi Sebastian,
The CAN dissector does not register itself by name (no call to
register_dissector() function), so as you noticed you will not find it on
the list.
The best way to move forward would be be to contribute to Wireshark so as
to add the missing register_dissector function call. But it will be only
added to the development tree (Wireshark 2.1) and not backported to stable
releases as I do not think it will be considered as a fix, but an
enhancement.
Regards,
Pascal.
___________________________________________________________________________
Sent via: Wireshark-dev mailing list <[email protected]>
Archives: https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
mailto:[email protected]?subject=unsubscribe