This commit is contained in:
Administrator
2025-04-24 10:16:38 +08:00
parent 6de65562be
commit 7267aec1fd
108 changed files with 7621 additions and 1890 deletions
@@ -0,0 +1,98 @@
package org.kne.cloud.network.srv6;
import java.io.EOFException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.util.UUID;
public class SEQSSegmentRoutingTLV extends IPv6SegmentRoutingTLV {
public SEQSSegmentRoutingTLV(ByteBuffer klalbHeader) {
super(klalbHeader);
}
@Override
public String toString() {
return "SEQSSegmentRoutingTLV [getSequence()=" + getSequence() + "]";
}
public SEQSSegmentRoutingTLV(long sequence,UUID uuid, boolean promise,boolean keeporder/*,int flownumber,long flowsequence*/) {
super(IPv6SegmentRoutingTLV.SEQS);
setSequence(sequence);
setUUID(uuid);
setPromise(promise);
setKeepOrder(keeporder);
//setFlowNumber(flownumber);
//setFlowSequence(flowsequence);
//getData().limit(14);
//getData().limit(22);
getData().limit(30);
}
public void setUUID(UUID uuid) {
getData().putLong(14,uuid.getMostSignificantBits());
getData().putLong(22,uuid.getLeastSignificantBits());
}
public UUID getUUID() {
return new UUID(getData().getLong(14),getData().getLong(22));
}
@Override
public void writeToChannel(WritableByteChannel dto) throws IOException {
super.writeToChannel(dto);
}
@Override
public void readFromChannel(ReadableByteChannel din, long length) throws IOException {
super.readFromChannel(din, length);
}
public long getSequence() {
return getData().getLong(6);
}
public void setSequence(long sequence) {
getData().putLong(6,sequence);
}
public int getFlowNumber() {
return getData().getInt(2);
}
public void setFlowNumber(int flowsequence) {
getData().putInt(2,flowsequence);
}
/*public long getFlowSequence() {
return getData().getLong(14);
}
public void setFlowSequence(long flowsequence) {
getData().putLong(14,flowsequence);
}*/
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);
}
}
public boolean isKeepOrder() {
return getData().get(1)!=0?true:false;
}
public void setKeepOrder(boolean keeporder) {
if(keeporder) {
getData().put(1, (byte) 1);
}else {
getData().put(1, (byte) 0);
}
}
}