## 4 Medium Access and Network Layer Protocols
### Medium Access Layer Protocols
#### 4.1.1 User Implementation of Distance-Aware Collision Avoidance Protocol  
The distance-aware collision avoidance protocol (DACAP) [17] is an access control protocol that operates asynchronously and is based on the acknowledgment of individual connections between modems. When exchanging data, the modem sender planning to transmit information to another modem generates a Request to Send (RTS). Upon receivingthe Request to Send (RTS), the modem receiver immediately responds with a Clear to Send (CTS) and then waits for the data packet. After sending the transmission-enabling packet, if the modem receiver detects activity in the transmission medium that could lead to signal corruption, it generates a short warning signal, resulting in message transmission cessation. Following the receipt of the clearance command, the modem sender observes a brief pause. If during this pause there is activity from other modems or the modem sender receives a warning signal from the modem receiver, data transmission is canceled. The delay time for transmission depends on the distance between the source and the recipient. The waiting period is chosen to ensure the absence of harmful collisions. Consequently, the \"handshake\" time between nearby neighbor modems can be kept short, while between remote nodes, it needs to be longer.  
To optimize network bandwidth, a predefined minimum handshake length, denoted as \(t_{min}\), is established for all nodes. This mechanism facilitates efficient data transfer performance and guarantees minimal waiting time.  
The waiting period is selected to prevent any detrimental collisions. Consequently, the handshake duration between proximate modems, such as those used by neighbors, can be kept brief. However, for remote nodes, it is essential to extend the handshake time.  
The protocol's overall structure is illustrated in Figure 6.  
Figure 6 illustrates the state machine and transition events for a device involved in transmitting and receiving data. The left and right sides represent the states, while the center contains states relevant to both roles. The algorithm begins in the IDLE state. If there are data to send and the RTS signal was previously sent, it transitions to the WAIT_CTS state. On the receiving side, if the RTS is accepted, the device enters either the SEND_CTS or the BACKGROUND state, depending on whether the data are intended for it.  
The DACAP protocol relies on the packet transmission time between transmitting and receiving nodes. The priority value is determined by the distance between these nodes,  
Figure 6: DACAP finite state machine.  
and RTS/CTS \"handshakes\" are essential for distinguishing transmissions among nearby nodes. If a node does not participate in the transfer, it enters a \"rollback\" state, from which it exits either at the end of other nodes' transfers or after reaching the waiting time interval calculated using the following formula:  
\[T_{per}=\begin{cases}t_{\text{min}}-2U/C,&U/c>\frac{t_{\text{min}}-\min(\Delta D /c,t_{\text{data}},2T-t_{\text{min}})}{2(U+\Delta D)/c-t_{\text{min}}},&U/c> \frac{t_{\text{min}}-\min(\Delta D/c,t_{\text{data}},2T-t_{\text{min}})}{2}\,, \end{cases}\]  
where \(c\) represents the speed of sound propagation in water; \(U+\Delta D\) denotes the minimum distance to the interfering node, where correct reception is still feasible; \(\text{t}_{\text{data}}\) signifies the data transfer rate; and \(\text{t}_{\text{min}}\) corresponds to the time of transmission for CTS/RTS signals. The algorithm of the DACAP protocol is presented in Appendix A, Algorithm A1.