aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
AgeCommit message (Collapse)AuthorFilesLines
2014-11-14Rename stat_cmd_args.[ch] to stat_tap_ui.[ch].Guy Harris1-1/+1
The intent is to handle more than just command-line arguments; reflect that. Change-Id: Ia10efda85a9d11c6579d1bec6f789cee30d9e825 Reviewed-on: https://code.wireshark.org/review/5304 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-14tap_ui -> stat_tap_ui.Guy Harris1-2/+2
The old routine had stat_ in the name, as the expectation was that they were for statistics taps; that's still the expectation, so have stat_ in the data structure and routine names. Change-Id: Ic98d011012b8641173d41fa0ec4f4e625614370a Reviewed-on: https://code.wireshark.org/review/5303 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-14For tap UIs, register a list of parameters and some menu information.Guy Harris1-1/+9
The intent here is to centralize more UI information so that we can move more tap UI stuff to common code. This is a beginning. Change-Id: Ic35ac0c01bc7b942aab88177db4065847a5e6c30 Reviewed-on: https://code.wireshark.org/review/5301 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-09Convert the Lua reference to AsciiDoc.Gerald Combs4-29/+29
Move it to the Developer's Guide while we're here. Nudge the markup in epan/wslua where needed. Note that we should probably convert it to AsciiDoc (if we're going to keep it in the DG) or Doxygen. Change-Id: Ie175111043f98b7a37eeeb8d185a833d8e866f8b Reviewed-on: https://code.wireshark.org/review/5203 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-11-06Lua: Fixed some memory leakages.Stig Bjørlykke2-12/+19
Change-Id: I5e14c2e5a3868ec40d1989876b06919aa9ece4a1 Reviewed-on: https://code.wireshark.org/review/5138 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
2014-11-04Lua: Fix for register dissectors only once.Stig Bjørlykke1-1/+3
The postdissector may be registered before adding the dissector function. Change-Id: I2285824835491ac91e00515bfb18eb471888eaf8 Reviewed-on: https://code.wireshark.org/review/5106 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-11-04Lua: Register dissectors only once.Stig Bjørlykke2-6/+4
Change-Id: I883e8560e9d101d34760d09715255e4fccc9eb98 Reviewed-on: https://code.wireshark.org/review/5022 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-10-31Lua: Only register postdissectors once.Stig Bjørlykke1-0/+1
Change-Id: Id41e4ebd19e0b80faa06f628d689bdb77f2b84c9 Reviewed-on: https://code.wireshark.org/review/5023 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-10-22Lua: Added support for FT_EUI64.Stig Bjørlykke1-1/+12
Bug: 10603 Change-Id: I21da496834b83466585f5b77f87970e3fab28b12 Reviewed-on: https://code.wireshark.org/review/4894 Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-10-18Lua: Added ProtoField.noneStig Bjørlykke1-2/+11
This field can be used for adding filterable subtree entries. Change-Id: Id395c9a8194dc00e6544170631b48d71ae9dd33e Reviewed-on: https://code.wireshark.org/review/4573 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2014-10-17Remove unnecessary include of <ctype.h>.Guy Harris1-1/+0
Change-Id: I596b252d5fb41e654961483cb530754442f25bc7 Reviewed-on: https://code.wireshark.org/review/4763 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-17Don't use <ctype.h> macros, and eliminate an include of <ctype.h>.Guy Harris1-6/+5
This avoids locale-dependent tests, and fixes cases where we passed signed char values to those macros (which is not safe with char being signed, as it is on most, but not all, platforms). Change-Id: I51d9716fe3eb02a6e98208334285c07597a6be79 Reviewed-on: https://code.wireshark.org/review/4761 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-17Don't use <ctype.h> macros, and eliminate an include of <ctype.h>.Guy Harris2-3/+1
This avoids locale-dependent tests. Change-Id: I709ff6b1a837fb0390b29f911d3b9ef1015a2d1e Reviewed-on: https://code.wireshark.org/review/4758 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-17Don't use ctype.h routines.Guy Harris1-2/+9
That avoids locale dependency and handles possibly-signed chars (which we weren't doing before). Change-Id: I2afab254044e0d39dfa67acd840b9fe4ff1e6d08 Reviewed-on: https://code.wireshark.org/review/4756 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-16Fix some more "char is unsigned" issues, and a possible "char is signed" one.Guy Harris1-4/+4
C neither guarantees that char is signed nor that it's unsigned. Make the str_to_nibble tables arrays of gint8, to make sure they can hold numbers between 0 and 15 as well as -1. Cast gchar to guchar, not int, when using it as a subscript into that array, so that the subscripts are in the range 0 to 255, not -128 to 127. Change-Id: Ib85de5aa4e83ae9efd808c78ce3f86f45b4a3f2a Reviewed-on: https://code.wireshark.org/review/4734 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-13Lua: luaL_checkstring does not return NULLStig Bjørlykke11-201/+65
Removed all checks for NULL strings to cleanup the code. Change-Id: Ia890cd9b206296f586e85214f07765f14984580b Reviewed-on: https://code.wireshark.org/review/4632 Tested-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-10-10Fix some more int-to-enum conversion complaint.Guy Harris1-4/+10
While we're at it, log a message if a Lua file format module lacks a read or a seek-read routine, rather than completely silently ignoring that module if it claims a file. Change-Id: I9778f7835922439e2d3708614689280ef7b61d33 Reviewed-on: https://code.wireshark.org/review/4590 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-09Use an enum for the open-routine return value, as per Evan Huus's suggestion.Guy Harris1-6/+6
Clean up some things we ran across while making those changes. Change-Id: Ic0d8943d36e6e120d7af0a6148fad98015d1e83e Reviewed-on: https://code.wireshark.org/review/4581 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-09Lua: Improved TreeItem:add documentation.Stig Bjørlykke1-9/+13
The protofield is optional and can not be replaced with 'nil' as with the other fields for this function. Change-Id: I2b1dd7f290264394b400cea2110b65b657c71456 Reviewed-on: https://code.wireshark.org/review/4549 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-10-08Make sure we don't dereference a null pointer.Gerald Combs1-7/+21
Change-Id: I033c60cdc5b78f4db31903277c659661e0dc5123 Reviewed-on: https://code.wireshark.org/review/4561 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-08Fix a comment.Guy Harris1-1/+1
Change-Id: I0ebaa1b99bc9c7e51be10f3f8825280782f26190 Reviewed-on: https://code.wireshark.org/review/4560 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-07No need for WTAP_ERR_CANT_READ.Guy Harris1-6/+3
Unlike the standard I/O routines, the code we introduced that supports fast random seeking on gzipped files will always supply some specific error code for read errors, so we don't need WTAP_ERR_CANT_READ. Add WTAP_ERR_CANT_WRITE for writing, as we're still using the standard I/O routines for that. Set errno to WTAP_ERR_CANT_WRITE before calling fwrite() in wtap_dump_file_write(), so that it's used if fwrite() fails without setting errno. Change-Id: I6bf066a6838284a532737aa65fd0c9bb3639ad63 Reviewed-on: https://code.wireshark.org/review/4540 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-07ASN1: Added support for using #.REGISTER_NEWStig Bjørlykke1-14/+19
This will register BER PDU-dissectors as "new". Return number of bytes dissected from dissector_try_* functions. Return number of bytes dissected in DissectorTable:try() This will make it possible to get dissected length when using dissector_try_*() and dissected ASN.1 length in Lua when using DissectorTable:try() (as we already have for Dissector:call). Change-Id: Iee17a68dc214fa0fb50b25fc927026ad7c1cbce4 Reviewed-on: https://code.wireshark.org/review/4531 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-10-07Revert "ASN1: Added support for using #.REGISTER_NEW"Gerald Combs1-19/+14
This temporarily reverts commit acc09c2aa248d892ee6b894b43c79cb060131b11. Change-Id: I7a55c8c2da3f65e914b90648ee92c84efd57f1a0 Reviewed-on: https://code.wireshark.org/review/4525 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-07ASN1: Added support for using #.REGISTER_NEWStig Bjørlykke1-14/+19
This will register BER PDU-dissectors as "new". Return number of bytes dissected from dissector_try_* functions. Return number of bytes dissected in DissectorTable:try() This will make it possible to get dissected length when using dissector_try_*() and dissected ASN.1 length in Lua when using DissectorTable:try() (as we already have for Dissector:call). Change-Id: I8802a812bd484c1e8794c618b87e676003aea94a Reviewed-on: https://code.wireshark.org/review/4493 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-10-06Adjust some whitespace to match editor modelines.Bill Meier1-2/+2
Change-Id: Ia22cac3ebd7a454c156f98d967e6fd61f708a2b3 Reviewed-on: https://code.wireshark.org/review/4489 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-29Fix lua bindings for timestamp precisionHadriel Kaplan1-0/+2
The changes to the timestamp define names broke the init.lua file generation. Change-id Id0c27b31c5 tried to fix this, but would break backwards compatibility of exisitng Lua scripts. This commit fixes that change by adding the timestamp variables in both a new Lua table as well as the old filetypes table. Change-Id: I74749acb51dc85094e8c63b240a1951bd4cc0330 Reviewed-on: https://code.wireshark.org/review/4370 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-09-29Fix lua bindings to handle timestamp precision changesEvan Huus2-2/+11
The recent wiretap changes broke the generation of init.lua among other things, though it did coincidentally fix one of the "yuck" comments in the generator regex. (Note that this is entirely untested, because out-of-tree init.lua is and always has been broken, but it should work) Change-Id: Id0c27b31c596613997de4ba2f6088eb9d6c8fc53 Reviewed-on: https://code.wireshark.org/review/4361 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-09-28Make the time stamp resolution per-packet.Guy Harris1-6/+6
Pcap-ng files don't have a per-file time stamp resolution, they have a per-interface time stamp resolution. Add new time stamp resolution types of "unknown" and "per-packet", add the time stamp resolution to struct wtap_pkthdr, have the libwiretap core initialize it to the per-file time stamp resolution, and have pcap-ng do the same thing with the resolution that it does with the packet encapsulation. Get rid of the TS_PREC_AUTO_XXX values; just have TS_PREC_AUTO, which means "use the packet's resolution to determine how many significant digits to display". Rename all the WTAP_FILE_TSPREC_XXX values to WTAP_TSPREC_XXX, as they're also used for per-packet values. Change-Id: If9fd8f799b19836a5104aaa0870a951498886c69 Reviewed-on: https://code.wireshark.org/review/4349 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-20Fix wslua_filehandler_open() to work as wiretap open routines should.Guy Harris1-2/+12
They should return 1 on success, -1 on error, and 0 if there was no error but the file isn't one of the type for the routine. They must not return any other value. If they return -1, they must set *err. Change-Id: I0f1e1675b4cc8f0214ad67a23de0e4ecb09cabea Reviewed-on: https://code.wireshark.org/review/4221 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-10Various minor changes:Bill Meier1-6/+19
- Create/use some extended value_strings - Remove unneeded #includes; - Do whitespace changes; - Add editor modelines. Change-Id: I2e1ea37dddfd5e8656c90c0d45a6596c4912bb2c Reviewed-on: https://code.wireshark.org/review/4065 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-09Fix some spelling & grammar.Bill Meier1-1/+1
Change-Id: Iedeaa411caa0823922dd79c27897a2349d4e6907 Reviewed-on: https://code.wireshark.org/review/4054 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-08-13Fix warning (turning error) when compiling with -O3Joerg Mayer1-1/+3
In file included from /home/jmayer/work/wireshark/git/epan/wslua/lrexlib_glib.c:199:0: /home/jmayer/work/wireshark/git/epan/wslua/lrexlib_algo.h: In function ‘generic_find_func’: /home/jmayer/work/wireshark/git/epan/wslua/lrexlib_algo.h:486:14: error: ‘ud’ may be used uninitialized in this function [-Werror=maybe-uninitialized] TUserdata *ud; ^ /home/jmayer/work/wireshark/git/epan/wslua/lrexlib_algo.h: In function ‘algf_gsub’: /home/jmayer/work/wireshark/git/epan/wslua/lrexlib_algo.h:281:14: error: ‘ud’ may be used uninitialized in this function [-Werror=maybe-uninitialized] TUserdata *ud; ^ Change-Id: I835103ea562ced44bc3cce5fadf6115476a78d0e Reviewed-on: https://code.wireshark.org/review/3568 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2014-08-12Fix generation of wslua taps in out-of-source-tree builds when the source treeJeff Morriss2-8/+7
is a source tarball (rather than git): Don't put the $(srcdir) path (from when the source tarball was made) into the C file: that file isn't regenerated when ./configure is run. (This is a correction to 0996730b91fddbf8aa7c61730a50da28ea1ab6a0). Also change a few dependency paths so they'll work in out-of-source-tree builds. Change-Id: I416f2d3611fb61659b9a7f7285e5f54a354fbe7d Reviewed-on: https://code.wireshark.org/review/3554 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-08-03Make Lua taps work in out-of-source-tree builds.Jeff Morriss4-19/+16
make-taps.pl needs to know where to find the source files in order to build the taps. This makes the wslua test suite run in autofoo out-of-source-tree builds too. To make it work with cmake builds requires putting all the epan/wslua/ output (or at least init.lua) in epan/wslua/ instead of epan/. Change-Id: I1b3c517f08d3c752ee03cb89482ee4951ceb5bf3 Reviewed-on: https://code.wireshark.org/review/3348 Petri-Dish: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
2014-08-02Rename buffer_ routines to ws_buffer_ to avoid name collisions.Guy Harris1-4/+4
In particular, epan/wslua/lrexlib.c has its own buffer_ routines, causing some linker warnings on some platforms, as reported in bug 10332. (Not to be backported to 1.12, as that would change the API and ABI of libwsutil and libwiretap. We should also make the buffer_ routines in epan/wslua/lrexlib.c static, which should also address this problem, but the name change avoids other potential namespace collisions.) Change-Id: I1d42c7d1778c7e4c019deb2608d476c52001ce28 Reviewed-on: https://code.wireshark.org/review/3351 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-02Revert "Make Lua taps work in out-of-source-tree builds."Evan Huus3-14/+11
Breaks on windows... This reverts commit 6b11cd97f2153bb015ade6efd05929999de85457. Change-Id: I1caf5500da993d7988e09fc0758950469f8252cf Reviewed-on: https://code.wireshark.org/review/3346 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-08-02Make Lua taps work in out-of-source-tree builds.Jeff Morriss3-11/+14
make-taps.pl needs to know where to find the source files otherwise none of the tap data gets built correctly. This makes the wslua test suite run in out-of-source-tree builds too. Change-Id: I059474d90d59e87bd57dba18530a66a927a014cf Reviewed-on: https://code.wireshark.org/review/3337 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-03Rename and move ui/stat_menu.h to epan/stat_groups.h.Guy Harris3-6/+6
The groups are, technically, independent of the notion of a menu, and, if we have mechanisms by which taps that are not only GUI toolkit-independent but independent of the *existence* of a GUI can be registered, they might want to register themselves in a group just in case they're running in a program that has a GUI. Also, this might fix the Debian package build. Change-Id: I29435681e79748fd4f2e0c5ac872cd11f831d172 Reviewed-on: https://code.wireshark.org/review/2830 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30Move stat_menu.h to libui.Guy Harris3-5/+5
Change-Id: I7bed7f7931845bc41035535cc62e1fe17c71047d Reviewed-on: https://code.wireshark.org/review/2726 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-18Remove svn $Id$ keyword in Lua scriptsPascal Quantin3-6/+0
Change-Id: I5c5f8659338aed36ba020a771a8b8222f2f7e025 Reviewed-on: https://code.wireshark.org/review/2416 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-06-18Convert the obvious emem to wmem in lua code.Evan Huus4-8/+15
Bug:9927 Change-Id: Ibf0dd45d3b54e489b70a4fde193b825ec703379e Reviewed-on: https://code.wireshark.org/review/2349 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-17lua_pushstring takes a copy of its argumentEvan Huus1-2/+4
free the value we pass it, fixing a memory leak Change-Id: I446cb85d82a0697c24035461ad03450855b68884 Reviewed-on: https://code.wireshark.org/review/2304 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-17Return number of bytes dissected in dissector:callStig Bjørlykke1-2/+4
This does not work for old-style dissectors as they always return the number of bytes in incoming buffer and not the number of bytes dissected. This is noted in the documentation. Change-Id: I5b236a73952cac3efc830e40276283bed9af1f87 Reviewed-on: https://code.wireshark.org/review/2237 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-16Convert a bunch of time_to_str functions to wmemEvan Huus1-2/+2
Change-Id: I24fe3cc4a3589dadc4528a77fe7ff13d06b1a983 Reviewed-on: https://code.wireshark.org/review/2245 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-15Fix documentation for DissectorTable_get_dissectorStig Bjørlykke1-4/+4
Change-Id: Ic8db06249c6326505b7f5c4518c3af2c6961066a Reviewed-on: https://code.wireshark.org/review/2234 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-05-24Allow wtap_read() and wtap_seek_read() to return records other than packets.Guy Harris4-4/+33
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-17lua: fix buffer underrunPeter Wu1-1/+1
A line containing just "\n" will cause a buffer underrun. Test: tshark -r test/captures/sipmsg.log -X lua_script:test/lua/acme_file.lua -w /dev/null Caught by ASAN. Change-Id: Idf38f1af2b211101b3929ee3fbd83c54c99c1e21 Reviewed-on: https://code.wireshark.org/review/1673 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-09Revert "Refactor Wiretap"Guy Harris3-115/+101
This reverts commit 1abeb277f5e6bd27fbaebfecc8184e37ba9d008a. This isn't building, and looks as if it requires significant work to fix. Change-Id: I622b1bb243e353e874883a302ab419532b7601f2 Reviewed-on: https://code.wireshark.org/review/1568 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-09Refactor WiretapMichael Mann3-101/+115
Start of refactoring Wiretap and breaking structures down into "generally useful fields for dissection" and "capture specific". Since this in intended as a "base" for Wiretap and Filetap, the "wft" prefix is used for "common" functionality. The "architectural" changes can be found in cfile.h, wtap.h, wtap-int.h and (new file) wftap-int.h. Most of the other (painstaking) changes were really just the result of compiling those new architecture changes. bug:9607 Change-Id: Ife858a61760d7a8a03be073546c0e7e582cab2ae Reviewed-on: https://code.wireshark.org/review/1485 Reviewed-by: Michael Mann <mmann78@netscape.net>