Example usage for io.netty.buffer ByteBuf readUnsignedInt

List of usage examples for io.netty.buffer ByteBuf readUnsignedInt

Introduction

In this page you can find the example usage for io.netty.buffer ByteBuf readUnsignedInt.

Prototype

public abstract long readUnsignedInt();

Source Link

Document

Gets an unsigned 32-bit integer at the current readerIndex and increases the readerIndex by 4 in this buffer.

Usage

From source file:org.opendaylight.openflowjava.nx.codec.match.NspCodec.java

License:Open Source License

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntryBuilder = deserializeHeader(message);
    NspCaseValueBuilder nspCaseValueBuilder = new NspCaseValueBuilder();
    nspCaseValueBuilder.setNspValues(new NspValuesBuilder().setNsp(message.readUnsignedInt()).build());
    matchEntryBuilder.setMatchEntryValue(nspCaseValueBuilder.build());
    matchEntryBuilder.setHasMask(false);
    return matchEntryBuilder.build();
}

From source file:org.opendaylight.openflowjava.nx.codec.match.TunIpv4DstCodec.java

License:Open Source License

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntriesBuilder = deserializeHeader(message);
    TunIpv4DstCaseValueBuilder caseBuilder = new TunIpv4DstCaseValueBuilder();
    TunIpv4DstValuesBuilder valuesBuilder = new TunIpv4DstValuesBuilder();
    valuesBuilder.setValue(message.readUnsignedInt());
    caseBuilder.setTunIpv4DstValues(valuesBuilder.build());
    matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
    return matchEntriesBuilder.build();
}

From source file:org.opendaylight.openflowjava.nx.codec.match.TunIpv4SrcCodec.java

License:Open Source License

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntriesBuilder = deserializeHeader(message);
    TunIpv4SrcCaseValueBuilder caseBuilder = new TunIpv4SrcCaseValueBuilder();
    TunIpv4SrcValuesBuilder valuesBuilder = new TunIpv4SrcValuesBuilder();
    valuesBuilder.setValue(message.readUnsignedInt());
    caseBuilder.setTunIpv4SrcValues(valuesBuilder.build());
    matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
    return matchEntriesBuilder.build();
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF10EnqueueActionDeserializer.java

License:Open Source License

@Override
public Action deserialize(ByteBuf input) {
    ActionBuilder builder = new ActionBuilder();
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    EnqueueCaseBuilder caseBuilder = new EnqueueCaseBuilder();
    EnqueueActionBuilder actionBuilder = new EnqueueActionBuilder();
    actionBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));
    input.skipBytes(ActionConstants.PADDING_IN_ENQUEUE_ACTION);
    actionBuilder.setQueueId(new QueueId(input.readUnsignedInt()));
    caseBuilder.setEnqueueAction(actionBuilder.build());
    builder.setActionChoice(caseBuilder.build());
    return builder.build();
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13GroupActionDeserializer.java

License:Open Source License

@Override
public Action deserialize(ByteBuf input) {
    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder builder = new ActionBuilder();
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    GroupCaseBuilder caseBuilder = new GroupCaseBuilder();
    GroupActionBuilder actionBuilder = new GroupActionBuilder();
    actionBuilder.setGroupId(input.readUnsignedInt());
    caseBuilder.setGroupAction(actionBuilder.build());
    builder.setActionChoice(caseBuilder.build());
    return builder.build();
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13OutputActionDeserializer.java

License:Open Source License

@Override
public Action deserialize(ByteBuf input) {
    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder builder = new ActionBuilder();
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
    OutputActionBuilder actionBuilder = new OutputActionBuilder();
    actionBuilder.setPort(new PortNumber(input.readUnsignedInt()));
    actionBuilder.setMaxLength(input.readUnsignedShort());
    caseBuilder.setOutputAction(actionBuilder.build());
    builder.setActionChoice(caseBuilder.build());
    input.skipBytes(ActionConstants.OUTPUT_PADDING);
    return builder.build();
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.action.OF13SetQueueActionDeserializer.java

License:Open Source License

@Override
public Action deserialize(ByteBuf input) {
    ActionBuilder builder = new ActionBuilder();
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    SetQueueCaseBuilder caseBuilder = new SetQueueCaseBuilder();
    SetQueueActionBuilder actionBuilder = new SetQueueActionBuilder();
    actionBuilder.setQueueId(input.readUnsignedInt());
    caseBuilder.setSetQueueAction(actionBuilder.build());
    builder.setActionChoice(caseBuilder.build());
    return builder.build();
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.experimenter.BundleControlFactory.java

License:Open Source License

@Override
public BundleControl deserialize(ByteBuf message) {
    BundleId bundleId = new BundleId(message.readUnsignedInt());
    BundleControlType type = BundleControlType.forValue(message.readUnsignedShort());
    BundleFlags flags = createBundleFlags(message.readUnsignedShort());
    BundleControlBuilder builder = new BundleControlBuilder();
    List<BundleProperty> properties = createBundleProperties(message);
    return builder.setBundleId(bundleId).setType(type).setFlags(flags).setBundleProperty(properties).build();
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.experimenter.BundleControlFactory.java

License:Open Source License

private BundleProperty createExperimenterBundleProperty(final int length, final ByteBuf message) {
    BundleExperimenterPropertyBuilder experimenterProperty = new BundleExperimenterPropertyBuilder();
    long experimenterId = message.readUnsignedInt();
    long expType = message.readUnsignedInt();
    experimenterProperty.setExperimenter(new ExperimenterId(experimenterId));
    experimenterProperty.setExpType(expType);

    OFDeserializer<BundleExperimenterPropertyData> deserializer = deserializerRegistry
            .getDeserializer(ExperimenterDeserializerKeyFactory.createBundlePropertyDeserializerKey(
                    EncodeConstants.OF13_VERSION_ID, experimenterId, expType));
    experimenterProperty/* w w w  .jav a  2  s . co  m*/
            .setBundleExperimenterPropertyData(deserializer.deserialize(message.readBytes(length - 12)));

    return new BundlePropertyBuilder().setType(BundlePropertyType.ONFETBPTEXPERIMENTER)
            .setBundlePropertyEntry(experimenterProperty.build()).build();
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.experimenter.OnfExperimenterErrorFactory.java

License:Open Source License

@Override
public ErrorMessage deserialize(ByteBuf message) {
    ErrorMessageBuilder builder = new ErrorMessageBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid(message.readUnsignedInt());

    int type = message.readUnsignedShort();
    ErrorType errorType = ErrorType.forValue(type);
    if (errorType != null && errorType.equals(ErrorType.EXPERIMENTER)) {
        builder.setType(errorType.getIntValue());
        builder.setTypeString(errorType.getName());
    } else {/*from w w  w . j av a2  s. com*/
        LOG.warn("Deserializing other than {} error message with {}", ErrorType.EXPERIMENTER.getName(),
                this.getClass().getCanonicalName());
        builder.setType(type);
        builder.setTypeString(UNKNOWN_TYPE);
    }

    int code = message.readUnsignedShort();
    OnfExperimenterErrorCode errorCode = OnfExperimenterErrorCode.forValue(code);
    if (errorCode != null) {
        builder.setCode(errorCode.getIntValue());
        builder.setCodeString(errorCode.getName());
    } else {
        builder.setCode(code);
        builder.setCodeString(UNKNOWN_CODE);
    }

    builder.addAugmentation(ExperimenterIdError.class, new ExperimenterIdErrorBuilder()
            .setExperimenter(new ExperimenterId(message.readUnsignedInt())).build());

    if (message.readableBytes() > 0) {
        byte[] data = new byte[message.readableBytes()];
        message.readBytes(data);
        builder.setData(data);
    }
    return builder.build();
}