[Bro] Defining a table inside a record

Vern Paxson vern at icir.org
Thu Oct 12 22:54:53 PDT 2006


> Am I doing something wrong?

It's subtle, but the problem is that this:

	local curr_info: temp_info;

assigns a record value to curr_info but one that *doesn't have any of the
fields initialized*.  It's the same as if you had a field "foo: double"
in the record - you couldn't then access temp_info$foo in an expression
because it hasn't yet been assigned.

The following will fix the problem.  Change:

	...
	local curr_info: temp_info;
	curr_info$temp_table[1] = "abhinay";
	...

to

	...
	local curr_info: temp_info;
	local table_val_for_record : table[count] of string;
	curr_info$temp_table = table_val_for_record;
	curr_info$temp_table[1] = "abhinay";
	...

> Also, the ref-manual mentions that we should use "* expr" for doing a deep
> copy. I get an error when I try to do so. What is the correct syntax for
> doing a deep copy.

Argh, that's out-of-date (where in the manual do you see it?).  Instead
use "copy(expr)".

		Vern



More information about the Bro mailing list