Commit Graph

301 Commits

Author SHA1 Message Date
Jakub Zawadzki 72ca9d0e61 Store pointers to previously displayed and captured packet, not nstime_t deltas.
This commit reduces size (from 144B to 128B on AMD64) of frame_data structure.

Part of bug 5821: Reduce per-packet memory requirements.

svn path=/trunk/; revision=45071
2012-09-23 16:25:28 +00:00
Jakub Zawadzki 9cde3e1a44 Add lua_nstime_to_sec()
svn path=/trunk/; revision=45070
2012-09-23 15:57:11 +00:00
Jakub Zawadzki 7719d4e84a Cleanup wslua PINFO_GET_* macros. It's portable, right?
svn path=/trunk/; revision=45067
2012-09-23 14:46:43 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Evan Huus dd01cc0490 From Niels Widger via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7725
Add get_filter method to Wireshark's Lua interface (to correspond with the
already-exposed set_filter method).

svn path=/trunk/; revision=44916
2012-09-15 13:58:57 +00:00
Jakub Zawadzki 5a8783f5b1 Initial commit to support yet another method of passing data between dissectors.
Add new parameter 'data' to heur_dissector_t and new_dissector_t, for now it's always NULL

svn path=/trunk/; revision=44860
2012-09-10 21:40:21 +00:00
Jakub Zawadzki 5ad3e5331e MT: move global frame_end_routines to packet_info.
svn path=/trunk/; revision=44748
2012-09-03 12:00:40 +00:00
Evan Huus 1457a01f49 Always memset the packet-header struct in Lua to avoid
crashes from garbage data.

Also, give Lua a copy of the packet comment if there is one.

Fixes: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7538

svn path=/trunk/; revision=44093
2012-07-28 15:51:37 +00:00
Evan Huus a234b68ff0 Fix some system header files that were #included with "" instead of <>.
They made cppcheck unhappy.

svn path=/trunk/; revision=43779
2012-07-18 02:47:56 +00:00
Anders Broman 45e9efc6a9 From Evan Huus:
Fix leaks

- don't g_strdup a string just to use it in a g_strdup_printf
- clean up properly in error cases in lua bindings
- misc. other missing g_free() calls
- one missing fclose() in the new 80211_utils

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7454

svn path=/trunk/; revision=43617
2012-07-09 01:56:27 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Anders Broman e6e6d6217b From Tony Trinh:
Update Lua from 5.1 to 5.2

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7400

svn path=/trunk/; revision=43482
2012-06-25 20:42:07 +00:00
Anders Broman 6efe4ea27c From Tony Trinh:
Update Lua from 5.1 to 5.2

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7400

svn path=/trunk/; revision=43479
2012-06-25 20:28:14 +00:00
Balint Reczey b90a1b7f63 Give hint to check http://wiki.wireshark.org/CaptureSetup/CapturePrivileges in Lua error messages related to running Wireshark as root
svn path=/trunk/; revision=43442
2012-06-22 15:18:03 +00:00
Guy Harris 4ad0bf65f2 Clean up indentation.
svn path=/trunk/; revision=43314
2012-06-17 16:32:04 +00:00
Jeff Morriss e9a30385c7 Fix Coverity 702396: tvbr is ep_ allocated so it can't be NULL.
svn path=/trunk/; revision=43116
2012-06-05 15:29:25 +00:00
Jeff Morriss fe5f076b5c Fix Coverity 702397: reference tvbr *after* checking that it is not NULL.
svn path=/trunk/; revision=43115
2012-06-05 15:26:09 +00:00
Chris Maynard 973b45c401 Add a "fallthrough" comment to avoid a missing break report from Coverity. Fixes Coverity CID 702382 Missing break in switch.
svn path=/trunk/; revision=42845
2012-05-25 01:49:49 +00:00
Anders Broman fec821f303 From Evan Huus:
Fix Three memory leaks and a bad if-condition, as caught by CppCheck.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7272

svn path=/trunk/; revision=42738
2012-05-21 07:42:09 +00:00
Jakub Zawadzki 0f1a21aaa9 tvb_unicode_strsize() returns number of bytes, NOT number of UCS-2 characters.
svn path=/trunk/; revision=42622
2012-05-14 06:32:16 +00:00
Guy Harris 14b616c35d Get rid of remaining Booleans-as-encoding-arguments in
proto_tree_add_item() calls.

Add new "add_packet_field" method to the TreeItem class, taking a
protocol field (*not* a protocol), TvbRange, and encoding value as
arguments.

Add the ENC_ values to init.lua.  Make them all hex #defines so
make-init-lua.pl can easily extract them.

Export tvb_unicode_strsize() for use by Lua (and elsewhere as desired). 
Note that it handles UTF-16 and UTF-8, and fix the comment to note that
its count of hexadectets *does* include the null terminator (that's what
the code does).

svn path=/trunk/; revision=42621
2012-05-14 00:49:05 +00:00
Anders Broman 7d17553acc From Evan Huus: Fix memory leaks in wslua_tvb.c fix typos in wslu_proto.c https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7202
svn path=/trunk/; revision=42281
2012-04-27 06:02:45 +00:00
Anders Broman 48fc51f835 From Evan Huus: Fix memory leaks in wslua_proto.c
svn path=/trunk/; revision=42280
2012-04-27 05:51:47 +00:00
Anders Broman ace0603d8f From Evan Huus: Fix memory leaks in wslua_pinfo.c https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7202
svn path=/trunk/; revision=42279
2012-04-27 05:47:42 +00:00
Jeff Morriss 75c3c92f19 Add a "-build" argument to checkAPIs.pl. Use that argument when building
from makefiles (and thus from the buildbot).

The intention is to be able to tell when a human is running the tool so we
can provide more code-review guidance.

As a starter, enable the "too many proto_tree_add_text() calls" check when
a human is running the tool.

svn path=/trunk/; revision=41943
2012-04-04 20:46:49 +00:00
Jeff Morriss 2d829b392f Line-wrap an extremely long comment. Remove trailing white space.
svn path=/trunk/; revision=41552
2012-03-15 02:33:52 +00:00
Guy Harris cd9fe7e242 Convert 4-space tabs to spaces.
svn path=/trunk/; revision=41441
2012-03-08 20:00:49 +00:00
Bill Meier 605dea0486 CVARSDLL hasn't been used (is undefined) for a while....
svn path=/trunk/; revision=41180
2012-02-24 16:23:38 +00:00
Jeff Morriss ea02598924 Fix the rest of of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6764 :
The Lua API does not have FT_*, it has ftypes.*, so use that in the
documentation.  Also, list out each ft so the user knows what the available
options are.

svn path=/trunk/; revision=41035
2012-02-16 03:00:52 +00:00
Jeff Morriss 38550ff3ce Fix part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6764 :
The Lua API does not have BASE_*, it has base.*, so use that.  Also, list out
each base so the user knows what the available options are.

svn path=/trunk/; revision=41024
2012-02-14 03:37:19 +00:00
Jeff Morriss d92857dd6b As suggested in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6763 :
Give an example of a Pref.range's default value.

svn path=/trunk/; revision=41023
2012-02-14 03:24:19 +00:00
Anders Broman 84370fffcb Add *.sbr files to the clean target.
svn path=/trunk/; revision=40762
2012-01-29 20:21:30 +00:00
Guy Harris 6f59700722 Fix usage of g_ascii_strdown() and g_ascii_strup() - they do *not*
modify the string in place, they return a g_mallocated modified version
of the string passed into them.

svn path=/trunk/; revision=40727
2012-01-25 23:03:33 +00:00
Jeff Morriss e36b1c6daf Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6738 :
size_t is sometimes an integer and sometimes a long.  To avoid compiler
warnings when formatting it, cast it to a long.

svn path=/trunk/; revision=40682
2012-01-24 02:42:01 +00:00
Alexis La Goutte 3712c6f6d1 Fix some Dereference of null pointer Warning found by Clang
svn path=/trunk/; revision=40456
2012-01-13 16:16:41 +00:00
Chris Maynard 647c5c0b27 packet_info's in_error_pkt is now a bitfield like in_gre_pkt.
svn path=/trunk/; revision=39764
2011-11-08 18:39:11 +00:00
Stig Bjørlykke 43c34aaf8e Do not return from within a TRY/CATCH/ENDTRY because this will make the
except stack invalid, and will lead to a crash.

In this case it was when calling a dissector from a table in a Lua script.

svn path=/trunk/; revision=39748
2011-11-07 07:41:03 +00:00
Stig Bjørlykke 0352ac8e8f From Robert G. Jakabosky via bug 5575:
Fix memory errors in Lua dissectors.
- Free Tvb when created from ByteArray.
- Free TvbRange correctly.
- Free string from get_persconffile_path and get_datafile_path.
- Some code cleanup.

svn path=/trunk/; revision=39744
2011-11-06 17:39:13 +00:00
Stig Bjørlykke e48b5f02e0 No need to ep_strdup a string to lua_pushstring.
svn path=/trunk/; revision=39684
2011-10-31 08:38:49 +00:00
Stig Bjørlykke 5a466a5246 Don't ep_strdup the protocol name when register a dissector, because
this name will be collected when loading a capture file and the name
will be gone.

svn path=/trunk/; revision=39681
2011-10-30 21:32:27 +00:00
Stig Bjørlykke 447de1178d Allow signed integers displayed as BASE_HEX_DEC.
svn path=/trunk/; revision=39571
2011-10-25 19:04:10 +00:00
Stig Bjørlykke 2d62e550b7 Added another Lua warning:
- FT_FRAMENUM can not have a bitmask.

svn path=/trunk/; revision=39563
2011-10-25 11:20:54 +00:00
Stig Bjørlykke 943c8b97ed Added Lua error messages when:
- Adding a INT64/UINT64 field with a value string (currently unsupported).
- Trying to display a signed integer as hexadecimal.

svn path=/trunk/; revision=39562
2011-10-25 11:13:11 +00:00
Stig Bjørlykke 4b930ccb33 Duplicate Lua strings we put into the private_table.
svn path=/trunk/; revision=39468
2011-10-19 15:32:49 +00:00
Stig Bjørlykke 82e0b65038 Added a private hash table to transport string values between dissectors.
This works between C and Lua.

In C the pinfo.private_table pointer must be initialized using
g_hash_table_new (g_str_hash, g_str_equal);

In Lua the values are available using pinfo.private.<key>, and the
table is created automatically on first usage.  It's possible to use
this datatypes: nil, boolean, number and string, but every value
is converted to string so numbers must be converted using tonumber()
on usage.  Boolean is either nil or an empty string.

svn path=/trunk/; revision=39461
2011-10-18 17:46:00 +00:00
Stig Bjørlykke 424463e083 Use PINFO_GET_BOOLEAN for visited.
svn path=/trunk/; revision=39458
2011-10-18 10:17:19 +00:00
Stig Bjørlykke 022929724b Added some Lua pinfo fields:
ethertype, fragmented, in_error_pkt, match_uint and match_string.

svn path=/trunk/; revision=39407
2011-10-13 19:39:35 +00:00
Stig Bjørlykke 72cdab4c31 From Alex Vallee via bug 6346:
Added Lua TvbRange unicode string methods.

svn path=/trunk/; revision=39225
2011-10-02 17:02:10 +00:00
Stig Bjørlykke 3e75b436a0 Added register action for loading Lua plugins.
Removed an unused argument to wslua_init().

svn path=/trunk/; revision=39214
2011-10-02 13:39:35 +00:00
Stig Bjørlykke c6eb911c93 Do case insensitive search for lua scripts to load.
Skip files starting with . also on windows, as the home directory
may be mounted from a server with a proper filesystem.

svn path=/trunk/; revision=38737
2011-08-25 19:01:05 +00:00