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.

to be a classifier. In some cases one may want to put an agent, or any class derived from Connector, <strong>at</strong> the entrypoint of a node. In such cases, one simply supplies target to parameter hook.– Node::i<strong>ns</strong>tall-entry{module, clsfr, hook} differs from Node::i<strong>ns</strong>ert-entry in th<strong>at</strong> it deletes theexisting classifier <strong>at</strong> the node entry point, unregisters any associ<strong>at</strong>ed routing module, <strong>and</strong> i<strong>ns</strong>talls the new classifier<strong>at</strong> th<strong>at</strong> point. If hook is given, <strong>and</strong> the old classifier is connected into a classifier chain, it will connect the chaininto slot hook of the new classifier. As above, if hook equals to target, clsfr will be tre<strong>at</strong>ed as an objectderived from Connector i<strong>ns</strong>tead of a classifier.– Node::i<strong>ns</strong>tall-demux{demux, port} places the given classifier demux as the default demultiplexer. Ifport is given, it plugs the existing demultiplexer into slot port of the new one. Notice th<strong>at</strong> in either case it doesnot delete the existing demultiplexer.5.6 Comm<strong>and</strong>s <strong>at</strong> a glanceFollowing is a list of common node comm<strong>and</strong>s used in simul<strong>at</strong>ion scripts:$<strong>ns</strong>_ node []Comm<strong>and</strong> to cre<strong>at</strong>e <strong>and</strong> return a node i<strong>ns</strong>tance. If is given, assign the node address to be . Note th<strong>at</strong>the l<strong>at</strong>ter MUST only be used when hierarchical addressing is enabled via either set-address-form<strong>at</strong>hierarchical{} or node-config -addressType hierarchical{}.$<strong>ns</strong>_ node-config - This comm<strong>and</strong> is used to configure nodes. <strong>The</strong> different config-parameters are addressingType, different type of the networkstack components, whether tracing will be turned on or not, mobileIP flag is truned or not, energy model is being used or notetc. An option -reset maybe used to set the node configur<strong>at</strong>ion to its default st<strong>at</strong>e. <strong>The</strong> default setting of node-config, i.e if novalues are specified, cre<strong>at</strong>es a simple node (base class Node) with fl<strong>at</strong> addressing/routing. For the syntax details seeSection 5.3.$node idRetur<strong>ns</strong> the id number of the node.$node node-addrRetur<strong>ns</strong> the address of the node. In case of fl<strong>at</strong> addressing, the node address is same as its node-id. In case of hierarchicaladdressing, the node address in the form of a string (viz. "1.4.3") is returned.$node resetResets all agent <strong>at</strong>tached to this node.$node agent Retur<strong>ns</strong> the h<strong>and</strong>le of the agent <strong>at</strong> the specified port. If no agent is found <strong>at</strong> the given port, a null string is returned.$node entryRetur<strong>ns</strong> the entry point for the node. This is first object th<strong>at</strong> h<strong>and</strong>les packet receiving <strong>at</strong> this node.$node <strong>at</strong>tach Attaches the to this node. Incase no specific port number is passed, the node alloc<strong>at</strong>es a port number <strong>and</strong> binds theagent to this port. Thus once the agent is <strong>at</strong>tached, it receives packets destined for this host (node) <strong>and</strong> port.$node detach This is the dual of "<strong>at</strong>tach" described above. It detaches the agent from this node <strong>and</strong> i<strong>ns</strong>talls a null-agent to the port thisagent was <strong>at</strong>tached. This is done to h<strong>and</strong>le tra<strong>ns</strong>it packets th<strong>at</strong> may be destined to the detached agent. <strong>The</strong>se on-the-flypackets are then sinked <strong>at</strong> the null-agent.61

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

Saved successfully!

Ooh no, something went wrong!