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.netide.openflowjava.protocol.impl.deserialization.factories.MultipartRequestInputMessageFactory.java

License:Open Source License

private MultipartRequestMeterConfigCase setMeterConfig(ByteBuf input) {
    MultipartRequestMeterConfigCaseBuilder caseBuilder = new MultipartRequestMeterConfigCaseBuilder();
    MultipartRequestMeterConfigBuilder meterBuilder = new MultipartRequestMeterConfigBuilder();
    meterBuilder.setMeterId(new MeterId(input.readUnsignedInt()));
    caseBuilder.setMultipartRequestMeterConfig(meterBuilder.build());
    return caseBuilder.build();
}

From source file:org.opendaylight.netide.openflowjava.protocol.impl.deserialization.factories.OF10BarrierInputMessageFactory.java

License:Open Source License

@Override
public BarrierInput deserialize(ByteBuf rawMessage) {
    BarrierInputBuilder builder = new BarrierInputBuilder();
    builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    return builder.build();
}

From source file:org.opendaylight.netide.openflowjava.protocol.impl.deserialization.factories.OF10FeaturesRequestMessageFactory.java

License:Open Source License

@Override
public GetFeaturesInput deserialize(ByteBuf rawMessage) {
    GetFeaturesInputBuilder builder = new GetFeaturesInputBuilder();
    builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    return builder.build();
}

From source file:org.opendaylight.netide.openflowjava.protocol.impl.deserialization.factories.OF10FlowModInputMessageFactory.java

License:Open Source License

@Override
public FlowModInput deserialize(ByteBuf rawMessage) {
    FlowModInputBuilder builder = new FlowModInputBuilder();
    builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    OFDeserializer<MatchV10> matchDeserializer = registry.getDeserializer(
            new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, EncodeConstants.EMPTY_VALUE, MatchV10.class));
    builder.setMatchV10(matchDeserializer.deserialize(rawMessage));
    byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
    rawMessage.readBytes(cookie);//from w  ww  . j ava 2s .  c om
    builder.setCookie(new BigInteger(1, cookie));
    builder.setCommand(FlowModCommand.forValue(rawMessage.readUnsignedShort()));
    builder.setIdleTimeout(rawMessage.readUnsignedShort());
    builder.setHardTimeout(rawMessage.readUnsignedShort());
    builder.setPriority(rawMessage.readUnsignedShort());
    builder.setBufferId(rawMessage.readUnsignedInt());
    builder.setOutPort(new PortNumber((long) rawMessage.readUnsignedShort()));
    builder.setFlagsV10(createFlowModFlagsFromBitmap(rawMessage.readUnsignedShort()));
    CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF10_VERSION_ID);

    List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF10_VERSION_ID,
            rawMessage.readableBytes(), rawMessage, keyMaker, registry);
    builder.setAction(actions);
    return builder.build();
}

From source file:org.opendaylight.netide.openflowjava.protocol.impl.deserialization.factories.OF10GetConfigInputMessageFactory.java

License:Open Source License

@Override
public GetConfigInput deserialize(ByteBuf rawMessage) {
    GetConfigInputBuilder builder = new GetConfigInputBuilder();
    builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    return builder.build();
}

From source file:org.opendaylight.netide.openflowjava.protocol.impl.deserialization.factories.OF10GetQueueConfigInputMessageFactory.java

License:Open Source License

@Override
public GetQueueConfigInput deserialize(ByteBuf rawMessage) {
    GetQueueConfigInputBuilder builder = new GetQueueConfigInputBuilder();
    builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
    builder.setXid((rawMessage.readUnsignedInt()));
    builder.setPort(new PortNumber((long) rawMessage.readUnsignedShort()));
    return builder.build();
}

From source file:org.opendaylight.netide.openflowjava.protocol.impl.deserialization.factories.OF10PacketOutInputMessageFactory.java

License:Open Source License

@Override
public PacketOutInput deserialize(ByteBuf rawMessage) {
    PacketOutInputBuilder builder = new PacketOutInputBuilder();
    builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setBufferId(rawMessage.readUnsignedInt());
    builder.setInPort(new PortNumber((long) rawMessage.readUnsignedShort()));
    int actions_len = rawMessage.readShort();
    CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF10_VERSION_ID);
    List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF10_VERSION_ID, actions_len,
            rawMessage, keyMaker, registry);
    builder.setAction(actions);//from   w  w w  . j  a v  a2s.  c om

    byte[] data = rawMessage.readBytes(rawMessage.readableBytes()).array();

    if (data != null) {

        builder.setData(data);
    }
    return builder.build();
}

From source file:org.opendaylight.netide.openflowjava.protocol.impl.deserialization.factories.OF10PortModInputMessageFactory.java

License:Open Source License

@Override
public PortModInput deserialize(ByteBuf rawMessage) {
    PortModInputBuilder builder = new PortModInputBuilder();
    builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setPortNo(new PortNumber((long) rawMessage.readUnsignedShort()));
    byte[] hwAddress = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
    rawMessage.readBytes(hwAddress);//  w  w  w .  j a  v  a  2  s .c  o m
    builder.setHwAddress(new MacAddress(ByteBufUtils.macAddressToString(hwAddress)));
    builder.setConfigV10(createPortConfig(rawMessage.readUnsignedInt()));
    builder.setMaskV10(createPortConfig(rawMessage.readUnsignedInt()));
    builder.setAdvertiseV10(createPortFeatures(rawMessage.readUnsignedInt()));
    return builder.build();
}

From source file:org.opendaylight.netide.openflowjava.protocol.impl.deserialization.factories.OF10SetConfigMessageFactory.java

License:Open Source License

@Override
public SetConfigInput deserialize(ByteBuf rawMessage) {
    SetConfigInputBuilder builder = new SetConfigInputBuilder();
    builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setFlags(SwitchConfigFlag.forValue(rawMessage.readUnsignedShort()));
    builder.setMissSendLen(rawMessage.readUnsignedShort());
    return builder.build();
}

From source file:org.opendaylight.netide.openflowjava.protocol.impl.deserialization.factories.OF10StatsRequestInputFactory.java

License:Open Source License

@Override
public MultipartRequestInput deserialize(ByteBuf rawMessage) {
    MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
    builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    int type = rawMessage.readUnsignedShort();
    builder.setType(getMultipartType(type));
    builder.setFlags(getMultipartRequestFlags(rawMessage.readUnsignedShort()));
    switch (getMultipartType(type)) {
    case OFPMPDESC:
        builder.setMultipartRequestBody(setDesc(rawMessage));
        break;//  w  w w  .  j a  v a  2 s  .  c o  m
    case OFPMPFLOW:
        builder.setMultipartRequestBody(setFlow(rawMessage));
        break;
    case OFPMPAGGREGATE:
        builder.setMultipartRequestBody(setAggregate(rawMessage));
        break;
    case OFPMPTABLE:
        builder.setMultipartRequestBody(setTable(rawMessage));
        break;
    case OFPMPPORTSTATS:
        builder.setMultipartRequestBody(setPortStats(rawMessage));
        break;
    case OFPMPQUEUE:
        builder.setMultipartRequestBody(setQueue(rawMessage));
        break;
    case OFPMPEXPERIMENTER:
        builder.setMultipartRequestBody(setExperimenter(rawMessage));
        break;
    default:
        break;
    }
    return builder.build();
}