void CMUTrace::format_mac(Packet *p, const char *why, int offset)
{
struct hdr_cmn *ch = HDR_CMN(p);
......
} else if (newtrace_) {
sprintf(pt_->buffer() + offset,"-Ma %x -Md %x -Ms %x -Mt %s ",
mh->dh_duration,ETHER_ADDR(mh->dh_ra),ETHER_ADDR(mh->dh_ta),
((ch->ptype() == PT_MAC) ? (
(mh->dh_fc.fc_subtype == MAC_Subtype_RTS) ? "RTS" :
(mh->dh_fc.fc_subtype == MAC_Subtype_CTS) ? "CTS" :
(mh->dh_fc.fc_subtype == MAC_Subtype_ACK) ? "ACK" :
"UNKN"
) : packet_info.name(ch->ptype())));
} else {
...
Here is an exmaple NS2 trace file which displays the RTS/CTS/ACK information of MAC layer frame.
r -t 0.003583515 -Hs 0 -Hd -2 ... -Nl MAC -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt ACK
s -t 0.003853348 -Hs 8 -Hd -2 ...-Nl MAC -Nw --- -Ma 2ff -Md 0 -Ms 8 -Mt RTS
r -t 0.004125515 -Hs 0 -Hd -2 ... -Nl MAC -Nw --- -Ma 2ff -Md 0 -Ms 8 -Mt RTS
s -t 0.004135515 -Hs 0 -Hd -2 ... -Nl MAC -Nw --- -Ma 1fd -Md 8 -Ms 0 -Mt CTS
r -t 0.004383682 -Hs 8 -Hd -2 ... -Nl MAC -Nw --- -Ma 1fd -Md 8 -Ms 0 -Mt CTS
Sourced from http://www.cse.msu.edu/~wangbo1/ns2/nshowto7.html