Professional Documents
Culture Documents
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
Outline
A Application li ti O Overview i Two Derived Classes
Traffic Generator Simulated Application
Summary
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
A li i Application
2. Simulated applications
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
NS2 Implementation I l i
C++ Class Application Main variables: agent_
// /ns/apps/app.h //~/ns/apps/app h class Application : public Process { public: Application(); virtual void send(int nbytes); virtual void recv(int nbytes); virtual void resume(); protected: virtual void start(); virtual void stop(); Agent *agent agent_; ; int enableRecv_;int enableResume_; };
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
recv(nbytes) y :
Be informed that nbytes are received. Invoked by an Agent object.
resume() ():
Invoked by sending agent when it has sent out all its packets
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
Outline
A Application li ti O Overview i Two Derived Classes
Traffic Generator Simulated Application
Summary
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
Pareto On/OFF
CBR During ON; Stop during OFF On/Off period is exp. Distb.
Traffic Trace
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
10
11
Meaning A TrafficTimer object, object which determines when a new burst of payload is created. Simulation time that the next payload will be passed to the attached transport layer agent Application payload size True rue if f the TrafficGenerator object is s running
12
nextPkttime nextPkttime_
size_ running_
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
Meaning - Pure virtual - Input = size - Return the time till the next payload is generated. generated - Initializes the traffic generator - Does nothing in this class. -Sends a user payload to the attached application timer . - Restart timer_ - Invoked when timer_ expires
13
init()
timeout()
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
14
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
15
16
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
17
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
18
19
Outline
A Application li ti O Overview i Two Derived Classes
Traffic Generator Simulated Application
Summary
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
20
Si l Simulated dA Application li i
No predefined schedule Act as if the application is running E Example: l FTP and d Telnet T l Let focus on FTP
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
21
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
22
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
23
Summary
Appl Applications: cat ons The he ma main n purpose = ( Indicate user demand ) Two derived classes
Traffic generator (e.g., CBR ) Simulated Si l d application li i ( (e.g., FTP )
Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.
24