Research Article

Location-Aware Source Routing Protocol for Underwater Acoustic Networks of AUVs

Algorithm 2

The algorithm for obtaining the next user-data message from the data queue.
  for each  msg  in  protocol-queue  do
(2)  if STATE(msg) = WAITING-FOR-ACK
    and IS-ACK-TIME-EXPIRED(msg) then
(3)    STATE(msg) PENDING
(4)  end if
(5)  if STATE(msg) = PENDING then
(6)   if MSG-TYPE(msg) = ROUTE-REQUEST then
      Route request message contain a route ending at the local node.
(7)    dest local-node
(8)   else
      Route reply message contain a route ending at the message’s destination.
(9)    dest DEST(msg)
(10)      end if
   Both message type contain a route starting at message’s originator.
(11)    route ROUTE-SEARCH (ORIG(msg), dest)
(12)      if  route =   then
      A protocol message without a route is deleted.
(13)    DELETE-MESSAGE(msg)
(14)   else
       Stop searching and return this message for transmission
(15)    STATE(msg) WAITING-FOR-ACK
(16)    return  msg
(17)   end if
(18)  end if
(19) end for
There are no protocol messages to transmit at this time.
(20) return NO-MSG