diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2014-06-15 21:53:47 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-06-17 17:16:56 +0000 |
commit | 8c0d3ae47e35f6692b91ab776919391f52700829 (patch) | |
tree | 457e4395d5ec0f2fb5775b7fbb24b8cd444f72a9 /epan/wslua | |
parent | 647255d6279fe6fea6ad43388a52e55afd5549e0 (diff) |
Return number of bytes dissected in dissector:call
This does not work for old-style dissectors as they always return
the number of bytes in incoming buffer and not the number of bytes
dissected. This is noted in the documentation.
Change-Id: I5b236a73952cac3efc830e40276283bed9af1f87
Reviewed-on: https://code.wireshark.org/review/2237
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/wslua')
-rw-r--r-- | epan/wslua/wslua_proto.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c index 8ac9c1de4a..17a8e7a869 100644 --- a/epan/wslua/wslua_proto.c +++ b/epan/wslua/wslua_proto.c @@ -2086,11 +2086,12 @@ WSLUA_METHOD Dissector_call(lua_State* L) { Pinfo pinfo = checkPinfo(L,WSLUA_ARG_Dissector_call_PINFO); TreeItem ti = checkTreeItem(L,WSLUA_ARG_Dissector_call_TREE); const char *volatile error = NULL; + int ret = 0; if (! ( d && tvb && pinfo) ) return 0; TRY { - call_dissector(d, tvb->ws_tvb, pinfo->ws_pinfo, ti->tree); + ret = call_dissector(d, tvb->ws_tvb, pinfo->ws_pinfo, ti->tree); /* XXX Are we sure about this??? is this the right/only thing to catch */ } CATCH_NONFATAL_ERRORS { show_exception(tvb->ws_tvb, pinfo->ws_pinfo, ti->tree, EXCEPT_CODE, GET_MESSAGE); @@ -2099,7 +2100,8 @@ WSLUA_METHOD Dissector_call(lua_State* L) { if (error) { WSLUA_ERROR(Dissector_call,error); } - return 0; + lua_pushnumber(L,(lua_Number)ret); + WSLUA_RETURN(1); /* Number of bytes dissected. Note that some dissectors always return number of bytes in incoming buffer, so be aware. */ } WSLUA_METAMETHOD Dissector__call(lua_State* L) { |