Wireshark-bugs: [Wireshark-bugs] [Bug 10695] New: Lua Proto:register_heuristic should accept Dis
Bug ID |
10695
|
Summary |
Lua Proto:register_heuristic should accept Dissector object or leave out function entirely
|
Product |
Wireshark
|
Version |
1.12.1
|
Hardware |
x86-64
|
OS |
Debian
|
Status |
UNCONFIRMED
|
Severity |
Normal
|
Priority |
Low
|
Component |
Dissection engine (libwireshark)
|
Assignee |
bugzilla-admin@wireshark.org
|
Reporter |
matthijs@stdin.nl
|
Build Information:
Debian version 1.12.1+g01b65bf-1
wireshark 1.12.1 (Git Rev Unknown from unknown)
Copyright 1998-2014 Gerald Combs <gerald@wireshark.org> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiled (64-bit) with GTK+ 3.12.2, with Cairo 1.12.16, with Pango 1.36.7, with
GLib 2.40.0, with libpcap, with libz 1.2.8, with POSIX capabilities (Linux),
with libnl 3, with SMI 0.4.8, with c-ares 1.10.0, with Lua 5.2, without Python,
with GnuTLS 3.3.7, with Gcrypt 1.6.2, with MIT Kerberos, with GeoIP, with
PortAudio V19-devel (built Feb 15 2014 23:28:00), without AirPcap.
Running on Linux 3.18.0-rc3+, with locale en_US.UTF-8, with libpcap version
1.6.2, with libz 1.2.8, GnuTLS 3.3.7, Gcrypt 1.6.2.
Intel(R) Core(TM) i7 CPU M 620 @ 2.67GHz
Built using gcc 4.9.1.
--
Right now, to add a heuristic dissector from lua, you call
Proto:register_heuristic, specifying the heuristic list name, and the function
to call.
It seems common to want to specify the normall dissector here, but it turns out
that this does not work:
local foo = Proto("foo", "Foo dissector")
function foo.dissector(tvb, pinfo, tree)
end
foo:register_heuristic("wpan", foo.dissector)
This gives:
Lua: Error during loading:
[string "/home/matthijs/.wireshark/plugins/foo.lua"]:6: bad argument #2 to
'register_heuristic' (The heuristic dissector must be a function)
It seems that the Proto.dissector attribute setter expects a lua function, but
the getter returns a Dissector object instead, which is not accepted by
register_heuristic.
To make it work, I need to wrop in a lambda:
foo:register_heuristic("wpan", function(...) foo.dissector(...) end)
I think it makes sense to allow passing a Dissector object to
register_heuristic. Additionally, it would also make sense to make the function
argument optional and just use the dissector associated with the Proto object
by default?
You are receiving this mail because:
- You are watching all bug changes.