aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/lua
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2006-02-17 16:16:42 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2006-02-17 16:16:42 +0000
commit0b2d1add6f8fedefc984930349b059dc8a0bc3b2 (patch)
tree93c4ab269b6f018d67a38dcc0d4944e6fd57dcea /plugins/lua
parent2ca04c00920dbadc54076ff29f32a8432382e7cb (diff)
- Make sure the right globals are set before invoking user tap caallbaccks
- Have Dumper.new_for_current() and dumper:dump_current() work. svn path=/trunk/; revision=17336
Diffstat (limited to 'plugins/lua')
-rw-r--r--plugins/lua/lua_dumper.c6
-rw-r--r--plugins/lua/lua_tap.c9
2 files changed, 9 insertions, 6 deletions
diff --git a/plugins/lua/lua_dumper.c b/plugins/lua/lua_dumper.c
index 1d66837746..0e29a15112 100644
--- a/plugins/lua/lua_dumper.c
+++ b/plugins/lua/lua_dumper.c
@@ -240,9 +240,9 @@ static int Dumper_dump(lua_State* L) {
}
static int Dumper_new_for_current(lua_State* L) {
- Dumper d = checkDumper(L,1);
- const char* filename = luaL_checkstring(L,2);
- int filetype = luaL_optint(L,3,WTAP_FILE_PCAP);
+ Dumper d;
+ const char* filename = luaL_checkstring(L,1);
+ int filetype = luaL_optint(L,2,WTAP_FILE_PCAP);
int encap;
int err = 0;
diff --git a/plugins/lua/lua_tap.c b/plugins/lua/lua_tap.c
index 8a57b519b1..1f8dcbb895 100644
--- a/plugins/lua/lua_tap.c
+++ b/plugins/lua/lua_tap.c
@@ -116,7 +116,8 @@ static int Field_fetch (lua_State* L) {
return 0;
}
- if (! lua_tree ) {
+ if (! lua_pinfo ) {
+ g_warning("pinfo: %p",lua_pinfo);
luaL_error(L,"fields cannot be used outside dissectors or taps");
return 0;
}
@@ -257,7 +258,7 @@ int tap_packet_cb_error_handler(lua_State* L) {
last_error = g_strdup(error);
repeated = 0;
next = 2;
- report_failure("Lua: on packet %i Error During execution of Tap Packet Callback:\n %s",error);
+ report_failure("Lua: on packet %i Error During execution of Tap Packet Callback:\n %s",lua_pinfo->fd->num,error);
}
return 0;
@@ -282,6 +283,7 @@ int lua_tap_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const
lua_pinfo = pinfo;
lua_tvb = edt->tvb;
+ lua_tree = edt->tree;
switch ( lua_pcall(tap->L,3,1,1) ) {
case 0:
@@ -307,7 +309,8 @@ int lua_tap_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const
lua_pinfo = NULL;
lua_tvb = NULL;
-
+ lua_tree = NULL;
+
return retval;
}