Class TcpPacket
java.lang.Object
org.pcap4j.packet.AbstractPacket
org.pcap4j.packet.TcpPacket
- All Implemented Interfaces:
Serializable, Iterable<Packet>, Packet, TransportPacket
- Since:
- pcap4j 0.9.12
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classstatic interfaceThe interface representing a TCP option.Nested classes/interfaces inherited from class AbstractPacket
AbstractPacket.AbstractBuilder, AbstractPacket.AbstractHeaderNested classes/interfaces inherited from interface Packet
Packet.HeaderNested classes/interfaces inherited from interface TransportPacket
TransportPacket.TransportHeader -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TcpPacket.TcpHeaderprivate final Packetprivate static final long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTcpPacket(byte[] rawData, int offset, int length) privateTcpPacket(TcpPacket.Builder builder) -
Method Summary
Modifier and TypeMethodDescriptionReturns a new Builder object populated with this object's fields' values.Returns the Header object representing this packet's header.Returns the Packet object representing this packet's payload.booleanhasValidChecksum(InetAddress srcAddr, InetAddress dstAddr, boolean acceptZero) checksum verification is necessary for IPv6(i.e.static TcpPacketnewPacket(byte[] rawData, int offset, int length) A static factory method.Methods inherited from class AbstractPacket
buildHexString, buildRawData, buildString, calcHashCode, calcLength, contains, equals, get, getOuterOf, getRawData, hashCode, iterator, length, toHexString, toStringMethods inherited from interface Iterable
forEach, iterator, spliteratorMethods inherited from interface Packet
contains, get, getOuterOf, getRawData, length
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
header
-
payload
-
-
Constructor Details
-
TcpPacket
- Throws:
IllegalRawDataException
-
TcpPacket
-
-
Method Details
-
newPacket
public static TcpPacket 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 TcpPacket object.
- Throws:
IllegalRawDataException- if parsing the raw data fails.
-
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- Specified by:
getHeaderin interfaceTransportPacket- Overrides:
getHeaderin classAbstractPacket- Returns:
- the Header object representing this packet's header. May be null if the header doesn't exist
-
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
-
hasValidChecksum
checksum verification is necessary for IPv6(i.e. acceptZero must be false)- Parameters:
srcAddr- srcAddrdstAddr- dstAddracceptZero- acceptZero- Returns:
- true if the packet represented by this object has a valid checksum; false otherwise.
-
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
-