Research Article

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

Algorithm 1

The algorithm for obtaining the next user-data message from the data queue.
  for  each  msg  in  data-queue  do
(2)  if  IS-PENDING-TIME-EXPIRED(msg) then
   The message has been waiting too long for a route. It cannot be delivered.
(3)   DELETE-MESSAGE(msg)
(4)  else
(5)   if  STATE(msg) = WAITING-FOR-ACK
   and  IS-ACK-TIME-EXPIRED(msg) then
(6)    STATE(msg) PENDING
(7)   end  if
(8)   if  STATE(msg) = PENDING then
(9)    route   ROUTE-SEARCH (ORIG(msg), DEST(msg))
(10)       if  route =   then
      Enqueue a route-request message if one isn’t already outstanding according to
     the route-request table.
(11)     ROUTE-REQ-MAYBE (DEST(msg))
(12)       else
      Stop searching and return this message for transmission.
(13)      STATE(msg) WAITING-FOR-ACK
(14)     return  msg
(15)       end if
(16)   end if
(17)  end if
(18) end for
There are no data messages to transmit at this time
(19) return NO-MSG