Commit Graph

24 Commits

Author SHA1 Message Date
Guy Harris 6db77b000f Allow wtap_read() and wtap_seek_read() to return records other than packets.
Add a "record type" field to "struct wtap_pkthdr"; currently, it can be
REC_TYPE_PACKET, for a record containing a packet, or
REC_TYPE_FILE_TYPE_SPECIFIC, for records containing file-type-specific
data.

Modify code that reads packets to be able to handle non-packet records,
even if that just means ignoring them.

Rename some routines to indicate that they handle more than just
packets.

We don't yet have any libwiretap code that supplies records other than
REC_TYPE_PACKET or that supporting writing records other than
REC_TYPE_PACKET, or any code to support plugins for handling
REC_TYPE_FILE_TYPE_SPECIFIC records; this is just the first step for bug
8590.

Change-Id: Idb40b78f17c2c3aea72031bcd252abf9bc11c813
Reviewed-on: https://code.wireshark.org/review/1773
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-24 18:31:25 +00:00
Hadriel Kaplan f3fe29f0fc Add paths to Lua package.path so require works for user scripts
This adds the global and personal plugins directories to the
package.path setting in Lua, so doing 'require' will work
properly.

Change-Id: Iec33bc60cd7d41aa122da456db91d4ccc3085f82
Reviewed-on: https://code.wireshark.org/review/841
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-27 05:03:39 +00:00
Hadriel Kaplan 8c2bb80574 Add various functions for Lua directory handling and path info
This adds new functions to get plugins path info, find out if a directory
exists, make a new one, remove one, etc. It also creates a file environment
for user-supplied Lua scripts, to prevent global variable contamination as
well as supply the script-specific file name.  Some other minor cleanup was
done as I found them.

A new testsuite was added to test the existing and new directory functions.

Change-Id: I19bd587b5e8a73d89b8521af73670e023314fb33
Reviewed-on: https://code.wireshark.org/review/832
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-26 07:37:34 +00:00
Hadriel Kaplan da1af6e549 Add filterable expert info for Lua
This adds the ability for a Lua script to register expert info fields,
similar to C-code dissectors. This change also removes the need for
the expert_add_info_format_internal() function. Existing Lua scripts
do not have to change, because the existing expert info function
uses the internal "_ws.lua" protocol instead of nothing; but using
the new functionality provides more benefits since it correctly
registers the expert info fields to the dissector's protocol.

The test suite was amended to generate both old and new forms.

Change-Id: Ib5ae74e927cfa81312baf7b04ff4104b0b4f936e
Reviewed-on: https://code.wireshark.org/review/830
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-26 05:20:17 +00:00
Michael Mann 04d9501306 Add capture file reader/writer support for Lua so scripts can implement new capture file formats.
This enables a Lua script to implement a brand new capture file format reader/writer, so that for example one could write a script to read from vendor-specific "logs" of packets, and show them as normal packets in wireshark.

Change-Id: Id394edfffa94529f39789844c382b7ab6cc2d814
Reviewed-on: https://code.wireshark.org/review/431
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-19 05:04:54 +00:00
Hadriel Kaplan c4f1777a97 Adds support for Lua struct library so one can pack/unpack binary structures
This is based on Roberto Ierusalimschy's struct library, along with additional
options based on Flemming Madsen's patch to the lua-users mailing list, and
some changes I made to support 64-bit integer packing/unpacking.  Details
are in the top comments for wslua_struct.c.  This also includes a test script.

Change-Id: Ifcd0116ba013d5c760927721c8d6e9f28965534b
Reviewed-on: https://code.wireshark.org/review/98
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-14 10:11:50 +00:00
Stig Bjørlykke e4a140c7f0 Lua: Added a utility function file_exists().
This function can be used to check for files before calling dofile(),
which will fail for non-existing files.

Change-Id: Iae7b7ef6d8eb6e0e18f98fee7c740d2a5705eef3
2014-01-29 16:05:48 +01:00
Luis Ontanon 5c595ef825 fix for bug 7465
add a wiretap file type table to init.lua


svn path=/trunk/; revision=49608
2013-05-29 06:50:28 +00:00
Michael Mann 2c7844cc69 Fix typos/errors and make Lua API more consistent.
From Hadriel Kaplan, bug 8393 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8393)

svn path=/trunk/; revision=47885
2013-02-25 22:05:28 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Balint Reczey b90a1b7f63 Give hint to check http://wiki.wireshark.org/CaptureSetup/CapturePrivileges in Lua error messages related to running Wireshark as root
svn path=/trunk/; revision=43442
2012-06-22 15:18:03 +00:00
Guy Harris 14b616c35d Get rid of remaining Booleans-as-encoding-arguments in
proto_tree_add_item() calls.

Add new "add_packet_field" method to the TreeItem class, taking a
protocol field (*not* a protocol), TvbRange, and encoding value as
arguments.

Add the ENC_ values to init.lua.  Make them all hex #defines so
make-init-lua.pl can easily extract them.

Export tvb_unicode_strsize() for use by Lua (and elsewhere as desired). 
Note that it handles UTF-16 and UTF-8, and fix the comment to note that
its count of hexadectets *does* include the null terminator (that's what
the code does).

svn path=/trunk/; revision=42621
2012-05-14 00:49:05 +00:00
Gerald Combs b9d13c328d Load console.lua and dtd-gen.lua from an explicit path.
svn path=/trunk/; revision=38414
2011-08-08 19:10:19 +00:00
Stig Bjørlykke b0c0ebcc20 Fix the check for disable_lua.
svn path=/trunk/; revision=33252
2010-06-18 15:25:41 +00:00
Stig Bjørlykke ba69712a63 Enable Lua by default.
svn path=/trunk/; revision=33243
2010-06-17 16:38:05 +00:00
Jaap Keuter da005d4aaf From Márton Németh:
Cleanup ident of epan/wslua/init_wslua.c: use spaces instead of tabs.
cleanup the ident of generator scripts and for template-init.lua
Spaces used instead of tabs for indent. Removed spaces placed by generator
script just before a newline.

svn path=/trunk/; revision=25176
2008-04-25 19:04:52 +00:00
Bill Meier 09f508b57b A few more ethereal --> wireshark
svn path=/trunk/; revision=20559
2007-01-26 01:34:29 +00:00
Luis Ontanon 58126f3753 fix bug 1321
svn path=/trunk/; revision=20515
2007-01-21 17:06:16 +00:00
Luis Ontanon 0072205e18 Have Lua disabled by default.
Add more documentation to the code. 
change make-dco.pl so that it creates more readable docbook output.

This should be copied over to 0.99.4



svn path=/trunk/; revision=19670
2006-10-24 13:16:57 +00:00
Luis Ontanon b8ef88a6e2 Several changes:
- do not #include a c code file in wslua_register.c compile a separate boject
 - add the console and evaluate windows
 - add some useful vars to the lua environment
 - some cleanup
 - add the dtd generator code (currently disabled)


svn path=/trunk/; revision=19579
2006-10-17 18:20:44 +00:00
Luis Ontanon ba90067e62 - wslua_util.c: replace Lua's loadfile and dofile for versions that will try to open the file in perscofdir then dataconfdir if there's no such file in cwd
- wslua_field.c: avoid FieldInfo:__tostring() crashing when the ftype has no val_to_string_repr
- init.lua: inform the user that a packet has been disabled, intead of a cryptic "attemt to call nil"
- Makefile.am: add register_wslua.c and declare_wslua.h to MAINTAINERCLEANFILES
- wslua_gui.c: fix a typo


svn path=/trunk/; revision=19425
2006-10-04 14:37:46 +00:00
Luis Ontanon 2e7726b3ff * rename REGISTER_STAT_GROUP_E -> register_stat_group_t
* Add a "Tools" menu
* allow wslua's register_menu to register menu items into more menus


svn path=/trunk/; revision=19338
2006-09-27 17:12:42 +00:00
Luis Ontanon 611d1e6443 Add a simple lua console to allow evaluation of conde into init.lua
svn path=/trunk/; revision=19332
2006-09-27 02:51:08 +00:00
Luis Ontanon 6462d05044 Move the Lua interface into epan... (not a plugin anymore).
- Rename Tap into Listener
- add a mechanism to pass protocols' tap data to the Listener


svn path=/trunk/; revision=19319
2006-09-25 01:09:00 +00:00