Ethereal-dev: Re: [Ethereal-dev] Questions on dfilter processing

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gilbert Ramirez <gram@xxxxxxxxxxxxxxx>
Date: Tue, 09 Dec 2003 21:42:03 -0000
On Mon, 2003-12-08 at 15:15, Biot Olivier wrote:
> Hi List,
> 
> I have some doubts/questions on how the dfilter processing works (maybe I
> don't get all the items right). I added debug logging in
> epan/dfilter/semcheck.c and I realized that dfw_semcheck() is called for
> every header field when a dfilter is evaluated.

It shouldn't be. dfw_semcheck() should only be called once, during the
compilation of the dfilter string into a dfvm array. Can you give more
detail if indeed you are seeing it called more than once?

> Now, I intend to compile and analyze the PCRE regular expression only once
> for every matches operator in a dfilter expression, by adding the following
> code to the check_relation_LHS_FIELD() function:
> 
> 	else if (type2 == STTYPE_STRING) {
> 		s = stnode_data(st_arg2);
> 		if (strcmp(relation_string, "matches") == 0) {

The relation_string was put there really for reporting purposes. If you
want to compare against it, you might consider using an enum value for
quicker comparisons.


> 
> BUT... I fear that the conversion from a string to a FT_PCRE happens more
> than once. Is my assumption correct, or (hopefully) not?
> 

I hope not. It should not be happening more than once.

--gilbert