Files
KLALB/src/org/kne/cloud/network/srv6/SRv6StreamSequenceTLV.java
T

43 lines
1.4 KiB
Java

package org.kne.cloud.network.srv6;
import java.io.DataInputStream;
import java.io.DataOutputStream;
public class SRv6StreamSequenceTLV extends SRv6TLV {
public SRv6StreamSequenceTLV() {
super(SEQS, 22, new byte[22]);
}
public SRv6StreamSequenceTLV(int lengthQTLV, byte[] rawQTLV) {
super(SEQS, lengthQTLV, rawQTLV);
}
public int getReserved(){
return getValue()[0]<<8|getValue()[1];
}
public void setReserved(int reserved) {
getValue()[0]=(byte) (reserved>>>8);
getValue()[1]=(byte) reserved;
}
public long getSequence() {
return (((long)getValue()[6] << 56) +
((long)(getValue()[7] & 255) << 48) +
((long)(getValue()[8] & 255) << 40) +
((long)(getValue()[9] & 255) << 32) +
((long)(getValue()[10] & 255) << 24) +
((getValue()[11] & 255) << 16) +
((getValue()[12] & 255) << 8) +
((getValue()[13] & 255) << 0));
}
public void setSequence(long sequence) {
getValue()[6] = (byte)(sequence >>> 56);
getValue()[7] = (byte)(sequence >>> 48);
getValue()[8] = (byte)(sequence >>> 40);
getValue()[9] = (byte)(sequence >>> 32);
getValue()[10] = (byte)(sequence >>> 24);
getValue()[11] = (byte)(sequence >>> 16);
getValue()[12] = (byte)(sequence >>> 8);
getValue()[13] = (byte)(sequence >>> 0);
}
}