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 ...
The following member functions are also defined by the class Agent, but are intended to be over-ridden by classes derivingfrom Agent:void timeout(timeout number)void recv(Packet*, Handler*)subclass-specific time out methodreceiving agent main receive pathThe allocpkt() method is used by derived classes to create packets to send. The function fills in the following fields inthe common packet header (Section 12): uid, ptype, size, and the following fields in the IP header: src, dst,flowid, prio, ttl. It also zero-fills in the following fields of the Flags header: ecn, pri, usr1, usr2. Anypacket header information not included in these lists must be must be handled in the classes derived from Agent.The recv() method is the main entry point for an Agent which receives packets, and is invoked by upstream nodes whensending a packet. In most cases, Agents make no use of the second argument (the handler defined by upstream nodes).10.3 Protocol AgentsThere are several agents supported in the simulator. These are their names in OTcl:TCPTCP/RenoTCP/NewrenoTCP/Sack1TCP/FackTCP/FullTcpTCP/VegasTCP/Vegas/RBPTCP/Vegas/RBPTCP/AsymTCP/Reno/AsymTCP/Newreno/AsymTCPSinkTCPSink/DelAckTCPSink/AsymTCPSink/Sack1TCPSink/Sack1/DelAcka “Tahoe” TCP sender (cwnd = 1 on any loss)a “Reno” TCP sender (with fast recovery)a modified Reno TCP sender (changes fast recovery)a SACK TCP sendera “forward” SACK sender TCPa more full-functioned TCP with 2-way traffica “Vegas” TCP sendera Vegas TCP with “rate based pacing”a Reno TCP with “rate based pacing”an experimental Tahoe TCP for asymmetric linksan experimental Reno TCP for asymmetric linksan experimental Newreno TCP for asymmetric linksa Reno or Tahoe TCP receiver (not used for FullTcp)a TCP delayed-ACK receiveran experimental TCP sink for asymmetric linksa SACK TCP receivera delayed-ACK SACK TCP receiverUDPa basic UDP agentRTPRTCPan RTP sender and receiveran RTCP sender and receiverLossMonitora packet sink which checks for lossesIVS/SourceIVS/Receiveran IVS sourcean IVS receiver97
CtrMcast/EncapCtrMcast/DecapMessageMessage/PruneSRMSRM/AdaptiveTapNullrtProto/DVa “centralised multicast” encapsulatora “centralised multicast” de-encapsulatora protocol to carry textual messagesprocesses multicast routing prune messagesan SRM agent with non-adaptive timersan SRM agent with adaptive timersinterfaces the simulator to a live networka degenerate agent which discards packetsdistance-vector routing protocol agentAgents are used in the implementation of protocols at various layers. Thus, for some transport protocols (e.g. UDP) thedistribution of packet sizes and/or inter-departure times may be dictated by some separate object representing the demandsof an application. To this end, agents expose an application programming interface (API) to the application. For agents usedin the implementation of lower-layer protocols (e.g. routing agents), size and departure timing is generally dictated by theagent’s own processing of protocol messages.10.4 OTcl LinkageAgents may be created within OTcl and an agent’s internal state can be modified by use of Tcl’s set function and any Tclfunctions an Agent (or its base classes) implements. Note that some of an Agent’s internal state may exist only within OTcl,and is thus is not directly accessible from C++.10.4.1 Creating and Manipulating AgentsThe following example illustrates the creation and modification of an Agent in OTcl:set newtcp [new Agent/TCP];# create new object (and C++ shadow object)$newtcp set window_ 20 ;# sets the tcp agent’s window to 20$newtcp target $dest;# target is implemented in Connector class$newtcp set portID_ 1;# exists only in OTcl, not in C++10.4.2 Default ValuesDefault values for member variables, those visible in OTcl only and those linked between OTcl and C++ with bind areinitialized in the ~ns/tcl/lib/ns-default.tcl file. For example, Agent is initialized as follows:Agent set fid_ 0Agent set prio_ 0Agent set addr_ 098
- 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 and 88: The recv() method overrides the bas
- Page 89 and 90: 9.2 ImplementationThe procedures an
- 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: Chapter 10AgentsAgents represent en
- 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
- Page 139 and 140: $ll_ set delay_ $delay$ll_ set band
- Page 141 and 142: 14.10 Commands at a glanceThe follo
- Page 143 and 144: 15.2.1 Default Hierarchical Setting
- Page 145 and 146: Chapter 16Mobile Networking in nsTh
- Page 147 and 148: entry_addrdemuxIP addressdefaulttar
CtrMcast/EncapCtrMcast/DecapMessageMessage/PruneSRMSRM/AdaptiveTapNullrtProto/DVa “centralised multicast” encapsul<strong>at</strong>ora “centralised multicast” de-encapsul<strong>at</strong>ora protocol to carry textual messagesprocesses multicast routing prune messagesan SRM agent with non-adaptive timersan SRM agent with adaptive timersinterfaces the simul<strong>at</strong>or to a live networka degener<strong>at</strong>e agent which discards packetsdistance-vector routing protocol agentAgents are used in the implement<strong>at</strong>ion of protocols <strong>at</strong> various layers. Thus, for some tra<strong>ns</strong>port protocols (e.g. UDP) thedistribution of packet sizes <strong>and</strong>/or inter-departure times may be dict<strong>at</strong>ed by some separ<strong>at</strong>e object representing the dem<strong>and</strong>sof an applic<strong>at</strong>ion. To this end, agents expose an applic<strong>at</strong>ion programming interface (API) to the applic<strong>at</strong>ion. For agents usedin the implement<strong>at</strong>ion of lower-layer protocols (e.g. routing agents), size <strong>and</strong> departure timing is generally dict<strong>at</strong>ed by theagent’s own processing of protocol messages.10.4 OTcl LinkageAgents may be cre<strong>at</strong>ed within OTcl <strong>and</strong> an agent’s internal st<strong>at</strong>e can be modified by use of Tcl’s set function <strong>and</strong> any Tclfunctio<strong>ns</strong> an Agent (or its base classes) implements. Note th<strong>at</strong> some of an Agent’s internal st<strong>at</strong>e may exist only within OTcl,<strong>and</strong> is thus is not directly accessible from C++.10.4.1 Cre<strong>at</strong>ing <strong>and</strong> Manipul<strong>at</strong>ing Agents<strong>The</strong> following example illustr<strong>at</strong>es the cre<strong>at</strong>ion <strong>and</strong> modific<strong>at</strong>ion of an Agent in OTcl:set newtcp [new Agent/TCP];# cre<strong>at</strong>e new object (<strong>and</strong> C++ shadow object)$newtcp set window_ 20 ;# sets the tcp agent’s window to 20$newtcp target $dest;# target is implemented in Connector class$newtcp set portID_ 1;# exists only in OTcl, not in C++10.4.2 Default ValuesDefault values for member variables, those visible in OTcl only <strong>and</strong> those linked between OTcl <strong>and</strong> C++ with bind areinitialized in the ~<strong>ns</strong>/tcl/lib/<strong>ns</strong>-default.tcl file. For example, Agent is initialized as follows:Agent set fid_ 0Agent set prio_ 0Agent set addr_ 098