if round == 1 then |
BS broadcasts Level-Msg containing routing_level = 1. |
if SN receives the broadcasting message then |
if Message is Level-Msg then |
if routing_level of node != 0 then |
if routing_level of node > routing_level within received message then |
Update routing_level of SN |
if Node is CH then |
routing_level routing_level + 1 |
Broadcast new Level-Msg (ID, routing_level) |
end if |
end if |
Else |
Update routing_level of SN with routing_level within received message |
end if |
else if Message is Level-Request-Msg then |
if routing_level of node != 0 then |
Send Reply-Request-Msg (ID, routing_level) to the requested SN |
end if |
End |
else |
Waiting for Level-Msg when T1 is expired |
if Node is CH then |
Broadcast Level-Request-Msg (ID) |
Waiting for Level-Reply-Msg when T2 is expired |
if Node receive Level-Reply-Msg then |
if Node is CH then |
Update routing_level of SN with routing_level within received message |
routing_level routing_level + 1 |
Broadcast new Level-Msg (ID, routing_level) |
end if |
Else |
Waiting for Level-Reply-Msg when T3 is expired |
routing_level 100 |
end if |
Else |
Waiting for Level-Msg when is expired |
routing_level 100 |
end if |
end if |
end if |