Skip to main content
. 2022 Dec 1;22(23):9389. doi: 10.3390/s22239389
Algorithm 2. Detection and matching
INPUT: input pkgs = { P1, P2,…, Pn }
    policy table: F = { F1, F2,…, Fn }
OUTPUT: Event_Match
1. for each Pi in pkgs do
2.   for each Fi in F
3.     if Pi.ip == Fi.ip do
4.        if L(Pi) in Fi.key and L(Pi) not in Fi.keylist do
5.           Fi.keylist.append(L(Pi))
6.           Fi.lastpkt_time = T(Pi)
7.        endif
8.        if L(Pi) in Fi.high and L(Pi) not in Fi.highlist do
9.           Fi.highlist.append(L(Pi))
10.          lastpkt = T(Pi)
11.       endif
12.    endif
13.  endfor
14.  for each Fi in F
15.    if L(Fi.keylist) >= L(Fi.key)–fix and L(Fi.highlist) >= L(Fi.key)–high fix do
16.       Event_Match [Fi.name].append(Fi.lastpkt_time)
17.       clearall F.keylist, F.highlist, F.lastpkt_time
18.       break
19.    endif
20.  endfor
21.  for each Fi in F
22.    if T(Pi)–Fi.lastpkt_time < Fi.max_time
23.       clear
24.       clear Fi.keylist, Fi.highlist, Fi.lastpkt_time
25.    endif
26.  endfor