ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: [Ethereal-dev] Re: [Ethereal-cvs] rev 17057: /trunk/plugins/lua/: Makefile.am pa

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

Date: Fri, 20 Jan 2006 01:33:15 +0100
Hi List,

For the last few days I've been working in embedding Lua (a
programming language) into ethereal.

Info about Lua can be found in http://www.lua.org .

I choose Lua because I found it preety easy to embed (so far less than
2K lines of straightforrward C). Because it implements references to
functions (Callbacks) which are very essential to ethereal's model.
And mainly because embeding it took me a fraction of the time it has
taken me just to begin the fruitless developement of  an ethereal
specific language, and last but not leaast because it is already
documented.

So far I've implemented the minimum needed to write a dissector in
Lua. attached you'll find one.
The .lua file (only one so far) can be ~/.ethereal/init.lua or any
file as far as you pass the full pathname via environment variable
ETHEREAL_LUA_INIT.

To get it to work you need to download lua-5.0.2.tar.gz into the
plugin/lua directory, uncompress it, cd to it and call make (at least
on my mac). Ah, you need to modify the makefiles too.

The "classes" for Lua I've created so far are:

ValueString -- a class to manage value_strings
   :new() -- create a new empty Valuetring
   :add(val,str) -- add a value-string pair to a ValueString
   :match(val) -- a wrapper arroud val_to_str()

Field -- a class that represents registration info of fields.
   :new(name,fieldname,...) declare a field (both the hfid and the
registration info)

FieldArray -- a class that represents the field_array of a protocol.
   :new()  -- creates an empty field array to start with
   :add(field) -- adds a field to the array

Ett -- a class to represent an ett
  :new() -- create an ett

EttArray -- a class that represents the ett array for a protocol
   :new() -- creates an empty array
   :add(ett) -- adds an Ett to it
   :register() -- registers the ett array with ethereal

Proto -- a class that represents protocol info in ethereal
  :new(name,filter_name,descr) -- creates and registers a new protocol
  :register_field_array(field_array) -- registers a field array as
this protocol's fa
  :add_uint_pref(abbr,...) -- adds an uint preference to this protocol
  :add_bool_pref(abbr,...) -- adds a string preference to this protocol
  :add_string_pref(abbr,...) -- adds an bool preference to this protocol
  :get_pref(abbr) -- fetches the value of a preference

DissectorTable -- a class to intreface to dissector tables
  :new(name,ui_name,type,opt_base) -- create a dissector table for
others to register
  :get(name) -- obtain a reference to another's dissector table
  :add(pattern,proto) -- add a protocol to a table (*)
  :try(pattern,tvb,pinfo,tree) -- try to invoke a dissector through a table

Dissector -- a class that represent another dissector
 :get(name) -- wraps find_dissector
 :call(tvb,pinfo,tree) -- calls a dissector

Tvb -- a class that represents a tvb
  :new(tvb,opt_offset,opt_len) -- creates a subset tvb
  :get_* -- wrappers to tvb_get_* functions

Pinfo -- a class that represents a packet_info structure
  :number -- the frame number
  :len -- the frame len
  :caplen -- the frame capture len
  :abs_ts -- absolute timestamp a floating number (s + ns/10^9)
  :rel_ts -- relative timestamp
  :delta_ts -- delta
  :visited -- pinfo->fd->flags.visited
  :src_address -- so far a string representing the address
  :dst_address -- we need an adress class!
  :dl_src
  :dl_dst
  :net_src
  :net_dst
  :ipproto
  :circuit_id
  :ptype
  :match_port
  :match_string
  :curr_proto
  :col -- colifo = pinfo:col(COL_INFO)

Column -- a class that represents a column
   :clear
   :set
   :append
   :prepend

Tree -- a class that represents a proto_tree
  :add_item -- overeloaded to accept many types of items, stil incomplete
  :add_item_le -- same thing but little_endian
  :get_parent -- yields the parent Item

Item -- a class that represents a proto_item
  :add_subtree
  :set_text
  :append_text
  :set_len
  :set_expert_flags
  :set_generated
  :set_hidden

On 1/20/06, lego@xxxxxxxxxxxx <lego@xxxxxxxxxxxx> wrote:
> User: lego
> Date: 2006/01/19 06:06 PM
>
> Log:
>  Starts to work so I check it in.
>
>  This is an interface to the Lua programming language.
>
>  http://www.lua.org
>
>  I've already wrote a simple dissector that calls another dissectors.
>
>  soon It will be able to register a tap and do something more.
>
>  I did not checkin changes to the Makefiles so in order to use it you must change the makefiles.
>
>  Other than that to get it to work you need to download lua-5.0.2.tar.gz into the plugin directory, uncompress it, cd to it and call make.
>
>  the interface is buggy and far from finished, time will help on this.
>
> Directory: /trunk/plugins/lua/
>   Changes    Path            Action
>   +58 -0     Makefile.am     Added
>   +1977 -0   packet-lua.c    Added
>   +45 -0     plugin.c        Added
>
>
>
> http://anonsvn.ethereal.com/viewcvs/viewcvs.py?rev=17057&view=rev
>
> _______________________________________________
> Ethereal-cvs mailing list
> Ethereal-cvs@xxxxxxxxxxxx
> http://www.ethereal.com/mailman/listinfo/ethereal-cvs
>


--
This information is top security. When you have read it, destroy yourself.
-- Marshall McLuhan

Attachment: packet-cellog.lua
Description: Binary data