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 ...

nmlab.korea.ac.kr
from nmlab.korea.ac.kr More from this publisher
12.07.2015 Views

place_receiver n addr C nb creates and places a PLM receiver at node n and attached it to the source which returnthe address addr. The check value for this PLM receiver is C. An optional parameter nb allows to get an instanceof the PLM receiver called PLMrcvr($nb). This instance is only useful to get some specific statistics about thisreceiver (mainly the number of packets received or lost).37.2 The Packet Pair Source GeneratorThis section describes the Packet Pair source generator; the relevant files are: ~ns/plm/cbr-traffic-PP.cc, ~ns/tcl/lib/nsdefault.tcl.The OTcl class name of the PP source is: Application/Traffic/CBR_PP. The Packet Pair (PP) source generatoris in the file ~ns/plm/cbr-traffic-PP.cc. This source generator is a variation of the CBR source generator in ~ns/cbr_traffic.cc.We just describe the salient differences between the code of the CBR source and the code of the PP source. The default valuesin ~ns/tcl/lib/ns-default.tcl for the PP source generator are the same than for the CBR source. We need for the PP sourcegenerator a new parameter PBM_:Application/Traffic/CBR_PP set PBM_ 2;#Default valueThe OTcl instvar bounded variable PBM_ (same name in C++ and in OTcl) specifies the number of back-to-back packets tobe sent. For PBM_=1 we have a CBR source, for PBM_=2 we have a Packet Pair source (a source which sends two packetsback-to-back), etc. The mean rate of the PP source is rate_, but the packets are sent in burst of PBM_ packets. Note that wealso use the terminology Packet Pair source and Packet Pair burst for PBM_>2. We compute the next_interval as:double CBR_PP_Traffic::next_interval(int& size)/*(PP_ - 1) is the number of packets in the current burst.*/if (PP_ >= (PBM_ - 1))interval_ = PBM_*(double)(size_ sendmsg(size_, "NEW_BURST");elseagent_->sendmsg(size_);...325

37.3 Architecture of the PLM ProtocolThe code of the PLM protocol is divided in three files: ~ns/tcl/plm/plm.tcl, which contains the PLM protocol machinerywithout any specific interface with ns; ~ns/tcl/plm/plm-ns.tcl, which contains the specific ns interface. However, we do notguarantee the strict validity of this ns interfacing; ~ns/tcl/plm/plm-topo.tcl, which contains a user interface to build simulationscenarios with PLM flows.In the following we do not discuss the various procedures per object (for instance all the instproc of the PLM class) but ratherper functionality (for instance which instproc among the various classes are involved in the instantiation of a PLM receiver).For a given functionality, we do not describe in details all the code involved, but we give the principal steps.37.3.1 Instantiation of a PLM SourceTo create a PLM source, place it at node n, and start it at t 0 , we call the PLMTopology instproc place_source n t 0 .This instproc return addr, the address required to attach a receiver to this source. place_source calls the Simulatorinstproc PLMbuild_source_set that creates as many Application/Traffic/CBR_PP instances as there are layers (in thefollowing we call an instance of the class Application/Traffic/CBR_PP a layer). Each layer corresponds to a different multicastgroup.To speed up the simulations when the PLM sources start we use the following trick: At t = 0, PLMbuild_source_setrestricts each layer to send only one packet (maxpkts_ set to 1). That allows to build the multicast trees – one multicast treeper layer – without flooding the whole network. Indeed, each layer only sends one packet to build the corresponding multicasttree.The multicast trees take at most the maximum RTT of the network to be established and must be established before t 0 ,the PLM source starting time. Therefore, t 0 must be carrefully chosen, otherwise the source sends a large number of uselesspackets. However, as we just need to start the PLM source after the multicast trees are estabished, t 0 can be largelyoverestimated. At time t 0 , we set maxpkts_ to 268435456 for all the layers.It is fundamental, in order to have persistent multicast trees, that the prune timeout is set to a large value. For instance, withDM routing:DM set PruneTimeout 1000Each layer of a same PLM source has the same flow id fid_. Consequently, each PLM source is considered as a single flowfor a Fair Queueing scheduler. The PLM code manages automatically the fid_ to prevent different sources to have the samefid_. The fid_ starts at 1 for the first source and is increased by one for each new source. Be careful to avoid other flows(for instance concurrent TCP flows) to have the same fid_ than the PLM sources. Additionally, If you consider fid_ largerthan 32, do not forget to increase the MAXFLOW in ~ns/fq.cc (MAXFLOW must be set to the highest fid_ considered in thesimulation).37.3.2 Instantiation of a PLM ReceiverAll the PLM machinery is implemented at the receiver. In this section we decribe the instantiation process of a receiver. To create,place at node n, attach to source S, and start at t 1 a PLM receiver we call the PLMTopology instproc build_receivern addr t 1 C where addr is the address returned by place_source when S was created, and C is the check value. Thereceiver created by build_receiver is an instance of the class PLM/ns, the ns interface to the PLM machinery. Atthe initialisation of the receiver, the PLM instproc init is called due to inheritance. init calls the PLM/ns instproc326

place_receiver n addr C nb cre<strong>at</strong>es <strong>and</strong> places a PLM receiver <strong>at</strong> node n <strong>and</strong> <strong>at</strong>tached it to the source which returnthe address addr. <strong>The</strong> check value for this PLM receiver is C. An optional parameter nb allows to get an i<strong>ns</strong>tanceof the PLM receiver called PLMrcvr($nb). This i<strong>ns</strong>tance is only useful to get some specific st<strong>at</strong>istics about thisreceiver (mainly the number of packets received or lost).37.2 <strong>The</strong> Packet Pair Source Gener<strong>at</strong>orThis section describes the Packet Pair source gener<strong>at</strong>or; the relevant files are: ~<strong>ns</strong>/plm/cbr-traffic-PP.cc, ~<strong>ns</strong>/tcl/lib/<strong>ns</strong>default.tcl.<strong>The</strong> OTcl class name of the PP source is: Applic<strong>at</strong>ion/Traffic/CBR_PP. <strong>The</strong> Packet Pair (PP) source gener<strong>at</strong>oris in the file ~<strong>ns</strong>/plm/cbr-traffic-PP.cc. This source gener<strong>at</strong>or is a vari<strong>at</strong>ion of the CBR source gener<strong>at</strong>or in ~<strong>ns</strong>/cbr_traffic.cc.We just describe the salient differences between the code of the CBR source <strong>and</strong> the code of the PP source. <strong>The</strong> default valuesin ~<strong>ns</strong>/tcl/lib/<strong>ns</strong>-default.tcl for the PP source gener<strong>at</strong>or are the same than for the CBR source. We need for the PP sourcegener<strong>at</strong>or a new parameter PBM_:Applic<strong>at</strong>ion/Traffic/CBR_PP set PBM_ 2;#Default value<strong>The</strong> OTcl i<strong>ns</strong>tvar bounded variable PBM_ (same name in C++ <strong>and</strong> in OTcl) specifies the number of back-to-back packets tobe sent. For PBM_=1 we have a CBR source, for PBM_=2 we have a Packet Pair source (a source which sends two packetsback-to-back), etc. <strong>The</strong> mean r<strong>at</strong>e of the PP source is r<strong>at</strong>e_, but the packets are sent in burst of PBM_ packets. Note th<strong>at</strong> wealso use the terminology Packet Pair source <strong>and</strong> Packet Pair burst for PBM_>2. We compute the next_interval as:double CBR_PP_Traffic::next_interval(int& size)/*(PP_ - 1) is the number of packets in the current burst.*/if (PP_ >= (PBM_ - 1))interval_ = PBM_*(double)(size_ sendmsg(size_, "NEW_BURST");elseagent_->sendmsg(size_);...325

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

Saved successfully!

Ooh no, something went wrong!