12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

switch(ch->ptype()) {case PT_MAC:break;case PT_ARP:form<strong>at</strong>_arp(p, offset);break;default:form<strong>at</strong>_ip(p, offset);offset = strlen(wrk_);switch(ch->ptype()) {case PT_DSR:form<strong>at</strong>_dsr(p, offset);break;case PT_MESSAGE:case PT_UDP:form<strong>at</strong>_msg(p, offset);break;case PT_TCP:case PT_ACK:form<strong>at</strong>_tcp(p, offset);break;case PT_CBR:form<strong>at</strong>_rtp(p, offset);break;..........}}}<strong>The</strong> above function calls different form<strong>at</strong> functio<strong>ns</strong> depending on the type of the packet being traced. All traces are written tothe buffer wrk_. A count of the offset for the buffer is kept <strong>and</strong> is passed along the different trace functio<strong>ns</strong>. <strong>The</strong> most basicform<strong>at</strong> is defined by form<strong>at</strong>_mac() <strong>and</strong> is used to trace all pkt types. <strong>The</strong> other form<strong>at</strong> functio<strong>ns</strong> print additional inform<strong>at</strong>ionas defined by the packet types. <strong>The</strong> mac form<strong>at</strong> prints the following:#ifdef LOG_POSITIONdouble x = 0.0, y = 0.0, z = 0.0;node_->getLoc(&x, &y, &z);#endifsprintf(wrk_ + offset,#ifdef LOG_POSITION"%c %.9f %d (%6.2f %6.2f) %3s %4s %d %s %d [%x %x %x %x] ",#else"%c %.9f _%d_ %3s %4s %d %s %d [%x %x %x %x] ",156

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!