Example usage for io.netty.buffer ByteBuf skipBytes

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

Introduction

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

Prototype

public abstract ByteBuf skipBytes(int length);

Source Link

Document

Increases the current readerIndex by the specified length in this buffer.

Usage

From source file:org.opendaylight.openflowjava.nx.codec.action.LearnCodecUtil.java

License:Open Source License

static void deserializeLearnHeader(final ByteBuf message, NxActionLearnBuilder nxActionLearnBuilder) {
    nxActionLearnBuilder.setIdleTimeout(message.readUnsignedShort());
    nxActionLearnBuilder.setHardTimeout(message.readUnsignedShort());
    nxActionLearnBuilder.setPriority(message.readUnsignedShort());
    nxActionLearnBuilder.setCookie(BigInteger.valueOf(message.readLong()));
    nxActionLearnBuilder.setFlags(message.readUnsignedShort());
    nxActionLearnBuilder.setTableId(message.readUnsignedByte());
    message.skipBytes(1);
    nxActionLearnBuilder.setFinIdleTimeout(message.readUnsignedShort());
    nxActionLearnBuilder.setFinHardTimeout(message.readUnsignedShort());
}

From source file:org.opendaylight.openflowjava.nx.codec.action.LearnCodecUtil.java

License:Open Source License

private static FlowMods readFlowMod(ByteBuf message) {
    short header = message.readShort();
    length -= EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
    if (header == 0) {
        return null;
    }// w  w w  .  ja  v  a2 s .  co m

    short src = (short) ((header & SRC_MASK) >> SRC_POS);
    short dst = (short) ((header & DST_MASK) >> DST_POS);
    short numBits = (short) (header & NUM_BITS_MASK);

    if (src == 0 && dst == 0 && numBits != 0) {
        return readFlowModAddMatchFromField(message, numBits);
    } else if (src == 0 && dst == 0) {
        message.skipBytes(EMPTY_FLOW_MOD_LENGTH);
        length -= EMPTY_FLOW_MOD_LENGTH;
    } else if (src == 1 && dst == 0) {
        return readFlowModAddMatchFromValue(message, numBits);
    } else if (src == 0 && dst == 1) {
        return readFlowModCopyFromField(message, numBits);
    } else if (src == 1 && dst == 1) {
        return readFlowModCopyFromValue(message, numBits);
    } else if (src == 0 && dst == 2) {
        return readFlowToPort(message, numBits);
    }
    return null;
}

From source file:org.opendaylight.openflowjava.nx.codec.action.MultipathCodec.java

License:Open Source License

@Override
public Action deserialize(final ByteBuf message) {
    ActionBuilder actionBuilder = deserializeHeader(message);
    ActionMultipathBuilder actionMultipathBuilder = new ActionMultipathBuilder();

    NxActionMultipathBuilder nxActionMultipathBuilder = new NxActionMultipathBuilder();
    nxActionMultipathBuilder.setFields(OfjNxHashFields.forValue(message.readUnsignedShort()));
    nxActionMultipathBuilder.setBasis(message.readUnsignedShort());
    message.skipBytes(2); //two bytes

    nxActionMultipathBuilder.setAlgorithm(OfjNxMpAlgorithm.forValue(message.readUnsignedShort()));
    nxActionMultipathBuilder.setMaxLink(message.readUnsignedShort());
    nxActionMultipathBuilder.setArg(message.readUnsignedInt());
    message.skipBytes(2); //two bytes

    nxActionMultipathBuilder.setOfsNbits(message.readUnsignedShort());
    nxActionMultipathBuilder.setDst(message.readUnsignedInt());
    actionMultipathBuilder.setNxActionMultipath(nxActionMultipathBuilder.build());
    actionBuilder.setActionChoice(actionMultipathBuilder.build());

    return actionBuilder.build();
}

From source file:org.opendaylight.openflowjava.nx.codec.action.OutputRegCodec.java

License:Open Source License

@Override
public Action deserialize(final ByteBuf message) {
    ActionBuilder actionBuilder = deserializeHeader(message);
    ActionOutputRegBuilder builder = new ActionOutputRegBuilder();
    NxActionOutputRegBuilder nxActionOutputRegBuilder = new NxActionOutputRegBuilder();
    nxActionOutputRegBuilder.setNBits(message.readUnsignedShort());
    nxActionOutputRegBuilder.setSrc(message.readUnsignedInt());
    nxActionOutputRegBuilder.setMaxLen(message.readUnsignedShort());
    message.skipBytes(PADDING_IN_OUTPUT_REG_ACTION);
    builder.setNxActionOutputReg(nxActionOutputRegBuilder.build());
    actionBuilder.setActionChoice(builder.build());
    return actionBuilder.build();
}

From source file:org.opendaylight.openflowjava.nx.codec.action.PopNshCodec.java

License:Open Source License

@Override
public Action deserialize(ByteBuf message) {
    ActionBuilder actionBuilder = deserializeHeader(message);
    ActionPopNshBuilder builder = new ActionPopNshBuilder();
    NxActionPopNshBuilder nxActionPopNshBuilder = new NxActionPopNshBuilder();
    message.skipBytes(padding);
    builder.setNxActionPopNsh(nxActionPopNshBuilder.build());
    actionBuilder.setActionChoice(builder.build());
    return actionBuilder.build();
}

From source file:org.opendaylight.openflowjava.nx.codec.action.PushNshCodec.java

License:Open Source License

@Override
public Action deserialize(ByteBuf message) {
    ActionBuilder actionBuilder = deserializeHeader(message);
    ActionPushNshBuilder builder = new ActionPushNshBuilder();
    NxActionPushNshBuilder nxActionPushNshBuilder = new NxActionPushNshBuilder();
    message.skipBytes(padding);
    builder.setNxActionPushNsh(nxActionPushNshBuilder.build());
    actionBuilder.setActionChoice(builder.build());
    return actionBuilder.build();
}

From source file:org.opendaylight.openflowjava.nx.codec.action.ResubmitCodec.java

License:Open Source License

@Override
public Action deserialize(final ByteBuf message) {
    ActionBuilder actionBuilder = deserializeHeader(message);

    ActionResubmitBuilder builder = new ActionResubmitBuilder();
    NxActionResubmitBuilder nxActionResubmitBuilder = new NxActionResubmitBuilder();
    nxActionResubmitBuilder.setInPort(message.readUnsignedShort());
    nxActionResubmitBuilder.setTable(message.readUnsignedByte());
    builder.setNxActionResubmit(nxActionResubmitBuilder.build());
    message.skipBytes(padding);

    actionBuilder.setActionChoice(builder.build());
    return actionBuilder.build();
}

From source file:org.opendaylight.openflowjava.nx.codec.action.SetNshc1Codec.java

License:Open Source License

@Override
public Action deserialize(ByteBuf message) {
    ActionBuilder actionBuilder = deserializeHeader(message);
    ActionSetNshc1Builder builder = new ActionSetNshc1Builder();
    NxActionSetNshc1Builder nxActionSetNspBuilder = new NxActionSetNshc1Builder();
    message.skipBytes(padding);
    nxActionSetNspBuilder.setNshc(message.readUnsignedInt());
    builder.setNxActionSetNshc1(nxActionSetNspBuilder.build());
    actionBuilder.setActionChoice(builder.build());
    return actionBuilder.build();
}

From source file:org.opendaylight.openflowjava.nx.codec.action.SetNshc2Codec.java

License:Open Source License

@Override
public Action deserialize(ByteBuf message) {
    ActionBuilder actionBuilder = deserializeHeader(message);
    ActionSetNshc2Builder builder = new ActionSetNshc2Builder();
    NxActionSetNshc2Builder nxActionSetNspBuilder = new NxActionSetNshc2Builder();
    message.skipBytes(padding);
    nxActionSetNspBuilder.setNshc(message.readUnsignedInt());
    builder.setNxActionSetNshc2(nxActionSetNspBuilder.build());
    actionBuilder.setActionChoice(builder.build());
    return actionBuilder.build();
}

From source file:org.opendaylight.openflowjava.nx.codec.action.SetNshc3Codec.java

License:Open Source License

@Override
public Action deserialize(ByteBuf message) {
    ActionBuilder actionBuilder = deserializeHeader(message);
    ActionSetNshc3Builder builder = new ActionSetNshc3Builder();
    NxActionSetNshc3Builder nxActionSetNspBuilder = new NxActionSetNshc3Builder();
    message.skipBytes(padding);
    nxActionSetNspBuilder.setNshc(message.readUnsignedInt());
    builder.setNxActionSetNshc3(nxActionSetNspBuilder.build());
    actionBuilder.setActionChoice(builder.build());
    return actionBuilder.build();
}