|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sourceforge.jpcap.net.Packet | +--net.sourceforge.jpcap.net.EthernetPacket | +--net.sourceforge.jpcap.net.IPPacket
An IP protocol packet.
Extends an ethernet packet, adding IP header information and an IP data payload.
Inner Class Summary | |
class |
IPPacket.TestProbe
inner class provides access to private methods for unit testing |
Field Summary | |
protected int |
_ipOffset
|
Fields inherited from class net.sourceforge.jpcap.net.EthernetPacket |
_bytes, _ethOffset |
Fields inherited from interface net.sourceforge.jpcap.net.IPFields |
IP_CODE_LEN, IP_CODE_POS, IP_CSUM_LEN, IP_CSUM_POS, IP_DST_POS, IP_FRAG_LEN, IP_FRAG_POS, IP_HEADER_LEN, IP_ID_LEN, IP_ID_POS, IP_LEN_LEN, IP_LEN_POS, IP_SRC_POS, IP_TOS_LEN, IP_TOS_POS, IP_TTL_LEN, IP_TTL_POS, IP_VER_LEN, IP_VER_POS |
Fields inherited from interface net.sourceforge.jpcap.net.EthernetFields |
ETH_CODE_LEN, ETH_CODE_POS, ETH_DST_POS, ETH_HEADER_LEN, ETH_SRC_POS |
Constructor Summary | |
IPPacket(int lLen,
byte[] bytes)
create a new IP packet |
Method Summary | |
protected int |
computeReceiverChecksum(int start,
int len)
|
protected int |
computeReceiverIPChecksum()
|
protected int |
computeSenderChecksum(int start,
int len,
int csumPos)
|
protected int |
computeSenderIPChecksum()
|
int |
getChecksum()
fetch the header checksum |
java.lang.String |
getColor()
Fetch ascii escape sequence of the color associated with this packet type. |
byte[] |
getData()
fetch the IP data as a byte array |
java.lang.String |
getDestinationAddress()
fetch the IP address of the host where the packet is destined |
long |
getDestinationAddressAsLong()
fetch the destination address as a long |
byte[] |
getDestinationAddressBytes()
fetch the destination address as a byte array |
int |
getFragmentFlags()
fetch fragmentation flags |
int |
getFragmentOffset()
fetch fragmentation offset |
byte[] |
getHeader()
fetch the IP header as a byte array |
int |
getHeaderLength()
fetch the packet IP header length |
int |
getId()
fetch the unique ID of this IP datagram. |
int |
getIPChecksum()
fetch the header checksum |
byte[] |
getIPData()
fetch the IP data as a byte array |
byte[] |
getIPHeader()
fetch the IP header a byte array |
int |
getIpHeaderLength()
fetch the IP header length in bytes |
int |
getIPHeaderLength()
fetch the IP header length in bytes |
int |
getIPProtocol()
fetch the code indicating the type of protocol embedded in the IP datagram. |
int |
getLength()
fetch the IP length in bytes |
int |
getProtocol()
fetch the code indicating the type of protocol embedded in the IP datagram. |
java.lang.String |
getSourceAddress()
fetch the IP address of the host where the packet originated from |
long |
getSourceAddressAsLong()
fetch the source address as a long |
byte[] |
getSourceAddressBytes()
fetch the source address as a byte array |
int |
getTimeToLive()
fetch the time to live. |
int |
getTypeOfService()
fetch the type of service. |
int |
getVersion()
get the IP version code. |
boolean |
isValidChecksum()
is the IP packet valid, checksum-wise |
boolean |
isValidIPChecksum()
is the IP packet valid, checksum-wise |
protected int |
onesCompSum(byte[] bytes,
int start,
int len)
|
java.lang.String |
toColoredString(boolean colored)
Generate string with contents describing this IP packet. |
java.lang.String |
toColoredVerboseString(boolean colored)
Convert this IP packet to a more verbose string. |
java.lang.String |
toString()
Convert this IP packet to a readable string. |
Methods inherited from class net.sourceforge.jpcap.net.EthernetPacket |
getDestinationHwAddress, getEthernetData, getEthernetHeader, getEthernetHeaderLength, getEthernetProtocol, getSourceHwAddress |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int _ipOffset
Constructor Detail |
public IPPacket(int lLen, byte[] bytes)
Method Detail |
public int getVersion()
public int getIPHeaderLength()
public int getIpHeaderLength()
public int getHeaderLength()
getHeaderLength
in class EthernetPacket
public int getTypeOfService()
public int getLength()
public int getId()
public int getFragmentFlags()
public int getFragmentOffset()
public int getTimeToLive()
public int getIPProtocol()
public int getProtocol()
getProtocol
in class EthernetPacket
public int getIPChecksum()
public int getChecksum()
public java.lang.String getSourceAddress()
public byte[] getSourceAddressBytes()
public long getSourceAddressAsLong()
public java.lang.String getDestinationAddress()
public byte[] getDestinationAddressBytes()
public long getDestinationAddressAsLong()
public byte[] getIPHeader()
public byte[] getHeader()
getHeader
in class EthernetPacket
public byte[] getIPData()
public byte[] getData()
getData
in class EthernetPacket
public boolean isValidChecksum()
public boolean isValidIPChecksum()
protected int computeReceiverIPChecksum()
protected int computeReceiverChecksum(int start, int len)
protected int computeSenderIPChecksum()
protected int computeSenderChecksum(int start, int len, int csumPos)
protected int onesCompSum(byte[] bytes, int start, int len)
public java.lang.String toString()
toString
in class EthernetPacket
public java.lang.String toColoredString(boolean colored)
toColoredString
in class EthernetPacket
colored
- whether or not the string should contain ansi
color escape sequences.public java.lang.String toColoredVerboseString(boolean colored)
public java.lang.String getColor()
getColor
in class EthernetPacket
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |