1 package edu.uci.iotproject;
3 import java.util.ArrayList;
4 import java.util.Arrays;
5 import java.util.Collections;
10 * TODO add class documentation.
12 * @author Janus Varmarken
14 public class FlowPattern {
17 // TP-Link Local ON packet lengths (TCP payload only), extracted from ON event at Feb 13, 2018 13:38:04
18 // of the 5 switch data collection:
19 // 517 1448 1448 1448 855 191 51 490 1027 31
21 ArrayList<Integer> packetLengths = new ArrayList<>();
22 packetLengths.addAll(Arrays.asList(new Integer[] {517, 1448, 1448, 1448, 855, 191, 51, 490, 1027, 31}));
23 TP_LINK_LOCAL_ON = new FlowPattern("TP_LINK_LOCAL_ON", "events.tplinkra.com", packetLengths);
26 public static final FlowPattern TP_LINK_LOCAL_ON;
28 private final String patternId;
31 * The hostname that this {@code FlowPattern} is associated with.
33 private final String hostname;
36 * The order of packet lengths that defines this {@link FlowPattern}
37 * TODO: this is a simplified representation, we should also include information about direction of each packet.
39 private final List<Integer> flowPacketOrder;
41 public FlowPattern(String patternId, String hostname, List<Integer> flowPacketOrder) {
42 this.patternId = patternId;
43 this.hostname = hostname;
44 this.flowPacketOrder = Collections.unmodifiableList(flowPacketOrder);
47 public String getPatternId() {
51 public String getHostname() {
56 * Get the the sequence of packet lengths that defines this {@code FlowPattern}.
57 * @return the the sequence of packet lengths that defines this {@code FlowPattern}.
59 public List<Integer> getPacketOrder() {
60 return flowPacketOrder;