Package org.pcap4j.packet
Class TcpPacket.TcpHeader
- java.lang.Object
-
- org.pcap4j.packet.AbstractPacket.AbstractHeader
-
- org.pcap4j.packet.TcpPacket.TcpHeader
-
- All Implemented Interfaces:
java.io.Serializable
,Packet.Header
,TransportPacket.TransportHeader
- Enclosing class:
- TcpPacket
public static final class TcpPacket.TcpHeader extends AbstractPacket.AbstractHeader implements TransportPacket.TransportHeader
- Since:
- pcap4j 0.9.12
- Author:
- Kaito Yamada
- See Also:
- Serialized Form
-
-
Method Summary
Modifier and Type Method Description protected java.lang.String
buildString()
This method builds the valuetoString()
will return.protected int
calcHashCode()
This method builds the valuehashCode()
will return using the byte arraygetRawData()
returns.protected int
calcLength()
This method calculates the valuelength()
will return by adding up the lengths of byte arrays in the listgetRawFields()
returns.boolean
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one using return values ofgetRawData()
.boolean
getAck()
int
getAcknowledgmentNumber()
long
getAcknowledgmentNumberAsLong()
short
getChecksum()
byte
getDataOffset()
int
getDataOffsetAsInt()
TcpPort
getDstPort()
boolean
getFin()
java.util.List<TcpPacket.TcpOption>
getOptions()
byte[]
getPadding()
boolean
getPsh()
protected java.util.List<byte[]>
getRawFields()
Returns a list of byte arrays which represents this header's fields.byte
getReserved()
boolean
getRst()
int
getSequenceNumber()
long
getSequenceNumberAsLong()
TcpPort
getSrcPort()
boolean
getSyn()
boolean
getUrg()
short
getUrgentPointer()
int
getUrgentPointerAsInt()
short
getWindow()
int
getWindowAsInt()
-
Methods inherited from class org.pcap4j.packet.AbstractPacket.AbstractHeader
buildHexString, buildRawData, getRawData, hashCode, length, toHexString, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.pcap4j.packet.Packet.Header
getRawData, length
-
-
-
-
Method Detail
-
getSrcPort
public TcpPort getSrcPort()
- Specified by:
getSrcPort
in interfaceTransportPacket.TransportHeader
- Returns:
- Source port
-
getDstPort
public TcpPort getDstPort()
- Specified by:
getDstPort
in interfaceTransportPacket.TransportHeader
- Returns:
- Destination port
-
getSequenceNumber
public int getSequenceNumber()
- Returns:
- sequenceNumber
-
getSequenceNumberAsLong
public long getSequenceNumberAsLong()
- Returns:
- sequenceNumber
-
getAcknowledgmentNumber
public int getAcknowledgmentNumber()
- Returns:
- acknowledgmentNumber
-
getAcknowledgmentNumberAsLong
public long getAcknowledgmentNumberAsLong()
- Returns:
- acknowledgmentNumber
-
getDataOffset
public byte getDataOffset()
- Returns:
- dataOffset
-
getDataOffsetAsInt
public int getDataOffsetAsInt()
- Returns:
- dataOffset
-
getReserved
public byte getReserved()
- Returns:
- reserved
-
getUrg
public boolean getUrg()
- Returns:
- urg
-
getAck
public boolean getAck()
- Returns:
- ack
-
getPsh
public boolean getPsh()
- Returns:
- psh
-
getRst
public boolean getRst()
- Returns:
- rst
-
getSyn
public boolean getSyn()
- Returns:
- syn
-
getFin
public boolean getFin()
- Returns:
- fin
-
getWindow
public short getWindow()
- Returns:
- window
-
getWindowAsInt
public int getWindowAsInt()
- Returns:
- window
-
getChecksum
public short getChecksum()
- Returns:
- checksum
-
getUrgentPointer
public short getUrgentPointer()
- Returns:
- urgentPointer
-
getUrgentPointerAsInt
public int getUrgentPointerAsInt()
- Returns:
- urgentPointer
-
getOptions
public java.util.List<TcpPacket.TcpOption> getOptions()
- Returns:
- options
-
getPadding
public byte[] getPadding()
- Returns:
- padding
-
getRawFields
protected java.util.List<byte[]> getRawFields()
Description copied from class:AbstractPacket.AbstractHeader
Returns a list of byte arrays which represents this header's fields. This method is called bycalcLength()
andbuildRawData()
.- Specified by:
getRawFields
in classAbstractPacket.AbstractHeader
- Returns:
- a list of byte arrays which represents this header's fields
-
calcLength
protected int calcLength()
Description copied from class:AbstractPacket.AbstractHeader
This method calculates the valuelength()
will return by adding up the lengths of byte arrays in the listgetRawFields()
returns.- Overrides:
calcLength
in classAbstractPacket.AbstractHeader
- Returns:
- a calculated length
-
buildString
protected java.lang.String buildString()
Description copied from class:AbstractPacket.AbstractHeader
This method builds the valuetoString()
will return.- Overrides:
buildString
in classAbstractPacket.AbstractHeader
- Returns:
- a string representation of this object
-
equals
public boolean equals(java.lang.Object obj)
Description copied from class:AbstractPacket.AbstractHeader
Indicates whether some other object is "equal to" this one using return values ofgetRawData()
. This method should be overridden so that it does more strict comparisons more efficiently.- Overrides:
equals
in classAbstractPacket.AbstractHeader
-
calcHashCode
protected int calcHashCode()
Description copied from class:AbstractPacket.AbstractHeader
This method builds the valuehashCode()
will return using the byte arraygetRawData()
returns. This method may be better to be overridden for performance reason.- Overrides:
calcHashCode
in classAbstractPacket.AbstractHeader
- Returns:
- a calculated hash code value for the object
-
-