From dd002649c32a0f16720236b34fe5a7aefe04c457 Mon Sep 17 00:00:00 2001 From: Hadriel Kaplan Date: Sat, 12 Apr 2014 00:32:20 -0400 Subject: 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 --- test/suite-wslua.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/suite-wslua.sh') diff --git a/test/suite-wslua.sh b/test/suite-wslua.sh index 5afdc9a516..fdeb5f0f2f 100755 --- a/test/suite-wslua.sh +++ b/test/suite-wslua.sh @@ -364,6 +364,22 @@ wslua_step_struct_test() { fi } +wslua_step_tvb_test() { + if [ $HAVE_LUA -ne 0 ]; then + test_step_skipped + return + fi + + # Tshark catches lua script failures, so we have to parse the output. + $TSHARK -r $CAPTURE_DIR/dns_port.pcap -X lua_script:$TESTS_DIR/lua/tvb.lua > testout.txt 2>&1 + if grep -q "All tests passed!" testout.txt; then + test_step_ok + else + cat testout.txt + test_step_failed "didn't find pass marker" + fi +} + wslua_cleanup_step() { rm -f ./testout.txt rm -f ./testin.txt @@ -385,6 +401,7 @@ wslua_suite() { test_step_add "wslua proto/protofield" wslua_step_proto_test test_step_add "wslua script arguments" wslua_step_args_test test_step_add "wslua struct" wslua_step_struct_test + test_step_add "wslua tvb" wslua_step_tvb_test } # # Editor modelines - http://www.wireshark.org/tools/modelines.html -- cgit v1.2.1