forked from osmocom/wireshark
- 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
This commit is contained in:
parent
2ca04c0092
commit
0b2d1add6f
|
@ -240,9 +240,9 @@ static int Dumper_dump(lua_State* L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Dumper_new_for_current(lua_State* L) {
|
static int Dumper_new_for_current(lua_State* L) {
|
||||||
Dumper d = checkDumper(L,1);
|
Dumper d;
|
||||||
const char* filename = luaL_checkstring(L,2);
|
const char* filename = luaL_checkstring(L,1);
|
||||||
int filetype = luaL_optint(L,3,WTAP_FILE_PCAP);
|
int filetype = luaL_optint(L,2,WTAP_FILE_PCAP);
|
||||||
int encap;
|
int encap;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,8 @@ static int Field_fetch (lua_State* L) {
|
||||||
return 0;
|
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");
|
luaL_error(L,"fields cannot be used outside dissectors or taps");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +258,7 @@ int tap_packet_cb_error_handler(lua_State* L) {
|
||||||
last_error = g_strdup(error);
|
last_error = g_strdup(error);
|
||||||
repeated = 0;
|
repeated = 0;
|
||||||
next = 2;
|
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;
|
return 0;
|
||||||
|
@ -282,6 +283,7 @@ int lua_tap_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const
|
||||||
|
|
||||||
lua_pinfo = pinfo;
|
lua_pinfo = pinfo;
|
||||||
lua_tvb = edt->tvb;
|
lua_tvb = edt->tvb;
|
||||||
|
lua_tree = edt->tree;
|
||||||
|
|
||||||
switch ( lua_pcall(tap->L,3,1,1) ) {
|
switch ( lua_pcall(tap->L,3,1,1) ) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -307,6 +309,7 @@ int lua_tap_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const
|
||||||
|
|
||||||
lua_pinfo = NULL;
|
lua_pinfo = NULL;
|
||||||
lua_tvb = NULL;
|
lua_tvb = NULL;
|
||||||
|
lua_tree = NULL;
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue