Commit Graph

175 Commits

Author SHA1 Message Date
Philipp Dittmann 9c68879a27 Windows: Fix Release (unused variables)
- ws_assert does not work, because _ASSERT_ENABLED is false and gets optimized
- add _U_ to unused variables because of compile flag /W3
- local variables need suppression of warning 4189
2023-01-11 17:50:42 +00:00
Guy Harris 17d7b7cb73 wslua_proto: document the init and prefs_changed functions.
Don't just indicate that they exist and are settable, indicate what the
*do*.

See https://ask.wireshark.org/question/29843/how-to-maintain-a-packetfile-specific-var/.
2022-12-10 02:49:52 -08:00
Gerald Combs fbadb8c785 wslua: Capitalize words in our markup.
Capitalize words in our markup instead of depending on make-wsluarm.pl.
Add a single space after "Mode:".
2022-07-20 14:52:40 -07:00
Chuck Craft 39fc49b792 wsdg: escape tick marks after backtick; fix typo 2022-06-22 18:55:27 -05:00
Stig Bjørlykke cfe33625a0 wslua: Initialize Proto members on creation
Set all pointers in Proto to NULL and check for valid pointers when
wslua_deregister_protocols().

Fixes #17668
2021-10-19 20:50:45 +00:00
João Valverde 1a702e5430 Try to avoid -Wunused with vanishing macros 2021-06-10 00:51:59 +01:00
João Valverde e10f761362 wslua: Replace g_assert() with ws_assert() 2021-05-19 03:52:45 +01:00
Moshe Kaplan e16166a74c Detect and replace bad allocation patterns
Adds a pre-commit hook for detecting and replacing
occurrences of `g_malloc()` and `wmem_alloc()` with
`g_new()` and `wmem_new()`, to improve the
readability of Wireshark's code, and
occurrences of
`g_malloc(sizeof(struct myobj) * foo)`
with
`g_new(struct myobj, foo)`
to prevent integer overflows

Also fixes all existing occurrences across
the codebase.
2020-12-22 14:56:38 +00:00
Gerald Combs 6f59b8e84d wslua: Cross-reference and title case fixes.
Use lua_class_DissectorTable instead of lua_class_DissectorTables.

Use title case for each module.

Change-Id: Ie855022ee59a857c8ced7c3e6ba070ab494fa017
Reviewed-on: https://code.wireshark.org/review/36634
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-03-30 16:42:18 +00:00
Gerald Combs 87be7fa23c wslua: Update the dissector docs.
Add content from https://wiki.wireshark.org/LuaAPI/Dissector,
https://wiki.wireshark.org/LuaAPI/Pref, and
https://wiki.wireshark.org/LuaAPI/Proto. Update as needed.

Change-Id: I74a167feb9db0fcdb723501e4692da020db1ab2c
Reviewed-on: https://code.wireshark.org/review/36629
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-30 08:55:19 +00:00
Stig Bjørlykke 541afedfbc wslua: Fix memleak of unregistered ProtoExpert
If a ProtoExpert object was created, but not linked to a Proto, then the
object and some fields (abbrev, text) would leak.

This is a follow-up to g79fef2ae.

Change-Id: Ic0b44e8b70895a19d9b52a0e44064a1e76a58fa0
Reviewed-on: https://code.wireshark.org/review/34876
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-10-28 16:16:49 +00:00
Stig Bjørlykke 551745998e wslua: Fix memleak of unregistered ProtoField strings
If a ProtoField object was created, but not linked to a Proto, then the
strings field and all elements (depending on type) would leak.

This is a follow-up to g79fef2ae and fixes the real issue in g44870fb1.

Change-Id: I01880a92bb20fae45f68c754b07daeb07630deec
Reviewed-on: https://code.wireshark.org/review/34872
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Vasil Velichkov <vvvelichkov@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-10-28 15:05:54 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Stig Bjørlykke 8b75b52254 wslua: Don't defer deletion of subtree indexes
The subtree indexes are only used in the dissector so it's not
needed to defer the deletion.

Change-Id: I33600897a186c078cc1021cde5a1d90054d475c8
Reviewed-on: https://code.wireshark.org/review/31800
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-29 14:30:37 +00:00
Peter Wu 79fef2ae50 wslua: fix memleak of unregistered ProtoField field
If a ProtoField object was created, but not linked to a Proto, then some
fields (name, abbrev, blob) could leak. Fixes ASAN test failures for
four wslua tests.

Change-Id: I570ea154153b505ba81edb2bbf538e6dc1438728
Reviewed-on: https://code.wireshark.org/review/31750
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-27 09:43:26 +00:00
Peter Wu 03e13a6a9f wslua: fix memleaks related to Proto and Pref
Proto objects were only freed while reloading Lua plugins, be sure to
release these on program exit too. Fix missing deallocation of heur_list
(matches per-protocol cleanup in proto_cleanup_base).

Be sure to keep a reference to the "Pref" object after registering it to
a Proto, otherwise it could be garbage-collected early, resulting in
memleaks (because the preference was still in use).

Fixes a lot of memory leaks reported by ASAN for tests, ten tests were
affected by Proto_new leaks, four were affected by the new_pref leaks.

Change-Id: Ica52718849a33eda614775f533dc0fcefec9cc74
Reviewed-on: https://code.wireshark.org/review/31746
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-27 09:43:05 +00:00
Martin Kaiser 965248dcfb wslua: register attributes along with their class
At the moment, wslua first registers a class and then adds its
attributes in a second step. This registration creates empty __getters
and __setters tables which are later populated with the getter and
setter methods of the attributes.

Looking at the code and the comments, it seems that this was meant to be
a temporary solution. Eventually, attributes should be stored in
wslua_class' attrs field. The code to read and write attributes was
already updated to handle this.

Add new macros WSLUA_REGISTER_CLASS/_META_WITH_ATTRS that store the
attributes in wslua_class. Defining new macros is simpler than modifying
WSLUA_REGISTER_CLASS/_META to register attributes. If we did the latter,
we'd have to add an empty attribute list for all classes without
attributes.

We can now drop the WSLUA_REGISTER_ATTRIBUTES macro and the
wslua_reg_attributes function.

Using this new way of registering attributes, the __getters and
__setters tables are still available. The tests is the test suite that
rely on those tables still pass.

Change-Id: I526b9116435645c9c54ab69a05c3c7f3d459ec33
Reviewed-on: https://code.wireshark.org/review/31417
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-21 11:51:01 +00:00
Gerald Combs 5a674d05c9 wslua: Convert more comment markup to Asciidoctor.
Convert links, source code blocks, and admonitions.

Change-Id: I50c8daa19a115c23f7501b91dbfd904779a609c9
Reviewed-on: https://code.wireshark.org/review/25720
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-02-11 17:12:52 +00:00
Dario Lombardo ff6e2fbb1b wslua: use SPDX identifiers.
Change-Id: I80d9d4e3ffc25eebf09e6ef693c378b77554e1b8
Reviewed-on: https://code.wireshark.org/review/25693
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-09 12:31:21 +00:00
Stig Bjørlykke 862a0b6472 epan: Make expert info summary text mandatory
This will make the code easier and removes the use of a generic
"Expert Info" as name.

Change-Id: I57ad2adb851726106ddc5009f3c6ca61721f647a
Reviewed-on: https://code.wireshark.org/review/24792
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-14 06:06:47 +00:00
Stig Bjørlykke f945b85391 epan: Use expert info summary text as field name
Change the expert info registry to use summary text as field name instead
of blurb to show the correct column header tooltip in custom columns.

Preserve backward compability by not use empty summary text.

Change-Id: Ibbaf142165be0d9f42d1e2476f39f8d251ea0593
Reviewed-on: https://code.wireshark.org/review/24788
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-12-13 10:35:36 +00:00
Guy Harris c079255539 Add an API to let a postdissector specify fields whose values it needs.
Currently, this is only used to determine whether a protocol tree needs
to be built on the first pass or not - if there are postdissectors that
need fields, it does - but eventually we should be able to use it to
prime the dissection to deliver those fields in cases where we don't
need the *entire* protocol tree (rather than using a hack such as
cooking up a fake tap with a fake filter to do that).

Update MATE and TRANSUM to use it.

Clean up code to check whether we need a protocol tree, and add comments
before that code indicating, in each case, what the criteria are.

The array of postdissectors includes a length, so we don't need to
separately keep track of the number of postdissectors.

Clean up indentation while we're at it.

Change-Id: I71d4025848206d144bc54cc82941089a50e80ab7
Reviewed-on: https://code.wireshark.org/review/21029
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-12 04:31:19 +00:00
Franklin "Snaipe" Mathieu 7f2a838922 lua: Allow proto:register_heuristic to be used on multiple list names
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-13 17:48:30 +00:00
Peter Wu f6e223c895 wslua: Drop unused "push_code" macro parameter
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-14 18:32:51 +00:00
Peter Wu a9ba46856c wslua: fix crash on Lua errors in dissect_tcp_pdus get_len_func
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-17 21:11:23 +00:00
Peter Wu 2ee62c55e7 wslua: avoid memleak on duplicate names for Proto.new
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>
2016-03-31 20:39:16 +00:00
Joerg Mayer 7e5dae90d6 Fix warnings/errors of type -Wused-but-marked-unused
Change-Id: I34c2d9953272822da0745d1b24c64d8466e43b37
Reviewed-on: https://code.wireshark.org/review/14668
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-03-28 13:27:52 +00:00
Stig Bjørlykke 6f220a343e Lua: Remove heur dissectors when reload Lua plugins
When reloading Lua plugins all registered heuristic dissectors
must be removed.

Bug: 12251
Change-Id: Ib7da6df347fb9294f5394ae531b582bf6d2730bb
Reviewed-on: https://code.wireshark.org/review/14429
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>
2016-03-13 10:51:44 +00:00
Stig Bjørlykke 39c11ce133 Lua: Check for duplicate heuristic short name
A Proto may be only be registered with a heuristic dissector once,
because we check this in heur_dissector_add().

Change-Id: I524fa832b647d557f13aedcb870f7789058d2180
Reviewed-on: https://code.wireshark.org/review/14436
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>
2016-03-13 10:20:12 +00:00
Stig Bjørlykke ea1789f925 Qt: Reload Lua expert infos
Support reloading Lua plugins with expert infos.
Use the same delayed deregister logic as for fields.

Change-Id: I36efa0820050b3a7afed4de7a8b0fa16805e8dfa
Reviewed-on: https://code.wireshark.org/review/12498
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>
2015-12-11 05:17:58 +00:00
Michael Mann 1474f49f19 new_register_dissector -> register_dissector for remaining uses.
Mostly plugins, but also LUA and generated skinny dissector.

Change-Id: Ifeb4205442f9a60875266b4e82841ff38b4fdb63
Reviewed-on: https://code.wireshark.org/review/12515
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-11 03:42:37 +00:00
Stig Bjørlykke 94b9907d0f Lua: Validate Proto() arguments
Check if description (protocol name) and short_name are used before
registering the protocol.  This because proto_register_protocol() makes
sure there's not already a protocol with any of the names registered
and duplicates will be reported with a g_error() which terminates the
Wireshark unexpectedly.

Also check if short_name contains valid characters.

Give appropriate error messages.

Bug: 11739
Change-Id: Ib9776a2a3406ae5278ce744defd61864ebed0282
Reviewed-on: https://code.wireshark.org/review/11995
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-11-21 20:30:26 +00:00
Peter Wu 82b225898b wslua: fix crash when a LUA error is raised in TRY block
The dissect_tcp_pdus function in LUA is passed two LUA functions that
get the PDU length and the dissect a PDU. When one of these functions
fail, a longjmp is made to the the caller of lua_pcall.

This is no problem for the PDU length function, but the PDU dissect
function is wrapped in a TRY/CATCH/ENDTRY block which also uses longjmp
and need to be fully executed. Without doing so, LUA exceptions will
crash on a weird location (except_pop).

Fix the crash by not using luaL_error, but throw dissector errors which
properly breaks out of the tcp_dissect_pdus C function and then convert
it to a LUA error such that the dissector can handle it.

Test with `tshark -X lua_script:crash.lua -r ssl.pcap`:

    trivial_proto = Proto("trivial", "Trivial Protocol")
    function dissect_foo(tvb, pinfo, tree)
        error("triggering a LUA error");
    end
    function get_pdu_len(tvb, pinfo, tree) return 5; end
    function trivial_proto.dissector(tvb, pinfo, tree)
        dissect_tcp_pdus(tvb, tree, 5, get_pdu_len, dissect_foo)
    end
    tcp_table = DissectorTable.get("tcp.port")
    tcp_table:add(443, trivial_proto)

It should not crash and will print this:

    Lua Error: dissect_tcp_pdus dissect_func: [string "crash.lua"]:3: triggering a LUA error

Change-Id: Ibd079cc5eb3a2e4d2e62ea49a512fa2cc8e561ea
Reviewed-on: https://code.wireshark.org/review/10685
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-10-05 02:30:16 +00:00
Stig Bjørlykke ecc4f756bd Added Reload Lua plugins.
This is initial support for reloading Lua plugins without
restarting the application.

Still todo:
- Deregister FileHandlers
- Support deregister ProtoField with existing abbrev (same_name_hfinfo)
- Add a progress dialog when reloading many plugins
- Search for memory leakages in wslua functions

Change-Id: I48870d8741251705ca15ffe1068613fcb0cb18c1
Reviewed-on: https://code.wireshark.org/review/5028
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-11 12:09:07 +00:00
Michael Mann 21e5a950ad Remove all preferences related to enabling/disabling heuristic dissectors.
The preferences are still supported for backwards compatibility, but the heuristic_protos file has final say on the "preference" to enable/disable a heuristic dissector.

Also add parameter to heur_dissector_add() for the "default" enable/disable of a heuristic dissector. With this parameter, a few more (presumably weak) heuristic dissectors have been "registered" but of course default to being disabled.

Change-Id: I51bebb2146ef3fbb8418d4f5c7f2cb2b58003a22
Reviewed-on: https://code.wireshark.org/review/9610
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-17 17:12:22 +00:00
Hadriel Kaplan 00b34f45ca Lua: all protocol tree entries expand/contract together
Make each Lua Proto object have an alloacted ett value, so
that they expand/contract only for the same protocol.

Bug: 11356
Change-Id: I68fb3ff00e080b47d540344aba2554e392b7f1c4
Reviewed-on: https://code.wireshark.org/review/9611
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-07-13 04:23:02 +00:00
Michael Mann be7d295fbf Add "user presentable" and "unique string ids" to heuristic table entries.
This allows better presentation of heuristic dissectors to the end user.

Change-Id: I2ff3985ab914e83c2989880cc0c7b9904045b3f6
Reviewed-on: https://code.wireshark.org/review/9602
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-12 03:14:38 +00:00
Hadriel Kaplan 0caf0616ba Lua: split up wslua files into class-based files
The size of some of the wslua source files has grown large, and it's hard
to quickly find things. So split them up based on class name, as much as
seems reasonable. Also have the make-wsluarm.pl Perl script handle this.

Change-Id: Ib495ec5c2a4df90495c0a05504856288a0b09213
Reviewed-on: https://code.wireshark.org/review/9579
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-07-12 02:08:24 +00:00
Hadriel Kaplan e47826734e Lua: fix docs and default base for ProtoField.framenum()
The ProtoField.framenum() Lua function says to use base.DEC, HEX, etc.
But it really can only allow base.NONE. Also, the code defaults
to base.DEC if none was given, and then errors if it's a FT_FRAMENUM;
instead the default base for FT_FRAMENUM should be base.NONE.

Change-Id: I0ec867069c66dbb58399ac2db4652469bfb39152
Reviewed-on: https://code.wireshark.org/review/9599
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-07-11 18:05:53 +00:00
Hadriel Kaplan 281055af9c Lua: add functions for more field information
Add Lua functions so a plugin can introspect field information, such
as the type of field, flags, tvb, etc. Also add a couple of Tvb and
ByteArray methods. And cleanup the TreeItem code a little.

Change-Id: I7b58ce589ace91cce14b8abccd01ceabb63e2653
Reviewed-on: https://code.wireshark.org/review/6500
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-07-09 01:49:11 +00:00
Hadriel Kaplan ceb8d954d2 Lua: Expose tcp_dissect_pdus() to Lua
Provide a way for Lua-based dissectors to invoke tcp_dissect_pdus()
to make TCP-based dissection easier.

Bug: 9851
Change-Id: I91630ebf1f1fc1964118b6750cc34238e18a8ad3
Reviewed-on: https://code.wireshark.org/review/6778
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-01-27 15:14:12 +00:00
Gerald Combs cf142c6b67 Get Wireshark to compile with afl-gcc.
Fix errors found by American Fuzzy Lop's afl-gcc
(http://lcamtuf.coredump.cx/afl/):

peektagged.c:
error: 'fileVersion' may be used uninitialized in this function

packet-h223.c:
error: variable 'circuit_id' might be clobbered by 'longjmp' or 'vfork'

wslua_proto.c:
error: variable 'd' might be clobbered by 'longjmp' or 'vfork'

wslua_proto.c:
error: variable 'dt' might be clobbered by 'longjmp' or 'vfork'

Change-Id: Idd74a3ad7b236d3a8756c1e7e917b1c74143f381
Reviewed-on: https://code.wireshark.org/review/6767
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-01-24 19:14:38 +00:00
Guy Harris 19a8eafc15 Use luaL_{check,opt}integer() rather than luaL_{check,opt}int().
Lua prior to 5.3 defined luaL_{check,opt}int() as macros wrapping
luaL_{check,opt}integer() with a cast to int; Lua 5.3 doesn't.

It sounds as if the Lua developers are deprecating luaL_{check,opt}int():

    http://osdir.com/ml/general/2014-10/msg46568.html

Change-Id: I2d0b649dcd57ede124f31d39f7945f342ae9b18f
Reviewed-on: https://code.wireshark.org/review/6744
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-01-23 03:58:29 +00:00
Michael Mann 7967ef9510 Remove emem APIs from UAT functionality.
Change-Id: I009c09f25d170e5c9aaaef713eaacb3252817856
Reviewed-on: https://code.wireshark.org/review/6460
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-12 14:25:12 +00:00
Hadriel Kaplan fac8356610 Make all Lua code use wmem not emem
Changed all remaining code in wslua that was using emem, to use wmem or
simpler methods.

Bug: 9927
Change-Id: I3d19a770e0fd77d996bdb6b61a76a722cc2bcd55
Reviewed-on: https://code.wireshark.org/review/6109
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-04 21:02:38 +00:00
Hadriel Kaplan f7b6dcc58c Lua: allow a Dissector object to be passed in for register_heuristic
Bug: 10695
Change-Id: I81181b2d00fcb5f0c25ab89bbe4968897f47a3a6
Reviewed-on: https://code.wireshark.org/review/6131
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-31 16:01:51 +00:00
Hadriel Kaplan 016769d7e2 Expose dissector_add_for_decode_as() to Lua
Allow Lua scripts to add their Protocol's dissector for "Decode as...".

Bug: 10696
Change-Id: Ic270cc85eff62ccfc29d8e5fcbb48247cfcd14bd
Reviewed-on: https://code.wireshark.org/review/6050
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-28 21:26:34 +00:00
Michael Mann 71c02b20eb Create FT_FCWWN field type.
Also, convert the "string" hf_ entries that used tvb_fcwwn_to_str as a string to use proto_tree_add_item with FT_FCWWN type.

Change-Id: I4ca77870499fd8239584a70874998b5d194a7167
Reviewed-on: https://code.wireshark.org/review/6036
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-28 20:05:29 +00:00
Evan Huus fafa686a68 Enable case-insensitive string dissector tables
Permit passing TRUE as the parameter during table registration to achieve that
effect.

Use it in RTP media type table.

Bug: 10708
Change-Id: I892fb1a421d349f0c05197dec90f14fc34ad6b97
Reviewed-on: https://code.wireshark.org/review/5695
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Evan Huus <eapache@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-12-15 21:09:35 +00:00
Guy Harris 151164d414 Give dissector_all_heur_tables_foreach_table() a sort function.
This makes it a bit more like dissector_all_tables_foreach_table.

Improve comments and clean up whitespace while we're at it.

Change-Id: I5147427f864add285e3bb6cb35ad9fa83bea516c
Reviewed-on: https://code.wireshark.org/review/5714
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-11 03:05:22 +00:00