|
|||||||||
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
An ethernet packet.
Contains link-level header and data payload encapsulated by an ethernet packet.
There are currently two subclasses. IP and ARP protocols are supported. IPPacket extends with ip header and data information. ARPPacket extends with hardware and protocol addresses.
Field Summary | |
protected byte[] |
_bytes
|
protected int |
_ethOffset
|
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 | |
EthernetPacket(int lLen,
byte[] bytes)
Construct a new ethernet packet. |
Method Summary | |
java.lang.String |
getColor()
Fetch ascii escape sequence of the color associated with this packet type. |
byte[] |
getData()
fetch the ethernet data as a byte array |
java.lang.String |
getDestinationHwAddress()
fetch the IP address of the host where the packet originated from |
byte[] |
getEthernetData()
fetch the ethernet data as a byte array |
byte[] |
getEthernetHeader()
fetch the ethernet header as a byte array |
int |
getEthernetHeaderLength()
fetch the ethernet header length in bytes |
int |
getEthernetProtocol()
fetches ethernet protocol |
byte[] |
getHeader()
fetch the ethernet header as a byte array |
int |
getHeaderLength()
fetch the packet ethernet header length |
int |
getProtocol()
fetches ethernet protocol |
java.lang.String |
getSourceHwAddress()
fetch the IP address of the host where the packet originated from |
java.lang.String |
toColoredString(boolean colored)
Generate string with contents describing this ethernet packet. |
java.lang.String |
toString()
Convert this ethernet packet to a readable string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected byte[] _bytes
protected int _ethOffset
Constructor Detail |
public EthernetPacket(int lLen, byte[] bytes)
For the purpose of jpcap, when the type of ethernet packet is recognized as a protocol for which a class exists network library, then a more specific class like IPPacket or ARPPacket is instantiated. The subclass can always be cast into a more generic form.
Method Detail |
public int getEthernetHeaderLength()
public int getHeaderLength()
public byte[] getEthernetHeader()
public byte[] getHeader()
getHeader
in class Packet
public byte[] getEthernetData()
public byte[] getData()
getData
in class Packet
public java.lang.String getSourceHwAddress()
public java.lang.String getDestinationHwAddress()
public int getEthernetProtocol()
public int getProtocol()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toColoredString(boolean colored)
toColoredString
in class Packet
colored
- whether or not the string should contain ansi
color escape sequences.public java.lang.String getColor()
getColor
in class Packet
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |