Adding skipped packets analysis.
[pingpong.git] / Code / Projects / PacketLevelSignatureExtractor / src / main / java / edu / uci / iotproject / detection / layer2 / Layer2AbstractMatcher.java
index 1621c820525d8871d2b6dc770c3a2df1baddba50..6a7de57208c740c2097b4f81799cfb3fc39d9520 100644 (file)
@@ -27,6 +27,12 @@ abstract public class Layer2AbstractMatcher {
      */
     protected final boolean[] mPacketDirections;
 
      */
     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.
     /**
      * 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));
             }
         }
                 mPacketDirections[i] = getPacketDirection(prevPkt, prevPktDirection, sequence.get(i));
             }
         }
+        mSkippedPackets = 0;
+        mMaxSkippedPackets = 0;
     }
 
     /**
     }
 
     /**
@@ -91,6 +99,10 @@ abstract public class Layer2AbstractMatcher {
         return mMatchedPackets;
     }
 
         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.
     /**
      * Utility for {@code getMatchedPackets().get(getMatchedPackets().size()-1)}.
      * @return The last matched packet, or {@code null} if no packets have been matched yet.