Commit Graph

16 Commits

Author SHA1 Message Date
Gilbert Ramirez ae356ef145 The dfilter yacc grammar now keeps track of every GNode that it allocates.
After a bad parse, instead of leaking this memory, the memory used for
those GNodes is now freed.

Added some memory-freeing "cleanup" routines for the dfilter and proto_tree
modules, which are called right before ethereal exits. Maybe once we get
a complete set of cleanup routines, we'll be able to better check if
memory is leaking.

svn path=/trunk/; revision=582
1999-08-26 06:20:50 +00:00
Gilbert Ramirez 11b9a6e949 Correctly set global_df->dftree to NULL after a bad parse.
svn path=/trunk/; revision=581
1999-08-25 22:54:17 +00:00
Gilbert Ramirez b85bb70925 Changed some symbols inside parser, fixed default error message in
dfilter_compile, and removed debug printf that I left in match_selected.

svn path=/trunk/; revision=532
1999-08-20 21:19:28 +00:00
Guy Harris 0a25d2df5b Include "snprintf.h" if necessary, to squelch some "gcc -Wall"
complaints.

svn path=/trunk/; revision=531
1999-08-20 20:45:14 +00:00
Gilbert Ramirez f0e5afe7a9 Enabled error reporting for bad ETHER values in display filters. A new
global variable, dfilter_error_msg is now available, being NULL when there
was no error, or pointing to a string when an error occurred. The three
places that dfilter_compile() is called now use this global variable to
report the error message to the user. A default error message is put
in that string if no context-specific error message is available (since
I only have one context-specifici error message, namely, ETHER values,
that will be most of the time).

svn path=/trunk/; revision=530
1999-08-20 20:37:47 +00:00
Gilbert Ramirez 57198bc28f Made handling of byte strings in scanner and parser much simpler,
improving size of grammar and creating the possibility of dfilter_compile
reporting errors back to user. In this case, if an ETHER variable is
compared against a byte string that is not 6 bytes, an error condition is
flagged appropriately. I have not put in the code to conver that error flag
to a message to the user, but that's what I'm working on next.

Also, fixed sample debug session in README to show correct gdb prompt.

svn path=/trunk/; revision=522
1999-08-20 06:01:07 +00:00
Gilbert Ramirez 8030084e93 Modified YACC grammar to use non-yy symbols, to avoid conflicts with
libpcap's that were compiled with symbols beginning with 'yy'.

svn path=/trunk/; revision=487
1999-08-14 06:24:27 +00:00
Gilbert Ramirez ab6490398c Moved global memory alloction used in display filters (which was stored
in dfilter-grammar.y) to a new struct dfilter. Display filters now have
their own struct, rather than simply being GNode's. This allows multiple
display filters to exist at once, aiding John McDermott in his
work on colorization.

svn path=/trunk/; revision=480
1999-08-13 23:47:43 +00:00
Guy Harris a5acc58fe3 Create a "dfilter-int.h" file, containing stuff used internally to the
display filter code but not outside it (and not static to one of the
modules in the display filter code), with most of that stuff moved there
from "dfilter.h".

Add a declaration of "byte_str_to_guint8_array()" to "dfilter-int.h".

svn path=/trunk/; revision=479
1999-08-12 21:16:32 +00:00
Gilbert Ramirez 336b94f506 Fixed two bugs in display filter parsing.
1. Some IP addresses (like 0.0.0.0) would be interpreted as byte ranges.
2. Parens were being ignored.

Thanks to Guy for pointing these out to me.

svn path=/trunk/; revision=477
1999-08-12 15:10:48 +00:00
Gilbert Ramirez aebcf2eb32 Removed the "exists" keyword from the grammar. The name of a protocol or a
field by itself assumes you are checking for the existence of that protocol
or field.

Changed the format of the list of filterable fields in the man page.
Developers: run "./configure" so that your configure script will re-create
dfilter2pod from the new dfilter2pod.in

svn path=/trunk/; revision=426
1999-08-03 15:04:33 +00:00
Gilbert Ramirez b2f932c1db Changed the display filter scanner from GLIB's GScanner to lex. The code
as it standed depends on your lex being flex, but that only matters if you're
a developer. The distribution will include the dfilter-scanner.c file, so
that if the user doesn't modify dfilter-scanner.l, he won't need flex to
re-create the *.c file.

The new lex scanner gives me better syntax checking for ether addresses. I
thought I could get by using GScanner, but it simply wasn't powerful enough.

All operands have English-like abbreviations and C-like syntax:
and, && ; or, || ; eq, == ; ne, != ; , etc.

I removed the ETHER_VENDOR type in favor of letting the user use the [x:y]
notation:	ether.src[0:3] == 0:6:29 instead of ether.srcvendor == 00:06:29

I implemented the IPXNET field type; it had been there before, but was
not implemented. I chose to make it use integer values rather than byte
ranges, since an IPX Network is 4 bytes. So a display filter looks like this:
	ipx.srcnet == 0xc0a82c00
rather than this:
	ipx.srcnet == c0:a8:2c:00

I can supposrt the byte-range type IPXNET in the future, very trivially.

I still have more work to do on the parser though. It needs to check ranges
when extracting byte ranges ([x:y]) from packets. And I need to get rid
of those reduce/reduce errors from yacc!

svn path=/trunk/; revision=414
1999-08-01 04:28:20 +00:00
Guy Harris bb0eaf66b7 When you hit <Return> in the text entry box for the display filter,
apply the filter (if it isn't invalid).

Apply the filter by clearing the Clist that shows packet summary lines
and scanning through the list of all packets and adding to the Clist
those that match the filter.

Get rid of "if (dfilter_proto_tree)" test in "load_cap_file()";
"dfilter_proto_tree" is always FALSE, and all the test does is keep us
from doing a "gtk_clist_freeze()" of the packet list, and we don't want
to do that (we don't want the packet to be updated until we're done
reading in the file).

Get rid of "dfilter_proto_tree", as it's no longer used.

Move the test that checks whether the display filter matches the current
packet to "add_packet_to_packet_list()"; this allows us to run
"dissect_packet()" only once - if we have a display filter, we generate
the summary info *and* the protocol tree in the same call, using the
summary info to make the packet list item and the protocol tree when
checking the display filter.

In "dfilter_compile()", destroy "*p_dfcode" if it's not NULL, so we
don't leak memory.

svn path=/trunk/; revision=355
1999-07-11 08:40:52 +00:00
Gilbert Ramirez e578a22f4c Put the XOR logic in place, where previously I had left an inclusive-OR
place-holder. Also removed the printf() telling the world that the parser
found some punctuation.

svn path=/trunk/; revision=347
1999-07-08 03:35:30 +00:00
Guy Harris 856e356a7a "const"ifty some function arguments and structure members, and "#if 0"
out the declaration of a variable used only by "#if 0"ed out code, to
eliminate some compiler warnings.

svn path=/trunk/; revision=344
1999-07-07 23:54:13 +00:00
Gilbert Ramirez 07f42b5b31 Created a new protocol tree implementation and a new display filter
mechanism that is built into ethereal. Wiretap is now used to read all
file formats. Libpcap is used only for capturing.

svn path=/trunk/; revision=342
1999-07-07 22:52:57 +00:00