Example usage for io.netty.buffer ByteBuf readUnsignedShort

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

Introduction

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

Prototype

public abstract int readUnsignedShort();

Source Link

Document

Gets an unsigned 16-bit short integer at the current readerIndex and increases the readerIndex by 2 in this buffer.

Usage

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

License:Open Source License

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntryBuilder = deserializeHeader(message);
    matchEntryBuilder.setHasMask(true);/*from   ww w. j  av a2 s . c  om*/
    int portNo = message.readUnsignedShort();
    int mask = message.readUnsignedShort();
    TcpDstCaseValueBuilder caseBuilder = new TcpDstCaseValueBuilder();
    TcpDstValuesBuilder tcpDstValuesBuilder = new TcpDstValuesBuilder();
    tcpDstValuesBuilder.setPort(new PortNumber(portNo));
    tcpDstValuesBuilder.setMask(mask);
    caseBuilder.setTcpDstValues(tcpDstValuesBuilder.build());
    matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
    return matchEntryBuilder.build();
}

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

License:Open Source License

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntryBuilder = deserializeHeader(message);
    matchEntryBuilder.setHasMask(true);// w w  w. ja v  a 2s .c o  m
    int portNo = message.readUnsignedShort();
    int mask = message.readUnsignedShort();
    TcpSrcCaseValueBuilder caseBuilder = new TcpSrcCaseValueBuilder();
    TcpSrcValuesBuilder tcpSrcValuesBuilder = new TcpSrcValuesBuilder();
    tcpSrcValuesBuilder.setPort(new PortNumber(portNo));
    tcpSrcValuesBuilder.setMask(mask);
    caseBuilder.setTcpSrcValues(tcpSrcValuesBuilder.build());
    matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
    return matchEntryBuilder.build();
}

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

License:Open Source License

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntryBuilder = deserializeHeader(message);
    matchEntryBuilder.setHasMask(true);//  ww w  .j a  v  a 2  s. c o m
    int portNo = message.readUnsignedShort();
    int mask = message.readUnsignedShort();
    UdpDstCaseValueBuilder caseBuilder = new UdpDstCaseValueBuilder();
    UdpDstValuesBuilder udpDstValuesBuilder = new UdpDstValuesBuilder();
    udpDstValuesBuilder.setPort(new PortNumber(portNo));
    udpDstValuesBuilder.setMask(mask);
    caseBuilder.setUdpDstValues(udpDstValuesBuilder.build());
    matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
    return matchEntryBuilder.build();
}

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

License:Open Source License

@Override
public MatchEntry deserialize(ByteBuf message) {
    MatchEntryBuilder matchEntryBuilder = deserializeHeader(message);
    matchEntryBuilder.setHasMask(true);//  ww w.  j a  v  a 2s  .c  o  m
    int portNo = message.readUnsignedShort();
    int mask = message.readUnsignedShort();
    UdpSrcCaseValueBuilder caseBuilder = new UdpSrcCaseValueBuilder();
    UdpSrcValuesBuilder udpSrcValuesBuilder = new UdpSrcValuesBuilder();
    udpSrcValuesBuilder.setPort(new PortNumber(portNo));
    udpSrcValuesBuilder.setMask(mask);
    caseBuilder.setUdpSrcValues(udpSrcValuesBuilder.build());
    matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
    return matchEntryBuilder.build();
}

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

License:Open Source License

@Override
public Action deserialize(ByteBuf input) {
    ActionBuilder builder = new ActionBuilder();
    builder.setType(getType());//from  w  ww .  j  a  va2 s. c  om
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    EthertypeActionBuilder etherType = new EthertypeActionBuilder();
    etherType.setEthertype(new EtherType(input.readUnsignedShort()));
    builder.addAugmentation(EthertypeAction.class, etherType.build());
    input.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
    return builder.build();
}

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

License:Open Source License

protected static void createPortAugmentation(ByteBuf input, ActionBuilder actionBuilder) {
    PortActionBuilder portBuilder = new PortActionBuilder();
    portBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));
    actionBuilder.addAugmentation(PortAction.class, portBuilder.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.OF10OutputActionDeserializer.java

License:Open Source License

@Override
public Action deserialize(ByteBuf input) {
    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((long) input.readUnsignedShort()));
    actionBuilder.setMaxLength(input.readUnsignedShort());
    caseBuilder.setOutputAction(actionBuilder.build());
    builder.setActionChoice(caseBuilder.build());
    return builder.build();
}

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

License:Open Source License

@Override
public Action deserialize(ByteBuf input) {
    ActionBuilder builder = new ActionBuilder();
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    SetTpDstCaseBuilder caseBuilder = new SetTpDstCaseBuilder();
    SetTpDstActionBuilder actionBuilder = new SetTpDstActionBuilder();
    actionBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));
    caseBuilder.setSetTpDstAction(actionBuilder.build());
    builder.setActionChoice(caseBuilder.build());
    input.skipBytes(ActionConstants.PADDING_IN_TP_PORT_ACTION);
    return builder.build();
}

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

License:Open Source License

@Override
public Action deserialize(ByteBuf input) {
    ActionBuilder builder = new ActionBuilder();
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    SetTpSrcCaseBuilder caseBuilder = new SetTpSrcCaseBuilder();
    SetTpSrcActionBuilder actionBuilder = new SetTpSrcActionBuilder();
    actionBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));
    caseBuilder.setSetTpSrcAction(actionBuilder.build());
    builder.setActionChoice(caseBuilder.build());
    input.skipBytes(ActionConstants.PADDING_IN_TP_PORT_ACTION);
    return builder.build();
}