- java.lang.Object
-
- org.pcap4j.packet.AbstractPacket
-
- org.pcap4j.packet.Ssh2BinaryPacket
-
public final class Ssh2BinaryPacket extends AbstractPacket
- Since:
- pcap4j 1.0.1
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSsh2BinaryPacket.Builderstatic classSsh2BinaryPacket.Ssh2BinaryHeader-
Nested classes/interfaces inherited from class org.pcap4j.packet.AbstractPacket
AbstractPacket.AbstractBuilder, AbstractPacket.AbstractHeader
-
Nested classes/interfaces inherited from interface org.pcap4j.packet.Packet
Packet.Header
-
-
Field Summary
Fields Modifier and Type Field Description private Ssh2BinaryPacket.Ssh2BinaryHeaderheaderprivate byte[]macprivate Packetpayloadprivate byte[]randomPaddingprivate static longserialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description privateSsh2BinaryPacket(byte[] rawData, int offset, int length)privateSsh2BinaryPacket(Ssh2BinaryPacket.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]buildRawData()This method builds the valuegetRawData()will return by concatenating the header's raw data and the payload's raw data.protected java.lang.StringbuildString()This method builds the valuetoString()will return by concatenating the header's string representation and the payload's string representation.protected intcalcHashCode()This method calculates the valuehashCode()will return using the header's hash code and the payload's hash code.protected intcalcLength()This method calculates the valuelength()will return by adding up the header length and the payload length.booleanequals(java.lang.Object obj)Indicates whether some other object is "equal to" this one.Ssh2BinaryPacket.BuildergetBuilder()Returns a new Builder object populated with this object's fields' values.Ssh2BinaryPacket.Ssh2BinaryHeadergetHeader()Returns the Header object representing this packet's header.byte[]getMac()PacketgetPayload()Returns the Packet object representing this packet's payload.byte[]getRandomPadding()static Ssh2BinaryPacketnewPacket(byte[] rawData, int offset, int length)A static factory method.-
Methods inherited from class org.pcap4j.packet.AbstractPacket
buildHexString, contains, get, getOuterOf, getRawData, hashCode, iterator, length, toHexString, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
header
private final Ssh2BinaryPacket.Ssh2BinaryHeader header
-
payload
private final Packet payload
-
randomPadding
private final byte[] randomPadding
-
mac
private final byte[] mac
-
-
Constructor Detail
-
Ssh2BinaryPacket
private Ssh2BinaryPacket(byte[] rawData, int offset, int length) throws IllegalRawDataException- Throws:
IllegalRawDataException
-
Ssh2BinaryPacket
private Ssh2BinaryPacket(Ssh2BinaryPacket.Builder builder)
-
-
Method Detail
-
newPacket
public static Ssh2BinaryPacket newPacket(byte[] rawData, int offset, int length) throws IllegalRawDataException
A static factory method. This method validates the arguments byByteArrays.validateBounds(byte[], int, int), which may throw exceptions undocumented here.- Parameters:
rawData- rawDataoffset- offsetlength- length- Returns:
- a new Ssh2BinaryPacket object.
- Throws:
IllegalRawDataException- if parsing the raw data fails.
-
getHeader
public Ssh2BinaryPacket.Ssh2BinaryHeader getHeader()
Description copied from class:AbstractPacketReturns the Header object representing this packet's header. This subclass have to override this method if the packet represented by the subclass has a header.- Specified by:
getHeaderin interfacePacket- Overrides:
getHeaderin classAbstractPacket- Returns:
- the Header object representing this packet's header. May be null if the header doesn't exist
-
getPayload
public Packet getPayload()
Description copied from class:AbstractPacketReturns the Packet object representing this packet's payload. This subclass have to override this method if the packet represented by the subclass has a payload.- Specified by:
getPayloadin interfacePacket- Overrides:
getPayloadin classAbstractPacket- Returns:
- the Packet object representing this packet's payload. May be null if the payload doesn't exist
-
getRandomPadding
public byte[] getRandomPadding()
- Returns:
- randomPadding
-
getMac
public byte[] getMac()
- Returns:
- mac
-
calcLength
protected int calcLength()
Description copied from class:AbstractPacketThis method calculates the valuelength()will return by adding up the header length and the payload length. If you write this subclass which represents a packet with extra parts (e.g. a trailer), you need to override this method.- Overrides:
calcLengthin classAbstractPacket- Returns:
- a calculated length
-
buildRawData
protected byte[] buildRawData()
Description copied from class:AbstractPacketThis method builds the valuegetRawData()will return by concatenating the header's raw data and the payload's raw data. If you write this subclass which represents a packet with extra parts (e.g. a trailer), you need to override this method.- Overrides:
buildRawDatain classAbstractPacket- Returns:
- a raw data built
-
buildString
protected java.lang.String buildString()
Description copied from class:AbstractPacketThis method builds the valuetoString()will return by concatenating the header's string representation and the payload's string representation. If you write this subclass which represents a packet with extra parts (e.g. a trailer), you need to override this method.- Overrides:
buildStringin classAbstractPacket- Returns:
- a string representation of this object
-
getBuilder
public Ssh2BinaryPacket.Builder getBuilder()
Description copied from interface:PacketReturns a new Builder object populated with this object's fields' values.- Specified by:
getBuilderin interfacePacket- Specified by:
getBuilderin classAbstractPacket- Returns:
- a new Builder object populated with this object's fields values
-
equals
public boolean equals(java.lang.Object obj)
Description copied from class:AbstractPacketIndicates whether some other object is "equal to" this one. This method firstly compares this packet's header using the header's equals(Object) method, then compares this packet's payload using the payload's equals(Object) method. If you write this subclass with fields which represent somethings other than header or payload, you need to override this method.- Overrides:
equalsin classAbstractPacket
-
calcHashCode
protected int calcHashCode()
Description copied from class:AbstractPacketThis method calculates the valuehashCode()will return using the header's hash code and the payload's hash code. If you write this subclass which represents a packet with extra parts (e.g. a trailer), you need to override this method.- Overrides:
calcHashCodein classAbstractPacket- Returns:
- a calculated hash code value for the object
-
-