es.tid.pce.pcep.constructs.UnnumIfEndPoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of network-protocols Show documentation
Show all versions of network-protocols Show documentation
BGP-LS,OSPF-TE,PCEP and RSVP-TE protocol encodings.
The newest version!
package es.tid.pce.pcep.constructs;
import es.tid.pce.pcep.PCEPProtocolViolationException;
import es.tid.pce.pcep.objects.ObjectParameters;
import es.tid.pce.pcep.objects.tlvs.PCEPTLV;
import es.tid.pce.pcep.objects.tlvs.UnnumberedEndpointTLV;
public class UnnumIfEndPoint extends EndPoint {
private UnnumberedEndpointTLV unnumberedEndpoint;
public UnnumIfEndPoint() {
}
public UnnumIfEndPoint(byte[] bytes, int offset) throws PCEPProtocolViolationException {
decode(bytes, offset);
}
public void encode() {
// TODO Auto-generated method stub
int length=0;
if (unnumberedEndpoint!=null){
unnumberedEndpoint.encode();
length=length+unnumberedEndpoint.getTotalTLVLength();
}
this.setLength(length);
this.bytes=new byte[this.getLength()];
int offset=0;
if (unnumberedEndpoint!=null){
System.arraycopy(unnumberedEndpoint.getTlv_bytes(),0,this.bytes,offset,unnumberedEndpoint.getTotalTLVLength());
offset=offset+unnumberedEndpoint.getTotalTLVLength();
}
}
public void decode(byte[] bytes, int offset) throws PCEPProtocolViolationException{
int tlvtype=PCEPTLV.getType(bytes, offset);
int tlvlength=PCEPTLV.getTotalTLVLength(bytes, offset);
this.setLength(tlvlength);
if (tlvtype==ObjectParameters.PCEP_TLV_TYPE_UNNUMBERED_ENDPOINT){
unnumberedEndpoint=new UnnumberedEndpointTLV(bytes, offset);
}
}
public UnnumberedEndpointTLV getUnnumberedEndpoint() {
return unnumberedEndpoint;
}
public void setUnnumberedEndpoint(UnnumberedEndpointTLV unnumberedEndpoint) {
this.unnumberedEndpoint = unnumberedEndpoint;
}
}