Добавлен UnfinishedStream
This commit is contained in:
@@ -2,6 +2,7 @@ package ru.serega6531.packmate.model;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import ru.serega6531.packmate.Protocol;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
@@ -27,6 +28,8 @@ public class Stream {
|
||||
@JoinColumn(name = "service_id", nullable = false)
|
||||
private CtfService service;
|
||||
|
||||
private Protocol protocol;
|
||||
|
||||
@OneToMany(mappedBy = "stream", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<Packet> packets;
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package ru.serega6531.packmate.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import ru.serega6531.packmate.Protocol;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class UnfinishedStream {
|
||||
|
||||
private Inet4Address firstIp;
|
||||
private Inet4Address secondIp;
|
||||
private int firstPort;
|
||||
private int secondPort;
|
||||
private Protocol protocol;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof UnfinishedStream)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
UnfinishedStream o = (UnfinishedStream) obj;
|
||||
|
||||
boolean ipEq1 = firstIp.equals(o.firstIp) && secondIp.equals(o.secondIp);
|
||||
boolean ipEq2 = firstIp.equals(o.secondIp) && secondIp.equals(o.firstIp);
|
||||
boolean portEq1 = firstPort == o.firstPort && secondPort == o.secondPort;
|
||||
boolean portEq2 = firstPort == o.secondPort && secondPort == o.firstPort;
|
||||
|
||||
return (ipEq1 || ipEq2) && (portEq1 || portEq2) && protocol == o.protocol;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user