es.tid.bgp.bgp4.open.BGP4CapabilitiesOptionalParameter 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.bgp.bgp4.open;
import java.util.LinkedList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* BGP4CapabilitiesOptionalParameter.
*
*
* RFC 3392.
*
* This is an Optional Parameter that is used by a BGP speaker to convey
to its BGP peer the list of capabilities supported by the speaker.
The parameter contains one or more triples <Capability Code,
Capability Length, Capability Value>, where each triple is encoded as
shown below:
*
+------------------------------+
| Capability Code (1 octet) |
+------------------------------+
| Capability Length (1 octet) |
+------------------------------+
| Capability Value (variable) |
+------------------------------+
*
The use and meaning of these fields are as follows:
Capability Code:
Capability Code is a one octet field that unambiguously
identifies individual capabilities.
Capability Length:
Capability Length is a one octet field that contains the length
of the Capability Value field in octets.
Capability Value:
Capability Value is a variable length field that is interpreted
according to the value of the Capability Code field.
* @author mcs
*
*/
public class BGP4CapabilitiesOptionalParameter extends BGP4OptionalParameter{
LinkedList capabilityList;
private static Logger log = LoggerFactory.getLogger("BGP4Parser");
public BGP4CapabilitiesOptionalParameter(){
this.type = BGP4OptionalParametersTypes.CAPABILITY_OPTIONAL_PARAMETER;
capabilityList = new LinkedList();
}
public BGP4CapabilitiesOptionalParameter(byte []bytes, int offset) {
super(bytes, offset);
capabilityList = new LinkedList();
decode();
}
public void encode() {
this.parameterLength=0;
for (int k=0; k getCapabilityList() {
return capabilityList;
}
public void setCapabilityList(LinkedList capabilityList) {
this.capabilityList = capabilityList;
}
}