aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2011-08-10 21:45:53 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2011-08-10 21:45:53 +0000
commit4ee1d732fb3d30006233731266ae5f14c59d7a6c (patch)
treed52a02b3b5f8d36b1b2a3c4bc932e7d65101d61f /epan/wslua
parentc832e7a28e6911ae15617cd7831fcc95ec8393fe (diff)
Add a Tvb_reported_len Lua API; this may help satisfy bug 6175.
svn path=/trunk/; revision=38461
Diffstat (limited to 'epan/wslua')
-rw-r--r--epan/wslua/wslua_tvb.c15
1 files changed, 15 insertions, 0 deletions
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 }
};