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.

$ll_ set delay_ $delay$ll_ set b<strong>and</strong>width_ $bw$ll_ sendtarget $mac$ll_ recvtarget $iif. . .# per LAN# link-level overhead# b<strong>and</strong>width# interface queue <strong>at</strong> the sender side# input interface of the receiver14.7 LanRouterclassBy default, there is just one LanRouter object per LAN, which is cre<strong>at</strong>ed when a new LanNode is initialized. For everynode on the LAN, the link layer object (LL) has a pointer to the LanRouter, so it is able to find the next hop for the packetth<strong>at</strong> is sent on the LAN:Packet* LL::sendto(Packet* p, H<strong>and</strong>ler* h){int nh = (lanrouter_) ? lanrouter_->next_hop(p) : -1;. . .}LanRouter is able to find the next hop by querying the current RouteLogic:int LanRouter::next_hop(Packet *p) {int next_hopIP;if (enableHrouting_) {routelogic_->lookup_hier(lanaddr_, adst, next_hopIP);} else {routelogic_->lookup_fl<strong>at</strong>(lanaddr_, adst, next_hopIP);}One limit<strong>at</strong>ion of this is th<strong>at</strong> RouteLogic may not be aware of dynamic changes to the routing. But it is always possible toderive a new class from LanRouter so th<strong>at</strong> to re–define its next_hop method to h<strong>and</strong>le dynamic changes appopri<strong>at</strong>ely.14.8 Other ComponentsIn addition to the C++ components described above, simul<strong>at</strong>ing local area networks also requires a number of existing componentsin <strong>ns</strong> such as Classifier, Queue, <strong>and</strong> Trace, networkinterface, etc. Configuring these objects requiresknowledge of wh<strong>at</strong> the user wants to simul<strong>at</strong>e. <strong>The</strong> default configur<strong>at</strong>ion is implemented in the two Tcl files mentioned <strong>at</strong> thebeginning of this chapter. To obtain more realistic simul<strong>at</strong>io<strong>ns</strong> of wireless networks, one can use the ErrorModel describedin Chapter 13.14.9 LANs <strong>and</strong> <strong>ns</strong> routingWhen a LAN is cre<strong>at</strong>ed using either make-lan or newLan, a “virtual LAN node” LanNode is cre<strong>at</strong>ed. LanNode keepstogether all shared objects on the LAN: Channel, Classifier/Mac, <strong>and</strong> LanRouter. <strong>The</strong>n for each node on the LAN,138

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

Saved successfully!

Ooh no, something went wrong!