public abstract class AbstractSegment extends BasePacket
Modifier and Type | Field and Description |
---|---|
protected short |
checksum |
protected short |
destinationPort |
protected short |
sourcePort |
parent, payload
Constructor and Description |
---|
AbstractSegment() |
Modifier and Type | Method and Description |
---|---|
IPacket |
deserialize(byte[] data,
int offset,
int length)
Deserializes this packet layer and all possible payloads.
|
short |
getChecksum()
Gets the checksum
|
short |
getDestinationPort()
Gets the destination port
|
short |
getSourcePort()
Gets the source port
|
int |
hashCode(int prime)
Method for subclass hashCode() to piggyback onto
|
void |
resetChecksum()
Reset any checksums as needed, and call resetChecksum on all parents.
|
void |
serialize(ByteBuffer bb,
int length)
Serialization method that calculates the checksum from pseudo- header.
|
AbstractSegment |
setChecksum(short checksum)
Sets the checksum
|
AbstractSegment |
setDestinationPort(short destinationPort)
Sets the destination port
|
AbstractSegment |
setSourcePort(short sourcePort)
Sets the source port
|
clone, equals, getParent, getPayload, hashCode, setParent, setPayload
protected short sourcePort
protected short destinationPort
protected short checksum
public short getSourcePort()
public AbstractSegment setSourcePort(short sourcePort)
sourcePort
- the sourcePort to setpublic short getDestinationPort()
public AbstractSegment setDestinationPort(short destinationPort)
destinationPort
- the destinationPort to setpublic short getChecksum()
public AbstractSegment setChecksum(short checksum)
checksum
- the checksum to setpublic void resetChecksum()
IPacket
resetChecksum
in interface IPacket
resetChecksum
in class BasePacket
public void serialize(ByteBuffer bb, int length)
bb
- The ByteBuffer for the data being serializedl4type
- The protocol typelength
- length of segmentpublic IPacket deserialize(byte[] data, int offset, int length)
IPacket
offset
- offset to start deserializing fromlength
- length of the data to deserializepublic int hashCode(int prime)
Copyright © 2015. All rights reserved.