В модель пакета добавлена информация, исходящий ли он
This commit is contained in:
@@ -149,15 +149,17 @@ public class PcapWorker {
|
|||||||
String sourceIpAndPort = sourceIpString + ":" + sourcePort;
|
String sourceIpAndPort = sourceIpString + ":" + sourcePort;
|
||||||
String destIpAndPort = destIpString + ":" + destPort;
|
String destIpAndPort = destIpString + ":" + destPort;
|
||||||
|
|
||||||
|
boolean incoming = destIpString.equals(localIp);
|
||||||
|
|
||||||
UnfinishedStream stream = new UnfinishedStream(sourceIp, destIp, sourcePort, destPort, protocol);
|
UnfinishedStream stream = new UnfinishedStream(sourceIp, destIp, sourcePort, destPort, protocol);
|
||||||
|
|
||||||
ru.serega6531.packmate.model.Packet packet = ru.serega6531.packmate.model.Packet.builder()
|
ru.serega6531.packmate.model.Packet packet = ru.serega6531.packmate.model.Packet.builder()
|
||||||
.tempId(packetIdCounter++)
|
.tempId(packetIdCounter++)
|
||||||
.timestamp(System.currentTimeMillis())
|
.timestamp(System.currentTimeMillis())
|
||||||
|
.incoming(incoming)
|
||||||
.content(content)
|
.content(content)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
if (unfinishedStreams.containsKey(stream)) {
|
if (unfinishedStreams.containsKey(stream)) {
|
||||||
unfinishedStreams.get(stream).add(packet);
|
unfinishedStreams.get(stream).add(packet);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ public class Packet {
|
|||||||
|
|
||||||
private long timestamp;
|
private long timestamp;
|
||||||
|
|
||||||
|
private boolean incoming; // true если от клиента к серверу, иначе false
|
||||||
|
|
||||||
private byte[] content;
|
private byte[] content;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user