|
|||||||||
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 information in 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.
Constructor Summary | |
EthernetPacket(int lLen,
byte[] bytes,
java.lang.String macSourceAddress,
java.lang.String macDestinationAddress)
Construct a new, unrecognized ethernet packet. |
|
EthernetPacket(int lLen,
byte[] bytes,
java.lang.String macSourceAddress,
java.lang.String macDestinationAddress,
int typeCode)
Construct a new, recognized ethernet packet. |
Method Summary | |
byte[] |
getData()
Fetch data portion of the ethernet header. |
java.lang.String |
getDestinationHwAddress()
|
byte[] |
getHeader()
Fetch the ethernet header, excluding data payload. |
java.lang.String |
getSourceHwAddress()
|
int |
getType()
Fetch the code stored in the ethernet type field which indicates the type of datagram embedded in 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 |
Constructor Detail |
public EthernetPacket(int lLen, byte[] bytes, java.lang.String macSourceAddress, java.lang.String macDestinationAddress)
If the ethernet packet type is not recognized, the ethernet type field is populated with 'unknown'.
public EthernetPacket(int lLen, byte[] bytes, java.lang.String macSourceAddress, java.lang.String macDestinationAddress, int typeCode)
When the type of the ethernet packet is known, it can be subclassified into a deriving class like IPPacket. The subclass then sets the ethernet type code to the appropriate and corresponding value.
Method Detail |
public byte[] getHeader()
public byte[] getData()
public java.lang.String getSourceHwAddress()
public java.lang.String getDestinationHwAddress()
public int getType()
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 |