diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2019-06-12 09:53:08 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-06-14 13:39:27 +0000 |
commit | bf8bc8e007ef8c12e79f95d97b3cf5868a7f671f (patch) | |
tree | e9ab4c521f69c7ec0215a0c5b032049b7f58a848 /epan/wslua | |
parent | 24138a0a7436fa6a456a317ba1f95fab55c275b7 (diff) |
wslua: add support for ft_none dissector tables
The C code introduced ft_none dissector tables some time ago. They have
no indicator to select the next protocol, only Decode As is supported
for them.
Allow lua code to create ft_none dissector tables as well. The patch
is trying to make as few changes as possible to DissectorTable_new().
Change-Id: Ie3ff58f092e6922ab7878d202c7484a64b2430a3
Reviewed-on: https://code.wireshark.org/review/33588
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/wslua')
-rw-r--r-- | epan/wslua/wslua_dissector.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/epan/wslua/wslua_dissector.c b/epan/wslua/wslua_dissector.c index 2deae54733..0d7590e6ec 100644 --- a/epan/wslua/wslua_dissector.c +++ b/epan/wslua/wslua_dissector.c @@ -19,6 +19,7 @@ #include "wslua.h" +#include <epan/decode_as.h> #include <epan/exceptions.h> #include <epan/show_exception.h> @@ -179,6 +180,8 @@ WSLUA_CONSTRUCTOR DissectorTable_new (lua_State *L) { case FT_STRING: base = BASE_NONE; /* fallthrough */ + case FT_NONE: + /* fallthrough */ case FT_UINT8: case FT_UINT16: case FT_UINT24: @@ -190,7 +193,9 @@ WSLUA_CONSTRUCTOR DissectorTable_new (lua_State *L) { ui_name = g_strdup(ui_name); /* XXX - can't determine dependencies of Lua protocols if they don't provide protocol name */ - dt->table = register_dissector_table(name, ui_name, -1, type, base); + dt->table = (type == FT_NONE) ? + register_decode_as_next_proto(-1, name, ui_name, NULL) : + register_dissector_table(name, ui_name, -1, type, base); dt->name = name; dt->ui_name = ui_name; dt->created = TRUE; @@ -205,7 +210,7 @@ WSLUA_CONSTRUCTOR DissectorTable_new (lua_State *L) { } WSLUA_RETURN(1); /* The newly created DissectorTable. */ default: - WSLUA_OPTARG_ERROR(DissectorTable_new,TYPE,"must be ftypes.UINT{8,16,24,32} or ftypes.STRING"); + WSLUA_OPTARG_ERROR(DissectorTable_new,TYPE,"must be ftypes.UINT{8,16,24,32}, ftypes.STRING or ftypes.NONE"); break; } return 0; |