Vous êtes sur la page 1sur 77

CHAPTER 1

INTRODUCTION
1.1 GENERAL
The need to exchange digital information outside the typical wired office
environment is growing. For example, a class of students may need to interact during
a lecture; business associates meeting in an airport may wish to share files; or
disaster recovery personnel may need to coordinate relief information after a
hurricane or flood. Each of the devices used by these information producers and
consumers can be considered a node in an Ad-hoc network. In the last couple of
years, the use of wireless networks has become more and more popular. There exist
three types of mobile wireless networks infrastructure networks, !d"hoc networks
and hybrid networks which combine infrastructure and !d"hoc aspects.
#ith recent performance advancements in computer and wireless communications
technologies, advanced mobile wireless computing is expected to see increasingly
widespread use and application, much of which will involve the use of the Internet
$rotocol %I$& suite. The vision of mobile ad hoc networking is to support robust and
efficient operation in mobile wireless networks by incorporating routing
functionality into mobile nodes. 'uch networks are envisioned to have dynamic,
sometimes rapidly"changing, random, multihop topologies which are likely
composed of relatively bandwidth"constrained wireless links.!n infrastructure
network consists of wireless mobile nodes and one or more bridges, which connect
the wireless network to the wired network. These bridges are called base stations.
In contrary to infrastructure networks, an !d"hoc network lacks any infrastructure.
There are no base stations, no fixed routers and no centrali(ed administration. !ll
nodes may move randomly and are connecting dynamically to each other. The
technology of )obile !d hoc *etworking is somewhat synonymous with )obile
$acket +adio *etworking %a term coined via during early military research in the
,-.s and /-.s&, )obile )esh *etworking %a term that appeared in an article in The
Economist regarding the structure of future military networks& and )obile,
0
)ultihop, #ireless *etworking %perhaps the most accurate term, although a bit
cumbersome&. There is current and future need for dynamic ad hoc networking
technology.
! hybrid network combines both aspects described before. It makes use of any
available base stations while it also supports infrastructure less communication.
!n embedded sensor network is a network of embedded computers placed in the
physical world that interacts with the environment. These embedded computers, or
sensor nodes, are often physically small, relatively inexpensive computers, each with
some set of sensors or actuators. These sensor nodes are deployed in situation,
physically placed in the environment near the ob1ects they are sensing. 'ensor nodes
are networked, allowing them to communicate and cooperate with each other to
monitor the environment and %possibly& effect changes to it. 2urrent sensor networks
are usually stationary, although sensors may be attached to moving ob1ects or may
even be capable of independent movement. These characteristics being embedded,
and being capable of sensing, actuation, and the ability to communicate, define the
field of sensor networking and differentiate from it from remote sensing, mobile
computing with laptop computers and traditional centrali(ed sensing systems.
'ensor networks 3045 present challenges in three key areas. First, energy
consumption is a common problem in sensor network design. 'ensors are often
battery operated and placed in remote locations, so any activity drains the sensor
battery, and bringing the node closer to death 305. 'econd, how sensors sense and
interact with the physical world is of great interest. 'ensor networks focus on
collaborative signal processing algorithms to exploit multiple, physically separate
views on the environment. Finally, with tens, hundreds, or even thousands of sensor
nodes, the network and applications as a whole must be self"configuring.
1.2 MANETs
)!*ETs are the collection of wireless nodes that can dynamically form a network
anytime and anywhere to exchange information without using any pre"existing
fixed network infrastructure. It is an autonomous system in which mobile hosts
connected by wireless links are free to move randomly and often act as routers at
the same time. This is a very important part of communication technology that
6
supports truly pervasive computing, because in many contexts information
exchange between mobile units cannot rely on any fixed network infrastructure, but
on rapid configuration of a wireless connections on"the"fly. )!*ETs themselves
are an independent, wide area of research and applications, instead of being only
1ust a complement of the cellular system. )obile !d"7oc *etworks %)!*ETs& are
wireless networks that continually re"organi(e themselves in response to their
environment without the benefit of a pre"existing infrastructure. ! )!*ET
consists of a set of mobile participants who must communicate, collaborate, and
interact to complete an assigned mission. The challenges of )!*ETs are to
provide wireless, high"capacity, secure, and networked connectivity. $articipants
must communicate using bandwidth limited wireless links with potential
intermittent connectivity, as compared to stable wired links and infrastructure.
)!*ETs are a key enabler for achieving the goals of net"centric operations and
warfare; they provide the right information at the right place at the right time.
! )!*ET consists of mobile platforms %e.g., a router with multiple hosts and
wireless communications devices&""herein simply referred to as 8nodes8""which are
free to move about arbitrarily. The nodes may be located in or on airplanes, ships,
trucks, cars, perhaps even on people or very small devices, and there may be
multiple hosts per router. ! )!*ET is an autonomous system of mobile nodes.
The system may operate in isolation, or may have gateways to and interface with a
fixed network.
)!*ET nodes are e9uipped with wireless transmitters and receivers using
antennas which may be omnidirectional %broadcast&, highly" directional %point"to"
point&, possibly steerable, or some combination thereof. !t a given point in time,
depending on the nodes positions and their transmitter and receiver coverage
patterns, transmission power levels and co"channel interference levels, a wireless
connectivity in the form of a random, multihop graph or 8ad hoc8 network exists
between the nodes. This ad hoc topology may change with time as the nodes move
or ad1ust their transmission and reception parameters.
:
1.3 MANET PROTOCOL DESIGN IS ATTRACTIVE
The following issues make the protocol design for )!*ETs an attractive proposition.
;arge variation of performance due to various environment inputs is a ma1or
impediment of implementing existing routing protocols for )!*ET in the
battlefield. Therefore, it is a ma1or challenge to design a routing protocol that
can adapt its behavior to environment alteration.
'ome or all of the nodes in a )!*ET may rely on batteries or other
exhaustible means for their energy. For these nodes, the most important
system design criteria for optimi(ation may be energy conservation.
*odes are free to move arbitrarily; thus, the network topology which is
typically multihop may change randomly and rapidly at unpredictable times,
and may consist of both bidirectional and unidirectional links.
#ireless links will continue to have significantly lower capacity than their
hardwired counterparts. In addition, the reali(ed throughput of wireless
communications""after accounting for the effects of multiple access, fading,
noise, and interference conditions, etc.""is often much less than a radio.s
maximum transmission rate.
)obile wireless networks are generally more prone to physical security
threats than are fixed" cable nets. The increased possibility of eavesdropping,
spoofing, and denial"of"service attacks should be carefully considered.
Existing link security techni9ues are often applied within wireless networks
to reduce security threats. !s a benefit, the decentrali(ed nature of network
control in )!*ETs provide additional robustness against the single points of
failure of more centrali(ed approaches.
)!*ETs are also used in many areas like military operations, disasters
conditions, remote areas where it is very tough to set up a network. 'o there
are lots of possibilities to design a routing protocol.
1.4 TESTING THE MANET PROTOCOLS
There are many tools available for testing the )!*ET routing protocols. These
tools help in getting the authenticated output for the routing protocols. !lso these
<
tools help in comparing the results of various routing protocols. 'o it is very easy
to compare the routing protocols graphically. =ut one problem with these tools is
that it is very tough to augment 2>> code on these tools. It is very hard to
understand the concept used in these tools and how different files are linked to
each other.
1.5 NEED FOR ROUTING PROTOCOL IMPLEMENTATION AND
AUGMENTATION
The existing tools have several drawbacks"
2odes used for protocol implementation in existing simulators are very lengthy
and tough.
It contains many files and lot of header files for one protocol implementation.
'o there is need to design a routing implementation that coding is of few lines
and easily understandable.
It is very tough to understand how files are linked to each other.
1.6 THE OBJECTIVE
The ob1ective of proposed work is to propose a protocol and design its basic
structure in 2>> and study its performance on various inputs. The purpose of this
proposed work is to gain familiarity with a network simulation tool and to get
experience in basic data analysis. !nalysis the output of the designed routing
protocol and draw the graphs of the various outputs. ! simulation can be very useful
because it is possible to scale the networks easily and therefore to eliminate the need
for time consuming and costly real world experiments. #hile the simulator is a
powerful tool, it is important to remember that the ability to do predictions about the
performance in the real world is dependent on the accuracy of the models in the
simulator.The proposed protocol can 9uickly find a local routing path from a source
node to destination node .
1.7 ORGANIZATION OF THESIS
The thesis work has been organi(ed as follows
2hapter 6 provides an overview of ad hoc wireless networks, its features, its
application and issues in ad hoc wireless networks.
2hapter : provides an overview of different types of ad hoc wireless networks
routing protocols.
?
2hapter < discusses the existing simulator like *'6 and @ualnet and the problems
associated with these existing simulators.
2hapter ? provides discussion on the achievement of proposed work that shows the
implementation of routing protocol in 2>>, its class diagram and graphs of the
outputs.
2hapter A provides conclusion and future scope.
A
CHAPTER 2
AN OVERVIE OF AD HOC IRELESS NETOR!
2.1 INTRODUCTION
!d hoc wireless network 36, :05 is defined as a collection of mobile platforms or nodes
where each node is free to move. Each node is logically consisting of a router that may
have multiple hosts and that also may have multiple wireless communications devices.
!d hoc wireless networks 30?5 are defined as the category of wireless networks that
utili(e multi"hop radio relaying and are capable of operating without the support of any
fixed infrastructure. The absence of any central coordinator or base station makes the
routing a complex one compared to cellular networks. Fig. 6.0 shows the path setup for a
call between two nodes, say, node 2 to node E, is completed through the intermediate
mobile node F.
Fig. 6.6 shows an ad hoc wireless network in which there are no base stations, no fixed
routers and no centrali(ed administration. !ll nodes may move randomly and are
connecting dynamically to each other. Therefore all nodes are operating as routers and
need to be capable to discover and maintain routes to every other node in the network and
to propagate packets accordingly.
Fig 6.: shows a infrastructure based network that consists of wireless mobile nodes and
one or more bridges, which can connect the wireless network to the wired network. These
,
F
F"#. 2.1 A$ A% &'( ")*+*ss N*,-'). s&'-"$# /0,& s*,1/ 2*,-**$ $'%*s C
0$% E
E
2
bridges are called base stations. ! mobile node within the network searches for the
nearest base station %e.g. the one with the best signal strength&, connects to it and
communicates with it. The important fact is that all communication is taking place
between the wireless node and the base station but not between different wireless nodes.
#hile the mobile node is traveling around and all of a sudden gets out of range of the
current base station, a handover to a new base station will let the mobile node
communicate seamlessly with the new base station.
F"#. 2.2 I$3)0s,)1(,1)* +*ss -")*+*ss $*,-').s F"#. 2.3 I$3)0s,)1(,1)* 20s*% $*,-').s
Fig. 6.< shows a simple !d"hoc network with three nodes. The outermost nodes are not
within transmitter range of each other. 7owever the middle node can be used to forward
packets between the outermost nodes. The middle node is acting as a router and the three
nodes have formed an !d"hoc network.
F"#. 2.4 E405/+* '3 0 s"5/+* A%6&'( $*,-'). -",& ,&)** /0),"("/0,"$# $'%*s
2.2 AD HOC IRELESS NETOR! FEATURES
!n ad hoc wireless network has the following features3<,, </5
A1,'$'5'1s T*)5"$0+7 6 In ad hoc wireless network; each mobile terminal is
an autonomous node, which may function as both a host and a router. In other
/
base station
!
2
=
words, besides the basic processing ability as a host, the mobile nodes
can also perform switching functions as a router. 'o usually endpoints and
switches are indistinguishable in ad hoc wireless network.
D"s,)"21,*% O/*)0,"'$76 'ince there is no background network for the central
control of the network operations, the control and management of the network is
distributed among the terminals. The nodes involved in an ad hoc wireless
network should collaborate amongst themselves and each node acts as a
relay as needed, to implement functions e.g. 'ecurity and routing.
M1+,"&'/ R'1,"$#76 =asic types of !d"hoc routing algorithms can be single"hop
and multi"hop, based on different link layer attributes and routing protocols.
'ingle"hop ad hoc wireless network is simpler than multi"hop in terms of
structure and implementation, with the cost of lesser functionality and
applicability. #hen delivering data packets from a source to its destination out of
the direct wireless transmission range, the packets should be forwarded via one
or more intermediate nodes.
D8$05"( N*,-'). T'/'+'#876 'ince the nodes are mobile, the network
topology may change rapidly and unpredictably and the connectivity among
the terminals may vary with time. !n ad hoc wireless network should adapt to
the traffic and propagation conditions as well as the mobility patterns of the
mobile network nodes. The mobile nodes in the network dynamically establish
routing among themselves as they move about, forming their own network on the
fly. )oreover, a user in the ad hoc wireless network may not only operate within
the !d"hoc network, but may re9uire access to a public fixed network %e.g.
Internet&.
F+1(,10,"$# L"$. C0/0(",876 The nature of high bit"error rates of wireless
connection might be more profound in an ad hoc wireless network. Bne end"to"
end path can be shared by several sessions. The channel over which the terminals
communicate is sub1ect to noise, fading, and interference, and has less
bandwidth than a wired network. In some scenarios, the path between any pair
of users can traverse multiple wireless links and the link themselves can be
4
heterogeneous.
L"#&,6*"#&, T*)5"$0+s76 In most cases, the ad hoc wireless network nodes are
mobile devices with less 2$C processing capability, small memory si(e, and low
power storage. 'uch devices need optimi(ed algorithms and mechanisms that
implement the computing and communicating functions.
2.3 APPLICATIONS OF AD HOC IRELESS NETOR!S
!dhoc wireless networks have following applications"
M"+",0)8 A//+"(0,"'$s76 !n ad hoc wireless network can be very useful in the
establishing communication among a group of soldiers for tactical operations.
'etting up a fixed infrastructure for communication among a group of soldiers in
enemy territories or in inhospitable terrains may not be possible. In such
environments, ad hoc wireless networks provide the re9uired communication
mechanism 9uickly. !nother application in this area can be the coordination of
military ob1ects moving at high speed such as fleets of airplanes or warships. 'uch
applications re9uire 9uick and reliable communication. The ad hoc wireless
network formed by a fleet of military tanks may not suffer from the power source
constraints present in the ad hoc network formed by a set of wearable devices
used by the foot soldiers. The primary nature of the communication re9uired in a
military environment enforces certain important re9uirement on ad hoc wireless
networks, namely, reliability, efficiency, secure communication and support for
multicast routing.
C'++02')0,"9* 0$% %"s,)"21,*% C'5/1,"$#762onsider a group of researchers
who want to share their research findings or presentation materials during a
conference, or a lecturer distributing notes to the class on the fly. In such cases,
the formation of an ad hoc wireless network with the necessary support for
reliable multicast routing can serve the purpose. The distributed file sharing
applications utili(ed in such stations do not re9uire the level of security expected
in a military environment. =ut the reliability of data transfer is of high
importance. 2onsider the example where a node that is part of an ad hoc wireless
network has to distribute a file to other nodes in the network.
0-
E5*)#*$(8 O/*)0,"'$s76 !d hoc wireless networks are very useful in emergency
operations such as search and rescue, crowd control and commando operations.
The ma1or factors that favor ad hoc wireless networks for such tasks are self"
configuration of the system with minimal overhead , independent of fixed or
centrali(ed infrastructure, the nature of the terrain of such applications, the
freedom and flexibility of mobility and the unavailability of conventional
communication infrastructure. In environments where the conventional
infrastructure based communication facilities are destroyed due to war or due to
natural calamities such as earth9uakes, immediate deployment of ad hoc wireless
networks would be a good solution for coordinating rescue activities.
2.4 Iss1*s "$ A% H'( ")*+*ss N*,-').s
Following issues are involved in ad hoc wireless network"
M*%"15 A((*ss S(&*5*76The primary responsibility of a medium access control
%)!2& protocol in ad hoc wireless networks is the distributed arbitration for the
shared channel for transmission of packets. The performance of any wireless
network hinges on the )!2 protocol, more so for ad hoc wireless networks. The
ma1or issues to be considered in designing a )!2 protocol for ad hoc wireless
networks are as follows
D"s,)"21,*% '/*)0,"'$76The ad hoc wireless networks need to operate in
environments where no centrali(ed coordination is possible. The )!2
protocol design should be finally distributed involving minimum control
overhead. In the case of polling"based )!2 protocols, partial coordination is
re9uired.
S8$(&)'$":0,"'$76 The )!2 protocol design should take into account the
re9uirement of time synchroni(ation. 'ynchroni(ation is mandatory for
TD)!"based systems for management of transmission and reception slots.
'ynchroni(ation involves usage of scarce resources such as bandwidth and
battery power. The control packets used for synchroni(ation can also increase
collisions in the network.
H"%%*$ ,*)5"$0+s76 7idden terminals are nodes that are hidden from the
sender of data transmission session, but are reachable to the receiver of the
00
session. In such cases, the hidden terminal can cause collisions at the receiver
node. The presence of hidden terminals can significantly reduce the throughput
of a )!2 protocol used in ad hoc wireless networks. 7ence the )!2 protocol
should be able to alleviate the effects of hidden terminals.
E4/'s*% ,*)5"$0+s7 6 Exposed terminals, the nodes that are in the transmission
range of the sender of an on"going session, are prevented from making a
transmission. In order to improve the efficiency of the )!2 protocol, the
exposed nodes should be allowed to transmit in a controlled fashion without
causing collision to the on"going data transfer.
A((*ss D*+087 6 The access delay refers to the average delay that any packet
experiences to get transmitted. The )!2 protocol should attempt to minimi(e
the delay.
R'1,"$#7 The responsibilities of a routing protocol includes exchanging the route
information; finding a feasible path to a destination based on criteria such as hop
length, minimum power re9uired , and lifetime of the wireless links; gathering
information about the path breaks; mending the broken paths expending minimum
processing power and bandwidth; and utili(ing minimum bandwidth. The ma1or
challenges that a routing protocol faces are as follows
M'2"+",87 Bne of the most important properties of ad hoc wireless networks is
the mobility associated with the nodes. The mobility of nodes results in the
fre9uent path breaks, packet collisions, transient loops, stale routing
information, and difficulty in resource reservation. ! good routing protocol
should be able to efficiently solve all the above issues
B0$%-"%,& C'$s,)0"$,7 'ince the channel is shared by all nodes in the
broadcast region, the bandwidth available per wireless link depends on the
number of nodes and the traffic they handle. Thus only a fraction of the total
bandwidth is available for every node.
L'(0,"'$ %*/*$%*$, ('$,*$,"'$7 The load on the wireless channel varies with
the number of nodes present in a given geographical region. This makes the
contention for the channel high when the number of nodes increases. The high
contention for the channel results in a high number of collisions and a
06
subse9uent wastage of bandwidth. ! good routing protocol should have built"
in mechanisms for distributing the network load uniformly across the network
so that the formation of regions where channel contention is high can be
avoided.
The ma1or re9uirements of a routing protocol in ad hoc wireless networks are the
following
M"$"515 )'1,* 0(;1"s","'$ %*+087 The route ac9uisition delay for a node
that does not have a route to a particular destination node should be as minimal
as possible. This delay may vary with the si(e of the network and the network
load.
<1"(. )'1,* )*('$3"#1)0,"'$7 The unpredictable changes in the topology of
the network re9uire that the routing protocol be able to 9uickly perform route
reconfiguration in order to handle path breaks and subse9uent packet losses.
L''/ 3)** )'1,"$#7 This is a fundamental re9uirement of any routing protocol
to avoid unnecessary wastage of the network bandwidth. In ad hoc wireless
networks, due to the random movement of nodes, transient loops may form in
the route thus established. ! routing protocol should detect such transient
routing loops and take corrective actions.
D"s,)"21,*% )'1,"$# 0//)'0(&7 !n ad hoc wireless network is a fully
distributed wireless network and the use of centrali(ed routing approaches in
such a network may consume a large amount of bandwidth.
M"$"515 ('$,)'+ '9*)&*0%7 The control packets exchanged for finding a
new route and maintaining existing routes should be kept as minimal as
possible. The control packets consume precious bandwidth and can cause
collisions with data packets, thereby reducing network throughput.
S(0+02"+",87 'calability is the ability of the routing protocol to scale well in a
network with a large number of nodes. This re9uires minimi(ation of control
overhead and adaptation of the routing protocol to the network si(e.
S1//'), 3') ,"5*6s*$s","9* ,)033"(7 Tactical communications and similar
applications re9uire support for time"sensitive traffic. The routing protocol
should be able to support both hard real"time and soft real"time traffic.
0:
S*(1)",8 0$% /)"90(87 The routing protocol must be resilient to threats
and vulnerabilities. It must have inbuilt capability to avoid resource
consumption, denial of service, impersonation and similar attacks possible
against an ad hoc wireless network.
P)"("$# S(&*5*7 !n ad hoc wireless networkEs functioning depends on the presence
of relaying nodes and their willingness to relay other nodes traffic. Even if node
density is sufficient enough to ensure a fully connected network, a relaying neighbor
node may not be interested in relaying a call and may 1ust decide to power down.
!ssume that an optimal route from node ! to node = passes through node 2, and
node 2 is not powered on. Then node ! will have to set up a costlier and non
optimal route to =. The non optimal path consumes more resources and affects the
throughput of the system. !s the intermediate nodes in a path that relay the data
packets expend their resources such as battery charge and computing power, they
should be properly compensated. 7ence pricing scheme that incorporate service
compensation or service reimbursement are re9uired. !d hoc wireless networks
employed for special tasks such as military missions, rescue operations, and law
enforcement do not re9uire such pricing schemes, whereas the successful
commercial deployment of ad hoc wireless networks re9uire billing and pricing. The
obvious solution to provide participation guarantee is to provide incentives to
forwarding nodes.
S*(1)",87 The security of communication in ad hoc networks is very important,
especially in military applications. The lack of any central coordination and shared
wireless medium makes them more vulnerable to attacks than wired networks. The
attacks against ad hoc wireless networks are generally classified into two types
$assive and !ctive attacks. $assive attacks refer to the attempts made by malicious
nodes to perceive the nature of activities and to obtain information transacted in the
network during without disrupting the operation. !ctive attacks disrupt the operation
of the network. Those active attacks that are executed by nodes outside the network
are called external attacks, and those that are performed by nodes belonging to the
same network are called internal attacks. *odes that perform internal attacks are
0<
compromised nodes. The ma1or security threats that exist in ad hoc wireless networks
are as follows
D*$"0+ '3 s*)9"(*7 The attack affected by making the network resource
unavailable for service to other nodes, either by consuming the bandwidth or by
overloading the system. is known as denial of service. ! simple scenario in
which a Do' attack interrupts the operation of ad hoc wireless networks is by
keeping a target node busy by making it process unnecessary packets.
R*s'1)(* ('$s15/,"'$7 The scarce availability of resources in ad hoc
wireless network makes it an easy target for internal attacks, particularly aiming
at consuming resources available in the network. The ma1or types of resource"
consumption attacks are the following
E$*)#8 %*/+*,"'$7 'ince the nodes in the ad hoc wireless networks are
highly constrained by the energy source, this type of attack is basically
aimed at depleting the battery power of critical nodes by directing
unnecessary traffic through them.
B133*) '9*)3+'-7 The buffer overflow attack is carried out either by
filling the routing table with unwanted routing entries or by consuming the
data packet buffer space with unwanted data. 'uch attacks can lead to a
large number of data packets being dropped, leading to the loss of critical
information. +outing table attacks can lead to many problems, such as
preventing a node from updating route information for important
destinations and filling the routing table with routes for non existent
destinations.
H's, "5/*)s'$0,"'$7! compromised internal node can act as another
node and respond with appropriate control packets to create wrong route
entries, and can terminate the traffic meant for the intended destination
node.
I$3')50,"'$ %"s(+'s1)*7 ! compromised node can act as an informer by
deliberate disclosure of confidential information to unauthori(ed nodes.
Information such as the amount and the periodicity of traffic between a
selected pair of nodes and pattern of traffic changes can be very valuable
0?
for military applications. The use of filler traffic may not be suitable in
resource"constrained ad hoc wireless networks.
CHAPTER 3
AD6HOC IRELESS NETOR! ROUTING PROTOCOLS
!n ad hoc wireless network 30A5 consists of a set of mobile nodes %hosts& that are
connected by wireless links. 'ince nodes in ad hco wireless are mobile, network topology
in such a network may changes fre9uently. The routing protocols used in traditional
wired networks can not be used for ad hoc wireless networks due to their highly dynamic
topology, absence of established infrastructure for centrali(ed administration, bandwidth
constrained wireless links, and resource %energy& constrained nodes. The various issues
involved in routing protocol are discussed in the next section.
3.1 ISSUES AND CHALLENGES IN DESIGNING A ROUTING
PROTOCOL
The ma1or challenges 3:, 0:, 6-, 60, <:, <?5 that a routing protocol designed for ad hoc
wireless networks faces are"
M'2"+",8
The network topology in an ad hoc wireless network is highly dynamic 30,, 0/5 due to
the movement of nodes; hence an on"going session suffers fre9uent path breaks.
Disruption occur either due to the movement of the intermediate nodes in the path or due
to the movement of end nodes. 'uch situations do not arise because of reliable links in
wired networks where all the nodes are stationary. Even though the wired network
protocols find alternate routes during path breaks, their convergence is very slow.
Therefore, wired network routing protocol can not be used in ad hoc wireless networks
where the mobility of nodes results in the fre9uently changing network topologies.
+outing protocols for ad hoc wireless networks must be able to perform efficient and
effective mobility management.
B0$%-"%,& ('$s,)0"$,s
!bundant bandwidth is available in wired networks due to the advent of fiber optics and
due to the exploitation of wavelength division multiplexing %#D)& technologies. =ut in
a wireless network, the radio band is limited and hence the data rates it can offer are
0A
much less than what a wired network can offer. This re9uires that the routing protocols
use the bandwidth optimally by keeping the overhead as low as possible. The limited
bandwidth availability also imposes a constraint on routing protocols in maintaining the
topological information. Due to the fre9uent changes in topology, maintaining consistent
topological information at all the nodes involves more control overhead which, in turn,
results in more bandwidth wastage. !s efficient routing protocols in wired networks
re9uire the complete topology information, they may not be suitable for routing in the ad
hoc wireless networking environment.
E))') /)'$* s&0)*% 2)'0%(0s, )0%"' (&0$$*+
The broadcast nature of the radio channel poses a uni9ue challenge in ad hoc wireless
networks. The wireless links have time"varying characteristics in terms of link capacity
and link error probability. This re9uires that the ad hoc wireless network routing protocol
interacts with the )!2 layer to find alternate routes through better"9uality links. !lso,
transmissions in ad hoc wireless networks result in collisions of data and control packets.
This is attributed to the hidden terminals problem. Therefore, it is re9uired that ad hoc
wireless network routing protocols find paths with less congestion.
R*s'1)(* ('$s,)0"$,s
Two essential and limited resources that form the ma1or constraint for the nodes in ad hoc
wireless network are battery life and processing power. Devices used in ad hoc wireless
networks in most cases re9uire portability, and hence they also have si(e and weight
constraints along with the restrictions on the power source. Increasing the battery power
and processing ability makes the nodes bulky and less portable. Thus ad hoc wireless
network routing protocols must optimally manage these resources.
3.2 CHARACTERISTICS OF AN IDEAL ROUTING PROTOCOL
FOR AD HOC IRELESS NETOR!S
The issues described above restrict wired routing protocol to work efficiently in wireless
scenario.7ence ad hoc wireless networks re9uire speciali(ed routing protocols that
address the challenges described above. ! routing protocol for ad hoc wireless networks
should have the following characteristics 3<, 06, 64, :65
0,
It must be fully distributed, as centrali(ed routing involves high control overhead
and hence is not scalable. Distributed routing is more fault"tolerant than
centrali(ed routing, which involves the risk of single point of failure.
It must be adaptive to fre9uent topology changes caused by the mobility of nodes.
+oute computation and maintenance must involve a minimum number of nodes.
Each node in the network must have 9uick access to routes, that is, minimum
connection setup time is desired.
It must be locali(ed, as global state maintenance involves a huge state propagation
control overhead.
It must be loop"free and free from stale routes.
The number of packet collisions must be kept to a minimum by limiting the
number of broadcasts made by each node. The transmission should be reliable to
reduce message loss and to prevent the occurrence of stale routes.
It must be convergence to optimal routes once the network topology becomes
stable. The convergence must be 9uick.
It must optimally use scarce resources such as bandwidth, computing power,
memory and battery power.
Every node in the network should try to store information regarding the stable
local topology only. Fre9uent changes in local topology and changes in the
topology of parts of the network with which the node does not have any traffic
correspondence , must not in any way affect the node, that is, changes in remote
parts of the network must not cause updates in the topology information
maintained by the node.
It should be able to provide a certain level of 9uality of service as demanded by
the applications, and should also offer support for time sensitive traffic.
3.3 CLASSIFICATIONS OF ROUTING PROTOCOLS
The routing protocol for ad hoc wireless networks 3:-, <6, <A, <4 , ?-5 are classified
as"
T02+* D)"9*$ R'1,"$# P)','('+s
These protocols are extensions of the wired network routing protocols. They
maintain the global topology information in the form of tables at every node.
0/
These tables are updated fre9uently in order to maintain consistent and accurate
network state information.
D"s,0$(* S*;1*$(*% D"s,0$(* V*(,') =DSDV> R'1,"$# P)','('+
D'DF 3?, :?5 is one of the first protocols proposed for ad hoc wireless
networks. It is enhanced version of the distributed =ellman"Ford algorithm
where each node maintains a table that contains the shortest distance and the
first node on the shortest path to every other node in the network. It
incorporates table updates with increasing se9uence number tags to prevent
loops, to counter the count"to"infinity problem, and for faster convergence.
!s it is a table driven routing protocol, routes to all destinations are readily
available at every node at all times. The tables are exchanged between
neighbors at regular intervals to keep an up"to"date view of the network
topology. The tables are also forwarded if a node observes a significant
change in local topology. The table updates are of two types " incremental
updates and full dumps. !n incremental update takes a single network data
packet unit %*D$C&, while a full dump may take multiple *D$Cs .
Incremental updates are used when a node does not observe significant
changes in local topology. ! full dump is done either when the local topology
changes significantly or when an incremental update re9uires more than a
single *D$C. Table updates are initiated by a destination with a new
se9uence number which is always greater than the previous one. Cpon
receiving an updated table, a node either updates its tables based on the
received information or holds it for some time to select the best metric %which
may be the lowest number of hops& received from multiple version of the
same update table from different neighboring nodes. =ased on the se9uence
number of the table update, it may forward or re1ect the table.
2onsider the example as shown in Fig. :.0.7ere node 0 is the source node and
node 0? is the destination. !s all the nodes maintain global topology
information, the route is already available as shown in Fig. :.0. 7ere the
routing table of node 0 indicates that the shortest route to the destination node
%node 0?& is available through node ? and the distance to it is < hops, as
04
depicted in Table :.0. The reconfiguration of a path used by an on"going data
transfer session is handled by the protocol in the following way. The end node
of the broken link initiates a table update message with the broken linkEs
weight assigned to infinity and with a se9uence number greater than the stored
se9uence number for that destination.


6-
Dest *ext*ode Dist 'e9*o
6 6 0 66
: 6 6 6A
< ? 6 :6
? ? 0 0:<
A A 0 0<<
, 6 : 0A6
/ ? : 0,-
4 6 < 0/A
0- A 6 0<6
00 A : 0,A
06 ? : 04-
0: ? < 04/
0< A : 60<
G0? ? < 6?A
F"#. 3.1 T'/'+'#8 #)0/& '3 ,&* $*,-'). "$ DSDV
T02+* 3.1 R'1,"$# ,02+* 3') $'%* 1
Destination ID
'ource ID
/
0
-
4
0
?
:
<
,
0
6
0
:
6
?
A
0
0
0
0
<
Each node, upon receiving an update with weight infinity, 9uickly disseminates
it to its neighbors in order to propagate the broken link information to the
whole network. Thus a single link break leads to the propagation of table
update information to the whole network. ! node always assign an odd
se9uence number to the link break update to differentiate it from the even
se9uence number generated by the destination.
2onsider the case when node 00 moves from its current position, as shown in
Fig :.6. #hen a neighbor node perceives the link break, it sets the entire path
passing through the broken link with distance as infinity. For example, when
node 0- knows about the link break, it sets the path to node 00 as infinity and
broadcasts its routing table to its neighbors. Those neighbors detecting
significant changes in their routing tables rebroadcast it to their neighbors. In
this way, the broken link information propagates throughout the network. *ode
0 also sets the distance to node 00 as infinity. #hen node 0< receives a table
update message from node 00, it informs the neighbors about the shortest
distance to node 00. This information is also propagated throughout the
network. !ll nodes receiving the new update message with the higher se9uence
number set the new distance to node 00 in their corresponding tables. The
updated table at node 0 is shown in Table :.6, where the current distance from
node 0 to node 00 has increased from three to four hops.
60
*ode
)ovement
Destination ID
'ource ID
/
0-
4
0?
:
<
,
06
0:
6
?
A
0
00
0<
00



F"#. 3.2 R'1,* 50"$,*$0$(* #)0/& "$ DSDV
66
Dest *ext*ode Dist 'e9*o
6 6 0 66
: 6 6 6A
< ? 6 :6
? ? 0 0:<
A A 0 0<<
, 6 : 0A6
/ ? : 0,-
4 6 < 0/A
0- A 6 0<6
G00 ? < 0/-
06 ? : 04-
0: ? < 04/
0< A : 60<
0? ? < 6?A
T02+* 3.2 R'1,* 50"$,*$0$(* ,02+* "$ DSDV
A%90$,0#*s
The availability of routes to all destinations at all times implies that
much less delay is involved in the route setup process. The mechanism
of incremental updates with se9uence number tags makes the existing
wired network protocols adaptable to ad hoc wireless networks. 7ence
an existing wired network protocol can be applied to ad hoc wireless
networks with many fewer modifications.
In this protocol se9uence number is used so that there is no loop exists.
D"s0%90$,0#*s
The updates are propagated throughout the network in order to maintain
an up"to"date view of the network topology at all the nodes. The updates
due to broken links lead to a heavy control overhead during high
mobility. Even a small network with high mobility or a large network
with low mobility can completely choke the available bandwidth. 7ence
this protocol suffers from excessive control overhead that is proportional
to the number of nodes in the network and therefore is not scalable in ad
hoc wireless networks, which have limited bandwidth and whose
topologies are highly dynamic.
+oute maintenance is costly.
RP
The wireless routing protocol %#+$& 3A5, similar to D'DF, inherits the
properties of the distributed =ellman"Ford algorithm. To counter the count"
to"infinity problem and to enable faster convergence, it employs a uni9ue
method of maintaining information regarding the shortest distance to every
destination node in the network and the penultimate hop node on the path to
every destination node. 'ince #+$, like D'DF, maintains an up"to"date
view of the network, every node has a readily available route to every
destination node in the network. It differs from D'DF in table maintenance
and in the update procedures. #hile D'DF maintains only one topology
6:
table, #+$ uses a set of tables to maintain more accurate information. The
tables that are maintained by a node are the following distance table %DT&,
routing table %+T&, link cost table %;2T&, and a message retransmission list
%)+;&. The DT contains the network view of the neighbors of a node. It
contains a matrix where each element contains the distance and the
penultimate node reported by a neighbor for a particular destination. The +T
contains the up"to"date view of the network for all known destinations. It
keeps the shortest distance, the predecessor node %penultimate node&, the
successor node %the next node to reach the destination&, and a flag indicating
the status of the path. The path status may not be a simple path %correct&, or a
loop %error&, or the destination node nor marked %null&. The ;2T contains the
cost %eg.The number of hops to reach the destination& of relaying the
messages through each link. The cost of a broken link is infinity. It also
contains the number of update periods %intervals between two successive
periodic updates& passed since the last successful was received from that link.
This is done to detect link breaks. The )+; contains an entry for every
update messages that is to be retransmitted and maintains a counter for each
entry. This counter is decremented after every retransmission of an update
message. Each update message contains a list of updates. ! node also marks
each node in the +T that has to acknowledge the update message it
transmitted. Bnce the counter reaches (ero, the entries in the update message
for which no acknowledgements have been received are to be retransmitted
and the update message is deleted. Thus, a node detects a link break by the
number of update periods missed since the last successful transmission. !fter
receiving an update message, a node not only updates the distance for
transmitted neighbors but also checks the other neighborEs distance, hence
convergence is much faster than D'DF. 2onsider the example shown in fig.
:.0 where the source of the route is node 0 and the destination is node 0?. !s
#+$ proactively maintains the route to all destinations, the route to any
destination node is readily available at the source node. From the routing
table shown in fig. :.0, the route from node 0 to node 0? has the next node as
6<
node 6. The predecessor node of 0? corresponding to this route is node 6.
The predecessor node of 0? corresponding to this route is node 06. The
predecessor information helps #+$ to converge 9uickly during the link
breaks. #hen a node detects a link breaks, it sends an update message to its
neighbors with the link cost of the broken link set to infinity. !fter receiving
the update message, all affected nodes update their minimum distances to the
corresponding nodes %including the distance to the destination&. The node
that initiated the update message then finds an alternative route, if available
from its DT. *ote that this new route computed will not contain the broken
link. 2onsider the scenario shown in fig.:.0 when the link between nodes 06
and 0? breaks, all nodes having a route to the destination with predecessor as
node 06 delete their corresponding routing entries.=oth node 06 and node 0?
send update messages to their neighbors indicating that the cost of the link
between nodes 06 and 0? is infinity. If the nodes have any other alternative
route to the destination node 0?, they update their routing tables and indicate
the changed route to their neighbors by sending an update message. !
neighbor node, after receiving an update message, updates its routing table
only if the new path is better than the previously existing paths. For example,
when node 06 finds an alternative route to the destination through node 0:, it
broadcasts an update message indicating the changed path. !fter receiving
the update message from node 06, neighboring nodes /, 0<, 0? and 0: do not
change their routing entry corresponding to destination 0? while node < and
node 0- modify their entries to reflect the new updated path. *odes < and 0-
again send an update message to indicate the correct path to the destination
for their respective neighbor. #hen node 0- receives node <Es update
message, it again modifies its routing entry to optimi(e the path to the
destination node 0? while node < discards the update entry it received from
node 0-.
A%90$,0#*s
It has faster convergence and involves fewer table updates.
D"s0%90$,0#*s
6?
The complexity of maintenance of multiple tables demands a larger
memory and greater processing power from nodes.
*ot suitable for highly dynamic and also for very large ad hoc wireless
networks.
R*0(,"9* R'1",$# P)','('+s
+eactive protocols, on the other hand, invoke a route determination procedure
on demand only. Thus, when a route is needed, some sort of global search
procedure is employed. The family of classical flooding algorithms belongs to
the reactive group. e.g. AODV %!d"hoc Bn Demand Distance Fector routing
protocol&, D'+ %Dynamic 'ource +outing protocol&, TORA %Temporally"
Brdered +outing !lgorithm routing protocol&
AODV
!BDF 3,, 6<, :A5 routing protocol uses an on"demand approach for
finding routes, that is, a route is established only when it is re9uired by a
source node for transmitting data packets. It employs destination se9uence
number to identify the most recent path. The ma1or difference between
!BDF and D'+ stems out from the facts that D'+ uses source routing in
which a data node and the intermediate nodes store the next hop
information corresponding to each flow for data packet transmission. In an
on"demand routing protocol, the source node floods the +oute+e9uest
packet in the network when a route is not available for the desired
destination. It may obtain multiple routes to different destinations from a
single +oute+e9uest. The ma1or difference between !BDF and other on"
demand routing protocols is that it uses a destination se9uence number
%Dest'e9*um& to determine an up"to"date path to the destination. ! node
updates its path information only if the Dest'e9*um of the current packet
received is greater than the last Destse9*um stored at the node.
! +oute+e9uest carries the source identifier %'rcID&, the destination
identifier %DestID&, the source se9uence number %'rcse9*um&, the
destination se9uence number %Dest'e9*um&, the broadcast identifier
6A
%=castID&, and the time to live%TT;& field. dest'e9*um indicates the
freshness of the route that is accepted by the source. #hen an intermediate
node receives a +oute+e9uest, it either forwards it or prepares a
+oute+eply if it has a valid route to the destination. The validity of a route
at the intermediate node is determined by comparing the se9uence number
at the intermediate node is determined by comparing the se9uence number
at the intermediate node with the destination se9uence number in the
+oute+e9uest packet. If a +oute+e9uest is received multiple times, which
is indicated by the =castId"'rcID pair, the duplicate copies are discarded.
!ll the intermediate nodes having valid routes to the destination, or the
destination node itself, are allowed to send +oute+eply packets to the
source. Every intermediate node, while forwarding a +oute+e9uest, enters
the previous node address and itEs =castID. ! timer is used to delete this
entry in case a +oute+eply is not received before the timer expires. This
helps in storing an active path at the intermediate node as !BDF does not
employ source routing of data packets. #hen a node receives a
+oute+eply packet, information about the previous node from which the
packet was received is also stored in order to forward the data packet to
this next node as the next hop towards the destination.
2onsider the example. In this Fig. :.:, source node 0 initiates a path"
finding process by originating a +oute+e9uest to be flooded in the
network for destination node 0?, assuming that the +oute+e9uest contains
the destination se9uence number as : and the source se9uence number as
0. #hen nodes 6,?, and A receive the +oute+e9uest packet, they check
their routes to the destination . In case a route to the destination is not
available, they further forward it to their neighbors. 7ere node :, < and 0-
are the neighbors of nodes 6, ? and A. This is with the assumption that
intermediate nodes : and 0- already have routes to the destination node,
that is, node 0? through paths 0-"0<"0? and :","4"0:"0? respectively. If
the destination se9uence number at intermediate node 0- is < and is 0 at
intermediate node :, then only node 0- is allowed to reply along the
6,
cached route to the source. This is because node : has an older route to
node 0? compared to the route available at the source node %the destination
se9uence number at node : is 0, but the destination se9uence number is :
at the source node&, while node 0- has a more recent route %the destination
se9uence number is <& to the destination. If the +oute+e9uest reaches the
destination %node 0?& through path <"06"0? or any other alternative route,
the destination also sends a +oute+eply to the source. In this case multiple
+oute+eply packets reach the source. !ll the intermediate nodes receiving
a +oute+eply update their route tables with the latest destination se9uence
number. They also update the routing information if it leads to a shorter
path between source and destination.
!BDF does not repair a broken path locally. #hen a link breaks, which is
determined by observing the periodical beacons or through link"level
acknowledgements, the end nodes %ie source and destination nodes& are
notified. #hen a source node learns about the path break, it reestablishes
the route to the destination if re9uired by the higher layers. If a path break
is detected at an intermediate node, the node informs the end nodes by
sending an unsolicited +oute+eply with the hop count set as infinity.
2onsider the example. #hen a path breaks, for example, between nodes <
and ?, both the nodes initiate +outeError messages to inform their end
nodes about the link break. The end nodes delete the corresponding entries
from their tables. The source node reinitiates the path"finding process with
the new =castID and the previous destination se9uence number.

*etwork ;ink
+oute+eply
+oute+9uest
6/
Destination ID
'ource ID
/
0
-
4
0
?
:
<
,
0
6
0
:
6
?
A
0
0
0
0
<
2ached route 0<"
0?
$ath0 0"?"0-"0<"0?
$ath6 0"?"<"06"0?

*etwork ;ink
+oute+eply
+outeError
=roken ;ink


A%90$,0#*s
+outes are established on demand and destination se9uence numbers are
used to find the latest route to the destination.
D"s0%90$,0#*s
Intermediate nodes can lead to inconsistent routes if the source
se9uence
number is very old and the intermediate nodes have a higher but not the
latest destination se9uence number, thereby having stale entries.
)ultiple +oute+eply packets in response to a single +oute+e9uest
packet can lead to heavy control overhead.
$eriodic beaconing leads to unnecessary bandwidth
64
F"#. 3.3 R'1,* *s,02+"s&5*$, "$ AODV
/
0
-
4
0
?
:
<
,
0
6
0
:
6
?
A
0
0
0
0
<
Destination ID
'ource ID
F"#. 3.4 R'1,* 50"$,*$0$(* "$ AODV
consumption.
TORA
Temporally ordered routing algorithm %TB+!& 3/, :,, :/5 is a source"
initiated on demand routing protocol which uses a link reversal algorithm
and provides loop"free multi"path routes to a destination node. In TB+!,
each node maintains its on"hop local topology information and also has the
capability to detect partitions. TB+! has the uni9ue property of limiting the
control packets to a small region during the reconfiguration process initiated
by a path break. Fig.:.A shows the distance metric used in TB+! which is
nothing but the length of the path, or the height from the destination. 7%*&
denotes the height of the node * from the destination. !ll messages in the
network flow downstream, from a node with higher height to a node with
lower height. TB+! has three main functions establishing, maintaining and
erasing routes.
The route establishment function is performed only when a node re9uires a
path to a destination but does not have any directed link. This process
establishes a destination oriented directed acyclic graph %D!H& using a
9ueryIupdate mechanism.2onsider the network topology shown in Fig.:.,.
#hen a node 0 has data packets to be sent to the destination node ,, a @uery
packet is originated by node 0 with the destination address included in it.
This @uery packet is forwarded by intermediate nodes 6,:,<,? and A and
reaches the destination node ,, or any other node which has a route to the
destination.

D
:-
F"#. 3.5 D")*(,*% 0(8(+"( #)0/& )'',*% 0, %*s,"$0,"'$.
The node that terminates %in this case, node ,& the @uery packet replies with an
Cpdate packet containing its distance from the destination %it is (ero at the
destination node&. In this example, the destination node , originates an Cpdate
packet. Each node that receives the Cpdate packet sets its distance to a value
higher than the distance of the sender of the Cpdate packet. =y doing this, a set
of directed links from the node which originated at the @uery to the destination
node , is created. This forms the D!H depicted in Fig.:.?. Bnce path to the
destination is obtained, it is considered to exist as long as the path is available,
irrespective of the path length changes due to the reconfigurations that may take
place during the course of the data transfer session.
#hen an intermediate node %say, node ?& discovers that the route to the
destination node is invalid, as illustrated in fig. :.A, it changes its distance value
to a higher value than its neighbors and originates an Cpdate packet. The
neighboring node < that receives the Cpdate packet reverses the link between 0
and < and forwards the Cpdate packet. This is done due to update the D!H
corresponding to destination node ,. This results in a change in the D!H . If the
source node has no other neighbor that has a path to the destination, it initiates a
fresh @ueryICpdate procedure. !ssume that the link between nodes 0 and <
breaks. *ode < reverses the path between itself and node ?, and sends an update
message to node ?. 'ince this conflict with the earlier reversal, a partition in the
network can be inferred. If the node detects a partition, it originates a 2lear
message, which erases the existing path information in that partition related to
the destination.
Edge of the D!H
7%0& 7eight of node 0
:0
,
A
Destination ID
'ource ID
<
0
?
:
6
7%:&


'ource
'ource



Destination
Destination


A%90$,0#*s
It supports multiple routes to any sourceIdestination pair.
=y limiting the control packets for route reconfigurations to a small
region, TB+! incurs less control overhead.
!ble to detect partitions very 9uickly.
;oop Free $ath
D"s0%90$,0#*s
TB+! is not energy efficient and does not scale to large networks.
The local reconfiguration of paths results in non"optimal routes.
It relies on synchroni(ed clocks among nodes in the network
DSR
:6
F"#. 3.6 I++1s,)0,"'$ '3 ,*5/')0+ ')%*)"$# "$ TORA
F"#. 3.7 I++1s,)0,"'$ '3 )'1,* 50"$,*$0$(* "$ TORA
;ink break between nodes ?
and ,
*odes < and ? reverse their links in order to
update the
path

<
,
?
A :
6
0
<
,
?
A :
6
0
7%
:&
Dynamic source routing%D'+& 34,6/5 is an on"demand protocol designed to
restrict the bandwidth consumed by control packets in ad hoc wireless networks
by eliminating the periodic table"update messages re9uired in the table"driven
approach. The ma1or difference between this and the other on"demand routing
protocols is that it is beacon"less and hence does not re9uire periodic hello
packet %beacon& transmissions, which are used by a node to inform its neighbors
of its presence. The basic approach of this protocol %and all other on"demand
routing protocols& during the route construction phase is to establish a route by
flooding +oute+e9uest packet, responds by sending a +oute+eply packet back to
the source, which carries the route traversed by the +oute+e9uest packet
received.
2onsider a source node that does not have a route to the destination. #hen it has
data packets to be sent to that destination, it initiates a +oute+e9uest packet. This
+oute+e9uest is flooded throughout the network. Each node, upon receiving a
+oute+e9uest packet, rebroadcasts the packet to its neighbors if it has not
forwarded already, or if the node is not the destination node, provided the
packetEs time to live %TT;& counter has not exceeded. Each +oute+e9uest carries
a se9uence number generated by the source node and the path it has traversed. !
node, upon receiving a +oute+e9uest packet, checks the se9uence number on the
packet before forwarding it. The packet is forwarded only if it is not a duplicate
+oute+e9uest. The se9uence number on the packet is used to prevent loop
formations and to avoid multiple transmissions of the same +oute+e9uest by an
intermediate node that receives it through multiple paths. Thus, all nodes except
the destination forward a +oute+e9uest packet during the route construction
phase. ! destination node, after receiving the first +oute+e9uest packet, replies
to the source node through the reverse path the +oute+e9uest packet had
traversed. In Fig.:./ source node 0 initiates a +oute+e9uest packet to obtain a
path for destination node 0?. This protocol uses a route cache that stores all
possible information extracted from the source route contained in a data packet.
*odes can also learn about the neighboring routes traversed by data packets if
operated in the promiscuous mode %the mode of operation in which a node can
::
receive the packets that are neither broadcast nor addressed to itself&. This route
cache is also used during the route construction phase. If an intermediate node
receiving a +oute+e9uest has a route to the destination node in its route cache,
then it replies to the source node by sending a +oute+eply with the entire route
information from the source node to the destination node.

*etwork ;ink
+oute+e9uest
+oute+eply
$ath0 0"6":","4"0:"0?
$ath6 0"?"<"06"0?
$ath: 0"A"0-"00"0<"0?
DSR O/,"5":0,"'$s6 'everal optimi(ation techni9ues 3:<5 have been incorporated
into the basic D'+ protocol to improve the performance of the protocol. D'+ uses the
route cache at intermediate nodes. The route cache is populated with routes that can be
extracted from the information contained in data packets that get forwarded. This
cache information is used by the intermediate nodes to reply to the source when they
receive a +oute+e9uest packet and if they have a route to the corresponding
destination. =y operating in the promiscuous mode, an intermediate node learns about
route breaks. Information thus gained is used to update the route cache so that the
active routes maintained in the route cache do not use such broken links. During
network partitions, the affected nodes initiate +oute+e9uest packets. !n exponential
:<
/
0
-
4
0
?
:
<
,
0
6
0
:
6
?
A
0
0
0
0
<
Destination ID
'ource ID
F"#.3.? R'1,* *s,02+"s&5*$, "$ DSR
backoff algorithm is used to avoid fre9uent +oute+e9uet flooding in the network when
the destination is in another dis1oint set. D'+ also allows piggy"backing of a data
packet on the +oute+e9uet so that a data packet can be sent along with the
+oute+e9uet.
If optimi(ation is not allowed in the D'+ protocol, the route construction phase is very
simple. !ll the intermediate nodes flood the +oute+e9uest packet if it is not
redundant. For example, after receiving the +oute+e9uest packet from node 0, all its
neighboring nodes, that is, nodes 6, ? and A forward it. *ode < receives the
+oute+e9uest from both nodes 6 and ?. *ode < forwards the first +oute+e9uest it
receives from any one of the nodes 6 and ? and discards the other redundant Iduplicate
+oute+e9uet packets. The +oute+e9uest is propagated till it reaches the destination
which initiates the +oute+eply. !s part of optimi(ations, if the intermediate nodes are
also allowed to originate +oute+eply packets, than a source node may receive multiple
replies from intermediate nodes. For example, in Fig.:./ if the intermediate node 0-
has a route to the destination via node 0<, it also sends the +oute+eply to the source
node. The source node selects the latest and best route, and uses that for sending data
packets. Each data packet carries the complete path to its destination.
#hen an intermediate node in the path moves away, causing a wireless link to break,
for example, the link between nodes 06 and 0? in Fig.:.4, a +outeError message is
generated from the node ad1acent to the broken link to inform the source node. The
source node reinitiates the route establishment procedure. The cached entries at the
intermediate nodes and the source node are removed when a +outeError packet is
received. If a link breaks due to the movement of edge nodes %nodes 0 and 0?&, the
source node again initiates the route discovery process.


*etwork ;ink
'elected path
:?
/
0
-
4
0
?
:
<
,
0
6
0
:
6
?
A
0
0
0
0
<
Destination ID
'ource ID
+outeError
=roken ;ink

A%90$,0#*s
+outes maintained only between nodes who need to communicate
+oute caching can further reduce route discovery overhead
! single route discovery may yield many routes to the destination, due to
intermediate nodes replying from local caches
It eliminates the need to periodically flood the network with the table
update messages which are re9uired in a table"driven approach.
Intermediate nodes also utili(e the route cache information efficiently to
reduce the control overhead.
D"s0%90$,0#*s
The route maintenance mechanism does not locally repair a broken link.
'tale route cache information could also result in inconsistencies during the
route reconstruction phase.
The connection setup delay is higher than in table"driven protocols.
The performance degrades rapidly with increasing mobility.
2onsiderable routing overhead is involved due to the source"routing
mechanism employed in D'+. This routing overhead is directly proportional
to the path length.
H82)"% R'1,"$# P)','('+
ZRP
:A
F"#. 3.@ R'1,* 50"$,*$0$(* "$ DSR
Jone +outing $rotocol %J+$& 30-, 66, ::, :45 is a hybrid routing protocol which
effectively combines the best features of both proactive and reactive routing
protocols. The key concept employed in this protocol is to use a proactive routing
scheme within a limited (one in the r"hop neighborhood of every node, and use a
reactive routing scheme for nodes beyond this (one. !n intra"(one routing
protocol %I!+$& is used in the (one where a particular node employs proactive
routing. The reactive routing protocol used beyond this (one is referred to as
inter"(one routing protocol %IE+$&. The routing (one of a given node is a subset
of the network, within which all nodes are reachable within less than or e9ual to
(one radius hops. Fig.:.0- illustrates routing (ones of node /, with rK0 hop and
rK6 hops. #ith (one radius K 6, the nodes ,,<,06 and 0: are interior nodes,
whereas nodes 6, :,?,4,0-,0: and 0? are peripheral nodes %nodes with the shortest
distance e9ual to the (one radius&. Each node maintains the information about
routes to all nodes within its routing (one by exchanging periodic route update
packets %part of I!+$&. 7ence the larger the routing (one, the higher the update
control traffic.
The IE+$ is responsible for finding paths to the nodes which are not within the
routing (one. IE+$ effectively uses the information available at every nodeEs
routing (one. #hen a node ' %node / in Fig. :.00 & has packets to be sent to a
destination node d%node 0? in fig.& , it checks whether node d is within its (one . If
the destination belongs to its own (one, then it delivers the packet directly.
Btherwise, node s broadcasts %uses unicast routing to deliver packets directly to
the border nodes& the +oute+e9uest to its peripheral nodes. In Fig. :.00 node /
broadcasts +oute+e9uest to nodes 6, :, ?, ,, 4,0-,0:,0< and 0?.If any peripheral
node finds node d to be located within its routing (one, it sends a +oute+eply
back to node s indicating the path; otherwise, the node rebroadcasts the
+oute+e9uest packet to the peripheral nodes. This process continues until node d
is located. *odes 0- and 0< find the information about node 0A to be available in
their intra"(one routing tables, and hence they originate +oute+eply packets back
to node /. During +oute+e9uet propagation, every node that forwards the
+oute+e9uest appends its address to it. This information is used for delivering the
:,
+oute+eply packet back to the source. The path"finding process may result in
multiple +oute+eply packets reaching the source, in which case the source node
can choose the best path among them. The criterion for selecting the best path
may be the shortest path, least delay path etc.
#hen an intermediate node in an active path detects a broken link in the path it
performs a local path reconfiguration in which the broken link is bypassed by
means of a short alternate path connecting the ends of the broken link. ! path
update message is then sent to the sender node to inform it about the change in
path. This results in a sub"optimal path between two end points, but achieves
9uick reconfiguration in case of link failures. To obtain an optimal path, the
sender reinitiates the global path"finding process after a number of local
reconfigurations.





:/
F"#. 3.1A R'1,"$# :'$* 3') $'%* ? "$ ZRP
/
0
-
4
0
?
:
<
,
0
6
0
:
6
?
A
0
0
0
0
<
+outing (one with radiusK0
+outing (one with radiusK6
*etwork ;ink
/
0
-
4
0
?
:
<
,
0
6
0
:
6
?
A
0
0
0
0
<
0
A
+oute+e9uet
16
+outing (one with radiusK6


A%90$,0#*s6
It reduces the control overhead compared to the +oute+e9uest flooding
mechanism employed in on"demand approaches and the periodic flooding of
routing information packets in table"driven approaches.
J+$ provides support for unidirectional links
The J+$ can determine the appropriate (one radius dynamically on"demand
D"s0%90$,0#*s6
In the absence of 9uery control, J+$ tends to produce higher control
overhead than the aforementioned schemes. This can happen due to the large
overlapping of nodesE routing (ones.
Total J+$ traffic increases with node density
'hort latency for finding new routes
H"*)0)(&"(0+ R'1,"$# P)','('+
The use of routing hierarchy has several advantages, the most important ones being
reduction in the si(e of routing tables and better scalability.
C+1s,*) B0s*% R'1,"$# P)','('+
In the 2luster =ased +outing $rotocol %2=+$& 3005, nodes are divided into clusters
and the clustering algorithm is performed when a node 1oins the network. =efore
:4
F"#. 3.11 P0,& 3"$%"$# 2*,-**$ $'%* ? 0$% $'%* 16
+oute+eply
16
*etwork ;ink
16
1oining, a node is in the 8undecided8 state. The LundecidedM node initiates the
1oining operation by setting a timer and broadcasts a 7ello message. If a clusterhead
receives the 7ello message, it replies with a triggered 7ello message. +eceiving the
triggered 7ello message, the LundecidedM node changes its state to 8member8 state.
If the LundecidedM node has bi"directional links to some neighbors but does not
receive a message from a clusterhead before the local timer generates a timeout, it
makes itself a clusterhead. Btherwise, the node remains in LundecidedM mode and
repeats the 1oining operation later.
In 2=+$, every node maintains a neighbor table in which it stores the information
about link states %uni"directional or bi"directional& and the state of its neighbors. In
addition to the information of all members in its cluster, a clusterhead keeps
information of its neighboring clusters, which includes the clusterheads of
neighboring clusters and gateway nodes connecting it to neighboring clusters.
If a source node wants to send a packet but has no active route which can be used, it
floods route re9uest to clusterhead of its own and all neighboring clusters. If a
clusterhead receives a re9uest it has seen before, it discards the re9uest. Btherwise,
the clusterhead checks if the destination of the re9uest is in its cluster. If the
destination is in the same cluster, the clusterhead sends the re9uest to the
destination, or it floods the re9uest to its neighboring clusterheads. 'ource routing is
used during the route search procedure and only the addresses of clusterheads on
the route are recorded. The destination sends a reply including the route information
recorded in the re9uest if it successfully receives a route re9uest. If the source
doesnEt receive a reply in the specified time period, it starts an exponentially
backoff algorithm and sends the re9uest later.
The shortening route is proposed in 2=+$ for performance optimi(ation. =ecause
2=+$ uses a source routing scheme, a node gets all information about the route
when receiving a packet. To reduce the hop number and adapt to network topology
changes, nodes exploit route shortening to choose the most distant neighboring
node in a route as next hop.
!nother optimi(ation method exploited by 2=+$ is local repair. #henever a node
has a packet to forward and the next hop is not reachable, it checks the routing
<-
information contained in the packet. If the next hop or the hop after next hop in the
route is reachable through one of its neighbors, the packet is forwarded through the
new route.
A%90$,0#*s
Cses local route repair and route shortening to improve routes
'upports uni" and bi"directional links
+eduction of communication traffic
+eduction of information storage
;oop free
'upport for multiple route
D"s0%90$,0#*s
Bverhead bytes according to source routing.
Bnly 6"level hierarchy.
'mall clusters but when clusters grow, si(e of 7E;;B messages and tables
increases.
3.4 COMPARISON OF DIFFERENT ROUTING PROTOCOLS
The Table :.: shows the comparison 30<, <-, <<5 between different routing
protocols. This table compared seven routing protocols on the basis of four
parameters like hello message re9uirement, update destination, routing strategy
and method of communication. !BDF and 2=+$ only uses broadcast hello
message. D'DF, #+$ and !BDF uses distance vector routing strategy and D'+
and 2=+$ uses source routing that uses the concept of route cache. D'DF, #+$
and TB+! broadcast the packets in the network. 2=+$ uses flooding of the
packets and D'+ unicast the packet to next neighbor.
D'DF #+$ D'+ !BDF TB+! J+$ 2=+$
<0
T02+* 3.3 C'5/0)"s'$ '3 D"33*)*$, R'1,"$# P)','('+s
7ello message
re9uirement
*o *o *o Nes *o *o Nes
Cpdate
Destination
*eighbors *eighbors 'ource 'ource *eighbors *eighbors *eighbors
+outing
'trategy
Distance
vector
Distance
vector
'ource
routing
Distance
vector
;ink state 7ybrid 'ource
routing
)ethod of
2ommunicatio
n
=roadcast =roadcast Cnicast Cnicast =roadcast =roadcast Flooding
CHAPTER 4
PROBLEMS ITH READBMADE ROUTING PROTOCOL
SIMULATORS
<6
4.1 NS2
4.1.1 I$,)'%1(,"'$
*'6 36:, 6?, <05 is an ob1ect oriented simulator, written in 2>>, with a T2; interpreter
as a front"end. *s"6 is a discrete event simulator, which means that events %e.g., packets
to send, timeouts, etc.& are scheduled in a global event 9ueue according to their time of
execution. #hen a simulation is run the simulator removes events from the head of the
9ueue, moves the simulator time to that of the currently removed event and executes it.
#hen done, it continues to the next event and so forth. Each simulation is defined by a
scenario that contains a number of predefined events that define the scenario.The
simulator supports a class hierarchy in 2>> and a similar class hierarchy within the T2;
interpreter. The two hierarchies are closely related to each other; from the userEs
perspective, there is a one"to"one correspondence between a class in the interpreted
hierarchy and one in the compiled hierarchy. The root of this hierarchy is the class
TclBb1ect. Csers create new simulator ob1ects through the interpreter. These ob1ects are
instantiated within the interpreter, and are closely mirrored by a corresponding ob1ect in
the compiled hierarchy.
*s"6 scenarios are implemented in T2;"scripts that contain the commands to initiali(e
the simulator and to create the nodes and their configuration. Each simulation run
generates a trace file containing all the data packets that are sent between the nodes
during the course of the scenario. =y analy(ing this file it is possible to determine the
performance effect of parameter variations, different routing protocols and more. *s"6 is
run from a C*IO terminal window. To edit the scripts used in this assignment you need a
text editor, e.g., Emacs, Fi or similar.
The interpreted class hierarchy is automatically established through methods defined in
the class Tcl2lass. Cser instantiated ob1ects are mirrored through methods defined in the
class TclBb1ect. There are other hierarchies in the 2>> code and T2; scripts; these other
hierarchies are not mirrored in the manner of TclBb1ect.
&8 ,-' +0$#10#*sC *'6 uses two languages because simulator has two different kinds
of things it needs to do. Bn one hand, detailed simulations of protocols re9uire a systems
programming language which can efficiently manipulate bytes, packet headers, and
<:
implement algorithms that run over large data sets. For these tasks run"time speed is
important and turn"around time %run simulation, find bug, fix bug, recompile, re"run& is
less important.
Bn the other hand, a large part of network research involves slightly varying parameters
or configurations, or 9uickly exploring a number of scenarios. In these cases, iteration
time %change the model and re"run& is more important. 'ince configuration runs once %at
the beginning of the simulation&, run"time of this part of the task is less important.
*'6 meets both of these needs with two languages, 2>> and Btcl, 2>> is fast to run but
slower to change, making it suitable for detailed protocol implementation. BTcl runs
much slower but can be changed very 9uickly %and interactively&, making it ideal for
simulation configuration. *'6 %via tclcl& provides glue to make ob1ects and variables
appear on both languages.
In *'6, we use the term LinterpreterM to be synonymous with the BTcl interpreter. The
code to interface with the interpreter resides in a separate directory, tclcl. The rest of the
simulator code resides in the directory, ns"6. #e will use the notation PtclclIhfilei to refer
to a particular hfilei in the Tcl directory. 'imilarly, we will use the notation, PnsIhfilei to
refer to a particular hfilei in the ns"6 directory.
There are a number of classes defined in PtclclI. #e only focus on the six that are used in
ns6 The 2lass Tcl contains the methods that 2>> code will use to access the interpreter.
The class TclBb1ect is the base class for all simulator ob1ects that are also mirrored in
the compiled hierarchy. The class Tcl2lass defines the interpreted class hierarchy, and
the methods to permit the user to instantiate TclBb1ects. The class Tcl2ommand is used
to define simple global interpreter commands. The class EmbeddedTcl contains the
methods to load higher level built"in commands that make configuring simulations easier.
Finally, the class InstFar contains methods to access 2>> member variables as BTcl
instance variables.
4.1.2 H'- %' I %*9*+'/ 58 '-$ /)','('+ 3') NS2
'uppose we are going to implement a new )!*ET routing protocol called protoname.
To allocate our code we will firstly create a new directory called protoname inside your
*'6 base directory. #e will create five files there
<<
/)','$05*.& This is the header file where will be defined all necessary timers
%if any& and routing agent which performs protocolEs functionality.
/)','$05*.(( This file are actually implements all timers, routing agent
and Tcl hooks.
/)','$05* /.,.& 7ere are declared all packets protoname protocol needs to
exchange among nodes in the manet.
/)','$05* ),02+*.& 7eader file where our own routing table is declared.
/)','$05* ),02+*.(( +outing table implementation.
To implement a routing protocol in *'6 you must create an agent by inheriting from
!gent class. This is the main class we will have to code in order to implement our routing
protocol. In addition, this class offers a linkage with Tcl interface, so we will be able to
control our routing protocol through simulation scripts written in Tcl.
Bur routing agent will maintain an internal state and a routing table. Internal state can be
represented as a new class or as a collection of attributes inside the routing agent. #e will
treat routing table as a new class, protonameQrtable.
!lso our new protocol must define at least one new packet type which will represent the
format of its control packets. !s we said these packet types are defined in
protonameIprotonameQpkt.h. #hen the protocol needs to send packets periodically or
after some time from the occurrence of an event, it is very useful to count on a Timer
class.
The Trace class is the base for writing log files with information about what happened
during the simulation. The roaming node scenario can be run using !BDF as the default
routing protocol by passing the scenario file as input to ns"6. The optional "prot argument
selects either !BDF or B;'+ routing %!BDF is default&.
D $s )'05"$#6$'%*6D!2.,(+ 6/)', E0'%9F'+s)G
+unning this command in a terminal window will produce two output files. The first is
the .tr file, which is the main trace file and the other is a .nam file, which is used to
<?
visuali(e the scenario using the nam animation tool. If you want to view an animation of
the node movements you can run nam, e.g.
D $05 )'05"$#6$'%*61%/60'%9.$05
7owever, the .tr trace file is the important file for this assignment and is used for the
analysis.
4.1.3 P)'2+*5s -",& NS2
To implement a routing protocol in *'6 we have to create too many files that are
not easy to implement.
In *'6, open source is used. To use this open source we must know the
programming used.
It is freeware so training is not easily available.
Editing is very difficult in *'6.
2ompilation and Execution is tough.
!#R file is created for ouput. To see output we have to change awk file.
T2; script language is to be learned to change the parameters.
4.2 <UALNET
4.2.1 I$,)'%1(,"'$
@ual*et 'imulator 36A, 6,5 is a state"of"the"art simulator for large, heterogeneous
networks and the distributed applications that execute on those networks. @ual*et
'imulator is an extremely scalable simulation engine, accommodating high"fidelity
models of networks of tens of thousands of nodes. @ual*et makes good use of
computational resources and models large"scale networks with heavy traffic and
mobility, in reasonable simulation times.
@ual*et 'imulator has the following attractive features
Fast model set up with a powerful Hraphical Cser Interface %HCI& for custom
code development and reporting options
Instant playback of simulation results to minimi(e unnecessary model executions
Fast simulation results for thorough exploration of model parameters
'calable up to tens of thousands of nodes
<A
+eal"time simulation for man"in"the"loop and hardware"in"the"loop models
)ulti"platform support
@ualnet contains different tools that provide some features. These tools are classified as "
<10+N*, S(*$0)"' D*s"#$*)
@ual*et 'cenario Designer is a graphical tool that provides an intuitive model set
up capability and is used to create and design experiments in @ual*et. The
'cenario Designer enables a user to define the geographical distribution, physical
connections and the functional parameters of the network nodes, all using
intuitive click and drag tools, and to define network layer protocols and traffic
characteristics for each node.
<10+N*, A$"50,')
@ual*et !nimator is used to execute and animate experiments created in the
'cenario Designer. Csing the !nimator a user can watch traffic flow through the
network and create dynamic graphs of critical performance metrics as a
simulation is running.
<10+N*, 3D V"s10+":*)
@ual*et :D visuali(er is similar to @ual*et !nimator, but it provides the added
capability of visuali(ing scenarios in :D.
<10+N*, A$0+8:*)
@ual*et !naly(er statistical graphing tool that displays network statistics
generated from a @ual*et experiment. Csing the !naly(er, a user can view
statistics as they are being generated, as well as compare results from different
experiments.
<10+N*, P0(.*, T)0(*)
@ual*et $acket Tracer is a packet"level visuali(ation tool for viewing the
contents of packets as they travel up and down the protocol stack.
<10+N*, P)','('+ S,0(.
<,
@ual*et uses a layered architecture similar to that of the T2$II$ network protocol
stack. #ithin that architecture, data moves between ad1acent layers. @ual*et.s
protocol stack consists of, from top to bottom, the !pplication, Transport,
*etwork, ;ink %)!2& and $hysical ;ayers. !d1acent layers in the protocol stack
communicate via well"defined !$Is, and generally, layer communication occurs
only between ad1acent layers. For example, Transport ;ayer protocols can get and
pass data to and from the !pplication and *etwork ;ayer protocols, but cannot do
so with the ;ink %)!2& ;ayer protocols or the $hysical ;ayer protocols.
4.2.2 P)'2+*5s -",& <10+$*,
In @ualnet, there is very long and complex code for the protocols. Eg. !BDF
codes are of 04A pages.
The output parameters can not be changed.
Editing is also a very tough task in @ualnet.
CHAPTER 5
</
DESIGN AND IMPLEMENTATION OF ROUTING PROTOCOL
5.1 DESIGNING THE ROUTING PROTOCOLS
The aim of the routing protocol is to find a path that consumes minimum battery power
from source node to destination node. The strategy used in routing protocol design is as
follows
The simulator takes following inputs from the user"
*umber of nodes that a network contains.
*umber of iterations.
Transmission radius or range that is used to find out the neighbor list of each node.
'ource node and destination node.
!fter having the following information a neighbour list is generated in increasing order
of their distances from the neighbouring nodes. Csing this sorted list the sorce node
checks whether the destination node is in its vicinity or not if the destination node is in its
vicinity then it directly unicast the re9uest packet to the destination otherwise the first
member of the sorted list is given the re9uest packet if it has not seen this packet before
otherwise the packet is given to the next member of the sorted list. The next node in turn
repeats the source node procedure to find the destination node. The process goes on until
the hop count maximum limit exceeds or the packet reaches the destination. The
following parameters were recorded in text file as follows
!verage number of hopes
!verage number of retransmission
!verage number of throughput
!verage power decapitated per node
5.1.1 A+#')",&5
The nodes in the ad"hoc network repeat the process of gathering the neighborEs entries in
the table until every node has details about their neighboring nodes. In fact, the nodes to
forward data packets use this information. #henever due to mobility of mobile nodes
there is a packet loss, the neighborEs entries are updated. 7owever, after a regular interval
<4
of time, every node within a cell retransmits a neighbor +e9uest packet in order to
read1ust the network information about its neighboring nodes. This process helps in
maintaining a updated network view.
HH P'-*) A-0)* R'1,"$# A+#')",&5
0. Input number of transmission do you want, number of nodes and transmission
range.
6. $ositioned all the nodes in a network.
:. !ssign 0-- units power to each node.
<. 2reate the neighbor list of each node and arrange the nodes of each neighbor list
in increasing order.
?. Input source node and destination node.
A. !ssign hopQcountK -, kK-, path3k5KsourceQnode
,. power3sourceQnode5Kpower3sourceQnode5"6.-
/. if %hopQcountS0A&
T if%destinationQnodeKcurrentQnode&
T k>>
path3k5KcurrentQnode
power3currentQnode5Kpower3currentQnode5"0.?
exit%& II path found
U
else
T hop"count>>
pathQfound%&
U
U
Else
Drop the packet and resend the packet.
4. 2alculate number of hopes, number of retransmission, number of successful
transmission and power left of each node.
0-. 2alculate
?-
!verage number of hopesKnoQofQhopesInoQofQtransmission
!verage power leftK sum"ofQpowerIno."of"transmission
!verage number of throughputK noQofQsuccessInoQofQtransmission
!verage number of retransmissionKnoQofQretransInoQofQretransmission
The algorithm says that, initially the hop count is set to 0A and when the hop count
becomes less then 0 the data packet has again to be retransmitted and if the count is
greater then 0 the data packet will call the gate way selection algorithm which is
discussed in the next section
P0,& 3'1$% 0+#')",&5
$athQfound% &
T
iK0;
while%sortQneighborQlistVKnull&
T
if %sortQneighborQlist3i5KKvisited node& IGif the i
th
entry of the sorted
neighbor list matches with the visited node
if yes then there is no need to visit it again GI
T IG check the next entry of the visited nodeGI
i>>;
U
else
T

if%destinationQnodeKsortQneighborQlist3i5&
T
k>>
path3k5KsortQneighborQlist3i5 II path found
power3sortQneighborQlist3i55Kpower3sortQneighborQlist3i55"0.?
exit%&;
U
?0
else
T
path3k5KsortQneighborQlist3i5
deliver the packet to sortQneighborQlist3i5
power3sortQneighborQlist3i55Kpower3sortQneighborQlist3i55"6.-
pathQfound%&;
U
U
if all the nodes of the neighborQlist are visited
T
kK-;
resend the packet
U
U
5.2 IMPLEMENTATION OF ROUTING PROTOCOLS
7ere only one class named *etwork is created. The description of data members
and member functions of this classe are as follows"
5.2.1 DATA MEMBERS
$6 number of nodes
$'I'3I,)0$s6 number of transmission do you want to run the program
s$#6 source node
%$#6 destination node
,)0$sI)0$#*6 transmission range
$'%*s E GE G6 double dimension array that store the x and y coordinates of the
nodes.
%E GE G6 double dimension array that store the distance between all the nodes.
$*"#&2')sI+"s,E GE G6 double dimension array that store the neighbor list of each
node.
('1$,E GE G6 double dimension array that store the number of neighbors of each
node.
?6
30"+I('1$,6 store the number of failures.
s1((I('1$,6 store the number of successful transmission.
5.2.2 MEMBER FUNCTIONS
#*,%0,0=>6 This function is used to take the coordinates of the nodes.
#*,I)0$#*=>6 This function is used to take input number of nodes and
transmission range.
#*,I/'-*)=>6 This function is used to initiali(e the power to each node.
()*0,*I$*,-').6 This function is used to place the nodes in the network.
%"s,0$(*=>6 This function is used to calculate the distance between all the nodes.
$*"#&2')s="$,>6 This function is used to generate the neighbor list of each node.
/0,&I3'1$%=>6 This function is used to calculate the path from source to
destination.
09#I/'-*)="$,>6 This function is used to calculate the average power left of each
node.
09#I&'/*s="$,>6 This function is used to calcualte the average number of
intermediate hopes.
09#I,&)/1,="$,>6 This function is used to calculate the average successful
transmission of the packet.
09#I)*,)0$s="$,>6 This function is used to calculate the avrage retransmission of
the packet.
%"s/+08="$,J"$,J"$,>6 This function is used to display the various outputs.
5.3 SIMULATION AND RESULTS
5.3.1 E405/+*
This section presents an example simulation of the proposed protocol
*o. of times do you want to run programK 0
*o. of nodesK 0-
Transmission rangeK0-
?:
?<
N'%*s N*"#&2') +"s,
0 <
6 :
: 6
< 4 ? 0 / 0-
? 4 < 0- / ,
A /
, ? 4 0-
/ < 4 0- A ?
4 ? < 0- / ,
0- 4 ? < , /
0
?
4
0
-
A
/
<
,
6
:
F"#. 5.1 A $*,-'). -",& 1A $'%*s
T02+* 5.1 N*"#&2') +"s, ,02+* '3 *0(& $'%*
'ource *ode is < and Destination *ode is 4.
Destination *ode 4 is found in the neighbor list of source node <. 'o $ath found
from
source to destination is <, 4.
!verage power left per node is 44A.?.
!verage throughput is 0
!verage number of hopes are 0.
!verage number of retransmission is -.
5.3.2 R*s1+,s
The simulator was designed in 2>>. It takes the following parameters as input
0. *umber of nodes
6. Transmission +adius of each node
:. *umber of iterations
The following outputs were recorded.
1. A9*)0#* /'-*) +*3, /*) $'%*7 For measuring average power the following
assumption was made
Each node is assigned 0-- units of power
The node consumes 6 units of battery for transmiting a packet
The node consumes 0.? units power in receiving a packet
The average power decreases for lower transmission radius but as the
transmission radius is increased the average power left per node also get increased
as shown in Fig. ?.6. The reason for such behaviour is at lower transmission
radius the number of retransmission is 9uite large.
T)0$s5"ss"'$ A9*)0#* P'-*) +*3, /*) $'%*
??
T02+* 5.2 A9*)0#* /'-*) +*3, /*) $'%*
R0$#* N152*) '3
N'%*sK2A
N152*) '3
N'%*sK25
N152*) '3 N'%*sK3A
5 93 93.98 89.26
6 86.69 89.08 80.75
7 80.24 78.86 75.25
8 69.02 80.68 79.8
9 73.05 72.83 53.25
10 74.44 72.59 52.26
11 82.67 55.48 64.63
12 29.82 75.32 82.84
13 55.7 91.45 49.45
14 81.09 86.83 93.46

2. T&)'1#&/1,7 It may be defined as the number of successful transmission to the
total number of transmissions. The average throughput increases as the
transmission range increases due to the fact that the information regarding
neighbouring nodes gets increased as shown in Fig. ?.:.
T)0$s5"ss"'$
R0$#*
A9*)0#* T&)'1#&/1,
N152*) '3 N'%*sK2A N152*) '3 N'%*sK25 N152*) '3 N'%*sK3A
5 0.2 0.15 0.05
6 0.15 0.15 0.15
7 0.25 0.25 0.2
8 0.35 0.6 0.4
9 0.55 0.65 0.55
10 0.75 0.75 0.65
?A
F"#. 5.2 A9*)0#* /'-*) +*3, Vs ,)0$s5"ss"'$ )0$#* #)0/&
T02+* 5.3 A9*)0#* ,&)'1#&/1,
11 0.9 0.85 0.9
12 0.65 0.85 1
13 0.85 1 0.9
14 1 1 1
3. H'/ ('1$,7 Defined as the number of intermediate nodes between a source and
destination. !s shown in the Fig. ?.< with the increase in the transmission radius,
the hop count gets increased.
?,
F"#. 5.3 A9*)0#* T&)'1#&/1, Vs ,)0$s5"ss"'$ )0$#* #)0/&
T02+* 5.4 A9*)0#* $'. '3 &'/*s 3') s1((*ss31+ ,)0$s5"ss"'$

4. A9*)0#* $152*) '3 )*,)0$s5"ss"'$7 The average number of retransmission is
more when the transmission radius is low since there are limited numbers of
neighbour but as the transmission radius is increased the probability to reach
destination gets increased and hence retransmission reduces as shown in Fig. ?.?.
T)0$s5"ss"'$ R0$#*
A9*)0#* $'. '3 )*,)0$s5"ss"'$
N152*) '3 N'%*sK2A N152*) '3 N'%*sK25 N152*) '3 N'%*sK3A
5 1.5 1.75 2.55
6 1.85 2.2 2.35
7 2.3 2.55 2.7
8 2.2 1.55 1.8
9 1.85 1.75 2.7
10 1.3 1.25 2
?/
T)0$s5"ss"'$ R0$#*
A9*)0#* $'. '3 &'/ ('1$, 3') s1((*ss31+ ,)0$s5"ss"'$
N152*) '3 N'%*sK2A N152*) '3 N'%*sK25 N152*) '3 N'%*sK3A
5 2 1.66 1
6 2.33 1.66 4.66
7 2.4 2.2 3.75
8 2.42 2.5 3.125
9 1.54 4 2.81
10 3.26 4.2 3.53
11 2.5 6.29 5.72
12 4.3 3.52 6.3
13 4.47 3.05 4.22
14 3.55 4.7 2.8
F"#. 5.4 A9*)0#* $'. '3 &'/*s 3') s1((*ss31+ ,)0$s5"ss"'$ Vs ,)0$s5"ss"'$
)0$#* #)0/&
T02+* 5.5 A9*)0#* $'. '3 )*,)0$s5"ss"'$
11 0.65 1.3 0.8
12 2.6 0.7 0.15
13 1 0 1.2
14 0.25 0 0
5.4 DISCUSSION ABOUT RESULTS
The power consumption in transmitting a packet is directly proportional to the s9uare of
the distance between the source and destination, more is the distance more is the power
consumed and lesser is the effective network life time. The nodes thus tries to select their
intermediate nodes to relay the packets inorder to increase its effective life time, reduce
average power consumption of the overall network but at the same time introduces
congestion since the number of nodes involved in routing process gets increased by
adopting the staraegy proposed.
?4
F"#. 5.5 A9*)0#* $'. '3 )*,)0$s5"ss"'$ Vs ,)0$s5"ss"'$ )0$#* #)0/&
CHAPTER 6
6.1 CONCLUSION
In this work a new routing protocol has been proposed for implementing routing protocol
for ad hoc network. The proposed protocol is power aware keeping in view the power
constraint of nodes being used in the ad hoc network.
To test the performance of the protocol a program has been designed in 2>>. This
implementation in 2>> has allowed us to check the performance of the protocol under
various conditions. This performance has been illustrated in the forms of the graphs and
tables in the previous chapter of this desertation. The results are 9uite satisfactory
indicating that the proposed protocol has feasible implementation.
6.2 FURURE SCOPE
The testing of the protocol in the present work has been done in isolated environment
where conditions are not standard. 7owever to check the actual applicability of protocol
it is mandatory to check this protocol under an industrial standard environment. 'o that
actual rating of a proposal can be made. 'uch an environment is provided by standard
softwares like *'6 and @ualnet. 7owever to test a protocol in *'6 and @ualnet the 2>>
code of the protocol has to be physical augmented. The implementation of the protocol in
2>> has accomplished this task.
*ow, the future work is to customi(e this implementation so as to create its augmentation
compatibility with *'6 or @ualnet. Then the proposed protocol can be actually tested in
the standard condition and its performance can be compared with the other existing
routing protocols.
A-
REFERENCES
305 Wohn 7eidemann0 and +amesh Hovindan,M !n Bverview of Embedded 'ensor
*etworksM Cniversity of 'outhern 2aliforniaIInformation 'ciences Institute,
1ohnhXisi.edu, Cniversity of 'outhern 2alifornia, 2omputer 'cience Department,
rameshXusc.edu
365 +. !nanthapadmanabha, =.'.)ano1 and 2.'iva +am )urthy, L)ulti"hop 2ellular
*etworks The !rchitecture and +outing $rotocolM $roceedings of IEEE $I)+2
6--0, vol 6, pp. ,/"/6, Bctober 6--0.
3:5 N.D.;in and N.2.7su, L)ulti"7op 2ellular ! *ew !rchitecture for #ireless
2ommunicationsM, $roceedings of IEEE I*FB2B) 6---, pp. 06,:"06/6, )arch
6---.
3<5 7. Deng, #.;i and D.$.!grawal, L+outing 'ecurity in #ireless !d 7oc
*etworksM IEEE communications )aga(ine, vol. <-, no. 0-, pp. ,-",?, Bctober
6--6.
3?5 2.E. $erkins and $.=hagwat, L7ighly Dynamic Destination"'e9uenced Distance
Fector +outing for mobile computersM, $roceedings of !2) 'IH2B)) 044<,
pp. 6:<"6<<, !ugust 044<.
3A5 '. )urthy and W.D. Harcia";una"!ceves L!n Efficient +outing $rotocol for
#ireless *etworksM, !2) )obile *etworks and !pplications Wournals, 'pecial
Issue on +outing in )obile 2ommuniactions *etworks, vol. 0, no. 6, pp. 0/:"
04,, Bctober 044A.
3,5 2.E. $erkins and E.). +oyer, L!d 7oc Bn"Demand Distance Fector +outing,M
$roceedings of IEEE #orkshop on )obile 2omputing 'ystems and !pplications
0444, pp. 4-"0--, February 0444.
A0
3/5 F.D. $ark and ).'. 2orson, L! 7ighly !daptive Distributed +outing !lgorithm
for )obile #ireless *etworks,M $roceedings of IEEE I*FB2B) 044,, pp. 0<-?"
0<0:, !pril 044,.
345 D.=. Wohnson and D.!. )alt( LDynamic 'ource +outing in !d 7oc #ireless
*etworksM )obile 2omputing , Rluwer !cademic $ublishers, vol. :?:, pp. 0?:"
0/0, 044A.
30-5 J.W. 7aas, LThe +outing !lgorithm for the +econfigurable #ireless *etworks,M
$roceedings of I2C$2 044,, vol.6, pp. ?A6"?AA, Bctober 044,.
3005 )ingliang Wiang, Winyang ;i and N.2. Tay, L2luster =ased +outing $rotocol
%2=+$&, Internet draft, draft"ietf"manet"cbrp"spec"-0.txt, !ugust 044/.
3065 T. '. +appaport. #ireless 2ommunications $rinciples and $ractice. $rentice"
7all, 044A.
30:5 2."R. Toh and ). Delawar. Implementation and evaluation of an adaptive
routing protocol for infrastructureless mobile networks. In IEEE International
2onference on 2omputer 2ommunications and *etworks %I222*.6---&, ;as
Fegas, C'!, Bct. 6---.
30<5 '. +. Das, 2. $erkins, and E. ). +oyer. $erformance comparison of two on"
demand routing protocols for ad"hoc networks. In $roceedings of IEEE
I*FB2B).6--, Tel"!viv, Israel, 6---.
30?5 2arlo Ropp, L!d 7oc *etworkingM, 'ystems Wournal, pp ::"<-, 0444.
30A5 '. 2orson and W. )acker, )obile !d hoc *etworking %)!*ET& +outing
$rotocol $erformance Issues and Evaluation 2onsiderations, +F2 6?-0, Wanuary
0444.
30,5 Huolong ;in, Huevara *oubir and +a1mohan +a1araman, 8)obility )odels for
!d hoc *etwork 'imulation8, In $roceedings of IEEE I*FB2B) 6--<, Folume
0, pp. ,"00, 6--<.
30/5 Tracy 2amp, Weff =oleng and Fanessa Davies, L! 'urvey of )obility )odels
for !d 7oc *etworkM 'pecial issue on )obile !d 7oc *etworking +esearch,
Trends and !pplications, vol. 6, no. ?, pp. </:"?-6, 6--6.
A6
3045 F. =ai, !. 7elmy, L! 'urvey of )obility )odeling and !nalysis in #ireless
!dhoc *etworksM in #ireless !d 7oc and 'ensor *etworks, Rluwer !cademic
$ublishers, 6--<.
36-5 '. 2orson and W. )acker, )obile !d hoc *etworking %)!*ET& +outing
$rotocol $erformance Issues and Evaluation 2onsiderations, +F2 6?-0, Wanuary
0444.
3605 ;. H. @uesada, M! +outing $rotocol for )!*ETsM, )aster thesis, Department
of Telematics, *orweigian Cniversity of 'cience and Technology,)ay 6--,.
3665 ;. #ang and '. Blariu, M! Two"Jone 7ybrid +outing $rotocol for )obile !d
7oc *etworksM, IEEE Trans. $arallel and Distributed 'ystems, vol. 0?, *o. 06,
Dec. 6--<.
36:5 The network simulator " ns"6. httpIIwww.isi.eduInsnamInsI.
36<5 2. $erkins, E. =elding"+oyer, and '. Das. !d hoc on"demand distance vector
%!BDF& routing, Wuly 6--:. IETF Internet +F2 :?A0.
36?5 Cser )anual for I)$B+T!*T )obility Tool Henerator in *'"6 'imulator.
httpIInile.usc.eduIimportantIsoftware.htm , +elease Date February 6--<
36A5 @ual*et <.? $rogrammerEs Huide " Evaluation Fersion 6--/,
httpIIwww.scalable"networks.comIproductsIdeveloperInewQinQ<?.php
36,5 @ual*et <.? CserEs Huide "Evaluation Fersion 6--/,
ww.eurecom.frIPchen1I'imulator)anual":.0.pdf
36/5 David =. Wohnson, David !. )alt(, Nih"2hun 7u, The Dynamic 'ource
+outing %D'+& $rotocol for )obile !d 7oc *etworks.draft"ietf"manet"dsr"0-.txt,
Wuly 6--<
3645 E. ). +oyer, and 2."R. Toh, L! review of current routing protocols for ad hoc
mobile wireless networksM, IEEE $ersonal 2ommunications, !pr. 0444, pp. <AY
??.
3:-5 7. ;i and ). 'inghal.M ! secure routing protocol for wireless ad hoc networksM.
In $roceeding of the :4th 7awaii International International 2onference on
'ystems 'cience %7I2''":4 6--A&, pages 66?Y6:<, Wanuary 6--A.
3:05 2. $erkins, Ed., !d 7oc *etworking. !ddison"#esley, 6--0.
A:
3:65 F. D. $ark and ). '. 2orson, L! highly adaptive distributed routing algorithm
for mobile wireless networksM, in IEEE Infocom, 044,.
3::5 J. W. 7aas, ). +. $earlman and $. 'amar, LThe (one routing protocol %J+$& for
ad hoc networksM, Internet Draft, Wuly Z-6.
3:<5 W. =roch, D. Wohnson and D. )alt(, LThe dynamic source routing protocol for
mobile ad hoc networksM, IETF Internet Draft,
httpIIwww.ietf.orgIinternetdraftsIdraft"ietf"manet"dsr"-0.txt, December 044/.
3:?5 2harles E. $erkins and $ravin =hagwat, L7ighly dynamic Destination"
'e9uenced Distance"Fector routing %D'DF& for mobile computersM. In
$roceedings of the 'IH2B) .4< 2onference on 2ommunications
!rchitecture, protocols and !pplications, pages6:<"6<<, !ugust 044<. !
revised version of the paper is available from
7ttpIIwww.cs.umd.eduIpro1ectsImcmlIpapersI'igcomm4<.ps.
%044/"00"64&
3:A5 2harles E. $erkins, L!d 7oc Bn Demand Distance Fector %!BDF& +outingM.
Internet draft, draft"ietf" manet"aodv"-0.txt, !ugust 044/. #ork in progress.
3:,5 Fincent D. $ark and ). 'cott 2orson, LTemporally"Brdered +outing
!lgorithm %TB+!& Fersion 0 Functional specificationM. Internet draft, draft"
ietf"manet"tora"spec"-0.txt, !ugust 044/. #ork in progress.
3:/5 Fincent D. $ark and ). 'cott 2orson, L! performance comparison of the
Temporally"Brdered +outing !lgorithm and Ideal ;ink"state routingM. In
$roceedings of IEEE 'ymposium on 2omputers and 2ommunication E4/,
Wune 044/.
3:45 Jygmunt W. 7aas and )arc +. $earlman, LThe Jone +outing $rotocol %J+$&
for !d 7oc *etworksM, Internet draft, draft"ietf"manet"(one"(rp"-0.txt, !ugust
044/. #ork in progress.
3<-5 W. =roch, D. !. )alt(, D. =. Wohnson, N."2. 7u, andW. Wetcheva. ! performance
comparison of multi"hop wireless ad hoc network routing protocols.
)obi2omE4/, $roceedings of <th !nnual !2)IIEEE Inter. 2onf. on )obile
2omputing and *etworking, pages /?Y4,, Bctober 044/.
A<
3<05 Revin Fall and Rannan Faradhan, Lns notes and documentationM. The FI*T
pro1ect, C2 =erkeley, ;=;, C'2II'I, and Oerox $!+2, )ay 044/. #ork in
progress.
3<65 *. 'chult, ). )irhakkak, D. ;a+occa, and W. 'trater. +outing in mobile ad hoc
networks. $roceedings of 2onference on )ilitary 2ommunications
%)I;2B)E44&, pages 0-Y0<, 0444.
3<:5 '. 2hakrabarti and !. )ishra, L@o' issues in ad hoc wireless networks,M IEEE
2ommunications )aga(ine, 6--0, :4%6&, pp. 0<6Y0</.
3<<5 '.+. Das, 2.E. $erkins, and E.). +oyer. $erformance comparison of two on"
demand routing protocols for ad hoc networks. $roceedings IEEE I*FB2B)
6---. 2onference on 2omputer 2ommunications. *ineteenth !nnual Woint
2onference of the IEEE 2omputer and 2ommunications 'ocieties, pages :Y06,
)arch 6---.
3<?5 'cott 2orson and Woseph )acker, L )obile !d 7oc *etworking
%)!*ET&+outing $rotocol $erformance Issues and Evaluation 2onsiderationsM.
Internet"Draft, draft"ietf"manet"issues"-0.txt, )arch 044/. #ork in progress.
3<A5 E.). +oyer and 2.R. Toh, L! review of current routing protocols for ad hoc
mobile wireless networks,M IEEE $ersonal 2ommunications, 0444, A%6&, pp. <A"
??.
3<,5 Theodore '. +appaport, L#ireless 2ommunications $rinciples and $racticeM.
*ew Wersey, $rentice 7all. I'=* -"0:":,??:A":.
3</5 ). Frodigh, $. Wohansson and $. ;arsson. L#ireless ad hoc networking the
art of networking without a network,M Ericsson +eview, *o.<, 6---, pp. 6</"6A:.
3<45 E. ). +oyer and 2."R. Toh. ! review of current routing protocols for ad hoc
mobile wireless networks. IEEE $ersonal 2ommunications, A%6&<AY??, !pril
0444. $roceedings of IEEE I22E4/, pages 0?AY0A-, !ugust 044/.
3?-5 David =. Wohnson and David !. )alt(, L$rotocols for adaptive wireless and
mobile computingM. In IEEE $ersonal 2ommunications, :%0&, February 044A
A?
APPENDIL
SOURCE CODE
[includeSiostream.h\
[includeSfstream.h\
[includeSstring.h\
[includeSstdio.h\
[includeSconio.h\
[includeSmath.h\
[includeSstdlib.h\
class network
T

int
n,totQtrans,kd,failQcount,succQcount,path3,-5,dn0,range,rangeg,k,km,sn0,temp0,temp6,
kc, global,hopQcount;
int power3A-5,nodes3A-53:5,count3A-5365,neighborsQlist3A-53A-5;
float retQmtpr,hQmtpr,thQmtpr,sumQmtpr,psQmtpr3A-5,powerQamount, d3A-53A-5,
neighborQdis3A-53A-5, transQrange, total;
public
int getdata%&;
int getQrange%&;
void createQnetwork%&;
void distance%&;
void neighbors%int&;
void display%int,int,int&;
void getQpower%&;
void pathQfound%int,int&;
void avgQpower%int&;
void avgQthrput%int&;
void avgQhopes%int&;
void avgQretrans%int&;
U;
void main%&
T
Int i,1, num,sng, dng, rr, noQofQtrans;
AA
network nt;
clrscr%&;
coutSS8]nEnter the no. of times do you want to run this program 8;
cin\\noQofQtrans;
numK nt.getQrange%&;
nt.getQpower%&;
for%rrK-;rrSnoQofQtrans;rr>>&
T
nt.getdata%&;
nt.createQnetwork%&;
getch%&;
nt.distance%&;
clrscr%&;
for%iK-;iSnum;i>>&
nt.neighbors%i&;
getch%&;
clrscr%&;
randomi(e%&;
sngKrandom%num&;
coutSS8]n'ource node8SSsng;
dngKrandom%num&;
coutSS8]nDestination node8SSdng;
nt.pathQfound%sng,dng&;
getch%&;
coutSS8]n]n""""""""""""""""""""""8;
coutSS8]n+esult of )T$+]n8;
coutSS8""""""""""""""""""""""""""8;
nt.display%sng,dng,rr&;
clrscr%&;
getch%&;
U
nt.avgQpower%noQofQtrans&;
nt.avgQthrput%noQofQtrans&;
nt.avgQhopes%noQofQtrans&;
nt.avgQretrans%noQofQtrans&;
getch%&;
U
int networkgetQrange%&
T
coutSS8Enter the number of nodes3:"A-58;
cin\\n;
coutSS8Enter the Transmission +ange8;
cin\\transQrange;
return n;
A,
U
int networkgetdata%&
T
clrscr%&;
randomi(e%&;
for%int iK-;iSn;i>>&
T
nodes3i53-5Ki;
nodes3i5305Krandom%:?&;
nodes3i5365Krandom%:?&;
U
for%iK-;iSn;i>>&
power3i5Krandom%A&;
U IIend of getdata%& II
void networkgetQpower%&
T
sumQmtprK-.-;
hQmtprK-.-;
thQmtprK-.-;
retQmtprK-.-;
fflush%stdin&;
for%int iK-;iSn;i>>&
psQmtpr3i5K0--.-;
UIIend of getQpower%& II
void networkcreateQnetwork%&
T
coutSS8]ncoordinates of the nodes are ]n8;
for%int iK-;iSn;i>>&
coutSS8node8 SSiSS88SSnodes3i5305SS8]t8SSnodes3i5365SS8]n8;
getch%&;
clrscr%&;
for%iK-;iSn;i>>&
T
gotoxy%nodes3i5305,nodes3i5365&;
cprintf%8^d8,i&;
U
UIIend of createQnetwork%& II
void networkdistance%&
T
A/
for%int iK-;iSn;i>>&
T
for%int 1K-;1Sn;1>>&
T
if%iKK1&
d3i5315K6--.-;
else
d3i5315Ks9rt%%nodes3i5305"nodes315305&G%nodes3i5305"nodes315305&>%nodes3i5365"
nodes315365&G%nodes3i5365"nodes315365&&;
U
U
U IIend of distance%& II
void networkneighbors%int dd&
T
int kkK-;
for%int 1K-;1Sn;1>>&
T
if%d3dd5315SKtransQrange&
T
neighborQdis3dd53kk5Kd3dd5315;
neighborsQlist3dd53kk5Knodes3153-5;
kk>>;
U
U
count3dd53-5Kdd;
count3dd5305Kkk;
coutSS8]n *eighbors list of node8 SSddSS8 is 8;
for%1K-;1Skk;1>>&
coutSSneighborsQlist3dd5315SS8]t8;
U IIend of neighbors%& II
void networkdisplay%int sng,int dng,int rr&
T
ofstream fout;
if%rrKK-&
T
fout.open%8output.dat8,iosout&;
foutSS8]n+E'C;T' BF )T$+]n8;
foutSS8]n*o. of *odesK8SSn;
foutSS8]nTransmission +angeK8SStransQrange;
foutSS8]n'no.]t'ource]tDest]t*o. of failures]t*o. of 'uccess]t]t*o. of 7opes]t]t]t]t
$ath]n8;
U
A4
else
fout.open%8output.dat8,iosapp&;
coutSS8]n]nFailuresK8SSfailQcount;
coutSS8]n'uccessfulK8SSsuccQcount;
if%succQcount\-&
coutSS8]n*o. of Intermediate 7opesK8SSk;
else
TkK-;
coutSS8]n*o. of Intermediate 7opesK-.-8;U
coutSS8]n$ower of each node are]n8;
for%int iK-;iSn;i>>&
coutSSpsQmtpr3i5SS8]t8;
if%succQcount\-&
hQmtprKhQmtpr>k;
else
hQmtprKhQmtpr>-.-;
thQmtprKthQmtpr>succQcount;
retQmtprKretQmtpr>failQcount;

foutSS%rr>0&SS8]t8SSsngSS8]t8SSdngSS8]t8SSfailQcountSS8]t]t]t8SSsuccQcountSS8]t]t]t8
;
foutSSkSS8]t]t]t]t8SS8pathK8;
if%succQcount\-&
for%iK-;iSKk;i>>&
foutSSpath3i5SS8]t8;
else
foutSS8*I;8;
foutSS8]n8;
fout.close%&;
U II end of display%int,int&
void networkavgQpower%int noQofQtrans&
T
totQtransKnoQofQtrans;
for%int iK-;iSn;i>>&
sumQmtprKsumQmtpr>psQmtpr3i5;
coutSS8]nTotal power in )T$+K8SSsumQmtpr;
coutSS8]nTotal TransmissionK8SStotQtrans;
coutSS8]n!verage $ower in )T$+K8SSsumQmtprIn;
ofstream fout;
fout.open%8output.dat8,iosapp&;
foutSS8]n!verage $ower left per node in )T$+K8SSsumQmtprIn;
fout.close%&;
U II end of avgQpower%int&
,-
void networkavgQhopes%int noQofQtrans&
T
int totQtransKnoQofQtrans;
coutSS8]nTotal no. of hopes in )T$+K8SShQmtpr;
coutSS8]nTotal TransmissionK8SStotQtrans;
if%thQmtpr\-&
coutSS8]n!verage 7opes in )T$+K8SShQmtprIthQmtpr;
else
coutSS8]n!verage 7opes in )T$+K-.-8;
ofstream fout;
fout.open%8output.dat8,iosapp&;
if%thQmtpr\-&
foutSS8]n!verage no. of hop count for successful transmission in )T$+K8SS
hQmtprIthQmtpr;
else
foutSS8]n!verage no. of hop count for successful transmission in )T$+K-.-8;
fout.close%&;
U II end of avgQhopes%int&
void networkavgQthrput%int noQofQtrans&
T
int totQtransKnoQofQtrans;
coutSS8]nTotal throughput in )T$+K8SSthQmtpr;
coutSS8]nTotal TransmissionK8SStotQtrans;
coutSS8]n!verage Throuput in )T$+K8SSthQmtprItotQtrans;
ofstream fout;
fout.open%8output.dat8,iosapp&;
foutSS8]n!verage Throughput in )T$+K8SSthQmtprItotQtrans;
fout.close%&;
U II end of avgQthrput%int&
void networkavgQretrans%int noQofQtrans&
T
int totQtransKnoQofQtrans;
coutSS8]nTotal retransmission in )T$+K8SSretQmtpr;
coutSS8]nTotal TransmissionK8SStotQtrans;
coutSS8]n!verage +etransmission in )T$+K8SSretQmtprItotQtrans;
ofstream fout;
fout.open%8output.dat8,iosapp&;
foutSS8]n!verage no. of retransmission in )T$+K8SSretQmtprItotQtrans;
,0
foutSS8]n$ower 'tatus of each node after 8SStotQtransSS8 transmission in )T$+
is]n8;
for%int iK-;iSn;i>>&
foutSSpsQmtpr3i5SS8]t8;
fout.close%&;
U II end of avgQretrans%int&
void networkpathQfound%int sng,int dng&
T
kKkdKglobalKhopQcountK-;
succQcountKfailQcountK-;
sn0Ksng;
dn0Kdng;
path3k5Ksn0;
for%int iK-;iSn;i>>&
T
if%path3-5KKcount3i53-5&
rangegKcount3i5305;
U
if%rangegKK-&
T
coutSS8]n $ath not found beco( neighbors list of source node 8SSpath3-5SS8is
empty8;
coutSS8]n+outing Failed8;
coutSS8]n *o. of 7opesK 8SSk;
failQcount>>;
hopQcount>>;
return;
U
while%hopQcountSK0A&
T
for%iK-;iSn;i>>&
T
if%sn0KKcount3i53-5&
rangeKcount3i5305;
U
coutSS8]n*eighbors of node 8SSsn0SS8 is8;
for%int iK-;iSrange;i>>&
coutSSneighborsQlist3sn053i5SS8]t8;
if%rangeKK-&
T
coutSS8]n$ath is 8;
for%iK-;iSk;i>>&
coutSSpath3i5SS8]t8;
,6
coutSS8]n]n*o. of hopsK8SSk;
coutSS8]n$acket is dropped beco( there is no neighbors of node 8SSsn0;
coutSS8]n*eighbors of source node 8SSpath3-5SS8 is8;
for%int iK-;iSrangeg;i>>&
coutSSneighborsQlist3path3-553i5SS8]t8;
coutSS8]nTake next node of source node as new source8;
coutSS8]n+esent the packet8;
hopQcount>>;
failQcount>>;
getch%&;
global>>;
if%globalSrangeg&
T
sn0KneighborsQlist3path3-553global5;
psQmtpr3path3-55KpsQmtpr3path3-55"6.-;
psQmtpr3sn05KpsQmtpr3sn05"0.?;
kK-;
path3k5Kpath3-5;
k>>;
path3k5Ksn0;
continue;
U
else
T
coutSS8]n+outing Fail beco( there is no neighbors remaining of source node
8SSpath3-5;
failQcount>>;
break;
U
UII end of if II
for%iK-;iSrange;i>>&
T
if%dn0KKneighborsQlist3sn053i5&
T
coutSS8]n]nDestination 8SSdn0SS 8 Found8;
k>>;
path3k5Kdn0;
coutSS8]n]n$ath to from source node 8SSpath3-5SS8 to Destination node 8SSdn0SS
8is8;
for%iK-;iSKk;i>>&
coutSSpath3i5SS8]t8;
coutSS8]n]n*o. of 7opsK8SSk;
succQcount>>;
psQmtpr3sn05KpsQmtpr3sn05"6.-;
psQmtpr3dn05KpsQmtpr3dn05"0.?;
,:
kdK6---;
break;
U
UIIend of for loopII
if%kdKK6---&
break;
for%iK-;iSrange;i>>&
T
kmK-;
for%int klK-;klSKk;kl>>&
if%path3kl5KKneighborsQlist3sn053i5&
kmK0;
if%kmKK-&
break;
U
if%kmKK0&
T
coutSS8]n]n$ath to from source node 8SSpath3-5SS8 to Destination node 8SSdn0SS
8is not
reachable8;
coutSS8]n !ll neighbors of node 8SSsn0 SS8 are visited before8;
coutSS8]n$acket is dropped8;
coutSS8]n$ath is 8;
for%iK-;iSKk;i>>&
coutSSpath3i5SS8]t8;
coutSS8]n]n*o. of 7opsK8SSk;
coutSS8]n*eighbors of source node 8SSpath3-5SS8 is8;
for%int iK-;iSrangeg;i>>&
coutSSneighborsQlist3path3-553i5SS8]t8;
coutSS8]nTake 8SS%global>0&SS8 node of source node as new source8;
coutSS8]n+esent the $ackets]n8;
hopQcount>>;
failQcount>>;
getch%&;
global>>;
if%globalSrangeg&
T
sn0KneighborsQlist3path3-553global5;
psQmtpr3path3-55KpsQmtpr3path3-55"6.-;
psQmtpr3sn05KpsQmtpr3sn05"0.?;
kK-;
path3k5Kpath3-5;
k>>;
path3k5Ksn0;
,<
continue;
U
else
T
coutSS8]n+outing Fail beco( there is no neighbor remaining of source node
8SSpath3-5;
failQcount>>;
getch%&;
break;
U
getch%&;
UIIend of bigger ifII
psQmtpr3sn05KpsQmtpr3sn05"6.-;
sn0KneighborsQlist3sn053i5;
k>>;
path3k5Ksn0;
if%k\0?&
T
coutSS8]n+outing Fail beco( no of intermediate nodes exceeds 0A8;
coutSS8]n*eighbors of source node 8SSpath3-5SS8 is8;
for%int iK-;iSrangeg;i>>&
coutSSneighborsQlist3path3-553i5SS8]t8;
coutSS8]nTake 8SS%global>0&SS8 node of source node as new source8;
coutSS8]n+esend the packet8;
global>>;
getch%&;
if%globalSrangeg&
T
sn0KneighborsQlist3path3-553global5;
psQmtpr3path3-55KpsQmtpr3path3-55"6.-;
psQmtpr3sn05KpsQmtpr3sn05"0.?;
kK-;
path3k5Kpath3-5;
k>>;
path3k5Ksn0;
hopQcount>>;
failQcount>>;
U
else
T
coutSS8]n+outing Fail beco( there is no neighbor remaining of source node
8SSpath3-5;
failQcount>>;
hopQcount>>;
getch%&;
,?
break;
U
U IIend of if II
else
psQmtpr3sn05KpsQmtpr3sn05"0.?;
UIIend of while loopII
if%hopQcount\0A&
T
coutSS8]n7op count exceeds 0A8;
failQcount>>;
getch%&;
U
UIIend of pathQfound%int&
,A
,,

Vous aimerez peut-être aussi