\section{Dynamic Source Routing Protocol Overview}\label{Dynamic Source Routing Protocol Overview}
In this section, we briefly describe the key features of the Dynamic Source Routing protocol (DSR). DSR is a simple and efficient routing protocol designed for use in multi hop wireless ad hoc networks of mobile nodes. The protocol was first presented and described by David A. Maltz, David B. Johnson and Josh Brock in 1994. DSR allows nodes to dynamically discover a source route "on the fly" across multiple network hops to any destination in the ad hoc network. Each sent data packet carries in its header the complete, ordered list of nodes through which the packet must pass, allowing packet routing to be trivially loop free and avoiding the need for up-to-date routing information in the intermediate nodes.

  DSR is composed of two main mechanisms: Route Discovery and Route Maintenance. These two mechanisms work together to allow and maintain routes to specific destinations in the ad hoc network. The Route Discovery mechanism handles the routes establishment, being used whenever a node does not know the route to a destination node to which a packet is to be sent. Route Maintenance is the mechanism responsible for keeping routing information up to date, indicates that the source route is broken or can invoke the Route Discovery again to find a new route. These two mechanisms operate "on demand", which means that DSR does not require to produce periodic packets, or to send neighbor detection packets. As a consequence of this on demand behavior, the overhead originated by DSR scales practically down to zero in conditions of low mobility where the number of network topology changes is reduced. DSR also supports unidirectional and asymmetric links. In response to a single Route Discovery, if a node learns and caches multiple routes to a destination, it can try an alternative route if the one used first fails. Therefore, the overhead incurred by performing a new Route Discovery can be avoided when the caching of multiple routes to a destination occurs. In Sections 2.1 and 2.2 a more detailed description of the main protocol mechanisms will be offered.\subsection{Basic DSR Route Discovery Mechanism}In DSR, the route to a specific destination node is obtained through Route Discovery. Route Discovery is the mechanism by which a source node S willing to send a packet to a node D obtains a possible sequence of nodes -the so called source route- through which the packet could be forwarded to reach that destination. If a node has a packet to send to a specific node for which it does not have a route, it initiates route discovery by broadcasting a ROUTE REQUEST. Each ROUTE REQUEST message identifies the initiator and target nodes of the Route Discovery. It also contains a route record listing the address of each intermediate node through which this copy of the ROUTE REQUEST message has been forwarded. The sender of the Route Discovery initializes the route record to an empty list. If an intermediate node receives a ROUTE REQUEST message, and its own address is not already contained in the route list, it appends its own address as the next hop of the sequence and propagates it by transmitting it as a local broadcast packet. However, if the node finds its own address is already listed in the route record of the ROUTE REQUEST message, it discards the REQUEST message in order to avoid request loops in the Route Discovery process. When the target node receives the ROUTE REQUEST message, it returns a ROUTE REPLY message to the Route Discovery initiator with a copy of the accumulated route record from the ROUTE REQUEST. The reply packet can be sent simply reversing the sequence of nodes stored in the route record of the ROUTE REQUEST, or initiating a new independent Route Discovery process from D to S. When the initiator receives the ROUTE REPLY, its route record is cached in the Route Cache and is used in sending subsequent packets to this destination.\newline 
Figure 1 provides an illustrative example of the Route Discovery mechanism, where an initiator node A is attempting to find a route to node E. In first place A initiates a Route Discovery and broadcasts a ROUTE REQUEST message, which is delivered to all 'A' neighbors. In our example, node B is the next hop to receive the request packet.
\begin{figure*}
\centering
\includegraphics[width=6in]{dsrdesc}
\centering
\begin{center}
\textbf{Figure 1} Route Discovery illustrative example
\end{center}
\end{figure*}

  Each Route Request contains sender and destination address, a unique sequence id (1 in our example) set by the sender, and a route record that lists the address of each intermediate node, through which this packet is forwarded. When the Request Route reaches the E, it sends a ROUTE REPLY message back to the sender. When the sender receives this Reply, it caches this route in its Route Cache and uses the sequence of hops to route the data from A to E.

  When the Route Discovery is initiated, the initiator node must store the packet to be sent in a local buffer named Send Buffer until a route to the destination node is determined. The Send Buffer serves as a temporary area where the node keeps a copy of each packet that cannot be transmitted because it does not have a route yet to its corresponding destination node. The node can initiate a new Route Discovery for a packet's destination address waiting in the buffer if no reply is received within an established timeout period. However, it is to be noted that the initiator node must limit the rate at which new route discoveries are started for the same destination, in order to avoid unnecessary requests and routing overhead across the network in case the destination node is currently unreachable -due to network partitions, which can be rare or common depending on a number of factors such as nodal density or node movement pattern in the network.
\subsection{Basic DSR Route Maintenance Mechanism}
Route Maintenance is the mechanism by which a source node S is able to detect, while using a source route to a destination node D, if the network topology has changed so that it can no longer use its route to D because a link along the route is no longer available. It is to be noted that Route Maintenance is performed only when S is actually sending packets to D using a route acquired during the previous Route Discovery process. When Route Maintenance indicates a source route is broken, S can look up in the Route Cache and attempt to use any other route it happens to know to D, or it can invoke Route Discovery again to find a new route.
\begin{figure*}
\centering
\includegraphics[width=6in]{dsrmain}
\begin{center}
\textbf{Figure 2} Route Maintenance illustrative example
\end{center}    
\end{figure*}

  In figure 2, each node confirms the correct reception of a packet to the previous hop while A is sending packets to E. The confirmation of arrival (acknowledgement) can be done by means of passive acknowledgements or making use of link-layer mechanisms such as option in MAC protocol. When a node is unable to deliver a packet to the next node then the node sends a ROUTE ERROR message to the original sender of the packet. The Sender then removes the broken link from the Route Cache and then leaves the retransmission to be done by the upper layers.              
