Wireshark-bugs: [Wireshark-bugs] [Bug 10695] Lua Proto:register_heuristic should accept Dissecto
Date: Mon, 29 Dec 2014 11:29:01 +0000

Comment # 7 on bug 10695 from
> > 	function foo.dissector(tvb, pinfo, tree)
> > 		return true;
> > 	end
> > 
> > 	foo:register_heuristic("wpan", function(...) return foo.dissector(...) end)
> > 
> > Which doesn't affect wpan packet parsing in any way.
> 
> Did your `foo.dissector(...)` return true?

Uh, the return true is right there in the second line above? Or am I
misunderstanding you?

> 
> > This is contrast
> > with:
> > 
> > 	foo:register_heuristic("wpan", function(...) return true; end)
> > 
> > Which should be exactly equivalent, but leaves all wpan packets
> > unparsed.
> 
> Well sure, because the lambda function didn't actually parse/tree-add
> anything.
Neither did foo.dissector in my previous example.


> We're kinda constrained to following how the C-code behaves. For example the
> C-code heuristic dissectors do the parsing/tree-add stuff and return true or
> false, and that's what every C-code protocol expects them to do. For example
> when the UDP protocol C-code calls its table of registered heuristic
> functions (heuristic dissectors of upper-layer protocols that use UDP
> transport), it expects that the called heuristic dissector will either
> return false to mean the packet wasn't for it, or true to mean it was for it
> and that it parsed it.
> 
> I could let the Lua register_heuristic() function accept a Dissector object
> as well, instead of only a Lua function; and then later when it's invoked,
> then if the called Dissector returned 0 it would mean false, and if it's a
> different number then it means true.

Yes, that would make sense to me.


You are receiving this mail because:
  • You are watching all bug changes.