|
From: Martijn K. <mk...@wi...> - 2003-12-15 18:25:00
|
Hi,
I am working on the enw sniffing framework and thought I would share
some of its functions with you.
enum { NORMAL =3D 0,
TEST =3D 1,
WARNING =3D 1 << 2,
ERRORS =3D 1 << 3,
ASSERT =3D 1 << 4};
When you use the new printf command to print there are several options
for its priority.
Test - will be printed to the logfile and simulation continues
Warning - will be printed to the logfile and simulation continues
Error - will be printed to the logfile and simulation is stopped
Assert - will be printed to the logfile and you will be asked if you
want to continue or not
The simulator will have a new commandline parameter that influences what
info is to be printed.
-dn, where n is a number in [0;31], where it switches on some of the
messages
We will also write a small shell-script that will crossreference the log
file and the sniffer file. I was thinking about something like
xref [-s] file1.snf file2.log=20
where the output goes to standard out.
The -s option will give the logfile added with the 5 lines of
snf-actions before and 5 lines of snf-action after it. This would
prevent you from going to large files.
Now a bit about sniffing...
You still have to derive the object you want to sniff from a class
(currently snifline). You can then control the sniffing from the
scenario file (you have to add some code, which will convert the
commands from the scn-file into booleans to sniff). Standard there are
up to 16 different messages that can be sniffed (or 16 different groups
to sniff). If you need more you can add some extra code and extend this
in your class).
The line you use to sniff is like a printf-line, so you have more
freedom how to print your message. The sniffer-class will add the time
for you.
wsPrint(Mac802_11::Data,"MAC %s data frame",mMacAddress->Print());
Mac802_11::Data is one of the groups you can switch on to sniff...
You can also use dbgPrint to add messages to the log-file, but these
cannot be controlled from the scn-file and cannot be used for printing
to the snf-file. This one works like
dbgPrint(DBG::Error,"Some strange error in %s due to code from NOT
ME!!!",mName);
Where the DBG:Error is one of the aforementioned commands.
/Martijn
|