Wireshark-dev: Re: [Wireshark-dev] Registering Dissector for Private SNAP PID
From: Christopher Merck <cmerck@xxxxxxxxxxxx>
Date: Wed, 3 Apr 2013 14:42:11 +0000
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;
}





This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If you are not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited.