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] Registering Dissector for Private SNAP PID

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Wed, 03 Apr 2013 23:44:20 +0200
Hi,

Have a look at epan/dissectors/packet-hpteam.c for instance. It's just a
reference to the header field for the representation of your PIDs.

Thanks,
Jaap


On 04/03/2013 04:42 PM, Christopher Merck wrote:
> On 2013-03-05, Guy Harris wrote:
>> On Mar 5, 2013, at 5:39 AM, Christopher Merck <cmerck@xxxxxxxxxxxx>
>> wrote:
>>>  I believe the correct way to proceed is to register a new dissector
>> table along the lines of "llc.oui",
>>
>> I believe the correct way to proceed would be to add llc_add_oui() to
>> the Lua API, so that Lua dissectors that need to handle a not-already-
>> registered OUI can register that OUI, including a new dissector table
>> for PIDs in that OUI, and then a dissector (no matter what language it's
>> in) could register in that table.
> 
> I almost have this working. But what I don't understand is the fourth argument to llc_add_oui. That structure contains a list of PIDs to register and the table name. However, when I am registering the OUI I don't want to register any PIDs yet, and I have already specified the table_name as the second argument to llc_add_oui.
> 
> So, I'm trying to stuff some dummy data into hf_pid, but I get segfaults or assertion errors at runtime.
> 
> Any idea what I'm missing?
> 
> Thanks,
>  Chris
> 
> ---
> 
> WSLUA_FUNCTION wslua_llc_add_oui(lua_State* LS) { /* registers a new OUI for LLC/SNAP purposes */
> #define WSLUA_ARG_llc_add_oui_OUI 1             /* OUI to register */
> #define WSLUA_ARG_llc_add_oui_TABLE_NAME 2      /* name of table to register, should be of the form: llc.<ouiname>_pid*/
> #define WSLUA_ARG_llc_add_oui_TABLE_UI_NAME 3   /* name to display in GUI */
>         lua_Number oui = luaL_checknumber(LS,WSLUA_ARG_llc_add_oui_OUI);
>         const gchar* table_name = luaL_checkstring(LS,WSLUA_ARG_llc_add_oui_TABLE_NAME);
>         const gchar* table_ui_name = luaL_checkstring(LS,WSLUA_ARG_llc_add_oui_TABLE_UI_NAME);
> 
>         const value_string oui_pid_vals[] = { { 0, NULL } };
>         gint hf_llc_oui_pid = -1;
>         hf_register_info hf_pid = {
>                 &hf_llc_oui_pid,
>                 { "PID", NULL /*table_name*/,
>                   FT_UINT16, BASE_HEX, VALS(oui_pid_vals),
>                   0x0, NULL, HFILL }
>         };
>         hf_pid.hfinfo.abbrev = table_name;
> 
> /*
> void
> llc_add_oui(guint32 oui, const char *table_name, const char *table_ui_name,
>     hf_register_info *hf_item)
> */
> 
>       // TODO: What do to about the fourth argument?
> 
>         llc_add_oui(oui, table_name, table_ui_name, &hf_pid);
> 
>         return 0;
> }
> 
> 
>