AODV Protocol in NS2

What is AODV?How routes are build in AODV Protocol?

AODV is Referred as AN ON Demand Algorithm.AODV builds routes between nodes when source nodes desires.AODV Protocol maintains routes between source and destination as long as required by source nodes.Building route in AODV follows route request / route reply query cycle.


Merits of AODV Protocol using NS2:

AODV Protocol reacts very fast with any topological changes in a network and changes node only when are affected.Energy as well as storage space are saved in AODV protocol in NS2.It does not require any main administrative system for controlling the routing process.If a node has to choose between two routes, the up-to-date route with a greater destination sequence number is always chosen.Hello messages supporting the routes maintenance are range-limited.

Architecture of AODV Protocol:

Sample NS2 code for AODV Routing Protocol

int hdr_aodv::offset_;
static class aodvHeaderClass : public PacketHeaderClass {
public: aodvHeaderClass() : PacketHeaderClass("PacketHeader/aodv",
														sizeof(hdr_all_aodv)) {
} class_rtProtoaodv_hdr;

static class aodvclass : public TclClass {
	aodvclass() : TclClass("Agent/aodv") {}
	TclObject* create(int argc, const char*const* argv) {
		assert(argc == 5);
		return (new aodv((nsaddr_t) Address::instance().str2addr(argv[4])));
} class_rtProtoaodv;

aodv::command(int argc, const char*const* argv) {
	if(argc == 2) {
		Tcl& tcl = Tcl::instance();
		if(strncasecmp(argv[1], "id", 2) == 0) {
			tcl.resultf("%d", index);
			return TCL_OK;
		if (strncasecmp(argv[1], "dump-table", 10) == 0) {
			printf("Node %d: Route table:\n", index);
			return TCL_OK;
		if(strncasecmp(argv[1], "start", 2) == 0) {
			btimer.handle((Event*) 0);
			htimer.handle((Event*) 0);
			ntimer.handle((Event*) 0);
			rtimer.handle((Event*) 0);
			return TCL_OK;

Journal Support for NS2 Projects: