public interface IPv4Packet extends IPPacket
| Modifier and Type | Method and Description |
|---|---|
IPv4Packet |
clone() |
short |
getDSCP() |
short |
getECN() |
short |
getFragmentOffset()
The fragment offset field, measured in units of eight-byte blocks, is 13
bits long and specifies the offset of a particular fragment relative to
the beginning of the original unfragmented IP datagram.
|
int |
getIpChecksum()
The checksum of the IP-packet.
|
int |
getTimeToLive() |
boolean |
isDontFragmentSet()
The DF flag is part of the three-bit flag field and those flags are: (in
order, from high order to low order):
|
boolean |
isFragmented() |
boolean |
isMoreFragmentsSet()
The MF flag is part of the three-bit flag field and those flags are: (in
order, from high order to low order):
|
boolean |
isReservedFlagSet()
The Reserved flag is part of the three-bit flag field and those flags
are: (in order, from high order to low order):
|
void |
reCalculateChecksum()
After you change anything in an IP packet (apart from the payload) you
should re-calculate the checksum.
|
void |
setDestinationIP(byte a,
byte b,
byte c,
byte d) |
void |
setDestinationIP(int a,
int b,
int c,
int d)
Setting an IPv4 address the fast way! Specify each part separately.
|
void |
setDestinationIP(String destinationIP)
Set the destination IP of this
IPv4Packet. |
void |
setSourceIP(byte a,
byte b,
byte c,
byte d)
Setting an IPv4 address the fast(est?) way! Specify each part separately.
|
void |
setSourceIP(int a,
int b,
int c,
int d)
Setting an IPv4 address the fast way! Specify each part separately.
|
void |
setSourceIP(String sourceIp)
Set the source IP of this
IPv4Packet. |
boolean |
verifyIpChecksum() |
getDestinationIP, getHeaderLength, getIdentification, getRawDestinationIP, getRawSourceIP, getSourceIP, getTotalIPLength, getVersiongetArrivalTime, getName, getNextPacket, getPacket, getParentPacket, getPayload, getProtocol, hasProtocol, verify, write, writevoid setSourceIP(int a,
int b,
int c,
int d)
#setSourceIP(192, 168, 0, 100)a - the first part of the IPv4 address, e.g. 192b - the second part of the IPv4 address, e.g. 168c - the third part of the IPv4 address, e.g. 0d - the fourth part of the IPv4 address, e.g. 100void setSourceIP(byte a,
byte b,
byte c,
byte d)
rawIp - void setSourceIP(String sourceIp)
IPv4Packet. Note, using
setSourceIP(int, int, int, int) will be must faster so try and
use it instead.setSourceIP in interface IPPacketsourceIp - void setDestinationIP(int a,
int b,
int c,
int d)
#setSourceIP(192, 168, 0, 100)a - the first part of the IPv4 address, e.g. 192b - the second part of the IPv4 address, e.g. 168c - the third part of the IPv4 address, e.g. 0d - the fourth part of the IPv4 address, e.g. 100void setDestinationIP(byte a,
byte b,
byte c,
byte d)
void setDestinationIP(String destinationIP)
IPv4Packet. Note, using
setDestinationIP(int, int, int, int) will be must faster so try
and use it instead.setDestinationIP in interface IPPacketsourceIp - int getIpChecksum()
void reCalculateChecksum()
boolean verifyIpChecksum()
int getTimeToLive()
short getDSCP()
short getECN()
IPv4Packet clone()
boolean isFragmented()
isFragmented in interface IPPacketboolean isReservedFlagSet()
bit 0: Reserved; must be zero. bit 1: Don't Fragment (DF) bit 2: More Fragments (MF)(source http://en.wikipedia.org/wiki/IPv4)
boolean isDontFragmentSet()
bit 0: Reserved; must be zero. bit 1: Don't Fragment (DF) bit 2: More Fragments (MF)If the DF flag is set, and fragmentation is required to route the packet, then the packet is dropped. This can be used when sending packets to a host that does not have sufficient resources to handle fragmentation. It can also be used for Path MTU Discovery, either automatically by the host IP software, or manually using diagnostic tools such as ping or traceroute. For unfragmented packets, the MF flag is cleared. For fragmented packets, all fragments except the last have the MF flag set. The last fragment has a non-zero Fragment Offset field, differentiating it from an unfragmented packet. (source http://en.wikipedia.org/wiki/IPv4)
boolean isMoreFragmentsSet()
bit 0: Reserved; must be zero. bit 1: Don't Fragment (DF) bit 2: More Fragments (MF)If the DF flag is set, and fragmentation is required to route the packet, then the packet is dropped. This can be used when sending packets to a host that does not have sufficient resources to handle fragmentation. It can also be used for Path MTU Discovery, either automatically by the host IP software, or manually using diagnostic tools such as ping or traceroute. For unfragmented packets, the MF flag is cleared. For fragmented packets, all fragments except the last have the MF flag set. The last fragment has a non-zero Fragment Offset field, differentiating it from an unfragmented packet. (source http://en.wikipedia.org/wiki/IPv4)
short getFragmentOffset()
getFragmentOffset in interface IPPacketCopyright © 2021. All Rights Reserved.