Commit Graph

56 Commits

Author SHA1 Message Date
Stig Bjørlykke cc679ca5ce Qt: Add check for field extractors
The proto tree is needed in several cases when using Lua field extractors,
because they fetch values from the tree.  Without a valid field extractor
a Lua plugin may misbehave and display wrong column info.

This fixes column issues when:
- Calling resetColumns() in Qt.  This involves adding a display filter,
  change time display format, change name resolution and other changes
  in UI which requires column updates.
- Print summary lines.
- Export as CSV and PSML.

Change-Id: Ieed6f8578cdf2759f1f836cd8413a4529b7bbd80
Reviewed-on: https://code.wireshark.org/review/13708
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-05 05:35:02 +00:00
Guy Harris 4348d4dd34 Type cleanups.
dfilter_macro_apply_recurse() returns either NULL or a pointer to
freshly-allocated memory, so it doesn't return a const pointer.
dfilter_macro_apply() calls dfilter_macro_apply_recurse(), so it doesn't
return a const pointer, either.

In dfilter_compile(), have separate variables for the filter handed in
and the macro-expanded filter, the former being const gchar * and the
latter being gchar *.

Change-Id: I191549bf0ff6c09c1278a98432a907c93d5e0e74
Reviewed-on: https://code.wireshark.org/review/12446
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-05 20:41:32 +00:00
Bill Meier 3e3fc9fc5e epan/dfilter/*.c: As needed: Add editor modelines & Fix indentation
Change-Id: I410839329a98bd806c60961dfb9693d5eeeeb702
Reviewed-on: https://code.wireshark.org/review/7104
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-13 19:04:44 +00:00
Guy Harris cfcbb28671 Clean up ftype-conversion and dfilter error message string handling.
Have dfilter_compile() take an additional gchar ** argument, pointing to
a gchar * item that, on error, gets set to point to a g_malloc()ed error
string.  That removes one bit of global state from the display filter
parser, and doesn't impose a fixed limit on the error message strings.

Have fvalue_from_string() and fvalue_from_unparsed() take a gchar **
argument, pointer to a gchar * item, rather than an error-reporting
function, and set the gchar * item to point to a g_malloc()ed error
string on an error.

Allow either gchar ** argument to be null; if the argument is null, no
error message is allocated or provided.

Change-Id: Ibd36b8aaa9bf4234aa6efa1e7fb95f7037493b4c
Reviewed-on: https://code.wireshark.org/review/6608
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 10:22:59 +00:00
Michael Mann 86726f404a Trim down the use of ep_ memory in the display filter code.
Couldn't quite eliminate it completely, but it's much improved.  Need to figure out where/when to free dfilter_error_msg.

Change-Id: I10216e9546d38e83f69991ded8ec0b3fc8472035
Reviewed-on: https://code.wireshark.org/review/6591
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-18 00:28:53 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Jakub Zawadzki c6669a3c63 dfilter: report warning if OR and AND logic operands are mixed without parentheses.
svn path=/trunk/; revision=51247
2013-08-10 17:49:28 +00:00
Jeff Morriss 54bb2e7a5c Move report_err.{h,c} from epan into wsutil: there's nothing epan-specific there and moving it avoids having to recompile the file for use in editcap and capinfos (which don't link against libwireshark).
svn path=/trunk/; revision=50598
2013-07-15 02:48:26 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Anders Broman 345b48d1ea Try to squelch warnings
svn path=/trunk/; revision=43019
2012-06-03 09:26:15 +00:00
Anders Broman 7f96d94b7c From Gilbert Ramirez: When filtering on a single-byte byte-array-slice, using a normal hex string would be nice
svn path=/trunk/; revision=41232
2012-02-29 05:58:45 +00:00
Guy Harris 70a8b27948 Get rid of the depth argument to dfilter_macro_apply(); have an internal
routine that does all the work and that takes a depth argumen, and an
external routine that calls that internal routine with a depth argument
of 0.  The depth is only of use internally, to avoid infinite recursion.

When recursing with that routine, pass depth+1 as the depth value,
rather than passing depth and incrementing it afterwards; the latter
doesn't prevent infinite recursion.  (Thanks and a tip of the hat to
Clang Cat for catching this.)

Squelch some other (harmless) warnings from Clang Cat.

Clean up indentation.

svn path=/trunk/; revision=39838
2011-11-15 04:26:38 +00:00
Guy Harris b32b4d08bd It wasn't complaining about that null pointer reference.
svn path=/trunk/; revision=35981
2011-02-17 18:43:38 +00:00
Guy Harris 8eb8623b15 OK, let's try a couple more explicit checks against NULL, to see whether
that de-confuses Microsoft's code analyzer.

svn path=/trunk/; revision=35975
2011-02-17 08:15:05 +00:00
Stig Bjørlykke 54fa8338b9 Fixed a data type and removed a shadowed variable.
svn path=/trunk/; revision=30610
2009-10-18 21:30:39 +00:00
Kovarththanan Rajaratnam 17f010119a From Jakub Zawadzki via. Bug 3330:
* Fix memleak (df->deprecated in dfilter_free())
* Free protocol hash tables on cleanup.
* Free protocols list on cleanup.
* Free memory allocated by fgetline() in parse_services_file()

From me:

* proto.c: set gmc_hfinfo to NULL after free
* proto.c: switch order of g_free() and g_list_remove() in proto_cleanup()

svn path=/trunk/; revision=29656
2009-09-01 18:16:55 +00:00
Kovarththanan Rajaratnam 2afdee256c Handle a text NULL pointer more gracefully
svn path=/trunk/; revision=29491
2009-08-21 11:31:21 +00:00
Anders Broman 29bb0505d5 NULL is zero on all platforms we run on.
svn path=/trunk/; revision=29003
2009-07-07 22:22:05 +00:00
Anders Broman 0d64273468 Initialize memory to zero.
(is NULL = zero on all platforms?)

svn path=/trunk/; revision=28955
2009-07-06 15:37:29 +00:00
Bill Meier 277980a6c6 From Kovarththanan Rajaratnam: dfilter: Fix for bug #3490:
"Purify reports an uninitialized memory read in dfw_append_const() when
accessing the 'next_const_id' member. This seems to be caused by dfwork_new()
which doesn't properly initialize the member."

svn path=/trunk/; revision=28486
2009-05-26 15:13:19 +00:00
Stig Bjørlykke 62f60df6b4 From Jakub Zawadzki (bug 3331):
g_free() is NULL safe, so we don't need check against it.

svn path=/trunk/; revision=27718
2009-03-13 22:06:48 +00:00
Guy Harris 884a635762 Assign pointers to strings to a const pointer.
svn path=/trunk/; revision=25582
2008-06-24 18:22:26 +00:00
Anders Broman 2640b786f4 Fix run checkapi for more targets.
svn path=/trunk/; revision=25414
2008-06-03 05:35:19 +00:00
Stig Bjørlykke ee8b8b0ad7 Hmmm. Second try to fix the const problems.
svn path=/trunk/; revision=24238
2008-01-31 23:10:09 +00:00
Gerald Combs 9703c2bb75 If "!=" or "ne" are used in a display filter, warn the user that the results
may be unexpected.

svn path=/trunk/; revision=24232
2008-01-31 19:50:38 +00:00
Bill Meier b436aeaf5f From Didier Gautheron: Bug #2042: Move constants initialisation at compile time.
svn path=/trunk/; revision=23659
2007-11-28 22:44:37 +00:00
Anders Broman 377793fc54 Apply yet another set of the optimization patches:
small memory leak when freeing compiled filter insns.

svn path=/trunk/; revision=23408
2007-11-09 05:54:16 +00:00
Guy Harris 1bc049906a Add some GCC warnings to the standard set, and add some others to the
--enable-extra-gcc-checks set.

If we turn on -pedantic, try turning on -Wno-long-long as well, so that
it's not *so* pedantic that it rejects the 64-bit integral data types
that we explicitly require.

Constify a bunch of stuff, and make some other changes, to get rid of
warnings.

Clean up some indentation.

svn path=/trunk/; revision=21526
2007-04-23 10:59:26 +00:00
Luis Ontanon 6a4a51ffec The UAT gui starts to work
set the macros_dlg to use it

add a dummy dfilter_macros file to supress a warning at startup


svn path=/trunk/; revision=20598
2007-01-29 10:23:38 +00:00
Luis Ontanon 8e849698a3 Drop dfilter_macro_load.l as dfilter-macro now uses UAT
svn path=/trunk/; revision=20596
2007-01-29 04:57:23 +00:00
Luis Ontanon 80dcfb23d2 display filter macros.
NOT to be copied over to release 0.99.5


svn path=/trunk/; revision=20467
2007-01-18 02:54:56 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Jörg Mayer 96adc5f4a1 - Include the .h files in their .c files.
- Remove epan/dissectors/packet-sna.h, it isn't used anywhere.

svn path=/trunk/; revision=15475
2005-08-20 16:19:22 +00:00
Ulf Lamping 994496a184 several times replacing:
sprintf -> g_snprintf
snprintf -> g_snprintf
vsnprintf -> g_vsnprintf
strdup -> g_strdup

svn path=/trunk/; revision=15412
2005-08-18 19:31:15 +00:00
Ulf Lamping 0dc9fb3d4a various code cleanup:
-use g_snprintf instead of sprintf and snprintf
-use g_strdup_printf where appropriate
-remove #include "snprintf.h" (as only g_snprintf should be used)
-replace some more alloc/realloc/calloc/free with their glib pendants

svn path=/trunk/; revision=15264
2005-08-08 18:50:39 +00:00
Jörg Mayer c5ab5374c2 Some more 'char*' -> 'const char*' changes
svn path=/trunk/; revision=15013
2005-07-23 06:53:59 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
they have LF at the end of the line on UN*X and CR/LF on Windows;
hopefully this means that if a CR/LF version is checked in on Windows,
the CRs will be stripped so that they show up only when checked out on
Windows, not on UN*X.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Guy Harris 7e128ddeb3 Note that the reason why there's parser state that stays around after
the parse finishes (forcing us to feed the parser an end-of-input even
after an error) is that we don't create a new parser object when we
start a new parse and don't destroy it when the parse finishes.

svn path=/trunk/; revision=11156
2004-06-16 07:33:46 +00:00
Guy Harris 95391789a3 From Graeme Hewson:
Add a #define to enable parser tracing.

	Clean up parser state when finished parsing, even if we stopped
	parsing due to a syntax error, so that there's nothing left
	around to screw up the next parse.

svn path=/trunk/; revision=11152
2004-06-15 10:38:14 +00:00
Ulf Lamping 37fc156dc6 removed unused things
svn path=/trunk/; revision=10740
2004-04-30 06:56:15 +00:00
Guy Harris 60096bfad9 Use -1 rather than 0 as the SCAN_FAILED return value from the lexical
analyzer on errors, and check for SCAN_FAILED from the lexical analyzer
and abort the parse if we see it; 0 means "end of input", and we want to
distinguish errors from end-of-input, so that we can report errors as
such.

If we see end-of-input while parsing a double-quoted string, report the
error (missing closing quote).

Fix the URL for the "Start conditions" section of the Flex manual.

svn path=/trunk/; revision=10044
2004-02-11 22:52:54 +00:00
Guy Harris cfa04730cf "dfilter_compile()" doesn't modify the string pointed to by its first
argument; make it a const pointer.

svn path=/trunk/; revision=6724
2002-12-02 23:28:16 +00:00
Gilbert Ramirez 1ba73660c0 Make the dfilter code support multiple header_field_info's with
the same name (abbreviation). Thus, if multiple protocols or fields
are registered with the same name, you can still filter on the name
and have the filtering work as expected.

svn path=/trunk/; revision=6434
2002-10-16 16:32:59 +00:00
Guy Harris ac69a72fda "dfilter_prime_proto_tree()" doesn't modify the "dfilter_t" to which
it's handed a pointer, which means that "epan_dissect_prime_dfilter()"
doesn't do so either; make that argument a "const dfilter_t *" in both
cases.

svn path=/trunk/; revision=6239
2002-09-09 21:04:15 +00:00
Jörg Mayer 48be4e530d Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6116
2002-08-28 20:41:00 +00:00
Gilbert Ramirez 41cc7f0707 Merge the work in Novell_NCP_branch into the mainline code.
A little work still needs to be done on the new NCP dissector -- make
some of the COL_INFO texts more useful, handle a Unicode issue, and
modify some of the cases that use "request conditions".
But the NCP dissector as it stands is very usable now.

Note: I didn't merge in the PROTO_LENGTH_UNTIL_END macro... I wanted
to think about the various possible macros and review an email conversation
I had with Guy on the subject.

svn path=/trunk/; revision=5432
2002-05-09 23:50:34 +00:00
Guy Harris 30f02bc99c Move the code to build the balanced tree of fields into "proto_init()",
move the code from "dfilter_lookup_token()" into
"proto_registrar_get_byname()", and get rid of "dfilter_lookup_token()"
and have its callers call "proto_registrar_get_byname()" instead.

svn path=/trunk/; revision=5287
2002-04-29 07:55:32 +00:00
Gilbert Ramirez bf43b509f0 Make some variables and functions static.
svn path=/trunk/; revision=5129
2002-04-08 20:11:31 +00:00
Guy Harris ee5ca25d31 Include files from the "epan" directory and subdirectories thereof with
"epan/..." pathnames, so as to avoid collisions with header files in any
of the directories in which we look (e.g., "proto.h", as some other
package has its own "proto.h" file which it installs in the top-level
include directory).

Don't add "-I" flags to search "epan", as that's no longer necessary
(and we want includes of "epan" headers to fail if the "epan/" is left
out, so that we don't re-introduce includes lacking "epan/").

svn path=/trunk/; revision=4586
2002-01-21 07:37:49 +00:00