aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
AgeCommit message (Collapse)AuthorFilesLines
2017-02-27wslua: fix documentation of Struct.fromhexPeter Wu1-1/+1
The default separator is really an empty string, not a single space. This has been wrongly documented since the beginning. Change-Id: I5598daec1486ce17cfeeaf5697f9759172db9cf5 Fixes: v1.11.3-rc1-1760-g860747e1e7 ("Adds some Lua helper functions: some commonly used functions, and to help troubleshooting Lua scripts") Reviewed-on: https://code.wireshark.org/review/20296 Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-10Rename tvb_new_subset() to tvb_new_subset_length_caplen().Guy Harris1-1/+1
This emphasizes that there is no such thing as *the* routine to construct a subset tvbuff; you need to choose one of tvb_new_subset_remaining() (if you want a new tvbuff that contains everything past a certain point in an existing tvbuff), tvb_new_subset_length() (if you want a subset that contains everything past a certain point, for some number of bytes, in an existing tvbuff), and tvb_new_subset_length_caplen() (for all other cases). Many of the calls to tvb_new_subset_length_caplen() should really be calling one of the other routines; that's the next step. (This also makes it easier to find the calls that need fixing.) Change-Id: Ieb3d676d8cda535451c119487d7cd3b559221f2b Reviewed-on: https://code.wireshark.org/review/19597 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-01-07Convert range API to always use wmem memory.Michael Mann2-10/+10
This is mostly to address memory leaks in range preferences (the biggest user of range functionality) on shutdown. Now range preferences must use epan scoped memory when referencing internal preference structures to keep consistency. Change-Id: Idc644f59b5b42fa1d46891542b53ff13ea754157 Reviewed-on: https://code.wireshark.org/review/19387 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-21Lua: Fix some typos.Stig Bjørlykke1-8/+8
Change-Id: I4d1cf878245b03665207a500fb7593be1435c3d3 Reviewed-on: https://code.wireshark.org/review/19371 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-20Lua: Add string types and byte seperators support.Stig Bjørlykke3-32/+140
Add handling of STR_ASCII and STR_UNICODE as base types for string and stringz. Add handling of SEP_DOT, SEP_DASH, SEP_COLON and SEP_SPACE for bytes and uint_bytes. Add SEP_NONE for completeness. Change-Id: Ida46c215fee7ec7132ec91ab5dd6cb3de4628920 Reviewed-on: https://code.wireshark.org/review/19337 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-12-20cmake,wslua,wsutil: load files from run/ instead of source treePeter Wu3-19/+23
Fixes Lua on macOS, tested with an out-of-tree build: WS_BIN_PATH=$PWD/run ../wireshark/test/test.sh -s wslua Previously programs that were ran from the build directory would load data files (radius/, diameter/, init.lua) from the source directory. Then in the case of Lua, files were loaded from the program directory ($BUILDDIR/run/init.lua on Linux) or source directory (sSOURCEDIR/epan/wslua/console.lua). On macOS, this does not work for Lua since files are installed into $BUILDDIR/run/Wireshark.app/Contents/Resources/share/wireshark/init.lua instead. Since CMake always copies data files (radius, console.lua, etc.) into the build directory, make get_datafile_dir() return this "run" directory instead. Change-Id: If97d2f5686271caf9ad4d4e4fc58e902dc592a98 Reviewed-on: https://code.wireshark.org/review/19330 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-12-20Lua: Remove an obsolete comment.Stig Bjørlykke1-1/+0
Change-Id: I6a946eb44f4a574d6d9add3604b2dac924c33a9f Reviewed-on: https://code.wireshark.org/review/19361 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-12-20Lua: Add unit names support.Stig Bjørlykke2-43/+194
Add support for using unit names in ProtoField integer types by using base.UNIT_STRING. Add unit name table argument in ProtoField.float() and ProtoField.double() (and made backward compatibility). The use of base.UNIT_STRING is not really the best API for adding unit names in Lua, but is the simples solution without adding new arguments to ProtoField. Change-Id: Ib5d064480cffd970a41db1764440642f6c593bb2 Reviewed-on: https://code.wireshark.org/review/19313 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-12-19Lua: Include all BASE_PT_* to base table.Stig Bjørlykke1-1/+1
Also added a note above field_display_e enum to indicate that this values are parsed in make-init-lua.pl to build init.lua. Change-Id: Ibd125684f9a68e1b8116fae0ccbc72147825d75d Reviewed-on: https://code.wireshark.org/review/19336 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-12-18Lua: Fix some memory leaks in error paths.Stig Bjørlykke1-34/+60
Because luaL_argerror() does a longjmp all memory free must be done before calling this. Also rewrote true_false_string_from_table() to be a bit simpler and to give argument error when too many strings in the table. Change-Id: Ied0fa468f1274155c746fe2e086dacf1a8582b08 Reviewed-on: https://code.wireshark.org/review/19325 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-12-02Include config.h first, for large-file-related #defines.Guy Harris1-2/+1
Change-Id: Id71326bc89e1461b100df99b618a1c49256b93af Reviewed-on: https://code.wireshark.org/review/19037 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-11-29Handle FT_CHAR, and report unsupported types as such.Guy Harris1-4/+12
FT_CHAR is straightforward to support. Split the list of "invalid" types into a list of "unsupported" types and a short list of "invalid" types, containing FT_PCRE (which isn't a valid type for a field) and "everything else". Add FT_IEEE_11073_SFLOAT and FT_IEEE_11073_FLOAT to the "unsupported" list. Flag the whole unsupported list as just "not handled yet". Change-Id: I62d2d7eead53377e4e601594a035b4395fdbeead Reviewed-on: https://code.wireshark.org/review/18979 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-11-22lua: Allow FT_ETHER protofields to be inserted in TreeItems.Franklin "Snaipe" Mathieu1-0/+10
Change-Id: If1daef88dce166ec92f00a8c6e71bcb220d25e0c Signed-off-by: Franklin "Snaipe" Mathieu <snaipe@diacritic.io> Reviewed-on: https://code.wireshark.org/review/18917 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-11-13lua: Allow proto:register_heuristic to be used on multiple list namesFranklin "Snaipe" Mathieu1-2/+11
In the C API, one can register a heuristic for the same protocol on different lists by specifying another unique short_name. This is impossible in the lua API, as the protocol name is used as the short name itself. This change fixes that by creating an unique shortname composed of the protocol name and the target list name. Change-Id: I2c30ce6e4f7a3b38879180c64cf8564f779163b4 Signed-off-by: Franklin "Snaipe" Mathieu <snaipe@diacritic.io> Reviewed-on: https://code.wireshark.org/review/18711 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-11-06lua: Added new integer sizes in TvbRangeFranklin "Snaipe" Mathieu1-6/+36
* Added support for 3-byte integers in :int() and :le_int() * Added support for 5, 6, and 7-byte integers in :int64() and :le_int64() Change-Id: If9ab4ea806191bc63effe45a081b9c65693c2367 Signed-off-by: Franklin "Snaipe" Mathieu <snaipe@diacritic.io> Reviewed-on: https://code.wireshark.org/review/18672 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-10-26wslua_pref(.c): fix spelling typo found by lintianAlexis La Goutte1-2/+2
Change-Id: Ie371e144a9b385d893ead67c03688841039b8319 Reviewed-on: https://code.wireshark.org/review/18484 Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-10-25lua: Added support for FT_IPv6 fieldsSnaipe3-10/+61
* Implement Tvb:ipv6() * Handle FT_IPv6 protofields during insertion in the lua tree * Implement Address.ipv6(hostname) Change-Id: I585c392681b3aef02ed8ee956f74051d77fb28d4 Signed-off-by: Franklin "Snaipe" Mathieu <snaipe@diacritic.io> Reviewed-on: https://code.wireshark.org/review/18442 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-18wslua: prepare for split class/instance (meta)methodsPeter Wu3-248/+329
Previously the metatables for classes were the same for the class and its instances. This results in issues like calling __gc on the class table on exit. Make it possible to declare separate class methods (functions) and instance methods. Observe that all attributes apply to the instances only, so make these just available on the instance. The attribute/methods lookup method (via __index/__newindex) have been rewritten to use upvalues, removing the technical need for the properties __getters/__setters/__methods. The "lua globals" test still checks for these, but it could be removed in the future. To fix bug 12968, the __gc method is removed from the class method. Future patches should remove the WSLUA_REGISTER_CLASS, WSLUA_REGISTER_META and WSLUA_REGISTER_ATTRIBUTES macros completely and create split class functions/methods (such that __call for an instance cannot accidentally be invoked on the class). Removed duplicate "fragmented" property from Pinfo (which triggered an error) and replaced exit() by g_error() for debugger friendliness. Remove lua_shiftstring since checkstring always returns non-NULL. Bug: 12968 Change-Id: I57f8a93d08bb84c79b0e94cf2c82d8402fc16646 Reviewed-on: https://code.wireshark.org/review/18026 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2016-10-18wslua: add support for negative indicesPeter Wu1-11/+21
Internal change, this allows use of negative indices for lua_rawgetfield/lua_rawsetfield convenience functions and is closer to lua_getfield/lua_setfield semantics in terms of indices. Add lua_absindex for compatibility with Lua 5.1 (do not bother exporting it yet since it is only used in this file, also do not rename it since it is the same functionality with no Wireshark-specific changes.) Change-Id: I322954ef461164ec514ed9f034ae2691775e67da Reviewed-on: https://code.wireshark.org/review/18025 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-10-18wslua: fix errors in documentation, add notational conventionsPeter Wu3-9/+4
Improve example with better formatting, clarification comments and more common variable names. Extend make-wsluarm.pl to support arguments containing underscores. Fixes the description of dissect_tcp_pdus. Change TvbRange.tvb(tvb) into tvbrange:tvb() and ByteArray.tvb(name) into bytearray:tvb(name), these are really instance methods. Change-Id: I1e20ef46195dc6c06f9ac790d3432db283d21a5e Reviewed-on: https://code.wireshark.org/review/18226 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-10-18wslua: Do not crash on the root tree itemPeter Wu1-2/+3
ti->item is NULL for the root item, prevent a NULL-deref by Lua script. Bug: 13017 Change-Id: I5e7f71d014a01bab615288df76509b3ef97b1bf6 Reviewed-on: https://code.wireshark.org/review/18247 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-10-14Lua: allow creating TVBs after calling other (Lua) dissectors.Jeff Morriss1-6/+12
Don't set `lua_tvb` (or any of the other global variables) to NULL after a Lua dissector is called: it's possible that the caller is also a Lua dissector which may want/need that (global) variable to still be set (to the value it had before the sub-dissector was called). This fixes the problem reported in: https://ask.wireshark.org/questions/56110/lua-error-tvbs-can-only-be-created-and-used-in-dissectors Making these variables not be a globals (as suggested at the top of init_wslua.c) might be a better solution--for another day. Change-Id: I14fb8ec35b62abeda3f3471a323b88c80537a06e Reviewed-on: https://code.wireshark.org/review/18095 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Peter Wu <peter@lekensteyn.nl>
2016-10-02wslua: fix wslua file test failurePeter Wu1-0/+10
Lua 5.2.4 built with -DLUA_USE_APICHECK detected a stack issue: tshark: lapi.c:175: lua_settop: Assertion `(-(idx+1) <= (L->top - (func + 1))) && "invalid new top"' failed. Function File_read always assumes that File_read_line pushes a value on the stack (which clearly did not happen). On read failure, it would then pop the stack (tripping the assertion) to push nil. The other user (File_lines) is also affected by this change, but the Lua 5.2.4 documentation says that it should also return nil on EOF, fitting this implementation. Change-Id: I9cc8a5319523b2b56f4ae4735bbdbc1196387386 Reviewed-on: https://code.wireshark.org/review/18016 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-09-30cmake: make WERROR_COMMON_FLAGS a normal stringPeter Wu1-7/+5
Instead of checking for the boolean "FALSE", just set an empty string. This avoids the need to check for WERROR_COMMON_FLAGS before using it. The transformation is the same for all files, remove "if (WERROR_COMMON_FLAGS)" and "endif()", reindent and add quotes (since we have a string here and not a list). Modelines have been added where missing. Change-Id: I0ab05ae507c51fa77336d49a99a226399cc81b92 Reviewed-on: https://code.wireshark.org/review/17997 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Dario Lombardo <lomato@gmail.com> Tested-by: Dario Lombardo <lomato@gmail.com>
2016-08-31Don't do any Decode As stuff for dissector tables not used with Decode As.Guy Harris1-1/+1
Have all dissector tables have a "supports Decode As" flag, which defaults to FALSE, and which is set to TRUE if a register_decode_as() refers to it. When adding a dissector to a dissector table with a given key, only add it for Decode As if the dissector table supports it. For non-FT_STRING dissector tables, always check for multiple entries for the same protocol with different dissectors, and report an error if we found them. This means there's no need for the creator of a dissector table to specify whether duplicates of that sort should be allowed - we always do the check when registering something for "Decode As" (in a non-FT_STRING dissector table), and just don't bother registering anything for "Decode As" if the dissector table doesn't support "Decode As", so there's no check done for those dissector tables. Change-Id: I4a1fdea3bddc2af27a65cfbca23edc99b26c0eed Reviewed-on: https://code.wireshark.org/review/17402 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-23CMake: Allow setting per target compiler warningsJoão Valverde1-0/+1
Setting our compiler warning flags in CMAKE_C_FLAGS does not allow using different flags per target. Allow for that possibility by setting the internal WS_WARNINGS_{C,CXX}_FLAGS and using the COMPILE_OPTIONS property to set them. This change is just setting mechanism and there should be no difference in generated warnings. The check_X_compiler_flag cmake test is changed to test each flag individually. We need a list, not a space separated string, and the aggregate test is not significant. Change-Id: I59fc5cd7e130c7a5e001c598e3df3e13f83a6a25 Reviewed-on: https://code.wireshark.org/review/17150 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-08-05Add PI_DEPRECATED expert info groupJoão Valverde2-0/+13
Change-Id: Ibc43b1976d5827e8c40252a5200852fbcd00b70c Reviewed-on: https://code.wireshark.org/review/16763 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: João Valverde <j@v6e.pt>
2016-07-26Use ws_g_warning in wslua.Michael Mann6-39/+44
The g_warning calls seem legitimate, so "hide" them from checkAPIs.pl. Change-Id: I6d25b08e22aeeb0244e07836385f2b67d6261546 Reviewed-on: https://code.wireshark.org/review/16703 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-25Fix checkAPI.pl warnings about printfMichael Mann2-3/+5
Many of the complaints from checkAPI.pl for use of printf are when its embedded in an #ifdef and checkAPI isn't smart enough to figure that out. The other (non-ifdef) use is dumping internal structures (which is a type of debug functionality) Add a "ws_debug_printf" macro for printf to pacify the warnings. Change-Id: I63610e1adbbaf2feffb4ec9d4f817247d833f7fd Reviewed-on: https://code.wireshark.org/review/16623 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-07-21No need to check for string option values being null.Guy Harris1-2/+2
A string option, if present, always has a value; it might be a null *string*, but you won't get a null pointer (if the option isn't present, it simply isn't present). Fix some comments while we're at it. Change-Id: I9c1420f56998a7d04de5c5cc2e92631b181f303a Reviewed-on: https://code.wireshark.org/review/16564 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-14Redo the block options APIs.Guy Harris2-5/+38
A block can have zero or more instances of a given option. We distinguish between "one instance only" options, where a block can have zero or one instance, and "multiple instances allowed" options, where a block can have zero or more instances. For "one instance only" options: "add" routines add an instance if there isn't one already and fail if there is; "set" routines add an instance if there isn't one already and change the value of the existing instance if there is one; "set nth" routines fail; "get" routines return the value of the instance if there is one and fail if there isn't; "get nth" routines fail. For "multiple instances allowed" options: "add" routines add an instance; "set" routines fail; "set nth" routines set the value of the nth instance if there is one and fail otherwise; "get" routines fail; "get nth" routines get the value if the nth instance if there is one and fail otherwise. Rename "optionblock" to just "block"; it describes the contents of a block, including both mandatory items and options. Add some support for NRB options, including IPv4 and IPv6 option types. Change-Id: Iad184f668626c3d1498b2ed00c7f1672e4abf52e Reviewed-on: https://code.wireshark.org/review/16444 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-04wslua: fail on tree:add(nil)Peter Wu1-0/+2
It is unlikely that tree:add(nil) or tree:add(nil, tvb) represents a valid invocation. Most likely the developer made a mistake and tried something like: local pf_thing = ProtoField.string("some.thing", "Description") some_proto.fields = { pf_thing } ... tree:add(some_proto.fields.thing, tvb()) which should have been: some_proto.fields = { thing = pf_thing } or: tree:add(pf_thing, tvb()) Save the developer some pain and bail out early. Change-Id: I59fc04153f02bb186b47b763676a68bb0271df76 Reviewed-on: https://code.wireshark.org/review/16177 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-19Revert "tap: change glib functions to wmem."Pascal Quantin2-6/+6
This reverts commit 2e9f3c5d366eaa7139fc877b5301392166b3f985. It breaks the registration of codec, dissector and libwiretap plugins. Change-Id: I4ef91dd192f765adf87ea9fe9f3693e25dbd24de Reviewed-on: https://code.wireshark.org/review/16012 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-17tap: change glib functions to wmem.Dario Lombardo2-6/+6
Change-Id: I878ae6b121a669f9b7f4e1e57bc079f0cb44c0bf Reviewed-on: https://code.wireshark.org/review/15270 Petri-Dish: Dario Lombardo <lomato@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>
2016-06-15capture info (wslua): Dereference of null pointerAlexis La Goutte1-0/+2
Change-Id: Iced579d5acaefa9d1c8e3775a53916773bf87659 Reviewed-on: https://code.wireshark.org/review/15929 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-06-15Remove Nmake build systemPascal Quantin2-131/+0
Change-Id: I3bd474f3cda9667dec66426b5729449953df3e61 Reviewed-on: https://code.wireshark.org/review/15777 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jörg Mayer <jmayer@loplof.de> Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2016-06-14wslua: remove FAIL_ON_NULL_MEMBER_OR_EXPIREDPeter Wu2-12/+16
Ensure that the member cannot be NULL at initialization, simplifies checkCaptureInfo and checkCaptureInfoConst logic. Change-Id: I2d9caa4a235310569ebbf0b30199dd3df7a4c093 Reviewed-on: https://code.wireshark.org/review/14791 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-14wslua: Drop unused "push_code" macro parameterPeter Wu24-38/+37
Reduce noise, no caller has used this parameter since its introduction. Msotly automated regex search and replace. Change-Id: I4b1180bfee8544b38d19c9c440ff5b9b0dc080b2 Reviewed-on: https://code.wireshark.org/review/14790 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-01Add data structures necessary to support multiple Section Header blocks.Michael Mann2-15/+19
This doesn't try to use any data from multiple Section Header blocks, it just converts single Section Header block usage into a GArray, so the potential is there to then use/support multiple Section Header blocks within a file format (like pcapng) Change-Id: I6ad1f7b8daf4b1ad7ba0eb1ecf2e170421505486 Reviewed-on: https://code.wireshark.org/review/15636 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-22Add wtap_optionblock_set_option_string_formatMichael Mann1-1/+2
Also add a length parameter to wtap_optionblock_set_option_string Change-Id: I8c7bbc48aa96b5c2a91ab9a17980928d6894f1ee Reviewed-on: https://code.wireshark.org/review/15505 Reviewed-by: Anthony Coddington <anthony.coddington@endace.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-10Have fvalue_to_string_repr always return an (wmem) allocated buffer.Michael Mann1-7/+11
Previous patches converted all fvalue_to_string_repr calls to expect an allocated buffer (and not a passed in one). Now changing signature to force an allocated buffer. Added wmem in case that can be taken advantage of within epan (and since the function signature was changing anyway). Change-Id: Ica1ac4a9a182ce0e73303856329e198d9d525b7b Reviewed-on: https://code.wireshark.org/review/15343 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-02Add checkAPI calls to CMake.Graham Bloice1-0/+9
This generates a top level target, checkAPI, that is excluded from the ALL build target, so must be run separately. On Windows using a Visual Studio generator, call msbuild /p:Configuration=RelWithDebInfo checkAPI.vcxproj Change-Id: I44a57c564dcfc75499463b942436f4b920a82478 Reviewed-on: https://code.wireshark.org/review/14873 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2016-04-17wslua: fix crash on Lua errors in dissect_tcp_pdus get_len_funcPeter Wu1-3/+4
A similar problem was addressed in v1.99.10rc0-339-g82b2258, but that patch missed the get_pdu_len function. A crash could occur when get_pdu_len does not return a number or when it raises a Lua error. Change-Id: I1a42a95d88708ae3bf6e015ba8d7af4db5071a00 Reviewed-on: https://code.wireshark.org/review/14954 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-04-17make-taps.pl: Remove perl >= 5.14 requirementJoão Valverde1-1/+4
Follow up to 2226802826c4ba802696d5df274094cec3818af1. Change-Id: Icd199a692f13bf30a68f655e30d7353987b22a6c Reviewed-on: https://code.wireshark.org/review/14942 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-04-16make-taps.pl: Enable "use warnings" pragmaJoão Valverde1-18/+19
Replace sprintf to fix newly generated warning. Change-Id: I85e8b0989c0caa4c9b079883b8653c9892df171c Reviewed-on: https://code.wireshark.org/review/14677 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-04-11Lua: Fix add and remove Fields when reload Lua pluginsStig Bjørlykke3-13/+20
Reset wslua_dfilter and remove the Field tap_listener when reloading plugins. Check for tap listeners in rescan_packets() after ws_epan_new() because Lua may register the Lua field tap when adding Fields. Bug: 12328 Change-Id: Ibbd8339033132c6f3b61d7e9c9ced9ed2b9affec Reviewed-on: https://code.wireshark.org/review/14871 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-04-10wslua: Abort on out of memoryPeter Wu1-1/+9
The current wslua code does not properly handle out of memory conditions. Since recovering from OOM is difficult in many places, just abort the program (which is done by g_realloc). Change-Id: Idae68d08c90c82ba5df18a28cc1e507d61d20e78 Reviewed-on: https://code.wireshark.org/review/14786 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-04-10lua: fix reload with -Xlua_scriptPeter Wu1-5/+6
Use ex_opt_get_nth instead of ex_opt_get_next to avoid consuming the parameters. This ensures that lua scripts via the "-Xlua_script" parameter are also reloaded. Change-Id: I316726cdf99f7ee3d738d3632a7f639ea8596f96 Reviewed-on: https://code.wireshark.org/review/14870 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-04-04Rename "libz" to "zlib"João Valverde1-2/+2
Change-Id: I12f92c983d587c2a4751428cdf299635090c9f0b Reviewed-on: https://code.wireshark.org/review/14748 Reviewed-by: João Valverde <j@v6e.pt> Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-03-31wslua: avoid memleak on duplicate names for Proto.newPeter Wu1-2/+2
luaL_error never returns, free memory before. Change-Id: Ibcdbdb6afea5d2dab7be6a16c4c2536dcf14220a Reviewed-on: https://code.wireshark.org/review/14734 Reviewed-by: Michael Mann <mmann78@netscape.net>