Class MplsLabelUtil

java.lang.Object
org.opendaylight.protocol.util.MplsLabelUtil

public final class MplsLabelUtil extends Object
Util class for encoding/decoding 20bit leftmost value.
  • Method Details

    • mplsLabelForByteBuf

      public static MplsLabel mplsLabelForByteBuf(io.netty.buffer.ByteBuf buffer)
      Creates and returns MplsLabel object from 20 leftmost bits in the incoming buffer. Moves reader index by 3.
      Parameters:
      buffer - expecting 3 bytes with 20 leftmost bits as label
      Returns:
      MplsLabel object
    • byteBufForMplsLabel

      public static io.netty.buffer.ByteBuf byteBufForMplsLabel(MplsLabel label)
      Serializes incoming MplsLabel without bottom bit.
      Parameters:
      label - MplsLabel object
      Returns:
      ByteBuf
    • byteBufForMplsLabelWithBottomBit

      public static io.netty.buffer.ByteBuf byteBufForMplsLabelWithBottomBit(MplsLabel label)
      Serializes incoming MplsLabel with bottom bit.
      Parameters:
      label - MplsLabel object
      Returns:
      ByteBuf
    • intForMplsLabel

      public static int intForMplsLabel(MplsLabel label)
      Makes a value of incoming label 20 leftmost bits in 24bit number.
      Parameters:
      label - object
      Returns:
      shifted value
    • getBottomBit

      public static boolean getBottomBit(io.netty.buffer.ByteBuf slice)
      Gets Bottom Bit.
      Parameters:
      slice - with 20 leftmost bits as label
      Returns:
      value of bottom bit