|
|||||||||
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.
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 | |
byte[] |
getData()
Fetch data portion of the ethernet header. |
java.lang.String |
getDestinationHwAddress()
Fetch the hardware address of the target host. |
byte[] |
getHeader()
Fetch the ethernet header, excluding data payload. |
int |
getProtocol()
Fetch the code stored in the ethernet type field which indicates the type of datagram embedded in this packet. |
java.lang.String |
getSourceHwAddress()
Fetch the hardware address from which the packet originated. |
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 |
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 byte[] getHeader()
getHeader
in class Packet
public byte[] getData()
getData
in class Packet
public java.lang.String getSourceHwAddress()
public java.lang.String getDestinationHwAddress()
public int getProtocol()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |