Package org.opendaylight.protocol.util
Class MplsLabelUtil
java.lang.Object
org.opendaylight.protocol.util.MplsLabelUtil
Util class for encoding/decoding 20bit leftmost value.
-
Method Summary
Modifier and TypeMethodDescriptionstatic io.netty.buffer.ByteBuf
byteBufForMplsLabel
(MplsLabel label) Serializes incoming MplsLabel without bottom bit.static io.netty.buffer.ByteBuf
Serializes incoming MplsLabel with bottom bit.static boolean
getBottomBit
(io.netty.buffer.ByteBuf slice) Gets Bottom Bit.static int
intForMplsLabel
(MplsLabel label) Makes a value of incoming label 20 leftmost bits in 24bit number.static MplsLabel
mplsLabelForByteBuf
(io.netty.buffer.ByteBuf buffer) Creates and returns MplsLabel object from 20 leftmost bits in the incoming buffer.
-
Method Details
-
mplsLabelForByteBuf
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
Serializes incoming MplsLabel without bottom bit.- Parameters:
label
- MplsLabel object- Returns:
- ByteBuf
-
byteBufForMplsLabelWithBottomBit
Serializes incoming MplsLabel with bottom bit.- Parameters:
label
- MplsLabel object- Returns:
- ByteBuf
-
intForMplsLabel
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
-