Hello Everybody,
I tried to figure out, how to generate a trace file at the Mac layer.
I'd like to see MAC level information for received and transmitted packets!
I tried the following:
Entry at mac-802_11.h
Trace *trace_mac_;
Entry at mac-802_11.cc
Mac802_11::command(int argc, const char*const* argv)
{
if (argc == 3) {
if (strcmp (argv[1], "log-target-mac") == 0) {
trace_mac_ = (Trace *) TclObject::lookup (argv[2]);
if (trace_mac_ == 0)
return TCL_ERROR;
return TCL_OK;
}
}
}
And write to the trace file:
if (trace_mac_){
sprintf (trace_mac_->pt_->buffer (), "%f %f",
Scheduler::instance().clock(), dataRate_);
trace_mac_->pt_->dump ();
}
Entry at sim.tcl
At the TCL-file I generated the instance procedure
set mactracefile [open mac.tr w]
Mac/802_11 instproc statstrace { tracefd } {
set T [new Trace/Generic]
$T target [[Simulator instance] set nullAgent_]
$T attach $tracefd
$T set src_ [$self set addr_]
$self log-target-mac $T
}
#call the function statstrace and hand over the link to the trace file.
Mac/802_11 statstrace $mactracefile
To generate a new Trace object and allocate the Trace object to a trace file
$tracefd.
But when i run my simulation file, i got serveral error messages.
Can somebody help me with that problem ?
Thanks a lot,
HB
--
View this message in context:
http://www.nabble.com/MAC-level-Trace-File-generation-tf3851688.html#a10911000
Sent from the ns-users mailing list archive at Nabble.com.