Commit Graph

45 Commits

Author SHA1 Message Date
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
Gilbert Ramirez 791f5774d0 Provide for per-protocol-tree data in the proto_tree code.
Put a hash-table of "interesting" fields in the per-proto-tree data.
The dfilter code records which fields/protocols are "interesting" (by which
I mean, their value or existence is checked). Thus, the proto_tree routines
can create special arrays of field_info*'s that are ready for the dfilter
engine to use during a filter operation.

Also store the "proto_tree_is_visible" boolean, renamed "visible", in
the per-proto-tree data.

Move epan_dissect_t to its own header file to make #include dependencies
easier to handle.

Provide epan_dissect_fill_in_columns(), which accepts just the epan_dissect_t*
as an argument.

epan_dissect_new() needs to be followed by epan_dissect_run() for the
dissection to actually take place. Between those two calls,
epan_dissect_prime_dfilter() can be run 0, 1, or multiple times in order to
prime the empty proto_tree with the "intersesting" fields from the dfilter_t.

svn path=/trunk/; revision=4422
2001-12-18 19:09:08 +00:00
Guy Harris f7b50ca754 From Joerg Mayer:
* gcc 3.0 warning fixes:
  - text2pcap.c: The number of characters to scan should probably not be 0
  - wiretap/csids.c: using preincrement on a variable used on both
    sides of an assignment might be undefined by the C99(?) standard
 * turn on additional warnings for epan and wiretap too
  - epan/configure.in
  - wiretap/configure.in
 * Fix some warnings (missing includes, signed/unsigned, missing
    initializers) found by turning on the warnings
  - all other files :-)

svn path=/trunk/; revision=3709
2001-07-13 00:55:58 +00:00
Guy Harris bea00e22cf In a display filter expression, make a field name refer to any of the
fields with that name.

svn path=/trunk/; revision=3030
2001-02-13 18:34:51 +00:00
Guy Harris 0196634a17 If there are multiple fields with the same name, list only one of them
in the output of "{ethereal,tethereal} -G", so that it appears only once
in the documentation.

Expand some comments to give more details.

svn path=/trunk/; revision=3024
2001-02-12 10:06:51 +00:00
Gilbert Ramirez 96e0398fc6 Grumble, grumble. I forgot to add the license comment at the top
of these files.

svn path=/trunk/; revision=2968
2001-02-01 20:31:21 +00:00
Gilbert Ramirez 8f1fff2e6a Create a more modular type system for the FT_* types. Put them
into epan/ftypes.

Re-write display filter routines using Lemon parser instead of yacc.
Besides using a different tool, the new grammar is much simpler, while
the display filter engine itself is more powerful and more easily extended.

Add dftest executable, to test display filter "bytecode" generation.
Add option to "configure" to build dftest or randpkt, both of which are not
built by default.

Implement Ed Warnicke's ideas about dranges in the new display filter and
ftype code.

Remove type FT_TEXT_ONLY in favor of FT_NONE, and have protocols registered
as FT_PROTOCOL. Thus, FT_NONE is used only for simple labels in the proto tree,
while FT_PROTOCOL is used for protocols. This was necessary for being
able to make byte slices (ranges) out of protocols, like "frame[0:3]"

Win32 Makefile.nmake's will be added tonight.

svn path=/trunk/; revision=2967
2001-02-01 20:21:25 +00:00