当前位置: 首页>>代码示例>>Java>>正文


Java PcepLabelRangeObject类代码示例

本文整理汇总了Java中org.onosproject.pcepio.protocol.PcepLabelRangeObject的典型用法代码示例。如果您正苦于以下问题:Java PcepLabelRangeObject类的具体用法?Java PcepLabelRangeObject怎么用?Java PcepLabelRangeObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PcepLabelRangeObject类属于org.onosproject.pcepio.protocol包,在下文中一共展示了PcepLabelRangeObject类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: read

import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
/**
 * Reads from the channel buffer and returns object of  PcepLabelRangeObject.
 *
 * @param cb of type channel buffer
 * @return object of  PcepLabelRangeObject
 * @throws PcepParseException when fails to read from channel buffer
 */
public static PcepLabelRangeObject read(ChannelBuffer cb) throws PcepParseException {

    PcepObjectHeader labelRangeObjHeader;
    byte labelType;
    int rangeSize;
    int labelBase;

    LinkedList<PcepValueType> llOptionalTlv = new LinkedList<>();

    labelRangeObjHeader = PcepObjectHeader.read(cb);

    //take only LabelRangeObject buffer.
    ChannelBuffer tempCb = cb.readBytes(labelRangeObjHeader.getObjLen() - MINIMUM_COMMON_HEADER_LENGTH);
    int temp = 0;
    temp = tempCb.readInt();
    rangeSize = temp & 0x00FFFFFF;
    labelType = (byte) (temp >> 24);
    labelBase = tempCb.readInt();
    llOptionalTlv = parseOptionalTlv(tempCb);
    return new PcepLabelRangeObjectVer1(labelRangeObjHeader, labelType, rangeSize, labelBase, llOptionalTlv);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:PcepLabelRangeObjectVer1.java

示例2: build

import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
@Override
public PcepLabelRangeObject build() throws PcepParseException {
    PcepObjectHeader labelRangeObjHeader = this.bIsHeaderSet ? this.labelRangeObjHeader
            : DEFAULT_LABELRANGE_OBJECT_HEADER;

    if (!this.bIsLabelType) {
        throw new PcepParseException("LabelType NOT Set while building label range object.");
    }

    if (!this.bIsRangeSize) {
        throw new PcepParseException("RangeSize NOT Set while building label range object.");
    }

    if (!this.bIsLabelBase) {
        throw new PcepParseException("LabelBase NOT Set while building label range object.");
    }

    if (bIsPFlagSet) {
        labelRangeObjHeader.setPFlag(bPFlag);
    }

    if (bIsIFlagSet) {
        labelRangeObjHeader.setIFlag(bIFlag);
    }
    return new PcepLabelRangeObjectVer1(labelRangeObjHeader, this.labelType, this.rangeSize, this.labelBase,
            this.llOptionalTlv);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:PcepLabelRangeObjectVer1.java

示例3: read

import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
/**
 * Reads channel buffer and returns object of PcepLabelRange.
 *
 * @param cb of type channel buffer.
 * @return object of PcepLabelRange
 * @throws PcepParseException when fails to read from channel buffer
 */
public static PcepLabelRange read(ChannelBuffer cb) throws PcepParseException {

    //parse and store SRP mandatory object
    PcepSrpObject srpObj = null;
    srpObj = PcepSrpObjectVer1.read(cb);
    if (srpObj == null) {
        throw new PcepParseException("Exception while parsing srp object");
    }

    LinkedList<PcepLabelRangeObject> llLabelRangeList = new LinkedList<>();
    boolean bFoundLabelRangeObj = false;
    while (0 < cb.readableBytes()) {
        //parse and store <labelrange-list>
        PcepLabelRangeObject lrObj;
        lrObj = PcepLabelRangeObjectVer1.read(cb);
        if (lrObj == null) {
            throw new PcepParseException("Exception while parsing label range object");
        } else {
            llLabelRangeList.add(lrObj);
            bFoundLabelRangeObj = true;
        }
    }

    if (!bFoundLabelRangeObj) {
        throw new PcepParseException("At least one LABEL-RANGE MUST be present.");
    }
    return new PcepLabelRangeVer1(srpObj, llLabelRangeList);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:36,代码来源:PcepLabelRangeVer1.java

示例4: write

import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
@Override
public int write(ChannelBuffer cb) throws PcepParseException {
    //write Object header
    int objStartIndex = cb.writerIndex();

    //write <SRP>
    int objLenIndex = srpObject.write(cb);

    if (objLenIndex <= 0) {
        throw new PcepParseException("bjectLength is " + objLenIndex);
    }

    //write <labelrange-list>
    ListIterator<PcepLabelRangeObject> listIterator = llLabelRangeList.listIterator();
    while (listIterator.hasNext()) {
        listIterator.next().write(cb);
    }

    //Update object length now
    int length = cb.writerIndex() - objStartIndex;
    // As per RFC the length of object should be
    // multiples of 4
    int pad = length % 4;
    if (pad != 0) {
        pad = 4 - pad;
        for (int i = 0; i < pad; i++) {
            cb.writeByte((byte) 0);
        }
        length = length + pad;
    }
    cb.setShort(objLenIndex, (short) length);
    return length;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:34,代码来源:PcepLabelRangeVer1.java

示例5: buildPcepLabelRangeObject

import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
@Override
public PcepLabelRangeObject.Builder buildPcepLabelRangeObject() {
    return new PcepLabelRangeObjectVer1.Builder();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:PcepFactoryVer1.java

示例6: getLabelRangeList

import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
@Override
public LinkedList<PcepLabelRangeObject> getLabelRangeList() {
    return llLabelRangeList;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:PcepLabelRangeVer1.java

示例7: setLabelRangeList

import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
@Override
public void setLabelRangeList(LinkedList<PcepLabelRangeObject> ll) {
    this.llLabelRangeList = ll;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:PcepLabelRangeVer1.java

示例8: PcepLabelRangeVer1

import org.onosproject.pcepio.protocol.PcepLabelRangeObject; //导入依赖的package包/类
/**
 * Constructor to initialize objects.
 *
 * @param srpObj PCEP Srp object.
 * @param llLabelRangeList list of PcepLabelRangeObject.
 */
PcepLabelRangeVer1(PcepSrpObject srpObj, LinkedList<PcepLabelRangeObject> llLabelRangeList) {
    this.srpObject = srpObj;
    this.llLabelRangeList = llLabelRangeList;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:PcepLabelRangeVer1.java


注:本文中的org.onosproject.pcepio.protocol.PcepLabelRangeObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。