I'm working on a sketch to build a set of 3D objects based off information gathered from tcpdump. I've setup a class called 'packet' that contains the source, destination, and protocol of each packet I've captured. All of the packet objects are stored in an array.
I would like to have the sketch walk through this array and group packet objects that have matching source strings together with hopes of drawing cubes for each source in a similar x, y, z space.
My code is a mess, I'm a bit frustrated, and I feel like I need a fresh perspective on the problem.
Here's the code with different attempts commented out:
CSV File "csv":
"1","0.000000","10.73.30.223","255.255.255.255","DB-LSP-DISC","Dropbox LAN sync Discovery Protocol"
"2","0.000354","10.73.30.223","10.73.31.255","DB-LSP-DISC","Dropbox LAN sync Discovery Protocol"
"3","0.072580","184.50.45.206","10.73.27.148","TCP","[TCP segment of a reassembled PDU]"
"4","0.072807","184.50.45.206","10.73.27.148","TCP","[TCP segment of a reassembled PDU]"
"5","0.073097","184.50.45.206","10.73.27.148","TCP","[TCP segment of a reassembled PDU]"
boolean firstRun = true;
boolean debug = true;
String[] csvStrings;
ArrayList packetZones;
ArrayList knownSource;
ArrayList knownDest;
Packet[] packetArray;
int mC = 0; //Master Counter
void setup() {
size(1280,720, P3D);
scene = new Scene(this);
csvStrings = loadStrings("csv");
packetArray = new Packet[csvStrings.length];
knownSource = new ArrayList();
packetZones = new ArrayList();
knownSource.add("127.0.0.1"); //Go ahead and add localhost as filler
if(debug) println("Setting up packet objects");
for(int i=0; i < csvStrings.length; i++) {
String[] pieces = split(csvStrings[i], ',');
packetArray[i] = new Packet(pieces);
}
}
void draw() {
for(int i=0; i < packetArray.length; i++){
String currSource = packetArray[i].source;
for(int j=i; j < packetArray.length; j++){
if(currSource.equals(packetArray[j].source){
//STOPPED HERE OUT OF FRUSTRATION/SLEEP DEPRIVATION
//AND THE HEAVENS DID RUMBLE WITH OUR LORD'S KEEN DISPLEASURE