本文整理匯總了Java中org.onosproject.bgpio.types.OspfRouteTypeTlv類的典型用法代碼示例。如果您正苦於以下問題:Java OspfRouteTypeTlv類的具體用法?Java OspfRouteTypeTlv怎麽用?Java OspfRouteTypeTlv使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
OspfRouteTypeTlv類屬於org.onosproject.bgpio.types包,在下文中一共展示了OspfRouteTypeTlv類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parsePrefixDescriptors
import org.onosproject.bgpio.types.OspfRouteTypeTlv; //導入依賴的package包/類
/**
* Parse list of prefix descriptors.
*
* @param cb ChannelBuffer
* @return list of prefix descriptors
* @throws BgpParseException while parsing list of prefix descriptors
*/
public static List<BgpValueType> parsePrefixDescriptors(ChannelBuffer cb) throws BgpParseException {
LinkedList<BgpValueType> prefixDescriptor = new LinkedList<>();
BgpValueType tlv = null;
boolean isIpReachInfo = false;
ChannelBuffer tempCb;
int count = 0;
while (cb.readableBytes() > 0) {
ChannelBuffer tempBuf = cb.copy();
short type = cb.readShort();
short length = cb.readShort();
if (cb.readableBytes() < length) {
//length + 4 implies data contains type, length and value
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
}
tempCb = cb.readBytes(length);
switch (type) {
case OspfRouteTypeTlv.TYPE:
tlv = OspfRouteTypeTlv.read(tempCb);
break;
case IPReachabilityInformationTlv.TYPE:
tlv = IPReachabilityInformationTlv.read(tempCb, length);
isIpReachInfo = true;
break;
case BgpAttrNodeMultiTopologyId.ATTRNODE_MULTITOPOLOGY:
tlv = BgpAttrNodeMultiTopologyId.read(tempCb);
count = count + 1;
if (count > 1) {
//length + 4 implies data contains type, length and value
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR,
BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(length + TYPE_AND_LEN));
}
break;
default:
UnSupportedAttribute.skipBytes(tempCb, length);
}
prefixDescriptor.add(tlv);
}
if (!isIpReachInfo) {
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
null);
}
return prefixDescriptor;
}