X-Git-Url: http://plrg.eecs.uci.edu/git/?p=pingpong.git;a=blobdiff_plain;f=Code%2FProjects%2FPacketLevelSignatureExtractor%2Fsrc%2Fmain%2Fjava%2Fedu%2Fuci%2Fiotproject%2Fdetection%2Flayer2%2FLayer2RangeMatcher.java;h=40059657d1a94b6b2ec17467fc042cfd78d091aa;hp=cd19045613695eff7d9953ac58c1c703bd944cf6;hb=75e5953e085f30ee7c108d2a55d3d7dd181f828b;hpb=6ac25672a1fda9e9d9656578bba41014da09a25f diff --git a/Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/detection/layer2/Layer2RangeMatcher.java b/Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/detection/layer2/Layer2RangeMatcher.java index cd19045..4005965 100644 --- a/Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/detection/layer2/Layer2RangeMatcher.java +++ b/Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/detection/layer2/Layer2RangeMatcher.java @@ -23,6 +23,7 @@ public class Layer2RangeMatcher extends Layer2AbstractMatcher { private final List mLowerBound; private final List mUpperBound; private final double mEps; + private int mInclusionTimeMillis; /** * Create a {@code Layer2RangeMatcher}. @@ -30,13 +31,16 @@ public class Layer2RangeMatcher extends Layer2AbstractMatcher { * @param upperBound The upper bound of the sequence to match against (search for). * @param eps The epsilon value used in the DBSCAN algorithm. */ - public Layer2RangeMatcher(List lowerBound, List upperBound, double eps) { + public Layer2RangeMatcher(List lowerBound, List upperBound, + int inclusionTimeMillis, double eps) { // TODO: Just use the lower bound since both lower and upper bounds' packets essentially have the same direction // TODO: for the same position in the array. Both arrays also have the same length. super(lowerBound); mLowerBound = lowerBound; mUpperBound = upperBound; mEps = eps; + mInclusionTimeMillis = + inclusionTimeMillis == 0 ? TriggerTrafficExtractor.INCLUSION_WINDOW_MILLIS : inclusionTimeMillis; } /** @@ -92,8 +96,10 @@ public class Layer2RangeMatcher extends Layer2AbstractMatcher { if (!packet.getTimestamp().isAfter(mMatchedPackets.get(getMatchedPacketsCount()-1).getTimestamp())) { return false; } +// if (packet.getTimestamp().isAfter(mMatchedPackets.get(0).getTimestamp(). +// plusMillis(TriggerTrafficExtractor.INCLUSION_WINDOW_MILLIS))) { if (packet.getTimestamp().isAfter(mMatchedPackets.get(0).getTimestamp(). - plusMillis(TriggerTrafficExtractor.INCLUSION_WINDOW_MILLIS))) { + plusMillis(mInclusionTimeMillis))) { return false; } // If we made it here, it means that this packet has the expected length, direction, and obeys the timing