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 byte
bos
static int
HEADER_LENGTH
protected int
label
protected byte
protocol
static byte
PROTOCOL_IPV4
static byte
PROTOCOL_MPLS
protected byte
ttl
-
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.int
getLabel()
Returns the MPLS label.byte
getTtl()
Returns the MPLS TTL of the packet.byte[]
serialize()
Sets all payloads parent packet if applicable, then serializes this packet and all payloads.void
setLabel(int label)
Sets the MPLS label.void
setTtl(byte ttl)
Sets the MPLS TTL of the packet.java.lang.String
toString()
-
Methods inherited from class org.onlab.packet.BasePacket
clone, equals, getParent, getPayload, hashCode, resetChecksum, setParent, setPayload
-
-
-
-
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_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:IPacket
Sets 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
-
deserializer
public static Deserializer<MPLS> deserializer()
Deserializer function for MPLS packets.- Returns:
- deserializer function
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-