Research Article

RLT Code Based Handshake-Free Reliable MAC Protocol for Underwater Sensor Networks

Algorithm 1

Encoding and transmitting.
()    INPUT: data block
()    OUTPUT: encoded packets delivery
()    Upon  receiving a data block of size    do
()      encodes packets to generate encoded packets;
()      set the frame sequence number of the first encoded packet to ;
()      // used to notice the overhearing nodes that the sender will transmit frames subsequently
()      set the frame sequence number of the second packet to , and so on till last to “1”;
()      // also used to notice the overhearing nodes the frame number transmitted subsequently
()      set the “immediate ACK” field of the first frame as well as the last to “1”, others to “0”;
()   find the next hop (receiver) in routing table;
()   while  (the state of the receiver ≤1)  then
()   put off delivery;
()   endwhile
()     if  (the state of the receiver >1) & (backoff_timer is timeout)  then
()   switch to sending state and transmit the first frame; // start one transmission stage
()   switch to receiving state; // waiting for the ACK
()   if  (receive the ACK for the first frame with “0” in the index field)  then
()    switch to sending state and send the other frames subsequently;
()   set  backoff_time = ;
()    switch to receiving state; // waiting for ACK for the block
()    // the first transmission stage for the block is over.
()   if  (receive the ACK for the block)  then
()     if  ( frames of the block are unrecovered successfully, )  then
()       set ;
()       goto  line ();
()     endif
()      else  (not receive the ACK for the block)
()       if  (the state of the receiver >1) & (backoff_timer is timeout)  then
()        switch to sending state and send the last frames again;
()        switch to receiving state; // waiting for ACK for the block again;
()       else
()        goto  line ();
()       endif
()        goto  line ();
()      endif
()   else  (not receive the ACK for the first frame)
()      set  backoff_time = ;
()      goto  line ();
()   endif
()     endif
() endupon