Add a Tvb_reported_len Lua API; this may help satisfy bug 6175.
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 10 Aug 2011 21:45:53 +0000 (21:45 +0000)
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 10 Aug 2011 21:45:53 +0000 (21:45 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@38461 f5534014-38df-0310-8fa8-9805f1628bb7

epan/wslua/wslua_tvb.c

index eca2f5ffeb59a3edf5e68cacf44ac814ec2366c0..89deb5b412a97debc82d2460f7d537b4ff4af7dc 100644 (file)
@@ -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 }
 };