Hi. I want to ask about the tap.packet functions. I have two listeners one for outbound traffic and the other for the inbound. Unfortunately, the examples of using Lua with wireshark are limited and I didn't find documentation talks about the scope of tap functions and why they are written like that; I mean the use of local init_listener()function or any other function the script start with, and why it is local and functions like: tap.packet and tap.draw as example are global inside these functions, does this mean something I should care about ? I tried to process online data using directly the tap.packet function without inserting it inside a local function as the examples I saw, is it just as convention or it has an effect on the performance of the program in some views? What is the benefit of writing the lua program with wireshark like this?? and I need any advice about using two listeners if there are any points I should care about, especially when I use data from one of the tap.packet function to be benefited from by the other tap.packet functions, Is there any advice about these listeners? Thanks alot. asked 05 Dec '12, 11:01 Leena edited 06 Dec '12, 19:26 |
One Answer:
There are several reasons to prefer In addition, The tap definitions don't need to be A
In the Lua example (from the Wiki), Note that it's a syntax error to write:
(but the answered 05 Dec '12, 19:13 helloworld Thanks a lot helloworld, you really helped, May God bless you. (05 Dec '12, 21:31) Leena Can I skip the step of making a function contains all the funcions inside like init_Listener() and just write the functions inside the "do..end" and declare the tap as a local inside the "do..end", I want to know exactly what is the job of this main function since "do..end" wrap the variables, is it just the style of writing a program or there is a benefit from programming view?? (05 Dec '12, 21:37) Leena 1 Yes, you can declare your tap outside of a function. It really comes down to your specific requirements and what works best for you. (06 Dec '12, 17:52) helloworld 1 Declaring your tap inside a function doesn't look very useful, especially in the Wiki example, but there are some advantages to this:
(06 Dec '12, 17:53) helloworld 1
(06 Dec '12, 17:53) helloworld Thanks a lot.Your explanation is clear and rich. (06 Dec '12, 19:10) Leena showing 5 of 6 show 1 more comments |
Is it enough and safe to use the tap functions and functions use their outputs inside a "do..end" since I'm working online, without putting them inside a local function and call it at the end of the script??