|
SourceForge Jpcap | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jpcap.net.Packet
net.sourceforge.jpcap.net.EthernetPacket
net.sourceforge.jpcap.net.IP.Packet
public abstract static class IP.Packet
Base IP packet class.
Field Summary | |
---|---|
protected int |
_ipHeaderLength
Length of IP header). |
protected int |
_ipOffset
offset from beginning of byte array where IP header ends (i.e., size of ethernet frame header and IP header). |
Fields inherited from class net.sourceforge.jpcap.net.EthernetPacket |
---|
_byteBuffer, _bytes, _ethOffset, _timeval |
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 | |
---|---|
protected |
IP.Packet(int lLen,
byte[] bytes)
|
protected |
IP.Packet(int lLen,
byte[] bytes,
Timeval tv)
|
protected |
IP.Packet(int lLen,
ByteBuffer bb,
Timeval tv)
|
Method Summary | |
---|---|
String |
getColor()
Fetch ASCII escape sequence of the color associated with this packet type. |
byte[] |
getData()
Fetch the data portion of the packet. This is overridden in derived classes to return successively smaller and smaller amounts of data. For example:
|
abstract InetAddress |
getDestinationInetAddress()
Fetch the destination IP address. |
byte[] |
getHeader()
Fetch header portion of the packet. This is overridden in derived classes to return the header appropriate to the packet class. For example:
|
int |
getHeaderLength()
Return the length of the header. |
abstract byte[] |
getIPData()
Fetch the IP data as a byte array. |
abstract byte[] |
getIPHeader()
Fetch the IP header as a byte array. |
abstract int |
getIPHeaderLength()
Fetch the IP header length in bytes. |
abstract int |
getIPProtocol()
Fetch the code indicating the type of protocol embedded in the IP packet. |
abstract int |
getLength()
Fetch the IP payload length in bytes. |
abstract InetAddress |
getSourceInetAddress()
Fetch the source IP address. |
abstract int |
getVersion()
Get the IP version code. |
abstract void |
setDestinationInetAddress(InetAddress address)
Set the destination address. |
abstract void |
setSourceInetAddress(InetAddress address)
Set the source address. |
String |
toColoredString(boolean colored)
Generate string with contents describing this packet. |
abstract String |
toColoredVerboseString(boolean colored)
Convert this IP packet to a more verbose string. |
Methods inherited from class net.sourceforge.jpcap.net.EthernetPacket |
---|
equals, getDestinationHwAddress, getDestinationMACAddress, getEthernetCRC32, getEthernetData, getEthernetHeader, getEthernetHeaderLength, getEthernetProtocol, getPacketData, getPacketLength, getProtocol, getSourceHwAddress, getSourceMACAddress, getTimeval, hashCode, setChecksums, setDestinationMACAddress, setEthernetProtocol, setSourceMACAddress, toByteArray, toString |
Methods inherited from class net.sourceforge.jpcap.net.Packet |
---|
getChecksum, ipChecksum, isValidChecksum |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int _ipOffset
protected int _ipHeaderLength
Constructor Detail |
---|
protected IP.Packet(int lLen, byte[] bytes)
protected IP.Packet(int lLen, byte[] bytes, Timeval tv)
protected IP.Packet(int lLen, ByteBuffer bb, Timeval tv)
Method Detail |
---|
public abstract int getIPHeaderLength()
public abstract int getVersion()
public abstract int getIPProtocol()
IPProtocols
public abstract InetAddress getSourceInetAddress()
public abstract void setSourceInetAddress(InetAddress address)
address
- Source address.public abstract InetAddress getDestinationInetAddress()
public abstract void setDestinationInetAddress(InetAddress address)
address
- Destination address.public abstract byte[] getIPHeader()
public abstract byte[] getIPData()
public int getHeaderLength()
getHeaderLength
in class EthernetPacket
Packet.getHeader()
.Packet.getHeader()
public abstract int getLength()
public byte[] getHeader()
EthernetPacket.getHeader()
returns the Ethernet header
getHeader()
returns the IP header, which is in the Ethernet payload
TCPPacket.getHeader()
returns the TCP header, which is in the IP payload
getHeader
in class EthernetPacket
public byte[] getData()
EthernetPacket.getData()
returns the entire Ethernet payload excluding the Ethernet header
getData()
only returns the IP payload, i.e. excluding the IP header which is in the Ethernet payload
TCPPacket.getData()
only returns the TCP payload, i.e. excluding the TCP header which is in the IP payload
getData
in class EthernetPacket
public String toColoredString(boolean colored)
toColoredString
in class EthernetPacket
colored
- whether or not the string should contain ansi
color escape sequences.public abstract String toColoredVerboseString(boolean colored)
public String getColor()
getColor
in class EthernetPacket
|
Copyright © Patrick Charles & Jonas Lehmann, 2001; Esmond Pitt, 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |