[ns] MAC trace format prob :

marceau coupechoux marceau.coupechoux@alcatel.fr
Tue Oct 22 05:17:58 2002


Hi,

In the function sendRTS, before pktRTS_=p, you have to write:
ch->ptype()=PT_MAC;
type=ETHERTYPE_RTS;
STORE2BYTE(&type,dh->dh_body);
I think that you have nothing to add in cmu-trace.cc
In my ns-2.1b7, it works,
bye,

Marceau

Shilpa Muniswamyreddy wrote:
> 
> Hi all,
> i am new to ns. I am trying to do some simulation with
> mac 802.11. I am having a problem with the trace file
> generated with the wireless simulation. I want to
> trace the RTS/CTS packets in the trace. From the
> mailing archive, a solution to this was given(as shown
> below). I incorporated the necessary changes, but it
> does not seem to work.
> 
> There was another suggestion, to add this at the
> appropriate in mac-802_11.cc
> 
> int ethertype=ETHERTYPE_RTS;
> STORE2BYTE(...);
> 
> i am not sure where to include this. Would this make a
> difference.
> I am not sure where I am going wrong. Can anyone help
> me? I would appreciate any help in this matter.
> 
> Shilpa
> 
> --- marceau coupechoux <marceau.coupechoux@alcatel.fr>
> wrote:
> >
> > Hi,
> >
> > in mac-802_11.cc, you have to add at the appropriate
> > places:
> >
> > int ethertype = ETHERTYPE_RTS;
> > STORE2BYTE(&ethertype, dh->dh_body);
> >
> > Marceau
> >
> > f1999127@bits-pilani.ac.in wrote:
> > >
> > > Hello,
> > >
> > > I have trouble making the changes in the .cc and
> > .h files so that my trace
> > > output would give me a explicit listing of the
> > cts/rts packets being
> > > passed around.
> > >
> > > I was given a suggestion asking me to incorporate
> > a few changes in the .h
> > > and .c files :
> > >
> > > 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        (works only on unix ??)
> > >
> > > ????????????????????????
> > >
> > > 5. Test it, the trace would look like below
> > example. So now you can
> > > distinguish mac packets.
> > >
> > > I use ns on a windows platform .Can someone please
> > tell me how and from
> > > where to do the command equivalent to step 4 . Do
> > I just change the above
> > > mentioned files, save the changes and simulate  -
> > would the trace file
> > > give me the required output or do I have to give a
> > few  more commands that
> > > work on these.cc and .h files at the command
> > prompt c:/ns-2.1b8> where I
> > > have all my scripts and ns and all other relevant
> > files.
> > >
> > > Someone please help . I am sorry for bothering you
> > with these simple
> > > questions about working on platforms but I am
> > unable to find other sources
> > > of help.
> > >
> > > Someone please respond.
> > > Thanks.
> > >
> > > Kavitha
> >
> > --
> > Marceau Coupechoux
> > --------------------------------------
> > Institut Eurecom
> > Département Communications Mobiles
> >
> > Alcatel CIT Recherche et Innovation
> > Département Radio (UTR)
> >
> > Route de Nozay 91460 Marcoussis France
> > tel : 01 69 63 43 59 fax : 43 60
> > mel : marceau.coupechoux@ms.alcatel.fr
> > --------------------------------------
> >
> 
> __________________________________________________
> Do you Yahoo!?
> Y! Web Hosting - Let the expert host your web site
> http://webhosting.yahoo.com/

-- 
Marceau Coupechoux
--------------------------------------
Institut Eurecom
Département Communications Mobiles

Alcatel CIT Recherche et Innovation
Département Radio (UTR)

Route de Nozay 91460 Marcoussis France
tel : 01 69 63 43 59 fax : 43 60
mel : marceau.coupechoux@ms.alcatel.fr
--------------------------------------