- java.lang.Object
-
- org.pcap4j.packet.AbstractPacket
-
- org.pcap4j.packet.IpV4Packet
-
public final class IpV4Packet extends AbstractPacket implements IpPacket
- Since:
- pcap4j 0.9.1
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIpV4Packet.Builderstatic classIpV4Packet.IpV4Headerstatic interfaceIpV4Packet.IpV4OptionThe interface representing an IPv4 option.static interfaceIpV4Packet.IpV4TosThe interface representing an IPv4 TOS.-
Nested classes/interfaces inherited from class org.pcap4j.packet.AbstractPacket
AbstractPacket.AbstractBuilder, AbstractPacket.AbstractHeader
-
Nested classes/interfaces inherited from interface org.pcap4j.packet.IpPacket
IpPacket.IpHeader
-
Nested classes/interfaces inherited from interface org.pcap4j.packet.Packet
Packet.Header
-
-
Field Summary
Fields Modifier and Type Field Description private IpV4Packet.IpV4Headerheaderprivate static org.slf4j.Loggerloggerprivate Packetpayloadprivate static longserialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description privateIpV4Packet(byte[] rawData, int offset, int length)privateIpV4Packet(IpV4Packet.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IpV4Packet.BuildergetBuilder()Returns a new Builder object populated with this object's fields' values.IpV4Packet.IpV4HeadergetHeader()Returns the Header object representing this packet's header.PacketgetPayload()Returns the Packet object representing this packet's payload.static IpV4PacketnewPacket(byte[] rawData, int offset, int length)A static factory method.-
Methods inherited from class org.pcap4j.packet.AbstractPacket
buildHexString, buildRawData, buildString, calcHashCode, calcLength, contains, equals, get, getOuterOf, getRawData, hashCode, iterator, 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
contains, get, getOuterOf, getRawData, length
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
logger
private static final org.slf4j.Logger logger
-
header
private final IpV4Packet.IpV4Header header
-
payload
private final Packet payload
-
-
Constructor Detail
-
IpV4Packet
private IpV4Packet(byte[] rawData, int offset, int length) throws IllegalRawDataException- Throws:
IllegalRawDataException
-
IpV4Packet
private IpV4Packet(IpV4Packet.Builder builder)
-
-
Method Detail
-
newPacket
public static IpV4Packet 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 IpV4Packet object.
- Throws:
IllegalRawDataException- if parsing the raw data fails.
-
getHeader
public IpV4Packet.IpV4Header 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.
-
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
-
getBuilder
public IpV4Packet.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
-
-