Commit Graph

222 Commits

Author SHA1 Message Date
Gerald Combs 9670f05384 Add ftsanity.py to the unit tests.
Change-Id: Ib480d8be5f66c70a4213af27acee94016fbf974b
Reviewed-on: https://code.wireshark.org/review/7855
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-30 21:02:21 +00:00
Gerald Combs f074647d2b Add a test-programs target everywhere.
Add a "test-programs" target to each toolchain which builds each unit
test executable. "test-programs" must now be built before running
the unit test suite.

Change-Id: I9317a1e305d987f244c4bd8b4a7f05d11fed7090
Reviewed-on: https://code.wireshark.org/review/7673
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-13 22:41:40 +00:00
Gerald Combs b255d8a1a1 CMake: Update wslua build and test.
Process wslua/CMakeLists.txt using add_subdirectory instead of
include. Generate files in the build directory instead of the source
directory.

Copy lua scripts to DATAFILE_DIR instead of DATAFILE_DIR/lua. That's
where init.lua looks for console.lua.

Always set WIRESHARK_RUN_FROM_BUILD_DIRECTORY when testing. We
presumably want to test our source files and not files which may or
may not be in the system path.

When we're running from the build directory look for lua scripts in both
the Autotools and CMake build locations.

Change-Id: Ic15ab8c58ff1b170d000c9b3e0a329af2ec44b7b
Reviewed-on: https://code.wireshark.org/review/7590
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-12 16:37:51 +00:00
Gerald Combs 95ce3928de Fix the Lua FPM dissector test.
In the FPM dissector test, only check the fields produced by the
frame and FPM dissectors.

Change-Id: I212afb8a8a4a7a9aa54391b0d5971b982b819395
Reviewed-on: https://code.wireshark.org/review/7643
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Graham Bloice <graham.bloice@trihedral.com>
2015-03-12 10:44:14 +00:00
Gerald Combs cac102eee3 Change a lot of http:// URLs to https://.
Most of our sites are now HTTPS-only. Update URLs accordingly. Update
other URLs while we're at it. Remove or comment out dead links.

Change-Id: I7c4f323e6585d22760bb90bf28fc0faa6b893a33
Reviewed-on: https://code.wireshark.org/review/7621
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-10 19:30:50 +00:00
Guy Harris 56446270f9 "Break" the Acme reader so that the tests work.
We don't want to have to change the pcap-ng file against which we
compare, so we hardcode the year here to be the same as the year from
the pcap-ng capture.

Change-Id: Ibd83d06e035341f617b8285f6ba51c749c38a177
Reviewed-on: https://code.wireshark.org/review/7448
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-01 07:13:02 +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 b32e39e198 Test suite: Add verbosity to the HTTP2 test.
We should probably do the same for the other decryption tests but we're
having issues with HTTP2 right now.

Change-Id: I8e8f5da200a29a5ca1cddb39c082bb7ee12d1eaf
Reviewed-on: https://code.wireshark.org/review/6686
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-23 13:14:10 +00:00
Guy Harris 612e286b9e Fix test script to test Lua Pinfo, and fix problem it found.
The test script was running lua/nstime.lua rather than lua/pinfo.lua for
the Pinfo test, and the Pinfo test was testing the ipproto property for
a Pinfo, but that was removed.

Change-Id: Iccdccd265dd550e41640af3acd607362f1f2f02e
Reviewed-on: https://code.wireshark.org/review/6747
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-23 01:52:24 +00:00
Alexis La Goutte af3924a333 HTTP2: Add HPACK decode to test suite
Change-Id: Ic84942b78a795974d6e2023751245ad98b8f1142
Reviewed-on: https://code.wireshark.org/review/6415
Reviewed-by: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-20 07:31:23 +00:00
Graham Bloice d7bce33140 Fix Cygwin path
Fix the Cygwin path added for tests so that Cygwin comes after the
existing path and that the correct link command is found for exntest.

Same change to runa2x.sh to be consistent.

Change-Id: I177a5e7d17a0077b0e8ca7d264d7e725a5312e24
Reviewed-on: https://code.wireshark.org/review/6503
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Graham Bloice <graham.bloice@trihedral.com>
2015-01-12 12:40:04 +00:00
Graham Bloice a49e1d54d9 Make running the tests a little easier on Windows
1.  Set the igncr option a little differently, this is the preferred
    way according to the latest Cygwin bash update announcement
    (See https://sourceware.org/ml/cygwin-announce/2014-10/msg00015.html, Sect 4a)
    The previous way didn't work for me.
2.  Ensure /usr/bin is on the path if running under Cygwin.
    I really don't want Cygwin on my normal paths, the build process
    adds if required, so this change makes the test scripts do the same.

Change-Id: I0f4da1fa87802bf0a4039bb5a91e577fae506d79
Reviewed-on: https://code.wireshark.org/review/6243
Tested-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2015-01-12 10:22:40 +00:00
Graham Bloice e7d0cdc061 Fix lua tests on Windows
Convert TEST_DIR path to a Windows path, this is used in all the lua tests.
Fix a typo

Change-Id: I38808822c998ed1df007732b3701b6b13d6c886b
Reviewed-on: https://code.wireshark.org/review/6235
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-01-02 16:49:40 +00:00
Evan Huus 887d198361 test: improve check for out-of-tree tests
Rather than running `cd` and letting it potentially fail, just use the `-d` flag
to test that `run` exists and is a directory. Avoids useless stderr output.

Change-Id: Iab8b63681db6256aa1a6fc389d2536acbd491aba
Reviewed-on: https://code.wireshark.org/review/6239
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-01-02 16:12:45 +00:00
Evan Huus 5cb96a0eb5 test: default WS_QT_BIN_PATH to WS_BIN_PATH
it used to be SOURCE_DIR, which is still the fallback for WS_BIN_PATH, but this
way if you specify a custom WS_BIN_PATH it gets picked up for both

Change-Id: If9198565fc7b7b3911550fd200adb0f918622540
Reviewed-on: https://code.wireshark.org/review/6238
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-01-02 16:08:20 +00:00
Joerg Mayer 27fa202b5e Make it easier to run tests out of tree.
Change-Id: I4ed10339d3c543d9d199e5262b6e7bb8247544ac
Reviewed-on: https://code.wireshark.org/review/5148
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-02 15:00:03 +00:00
Hadriel Kaplan 3cc6aee32a Lua: regex test suite fails with UTF-8 locale
Due to the change in change-id Ib43e16a9d98d08e5ddaff81fd3235f5b64d7b95b, the setlocale() call has been moved earlier in tshark's processing, such that Lua plugins load with the environment locale instead of C-locale. Since that matches Wireshark's behavior, it's good, but it causes the Lua regex test suite to fail. So the test suite needs to be fixed.

Bug: 10824
Change-Id: I3dcad15a9e247a1e42d2f708ccfb7272de2fe960
Reviewed-on: https://code.wireshark.org/review/6226
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2015-01-02 13:09:16 +00:00
Gerald Combs f485b28090 Test suite: Make sure we have a usable locale before we run iconv.
Change-Id: Ib1f3143dc48af4c556b9bcdfafbb477fd59b6359
Reviewed-on: https://code.wireshark.org/review/6181
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-31 17:13:06 +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
Gerald Combs dcbebe0eac Test suite: Start testing our output for valid UTF-8.
Feed the output of `tshark -G <glossary>` to `iconv -f UTF-8`. Adjust a
couple of the Bluetooth dissectors and X11 keysyms accordingly.

Change-Id: I5b04dc3fa4734c8f0a795daf44bd398fe5ebc1bd
Reviewed-on: https://code.wireshark.org/review/6146
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-30 21:20:28 +00:00
Hadriel Kaplan 2391a436e6 Bug 10233 - Wireshark crashes if Lua heuristic dissector returns true
Because call_heur_dissector_direct() didn't set the pinfo->heur_list_name
before calling the heuristic dissector, heur_dissect_lua() would invoke
report_failure().  Unfortunately, calling report_failure() within a dissector
can cause problems because GTK continues invoking timed callbacks while
it displays the modal dialog created by report_failure()... without yet
returning from report_failure().  In such a case, it's possible for
epan_dissect_run() to be called while still within the execution of a
previous call to epan_dissect_run(), which casues an assert since
epan_dissect_run() is not reentrant.

So this commit both fixes the call_heur_dissector_direct() bug as well
as avoids using report_failure() within heur_dissect_lua().  It also
upadtes the dissector.lua script used in the testsuite to match the one
pubshied on the wiki, since that script's heuristic dissector triggered
the bug.

Bug: 10233
Change-Id: If022604347745fadac01c02d370ca1a5d3f88b5b
Reviewed-on: https://code.wireshark.org/review/6040
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: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2014-12-25 15:13:56 +00:00
Alexis La Goutte 04a1f332b1 test suite: (Minor) fix some double space
Change-Id: I7fe7cd7ed471b8fcd2afd5fb4bbc180b580295b3
Reviewed-on: https://code.wireshark.org/review/6031
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-24 17:39:49 +00:00
Alexis La Goutte cd558218f7 test suite: fix indent (use tabs) and add modelines
Change-Id: I648d02d41f92c7fd176ce194eee20a2d19643fe0
Reviewed-on: https://code.wireshark.org/review/5985
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-23 07:27:48 +00:00
Michael Mann 6d207fe5f4 Remove private_data member from packet_info structure.
Dissectors should pass data directly to their subdissectors through the data parameter (of new-style dissectors). This avoids unintentional "trampling" from other dissectors trying to "share" private_data member.

Change-Id: I2efef5c8dfeef64588ba3ac6e695b469238c6468
Reviewed-on: https://code.wireshark.org/review/5487
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-01 14:05:44 +00:00
Gerald Combs c55d69780b Try to speed up ping-dependent capture tests.
Ping four times a second for ~60 seconds. Save the subprocess PID so that
we can kill it when we're done with each test instead of waiting for it
to finish.

Change-Id: I64f889c700e8a6fa1bc1c3916ef045341ef59cc6
Reviewed-on: https://code.wireshark.org/review/4557
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-08 18:54:13 +00:00
Gerald Combs bdfff4d3c7 Re-enable the Wireshark test suite.
Change-Id: Icfd9edb8c6ef7620878bc9d60c8dcc569ad2abad
Reviewed-on: https://code.wireshark.org/review/4434
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-03 00:02:56 +00:00
Gerald Combs ff7b51f920 Partially re-enable Wireshark tests.
Qt requires Xrender and XKEYBOARD. Unfortunately the Ubuntu and Solaris
buildbots run the test script under Xtightvnc, which provides neither of
those. Only enable the tests on Windows and OS X for now.

Change-Id: I84bc28f810782b862b4dca8fc8df088a4919066d
Reviewed-on: https://code.wireshark.org/review/4430
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-02 22:49:46 +00:00
Gerald Combs 67f1fa5e56 Temporarily disable the Qt tests added in g58cde5c.
Apparently what works for me doesn't work for the Buildbot users.

Change-Id: I7d3e4f2b89ae8ae3dadc8d92438c0e1923b97ace
Reviewed-on: https://code.wireshark.org/review/4416
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-02 02:20:07 +00:00
Gerald Combs 58cde5c74a Add tests for the Qt UI.
Make sure the Qt UI quits if WIRESHARK_QUIT_AFTER_CAPTURE is set. Make
sure Bourne shell scripts (*.sh) have UNIX/POSIX line endings. Reduce
some time values so that the tests run faster.

Change-Id: I81df7c6f72d7d807d1856863cbea1bb6326ca711
Reviewed-on: https://code.wireshark.org/review/4407
Tested-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-01 22:30:33 +00:00
Evan Huus 45fb37718e Fix lua bindings to handle timestamp precision changes
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-29 02:35:29 +00:00
Alex Badea a1604bd5d6 test: add decryption test for isakmp with certificates
This was suggested in review 2297. Capture and key are from bug 7951.

Bug: 7951
Change-Id: I820c5e839b20ec464cc1be438633d5311f657fb2
Signed-off-by: Alex Badea <abadea@ixiacom.com>
Reviewed-on: https://code.wireshark.org/review/4143
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-09-24 22:06:31 +00:00
Gerald Combs b7fb1167e3 Qt → wireshark. GTK+ → wireshark-gtk.
Make sure the Qt UI is named "Wireshark" and its executable is named
"wireshark" or "wireshark.exe". Make sure the GTK+ UI is named
"Wireshark 1" or "Wireshark (GTK+)" depending on how much the target
audience is likely to care about UI toolkits. Make sure the GTK+
executable is named "wireshark-gtk" or "wireshark-gtk.exe".

It looks like moving to Qt 5.3 (g978faf3) broke the PortableApps
package. It's likely even more broken now.

Autotools out-of-tree builds also broke on Ubuntu 12.02 (automake
1.11.3) at some point. The first attempt to compile in ui/qt returns
"error: source_file.cpp: No such file or directory". The second attempt
works. Out-of-tree builds work fine on Ubuntu 14.04 (automake 1.14.1).

Tested:

- Nmake builds

- NSIS packaging

- CMake builds (Windows, OS X)

- Autotools build and distcheck

- RPM packaging

To do:

- Test Debian packaging

- Fix PortableApps

Change-Id: I66429870e05fd2d6fc901942477959ed6164fce2
Reviewed-on: https://code.wireshark.org/review/3919
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-09-02 15:39:17 +00:00
Evan Huus 5fda232659 make unit-test suite work out-of-tree
Change-Id: I638015a9b55712bb6843d6756c9c55915e142372
Reviewed-on: https://code.wireshark.org/review/2893
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-12 12:08:13 +00:00
Evan Huus a87e292272 Tighten the dump-glossary test.
1. The only indication we get of an out-of-order value string is a message on
 STDERR, so check that and fail the test if STDERR wasn't empty.

 2. This exposes an out-of-order value string in packet-stun.c; fix it.

 3. This triggered the pre-commit hook on packet-stun.c, which noticed an API
 error (ENC_ASCII -> ENC_ASCII|ENC_NA); fix that too.

Change-Id: I36f87a2a87b40537119562f22a7e3012716ff239
Lesson: automated testing/tooling is both wonderful and scary.
Reviewed-on: https://code.wireshark.org/review/2682
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-27 03:47:32 +00:00
Gerald Combs 81963e7f1a Decrease TRAFFIC_CAPTURE_DURATION from 60s to 15s.
Change-Id: Ie6d6ac0489f0fcb506360a3900d33c44cb3477e9
Reviewed-on: https://code.wireshark.org/review/2664
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-06-25 23:02:55 +00:00
Evan Huus fca7b3f4f8 Check for lua by grepping the output of tshark -v
Grepping config.h doesn't work for out-of-tree builds.

Change-Id: If3f551dffb04dd646f5adece57fac90dc48ff1c9
Reviewed-on: https://code.wireshark.org/review/2389
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-18 18:32:18 +00:00
Guy Harris 6db77b000f Allow wtap_read() and wtap_seek_read() to return records other than packets.
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-24 18:31:25 +00:00
Evan Huus a1e6b10239 Fix lua directory tests.
The underlying directory iterator is not guaranteed to return directories in the
same order according to the glib documentation, so don't rely on the directory
order being the same when testing it.
https://developer.gnome.org/glib/2.37/glib-File-Utilities.html#g-dir-read-name

Bug:10009
Change-Id: I4b1078e1f3981921b1e83c4f77b4bc30a5d21b46
Reviewed-on: https://code.wireshark.org/review/1671
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-21 03:17:15 +00:00
Evan Huus 4272cb8786 Revert part of g757db64e484b009c3
It was intended to change the DTLS decryption test, but changed the SSL test
file instead, which led to the SSL test mysteriously failing. The SSL capture
really is http, so that's the right protocol, and the port is the standard 443,
not 4433 (which was perhaps a typo?).

Change-Id: I84448c2326d2a4301a4bba9607f8ba90a495531d
Reviewed-on: https://code.wireshark.org/review/1401
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-27 21:55:03 +00:00
Evan Huus c6d41f961b Have DTLS just dissect the test capture as data
Follow-up to g757db64e484b009c33b67b5fa38e109d7b8f5e78 which changed the filter
being tested but didn't change the target protocol, so the test was still
failing because it was still trying to use HTTP.

Change-Id: I6675cfad3bba63f7a536eb7ae82e4b25132d108e
Reviewed-on: https://code.wireshark.org/review/1375
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-26 21:45:48 +00:00
Michael Mann 757db64e48 Don't use HTTP filter for DTLS decryption test as it's not really HTTP traffic (and a more discerning HTTP dissector will cause this to fail)
Change-Id: I74ea78f541f87000d84c85794d04e9de46d477f2
Reviewed-on: https://code.wireshark.org/review/1333
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-25 04:20:27 +00:00
Hadriel Kaplan f52626cc83 Add tvb_get and proto_tree_add for string-encoded byte arrays
This commit adds tvb_get_string_bytes and proto_tree_add_bytes_item routines for
getting GByteArrays fields from the tvb when they are encoded in ASCII hex string form.

The proto_tree_add_bytes_item routine is also usable for normal
binary encoded byte arrays, and has the advantage of retrieving
the array values even if there's no proto tree.

It also exposes the routines to Lua, both so that a Lua script can take
advantage of this, but also so I can write a testsuite to test the functions.

Change-Id: I112a038653df6482a5d0ebe7c95708f207319e20
Reviewed-on: https://code.wireshark.org/review/1158
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-17 14:04:19 +00:00
Hadriel Kaplan dd002649c3 Add tvb_get and proto_tree_add for string-encoded timestamps
This commit adds tvb_get_string_time and proto_tree_add_time_item routines for
getting nstime fields from the tvb when they are encoded in ASCII string form.

The proto_tree_add_time_item routine is also usable for normal
big/little-endian encoded time_t, and has the advantage of retrieving
the value even if there's no proto tree.

It also exposes the routines to Lua, both so that a Lua script can take
advantage of this, but also so I can write a testsuite to test the functions.

Change-Id: I955da10f68f2680e3da3a5be5ad8fdce7ed6808c
Reviewed-on: https://code.wireshark.org/review/1084
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-14 11:47:39 +00:00
Pascal Quantin cc3c05ed5f Switch to Lua 5.2.3 built with MSVC2010 instead of the one built with MingW gcc 4.3
Fixes bug 9957

Change-Id: Ibe38ec25be5cfdad98c53c8257b0a858529897f6
Reviewed-on: https://code.wireshark.org/review/991
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-04-07 05:54:19 +00:00
Hadriel Kaplan 85aa07157a Get it compiling again: WindowsXP build failing
The WindowsXP build is failing due to a wslua testsuite failure, in the
file reader/writer tests. I've looked at it a bit and I don't know
why it's failing yet - I know why it says it's failing, but it doesn't
fail for me. And it was passing on WindowsXP until the change to Lua 5.2.3,
but I run 5.2.3 all the time and it passes for me, and there's nothing
special about the portion that's failing.

The only way to debug it is to run it on WindowsXP myself, but I need
a build to do that with, so I've commented out the failing test and
hopefull it will build now and I can grab the automated build to debug
the issue.

Change-Id: Ib75e8f75829e8f506823e648605ba16e21c7973a
Reviewed-on: https://code.wireshark.org/review/982
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-06 17:51:34 +00:00
Alexis La Goutte 757aa33220 Continue to remove $Id$ from top of file
(Using sed : sed -i '/^\# \$Id\$/,+1 d') (start with dash)

Change-Id: Ia4b5a6c2302f6a531f6a86c1ec3a2f8205c8c2dd
Reviewed-on: https://code.wireshark.org/review/881
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-31 18:48:06 +00:00
Alexis La Goutte 94a791a76e Continue to remove $Id$ from top of file
(Using sed : sed -i '/^\$Id\$/,+1 d') (No space or star before $Id$)

Change-Id: I0801bd7cf234d32487008a8b6dcee64875b07688
Reviewed-on: https://code.wireshark.org/review/876
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-31 16:00:04 +00:00
Hadriel Kaplan 8c2bb80574 Add various functions for Lua directory handling and path info
This adds new functions to get plugins path info, find out if a directory
exists, make a new one, remove one, etc. It also creates a file environment
for user-supplied Lua scripts, to prevent global variable contamination as
well as supply the script-specific file name.  Some other minor cleanup was
done as I found them.

A new testsuite was added to test the existing and new directory functions.

Change-Id: I19bd587b5e8a73d89b8521af73670e023314fb33
Reviewed-on: https://code.wireshark.org/review/832
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-26 07:37:34 +00:00
Hadriel Kaplan da1af6e549 Add filterable expert info for Lua
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-26 05:20:17 +00:00
Hadriel Kaplan 21a61a8cb1 Add Lua Struct.values() function, and prevent coercion in all Struct functions
This adds a Struct.values() function to get the number of values
needed/returned with Struct.pack/unpack. It also changes the existing
Struct functions such that they don't coerce a non-string argument
into a string. (not preventing it confused a user on ask.wireshark.org)

Change-Id: I93d5846105e55b67680e1c276a7286535c77b039
Reviewed-on: https://code.wireshark.org/review/790
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-23 07:05:30 +00:00