aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
AgeCommit message (Collapse)AuthorFilesLines
2014-03-26Add filterable expert info for LuaHadriel Kaplan6-15/+513
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-25Enhance Lua API doc generator and add more API infoHadriel Kaplan13-1054/+1502
This enhances the Lua API doc generator Perl script to handle meta-information in description comments, such as bold, italics, raw code, version info, etc. The supported markup and codes are documented in make-wsluarm.pl. It's not beautiful Perl code (I don't know Perl), and I'd rather do it using Lua, but I think keeping it Perl makes more sense in the long run. Change-Id: I477b3ebe770075dcea9ec52708e2d6fb5758d2f4 Reviewed-on: https://code.wireshark.org/review/802 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-23Add Lua Struct.values() function, and prevent coercion in all Struct functionsHadriel Kaplan3-26/+82
This adds a Struct.values() function to get the number of values needed/returned with Struct.pack/unpack. It also changes the existing Struct functions such that they don't coerce a non-string argument into a string. (not preventing it confused a user on ask.wireshark.org) Change-Id: I93d5846105e55b67680e1c276a7286535c77b039 Reviewed-on: https://code.wireshark.org/review/790 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-22Fix request for implicit conversion from 'gpointer' to 'struct file_priv_t ↵AndersBroman1-2/+2
*' not permitted in C++ Change-Id: If88c65fa70d38d6b447a060a19d2681aa7166217 Reviewed-on: https://code.wireshark.org/review/783 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-22Add way for Lua file reader to save state per file read/write opsHadriel Kaplan1-19/+283
Lua can create a file reader/writer, to open new capture file formats or write to new ones. To save local state, it can save things in Lua itself; but since there can be multiple open files at the same time (for example during a reload), the Lua script won't know for which file and state its read/write functions are being invoked for. To remedy this, and also provide a convenient way to store such state, this commit adds the ability for a Lua script to store a Lua table in the wtap/wtap_dumper's priv data member, just like C-code-based reader/writers do. Change-Id: Ifc9e0d5f0379accee56f2a04b6080238670fec52 Reviewed-on: https://code.wireshark.org/review/766 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-21Fix API comments and don't use sprintf in wslua_int64.cHadriel Kaplan1-8/+8
Change-Id: I4997317e010f685d47e1e2ab512b086e54b286a7 Reviewed-on: https://code.wireshark.org/review/777 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-21Fix Bug 9903: 'Clicking reload-file ignores selected file format reader'Hadriel Kaplan2-9/+11
There's a relatively new feature in 1.11.3 to select a specific file format reader, instead of relying on magics or heuristics. If you select a file reader and open a file, open it, and then click the reload-file button or go to View->Reload or press the ctrl-R keymap, the file is reloaded but using the magic/heuristics again instead of the file format reader you previously chose. Likewise, the Lua relaod() function has the same issue (which is how I found this problem). I have tested this change by hand, using a Lua script, but I didn't add it to the testsuite because I need another change for my test script to work correctly. (an enhancement rather than a bug fix, which I'll submit separately) Change-Id: I48c2d9ea443e37fd9d41be43d6b6cd5a866d5b01 Reviewed-on: https://code.wireshark.org/review/764 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-19Fix buildAlexis La Goutte1-1/+1
wslua_file.c:92:13: error: request for implicit conversion from 'WFILE_T' to 'FILE_T' not permitted in C++ [-Werror=c++-compat] Change-Id: Iff9cc716333802a3902429a8c68e5f4cdac2ee9e Reviewed-on: https://code.wireshark.org/review/732 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-19Add capture file reader/writer support for Lua so scripts can implement new ↵Michael Mann8-18/+2267
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-15Fix lrexlib.c clang static analyzer warningHadriel Kaplan1-0/+3
This fixes a "Argument with 'nonnull' attribute passed null" warning generated by the clang static analyzer. It's a false positive, but easy to remedy. Change-Id: Id737d1ac29765ed26a416c5cd13bedafee478fb6 Reviewed-on: https://code.wireshark.org/review/661 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-14Add Lua heuristic dissector supportHadriel Kaplan6-6/+293
This adds the ability for Lua scripts to register heuristic dissectors for any protocol that has registered a heuristic dissector list, such as UDP, TCP, and ~50 others. The Lua function can also establish a conversation tied to its Proto dissector, to avoid having to check the heuristics for the same flow. The example dissector in the testsuite has also been enhanced to include a heuristic dissector, to verify the functionality and provide an example implementation. Change-Id: Ie232602779f43d3418fe8db09c61d5fc0b59597a Reviewed-on: https://code.wireshark.org/review/576 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-11Fix Bug 9870 'Lua: trying to call/get an invalid name results in a get-loop ↵Hadriel Kaplan2-9/+74
error' Due to the change I made previously for how methods are accessed, if you try to access one that doesn't exist (for example mistype it or whatever), you get an internal Lua error about a loop in table get, as opposed to the right error message about the field not existing. That's because I had set the class' metatable __index metamethod to point to the class table, which of course has the metatable with the __index metamethod, causing a lookup loop. Blech. Change-Id: I20d3717feadd45f652c2640e1671846184e7082d Reviewed-on: https://code.wireshark.org/review/593 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-10Try to fix -Wparentheses-equality errors.Gerald Combs1-2/+2
Clang in XCode 5.0 currently fails with error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality] Change-Id: I7ca2e81959e777f923bdff1273aca6c56b100f6c Reviewed-on: https://code.wireshark.org/review/600 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-03-10Replace "see copyright notice in" message with full licenseEvan Huus4-6/+105
Should make the licensecheck buildbot happy. Also add "Public domain MIT/X11 (BSD like)" to the list of permitted licenses, since it is a combination of two permitted licenses. Change-Id: Ibc4ead09af89e9225c4e0589a2b7d06dcee6a44e Reviewed-on: https://code.wireshark.org/review/581 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-10Add two more casts to satisfy OSX10.6 buildbotEvan Huus1-2/+2
Change-Id: Ia9d289d241d6117fdeb89db122b1813eed537631 Reviewed-on: https://code.wireshark.org/review/582 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-10Fix Windows x64 build failureAnders Broman1-1/+1
Change-Id: I7b71ead00b09e583e51fe45cf6b0bdfe75c3da98 Reviewed-on: https://code.wireshark.org/review/580 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-03-10add explicit casts to fix compilation on LinuxMartin Kaiser3-12/+14
Change-Id: I3b87e156ab35e14e3c6e3800ee2058b1a6be57d6 Reviewed-on: https://code.wireshark.org/review/577 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2014-03-10Add GLib's regex library into LuaHadriel Kaplan10-0/+1721
While Lua's built-in pattern support is ok for simple things, many people end up wanting a real regex engine. Since Wireshark already includes the GLib Regex library (a wrapper for PCRE), it makes sense to expose that library to Lua scripts. This has been done using Lrexlib, one of the most popular regex bindings for Lua. Lrexlib didn't support binding GLib's Regex in particular - it does for PCRE but GLib is a different API - so I've done that. A fairly thorough testsuite came along with that, which has been incorporated into the wireshark wslua testuites as well in this commit. Change-Id: I05811d1edf7af8d7c9f4f081de6850f31c0717c7 Reviewed-on: https://code.wireshark.org/review/332 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-09Fix Bug 9853: 'Lua: trying to get/access a Preference before its registered ↵Hadriel Kaplan1-9/+14
causes a segfault' Accessing a pref before it's registered causes a segfault, because prefs_p->next is not being checked for NULL in wslua_proto.c:Prefs__index(). Change-Id: I270978ddb9238a9e8d2c533a96fc01ee0df385c7 Reviewed-on: https://code.wireshark.org/review/563 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte12-24/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-27Fix build with recent lua changes.Evan Huus2-13/+13
Use FT_NONE instead of 0 to initialize an enum. Drop use of lround/llround since they are not available on Windows. Change-Id: I3961c1921304bafc090c763f0d6de8532f0b3510 Reviewed-on: https://code.wireshark.org/review/425 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-27Fix coverity warnings for all wslua files. (redux)Hadriel Kaplan14-171/+383
This fixes/addresses all the coverity warnings shown by the buildbots. (I hope) Change-Id: Ic2722df97c577d274e3cf3f0cbdca1902edde047 Reviewed-on: https://code.wireshark.org/review/423 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-02-25Fix bug 6357: Lua all_field_infos() broken within tap/listenerHadriel Kaplan3-3/+20
The current API for Lua provides a global function "all_field_infos()" which returns all the populated field_info nodes in the current proto_tree. By default all_field_infos() "works", in the literal sense: it returns exactly the fields the previous dissectors of the packet have populated at that instant of time. But of course dissectors don't populate all the applicable fields most of the time, because of the TRY_TO_FAKE_THIS_ITEM optimization where they don't fill in things that aren't needed at the time by a display, color, or tap's dfilter. So this commit offers a way to force the dissectors to populate all the applicable field_infos in the tree, by setting the proto_tree to be visible. Obviously that is going to impact performance, since it basically bypasses the TRY_TO_FAKE_THIS_ITEM optimization; so the patch only does this if the Lua script author told it to explicitly, by adding an argument to Listener.new() and register_postdissector(). Change-Id: I11d3559fbe8c14fbadf1b51415a3701dc1200b7b Reviewed-on: https://code.wireshark.org/review/286 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-25Adds some Lua helper functions: some commonly used functions, and to help ↵Hadriel Kaplan7-66/+387
troubleshooting Lua scripts There are some common things people need to do, such as convert to/from hex or get the raw binary string in a ByteArray/Tvb/TvbRange. These have been added, as well as some tests for them in the testsuites. Also, functions have been added to allow a script to get all the available tap types and filter fields, since they are not exactly what one can see in the Wireshark gui. Change-Id: I92e5e4eae713bb90d79b0c024eaa4e55b99cc96b Reviewed-on: https://code.wireshark.org/review/249 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-25Remove trailing whitespaceBill Meier5-25/+25
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0 Reviewed-on: https://code.wireshark.org/review/385 Reviewed-by: Bill Meier <wmeier@newsguy.com> Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-21Fix bug 9790: Lua: wslua allows duplicate field registrationHadriel Kaplan1-150/+137
As discussed in bug 3513 and 9709, one can register more than one new ProtoFields for the same field name. Of course C-code can do that too, and does a LOT apparently, but if they're not similar ftypes then things can get scrweed up in display filters. So this change prevents duplicate field registration of dissimilar ftypes. The similarity is based on the discussion on the mailing list, and the listing in README.developer has been updated to refelect that as well. Also, this change adds a testscript for Proto/ProtoFields. Change-Id: I43bd323f785245941a21289647332a19adec2a9d Reviewed-on: https://code.wireshark.org/review/285 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-21Add test suite for verifying Lua global variables/tables of previous ↵Hadriel Kaplan2-1/+3
releases have not disappeared. Several bugs have been introduced due to changing of perl scripts or #define names, such that things exported into Lua have dissapeared or changed unintentionally. This commit adds a test suite which compares the Lua global table with the ones from previous releases (1.8 and 1.10), to verify nothing has gone missing. New items can be added, but old ones cannot go away. The added script to verify these things, called 'verify_globals.lua', also has the ability to display what's new - i.e., what was not in the olrder releases. Lastly, this commit also fixes a bug: MENU_STAT_ENDPOINT became MENU_STAT_ENDPOINT_LIST due to a change in the make-init-lua.pl perl script in this 1.11 release. Change-Id: Iba143d1a436e706970635a5f8cc2b317955392bf Reviewed-on: https://code.wireshark.org/review/284 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-21And we need wslua_internals.obj as well.Guy Harris1-8/+9
Sort the list to match the .c list while we're at it, to make it easier to check for errors. (Why isn't this done with a Makefile.common file?) Change-Id: I239964d53be9e48bddbd6180aabe118b5cac1fd0 Reviewed-on: https://code.wireshark.org/review/287 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-21Need to include wslua_internals.c here as well.Guy Harris1-1/+2
Change-Id: Ibae7e4473ad0131e399423ee9faba5ad759feaed Reviewed-on: https://code.wireshark.org/review/283 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-21Fix warnings - index() is declared as a function in some systems.Guy Harris1-4/+4
Change-Id: If9ee9f0decc0a9d7971095109e1012b015a9dc96 Reviewed-on: https://code.wireshark.org/review/282 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-21Revert "Add test suite for verifying Lua global variables/tables of previous ↵Evan Huus1-1/+1
releases have not disappeared." This reverts commit 5b7f00178f45149ecdce204f1c71c1598ceedac1. Change-Id: Idf09d25270847970713b67d02bcd7cbc411a4e9c Reviewed-on: https://code.wireshark.org/review/280 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-21Add test suite for verifying Lua global variables/tables of previous ↵Hadriel Kaplan1-1/+1
releases have not disappeared. Several bugs have been introduced due to changing of perl scripts or #define names, such that things exported into Lua have dissapeared or changed unintentionally. This commit adds a test suite which compares the Lua global table with the ones from previous releases (1.8 and 1.10), to verify nothing has gone missing. New items can be added, but old ones cannot go away. The added script to verify these things, called 'verify_globals.lua', also has the ability to display what's new - i.e., what was not in the olrder releases. Lastly, this commit also fixes a bug: MENU_STAT_ENDPOINT became MENU_STAT_ENDPOINT_LIST due to a change in the make-init-lua.pl perl script in this 1.11 release. Change-Id: Ic46172904256dc535b0fe4543237c07dddb3b9b5 Reviewed-on: https://code.wireshark.org/review/242 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-21Cleanup on aisle 5: normalizes the Lua code to follow common schema/modelHadriel Kaplan15-1360/+1081
Over time the various wslua classes/functions have gotten moldy, with different ways of doing similar things. Some of it can't be changed without breaking backwards compatibility for Lua scripts, so I didn't do that. But I did what I could. The biggest change is a refactoring of how accessors/attributes are handled in the code, so that most of them work the same way using the same code. Specific changes made: * Added null/expired checking macro to class declarations for many classes * Removed extraneous pointer/expired checking, since checkFoo() does that already * Fixed "errors" reported by clang static analyzer; they were false positives, but it was easier to get it to stop complaining by changing the code * Moved internal wslua functions from wslua_utils.c into a new 'wslua_internals.c' file * Changed Listener/NSTime/Pinfo/Proto to use a common setter/getter accessor/attribute code model, instead of each of them doing their own * Fixed some API doc mistakes, mostly around attributes that were documented as read-only but were actually read-write Change-Id: Idddafc5fbd3545ebff29e063acc767e1c743a1a9 Reviewed-on: https://code.wireshark.org/review/271 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-20Fix Bug 9792: 'Lua: setting pinfo.dst_port actually sets src_port'Hadriel Kaplan1-1/+1
Setting the Pinfo.dst_port to a value actually changes the src_port's value, due to a bug in wslua_pinfo.c, where both src_port and dst_port attributes use the PARAM_PORT_SRC for their setter type enum. Change-Id: I1b84ba8b343ec857d04a2d0809e16f17ba2a43e8 Reviewed-on: https://code.wireshark.org/review/269 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-14Move lua struct license to top of file.Evan Huus1-26/+23
It isn't picked up by licensecheck at bottom of file. Change-Id: Ifa8302f90dc44eacd3722efca2471101902457a0 Reviewed-on: https://code.wireshark.org/review/217 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-14Fix build on WindowsAlexis La Goutte1-1/+1
wslua_struct.c(431) : error C2220: warning treated as error - no 'object' file generated wslua_struct.c(431) : warning C4244: '=' : conversion from 'lua_Number' to 'size_t', possible loss of data Change-Id: Id8b7a77eb123232116223077175d243195c8d4fa Reviewed-on: https://code.wireshark.org/review/213 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-14Adds support for Lua struct library so one can pack/unpack binary structuresHadriel Kaplan7-11/+554
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-13Lua: add ability for scripts loaded from command-line to be passed argumentsHadriel Kaplan1-6/+29
This change adds the ability to pass on to lua scripts loaded from the command-line (tshark or wireshark) additional arguments supplied by the command-line. This will help us in our testsuites, but also might be useful for user-created scripts. The additional arguments are passed in using the '-X' eXtension switch. Change-Id: Ib94cdf1ffd194ca84692fee7816665e4ff95efbd Reviewed-on: https://code.wireshark.org/review/156 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-09Fix bug 9736 'Lua: new Int64/UInt64 functions don't prevent division by zero'Hadriel Kaplan2-24/+57
OK, in all fairness this does a bit more than just fix that bug. It also adds a 'Int64()' and 'UInt64()' __call metamethods. I generally dislike using __call metamethods, because they're often unintuitive (for example the wireshark Field and FielInfo use this in a bizarre fashion). But this happens to be a perfect use for it, and very natural, imho. Another change is to make the metatables of classes visible to scripts. There was never really a good reason not to make them visible, and they have to be visible to do things like use __call on a plain table... not to mention I need them to be visible to run test scripts verifying evrything is kosher. I also updated the test suite to test for the div/mod by zero. Change-Id: Ia4c594c8f59d4e799090716bd032ba2815df032f Reviewed-on: https://code.wireshark.org/review/149 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-08Fix bug 9733 ' Lua: wtap_filetypes.TSPREC_ variable names are missing from ↵Hadriel Kaplan1-1/+2
the Lua global table' The fix for bug 9712, which involved changing the make-init-lua.pl perl script to handle the new C-code define names for filetypes in release 1.11, unfortunately also stopped matching against the timestamp define names. Arguably the timestamp ones should never have been matched to begin with, at least not by the same regex function, because they're not "filetypes". But they've been matched and exported into the Lua table forever, so we'll break backward-compat if we don't keep doing it. Ugh. The good news is I caught this bug using a new test script I wrote which verifies previous release's Lua stuff didn't disappear. I'll submit that separately when I get a chance to clean it up, hopefully next week. Change-Id: Ibf1d1da0dc4ed62cc1bacf345742dccf8ec40e30 Reviewed-on: https://code.wireshark.org/review/143 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-08Fix bug 9732: ' Lua: recent commit changed some MENU_ key names in init.lua'Hadriel Kaplan2-2/+10
A recent fix (made by me) for bug 9707, in Change-Id: If4ee1906aa60dd37366cf2ef9bc4168e0ea024b6, made the perl regex grab too much of the menu name. It changed MENU_STAT_CONVERSATION, MENU_STAT_RESPONSE, and MENU_ANALYZE_CONVERSATION's key names into their longer C-code names. Ugh. The fix for this is a bit brittle, but I think it's impractical to avoid it being brittle, due to needing to support legacy Lua scripts. I put comments in stat_menu.h to warn of the danger. Change-Id: I41408e9d4f5b5bd73e2871fccabff81c7cbd242d Reviewed-on: https://code.wireshark.org/review/140 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-07Fix Bug 9728 'Lua: ProtoField.bool() VALUESTRING argument is not optional ↵Hadriel Kaplan3-15/+33
but was supposed to be' Similar to bug 9725 and ProtoField.new(), the way the VALUESTRING argument is being checked in the code for ProtoField.bool() ends up making it non-optional. This patch fixes that, along with some minor API documentation fixes (text). Change-Id: Iadb9a8ace9c5514fc623d882301fe16b637fe4ce Reviewed-on: https://code.wireshark.org/review/125 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-05Two fixes for license headersEvan Huus1-39/+35
- packet-bencode.c had the wrong FSF address - wslua_int64.c had the license as a footer instead of a header Change-Id: I71204b36a1034af72874d6fe87929c31c9ff03df Reviewed-on: https://code.wireshark.org/review/123 Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-05Fix Bug 9725 'Lua: ProtoField.new() is buggy'Hadriel Kaplan1-2/+3
Using ProtoField.new() is dicey. Many of the optional arguments don't properly check the lua stack - they call lua_isnil() for their index number, instead of lua_gettop() to see the stack size. lua_isnil() may return false in such cases. Change-Id: I83ca1e5fc34e71ec35899adbedabcee69571b9fe Reviewed-on: https://code.wireshark.org/review/118 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-02-04Fix bug 9720 'Lua: bitop library is missing in Lua 5.2'Hadriel Kaplan1-1/+3
In Lua 5.2 the bitop library is missing - it's not getting loaded into the lua global table as "bit", or anything else for that matter. Lua 5.2 has its own bit-operations library ("bit32") which is there, but that one's not as good as bitop and would break back/forward compatibility for lua scripts anyway. Change-Id: I94b7d45bbeb2f637d1c76b0b5c9d8472eebfcaea Reviewed-on: https://code.wireshark.org/review/100 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-02-04Various fixes to the Lua int64 codeEvan Huus1-11/+11
- add casts to pacify certain buildbots - skip test if lua isn't available Change-Id: I614c05dca40cb848c87b361e4b3d3c4e94aafb9e Reviewed-on: https://code.wireshark.org/review/97 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-04Adds support for Lua Int64 and UInt64 operators, functions, and generalHadriel Kaplan10-120/+949
usefulness, working around bug #9162 until Lua 5.3 is released. The existing Int64 and UInt64 classes provide virtually no usefullness, other than for creating a string of their value. While one could then write Lua code to convert the string to Lua numbers and such, ultimately Lua has no native 64-bit integer support, making such a task difficult to handle in Lua. This change adds a host of functions and operators to the existing Int64 (gint64) and UInt64 (guint64) classes, to enable true 64-bit integer support on par with native Lua numbers. A test script is also provided, which tests the functions/operators. Change-Id: I4c5f8f5219b9a88198902283bd32ddf24c346bbe Reviewed-on: https://code.wireshark.org/review/83 Tested-by: Evan Huus <eapache@gmail.com> Reviewed-by: Evan Huus <eapache@gmail.com>
2014-01-31Fix for Bug-9711 Lua: the Lua stack is growing slightly during initialization.Hadriel Kaplan11-28/+38
Change-Id: I689319c0071fdb42583e8bd7633d8f0660c92f1b Reviewed-on: https://code.wireshark.org/review/51 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-01-31Fix for Bug-9712 Lua: changes to WTAP_FILE_ #define names prevents them ↵Hadriel Kaplan1-2/+2
being in init.lua Change-Id: I0a2ccd686a89ffbc918a7b8b6af4a0ba8a5ab097 Reviewed-on: https://code.wireshark.org/review/52 Reviewed-by: Gilbert Ramirez <gram@alumni.rice.edu> Tested-by: Gilbert Ramirez <gram@alumni.rice.edu>
2014-01-30Lua: Improved running in build directory.Stig Bjørlykke2-2/+39
Load system init.lua from build-directory/epan/wslua Set Lua datafile_path to source-directory/epan/wslua Made dofile() search in source-directory/epan/wslua Change-Id: I009234eb8193c1ed3260455b245c256c9747930f