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.protocol.impl.deserialization.match.OxmArpOpDeserializer.java

License:Open Source License

private static void addArpOpValue(ByteBuf input, MatchEntryBuilder builder) {
    ArpOpCaseBuilder caseBuilder = new ArpOpCaseBuilder();
    ArpOpBuilder opBuilder = new ArpOpBuilder();
    opBuilder.setOpCode(input.readUnsignedShort());
    caseBuilder.setArpOp(opBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmEthTypeDeserializer.java

License:Open Source License

private static void addEthTypeValue(ByteBuf input, MatchEntryBuilder builder) {
    EthTypeCaseBuilder caseBuilder = new EthTypeCaseBuilder();
    EthTypeBuilder ethBuilder = new EthTypeBuilder();
    ethBuilder.setEthType(new EtherType(input.readUnsignedShort()));
    caseBuilder.setEthType(ethBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmIpv6ExtHdrDeserializer.java

License:Open Source License

private static Ipv6ExthdrFlags convertPseudofields(ByteBuf input) {
    int bitmap = input.readUnsignedShort();
    final Boolean nonext = ((bitmap) & (1 << 0)) != 0;
    final Boolean esp = ((bitmap) & (1 << 1)) != 0;
    final Boolean auth = ((bitmap) & (1 << 2)) != 0;
    final Boolean dest = ((bitmap) & (1 << 3)) != 0;
    final Boolean frag = ((bitmap) & (1 << 4)) != 0;
    final Boolean router = ((bitmap) & (1 << 5)) != 0;
    final Boolean hop = ((bitmap) & (1 << 6)) != 0;
    final Boolean unrep = ((bitmap) & (1 << 7)) != 0;
    final Boolean unseq = ((bitmap) & (1 << 8)) != 0;
    return new Ipv6ExthdrFlags(auth, dest, esp, frag, hop, nonext, router, unrep, unseq);
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmSctpDstDeserializer.java

License:Open Source License

private static void addSctpDstValue(ByteBuf input, MatchEntryBuilder builder) {
    SctpDstCaseBuilder caseBuilder = new SctpDstCaseBuilder();
    SctpDstBuilder sctpBuilder = new SctpDstBuilder();
    sctpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
    caseBuilder.setSctpDst(sctpBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmSctpSrcDeserializer.java

License:Open Source License

private static void addSctpSrcValue(ByteBuf input, MatchEntryBuilder builder) {
    SctpSrcCaseBuilder caseBuilder = new SctpSrcCaseBuilder();
    SctpSrcBuilder sctpBuilder = new SctpSrcBuilder();
    sctpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
    caseBuilder.setSctpSrc(sctpBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTcpDstDeserializer.java

License:Open Source License

private static void addTcpDstValue(ByteBuf input, MatchEntryBuilder builder) {
    TcpDstCaseBuilder caseBuilder = new TcpDstCaseBuilder();
    TcpDstBuilder tcpBuilder = new TcpDstBuilder();
    tcpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
    caseBuilder.setTcpDst(tcpBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmTcpSrcDeserializer.java

License:Open Source License

private static void addTcpSrcValue(ByteBuf input, MatchEntryBuilder builder) {
    TcpSrcCaseBuilder caseBuilder = new TcpSrcCaseBuilder();
    TcpSrcBuilder tcpBuilder = new TcpSrcBuilder();
    tcpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
    caseBuilder.setTcpSrc(tcpBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpDstDeserializer.java

License:Open Source License

private static void addUdpDstValue(ByteBuf input, MatchEntryBuilder builder) {
    UdpDstCaseBuilder caseBuilder = new UdpDstCaseBuilder();
    UdpDstBuilder udpBuilder = new UdpDstBuilder();
    udpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
    caseBuilder.setUdpDst(udpBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpSrcDeserializer.java

License:Open Source License

private static void addUdpSrcValue(ByteBuf input, MatchEntryBuilder builder) {
    UdpSrcCaseBuilder caseBuilder = new UdpSrcCaseBuilder();
    UdpSrcBuilder udpBuilder = new UdpSrcBuilder();
    udpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
    caseBuilder.setUdpSrc(udpBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}

From source file:org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanVidDeserializer.java

License:Open Source License

private static void addVlanVidValue(ByteBuf input, MatchEntryBuilder builder) {
    VlanVidCaseBuilder caseBuilder = new VlanVidCaseBuilder();
    VlanVidBuilder vlanBuilder = new VlanVidBuilder();
    int vidEntryValue = input.readUnsignedShort();
    vlanBuilder.setCfiBit((vidEntryValue & (1 << 12)) != 0); // cfi is 13-th bit
    vlanBuilder.setVlanVid(vidEntryValue & ((1 << 12) - 1)); // value without 13-th bit
    if (builder.isHasMask()) {
        vlanBuilder.setMask(OxmDeserializerHelper.convertMask(input, EncodeConstants.SIZE_OF_SHORT_IN_BYTES));
    }/*  w  w w.j av  a  2  s  . c o m*/
    caseBuilder.setVlanVid(vlanBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}