Help with registration of dissector


#1

I have a program that takes a DeviceNet packet and
puts it inside an Ethernet frame and sends it to a NIC. I want to use
SNAP in order to capture the packet.
I have started the plugin, added it to Wireshark and Wireshark
apparently recognizes the plugin.
But Wireshark captures my Ethernet frames as:
147 7.462071000 00:00:00_00:00:01 00:00:00_00:00:02 LLC 24 U, func=UI;
SNAP, OUI 0x0088A4 (Unknown), PID 0x8833
The OUI and PID are just test numbers that I invented. I try to
register the PID as:
static hf_register_info hf2] = {
{ &hf_llc_devicenet_pid,
{ “PID”, “llc.devicenet_pid”,
FT_UINT16, BASE_HEX, VALS(devicenet_pid_vals), 0,
NULL, HFILL }
}
};
proto_devicenet = proto_register_protocol(“DeviceNet Protocol”,
“Devicenet”, “devicenet”);

  • Ignored:

     proto_register_field_array(proto_devicenet, hf2, array_length(hf2));
    
     register_dissector("devicenet", dissect_devicenet,
             proto_devicenet);
    

    where

    static const value_string devicenet_pid_vals] = {
    { 0x8833, “DeviceNet” },
    { 0, NULL }
    };

    What am I missing? Is it something I don’t understand? How would you do it?