# Cross-Layer-Aided Opportunistic Routing for Sparse Underwater Wireless Sensor Networks
## 4 CLOR Protocol
### Process of CLOR
#### 4.2.2 Negotiation Process
The node uses a request mask \(M_{\eta}\) to indicate the data packets that are requested to be sent. Since the RTF conveys a series of information for the data packets of burst transmission, the node sets the bit field value of the position in \(M_{\eta q}\) to 1 if it requires the data packet (line 13). If at least one packet is requested to be sent, the node executes the candidate set selection algorithm by using the fuzzy logic method (line 15). If all the data packets in the burst transmission have been received, the node will skip this algorithm and set the output value of fuzzy logic \(F_{\mathit{prg}}\) to zero. Then, it returns back a CTF packet that contains \(M_{\eta q}\), \(F_{\mathit{prg}}\), and the topological information of itself (line 17). Meanwhile, the node sets a timer to wait for the data packets according to the bit field value of \(M_{\eta q}\). If all the bit field values of \(M_{\eta q}\) are zeros, the node ignores the following transmission and goes back to IDLE state. ```
1: updates neighbor table and topological information. 2:if(\(State=WFCTF\)) then
3:if(\(N_{Q}(x)\leq N_{Q}(RTF)\)&&\(D_{x}<D_{RTF}\)) then
4: back off according to (9)
5:endif
6: discard \(P_{RTF}\)
7:elseif(\(State\
eq IDLE\)) then
8: discard \(P_{RTF}\)
9:elseif(\(y\
otin C_{x}\)) then
10: back off according to (9)
11: discard \(P_{RTF}\)
12:else
13: set \(M_{\eta q}\) according to the burst information in \(P_{RTF}\);
14:if(\(bitsum(M_{\eta q})\
eq 0\)) then
15: execute fuzzy logic
16:endif
17: create a CTF packet and send it to transmit queue. 18:endif
```  
**Algorithm 1** Upon receiving an RTF packet \(P_{RTF}\)  
If it has not received any reply when the timer expires, the node restarts a new negotiation until the retry times reach the maximum value. Once receiving a CTF, the sender updates topological information, link quality, and requesting mask. We define the mask from the \(i_{th}\) CTF packet \(M_{rq}(i)\) as below. \[M_{rq}(i)=\sum_{j=1}^{N_{BT}}b_{rq}(i,j)x^{j} \tag{10}\]  
where \(b_{rq}(i,j)\) is the \(j_{th}\) bit field value of the require mask in the \(i_{th}\) CTF packet, and \(N_{BT}\) is the number of original data packets in the burst transmission. In addition, to improve the transmission effectiveness at high traffic rates, this paper introduces a minimum value of burst size \(N_{mBT}\). A negotiation can be triggered only in case that the number of packets in the data queue is higher than or equal with the threshold \(N_{mBT}\). In addition, to avoid that a transmission occupies a channel for a long time, a maximum value \(N_{MBT}\) needs to be set. The number of the outgoing original packets should not be larger than \(N_{MBT}\). As the waiting timer expires, the node calculates a transmission mask \(M_{tx}\) as below. \[M_{tx}=\sum_{j=1}^{N_{BT}}\left(\prod_{i=1}^{N_{ctf}}b_{rq}(i,j)\right)x^{j} \tag{11}\]  
where \(N_{ctf}\) is the number of CTF packets that has been received by the sender. Then, the sender checks the bit field in \(M_{tx}\). If all the data packets in transmission queue have been received by these nodes in the candidate set, the sender will remove these data packets in the queue and cancel the following transmission. Otherwise, the sender executes the candidate set selection algorithm to calculate the priority of forwarding as below. \[F_{c}(i)=\omega_{c}\cdot F_{prg}(i)+(1-\omega_{c})\frac{1}{hc_{i}} \tag{12}\]  
where \(hc_{i}\) is the hop count of the \(i_{th}\) node in the candidate set, \(F_{prg}(i)\) is the output value of the fuzzy logic that represents the progress of the \(i_{th}\) node, and \(w_{c}\in[0,1]\) is a weight factor. Finally, the sender selects the node with the highest value of \(F_{c}(i)\) as an optimal forwarder.