Research Article

Hybrid Internal Anomaly Detection System for IoT: Reactive Nodes with Cross-Layer Operation

Pseudocode 4

Data anomaly deduction from nodes observation.
while (sbrt_timer expired)
for every node (n_i) in network
  for every nbr (n_j) of n_i
   if (n_i reported anomaly of n_j && open) then
    if (n_i is parent) then
     new_nbr:= count(nbr[n_j] reported dpo_type_1 after n_i anomaly report);
     new_nbr_an:= count(new_nbr reported anomaly);
     if (new_nbr > 0) then
      if (new_nbr_an < new_nbr) then
       //do nothing;
      else
       set data_anomaly of n_j;
      } end if
     else
      set data_anomaly of n_i;
     } end if
    else
     if (count(nbr[n_j] reported inactivity) < (count(nbr[n_j])
      //do nothing;
     else
      set unreported_data_anomaly of n_i;
     } end if
    } end if
    set closed;
   } end if
  }
 }
reset sbrt_timer;