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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10.6.4 Using the agent through OTcl<strong>The</strong> agent we have cre<strong>at</strong>ed will have to be i<strong>ns</strong>tanti<strong>at</strong>ed <strong>and</strong> <strong>at</strong>tached to a node. Note th<strong>at</strong> a node <strong>and</strong> simul<strong>at</strong>or object isassumed to have already been cre<strong>at</strong>ed. <strong>The</strong> following OTcl code performs these functio<strong>ns</strong>:set echoagent [new Agent/ECHO]$simul<strong>at</strong>or <strong>at</strong>tach-agent $node $echoagentTo set the interval <strong>and</strong> packet size, <strong>and</strong> start packet gener<strong>at</strong>ion, the following OTcl code is executed:$echoagent set dst_ $dest$echoagent set fid_ 0$echoagent set prio_ 0$echoagent set flags_ 0$echoagent set interval_ 1.5$echoagent set packetSize_ 1024$echoagent startThis will cause our agent to gener<strong>at</strong>e one 1024-byte packet destined for node $dest every 1.5 seconds.10.7 <strong>The</strong> Agent APISimul<strong>at</strong>ed applic<strong>at</strong>io<strong>ns</strong> may be implemented on top of protocol agents. Chapter 38 describes the API used by applic<strong>at</strong>io<strong>ns</strong> toaccess the services provided by the protocol agent.10.8 Different agent objectsClass Agent forms the base class from which different types of objects like Nullobject, TCP etc are derived. <strong>The</strong> methods forAgent class are described in the next section. Configur<strong>at</strong>ion parameters for:fid_ Flowid.prio_ Priority.agent_addr_ Address of this agent.agent_port_ Port adress of this agent.dst_addr_Destin<strong>at</strong>ion address for the agent.dst_port_ Destin<strong>at</strong>ion port address for the agent.flags_ttl_ TTL defaults to 32.<strong>The</strong>re are no st<strong>at</strong>e variables specific to the generic agent class. Other objects derived from Agent are given below:106

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

Saved successfully!

Ooh no, something went wrong!