## 4 Quality-Aware Routing and Channel Assignment in Multi-Channel Multi-Gateway WOBAN
### JRCA Routing Protocol  
The detailed JRCA routing protocol can be illustrated by the following set of actions. JRCA is a reactive routing protocol that tries to maximize the packet delivery ratio while reducing the end-to-end latency [2].  
**Route Discovery:** In JRCA, when a source router does not have a route to any destination (or gateway), it broadcasts a route request packet (RREQ) to its neighbors. The RREQ contains the following key fields:  
\(\langle\)RREQ ID, destination address, source address, number of active neighbors of the sender (\(A\)), accumulated POS on the current route (\(P_{S}\)), accumulated delay in the current route (\(T_{d}\)), timestamp\(\rangle\)  
These quantities \(A\), \(P_{S}\), \(T_{d}\) and the timestamp are initialized at the source router: \(A\) is initialized to the number of active neighbors of the source, \(P_{S}\) and \(T_{d}\) are set to 1 and 0, respectively, and the timestamp is set to the time when the RREQ packet is generated. Every intermediate node updates the accumulated delay and POS based on the number of active neighbors of the previous node and its active interferers before forwarding it. The RREQ ID combined with the source address uniquely identifies a route request. This is required to ensure that the intermediate nodes rebroadcast a route request only once in order to avoid broadcast storms. If an intermediate node receives a RREQ more than once, it discards it. All intermediate nodes follow the same principle and forward the RREQ until it reaches the gateways. The timestamp is used to avoid the unnecessary flooding of RREQ packets.  
**Route Selection:** The destinations (gateways) wait for the first \(\mathcal{N}\) RREQ packets, which is assumed to be 10 in our simulations. Then, they (a) run _backtracking_ and _genetic algorithm_ on all the routes carried by the RREQ packets, (b) collaborate with each other and (c) choose the routes and channels that maximizes route quality \(Q\). The node locations and their neighborhood information are used while calculating \(Q\). After choosing the route with highest \(Q\), the gateway that receives the best route (carried by RREQ) forwards a route reply packet (RREP) back on the same route. The RREP packet contains the following key fields:  
\(\langle\)source address, destination address, assigned channels of the interfaces, timestamp\(\rangle\)  
The intermediate nodes (a) forward the RREP back to the source in the reverse path, (b) perform channel switching if required (conveyed in the RREP packet), and (c) update their routing table entry. The source after receiving the RREP starts sending the data packets via this route.  
**Route Maintenance:** If a routing table entry is not used for a long time, that entry is erased. This is required to make the scheme robust against the temporal variation of the wireless channels. Thus, after a long time, if a source router needs a route to the gateway, it starts a new route discovery to find a good quality route.  
In JRCA, we assume a dedicated control channel on which all nodes assign a NIC. This is the _default channel_ which is mainly used to send RREQ and RREP packets. Other interfaces are switched between different data channels for data transmission. The overall scheme of JRCA is depicted in Figure 8.