diff options
author | Balint Reczey <balint.reczey@ericsson.com> | 2008-12-30 12:49:42 +0000 |
---|---|---|
committer | Balint Reczey <balint.reczey@ericsson.com> | 2008-12-30 12:49:42 +0000 |
commit | 315c36c84761cbfb64b9f73922fac2bfb6bf18b6 (patch) | |
tree | abd14b426e791bcd6c6600d20e0050edf4f35b1e /epan | |
parent | 4dab0f663e5b6430ea9ef12bd5ebd7bec4ce1252 (diff) |
From yami <yamisoe@gmail.com>:
Expose pinfo->private_data to lua interface.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3129
svn path=/trunk/; revision=27132
Diffstat (limited to 'epan')
-rw-r--r-- | epan/wslua/wslua_pinfo.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c index cd58c59486..ff0eaf0d9f 100644 --- a/epan/wslua/wslua_pinfo.c +++ b/epan/wslua/wslua_pinfo.c @@ -634,6 +634,17 @@ static int Pinfo_tostring(lua_State *L) { lua_pushstring(L,"a Pinfo"); return 1; return 1; \ } +#define PINFO_GET_LIGHTUSERDATA(name, val) static int name(lua_State *L) { \ + Pinfo pinfo = checkPinfo(L, 1); \ + if (!pinfo) return 0; \ + if (pinfo->expired) { \ + luaL_error(L, "expired_pinfo"); \ + return 0; \ + } \ + lua_pushlightuserdata(L, (void *) (val)); \ + return 1; \ +} + PINFO_GET_NUMBER(Pinfo_number,pinfo->ws_pinfo->fd->num) PINFO_GET_NUMBER(Pinfo_len,pinfo->ws_pinfo->fd->pkt_len) PINFO_GET_NUMBER(Pinfo_caplen,pinfo->ws_pinfo->fd->cap_len) @@ -658,6 +669,8 @@ PINFO_GET_ADDRESS(Pinfo_dl_dst,dl_dst) PINFO_GET_ADDRESS(Pinfo_src,src) PINFO_GET_ADDRESS(Pinfo_dst,dst) +PINFO_GET_LIGHTUSERDATA(Pinfo_private_data, pinfo->ws_pinfo->private_data) + static int Pinfo_visited(lua_State *L) { Pinfo pinfo = checkPinfo(L,1); if (!pinfo) return 0; @@ -939,6 +952,9 @@ static const pinfo_method_t Pinfo_methods[] = { /* WSLUA_ATTRIBUTE Pinfo_desegment_offset RW Offset in the tvbuff at which the dissector will continue processing when next called*/ {"desegment_offset", Pinfo_desegment_offset, Pinfo_set_int, PARAM_DESEGMENT_OFFSET }, + /* WSLUA_ATTRIBUTE Pinfo_private_data RO Access to private data */ + {"private_data", Pinfo_private_data, pushnil_param, PARAM_NONE}, + {NULL,NULL,NULL,PARAM_NONE} }; |