## 5 RC-LARR: RSU-Assisted Cloud-Based Location-Aware Hybrid Routing
### Route Discovery  
Whenever a node needs to send data to another node, first, it checks whether the node is in its neighbor list. If it is present in the list, it just receives confirmation from the destination node, and after that, the node starts sending the data packets to the destination node. If the sender does not find the node in its table, it sends the route request to the RSU. The RSU checks if the destination node is inside its range. If the destination node is in range, it just calculates the route using Find Route Algo and sends RREP to all the nodes in the range. If the destination node is not in the range of the RSU, it sends the route request to the neighboring RSUs. If the RSU does not find the route in its routing table, it sends the route request to its neighboring RSUs. If the neighboring RSU does not find the route, then finally the route request is sent to the cloud, which acts as control plane layer 2. The cloud server stores the global view of the topology. Control plane layer 2 finds the route using the Find Route algorithm, and it sends the route to all concerned RSUs from which the node is picked. Further, all RSUs send the RREP to all the nodes in the range. Algorithm 2 is described as the routing protocol. As stated in Algorithm 3, the _FindNeighbour_ function determines the nest hop. To calculate the next hop, the whole range of the node was divided into four different zones, as illustrated in Figure 12.  
The nodes available near the sender node will be available for longer, but it will increase the hop count. If the next hop is available inside _PZ1_ (Priority Zone 1), the hop count will be lower. If a node is not available in _PZ1_, the next priority is given to _PZ2_, then _PZ3_, and so on. The division of the zones is decided based on the simulation results. ```
Input: S, D [S=Source, D=Destination] Output: mlist
```
1 Begin
2 mlist=S
3 path=false
4 mlist=FindNeighbour(S)
5 While (nlist!=phi)
6 do
7 For each Vi \(\in\) nlist
8 do
9 IfVi=D then
10 path=true
11 mlist=nlist \(\cup\) Vi
12 break;
13 EndIf
14 IfVi \(\
otin\) mlist then
15 temp=FindNeighbour(Vi)
16 mlist=append(nlist, temp)
17 mlist=mlist UL Vi
18 EndIf
19 EndFor
20 Ifpath=true then
21 break;
22 EndIf
23 Endwhile
24 Ifpath=true then
25 Returnmlist
26 EndIf
27 else
28 Returnmull
29 End
```

**Algorithm 2**FindRoute(S, D, mlist)

Figure 12: Priority zone division for next hop calculation. ```
Input: VID=Vehicle ID Output: nexthop
```
1. Begin
2. Priority:=0
3. for eachVn in Vehicle_List[n][0....n]
4. IfVn.Priority \(\geq\) Prioritythen
5. Priority=Vn.Priority
6. Temmode.loc=Vn.loc;
7. Temmode.id=Vn.VID
8. Temmode.RSU_ID=Vn.RSU-ID
9. End If
10. End For
11. Reutrn Temmode
12. End ```
**Algorithm 3**FindNeighbour

### Packet Forwarding

Once the route is decided, the route is sent to the nodes, which are involved in forwarding packets. The source node starts sending data with the route. Each hop in the route is aware of the next hop, as the RSU sends the route to all nodes. If the route link breaks down in the middle of forwarding data, the hop for which the next hop is lost sends a message to the RSU, and the RSU provides the new route to the nodes. A session is maintained at the sender node. The sender starts sending packets from the end point of the previous session whenever the RSU provides the new route. Algorithm 4 defines the packet forwarding mechanism. ``` Input: S = Source Node, D = Destination Node, H = Next Hop, P = Packet Output: Acknowledgement ```
1. Begin
2. ACK \(\leftarrow\) sendPacket(S, D, H, P) //Sends the data packet
3. If ACK is not foundthen
4. Ctr:=0;//initialise the counter
5. ACK=null//initialise the acknowledgement null
6. WhileCtr<tll do
7. ACK \(\leftarrow\) SendPacket(S, D, H, P)
8. If ACK is foundthen
9. Return ACK;
10. End If
11. Done
12. If ACK is nullthen
13. InformRSU(S, D, H)
14. End If
15. Else
16. Return ACK;
17. End If
18.