Package org.onlab.packet.bmp
Class Bmp
- java.lang.Object
-
- org.onlab.packet.BasePacket
-
- org.onlab.packet.bmp.Bmp
-
- All Implemented Interfaces:
IPacket
public class Bmp extends BasePacket
The following common header appears in all BMP messages. The rest of the data in a BMP message is dependent on the Message Type field in the common header.Version (1 byte): Indicates the BMP version. This is set to '3' for all messages defined in this specification. ('1' and '2' were used by draft versions of this document.) Version 0 is reserved and MUST NOT be sent.
Message Length (4 bytes): Length of the message in bytes (including headers, data, and encapsulated messages, if any).
Message Type (1 byte): This identifies the type of the BMP message. A BMP implementation MUST ignore unrecognized message types upon receipt.
Type = 0: Route Monitoring Type = 1: Statistics Report Type = 2: Peer Down Notification Type = 3: Peer Up Notification Type = 4: Initiation Message Type = 5: Termination Message Type = 6: Route Mirroring Message
-
-
Field Summary
Fields Modifier and Type Field Description static short
DEFAULT_HEADER_LENGTH
static int
DEFAULT_PACKET_MINIMUM_LENGTH
protected int
length
protected byte
type
protected byte
version
-
Fields inherited from class org.onlab.packet.BasePacket
parent, payload
-
-
Constructor Summary
Constructors Constructor Description Bmp()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Deserializer<Bmp>
deserializer()
Deserializer function for Bmp Packets.boolean
equals(Object obj)
int
getLength()
Returns message length.byte
getType()
Returns message type.byte
getVersion()
Returns message version.int
hashCode()
byte[]
serialize()
Sets all payloads parent packet if applicable, then serializes this packet and all payloads.void
setLength(int length)
Sets message length.void
setType(byte type)
Sets message type.void
setVersion(byte version)
Sets version field.String
toString()
-
Methods inherited from class org.onlab.packet.BasePacket
clone, getParent, getPayload, resetChecksum, setParent, setPayload
-
-
-
-
Field Detail
-
DEFAULT_HEADER_LENGTH
public static final short DEFAULT_HEADER_LENGTH
- See Also:
- Constant Field Values
-
DEFAULT_PACKET_MINIMUM_LENGTH
public static final int DEFAULT_PACKET_MINIMUM_LENGTH
- See Also:
- Constant Field Values
-
version
protected byte version
-
type
protected byte type
-
length
protected int length
-
-
Method Detail
-
setVersion
public void setVersion(byte version)
Sets version field.- Parameters:
version
- message version field
-
setType
public void setType(byte type)
Sets message type.- Parameters:
type
- message type
-
setLength
public void setLength(int length)
Sets message length.- Parameters:
length
- message length
-
getLength
public int getLength()
Returns message length.- Returns:
- message length
-
getVersion
public byte getVersion()
Returns message version.- Returns:
- message version
-
getType
public byte getType()
Returns message type.- Returns:
- message type
-
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
-
deserializer
public static Deserializer<Bmp> deserializer()
Deserializer function for Bmp Packets.- Returns:
- deserializer function
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classBasePacket
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classBasePacket
-
-