Comment # 10
on bug 3513
from Wenbin Shan
Sorry, it's not a TextWindow, it's a menu.
(In reply to comment #9)
> I am using this workarround. Creage a TextWindow, add Field.New to the
> callback method. now you need to click the menu first before you capture
> anything. if you have start capture or onpened a capture file, you have to
> restart wireshark/tshark.
>
> -- test.lua
> do
> local f_ua = nil
> local f_cg = nil
>
> local function menuable_tap()
> -- ***** the following code is used to set up text windows *****
> -- Declare the window we will use
> tw = TextWindow.new("xxxx")
>
> function remove()
> -- this way we remove the listener that otherwise will remain running
> indefinitely
> f_ua = nil
> f_cg = nil
> tap:remove()
> end
>
> -- we tell the window to call the remove() function when closed
> tw:set_atclose(remove)
>
> -- tap defination
> local tap = Listener.new(tap, "filter");
>
> -- Field references
> -- workaround for re-click menu item.
> if not f_ua and not f_cg then
> f_ua = Field.new("xxxx")
> f_cg = Field.new("xxxx")
> end
>
> -- this function will be called once for each packet
> function tap.packet(pinfo,tvb)
>
> -- get field values
> local ua = f_ua().value
> local cg = f_cg().value
>
> -- dosomething
> end
>
> -- this function will be called once every few seconds to update our window
> function tap.draw(t)
> end
>
> -- this function will be called whenever a reset is needed
> -- e.g. when reloading the capture file
> function tap.reset()
> tw:clear()
> end
> end
>
> -- using this function we register our function
> -- to be called when the user selects the Tools->Test->Super Group Address
> Counter menu
> register_menu("Test/xxxx", menuable_tap, MENU_TOOLS_UNSORTED)
> end
You are receiving this mail because:
- You are the assignee for the bug.
- You are watching all bug changes.