Commit Graph

980 Commits

Author SHA1 Message Date
João Valverde 91f7762fad wslua: Use wiretap introspection 2022-10-07 10:28:47 +01:00
João Valverde 9faaf0ecff wslua: Use introspection API to generate constants 2022-10-07 10:28:47 +01:00
Stig Bjørlykke 4512dfd66d wslua: Support FT_STRINGZPAD in FieldInfo
Add support for FT_STRINGZPAD in FieldInfo.
2022-10-04 15:28:18 +00:00
Guy Harris c9342873e5 Clarify dissector description, protocol short name, and protocol ong name.
Rename dissector_handle_get_long_name() and
dissector_handle_get_short_name() to
dissector_handle_get_protocol_long_name() and
dissector_handle_get_protocol_short_name(), to clarify that they fetch
names for the protocol that the dissector dissects, not for the
dissector *itself*.  Leave a deprecated
dissector_handle_get_short_name() wrapper, and export
dissector_handle_get_protocol_long_name(), as it's now used in some
dissectors.

Change some calls to dissector_handle_get_description() back to
dissector_handle_get_protocol_short_name(), as they appear to be made in
order to display a *protocol* name.

Rename some methods, variables, enums, and table column names to reflect
cases where the dissector description is being used.
2022-09-13 00:47:24 -07:00
Guy Harris d4394de669 Give dissectors a descriptive string.
It defaults to the short name of the protocol dissected by the
descriptor, but it's now possible to register a dissector with an
explicit description.

This is mainly for use in the Decode As UI.  It handles the case where
the same protocol might have different "Decode As..."-specifiable
dissectors for different situations.
2022-09-12 21:05:14 +00:00
Chuck Craft 9ab1093913 wsdg/Lua: no get_range() method - use fieldinfo.range 2022-09-11 17:52:10 +00:00
Gerald Combs 3bb40a586d wslua: Rename wslua_util.c to wslua_utility.c.
Rename wslua_util.c to wslua_utility.c so that our file name has the
form "wslua_<lower case lua module name>.c", which is the case for our
other modules.
2022-07-24 17:11:57 +00:00
Gerald Combs fd830dff58 wslua+lrexlib: Fixup our dependencies and paths.
Add a register_wslua target and have lrexlib depend on it so that
declare_wslual.h is generated in the right order. The working directory
when we create declare_wslua.h and register_wslua.c is epan/wslua,
so there's no need to explicitly set it. Remove an unneeded lrexlib
include path.
2022-07-22 19:08:13 +00:00
Gerald Combs b9ee6f4563 wslua: Fix more argument definitions. 2022-07-21 17:38:22 -07:00
Chuck Craft 9f59cae607 wslua: tapinfo - add state to debug info; update wsluarm
Test wth:
for _,tap_name in pairs(Listener.list()) do
  foo1 = Listener.new(tap_name)
  print (foo1)
end
2022-07-21 21:17:36 +00:00
Gerald Combs fbadb8c785 wslua: Capitalize words in our markup.
Capitalize words in our markup instead of depending on make-wsluarm.pl.
Add a single space after "Mode:".
2022-07-20 14:52:40 -07:00
Gerald Combs 3acd20fabe CMake+lrexlib: Another include path fix attempt. 2022-07-19 13:57:54 -07:00
Gerald Combs 9d96b301de CMake+lrexlib: Add another include path.
Include paths will be added until morale improves.
2022-07-19 13:04:44 -07:00
Gerald Combs 56a9666a3a wslua: Fix our argument definitions.
Make sure our argument definitions match their corresponding function
names.
2022-07-19 18:53:11 +00:00
Gerald Combs 953c6f73aa CMake+lrexlib: Fix our include paths.
Try to fix

C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\epan\wslua\lrexlib\pcre2\../../wslua.h(52,1): fatal error C1083: Cannot open include file: 'epan/wslua/declare_wslua.h': No such file or directory [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\epan\wslua\lrexlib\lrexlib.vcxproj]
C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\epan\wslua\lrexlib\pcre2\../../wslua.h(52,1): fatal error C1083: #include <epan/wslua/declare_wslua.h> [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\epan\wslua\lrexlib\lrexlib.vcxproj]
C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\epan\wslua\lrexlib\pcre2\../../wslua.h(52,1): fatal error C1083: ^ [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\epan\wslua\lrexlib\lrexlib.vcxproj]
2022-07-18 09:47:34 -07:00
Alexis La Goutte b68acb6bff pcre2: Fix -Wmissing-prototypes
lpcre2.c:506:13: warning: no previous prototype for function 'luaopen_rex_pcre2'
lpcre2_f.c:207:5: warning: no previous prototype for function 'Lpcre2_config'
lpcre2_f.c:234:5: warning: no previous prototype for function 'Lpcre2_get_flags'
2022-07-15 13:45:52 +00:00
Gerald Combs 75efbb1ac4 Rename Logwolf to Logray
Switch to the name "Logray" for the log analyzer. Rays are biological
cousins of sharks and more people like the name "Logray" in a completely
unscientific survey here. Apologies for any inconvenience this might
cause.
2022-07-06 15:04:25 +00:00
Gerald Combs eaae2d0ee7 Minor Python3 script fixups.
Make some scripts executable and use the shebang line recommended at
https://docs.python.org/3/using/unix.html#miscellaneous
2022-06-27 16:46:55 +00:00
Gerald Combs 4153af1dc7 wslua: Port make-init-lua to Python3
Port the script that creates init.lua to Python3. The generated init.lua
removes one newline and adds another, otherwise the output is identical
to the Perl version.
Ping #18152.
2022-06-27 16:28:36 +00:00
Gerald Combs ae3010cabe wslua: Port make-taps to Python3
Port the script that creates taps_wslua.c and taps.txt to Python3. The
generated taps_wslua.c has one less newline, otherwise the output is
identical to the Perl version. Make the "taps" configuration file an
ConfigParser / .ini file.
Ping #18152.
2022-06-27 16:11:34 +00:00
Gerald Combs 602e87d6c5 Make sure our Python scripts read and write UTF-8.
Explicitly set "encoding='utf-8'" for each of the files we read and
write in make-reg.py and generate_authors.py.
2022-06-24 11:08:37 -07:00
Moshe Kaplan 26f87b3250 wslua: Port epan/wslua/make-reg.py to Python3
Port the script that creates
declare_wslua.h and register_wslua.c
to Python3.
Ping #18152.
2022-06-24 15:02:38 +00:00
Chuck Craft 39fc49b792 wsdg: escape tick marks after backtick; fix typo 2022-06-22 18:55:27 -05:00
João Valverde 0615ba6317 ftypes: Make accessor functions type safe 2022-06-20 17:29:57 +00:00
Roland Knall 2cf938cfa8 tap: Adding flags for tap_packet
This allows flags to be passed by the registering listener
to the collection of information
2022-06-10 05:46:15 +00:00
João Valverde 693820b90d lrexlib: Disable MSVC narrowing warnings 2022-06-02 14:47:04 +00:00
João Valverde cd73921a9e lrexlib: Disable a warning [-Wshorten-64-to-32]
The warning is harmless and we want to keep upstream code
as pristine as possible (unless there is a real issue in
the code of course) so disable the warning.
2022-05-27 15:14:16 +01:00
João Valverde b8279a6ce1 lrexlib: Pacify checkAPIs 2022-05-26 10:09:13 +00: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
Chuck Craft 4376cf1209 wsdg/lua: gui.colorized_frame.fg example is a few digits short 2022-05-16 22:48:37 +00:00
Peter Lemenkov b1ba667acc wslua: another fix for -Werror=clobbered
```
cd /home/petro/work/wireshark/epan/wslua && /usr/bin/cc -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DWS_BUILD_DLL -I/home/petro/work/wireshark -I/home/petro/work/wireshark/include -isystem /usr/include/glib-2.0 -isystem /usr/lib64/glib-2.0/include -isystem /usr/include/lua-5.1 -isystem /home/petro/work/wireshark/epan/wslua -fvisibility=hidden  -fexcess-precision=fast -Wall -Wextra -Wendif-labels -Wpointer-arith -Wformat-security -fwrapv -fno-strict-overflow -Wvla -Waddress -Wattributes -Wdiv-by-zero -Wignored-qualifiers -Wpragmas -Wno-overlength-strings -Wno-long-long -Wredundant-decls -Wno-error=maybe-uninitialized -Wno-format-truncation -Wframe-larger-than=32768 -Wunused-const-variable -Wshadow -Wold-style-definition -Wstrict-prototypes -Wlogical-op -Wjump-misses-init -Werror=implicit -Wno-pointer-sign -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fmacro-prefix-map=/home/petro/work/wireshark/= -fmacro-prefix-map=/home/petro/work/wireshark/= -O2 -g -DNDEBUG -fPIC -std=gnu11 -Werror -MD -MT epan/wslua/CMakeFiles/wslua.dir/init_wslua.c.o -MF CMakeFiles/wslua.dir/init_wslua.c.o.d -o CMakeFiles/wslua.dir/init_wslua.c.o -c /home/petro/work/wireshark/epan/wslua/init_wslua.c
/home/petro/work/wireshark/epan/wslua/wslua_tree.c: In function ‘TreeItem_add_packet_field’:
/home/petro/work/wireshark/epan/wslua/wslua_tree.c:79:17: error: variable ‘item’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
   79 |     proto_item* item = NULL;
      |                 ^~~~
Consolidate compiler generated dependencies of target dissectors
cc1: all warnings being treated as errors
make[2]: *** [epan/wslua/CMakeFiles/wslua.dir/build.make:508: epan/wslua/CMakeFiles/wslua.dir/wslua_tree.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
```

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
2022-04-25 11:24:11 +00:00
Gerald Combs e364444b24 wslua: Update the menu group documentation.
Update to match ca04f4c8cb.
2022-04-15 21:30:50 +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
Chuck Craft 14bf5bbdf1 wslua: Lua Console - add Clear button; restore print() 2022-03-25 09:47:05 +00:00
Guy Harris 109b92b5d7 wiretap: have wtap_dump_close() provide a "needs to be reloaded" indication.
This allows the "needs to be reloaded" indication to be set in the close
process, as is the case for ERF; having a routine that returns the value
of that indication is not useful if it gets seet in the close process,
as the handle for the wtap_dumper is no longer valid after
wtap_dump_close() finishes.

We also get rid of wtap_dump_get_needs_reload(), as callers should get
that information via the added argument to wtap_dump_close().

Fixes #17989.
2022-03-14 19:12:20 +00:00
Chuck Craft ab8500261b Docs: wslua TreeItem class typo 2022-01-28 06:24:28 +00:00
Pascal Quantin adca11dd5c range_string: follow-up of 893290c 2022-01-05 20:34:15 +00:00
João Valverde a566076839 epan: Move time display types to field_display_e
This makes it easier to understand the code, avoids conflicts
and ugly and unnecessary casts.

The field display enum has evolved over time from integer types
to a type generic parameter.
2021-12-27 22:31:31 +00:00
João Valverde ce1dc88173 Fix stdio.h conversions to use the scanf macros 2021-12-19 23:49:55 +00:00
João Valverde c5a19582e4 epan: Convert to use stdio.h from GLib
Replace:
    g_snprintf() -> snprintf()
    g_vsnprintf() -> vsnprintf()
    g_strdup_printf() -> ws_strdup_printf()
    g_strdup_vprintf() -> ws_strdup_vprintf()

This is more portable, user-friendly and faster on platforms
where GLib does not like the native I/O.

Adjust the format string to use macros from intypes.h.
2021-12-19 19:29:53 +00:00
João Valverde 19dcb725b6 epan: Remove STR_ASCII and STR_UNICODE
These display bases work to replace unprintable characters so the
name is a misnomer. In addition they are the same option and this
display behaviour is not something that is configurable.

This does not affect encodings because all our internal text strings
need to be valid UTF-8 and the source encoding is specified using
ENC_*.

Remove the assertion for valid UTF-8 in proto.c because
tvb_get_*_string() must return a valid UTF-8 string, always, and we
don't need to assert that, it is expensive.
2021-12-03 04:35:56 +00:00
Moshe Kaplan a523135202 epan: Add header files to Doxygen
Add @file markers for epan
headers so that Doxygen will
generate documentation for them.
2021-11-30 08:46:49 +00:00
Moshe Kaplan 1c3a9af869 Add files with WS_DLL_PUBLIC to Doxygen
Add @file markers for most files that
contain functions exported with
WS_DLL_PUBLIC so that Doxygen will
generate documentation for them.
2021-11-29 21:27:45 +00:00
Gerald Combs 6ee1390b86 Qt: Make Lua dialogs children of the main window.
Pass the funnel operations ID to new_text_window and new_dialog so that
we can assign parent widgets when we create new FunnelTextDialogs and
FunnelStringDialog. This should ensure that they're destroyed properly.
Ping #17590.
2021-11-15 20:03:16 +00:00
João Valverde 1a32a75a62 ftypes: Internal headers need to be internal
The header ftypes-int.h should not be used outside of epan/ftypes
because it is a private header.

The functions fvalue_free() and fvalue_cleanup() need not and should
not be macros either.
2021-11-11 03:15:31 +00:00
Gerald Combs 87b84b7813 Lua is a proper name. Fix its capitalization. 2021-11-11 01:08:51 +00:00
Chuck Craft a541fcb528 docs/tshark: proper name is lopsided CamelCase (TShark)
This is a first pass that covers the WSDG, WSUG, man page, a code
comment and a README. Plenty left to do in the Debian files, a few
Lua examples and other misc files.
2021-10-21 19:54:20 +00:00
Stig Bjørlykke cfe33625a0 wslua: Initialize Proto members on creation
Set all pointers in Proto to NULL and check for valid pointers when
wslua_deregister_protocols().

Fixes #17668
2021-10-19 20:50:45 +00:00
Stig Bjørlykke 41f4855443 Lua: Make FileHandler seek_read() optional
When FileHandler seek_read() is not implemented use a default
implementation which does the same as the provided example to
file_seek() and then call the FileHandler read().
2021-10-03 11:04:29 +02:00