本文整理汇总了Java中org.onosproject.ospf.protocol.lsa.LsaHeader.lsPacketLen方法的典型用法代码示例。如果您正苦于以下问题:Java LsaHeader.lsPacketLen方法的具体用法?Java LsaHeader.lsPacketLen怎么用?Java LsaHeader.lsPacketLen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.ospf.protocol.lsa.LsaHeader
的用法示例。
在下文中一共展示了LsaHeader.lsPacketLen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readFrom
import org.onosproject.ospf.protocol.lsa.LsaHeader; //导入方法依赖的package包/类
@Override
public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException {
try {
//From header 4 bytes is number of lsa's
this.setNumberOfLsa(channelBuffer.readInt());
//get the remaining bytes represents Number of LSA's present. Add all the LSA's
while (channelBuffer.readableBytes() > OspfUtil.LSA_HEADER_LENGTH) {
LsaHeader header = OspfUtil.readLsaHeader(channelBuffer.readBytes(OspfUtil.LSA_HEADER_LENGTH));
int lsaLength = header.lsPacketLen();
int lsType = header.lsType();
switch (lsType) {
case OspfParameters.LINK_LOCAL_OPAQUE_LSA:
OpaqueLsa9 opaqueLsa9 = new OpaqueLsa9((OpaqueLsaHeader) header);
opaqueLsa9.readFrom(channelBuffer.readBytes(lsaLength - OspfUtil.LSA_HEADER_LENGTH));
addLsa(opaqueLsa9);
break;
case OspfParameters.AREA_LOCAL_OPAQUE_LSA:
OpaqueLsa10 opaqueLsa10 = new OpaqueLsa10((OpaqueLsaHeader) header);
opaqueLsa10.readFrom(channelBuffer.readBytes(lsaLength - OspfUtil.LSA_HEADER_LENGTH));
addLsa(opaqueLsa10);
break;
case OspfParameters.AS_OPAQUE_LSA:
OpaqueLsa11 opaqueLsa11 = new OpaqueLsa11((OpaqueLsaHeader) header);
opaqueLsa11.readFrom(channelBuffer.readBytes(lsaLength - OspfUtil.LSA_HEADER_LENGTH));
addLsa(opaqueLsa11);
break;
case OspfParameters.ROUTER:
RouterLsa routerLsa = new RouterLsa(header);
routerLsa.readFrom(channelBuffer.readBytes(lsaLength - OspfUtil.LSA_HEADER_LENGTH));
addLsa(routerLsa);
break;
case OspfParameters.NETWORK:
NetworkLsa networkLsa = new NetworkLsa(header);
networkLsa.readFrom(channelBuffer.readBytes(lsaLength - OspfUtil.LSA_HEADER_LENGTH));
addLsa(networkLsa);
break;
case OspfParameters.ASBR_SUMMARY:
AsbrSummaryLsa asbrSummaryLsa = new AsbrSummaryLsa(header);
asbrSummaryLsa.readFrom(channelBuffer.readBytes(lsaLength - OspfUtil.LSA_HEADER_LENGTH));
addLsa(asbrSummaryLsa);
break;
case OspfParameters.SUMMARY:
SummaryLsa summaryLsa = new SummaryLsa(header);
summaryLsa.readFrom(channelBuffer.readBytes(lsaLength - OspfUtil.LSA_HEADER_LENGTH));
addLsa(summaryLsa);
break;
case OspfParameters.EXTERNAL_LSA:
ExternalLsa externalLsa = new ExternalLsa(header);
externalLsa.readFrom(channelBuffer.readBytes(lsaLength - OspfUtil.LSA_HEADER_LENGTH));
addLsa(externalLsa);
break;
default:
log.debug("LSUpdate::readLsUpdateBody::UnKnown LS Type: {}", lsType);
break;
}
}
} catch (Exception e) {
log.debug("Error::LsUpdate:: {}", e.getMessage());
throw new OspfParseException(OspfErrorType.MESSAGE_HEADER_ERROR, OspfErrorType.BAD_MESSAGE_LENGTH);
}
}