aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/wslua_proto.c
AgeCommit message (Collapse)AuthorFilesLines
2016-06-14wslua: Drop unused "push_code" macro parameterPeter Wu1-1/+1
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-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-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>
2016-03-28Fix warnings/errors of type -Wused-but-marked-unusedJoerg Mayer1-2/+2
Change-Id: I34c2d9953272822da0745d1b24c64d8466e43b37 Reviewed-on: https://code.wireshark.org/review/14668 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-03-13Lua: Remove heur dissectors when reload Lua pluginsStig Bjørlykke1-0/+16
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-13Lua: Check for duplicate heuristic short nameStig Bjørlykke1-0/+5
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>
2015-12-11Qt: Reload Lua expert infosStig Bjørlykke1-0/+3
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-11new_register_dissector -> register_dissector for remaining uses.Michael Mann1-2/+2
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-11-21Lua: Validate Proto() argumentsStig Bjørlykke1-4/+15
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-10-05wslua: fix crash when a LUA error is raised in TRY blockPeter Wu1-5/+9
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-08-11Added Reload Lua plugins.Stig Bjørlykke1-19/+91
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-07-17Remove all preferences related to enabling/disabling heuristic dissectors.Michael Mann1-1/+1
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-13Lua: all protocol tree entries expand/contract togetherHadriel Kaplan1-1/+5
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-12Add "user presentable" and "unique string ids" to heuristic table entries.Michael Mann1-1/+2
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-12Lua: split up wslua files into class-based filesHadriel Kaplan1-2118/+28
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-11Lua: fix docs and default base for ProtoField.framenum()Hadriel Kaplan1-3/+4
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-09Lua: add functions for more field informationHadriel Kaplan1-18/+17
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-01-27Lua: Expose tcp_dissect_pdus() to LuaHadriel Kaplan1-0/+172
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-24Get Wireshark to compile with afl-gcc.Gerald Combs1-2/+2
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-23Use luaL_{check,opt}integer() rather than luaL_{check,opt}int().Guy Harris1-14/+14
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-12Remove emem APIs from UAT functionality.Michael Mann1-1/+7
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-04Make all Lua code use wmem not ememHadriel Kaplan1-6/+3
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>
2014-12-31Lua: allow a Dissector object to be passed in for register_heuristicHadriel Kaplan1-0/+30
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-28Expose dissector_add_for_decode_as() to LuaHadriel Kaplan1-0/+24
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-28Create FT_FCWWN field type.Michael Mann1-0/+3
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-15Enable case-insensitive string dissector tablesEvan Huus1-1/+1
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-11Give dissector_all_heur_tables_foreach_table() a sort function.Guy Harris1-1/+1
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-11Make the type of the second argument to a DATFunc_heur_table explicit.Guy Harris1-1/+1
It's always pased a heur_dissector_list_t *, so give it that type, rather than having it be a generic pointer. Change-Id: Ia6a045bb1b96c2f6ef3e23f27928e0b52f7cfb9f Reviewed-on: https://code.wireshark.org/review/5713 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-06Lua: Fixed some memory leakages.Stig Bjørlykke1-9/+11
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ørlykke1-6/+3
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-17Don't use <ctype.h> macros, and eliminate an include of <ctype.h>.Guy Harris1-2/+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-13Lua: luaL_checkstring does not return NULLStig Bjørlykke1-75/+51
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-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-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-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-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-03-28Allow chained calls with Lua TreeItem functions, and fix a couple of minor ↵Hadriel Kaplan1-2/+2
errors. A common Lua idiom is to use chained calls, i.e. tree:foo():bar():choo(). This actually works for tree:add() because it returns the new child tree item which is then the one being applied to the next chained call. But it doesn't work beyond that for things like set_generated() and so on. So this commit fixes that. This also fixes the Lua tree:add() function for the FT_BOOL type to let it be a Lua boolean value. And it reverts a previous change to Struct.tohex() to allow coercion of the argument. Change-Id: I10f819d363163914ba320c87d4bedebe5b50cacf Reviewed-on: https://code.wireshark.org/review/851 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-26Add filterable expert info for LuaHadriel Kaplan1-3/+187
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 Kaplan1-307/+396
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-14Add Lua heuristic dissector supportHadriel Kaplan1-0/+134
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-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 Goutte1-2/+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 Huus1-1/+1
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>