## 4 The Role of Routing Protocols to Resilience in Self-Configuring WSNs
### Fundamentals of AODV, DSR and MPH Routing Protocols  
In AODV, a node sends an RREQ packet (route request) in broadcast mode in order to apply for a route. If a node receives this packet, it first checks if it has previously received a record of this RREQ packet. If the packet is not registered, the node retransmits it again, increasing the number of hops and creating a reverse path (the path to the node that this RREQ has reached). A node that has received an RREQ packet can only respond with an RREP packet (route reply) to confirm a route in only two cases: if the node is already the destination or if the node has an available route to the destination. This procedure continues until the source is reached. The source node may receive RREP packets from different nodes as a confirmation of various possible routes to the destination. In this case, the source node has two criteria for selecting the best route: the route that has the least number of hops or the route that has the highest sequence number. Then, nodes can have multiple routes to the same destination; the node generally chooses the shortest route. In DSR, when a source node has a packet to send to a destination, it first looks in its cache to see if it has a route to that destination; if so, it creates a new packet header containing the path with the necessary hops to reach the destination and sends it. If there is no route to that destination in its cache, the node starts the route discovery mechanism, where the source node sends an RREQ broadcast packet, which contains the identifier of the source node and that of the destination node whose route is to be discovered; it also contains a unique identifier for the RREQ. Each intermediate node makes a copy of the received RREQ and adds its identifier. When a node receives a RREQ, it first looks in its cache to find out if it has the route to the destination node. If so, the node responds with an RREP to the source instead of forwarding the RREQ. In that RREP, the node writes all nodes that the received RREQ has passed through and the nodes of the route found in its cache. If the node does not find a route in its cache, it adds its address in the packet and forwards it via broadcast. Once the source node receives the RREP, it stores the route in its cache. This route will be included in the header of each subsequent packet that thenode sends, so that all nodes that receive the packet will know to which next node they should resend. As with AODV, nodes can have multiple routes to a destination and choose the lowest hop count. MPH is a routing protocol that creates a logical hierarchical network topology where the node hierarchy is given by its location level in the hierarchy (the lower the level, the lower the hierarchy) [6]; basically, the root hierarchy (coordinator node) will have the highest hierarchy. When a node is in a specific hierarchical level (or generation), the nodes that are connected to it and have a higher hierarchical level are parent nodes. On the other hand, nodes that are connected to any parent node and that have lower hierarchical level are child nodes. The hierarchical topology will be formed with routes that minimize the number of hops from a given node to the coordinator; this restriction will reduce the overall energy consumption of the network. The MPH routing protocol allows a child node to have one or more parents. As a result, a node can share both children and parents with another node belonging to the same hierarchical level or generation. When a node cannot reach a specific neighbor node, then it deletes it from its neighbor table.