From 1e72719e0ea1c3ceca5e668bd651bd77c999c5e2 Mon Sep 17 00:00:00 2001 From: Janus Varmarken Date: Fri, 20 Jul 2018 14:20:12 -0700 Subject: [PATCH] Correct TcpReassembler to implement PacketListener interface instead of PcapPacketConsumer interface deleted in last commit. Remove import of deleted PcapProcessingPipeline in Main.java --- .../src/main/java/edu/uci/iotproject/Main.java | 1 - .../src/main/java/edu/uci/iotproject/TcpReassembler.java | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/Main.java b/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/Main.java index 7cf0c3c..bc5948d 100644 --- a/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/Main.java +++ b/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/Main.java @@ -1,7 +1,6 @@ package edu.uci.iotproject; import edu.uci.iotproject.analysis.PcapPacketPair; -import edu.uci.iotproject.analysis.PcapProcessingPipeline; import edu.uci.iotproject.analysis.TcpConversationUtils; import edu.uci.iotproject.analysis.TriggerTrafficExtractor; import edu.uci.iotproject.io.TriggerTimesFileReader; diff --git a/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/TcpReassembler.java b/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/TcpReassembler.java index cffe9ec..140a151 100644 --- a/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/TcpReassembler.java +++ b/Code/Projects/SmartPlugDetector/src/main/java/edu/uci/iotproject/TcpReassembler.java @@ -1,7 +1,7 @@ package edu.uci.iotproject; +import org.pcap4j.core.PacketListener; import org.pcap4j.core.PcapPacket; -import org.pcap4j.packet.IpV4Packet; import org.pcap4j.packet.TcpPacket; import java.util.*; @@ -12,7 +12,7 @@ import java.util.*; * @author Janus Varmarken {@literal } * @author Rahmadi Trimananda {@literal } */ -public class TcpReassembler implements PcapPacketConsumer { +public class TcpReassembler implements PacketListener { /** * Holds open {@link Conversation}s, i.e., {@code Conversation}s that have not been detected as @@ -37,7 +37,7 @@ public class TcpReassembler implements PcapPacketConsumer { private final Map mTerminatedConversations = new HashMap<>(); @Override - public void consumePacket(PcapPacket pcapPacket) { + public void gotPacket(PcapPacket pcapPacket) { TcpPacket tcpPacket = pcapPacket.get(TcpPacket.class); if (tcpPacket == null) { return; @@ -48,7 +48,7 @@ public class TcpReassembler implements PcapPacketConsumer { /** * Get the reassembled TCP connections. Note that if this is called while packets are still being processed (by - * calls to {@link #consumePacket(PcapPacket)}), the behavior is undefined and the returned list may be inconsistent. + * calls to {@link #gotPacket(PcapPacket)}), the behavior is undefined and the returned list may be inconsistent. * @return The reassembled TCP connections. */ public List getTcpConversations() { -- 2.34.1