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 ...
Chapter 9Differentiated Services Module in nsNote: The Differentiated Services module described in this chapter has been integrated into ns-2.1b8.Differentiated Services, or DiffServ, is an IP QoS architecture based on packet marking that allows packets to be prioritizedaccording to user requirements. During the time of congestion, more low priority packets are discarded than high prioritypackets. This chapter describes the DiffServ module that was originally implemented by the Advanced IP Networks group inNortel Networks [28].9.1 OverviewThe DiffServ architecture provides QoS by dividing traffic into different categories, marking each packet with a code pointthat indicates its category, and scheduling packets according accordingly. The DiffServ module in nscan support four classesof traffic, each of which has three dropping precedences allowing differential treatment of traffic within a single class. Packetsin a single class of traffic are enqueued into one corresponding physical RED queue, which contains three virtual queues (onefor each drop precedence).Different RED parameters can be configured for virtual queues, causing packets from one virtual queue to be dropped morefrequently than packets from another. A packet with a lower dropping precedence is given better treatment in times ofcongestion because it is assigned a code point that corresponds to a virtual queue with relatively lenient RED parameters.The DiffServ module in nshas three major components:Policy: Policy is specified by network administrator about the level of service a class of traffic should receive in the network.Edge router: Edge router marks packets with a code point according to the policy specified.Core router: Core router examines packets’ code point marking and forwarding them accordingly.DiffServ attempts to restrict complexity to only the edge routers.87
9.2 ImplementationThe procedures and functions described in this section can be found in ~ns/diffserv/dsred, dsredq, dsEdge, dsCore, dsPolicy.{cc,h}.9.2.1 RED queue in DiffServ moduleA DiffServ queue (in class dsREDQueue) derived from the base class Queue is implemented in DiffServ module to providethe basic DiffServ router functionality, see dsred.{h,cc}). dsREDQueue has the following abilities:• to implement multiple physical RED queues along a single link;• to implement multiple virtual queues within a physical queue, with individual set of parameters for each virtual queue;• to determine in which physical and virtual queue a packet is enqueued according to its code point;• to determine in from which physical and virtual queue a packet is dequeued according to the scheduling scheme chosen.The class dsREDQueue consists of four physical RED queues, each containing three virtual queues. The number of physicaland virtual queues are defined in numPrec and numQueues_. Each combination of physical and virtual queue number isassociated with a code point (or a drop preference), which specifies a certain level of service.The physical queue is defined in class redQueue, which enables traffic differentiation by defining virtual queues withindependent configuration and state parameters, see dsredq.{h,cc}. For example, the length of each virtual queue iscalculated only on packets mapped to that queue. Thus, packet dropping decisions can be applied based on the state andconfiguration parameters of that virtual queues. Class redQueue is not equivalent to class REDQueue, which was alreadypresent in ns. Instead, it is a modified version of RED implementation with the notion of virtual queues and is only used byclass redQueue to realize physical queues. All user interaction with class redQueue is handled through the commandinterface of class dsREDQueue.Class dsREDQueue contains a data structure known as the Per Hop Behavior (PHB) Table In DiffServ, edge routers markpackets with code points and core routers simply respond to existing code points; both of them use PHB table to map a codepoint to a particular physical and virtual queue. The PHB Table is defined as an array with three fields:struct phbParam {int codePt_; // corresponding code pointint queue_; // physical queueint prec_; // virtual queue (drop precedence)};9.2.2 Edge and core routersThe DiffServ edge and core routers are defined in class edgeQueue and class coreQueue, which are derived fromclass dsREDQueue, see dsEdge, dsCore.{h,cc}.Packet marking is implemented in class edgeQueue. A packet is marked with a code point according to the policy specifiedbefore it is put into the corresponding physical and virtual queue. Class edgeQueue has a reference to an instance ofclass PolicyClassifier, which contains policies for packet marking.88
- Page 37 and 38: class TclClass (Section 3.5) define
- Page 39 and 40: Chapter 4The Class SimulatorThe ove
- Page 41 and 42: 4.2.2 the heap schedulerThe heap sc
- Page 43 and 44: 4.4 Commands at a glanceSynopsis:ns
- Page 45 and 46: $ns_ dumpqCommand for dumping event
- Page 47 and 48: NODEPortClassifierAgentAgentAddrCla
- Page 49 and 50: The Node instance variable, entry_,
- Page 51 and 52: The default values for all the abov
- Page 53 and 54: The classify() method is pure virtu
- Page 55 and 56: };The class imposes no direct seman
- Page 57 and 58: flow-specific queuing disciplines a
- Page 59 and 60: 5.5 Routing Module and Classifier O
- Page 61 and 62: Module NameRtModule/BaseRtModule/Mc
- Page 63 and 64: $node neighborsThis returns the lis
- Page 65 and 66: Linkhead_enqT_queue_ deqT_ link_ tt
- Page 67 and 68: 6.2 ConnectorsConnectors, unlink cl
- Page 69 and 70: $ns_ link-lossmodel This function
- Page 71 and 72: Chapter 7Queue Management and Packe
- Page 73 and 74: }}}void Queue::resume(){Packet* p =
- Page 75 and 76: 7.3 Different types of Queue object
- Page 77 and 78: maxidle_ is the maximum amount of t
- Page 79 and 80: dst_ The destination address of pac
- Page 81 and 82: 7.5.2 ConfigurationRunning a JoBS s
- Page 83 and 84: mean_pkt_size_ Used to set the expe
- Page 85 and 86: Demarker objects$q trace-file This
- Page 87: The recv() method overrides the bas
- Page 91 and 92: Average sending rateTSW window leng
- Page 93 and 94: The following command adds an entry
- Page 95 and 96: $qCE configQ 0 1 10 20 0.10Note tha
- Page 97 and 98: Chapter 10AgentsAgents represent en
- Page 99 and 100: CtrMcast/EncapCtrMcast/DecapMessage
- Page 101 and 102: }bind("windowOption_", &wnd_option_
- Page 103 and 104: hdr_flags* nf = (hdr_flags*)npkt->a
- Page 105 and 106: public:ECHO_Timer(ECHO_Agent *a) :
- Page 107 and 108: 10.6.4 Using the agent through OTcl
- Page 109 and 110: State Variables are:dupacks_ Number
- Page 111 and 112: $agent attach-tbf Attaches a token
- Page 113 and 114: (void)Scheduler::instance().schedul
- Page 115 and 116: * outstanding, cancel it.*/void Tcp
- Page 117 and 118: Chapter 12Packet Headers and Format
- Page 119 and 120: method is now obsolete; its usage i
- Page 121 and 122: Packethdrsize_next_bits()points to
- Page 123 and 124: the system’s memory allocator. In
- Page 125 and 126: }incr hdrlen_ $incrreturn $baseFrom
- Page 127 and 128: Chapter 13Error ModelThis chapter d
- Page 129 and 130: SimpleLink::errormodule argsSimulat
- Page 131 and 132: This is a simple example of how to
- Page 133 and 134: Higher LayersNode 1Node 2. . .Node
- Page 135 and 136: };void recv(Packet* p, Handler*);vi
- Page 137 and 138: and the frame type. It then passes
9.2 Implement<strong>at</strong>ion<strong>The</strong> procedures <strong>and</strong> functio<strong>ns</strong> described in this section can be found in ~<strong>ns</strong>/diffserv/dsred, dsredq, dsEdge, dsCore, dsPolicy.{cc,h}.9.2.1 RED queue in DiffServ moduleA DiffServ queue (in class dsREDQueue) derived from the base class Queue is implemented in DiffServ module to providethe basic DiffServ router functionality, see dsred.{h,cc}). dsREDQueue has the following abilities:• to implement multiple physical RED queues along a single link;• to implement multiple virtual queues within a physical queue, with individual set of parameters for each virtual queue;• to determine in which physical <strong>and</strong> virtual queue a packet is enqueued according to its code point;• to determine in from which physical <strong>and</strong> virtual queue a packet is dequeued according to the scheduling scheme chosen.<strong>The</strong> class dsREDQueue co<strong>ns</strong>ists of four physical RED queues, each containing three virtual queues. <strong>The</strong> number of physical<strong>and</strong> virtual queues are defined in numPrec <strong>and</strong> numQueues_. Each combin<strong>at</strong>ion of physical <strong>and</strong> virtual queue number isassoci<strong>at</strong>ed with a code point (or a drop preference), which specifies a certain level of service.<strong>The</strong> physical queue is defined in class redQueue, which enables traffic differenti<strong>at</strong>ion by defining virtual queues withindependent configur<strong>at</strong>ion <strong>and</strong> st<strong>at</strong>e parameters, see dsredq.{h,cc}. For example, the length of each virtual queue iscalcul<strong>at</strong>ed only on packets mapped to th<strong>at</strong> queue. Thus, packet dropping decisio<strong>ns</strong> can be applied based on the st<strong>at</strong>e <strong>and</strong>configur<strong>at</strong>ion parameters of th<strong>at</strong> virtual queues. Class redQueue is not equivalent to class REDQueue, which was alreadypresent in <strong>ns</strong>. I<strong>ns</strong>tead, it is a modified version of RED implement<strong>at</strong>ion with the notion of virtual queues <strong>and</strong> is only used byclass redQueue to realize physical queues. All user interaction with class redQueue is h<strong>and</strong>led through the comm<strong>and</strong>interface of class dsREDQueue.Class dsREDQueue contai<strong>ns</strong> a d<strong>at</strong>a structure known as the Per Hop Behavior (PHB) Table In DiffServ, edge routers markpackets with code points <strong>and</strong> core routers simply respond to existing code points; both of them use PHB table to map a codepoint to a particular physical <strong>and</strong> virtual queue. <strong>The</strong> PHB Table is defined as an array with three fields:struct phbParam {int codePt_; // corresponding code pointint queue_; // physical queueint prec_; // virtual queue (drop precedence)};9.2.2 Edge <strong>and</strong> core routers<strong>The</strong> DiffServ edge <strong>and</strong> core routers are defined in class edgeQueue <strong>and</strong> class coreQueue, which are derived fromclass dsREDQueue, see dsEdge, dsCore.{h,cc}.Packet marking is implemented in class edgeQueue. A packet is marked with a code point according to the policy specifiedbefore it is put into the corresponding physical <strong>and</strong> virtual queue. Class edgeQueue has a reference to an i<strong>ns</strong>tance ofclass PolicyClassifier, which contai<strong>ns</strong> policies for packet marking.88