# Revision history [back]

### Can I create a subdissector based on CAN ID?

Hi,

in my previous approaches I tried to create a dissector which should decode the payload of CAN messages. The implemented socketCAN dissector allows only the option to trigger my subdissector with the "decode as" preference option. But in my case I want to decode automatically on specific CAN IDs.

Possible:

dissector_add_for_decode_as("can.subdissector", myDissector_handle);


Not possible:

 dissector_add_uint("can.id", 0x01, myDissector_handle);


What changes I have to do in the socketCAN dissector (packet-socketcan.c) to allow calling subdissectors with can id?

Simply add subdissector_table = register_dissector_table("can.id", "CAN ID", proto_can, FT_UINT32, BASE_HEX); in proto_register_socketcan function doesn't work.