From: morriss Date: Wed, 10 Aug 2011 21:45:53 +0000 (+0000) Subject: Add a Tvb_reported_len Lua API; this may help satisfy bug 6175. X-Git-Url: http://git.samba.org/samba.git/?p=obnox%2Fwireshark%2Fwip.git;a=commitdiff_plain;h=567251a3145da332887f32fc23bcfbe894488950 Add a Tvb_reported_len Lua API; this may help satisfy bug 6175. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@38461 f5534014-38df-0310-8fa8-9805f1628bb7 --- diff --git a/epan/wslua/wslua_tvb.c b/epan/wslua/wslua_tvb.c index eca2f5ffeb..89deb5b412 100644 --- a/epan/wslua/wslua_tvb.c +++ b/epan/wslua/wslua_tvb.c @@ -450,6 +450,20 @@ static int Tvb__gc(lua_State* L) { } +WSLUA_METHOD Tvb_reported_len(lua_State* L) { + /* Obtain the reported length of a TVB */ + Tvb tvb = checkTvb(L,1); + + if (!tvb) return 0; + if (tvb->expired) { + luaL_error(L,"expired tvb"); + return 0; + } + + lua_pushnumber(L,tvb_reported_length(tvb->ws_tvb)); + WSLUA_RETURN(1); /* The length of the Tvb. */ +} + WSLUA_METHOD Tvb_len(lua_State* L) { /* Obtain the length of a TVB */ Tvb tvb = checkTvb(L,1); @@ -563,6 +577,7 @@ static const luaL_reg Tvb_methods[] = { {"range", Tvb_range}, {"len", Tvb_len}, {"offset", Tvb_offset}, + {"reported_len", Tvb_reported_len}, { NULL, NULL } };