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.OF10StatsRequestInputFactory.java

License:Open Source License

private MultipartRequestQueueCase setQueue(ByteBuf input) {
    MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
    MultipartRequestQueueBuilder queueBuilder = new MultipartRequestQueueBuilder();
    queueBuilder.setPortNo((long) input.readUnsignedShort());
    input.skipBytes(2);/*from  w w w. j av  a2s  . c o m*/
    queueBuilder.setQueueId(input.readUnsignedInt());
    caseBuilder.setMultipartRequestQueue(queueBuilder.build());
    return caseBuilder.build();
}

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

License:Open Source License

@Override
public PacketOutInput deserialize(ByteBuf rawMessage) {
    PacketOutInputBuilder builder = new PacketOutInputBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setBufferId(rawMessage.readUnsignedInt());
    builder.setInPort(new PortNumber(rawMessage.readUnsignedInt()));
    int actions_len = rawMessage.readShort();
    rawMessage.skipBytes(PADDING);//from   w w w . j  ava 2s . c  om
    CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
    List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID, actions_len,
            rawMessage, keyMaker, registry);
    builder.setAction(actions);
    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.PortModInputMessageFactory.java

License:Open Source License

@Override
public PortModInput deserialize(ByteBuf rawMessage) {
    PortModInputBuilder builder = new PortModInputBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setPortNo(new PortNumber(rawMessage.readUnsignedInt()));
    rawMessage.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_1);
    byte[] hwAddress = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
    rawMessage.readBytes(hwAddress);//from  w w  w . j a  v  a 2s . co m
    builder.setHwAddress(new MacAddress(ByteBufUtils.macAddressToString(hwAddress)));
    rawMessage.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_2);
    builder.setConfig(createPortConfig(rawMessage.readUnsignedInt()));
    builder.setMask(createPortConfig(rawMessage.readUnsignedInt()));
    builder.setAdvertise(createPortFeatures(rawMessage.readUnsignedInt()));
    rawMessage.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_3);
    return builder.build();
}

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

License:Open Source License

@Override
public RoleRequestInput deserialize(ByteBuf rawMessage) {
    RoleRequestInputBuilder builder = new RoleRequestInputBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid((rawMessage.readUnsignedInt()));
    builder.setRole(ControllerRole.forValue(rawMessage.readInt()));
    rawMessage.skipBytes(PADDING);/*from   w  w  w . j av a2  s  .co m*/
    byte[] generationId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
    rawMessage.readBytes(generationId);
    builder.setGenerationId(new BigInteger(1, generationId));
    return builder.build();
}

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

License:Open Source License

@Override
public SetAsyncInput deserialize(ByteBuf rawMessage) {
    SetAsyncInputBuilder builder = new SetAsyncInputBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setPacketInMask(decodePacketInMask(rawMessage));
    builder.setPortStatusMask(decodePortStatusMask(rawMessage));
    builder.setFlowRemovedMask(decodeFlowRemovedMask(rawMessage));
    return builder.build();
}

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

License:Open Source License

private static List<PacketInMask> decodePacketInMask(ByteBuf input) {
    List<PacketInMask> inMasks = new ArrayList<>();
    PacketInMaskBuilder maskBuilder;/*from   ww  w  .  jav a 2 s  .c  om*/
    for (int i = 0; i < SEPARATE_ROLES; i++) {
        maskBuilder = new PacketInMaskBuilder();
        maskBuilder.setMask(decodePacketInReasons(input.readUnsignedInt()));
        inMasks.add(maskBuilder.build());
    }
    return inMasks;
}

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

License:Open Source License

private static List<PortStatusMask> decodePortStatusMask(ByteBuf input) {
    List<PortStatusMask> inMasks = new ArrayList<>();
    PortStatusMaskBuilder maskBuilder;/*from w w w . j ava  2 s . co m*/
    for (int i = 0; i < SEPARATE_ROLES; i++) {
        maskBuilder = new PortStatusMaskBuilder();
        maskBuilder.setMask(decodePortReasons(input.readUnsignedInt()));
        inMasks.add(maskBuilder.build());
    }
    return inMasks;
}

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

License:Open Source License

private static List<FlowRemovedMask> decodeFlowRemovedMask(ByteBuf input) {
    List<FlowRemovedMask> inMasks = new ArrayList<>();
    FlowRemovedMaskBuilder maskBuilder;//from w ww.  j  a va2  s  .  c  om
    for (int i = 0; i < SEPARATE_ROLES; i++) {
        maskBuilder = new FlowRemovedMaskBuilder();
        maskBuilder.setMask(decodeFlowRemovedReasons(input.readUnsignedInt()));
        inMasks.add(maskBuilder.build());
    }
    return inMasks;
}

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

License:Open Source License

@Override
public SetConfigInput deserialize(ByteBuf rawMessage) {
    SetConfigInputBuilder builder = new SetConfigInputBuilder();
    builder.setVersion((short) EncodeConstants.OF13_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.TableModInputMessageFactory.java

License:Open Source License

@Override
public TableModInput deserialize(ByteBuf rawMessage) {
    TableModInputBuilder builder = new TableModInputBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setTableId(new TableId((long) rawMessage.readUnsignedByte()));
    rawMessage.skipBytes(PADDING_IN_TABLE_MOD_MESSAGE);
    builder.setConfig(createTableConfig(rawMessage.readUnsignedInt()));
    return builder.build();
}