aboutsummaryrefslogtreecommitdiffstats
path: root/dftest.c
AgeCommit message (Collapse)AuthorFilesLines
2023-02-10Move ui/cmdarg_err.[ch] to wsutilJoão Valverde1-1/+1
2023-02-07Move ui/version_info.[ch] to wsutilJoão Valverde1-1/+1
2023-02-07Move ui/exit_codes.h to include/João Valverde1-6/+7
2023-01-11Set unique exit codes for processesMartin Mathieson1-5/+6
2023-01-11dftest: Add --types optionJoão Valverde1-1/+10
2023-01-09dftest: Add wslog usageJoão Valverde1-0/+2
2023-01-09dftest: Add a newline to outputJoão Valverde1-4/+16
2023-01-08dftest: Enable debug log level with -l or -fJoão Valverde1-0/+2
2023-01-08dftest: Add -0 option (no optimization)João Valverde1-13/+29
2023-01-07dftest: Move a newline insertionJoão Valverde1-1/+0
We want the string to not end with a new line for logging purposes but add the final new line when printing to a file stream.
2023-01-07dftest: More code cleanups and enhancementsJoão Valverde1-116/+177
2023-01-06dftest: Add -h and improve output formatJoão Valverde1-10/+18
Experiment with removing the type from the instruction output. This information is also available with the -s option flag. Rename -t to -s.
2023-01-05dftest: More CLI options and improve output formatJoão Valverde1-29/+87
2022-12-30dftest: Fix command-line argument parsingJoão Valverde1-24/+35
Expressions that start with hyphen clash with command-line options. In that case we need to pass "--" to dftest to stop processing options. Fix the test suite to do this. Fixes failures with dftest and expressions like: -2 == tcp.port Replace the GLib option parser with getopt while at it. The GLib API is nice but isn't a good fit for this utility and the code appears to be inconsistent on whether "--" is left in the argv or not.
2022-12-30dftest: Add debug command-line optionsJoão Valverde1-14/+47
2022-12-30dftest: Add a missing goto statementJoão Valverde1-0/+1
2022-12-29dfilter: Add compilation warning for ambiguous syntaxJoão Valverde1-26/+30
$ dfilter 'frame contains fc' Filter: frame contains fc Warning: Interpreting "fc" as "Fibre Channel". Consider writing :fc or .fc. (...)
2022-12-29dftest: Add elapsed timeJoão Valverde1-2/+20
2022-12-23dfilter: Refactor error location trackingJoão Valverde1-1/+1
Remove duplicate location struct by adding a new header. Pass around a structure instead of a pointer.
2022-11-30dfilter: Replace compile booleans arguments with a bit flagJoão Valverde1-1/+1
2022-11-30dfilter: Add optimization flagJoão Valverde1-1/+1
When we are just testing code to see if it compiles performing optimizations is wasteful. Add an option to disable them.
2022-11-28dfilter: Return an error object instead of stringJoão Valverde1-6/+6
Return an struct containing error information. This simplifies the interface to more easily provide richer diagnostics in the future. Add an error code besides a human-readable error string to allow checking programmatically for errors in a robust manner. Currently there is only a generic error code, it is expected to increase in the future. Move error location information to the struct. Change callers and implementation to use the new interface.
2022-10-08Add log init message to main()João Valverde1-0/+3
2022-04-11Try to fix a narrowing warningJoão Valverde1-7/+4
"C:\Development\wsbuild64\Wireshark.sln" (default target) (1) -> "C:\Development\wsbuild64\epan\dfilter\dfilter.vcxproj.metaproj" (default target) (18) -> "C:\Development\wsbuild64\epan\dfilter\dfilter.vcxproj" (default target) (108) -> (ClCompile target) -> C:/Development/wireshark/epan/dfilter/scanner.l(463,54): warning C4267: '+=': conversion from 'size_t' to 'int ', possible loss of data [C:\Development\wsbuild64\epan\dfilter\dfilter.vcxproj] C:/Development/wireshark/epan/dfilter/scanner.l(463,54): warning C4267: state->location.col_start += sta te->location.col_len; [C:\Development\wsbuild64\epan\dfilter\dfilter.vcxproj] C:/Development/wireshark/epan/dfilter/scanner.l(463,54): warning C4267: ^ (compiling source file C:\Development\wsbuild64\epan\dfilter\scanner.c) [C:\Development\ws build64\epan\dfilter\dfilter.vcxproj]
2022-04-11dfilter: Handle missing error location more gracefullyJoão Valverde1-3/+5
If we don't have an offset, don't print anything with underline. Also it can underline filters using macros correctly now. $ tshark -Y 'ip and ${private_ipv4:ip.sr}' -r /dev/null tshark: Left side of "==" expression must be a field or function, not "ip.sr". ip and ip.sr == 192.168.0.0/16 or ip.sr == 172.16.0.0/12 or ip.sr == 10.0.0.0/8 ^~~~~
2022-04-10dfilter: Add location tracking to scanner and use it to report errorsJoão Valverde1-6/+42
Add location tracking as a column offset and length from offset to the scanner. Our input is a single line only so we don't need to track line offset. Record that information in the syntax tree. Return the error location in dfilter_compile(). Use it in dftest to mark the location of the error in the filter string. Later it would be nice to use the location in the GUI as well. $ dftest "ip.proto == aaaaaa and tcp.port == 123" Filter: ip.proto == aaaaaa and tcp.port == 123 dftest: "aaaaaa" cannot be found among the possible values for ip.proto. ip.proto == aaaaaa and tcp.port == 123 ^~~~~~
2022-04-05dfilter: Print syntax tree using dftest + format enhancementsJoão Valverde1-3/+7
Add argument to dfilter_compile_real() to save syntax tree text representation. Use it with dftest to print syntax tree. Misc debug output format improvements.
2022-04-04wsutil: Add configuration namespaces.Gerald Combs1-5/+5
Rename init_progfile_dir to configuration_init. Add an argument which specifies our configuration namespace, which can be "Wireshark" (default) or "Logwolf".
2022-03-28dfilter: Store expanded textJoão Valverde1-4/+0
2022-02-20Remove editor modelines and .editorconfig exceptions from root filesDavid Perry1-123/+110
2022-01-01Revert "epan: Initialize wiretap"João Valverde1-0/+9
This reverts commit c15f2aadc1aef3f4855c682ff7f686d5f63088cb. Crashes on exit. Needs more work. Fixes #17821.
2021-11-27epan: Initialize wiretapJoão Valverde1-9/+0
Clients of libwireshark should not be required to initialize explicitly wiretap, if they don't use it themselves.
2021-09-29dftest: Don't use quotes to output filterJoão Valverde1-1/+1
Using quotes is confusing because they are difficult to distinguish from the actual filter expression itself. Quotes are unnecessary anyway because whitespace is not significant (except inside brackets).
2021-06-26wslog: Check environment initialization for errorsJoão Valverde1-3/+3
Initialiaze the cmdarg error stream earlier. Dumpcap also needs to know earlier if it is running in capture child mode.
2021-06-21wslog: Check if we are initialized and add missing initsJoão Valverde1-0/+7
Instead of receiving the program name from GLib, pass it explicitly to ws_log_init() instead and use that to initialize the GLib program name. ws_log_parse_args() will now exit the program when it encounters an argument error if exit_failure >= 0.
2021-03-15Add more error-reporting routines that call through a function pointer.Guy Harris1-36/+25
Have routines to report capture-file errors, using libwireshark error codes and strings, that call through a pointer, so they can pop up dialogs in GUI apps, print a message to the standard error on command-line apps, and possibly do something different on server programs. Have init_report_message() take a pointer to structure containing those function pointers, rather than the function pointers themselves, as arguments. Make other API changes to make that work.
2021-02-19wiretap: eliminate two WTAP_FILE_TYPE_SUBTYPE_ values.Guy Harris1-0/+5
Eliminate WTAP_FILE_TYPE_SUBTYPE_ERF and WTAP_FILE_TYPE_SUBTYPE_SYSTEMD_JOURNAL - instead, fetch the values by name, using wtap_name_to_file_type_subtype(). This requires that wtap_init() be called before epan_init(); that's currently the case, but put in comments to indicate why it must continue to be the case.
2020-07-06Windows: Set our locale to ".UTF-8".Gerald Combs1-1/+8
In each of our executables we were calling "setlocale(LC_ALL, "")" at startup. This told Windows that output was encoded using the current system code page. Unless the code page was 65001 (UTF-8), this was a lie. We write UTF-8 to stdout and stderr, so call "setlocale(LC_ALL, ".UTF-8)" at startup on Windows. This lets the CRT translate our output correctly in more cases. Clarify and expand the OUTPUT section in the tshark man page. Bug: 16649 Change-Id: If93231fe5b332c292946c7f8e5e813e2f543e799 Reviewed-on: https://code.wireshark.org/review/37560 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-07-26HTTPS (almost) everywhere.Guy Harris1-1/+1
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-01-31dftest: Always free the get_args_as_string resultVasil Velichkov1-0/+2
Fixes ASAN test failures for 14 dfilter tests. Change-Id: I1592bb1f679253a5eb8be8496881c4e4af207612 Reviewed-on: https://code.wireshark.org/review/31843 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-09-09epan: Add argument to epan_init() to disable pluginsJoão Valverde1-1/+1
Change-Id: I8dc76e6bf8c4d5a3081cbdc1d47b88e857415d29 Reviewed-on: https://code.wireshark.org/review/29498 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2018-08-29epan: Remove unnecessary all protocols registration callbackJoão Valverde1-3/+1
We are exporting a registration function from libwireshark just to have it passed back as a callback. Seems unnecessary. Change-Id: I7621005c9be11691d319102326824c5e3520a6f3 Reviewed-on: https://code.wireshark.org/review/29328 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2018-05-05Don't use dladdr() to get a pathname for the current executable().Guy Harris1-1/+1
Change-Id: I24ad11a659c2cb936f873339dc2b36ac9944280a Reviewed-on: https://code.wireshark.org/review/27359 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-08replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.Dario Lombardo1-1/+1
The first is deprecated, as per https://spdx.org/licenses/. Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed Reviewed-on: https://code.wireshark.org/review/25661 Petri-Dish: Anders Broman <a.broman58@gmail.com> Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-09wiretap: add a parameter to wtap_init() indicating whether plugins must be ↵Pascal Quantin1-1/+1
loaded g995812c5f1 moved wiretap plugins registration from applications to wiretap library init function. As we do not want to load plugins for all users of libwiretap, let's make it configurable. Bug: 14314 Change-Id: Id8fdcc484e2d0d31d3ab0bd357d3a6678570f700 Reviewed-on: https://code.wireshark.org/review/25194 Reviewed-by: Dario Lombardo <lomato@gmail.com> Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-14Refactor plugin registration and loadingJoão Valverde1-9/+0
Put different types of plugins (libwiretap, libwireshark) in different subdirectories, give libwiretap and libwireshark init routines that load the plugins, and have them scan the appropriate subdirectories so that we don't even *try* to, for example, load libwireshark plugins in programs that only use libwiretap. Compiled plugins are stored in subfolders of the plugin folders, with the subfolder name being the Wireshark minor version number (X.Y). There is another hierarchical level for each Wireshark library (libwireshark, libwscodecs and libwiretap). The folder names are respectively plugins/X.Y/{epan,codecs,wiretap}. Currently we only distribute "epan" (libwireshark) plugins. Change-Id: I3438787a6f45820d64ba4ca91cbe3c8864708acb Reviewed-on: https://code.wireshark.org/review/23983 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2017-11-21Move the protocol registration routines back into libwiresharkJoão Valverde1-1/+1
Follow-up to b695b3e2f72998d66ca4b7a6826d4ce1688060c8. Change-Id: I7e36519f2c3806c1205d05437671325080974257 Reviewed-on: https://code.wireshark.org/review/24524 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
2017-11-09Start using SPDX license identifiers.Gerald Combs1-13/+1
A while back Graham pointed out the SPDX project (spdx.org), which is working on standardizing license specifications: https://www.wireshark.org/lists/wireshark-dev/201509/msg00119.html Appendix V of the specification describes a short identifier (SPDX-License-Identifier) that you can use in place of boilerplate in your source files: https://spdx.org/spdx-specification-21-web-version#h.twlc0ztnng3b Start the conversion process with our top-level C and C++ files. Change-Id: Iba1d835776714deb6285e2181e8ca17f95221878 Reviewed-on: https://code.wireshark.org/review/24302 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Balint Reczey <balint@balintreczey.hu> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-09Pull all the "load settings" calls into a epan_load_settings() routine.Guy Harris1-1/+2
That way, nothing using libwireshark needs to know what settings need to be loaded, they just call epan_load_settings(). Change-Id: I9390e259e286fc4f5acaeaac2767e4c3c4b656af Reviewed-on: https://code.wireshark.org/review/20983 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-09Pull the error-reporting code for preference files into read_prefs().Guy Harris1-29/+1
No need to duplicate it in N different programs. Update comments while we're at it. Change-Id: I3096cbe5448a19363eff6303bdd54e522dae9336 Reviewed-on: https://code.wireshark.org/review/20973 Reviewed-by: Guy Harris <guy@alum.mit.edu>