|
@@ -37,6 +37,16 @@ public class PacketCollector {
|
|
|
*/
|
|
|
private PacketSniffer packetAlgorithm = null;
|
|
|
|
|
|
+ /**
|
|
|
+ * Mode of the Collector, whether it should train or test the packetSniffer algorithm
|
|
|
+ */
|
|
|
+ private boolean mode = false;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * True if it should collect packages
|
|
|
+ */
|
|
|
+ private boolean active = true;
|
|
|
+
|
|
|
/**
|
|
|
* Creates a PacketCollector without assigning and algorithm to process the packets
|
|
|
*/
|
|
@@ -180,4 +190,40 @@ public class PacketCollector {
|
|
|
public void setPacketAlgorithm(PacketSniffer packetAlgorithm) {
|
|
|
this.packetAlgorithm = packetAlgorithm;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns training or testing mode of the algorithm.
|
|
|
+ * @return true if testing or false if training the algorithm.
|
|
|
+ */
|
|
|
+ public boolean getMode() {
|
|
|
+ if(packetAlgorithm!=null)
|
|
|
+ mode = packetAlgorithm.getMode();
|
|
|
+ return mode;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Sets the training or testing mode
|
|
|
+ * @param mode true if testing or false if training the algorithm.
|
|
|
+ */
|
|
|
+ public void setMode(boolean mode) {
|
|
|
+ this.mode = mode;
|
|
|
+ if(packetAlgorithm != null)
|
|
|
+ packetAlgorithm.setMode(mode);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Whether the algorithm should run
|
|
|
+ * @return true if algorithm will be executed
|
|
|
+ */
|
|
|
+ public boolean isActive() {
|
|
|
+ return active;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set to true, if it should run
|
|
|
+ * @param active true if it should be active
|
|
|
+ */
|
|
|
+ public void setActive(boolean active) {
|
|
|
+ this.active = active;
|
|
|
+ }
|
|
|
}
|