aboutsummaryrefslogtreecommitdiffstats
path: root/dfilter-int.h
AgeCommit message (Collapse)AuthorFilesLines
2000-08-01Allow filtering on strings.Gilbert Ramirez1-1/+4
svn path=/trunk/; revision=2193
2000-07-22Simplify the way the display filter routines get field values fromGilbert Ramirez1-8/+11
the proto tree. Now, proto_get_finfo_ptr_array() can easily be used by any routine, not just display filter code, to get values from the proto tree. This might be useful if one were to allow columns in the packet list to show the value of an arbitrary field. Fixed a memleak when filtering on a byte arrays. Fixed erroneous asserts in dfilter-grammar.y, where I used '=' instead of '=='. They had to do with byte-arrays, too. svn path=/trunk/; revision=2152
1999-11-15Add "class" that understands IPv4 addresses and subnet masks.Gilbert Ramirez1-2/+10
We now store IPv4 addresses in host order, allowing non-equivalence comparisons. That is, display filters with lt, le, gt, and ge will work on big-endian and little-endian machines. CIDR notation is now supported for IPv4 addresses in display filters. You can test to see if an IPv4 address is on a certain subnet by using this notation. For example, to test for IPv4 packets on a Class-C network: ip.addr == 192.168.1.0/24 svn path=/trunk/; revision=1032
1999-10-19Enable display filtering on FT_DOUBLE fields.Gilbert Ramirez1-1/+6
svn path=/trunk/; revision=886
1999-10-11- add handling of FT_IPv6 variablesLaurent Deniel1-1/+6
there is still some work to do in resolv.c (get_host_ipaddr6) - add display filters of this kind in packet-ipv6.c just for testing (display filtering is incomplete) svn path=/trunk/; revision=808
1999-10-11When a new display filter is to be applied, don't set "cf.dfilter" orGuy Harris1-2/+1
"cf.dfcode" if the new filter doesn't compile, because the filter currently in effect will be the one that was last applied - just free up the text of the new filter, and whatever memory was allocated for the new filter code. This means we allocate a new dfilter when a new filter is to be applied, rather than recycling stuff from the old filter, as we want the old filter code to remain around if the new filter doesn't compile. This means that "cf.dfilter" and "cf.dfcode" will be null if there's no filter in effect. svn path=/trunk/; revision=803
1999-10-11Have "get_host_ipaddr()" return a Boolean indicating whether itGuy Harris1-3/+12
succeeded or failed, and, if it succeeded, have it fill in the IP address if found through a pointer passed as the second argument. Have it first try interpreting its first argument as a dotted-quad IP address, with "inet_aton()", and, if that fails, have it try to interpret it as a host name with "gethostbyname()"; don't bother with "gethostbyaddr()", as we should be allowed to filter on IP addresses even if there's no host name associated with them (there's no guarantee that "gethostbyaddr()" will succeed if handed an IP address with no corresponding name - and it looks as if FreeBSD 3.2, at least, may not succeed in that case). Add a "dfilter_fail()" routine that takes "printf()"-like arguments and uses them to set an error message for the parse; doing so means that even if the filter expression is syntactically valid, we treat it as being invalid. (Is there a better way to force a parse to fail from arbitrary places in routines called by the parser?) Use that routine in the lexical analyzer. If that error message was set, use it as is as the failure message, rather than adding "Unable to parse filter string XXX" to it. Have the code to handle IP addresses and host names in display filters check whether "get_host_ipaddr()" succeeded or failed and, if it failed, arrange that the parse fail with an error message indicating the source of the problem. svn path=/trunk/; revision=802
1999-10-10The #defines to turn "yy{lex,error}" into names specific to theGuy Harris1-15/+3
parser/lexical analyzer in question are needed only in the ".c" files for the generated parser and lexical analyzer, and Flex and Byacc/Bison put them there; don't bother putting them in a header file, just directly declare the functions with the right names. svn path=/trunk/; revision=801
1999-10-07Make "dfilter_error()" available to the lexical analyzer.Guy Harris1-2/+16
Get rid of the declaration of the non-existent "dfilter_yyerror()", and put in some #defines to work around the fact that the #defines to replace "yy" with "dfilter_" in the names of Flex-generated and Yacc-generated routines aren't put into a header file, they're put into ".c" files. Have it remember the error message it was handed (unless it's Yacc's boring "parse error" message). When generating the message to be shown to the user on a parse error, make it be the "Unable to parse filter string" message, and, if a non-boring error message was supplied to "dfilter_error()", take that error message onto the end. Don't panic if a field type we don't yet support in the parser is seen; generate an error, telling the user we don't support filter on that type yet. Don't assume that "global_df" has been set if we see an empty statement (if the first token was the end-marker, because, say, the first token the lexical analyzer found was a field of a type not yet supported in filter expressions, "global_df" won't have been set). svn path=/trunk/; revision=783
1999-08-30Now that FT_BOOLEAN display filter fields are treated differently (onlyGilbert Ramirez1-5/+1
their existence is checked), some FT_BOOLEAN-related functions in dfilter.c are no longer called. So I removed them. svn path=/trunk/; revision=611
1999-08-26The dfilter yacc grammar now keeps track of every GNode that it allocates.Gilbert Ramirez1-1/+2
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-13Moved global memory alloction used in display filters (which was storedGilbert Ramirez1-2/+8
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-12Create a "dfilter-int.h" file, containing stuff used internally to theGuy Harris1-0/+108
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