В модель пакета добавлена информация, исходящий ли он

This commit is contained in:
serega6531
2019-05-11 23:32:13 +03:00
parent a935fca410
commit 3ce16c5bd3
2 changed files with 7 additions and 3 deletions

View File

@@ -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 {

View File

@@ -40,6 +40,8 @@ public class Packet {
private long timestamp; private long timestamp;
private boolean incoming; // true если от клиента к серверу, иначе false
private byte[] content; private byte[] content;
} }