|
|
@@ -58,19 +58,19 @@ public class App {
|
|
58
|
58
|
Nips newDest = destinationAssign.getClass().newInstance();
|
|
59
|
59
|
|
|
60
|
60
|
// Insert node value
|
|
61
|
|
- newSource.setSourceIp(newPacket.eip);
|
|
62
|
|
- newSource.setSourcePort(newPacket.eport);
|
|
63
|
|
- newDest.setDestIp(newPacket.nip);
|
|
64
|
|
- newDest.setDestPort(newPacket.nport);
|
|
|
61
|
+ insertNodeValue(newSource, newDest, newPacket);
|
|
65
|
62
|
newNode.ip = newSource.getSourceIp();
|
|
66
|
|
- // Insert source & destination address -> need edit
|
|
67
|
|
- (newNode.source).addElement(newSource);
|
|
68
|
|
- (newNode.destination).addElement(newDest);
|
|
|
63
|
+
|
|
|
64
|
+ // Insert source & destination address
|
|
|
65
|
+ insertAddress(newSource, newDest, newNode);
|
|
|
66
|
+
|
|
69
|
67
|
// sum packet & byte
|
|
70
|
68
|
newNode.sumPkt(newPacket.out_pkt);
|
|
71
|
69
|
newNode.sumByte(newPacket.out_byte);
|
|
|
70
|
+
|
|
72
|
71
|
// Insert newNode
|
|
73
|
72
|
networkNode.add(newNode);
|
|
|
73
|
+
|
|
74
|
74
|
} catch (InstantiationException e) {
|
|
75
|
75
|
e.printStackTrace();
|
|
76
|
76
|
|
|
|
@@ -82,8 +82,15 @@ public class App {
|
|
82
|
82
|
else if(IP.contains(newPacket.eip)){
|
|
83
|
83
|
// Find Node
|
|
84
|
84
|
Node searchNode = findNode(networkNode, newPacket.eip);
|
|
85
|
|
-
|
|
86
|
|
-
|
|
|
85
|
+ Eips newSource = sourceAssign.getClass().newInstance();
|
|
|
86
|
+ Nips newDest = destinationAssign.getClass().newInstance();
|
|
|
87
|
+ // Insert node value
|
|
|
88
|
+ insertNodeValue(newSource, newDest, newPacket);
|
|
|
89
|
+ // Insert source & destination address
|
|
|
90
|
+ insertAddress(newSource, newDest, searchNode);
|
|
|
91
|
+ // sum packet & byte
|
|
|
92
|
+ searchNode.sumPkt(newPacket.out_pkt);
|
|
|
93
|
+ searchNode.sumByte(newPacket.out_byte);
|
|
87
|
94
|
}
|
|
88
|
95
|
|
|
89
|
96
|
} catch (InstantiationException e1) {
|
|
|
@@ -98,6 +105,7 @@ public class App {
|
|
98
|
105
|
} catch( IOException e) {
|
|
99
|
106
|
e.printStackTrace();
|
|
100
|
107
|
}
|
|
|
108
|
+
|
|
101
|
109
|
}
|
|
102
|
110
|
public static Node findNode(Vector<Node> nodeVector, Object obj){
|
|
103
|
111
|
for(int i = 0; i < nodeVector.size(); i++){
|
|
|
@@ -108,4 +116,14 @@ public class App {
|
|
108
|
116
|
}
|
|
109
|
117
|
return null;
|
|
110
|
118
|
}
|
|
|
119
|
+ public static void insertNodeValue(Eips S, Nips D, Packet pkt){
|
|
|
120
|
+ S.setSourceIp(pkt.eip);
|
|
|
121
|
+ S.setSourcePort(pkt.eport);
|
|
|
122
|
+ D.setDestIp(pkt.nip);
|
|
|
123
|
+ D.setDestPort(pkt.nport);
|
|
|
124
|
+ }
|
|
|
125
|
+ public static void insertAddress(Eips S, Nips D, Node N){
|
|
|
126
|
+ N.source.addElement(S);
|
|
|
127
|
+ N.destination.addElement(D);
|
|
|
128
|
+ }
|
|
111
|
129
|
}
|