Paper

Saturday, March 27, 2010

Wireless MAC trace format

You could do as following steps:

1. Modify mac-802.11.cc

1.1 Mac802_11::sendCTS(int dst, double rts_duration)
{
Packet *p = Packet::alloc();
hdr_cmn* ch = HDR_CMN(p);
struct cts_frame *cf = (struct cts_frame*)p->access(hdr_mac::offset_);

assert(pktCTRL_ == 0);

ch->uid() = 0;
ch->ptype() = PT_MAC_CTS; ##### modify
ch->size() = ETHER_CTS_LEN;
ch->iface() = -2;
ch->error() = 0;
....
}
1.2 Mac802_11::sendRTS(int dst, double rts_duration)
1.2 Mac802_11::sendACK(int dst, double rts_duration)

2. Modify packet.h

enum packet_t {
....
/* CMU/Monarch's extnsions */
PT_ARP,
PT_MAC,
PT_MAC_RTS,
PT_MAC_CTS,
PT_MAC_ACK,
PT_MAC_CTRL,
....
}

class p_info {
....

name_[PT_ARP]= "ARP";
name_[PT_MAC]= "MAC";
name_[PT_MAC_RTS]= "MAC_RTS";
name_[PT_MAC_CTS]= "MAC_CTS";
name_[PT_MAC_ACK]= "MAC_ACK";
name_[PT_MAC_CTRL]= "MAC_CTRL";
}


3. modify cmu-tracc.cc

void CMUTrace::format(Packet* p, const char *why)
{
hdr_cmn *ch = HDR_CMN(p);
int offset = 0;

/*
* Log the MAC Header
*/
format_mac(p, why, offset);

if (namChan_)
nam_format(p, offset);
offset = strlen(wrk_);
switch(ch->ptype()) {
case PT_MAC:
case PT_MAC_RTS:
case PT_MAC_CTS:
case PT_MAC_ACK:
case PT_MAC_CTRL:
...
}

4.make clean,  make

5. Test it, the trace would look like below example.
So now you can distinguist mac packets


r 1199.980118388 _5_ MAC  --- 0 MAC_ACK 38 [0 2 0 0]
r 1199.980152 2 5 udp 72 ------- 0 1.0.0.0 3.0.0.0 0 122607
s 1199.980608388 _5_ MAC  --- 0 MAC_RTS 44 [38e 1a 2 0]
r 1199.980784727 _29_ MAC  --- 0 MAC_RTS 44 [38e 1a 2 0]
s 1199.980794727 _29_ MAC  --- 0 MAC_CTS 38 [2ec 2 0 0]
r 1199.980947065 _5_ MAC  --- 0 MAC_CTS 38 [2ec 2 0 0]
s 1199.980997065 _5_ MAC  --- 122607 udp 144 [a2 1a 2 800] ------- 0 [3.0.0.0 1.0.10.0 32 4194314]
r 1199.981573404 _29_ MAC  --- 122607 udp 92 [a2 1a 2 800] ------- 0 [3.0.0.0 1.0.10.0 32 4194314]
s 1199.981583404 _29_ MAC  --- 0 MAC_ACK 38 [0 2 0 0]
r 1199.981735743 _5_ MAC  ---

No comments:

Post a Comment