+ // Update the maximum number of skipped packets
+ private boolean checkMaxSkippedPackets(List<PcapPacket> flowPackets, List<PcapPacket> matchedPackets) {
+ // Count number of skipped packets by looking into
+ // the difference of indices of two matched packets
+ boolean stillMatch = true;
+ for(int i = 1; i < matchedPackets.size(); ++i) {
+ int currIndex = flowPackets.indexOf(matchedPackets.get(i-1));
+ int nextIndex = flowPackets.indexOf(matchedPackets.get(i));
+ int skippedPackets = nextIndex - currIndex;
+ if (mMaxSkippedPackets < skippedPackets) {
+ mMaxSkippedPackets = skippedPackets;
+ }
+ if (mLimitSkippedPackets < skippedPackets) {
+ stillMatch = false;
+ }
+// mMaxSkippedPackets.add(skippedPackets);
+ }
+ return stillMatch;
+ }
+