Package org.onlab.packet
Class MPLS
- java.lang.Object
-
- org.onlab.packet.BasePacket
-
- org.onlab.packet.MPLS
-
- All Implemented Interfaces:
IPacket
public class MPLS extends BasePacket
Representation of an MPLS Packet.
-
-
Field Summary
Fields Modifier and Type Field Description protected bytebosstatic intHEADER_LENGTHprotected intlabelprotected byteprotocolstatic bytePROTOCOL_IPV4static bytePROTOCOL_IPV6static bytePROTOCOL_MPLSprotected bytettl-
Fields inherited from class org.onlab.packet.BasePacket
parent, payload
-
-
Constructor Summary
Constructors Constructor Description MPLS()Default constructor that sets the version to 4.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Deserializer<MPLS>deserializer()Deserializer function for MPLS packets.intgetLabel()Returns the MPLS label.bytegetTtl()Returns the MPLS TTL of the packet.byte[]serialize()Sets all payloads parent packet if applicable, then serializes this packet and all payloads.voidsetLabel(int label)Sets the MPLS label.IPacketsetPayload(IPacket payload)Assign the packet payload.voidsetTtl(byte ttl)Sets the MPLS TTL of the packet.java.lang.StringtoString()-
Methods inherited from class org.onlab.packet.BasePacket
clone, equals, getParent, getPayload, hashCode, resetChecksum, setParent
-
-
-
-
Field Detail
-
HEADER_LENGTH
public static final int HEADER_LENGTH
- See Also:
- Constant Field Values
-
PROTOCOL_IPV4
public static final byte PROTOCOL_IPV4
- See Also:
- Constant Field Values
-
PROTOCOL_IPV6
public static final byte PROTOCOL_IPV6
- See Also:
- Constant Field Values
-
PROTOCOL_MPLS
public static final byte PROTOCOL_MPLS
- See Also:
- Constant Field Values
-
label
protected int label
-
bos
protected byte bos
-
ttl
protected byte ttl
-
protocol
protected byte protocol
-
-
Method Detail
-
serialize
public byte[] serialize()
Description copied from interface:IPacketSets all payloads parent packet if applicable, then serializes this packet and all payloads.- Returns:
- a byte[] containing this packet and payloads
-
getLabel
public int getLabel()
Returns the MPLS label.- Returns:
- MPLS label
-
setLabel
public void setLabel(int label)
Sets the MPLS label.- Parameters:
label- MPLS label
-
getTtl
public byte getTtl()
Returns the MPLS TTL of the packet.- Returns:
- MPLS TTL of the packet
-
setTtl
public void setTtl(byte ttl)
Sets the MPLS TTL of the packet.- Parameters:
ttl- MPLS TTL
-
setPayload
public IPacket setPayload(IPacket payload)
Description copied from interface:IPacketAssign the packet payload.- Specified by:
setPayloadin interfaceIPacket- Overrides:
setPayloadin classBasePacket- Parameters:
payload- new payload- Returns:
- self
-
deserializer
public static Deserializer<MPLS> deserializer()
Deserializer function for MPLS packets.- Returns:
- deserializer function
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-