Update Layer2 detection to only allow one sequence matcher in each state for each...
[pingpong.git] / Code / Projects / SmartPlugDetector / src / main / java / edu / uci / iotproject / detection / layer2 / Layer2SequenceMatcher.java
index 10ae34ec8ae51118ed24fa74aca4afb782f70514..672fb72f3441b29abf667c1027c7d5590de0f0e4 100644 (file)
@@ -139,6 +139,14 @@ public class Layer2SequenceMatcher {
         return mMatchedPackets;
     }
 
+    /**
+     * Utility for {@code getMatchedPackets().get(getMatchedPackets().size()-1)}.
+     * @return The last matched packet, or {@code null} if no packets have been matched yet.
+     */
+    public PcapPacket getLastPacket() {
+        return mSequence.size() > 0 ? mSequence.get(mSequence.size()-1) : null;
+    }
+
     /**
      * Compute the direction of a packet based on the previous packet. If no previous packet is provided, the direction
      * of {@code currPkt} is {@code true} by definition.