forked from KNEMC/KLALB
KLALB V3.6.0 写了一半
This commit is contained in:
@@ -9,7 +9,7 @@ import java.nio.channels.ReadableByteChannel;
|
||||
import java.nio.channels.WritableByteChannel;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.kne.cloud.network.klalb.IPSequence;
|
||||
import org.kne.cloud.network.ipv6.PacketID;
|
||||
|
||||
public class ACKSEQSSegmentRoutingTLV extends IPv6SegmentRoutingTLV {
|
||||
public ACKSEQSSegmentRoutingTLV(ByteBuffer klalbHeader) {
|
||||
@@ -21,17 +21,15 @@ public class ACKSEQSSegmentRoutingTLV extends IPv6SegmentRoutingTLV {
|
||||
return "ACKSEQSSegmentRoutingTLV [getSequence()=" + getSequence() + "]";
|
||||
}
|
||||
|
||||
public ACKSEQSSegmentRoutingTLV(UUID ackid, boolean promise) {
|
||||
public ACKSEQSSegmentRoutingTLV(UUID ackid,long sequence) {
|
||||
super(IPv6SegmentRoutingTLV.ACKSEQS);
|
||||
setUUID(ackid);
|
||||
setPromise(promise);
|
||||
getData().limit(22);
|
||||
getData().limit(30);
|
||||
}
|
||||
public ACKSEQSSegmentRoutingTLV(IPSequence ackid, boolean promise) {
|
||||
public ACKSEQSSegmentRoutingTLV(PacketID ackid) {
|
||||
super(IPv6SegmentRoutingTLV.ACKSEQS);
|
||||
setIPSequence(ackid);
|
||||
setPromise(promise);
|
||||
getData().limit(22);
|
||||
setPacketID(ackid);
|
||||
getData().limit(30);
|
||||
}
|
||||
public void setUUID(UUID uuid) {
|
||||
getData().putLong(6,uuid.getMostSignificantBits());
|
||||
@@ -41,12 +39,13 @@ public class ACKSEQSSegmentRoutingTLV extends IPv6SegmentRoutingTLV {
|
||||
public UUID getUUID() {
|
||||
return new UUID(getData().getLong(6),getData().getLong(14));
|
||||
}
|
||||
public void setIPSequence(IPSequence ackid) {
|
||||
setUUID(ackid.getUuid());
|
||||
public void setPacketID(PacketID ackid) {
|
||||
setUUID(ackid.getFlowuuid());
|
||||
setSequence(ackid.getSequence());
|
||||
}
|
||||
|
||||
public IPSequence getIPSequence() {
|
||||
return new IPSequence(getUUID(),isPromise());
|
||||
public PacketID getPacketID() {
|
||||
return new PacketID(getUUID(),getSequence());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,10 +62,10 @@ public class ACKSEQSSegmentRoutingTLV extends IPv6SegmentRoutingTLV {
|
||||
}
|
||||
|
||||
public long getSequence() {
|
||||
return getData().getLong(6);
|
||||
return getData().getLong(22);
|
||||
}
|
||||
public void setSequence(long sequence) {
|
||||
getData().putLong(6,sequence);
|
||||
getData().putLong(22,sequence);
|
||||
}
|
||||
public int getFlowNumber() {
|
||||
return getData().getInt(2);
|
||||
@@ -74,28 +73,6 @@ public class ACKSEQSSegmentRoutingTLV extends IPv6SegmentRoutingTLV {
|
||||
public void setFlowNumber(int flowsequence) {
|
||||
getData().putInt(2,flowsequence);
|
||||
}
|
||||
public void setACKIP(Inet6Address ip) {
|
||||
getData().put(14, ip.getAddress());
|
||||
}
|
||||
public Inet6Address getACKIP() {
|
||||
byte[]arr=new byte[16];
|
||||
getData().get(14,arr);
|
||||
try {
|
||||
return (Inet6Address) Inet6Address.getByAddress(arr);
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public boolean isPromise() {
|
||||
return getData().get(0)!=0?true:false;
|
||||
}
|
||||
|
||||
|
||||
public void setPromise(boolean promise) {
|
||||
if(promise) {
|
||||
getData().put(0, (byte) 1);
|
||||
}else {
|
||||
getData().put(0, (byte) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user