Network Simulation Tools Now a days lots of networking simulation tools are introduced and used by the students and researchers. From that ns3 is one network simulation tool.
- Ns3 Aim is to replace venerable network simulator-2.
- It’s a community-oriented open source developments and integration of open source tools and software
Ns3 script structure:
- Boilerplate : important for documentation
- Modules includes: include header files
- Ns-3 namespace: global declaration
- Logging: optional
- Main function: declare main function
- Topology helpers: objects to combine distinct operations
- Applications: on/off applications, UdpEchoClient/Server
- Tracing: .tr and/or .pcap files
- Simulator: start/end simulator, cleanup.
Event handler in NS-3:
- Network Simulation Tools uses a template member function pointer to achieve type–safe and flexible event handlers.
- Sample code defining event handler:
template <typename MEM, typename OBJ, typename T1, typename T2, typename T3>
static EventId schedule (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
- From that mem_ptr is that function pointer and obj is the object that has function mem_ptr.
- A1, a2, and a3 are all variables of any type.
- Similar schedule function is defined for non-member functions for handlers.