Adding skipped packets analysis.
[pingpong.git] / Code / Projects / PacketLevelSignatureExtractor / src / main / java / edu / uci / iotproject / detection / layer2 / Layer2AbstractMatcher.java
index 1621c82..6a7de57 100644 (file)
@@ -27,6 +27,12 @@ abstract public class Layer2AbstractMatcher {
      */
     protected final boolean[] mPacketDirections;
 
+    /**
+     * Keep track of the numbers of skipped packets
+     */
+    protected int mSkippedPackets;
+    protected int mMaxSkippedPackets;
+
     /**
      * Create a {@code Layer2AbstractMatcher}.
      * @param sequence The sequence of the signature.
@@ -45,6 +51,8 @@ abstract public class Layer2AbstractMatcher {
                 mPacketDirections[i] = getPacketDirection(prevPkt, prevPktDirection, sequence.get(i));
             }
         }
+        mSkippedPackets = 0;
+        mMaxSkippedPackets = 0;
     }
 
     /**
@@ -91,6 +99,10 @@ abstract public class Layer2AbstractMatcher {
         return mMatchedPackets;
     }
 
+    public int getMaxSkippedPackets() {
+        return mMaxSkippedPackets;
+    }
+
     /**
      * Utility for {@code getMatchedPackets().get(getMatchedPackets().size()-1)}.
      * @return The last matched packet, or {@code null} if no packets have been matched yet.