|
Algorithm 1. Energy efficient probe message forwarding mechanism |
-
1.
When an intermediate node vm receives a probe message:
-
2.
if (vm has not forwarded the probe message)
-
3.
Add its ID in the “Forwarders ID” field included in the probe message;
-
4.
Calculate NF based on the “Forwarders ID” field;
-
5.
Calculate (EOH–NF); // the EOH is obtained from the “EOH” field
-
6.
if (vm has neighbors) //vp is not included
-
7.
Select the neighbor whose EOH is closest to (EOH–NF) as an optimal forwarder;
-
8.
Forward the probe message to it;
-
9.
end if
-
10.
else
-
11.
//suppose that vm has forwarded the probe message to vn, but then receives this message again from it
-
12.
Explore the neighbors that have not forwarded this probe message;
-
13.
Delete the IDs of vm, vn from the “Forwarders ID” field;
-
14.
Node vm adds its ID in the “Forwarders ID” field;
-
15.
Calculate NF based on the “Forwarders ID” field;
-
16.
Calculate (EOH–NF);
-
17.
if (the explored neighbors exist)
-
18.
Select the neighbor whose EOH is closest to (EOH–NF) as an optimal forwarder;
-
19.
Forward the probe message to it;
-
20.
end if
-
21.
end if
-
22.
if (only the neighbor vp of vm is in working status)
-
23.
Forward the probe message to vp;
-
24.
else //vm is in sleeping status
-
25.
Stop forwarding this probe message;
-
26.
end if
|