1tclInterpreter With Extensionstcl80otcltclclEventSchedulerNetworkComponentExample Scriptset ns new Simulatorset n0 ns nodeset n1 ns noden0n1set ftp new ApplicationFTPftp attachagent tcpns at 02 ftp ID: 893554
Download Pdf The PPT/PDF document "ns2 201Polly HuangUSCISIhuangisiedu" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
1 1 ns-2 201Polly HuangUSC/ISIhuang@isi.ed
1 ns-2 201Polly HuangUSC/ISIhuang@isi.edu tclInterpreter With Extensions tcl8.0 otcl tclcl EventScheduler NetworkComponent Example Scriptset ns [new Simulator]set n0 [$ns node]set n1 [$ns node] n0n1set ftp [new Application/FTP]$ftp attach-agent $tcp$ns at 0.2 "$ftp start"$ns at 1.2 exit"$ns duplex-link $n0 $n1 1.5Mb 10msDropTailsettcp[$ns create-connection TCP $n0TCPSink$n1 0] OutlineInternalsMaking changesCreating new components 2 InternalsDiscrete Event SchedulerNetwork TopologyRoutingTransportApp
2 licationPacket FlowPacket Fo
licationPacket FlowPacket Format Discrete Event Scheduler time_, uid_, next_, handler_head_ -handler_ - handle() time_, uid_, next_, handler_ insert head_ - Network Topology -Node n0n1 Addr ClassifierPort Classifier classifier_dmux_entry_Node entry Node Multicast Classifier classifier_dmux_entry_Node entryMulticast Node multiclassifier_ Network Topology -Link n0n1 enqT_ queue_ deqT_ drophead_ drpT_ link_ ttl_ entry_head_ 3 n0n1 Addr ClassifierPort Classifier classifier_dmux_entry_Node entry 01 enqT_ queue_ deqT
3 _ drophead_ drpT_ link_ ttl_ n1 entry_he
_ drophead_ drpT_ link_ ttl_ n1 entry_head_ Routing (cont.) n0n1 Addr ClassifierPort Classifier classifier_dmux_entry_ 01 Addr ClassifierPort Classifier classifier_dmux_entry_ 0 Link n0-n1 Link n1-n0 Transport n0n1Addr ClassifierPort Classifierclassifier_dmux_entry_ Agent/TCP agents_Addr ClassifierPort Classifierclassifier_dmux_entry_ 0 Link n0-n1 Link n1-n0 0 Agent/TCPSink agents_dst_=1.0dst_=0.0 Application n0n1Addr ClassifierPort Classifierclassifier_dmux_entry_ Agent/TCP agents_Addr ClassifierPort Classifierclassifier_dmux_entry_ 0 Link n0-n1
4 Link n1-n0 0 Agent/TCPSink agents_dst_=
Link n1-n0 0 Agent/TCPSink agents_dst_=1.0dst_=0.0 Application/FTP 4 Packet Flow n0n1Addr ClassifierPort Classifierentry_ Agent/TCP Addr ClassifierPort Classifierentry_ 0 Link n0-n1 Link n1-n0 0 Agent/TCPSink dst_=1.0dst_=0.0 Application/FTP Packet Format ip header tcp header rtp header trace header cmn header ptype_ iface_ OutlineInternalsMaking changesCreating new components ns-2 Directory Structure otcl nam-1 test ... ... tcl code example validation test C++ code tcl code core 5 Making Changes in C++ SpaceExisting code
5 recompileAdditionchange Make
recompileAdditionchange Makefile and recompile Making Changes inotclSpaceExisting coderecompilesourceAdditionsourcechange Makefile(NS_TCL_LIB), tcl/ns-lib.tcl (source) and recompile OutlineInternalsMaking changesCreating new components Creating New ComponentsGuidelinesInheritance HierarchyC++ andotclInterfaceExamplesNetwork layerTransport layerApplication layer 6 GuidelinesDecide its inheritance structureCreate the class and fill in t
6 he API virtual functionsDefine otc
he API virtual functionsDefine otcl linkage functionsWrite the necessary otcl code to access your agent Class Hierarchy (Partial) TclObject NsObject Connector Classifier Delay AddrClassifier Agent McastClasifier Queue Trace DropTail Drop Reno C++ and otcl InterfaceSupported by tclcl (a.k.a., Tcl)Tcl&tcl=Tcl::instance();Implementation is 100% in C++otcl- C++ command(): tclcommo150;andtcl.result()C++ -o150; otcltcl.eval(tclactioo140;n)bind() or [otcl-o
7 140;C++] Network LayerNetwork Inte
140;C++] Network LayerNetwork Interface -Packet Labeler NetworkInterface A NetworkInterface B 7 Class Hierarchy TclObject NsObject Connector Classifier Delay AddrClassifier Agent McastClasifier Queue Trace DropTail Drop Reno Network Interface Network Interface Labelerclass NetworkInterfaceNetworkInterface()recv(pkt)pkt-iface() = label_send(pkt)target-recv(pkt)command()label argv{label_ = argv}TclClass(networkinterface) NetworkInterfacenetworkinterfaceset iface
8 [new networkinteface]$ifacelabel Acomman
[new networkinteface]$ifacelabel Acommand(): label Transport LayerTCP Jump Startfrom cwnd += 1tocwnd= maxwin Class Hierarchy TclObject NsObject Connector Classifier Delay AddrClassifier Agent McastClasifier Queue Trace DropTail Drop Reno 8 TCP Linear Slow Startclass JSTcpAgentopenwin()slowdown()TclClass(Agent/TCP/JS) Application LayerMessage sender Message Sender Message Sender Class Hierarchy TclObject NsObject Connector Classifier Delay AddrClassifier Agent McastClasifier Queue Trace D
9 ropTail Drop Reno MessageAgent Message S
ropTail Drop Reno MessageAgent Message Senderclass MessageAgentMessageAgent()recv()send()command()send {send()}TclClass(Agent/Message) C++otclMessageAgentAgent/Messageset msg[new Agent/Message]$msgsendcommand(): send 9 ns-2 301 PreviewGenerating representative web trafficHttpSessioninternal -step by step code walk throughIsolating flow control or error recovery mechanisms from TCPTCP internal -step by step code walk through Slideshttp://www.research.att.com/~phuan