Commit Graph

95 Commits

Author SHA1 Message Date
Nardi Ivan e6e3a91696 WSLUA: allow 64 bits bitmask for ProtoField objects
Mask might be specified using a (Lua) number, a string or a UInt64
object.

It is useful to handle 64 bit bitfields.
2023-01-04 14:32:23 +00:00
João Valverde a19834b98c Windows: Store "gui.console_open" in the Windows registry
This removes the last dependency of the logging subsystem on the
preferences module. The latter is started much later than the former
and this is an issue.

The Windows-only preference "gui.console_open" is stored in the
registry as HKEY_LOCAL_USER\Software\Wireshark\ConsoleOpen. The semantics
are exactly the same. The preference is read by the logging subsystem
for initialization and then again by the preferences (read/write) so
the user can configure it as before.

The code to store the preference also in the preferences file was
kept, for backward compatibility and because it is not incompatible
with using the Registry concurrently.

The elimination of the prefs dependency also allows moving the Windows
console logic to wsutil and add the functionality to wslog directly,
thereby eliminating the superfluous Wireshark/Logray custom log handler.

To be able to read the ws_log_console_open global variable from
libwireshark it becomes necessary to add a new export macro
symbol called WSUTIL_EXPORT.
2022-10-11 14:25:04 +01:00
João Valverde 8ff24c2b6e Lua: Add lrexlib-pcre2 Lua regex bindings
Add the de facto standard Lua regex API to Wireshark. Upstream
code is copied verbatim and the module opened in the "rex" table.
This is just a user convenience and developer quality of life improvement
over the GRegex Lua API because it has always been possible to
load lrexlib-pcre2 as a Lua module from Wireshark.
2022-05-26 10:09:13 +00:00
João Valverde e6da2cd8de Lua: Remove on-life-support GRegex bindings
This code has been unmaintained and does not pass the lrexlib test
suite. GRegex itself has been obsolescent for some time, although GNOME
has recently restarted trying to move it to PCRE2.

Remove it in preparation for a move to lrexlib-pcre2.
2022-05-26 10:09:13 +00:00
Gerald Combs ca04f4c8cb Qt: Update our dynamic menu groups.
Add log-specific statistics groups, and use them to limit the dynamic
menu items in Wireshark and Logwolf.
2022-04-12 12:14:03 -07:00
John Thacker 156a958d3f wsutil: Fix time zone handling.
Time zone handling was reversed, partially due to the tests having
it backwards.
2021-12-30 21:20:08 +00:00
Moshe Kaplan 69d54d6f8e Corrects repeated words throughout the code.
Repeated words were found with:
egrep "(\b[a-zA-Z]+) +\1\b" . -Ir
and then manually reviewed.
Non-displayed strings (e.g., in comments)
were also corrected, to ease future review.
2021-12-22 11:01:11 +00:00
John Thacker aadf4efcbe epan: Add ENC_ISO_8601_DATE_TIME_BASIC
Add the ISO 8601 Basic date time format as another string time
option. This could be used for e.g. ASN.1 GeneralizedTime.
Add tests for it.
2021-12-02 14:19:49 +00:00
David Perry dc7089e831 Carry drop count/packet ID/queue ID as options on packet block 2021-07-19 21:25:40 +00:00
David Perry 06ed6930dc Carry EPB flags as an option on the packet block
As requested by [this comment][1] on !2859, move `pack_flags` from a
dedicated field in `wtap_rec` to a block option on the packet block in
`wtap_rec.block`.

[1]: https://gitlab.com/wireshark/wireshark/-/merge_requests/2859#note_615984624
2021-07-12 12:41:57 -04:00
David Perry 73087d6fb4 Use wtap_blocks for packet comments
Mostly functioning proof of concept for #14329. This work is intended to
allow Wireshark to support multiple packet comments per packet.

Uses and expands upon the `wtap_block` API in `wiretap/wtap_opttypes.h`.
It attaches a `wtap_block` structure to `wtap_rec` in place of its
current `opt_comment` and `packet_verdict` members to hold OPT_COMMENT
and OPT_PKT_VERDICT option values.
2021-07-07 18:40:24 +00:00
Chuck Craft 54baebad48 Lua: reconcile expert info groups; add PI_ASSUMPTION 2021-06-21 15:27:51 +00:00
Daniel Dulaney 62af671bf3 Lua: add DissectorTable.try_heuristics() function
Add DissectorTable.try_heuristics(name, tvb, pinfo, tree). Previously,
there was no way for a Lua plugin to run an existing heuristic
dissector.

Based on Gerrit change 18718. Closes #17220.
2021-03-26 07:15:16 +00:00
Guy Harris b61fd6d76a dfilter, ftypes: get rid of FT_PCRE.
It's not a valid field type, it's only a hack to support regular
expression matching in packet-matching expressions.

Instead, in the packet-matching code, have a separate syntax tree type
for Perl-compatible regular expressions, and a separate instruction to
load one into a register, and have the "matching" operator for field
types take a GRegex * as the second argument.
2021-03-21 03:27:44 -07:00
Stig Bjørlykke 9cafd342ac Lua: Add get_preference() and set_preference() utility functions.
Support uint, bool, enum, string, range, filename and directory preferences.
Added apply_preferences() to write to file and apply changes.
2020-12-08 22:56:50 +00:00
David Perry 27c00ca0e9 Lua: make TvbRange:raw() return a subset #12046 v2
My initial fix caused several double-offset errors in TvbRange_raw()
because I was adjusting for the TvbRange's offset too early in the
process. The proper fix is to only adjust for it in the final call to
get the data.

I also simplified some of the bounds checks to be based on the values in
the TvbRange instead of calling `tvb_captured_length()` and the like,
because its bounds are already checked against the backing Tvb when it's
first taken.

Massively expanded the lua test suite to account for every combination
of passing offsets and lengths to a Tvb or TvbRange and to the
subsequent `:raw()` call.
2020-12-02 20:09:55 +00:00
Huang Qiangxiong dcf6bdda84 Protobuf/gRPC: add test cases for Protobuf and gRPC
Add case_dissect_protobuf and case_dissect_grpc in test/suite_dissection.py.
Add *.proto into the sub directories of test/protobuf_lang_files/.
Run command like 'pytest --program-path .\run\Debug\ -k "grpc or protobuf"'
in build directory (in windows) to test these cases only.
2020-12-01 12:06:43 +00:00
David Perry c03011b906 Lua: base64_decode: handle unpadded data
As noted in bug #16386, glib's `g_base64_decode_inplace()` aborts
decoding of base64 strings that aren't padded. This addresses that by
adding padding "=" characters if needed to the buffer which will be
decoded.

I added the test case from the bug report to the test suite, though the
location therein may not be ideal.

Closes #16386
2020-10-19 08:38:31 +00:00
Guy Harris e013c5ec7f Clean up URLs.
Add ui/urls.h to define some URLs on various of our websites.  Use the
GitLab URL for the wiki.  Add a macro to generate wiki URLs.

Update wiki URLs in comments etc.

Use the #defined URL for the docs page in
WelcomePage::on_helpLabel_clicked; that removes the last user of
topic_online_url(), so get rid of it and swallow it up into
topic_action_url().
2020-10-02 20:13:42 -07:00
Moshe Kaplan 4a8da5fbde wslua: Fix crash on TvbRange:__tostring for a zero-length TVB
Fields such as 'frame.time_delta' have no byte selection, they are added
with offset 0 and length 0, and evidently 'ws_tvb' is NULL. As
tvb_bytes_to_str expects a non-NULL tvb, explicitly check for this and
add a dummy placeholder. This is intended to be a human-readable string,
so prefer `<EMPTY>` over an empty string.

Change-Id: I32efe4cbefc6bcf0fa9fb94fcf25d7bf1628f3a7
Reviewed-on: https://code.wireshark.org/review/36440
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-03-16 22:42:03 +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
Vasil Velichkov 44870fb1c2 wslua: Fix two memory leaks in the lua tests
Add the newly create ProtoField to the test_proto.fields in order to be freed.

ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x55e041f5ef86 in realloc (/home/vasko/sources/wireshark/build_clang/run/tshark+0x222f86)
    #1 0x7fd8e0919e7d in g_realloc gmem.c:164:16
    #2 0x7fd8e08e457b in g_array_maybe_expand garray.c:820:21
    #3 0x7fd8e08e4b49 in g_array_append_vals garray.c:428:3
    #4 0x7fd8ef112b6e in value_string_from_table /home/vasko/sources/wireshark/epan/wslua/wslua_proto_field.c:294:9
    #5 0x7fd8ef10ee10 in ProtoField_new /home/vasko/sources/wireshark/epan/wslua/wslua_proto_field.c:646:24

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x55e041f5ef86 in realloc (/home/vasko/sources/wireshark/build_clang/run/tshark+0x222f86)
    #1 0x7fd8e0919e7d in g_realloc gmem.c:164:16
    #2 0x7fd8e08e457b in g_array_maybe_expand garray.c:820:21
    #3 0x7fd8e08e4b49 in g_array_append_vals garray.c:428:3
    #4 0x7fd8ef111e2e in range_string_from_table /home/vasko/sources/wireshark/epan/wslua/wslua_proto_field.c:226:17
    #5 0x7fd8ef10e43f in ProtoField_new /home/vasko/sources/wireshark/epan/wslua/wslua_proto_field.c:642:24

Fixes: v3.1.1rc0-497-g0371994223 ("wslua: Improve parameter check in ProtoField.new()")
Change-Id: I05b8bf3d78c8a540c6cf33d11dc3f3e01f83b8c5
Reviewed-on: https://code.wireshark.org/review/34834
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-26 13:27:45 +00:00
Stig Bjørlykke 0371994223 wslua: Improve parameter check in ProtoField.new()
Improve paremeter check in ProtoField.new() when using ftypes.CHAR:
- Check valid base types and give an error when not supported instead of
  terminate in a g_error() (base.DEC is not supported).
- Give an error if used with base.UNIT_STRING instead of silently remove
  the flags.
- Support base.RANGE_STRING instead of removing the flag.

Support using base.NONE with a valuestring.
Add ftypes.CHAR to the list of supported types.

Change-Id: I0e3f9698074c807f5da0de23ccd1be7446271135
Reviewed-on: https://code.wireshark.org/review/34783
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-16 07:41:11 +00:00
Guy Harris 5cf3fd03f1 HTTPS In More Places, update some URLs.
Change-Id: Ice2e1e2e4d94f6c9da7c651866cfa1a8ac4a31d8
Reviewed-on: https://code.wireshark.org/review/34096
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-27 07:55:36 +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
Martin Kaiser 429082dd71 wslua: pinfo: make p2p_dir accessible to lua dissectors
Some dissectors populate pinfo->p2p_dir with a packet's direction
(incoming / outgoing). Make this info available to lua dissectors.

Add a simple test for Pinfo's new p2p_dir attribute to the wslua
test suite. It checks that p2p_dir is unknown for dhcp packets.
(The dhcp dissector does not set p2p_dir).

Change-Id: I8cc39a11cff840d10ef7fa94d30cbac8bf9b533f
Reviewed-on: https://code.wireshark.org/review/33935
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2019-07-22 15:45:27 +00:00
Guy Harris ed23cfba22 Clean up IPMB/I2C link-layer header types.
209 is LINKTYPE_IPMB_LINUX; add _LINUX/_linux to the WTAP_ENCAP_ name
and function/structure names, to clarify that it's not I2C in general,
it's I2C with a particular pseudo-header.

199 is now LINKTYPE_IPMB_KONTRON, not LINKTYPE_IPMB, as it doesn't have
raw I2C packets, it has I2C packets with a pseudo-header.  Change the
WTAP_ENCAP_ name, and add a dissector for it.

Change-Id: Ie097f4317b03d2b2adfd9b81a4b11caf6268399e
Reviewed-on: https://code.wireshark.org/review/32539
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-23 20:30:00 +00:00
Peter Wu f201b971d8 test: add tests for Unicode paths in Lua and tshark -G folders
Check for potential Unicode-related problems on Windows.

Change-Id: I147c07749c5073a9ae00f07914dd80347d17c40f
Ping-Bug: 15118
Reviewed-on: https://code.wireshark.org/review/31154
Tested-by: Petri Dish Buildbot
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-29 08:27:58 +00:00
Martin Kaiser 7f80b7a2ad test: lua: add a test for invalid ethernet address
Wslua converts an invalid ethernet address to all 0's. Add a test for
this case.

Change-Id: I59bd1f9e0b94805c563fe891b22cadd32ae054d8
Reviewed-on: https://code.wireshark.org/review/30791
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-27 04:35:19 +00:00
Martin Kaiser 6e3ec21e73 test: lua: (trivial) fix indentation
Replace a TAB with spaces.

Change-Id: I3d5c79af4116614ef78dd8a71eb42e93875c0637
Reviewed-on: https://code.wireshark.org/review/30790
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2018-11-25 18:34:33 +00:00
Martin Kaiser 178001e74d lua: add support for ethernet addresses to the Address class
The code for the Address class already contains commented-out code for a
number of additional address types.

Activate the draft constructor for ethernet addresses and complete it.
Use the newly-added function to parse a string that contains an ethernet
address.

Add a basic test tvb.lua. Read an ethernet address from a tvb and
compare it to a constant Address.ether object.

Change-Id: I9771dd6e7ade4b572a8b864b8986d641b4eba3e5
Reviewed-on: https://code.wireshark.org/review/30163
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>
2018-10-18 07:51:36 +00:00
Richard Sharpe 6eba988f7c wslua: Add support for base.RANGE_STRING handling.
A range string is passed as a table of tables, eg:

  range_string = {
     { 0, 24, "Some string for values 0 to 24" },
     { 25, 25, "The string for value 25" },
     { 26, 255, "The string for the remainder" }
  }

Included is a minimal Lua test for range strings and value strings
(which did not have one previously.) It will take more time than I
currently have to figure out how to do a more exhaustive test.

Also fixed some grammar issues in error messages along the way.

Change-Id: Ia9d1efc8adabb6528c4bdcf1624c9ede49e2fdc6
Reviewed-on: https://code.wireshark.org/review/30211
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2018-10-17 20:08:57 +00:00
Peter Wu 6fa2ad4922 Lua: remove various logging functions (debug, warn, etc.)
The "debug" logging function overwrites the "debug" package which breaks
luacov: https://github.com/keplerproject/luacov/issues/55

Change-Id: I9b6025c060733198bfff8ea959444c09d6e08709
Reviewed-on: https://code.wireshark.org/review/29449
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-07 04:02:45 +00:00
Gerald Combs ef01359849 Add support for protocol aliases. Switch BOOTP to DHCP.
Add support for aliasing one protocol name to another and for filtering
using aliased fields. Mark aliased fields as deprecated.

Rename the BOOTP dissector to DHCP and alias "bootp" to "dhcp". This
lets you use both "dhcp.type" and "bootp.type" as display filter fields
without having to duplicate all 500+ DHCP/BOOTP fields.

To do:
- Add checks to proto.c:check_valid_filter_name_or_fail?
- Transition SSL to TLS.
- Rename packet-bootp.c to packet-dhcp.c?

Change-Id: I29977859995e8347d80b8e83f1618db441b10279
Ping-Bug: 14922
Reviewed-on: https://code.wireshark.org/review/29327
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-31 05:25:17 +00:00
Jaap Keuter d7c4e482b7 Remove executable file permission from lua test files
Change-Id: I18b3f145bb48a78edabed3cca03691d15cd06842
Reviewed-on: https://code.wireshark.org/review/28809
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-07-23 09:31:48 +00:00
Gerald Combs 61dd06ed9f Lua: Switch from disable_lua to enable_lua.
Deprecate "disable_lua" in favor of "enable_lua". Configuration options
typically use "true" or a similar value to enable features. Using
"disable_lua = false" to enable Lua seems odd.

Change-Id: I224acad0559d409ea0a28b5555d1eb898564328c
Reviewed-on: https://code.wireshark.org/review/28773
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-20 06:42:38 +00:00
Peter Wu a1e5a15780 wslua: fix NSTime:__tostring for negative values
"nstime_t{A, B}" is defined as "A + B * 10^9" rather than an integer
part A and fractional part B.

Bug: 14720
Change-Id: I5321db7d5ecea8f976291d2a22667b02162194e2
Reviewed-on: https://code.wireshark.org/review/27775
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-25 12:50:18 +00:00
Gerald Combs 44537199a2 Test: Add wslua.
Change-Id: I904796d13550c04df1958715d6528548385c3109
Reviewed-on: https://code.wireshark.org/review/27241
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-02 00:35:20 +00:00
Peter Wu b9f915eeef Lua: ensure that DATA_DIR and USER_DIR have trailing slashes
These directories have had trailing slashes for years and users seem to
rely on it, so restore this assumption for backwards compatibility. The
underlying API function (Dir.persconffile_path()) is not changed because
trailing slashes were not documented for that function.

For consistency, ensure that all Lua Dir functions return paths without
trailing slashes.

Bug: 14619
Change-Id: Ia299864999578884b1ad1cd48f1bd883bce6879d
Fixes: v2.5.0rc0-579-gfb052a637f ("Use g_build_filename() instead, fix indentation")
Reviewed-on: https://code.wireshark.org/review/27166
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-04-30 10:33:46 +00:00
Guy Harris af0f49e80d Use pcapng as the name of the file format.
At one point, I remember a discussion resulting in the official name of
the next-generation replacement for pcap format being changed to
"pcapng", with no hyphen.

Make Wireshark reflect that.

Change-Id: Ie66fb13a0fe3a8682143106dab601952e9154e2a
Reviewed-on: https://code.wireshark.org/review/25214
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-01-09 00:38:51 +00:00
Michael Mann b1302f0f28 Remove circuit_id from Lua tests
It was removed from packet_info when circuit API was removed.  Remove
tests that call circuit_id for testing.

Change-Id: I88e54b288d9d8f99b63e0828663b3025c57e0ec8
Reviewed-on: https://code.wireshark.org/review/24400
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-13 20:27:17 +00:00
Silvio Gissi 59add43eec Lua: Add "tonumber" method to NSTime
Absolute and Relative time fields could not be converted to seconds
without converting to string and parsing to number.

Fixed conversion in generated code that was subject to precision loss

Usage:
f=Field.new("frame.delta_time")
delta=f().value:tonumber()

Change-Id: I6ef91c6238a6c2ed9adf6cae03f8913f0a09332e
Reviewed-on: https://code.wireshark.org/review/22316
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-21 23:50:27 +00:00
Rado Radoulov ae8b18d618 New Lua function TreeItem:referenced(ProtoField | Dissector).
This function returns TRUE/FALSE depending whether the specified ProtoField/Dissector
needs to be dissected. By using this function in conjunction with the TreeItem.visible
attribute, Lua dissectors can be significantly sped up by making less C interop calls
which are relatively slow in terms of dissection especially when using sub-protocols
where the dissection of an entire protocol can be skipped.

Added tests for TreeItem:referenced to protofield.lua

Change-Id: I44feacb91a2a5b0e3c28c0ccd8d6b04cccd67261
Reviewed-on: https://code.wireshark.org/review/21387
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-05-05 08:38:40 +00:00
Stig Bjørlykke 1dde988265 Lua: Add some ProtoField tests
Add tests for abbrev and name validation.
Add tests for signed integer base values.

Change-Id: I0bd65c6633b44ae998880f528c22afc22c87529d
Reviewed-on: https://code.wireshark.org/review/20568
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-03-19 15:14:18 +00:00
Stig Bjørlykke 0837dd23ec Lua: Add absolute time base values
Add ABSOLUTE_TIME_* defines to the base table in init.lua for use
in ProtoField.absolute_time.

Change-Id: I5c99eafdac97655d71fd4f3374294cd587afaf0a
Reviewed-on: https://code.wireshark.org/review/20543
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-03-15 18:44:44 +00:00
Stig Bjørlykke ba49a8526c Lua: Add some ProtoField tests.
Test usage of base.UNIT_STRING.

Change-Id: I9c97b58b3cc6db65713e83609900880e157237f2
Reviewed-on: https://code.wireshark.org/review/19357
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-03-14 13:58:18 +00:00
Franklin "Snaipe" Mathieu e95519b7f9 lua: Added new integer sizes in TvbRange
* Added support for 3-byte integers in :int() and :le_int()
* Added support for 5, 6, and 7-byte integers in :int64() and :le_int64()

Change-Id: If9ab4ea806191bc63effe45a081b9c65693c2367
Signed-off-by: Franklin "Snaipe" Mathieu <snaipe@diacritic.io>
Reviewed-on: https://code.wireshark.org/review/18672
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-11-06 09:01:16 +00:00
Snaipe d8db5646ef lua: Added support for FT_IPv6 fields
* Implement Tvb:ipv6()
* Handle FT_IPv6 protofields during insertion in the lua tree
* Implement Address.ipv6(hostname)

Change-Id: I585c392681b3aef02ed8ee956f74051d77fb28d4
Signed-off-by: Franklin "Snaipe" Mathieu <snaipe@diacritic.io>
Reviewed-on: https://code.wireshark.org/review/18442
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-25 19:18:35 +00:00
Peter Wu 537705a8b2 wslua: prepare for split class/instance (meta)methods
Previously the metatables for classes were the same for the class and
its instances. This results in issues like calling __gc on the class
table on exit.

Make it possible to declare separate class methods (functions) and
instance methods. Observe that all attributes apply to the instances
only, so make these just available on the instance.

The attribute/methods lookup method (via __index/__newindex) have been
rewritten to use upvalues, removing the technical need for the
properties __getters/__setters/__methods. The "lua globals" test still
checks for these, but it could be removed in the future.

To fix bug 12968, the __gc method is removed from the class method.
Future patches should remove the WSLUA_REGISTER_CLASS,
WSLUA_REGISTER_META and WSLUA_REGISTER_ATTRIBUTES macros completely and
create split class functions/methods (such that __call for an instance
cannot accidentally be invoked on the class).

Removed duplicate "fragmented" property from Pinfo (which triggered an
error) and replaced exit() by g_error() for debugger friendliness.
Remove lua_shiftstring since checkstring always returns non-NULL.

Bug: 12968
Change-Id: I57f8a93d08bb84c79b0e94cf2c82d8402fc16646
Reviewed-on: https://code.wireshark.org/review/18026
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2016-10-18 20:41:34 +00:00
Guy Harris c8157aa6b4 Go back to having only one SocketCAN LINKTYPE_ value.
Libpcap just backed out the "host-endian" SocketCAN LINKTYPE_ value; we
don't need it any more.

Change-Id: I33a7dc21207a0009e20b4abaefe1119eb649c39a
Reviewed-on: https://code.wireshark.org/review/17327
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-25 21:14:48 +00:00