Passing a Table to the policy engine

Vern Paxson vern at icir.org
Thu Apr 1 12:17:57 PST 2004


> I tried doing this in my myfile.cc file:
> 
> 	int pathArr[100];
> 	val_list* vl = new val_list;
> 	...
> 	TableVal* myPath = new TableVal(internal_type("count")->AsTableType());
> 	for ( int i=0; i < 100; i++ ) {
> 		myPath->Assign(new Val(i, TYPE_INT), new Val(pathArr[i], TYPE_INT));
> 	}
> 	updaterec->Assign(1, myPath);
> 	vl->append(updaterec);
> 	mgr.QueueEvent(update, vl, Event::LOCAL, this);
> 
> but I beleve that my TableVal* myPath assigmnet is incorrect, as it
> does not recognize "count" as a type when i run it.

You have the right idea.  Two problems I see are: (1) you should use
TYPE_COUNT rather than TYPE_INT (count is unsigned, int is signed), though
that shouldn't matter in practice; (2) I don't understand the line:

	updaterec->Assign(1, myPath);

What is updaterec and why are you assigning element 1 rather than element 0?

		Vern



More information about the Bro mailing list