aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/init_wslua.c
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2015-07-08 15:20:50 -0400
committerHadriel Kaplan <hadrielk@yahoo.com>2015-07-09 01:49:11 +0000
commit281055af9ccdd701ba18accb39f3d25ab77168df (patch)
tree1471e64a629d3b02ac76077c256eb6cebb2f23fa /epan/wslua/init_wslua.c
parent7b85f62ba3fe95e20004c31165c989a4fd29beb3 (diff)
Lua: add functions for more field information
Add Lua functions so a plugin can introspect field information, such as the type of field, flags, tvb, etc. Also add a couple of Tvb and ByteArray methods. And cleanup the TreeItem code a little. Change-Id: I7b58ce589ace91cce14b8abccd01ceabb63e2653 Reviewed-on: https://code.wireshark.org/review/6500 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
Diffstat (limited to 'epan/wslua/init_wslua.c')
-rw-r--r--epan/wslua/init_wslua.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/epan/wslua/init_wslua.c b/epan/wslua/init_wslua.c
index 90b9e43d6a..fd42080ada 100644
--- a/epan/wslua/init_wslua.c
+++ b/epan/wslua/init_wslua.c
@@ -163,9 +163,6 @@ int dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data
lua_pinfo = pinfo;
lua_tvb = tvb;
- lua_tree = create_TreeItem(tree, proto_tree_add_item(tree, hf_wslua_fake, tvb, 0, 0, ENC_NA));
- PROTO_ITEM_SET_HIDDEN(lua_tree->item);
-
/*
* almost equivalent to Lua:
* dissectors[current_proto](tvb,pinfo,tree)
@@ -185,7 +182,8 @@ int dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data
push_Tvb(L,tvb);
push_Pinfo(L,pinfo);
- push_TreeItem(L,lua_tree);
+ lua_tree = push_TreeItem(L, tree, proto_tree_add_item(tree, hf_wslua_fake, tvb, 0, 0, ENC_NA));
+ PROTO_ITEM_SET_HIDDEN(lua_tree->item);
if ( lua_pcall(L,3,1,0) ) {
proto_tree_add_expert_format(tree, pinfo, &ei_lua_error, tvb, 0, 0, "Lua Error: %s", lua_tostring(L,-1));
@@ -278,12 +276,10 @@ gboolean heur_dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, v
return FALSE;
}
- lua_tree = create_TreeItem(tree, proto_tree_add_item(tree, hf_wslua_fake, tvb, 0, 0, ENC_NA));
- PROTO_ITEM_SET_HIDDEN(lua_tree->item);
-
push_Tvb(L,tvb);
push_Pinfo(L,pinfo);
- push_TreeItem(L,lua_tree);
+ lua_tree = push_TreeItem(L, tree, proto_tree_add_item(tree, hf_wslua_fake, tvb, 0, 0, ENC_NA));
+ PROTO_ITEM_SET_HIDDEN(lua_tree->item);
if ( lua_pcall(L,3,1,0) ) {
proto_tree_add_expert_format(tree, pinfo, &ei_lua_error, tvb, 0, 0,