Skip to main content
. 2020 Feb 18;20(4):1108. doi: 10.3390/s20041108
Algorithm 3 Algorithm for Gateway-independent and Gateway-assisted Trust Evaluation
Input: The trustiness of the node k Tk
    The node u is who sends a query against suspicious node w
    The forwarding ratio of the node kFork
    The malicious node threshold of suspicious node wMaliw
    The set of child nodes v
    The logical inspection node l
Output: Whether the suspicious node is malicious or normal
//Collaborative inspection
gateway sends collaborative inspection response to node u
node u relay response to child nodes v except suspicious node w
for node cv do
 node c collects transmission/reception information
 node c reports to node u
end for
node u calculates Forw about suspicious node w
ifForw < Maliw then
 suspicious node w becomes malicious node
else
 suspicious node w becomes normal node
end if
//Logical inspection
gateway selects node l with the highest trustiness T among 1-hop nodes of suspicious node w
gateway sends logical inspection response to node l
count0
fori = 1 to 5 do
 node l selects random interval time ti
 node l calculates Forw in ti seconds about suspicious node w
if Forw < Maliw then
  count++
end if
end for
ifcount > 2 then
 suspicious node w becomes malicious node
else
 suspicious node w becomes normal node
end if
//Physical inspection
gateway sends physical inspection response to drone node
count0
drone node goes to suspicious node w area
drone node collects transmission/reception information about suspicious node w
fori = 1 to 10 do
 gateway calculates Forw in t seconds about suspicious node w
if Forw < Maliw then
  count++
end if
end for
ifcount > 4 then
 suspicious node w becomes malicious node
else
 suspicious node w becomes normal node
end if