本文整理汇总了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;
}