Modifier and Type | Field and Description |
---|---|
protected boolean |
corrupted |
protected Map<String,org.apache.commons.lang3.tuple.Pair<Integer,Integer>> |
hdrFieldCoordMap |
protected Map<String,byte[]> |
hdrFieldsMap |
protected static org.slf4j.Logger |
LOG |
protected Packet |
parent |
protected Packet |
payload |
protected Class<? extends Packet> |
payloadClass |
protected byte[] |
rawPayload |
protected boolean |
writeAccess |
Modifier and Type | Method and Description |
---|---|
Packet |
deserialize(byte[] data,
int bitOffset,
int size)
This method deserializes the data bits obtained from the wire into the
respective header and payload which are of type Packet
|
boolean |
equals(Object obj) |
int |
getfieldnumBits(String fieldName)
This method fetches the number of bits for header field specified by
'fieldname'.
|
int |
getfieldOffset(String fieldName)
This method fetches the start bit offset for header field specified by
'fieldname'.
|
int |
getHeaderSize()
Gets the header length in bits
|
Packet |
getParent() |
Packet |
getPayload() |
byte[] |
getRawPayload()
Returns the raw payload carried by this packet in case payload was not
parsed.
|
int |
hashCode() |
boolean |
isCorrupted()
Return whether the deserialized packet is to be considered corrupted.
|
protected void |
postDeserializeCustomOperation(byte[] data,
int startBitOffset)
This method re-computes the checksum of the bits received on the wire and
validates it with the checksum in the bits received Since the computation
of checksum varies based on the protocol, this method is overridden.
|
protected void |
postSerializeCustomOperation(byte[] myBytes)
This method gets called at the end of the serialization process It is
intended for the child packets to insert some custom data into the output
byte stream which cannot be done or cannot be done efficiently during the
normal Packet.serialize() path.
|
byte[] |
serialize()
This method serializes the header and payload from the respective
packet class, into a single stream of bytes to be sent on the wire
|
void |
setHeaderField(String headerField,
byte[] readValue) |
void |
setParent(Packet parent) |
void |
setPayload(Packet payload) |
void |
setRawPayload(byte[] payload)
Set a raw payload in the packet class
|
String |
toString() |
protected static final org.slf4j.Logger LOG
protected boolean writeAccess
protected boolean corrupted
protected Packet parent
protected Packet payload
protected byte[] rawPayload
protected Map<String,org.apache.commons.lang3.tuple.Pair<Integer,Integer>> hdrFieldCoordMap
public Packet getParent()
public Packet getPayload()
public void setParent(Packet parent)
public void setPayload(Packet payload)
public void setHeaderField(String headerField, byte[] readValue)
public Packet deserialize(byte[] data, int bitOffset, int size) throws PacketException
data
- - data from wire to deserializebitOffset
- bit position where packet header starts in data
arraysize
- size of packet in bitsPacketException
public byte[] serialize() throws PacketException
PacketException
protected void postSerializeCustomOperation(byte[] myBytes) throws PacketException
myBytes
- serialized bytesPacketException
protected void postDeserializeCustomOperation(byte[] data, int startBitOffset) throws PacketException
data
- The byte stream representing the Ethernet framestartBitOffset
- The bit offset from where the byte array corresponding to this Packet starts in the framePacketException
public int getHeaderSize()
public int getfieldOffset(String fieldName)
public int getfieldnumBits(String fieldName)
public byte[] getRawPayload()
public void setRawPayload(byte[] payload)
payload
- The raw payload as byte arraypublic boolean isCorrupted()
Copyright © 2019 OpenDaylight. All rights reserved.