Example usage for io.netty.buffer ByteBuf readUnsignedByte

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

Introduction

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

Prototype

public abstract short readUnsignedByte();

Source Link

Document

Gets an unsigned byte at the current readerIndex and increases the readerIndex by 1 in this buffer.

Usage

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);//ww  w.  ja  v  a 2s  .  c  o  m

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

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

License:Open Source License

@Override
public Action deserialize(final ByteBuf message) {
    ActionBuilder actionBuilder = deserializeHeader(message);
    ActionSetNsiBuilder builder = new ActionSetNsiBuilder();
    NxActionSetNsiBuilder nxActionSetNsiBuilder = new NxActionSetNsiBuilder();
    nxActionSetNsiBuilder.setNsi(message.readUnsignedByte());
    message.skipBytes(padding);//ww  w .j  a va2 s. co  m

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

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

License:Open Source License

protected MatchEntryBuilder deserializeHeader(ByteBuf message) {
    MatchEntryBuilder builder = new MatchEntryBuilder();
    builder.setOxmClass(getOxmClass());/*from  w  w  w. j a va2s  .  com*/
    // skip oxm_class - provided
    message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    builder.setOxmMatchField(getNxmField());
    boolean hasMask = (message.readUnsignedByte() & 1) != 0;
    builder.setHasMask(hasMask);
    // skip match entry length - not needed
    message.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
    return builder;
}

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

License:Open Source License

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntriesBuilder = deserializeHeader(message);
    IcmpTypeCaseValueBuilder icmpTypeCaseValueBuilder = new IcmpTypeCaseValueBuilder();
    icmpTypeCaseValueBuilder//from w w  w. j  a  v  a  2  s.  co  m
            .setIcmpTypeValues(new IcmpTypeValuesBuilder().setValue(message.readUnsignedByte()).build());
    matchEntriesBuilder.setMatchEntryValue(icmpTypeCaseValueBuilder.build());
    matchEntriesBuilder.setHasMask(false);
    return matchEntriesBuilder.build();
}

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

License:Open Source License

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntriesBuilder = deserializeHeader(message);
    NshMdtypeCaseValueBuilder nshMdtypeCaseValueBuilder = new NshMdtypeCaseValueBuilder();
    nshMdtypeCaseValueBuilder/*from www . ja v  a  2 s.  com*/
            .setNshMdtypeValues(new NshMdtypeValuesBuilder().setValue(message.readUnsignedByte()).build());
    matchEntriesBuilder.setMatchEntryValue(nshMdtypeCaseValueBuilder.build());
    matchEntriesBuilder.setHasMask(false);
    return matchEntriesBuilder.build();
}

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

License:Open Source License

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntriesBuilder = deserializeHeader(message);
    NshNpCaseValueBuilder nshNpCaseValueBuilder = new NshNpCaseValueBuilder();
    nshNpCaseValueBuilder.setNshNpValues(new NshNpValuesBuilder().setValue(message.readUnsignedByte()).build());
    matchEntriesBuilder.setMatchEntryValue(nshNpCaseValueBuilder.build());
    matchEntriesBuilder.setHasMask(false);
    return matchEntriesBuilder.build();
}

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

License:Open Source License

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntriesBuilder = deserializeHeader(message);
    NsiCaseValueBuilder nsiCaseValueBuilder = new NsiCaseValueBuilder();
    nsiCaseValueBuilder.setNsiValues(new NsiValuesBuilder().setNsi(message.readUnsignedByte()).build());
    matchEntriesBuilder.setMatchEntryValue(nsiCaseValueBuilder.build());
    matchEntriesBuilder.setHasMask(false);
    return matchEntriesBuilder.build();
}

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

License:Open Source License

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntriesBuilder = deserializeHeader(message);
    TunGpeNpCaseValueBuilder tunGpeNpCaseValueBuilder = new TunGpeNpCaseValueBuilder();
    tunGpeNpCaseValueBuilder//from   ww  w .  j a  v a2  s  .  co  m
            .setTunGpeNpValues(new TunGpeNpValuesBuilder().setValue(message.readUnsignedByte()).build());
    matchEntriesBuilder.setMatchEntryValue(tunGpeNpCaseValueBuilder.build());
    matchEntriesBuilder.setHasMask(false);
    return matchEntriesBuilder.build();
}

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

License:Open Source License

private static Augmentation<Action> createNwAddressAugmentationAndPad(ByteBuf input) {
    IpAddressActionBuilder ipBuilder = new IpAddressActionBuilder();
    List<String> groups = new ArrayList<>();
    for (int i = 0; i < EncodeConstants.GROUPS_IN_IPV4_ADDRESS; i++) {
        groups.add(Short.toString(input.readUnsignedByte()));
    }//from ww  w .ja  v  a2s  . c  om
    Joiner joiner = Joiner.on(".");
    ipBuilder.setIpAddress(new Ipv4Address(joiner.join(groups)));
    return ipBuilder.build();
}

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

License:Open Source License

@Override
public Action deserialize(ByteBuf input) {
    ActionBuilder builder = new ActionBuilder();
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    SetNwTosCaseBuilder caseBuilder = new SetNwTosCaseBuilder();
    SetNwTosActionBuilder tosBuilder = new SetNwTosActionBuilder();
    tosBuilder.setNwTos(input.readUnsignedByte());
    caseBuilder.setSetNwTosAction(tosBuilder.build());
    builder.setActionChoice(caseBuilder.build());
    input.skipBytes(ActionConstants.PADDING_IN_SET_NW_TOS_ACTION);
    return builder.build();
}