Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf ·...
Transcript of Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf ·...
![Page 1: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/1.jpg)
Developing New Modules Developing New Modules Developing New Modules Developing New Modules Developing New Modules Developing New Modules in NSin NS22
Developing New Modules Developing New Modules in NSin NS22
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 1
![Page 2: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/2.jpg)
OutlineR• Recap
• Automatic Repeat reQuest• Packet Scheduling• SummarySummary
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 2
![Page 3: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/3.jpg)
RRecap• 3 Simulation Main Steps3 Simulation Main Steps1. Design and Implementation
– Things to simulate– Assumptions– Performance measure– Code Implementationp
2. Simulation– Network Configuration Phase
Si l ti Ph– Simulation Phase3. Result Compilation
– Debugging and Tracing
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
gg g g– Compute performance measures
3
![Page 4: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/4.jpg)
D i d I l iDesign and Implementation• DesignDesign
1. What would you like to simulate? Draw a conceptual view
2 Wh t hi h d ish t b ild m d l ?2. What hierarchy do you wish to build a new module?C++, OTcl, or both Do you need to bind them?
3. What variables/functions do you need?4 D d OT l i f ?4. Do you need OTcl interface?
• Implementation1. Implement C++/OTcl codes1. Implement C /OTcl codes2. Modify makefile make
3. Develop Simulation script
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 4
![Page 5: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/5.jpg)
OutlineR• Recap
• Automatic Repeat reQuest• Packet Scheduling• SummarySummary
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 5
![Page 6: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/6.jpg)
A i R QAutomatic Repeat reQuest• Error Control MechanismError Control Mechanism• Based on packet retransmission (i.e.,
acknowledgement (ACK))acknowledgement (ACK))• 3 Main types
– Stop and Wait– Go-back-N: TCP– Selective Repeat Request
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 6
![Page 7: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/7.jpg)
S A d W iStop-And-Wait• Transmit and wait for ACK before Transmit and wait for ACK before
transmitting the next packetRetransmit after timeout• Retransmit after timeout
• Reset timeout upon receiving an ACK
1sender 22
timeout
receiver 1
l
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
packetACK
How many times would you retransmit the lost packet?
7
![Page 8: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/8.jpg)
S A d W iStop-And-Wait• 1-persistent1-persistent• Infinite-persistent
i i • p-persistent: retransmit w.p. p• Finite persistent: retransmit upto K p p
times
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 8
![Page 9: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/9.jpg)
S A d W iStop-And-Wait• Let e be error probabilityLet e be error probability
Persistent Type Pr of successful TX Persistent Type Pr. of successful TX 1 1-eInfinite 1Infinite 1p (1-e)/(1-pe)Finite 1 eK+1Finite 1-eK+1
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 9
![Page 10: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/10.jpg)
C l ViConceptual View
n0 n1SimpleLink
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 10
![Page 11: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/11.jpg)
C l ViConceptual View
n0 n1Lossy link
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 11
![Page 12: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/12.jpg)
C l ViConceptual View
n0 n1Lossy link with ARQ
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 12
![Page 13: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/13.jpg)
C l ViConceptual View• Two main mechanismsTwo main mechanisms
– ACK passingCallback mechanism– Callback mechanism
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 13
![Page 14: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/14.jpg)
C l Vi• ACK passing
Conceptual ViewACK passing– tARQ_:
• ARQ transmitting unit • ARQ transmitting unit • Keep track of the no. of retransmissions• Decide whether to TX or drop the packetDec de whether to X or drop the packet
– acker_: inform tARQ_ of TX success– nacker : inform tARQ of TX failurenacker_ inform tARQ_ of TX failure
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 14
![Page 15: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/15.jpg)
C l ViConceptual View• Two main mechanismsTwo main mechanisms
– ACK passingCallback mechanism– Callback mechanism
callback
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
callback
15
![Page 16: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/16.jpg)
C l Vi• Callback mechanism
Conceptual ViewCallback mechanismQ: What does link_ do when receiving a
packet?packet?A: Schedule two events: Pkt departure
and arrival Th and arrival//~ns/link/delay.ccvoid LinkDelay::recv(Packet* p, Handler* h) {
This is a queue handler
double txt = txtime(p); Scheduler& s = Scheduler::instance(); s.schedule(target_, p, txt + delay_);
Pkt arrival:packet receptionat the next node
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
s.schedule(h, &intr_, txt); }
at the next nodePkt departure:Tell the associated queue to resume
16
![Page 17: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/17.jpg)
C l Vi• Callback mechanism
Conceptual ViewCallback mechanismQ: What does link_errmodule do when
receiving a packet and the packet is in error?A: Drop the packet and Tell the queue to resume
// /ns/queue/errmodel cc
This is a queue //~/ns/queue/errmodel.cc
void ErrorModel::recv(Packet* p, Handler* h) {
double delay = Random::uniform(8.0*ch->size()/bandwidth_);i i
qhandler
Scheduler::instance().schedule(h, &intr_, delay);drop_->recv(p); return;
} Pkt departure:Tell the associated queue to resumeDrop the packet
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
Drop the packet
17
![Page 18: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/18.jpg)
C l Vi• link and linkerrmodule callback to
Conceptual Viewlink_ and linkerrmodule_ callback to tARQ_
• tARQ call back to queuet Q_ call back to queue_• To send packet p downstream:
– queue : recv(qh , p)q _ (q _, p)– tARQ_: recv(arqh_,p)
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 18
![Page 19: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/19.jpg)
C l ViConceptual View• Two main mechanisms
– ACK passing– Callback mechanismm m
Callback with ARQ
qh_
arqh_
callback
qh_
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
callbackwith qh_
19
![Page 20: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/20.jpg)
C I l iC++ Implementation• ARQ Transmitter ClassesARQ Transmitter Classes
– ARQTX,ARQHandler
ARQ R i Cl ss s• ARQ Receiver Classes– ARQRX ARQAcker, ARQNacker
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 20
![Page 21: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/21.jpg)
C I l iC++ ImplementationARQTX:ARQTX:
class ARQTx : public Connector {
called by ARQNacker
public:ARQTx();void recv(Packet*, Handler*);
id k(P k t*) id k()
called by ARQAcker
void nack(Packet*); void ack();void resume();
protected:ARQHandler arqh ;
Callback from link_ or linkerrmodule
Queue handler
Q q _;Handler* qh_; Packet* pkt_;ARQStatus status_;int blocked_;
_
Finite persistent ARQ
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
int retry_limit_; int num_rtxs_;};
21
![Page 22: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/22.jpg)
C I l iARQTx,
C++ ImplementationARQTx::ARQTx() : arqh_(*this)ARQTx,
ARQHandler:_
{num_rtxs_ = 0; retry_limit_ = 0;qh_ = 0;pkt_ = 0;status_ = IDLE;blocked_ = 0;bind("retry_limit_", &retry_limit_);
}
enum ARQStatus {IDLE,SENT,ACKED,RTX,DROP};
class ARQHandler : public Handler {public:public:
ARQHandler(ARQTx& arq) : arq_tx_(arq) {};
void handle(Event*);private:
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
private: ARQTx& arq_tx_;
};
22
![Page 23: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/23.jpg)
C I l iC++ ImplementationARQTX:ARQTX:
void ARQTx::recv(Packet* p, Handler* h){
qh_ = h;status_ = SENT;bl k d 1blocked_ = 1;send(p,&arqh_);
}
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 23
![Page 24: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/24.jpg)
C I l iC++ ImplementationARQTX:ARQTX:
void ARQTx::recv(Packet* p, Handler* h){
qh_ = h;status_ = SENT;bl k d 1blocked_ = 1;send(p,&arqh_);
}
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 24
![Page 25: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/25.jpg)
C I l iC++ Implementationnack(p)
ack()
nack(p)
num_rtxs_++;pkt_ = p;
num_rtxs_=0;status_ = ACKED;
num_rtxs_>retry_limit_<=retry_limit_
returnstatus_ = RTX; num_rtxs_ = 0;
status_ = DROP;
return
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 25
![Page 26: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/26.jpg)
C I l iC++ Implementationresume()resume()
blocked_=0;
status_
ACKED RTX DROP
status_ = SENT;blocked_ = 1;
drop(pkt_);status_ = IDLE;
ACKED
status_ = IDLE;qh >handle(0);
RTX DROP
send(pkt_,&arqh_); qh_->handle(0);qh_->handle(0);
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
return
26
![Page 27: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/27.jpg)
C I l iC++ Implementation• ARQ Transmitter ClassesARQ Transmitter Classes
– ARQTX,ARQHandler
ARQ R i Cl ss s• ARQ Receiver Classes– ARQRX ARQAcker, ARQNacker
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 27
![Page 28: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/28.jpg)
C I l iC++ Implementationclass ARQRx : public Connector { ppublic:
ARQRx();int command(int argc, const char*const* argv); virtual void recv(Packet* Handler*);virtual void recv(Packet*, Handler*);virtual void resume()=0;Packet *pkt_;
protected: class ARQAcker : public ARQRx { bliARQTx* arq_tx_;
};
public:ARQAcker() {};virtual void resume();
};class ARQNacker : public ARQRx { public:
ARQNacker() {};virtual void resume();
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
();};
28
![Page 29: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/29.jpg)
C I l iC++ Implementationint ARQRx::command(int argc, const char*const* argv) {
Tcl& tcl = Tcl::instance();if (argc == 3) {
if (strcmp(argv[1], "attach-ARQTx") == 0) {arq_tx_ = (ARQTx*)TclObject::lookup(argv[2]);return(TCL OK);return(TCL_OK);
}
} return Connector::command(argc, argv);}
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 29
![Page 30: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/30.jpg)
C I l iC++ Implementationid ( k * dl * h)void ARQRx::recv(Packet* p, Handler* h)
{pkt_ = p; handler_ = h; resume();
}
void ARQAcker::resume(){
arq_tx_->ack(); send(pkt_,handler_);}
void ARQNacker::resume(){
arq tx ->nack(pkt );
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
arq_tx_ >nack(pkt_);
}
30
![Page 31: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/31.jpg)
OT l I l iOTcl Implementation• 2 Instprocs to put ARQ in the simple 2 Instprocs to put ARQ in the simple
link:1 Simulator:: link arq{limit from to}1. Simulator:: link-arq{limit from to}2. SimpleLink::link-arq{limit}
Simulator instproc link arq { limit from to } {Simulator instproc link-arq { limit from to } { set link [$self link $from $to] $link link-arq $limit
}
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
}
31
![Page 32: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/32.jpg)
OT l I l iOTcl ImplementationSimpleLink instproc link-arq { limit } {
$self instvar link_ link_errmodule_ queue_ drophead_$self instvar tARQ_ acker_ nacker_ set tARQ_ [new ARQTx] set acker [ne ARQAcker]set acker_ [new ARQAcker] set nacker_ [new ARQNacker] $tARQ_ set retry_limit_ $limit $acker attach-ARQTx $tARQ $ _ Q $ Q_$nacker_ attach-ARQTx $tARQ_ $queue_ target $tARQ_ $tARQ_ target $link_errmodule_ $link_errmodule_ target $acker_ $acker_ target $link_ $tARQ_ drop-target $drophead_ $link errmodule drop target $nacker
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
$link_errmodule_ drop-target $nacker_ }
32
![Page 33: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/33.jpg)
T l Si l i S iTcl Simulation Script• Insert the following codes:Insert the following codes://tcp.tcl
set em [new ErrorModel]$em set rate_ 0.1$$em unit pkt$em ranvar [new RandomVariable/Uniform]$em drop-target [new Agent/Null]$ns link-lossmodel $em $n1 $n3$ns link-arq 2 $n1 $n3
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 33
![Page 34: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/34.jpg)
R l C ll iResult Collection• Insert the following codes:Insert the following codes://tcp.tclproc show_tcp_seqno {} {
global tcp nsputs "At [$ns now] The final tcp sequence number is [$tcp set t seqno ]"[$tcp set t_seqno_]"
}
$ t 0 0 "$ft t t"$ns at 0.0 "$ftp start"$ns at 10.0 "show_tcp_seqno"$ns at 10.1 "$ns halt"$
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
$ns run
34
![Page 35: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/35.jpg)
Si l i R lSimulation Result>> ns tcp.tcl>> The final tcp sequence number is 37587
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 35
![Page 36: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/36.jpg)
OutlineR• Recap
• Automatic Repeat reQuest• Packet Scheduling• SummarySummary
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 36
![Page 37: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/37.jpg)
P k S h d liPacket Scheduling• Not related to the Event SchedulingNot related to the Event Scheduling
Packet scheduler: Which packet should o first?Which packet should go first?
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 37
![Page 38: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/38.jpg)
P k S h d liPacket Scheduling• Example of scheduler: (Give me few Example of scheduler: (Give me few
example) Round robin– Round robin
– Max rateDelay based– Delay based
– Fairness basedP i it b d– Priority based
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 38
![Page 39: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/39.jpg)
C l ViConceptual View
n0 n1SimpleLink
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 39
![Page 40: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/40.jpg)
C l ViConceptual ViewLinkSchedn0
n1 n1
n2
...
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 40
![Page 41: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/41.jpg)
C l ViConceptual View• Key differencesKey differences
– Flow classifier (flow_clsfr_): Send packets from different flow to packets from different flow to different queue
– Scheduler (sch ): Determine which Scheduler (sch_) Determine which packet should go first• Round robin• Priority based
– Callback mechanism
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 41
![Page 42: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/42.jpg)
C l ViConceptual ViewLinkSchedn0
n1 n1
n2
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 42
![Page 43: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/43.jpg)
C l ViConceptual ViewLinkSchedn0
n1 n1
n2
Callback
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 43
![Page 44: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/44.jpg)
C I l iC++ Implementation• Flow classifier: Flow classifier:
– Base class: ClassifierDerived class: FlowClassifier– Derived class: FlowClassifier
• Packet schedulerB l – Base class: Connector PktScheduler
– Derived class: RRScheduler
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 44
![Page 45: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/45.jpg)
R P Cl ifiRecap: Port Classifier(1)
//~ns/classifier/classifier-port.ccint PortClassifier::classify(Packet *p)
(1)(3)
y( p){
hdr_ip* iph = hdr_ip::access(p);return iph->dport();
}
(2)
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 45
![Page 46: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/46.jpg)
Fl Cl ifiFlow Classifier• FlowClassfier (C++) FlowClassfier (C )
Classifier/Flow (OTcl)
• We only need to define function classify(p):y(p)
//classifier-flow.cc int FlowClassifier::classify(Packet *p)y p{
return hdr_ip::access(p)->flowid(); }
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 46
![Page 47: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/47.jpg)
C I l iC++ Implementation• Flow classifier: Flow classifier:
– Base class: ClassifierDerived class: FlowClassifier– Derived class: FlowClassifier
• Packet schedulerB l – Base class: Connector PktScheduler
– Derived class: RRScheduler
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 47
![Page 48: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/48.jpg)
C I l i• Two main functionality
C++ ImplementationTwo main functionality1. Determine the next flow and
transmitted the packettransmitted the packet2. Callback Mechanism
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 48
![Page 49: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/49.jpg)
C I l iC++ ImplementationV i bl M iVariable Meaningblocked_ True if the PktScheduler is blockedactive_flow_id_ Flow ID of the packet being transmittedpkt_[i] HOL packet of queue iqh_[i] Queue handler corresponding to Queue i
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 49
![Page 50: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/50.jpg)
C I l i• Declaration
C++ ImplementationDeclaration
#define MAX_FLOWS 10 class PktScheduler : public Connector { public:
P k t ti f tiPktScheduler(); virtual void handle(Event*); virtual void recv(Packet*, Handler*);
protected:
Packet reception function
Use this function to send packetsp
void send(int fid, Handler* h); virtual void resume(); int getFlowID(Packet* p) {return hdr_ip::access(p)->flowid();};virtual int nextID() = 0;
Callback function
virtual int nextID() 0; Handler* qh_[MAX_FLOWS]; Packet* pkt_[MAX_FLOWS]; int blocked_; int active flow id ;
Pure virtual function:Override by the derived class
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
int active_flow_id_;
};
50
![Page 51: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/51.jpg)
C I l i• Functions recv(p h) and send(id h)
C++ ImplementationFunctions recv(p,h) and send(id,h)
void PktScheduler::recv(Packet* p, Handler* h)void PktScheduler::recv(Packet p, Handler h){
int fid = getFlowID(p); pkt_[fid] = p;qh_[fid] = h; if (!blocked ) {
PktScheduler
if (!blocked_) { send(fid,this); blocked_ = 1; active_flow_id_ = fid;
}
… …
pkt_ qh_
} }void PktScheduler::send(int fid_idx, Handler* h){ If blocked,
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
Connector::send(pkt_[fid_idx],h); pkt_[fid_idx] = 0;
}
wait for a call back signal from link_.
51
![Page 52: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/52.jpg)
C I l i• Functions handle() and resume()
C++ ImplementationFunctions handle() and resume()
void PktScheduler::handle(Event*) { resume();}void PktScheduler::handle(Event ) { resume();}void PktScheduler::resume() {
qh_[active_flow_id_]->handle(0); int index = nextID();
qh_
PktScheduler
int index = nextID();blocked_ = 0; if (index >= 0) {
send(index,this); bl k d 1
queue_ queue_ …Polymorphism
blocked_ = 1; active_flow_id_ = index;
}
} ue_[0]
ue_[1]
• The packet has left link
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
que
que• The packet has left link_
• Fetch another packet
52
![Page 53: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/53.jpg)
C I l i• Packet forwarding mechanism
C++ ImplementationPacket forwarding mechanism
classify hCallback
pkt
classify qh_
this
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 53
![Page 54: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/54.jpg)
C I l i• One missing piece
C++ ImplementationOne missing piece How would a PktScheduler select a flow? Class RRScheduler (C++) PktScheduler/RR (OTcl) int RRScheduler::nextID() {
int count = 0; c rrent id ++ c rrent id % MAX FLOWScurrent_id_++; current_id_ %= MAX_FLOWS; while((pkt_[current_id_] == 0)&&(count<MAX_FLOWS)){
current_id_++; current_id_ %= MAX_FLOWS; count++;
}} if (count == MAX_FLOWS)
return -1; else{
return current id ;
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
return current_id_; }
}
54
![Page 55: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/55.jpg)
OT l I l iOTcl Implementation• Class LinkSch derives from Class LinkSch derives from SimpleLink
•
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 55
![Page 56: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/56.jpg)
OT l I l iOTcl Implementation• ConstructorConstructor
Class LinkSch -superclass Link LinkSch instproc init {src dst bw delay num_queues} {
set flow clsfr [new Classifier/Flow] _ _ [ / ]set sch_ [new PktScheduler/RR] set num_queues_ $num_queues $head_ target $flow_clsfr_ for {set i 0} {$i < $num queues } {incr i} { { } { _q _} { } {
set queue_($i) [new Queue/DropTail] $queue_($i) target $sch_ $queue_($i) drop-target $drophead_
} }$sch_ target $link_ $link_ target $ttl_ $ttl_ target [$dst entry] ...
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
}
56
![Page 57: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/57.jpg)
OT l I l iOTcl Implementation• ConstructorConstructor
Class LinkSch -superclass Link LinkSch instproc init {src dst bw delay num_queues} {
set flow clsfr [new Classifier/Flow] _ _ [ / ]set sch_ [new PktScheduler/RR] set num_queues_ $num_queues $head_ target $flow_clsfr_ for {set i 0} {$i < $num queues } {incr i} { { } { _q _} { } {
set queue_($i) [new Queue/DropTail] $queue_($i) target $sch_ $queue_($i) drop-target $drophead_
} }$sch_ target $link_ $link_ target $ttl_ $ttl_ target [$dst entry] ...
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
}
57
![Page 58: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/58.jpg)
OT l I l iOTcl ImplementationSimulator instproc sch-link { n1 n2 bw delay num_queues} {
$self instvar link_ queueMap_ nullAgent_ useasim_ set sid [$n1 id] set did [$n2 id] set link_($sid:$did) [new LinkSch
$n1 $n2 $bw $delay $num_queues] }
Simulator instproc add-flow { n1 n2 prio } { $self instvar link_ set sid [$n1 id] set did [$n2 id] $link_($sid:$did) add-flow $fid
} LinkSch instproc add-flow { fid } { $self instvar queue_ flow_clsfr_ $flow_clsfr_ install $fid
$queue ($fid)
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
$queue_($fid)}
58
![Page 59: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/59.jpg)
T l Si l i S iTcl Simulation Script
Agent/TCP TCPSinkFTP
n1 n3LinkSch
TCPSinkAgent/TCPFTP
…… …
SimpleLink SimpleLink
TCPSinkAgent/TCPFTP
n2
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
Q: Do we need a receiving Application? Why? Why not?
59
![Page 60: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/60.jpg)
OT l I l iOTcl Implementation$ns sch-link $n1 $n3 5Mb 2ms 10 f { t i 0} {$i $ } {i i} {for {set i 0} {$i < $num_queues} {incr i} {
$ns add-flow $n1 $n3 $i set tcp($i) [new Agent/TCP]; set sink($i) [new Agent/TCPSink] set ftp($i) [new Application/FTP] $ tt h t $ 1 $t ($i) $ tt h t $ 3 $ i k($i)$ns attach-agent $n1 $tcp($i);$ns attach-agent $n3 $sink($i) $ftp($i) attach-agent $tcp($i);$ns connect $tcp($i) $sink($i) $tcp($i) set fid_ $i $ns at 0.0 "$ftp($i) start"
}}proc show_tcp_seqno {} {
global tcp num_queues for {set i 0} {$i < $num_queues} {incr i} {
puts "The final tcp($i) sequence number isputs The final tcp($i) sequence number is [$tcp($i) set t_seqno_]"
} } $ns at 100.0 "show tcp seqno"
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
$ns at 100.0 show_tcp_seqno $ns at 100.1 "$ns halt" $ns run
60
![Page 61: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/61.jpg)
Si l i R lSimulation Results
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 61
![Page 62: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/62.jpg)
OutlineR• Recap
• Automatic Repeat reQuest• Packet Scheduling• SummarySummary
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 62
![Page 63: Developing New Modules in NSin NS2in NS2 - UBC ECEteerawat/publications/NS2/14-NewModules.pdf · Developing New Modules in NSin NS2in NS2 Textbook: T. Issariyakul and E. Hossain,](https://reader033.fdocuments.in/reader033/viewer/2022051509/5ad6d6187f8b9a991b8b5a8a/html5/thumbnails/63.jpg)
SSummary• Design and ImplementationDesign and Implementation
– Determine what to doDraw a conceptual view– Draw a conceptual view
– OTcl Main componentsC I t l M h i– C++ Internal Mechanism
• Example– Automatic Repeat reQuest– Packet Scheduling Round Robin
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 63