Package jpcap.packet
Class EthernetPacket
- java.lang.Object
-
- jpcap.packet.DatalinkPacket
-
- jpcap.packet.EthernetPacket
-
- All Implemented Interfaces:
java.io.Serializable
public class EthernetPacket extends DatalinkPacket
This class represents Ethernet packet.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description byte[]
dst_mac
Destination MAC address (6byte)static short
ETHERTYPE_ARP
Addr.static short
ETHERTYPE_IP
IP protocolstatic short
ETHERTYPE_IPV6
IPv6static short
ETHERTYPE_LOOPBACK
used to test interfacesstatic short
ETHERTYPE_PUP
PUP protocolstatic short
ETHERTYPE_REVARP
reverse Addr.static short
ETHERTYPE_VLAN
IEEE 802.1Q VLAN taggingshort
frametype
Frame typebyte[]
src_mac
Source MAC address (6byte)
-
Constructor Summary
Constructors Constructor Description EthernetPacket()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDestinationAddress()
Returns the MAC address of the destination.java.lang.String
getSourceAddress()
Returns the MAC address of the source.java.lang.String
toString()
Returns a string representation of this Ethernet packet.
Format: Fsrc_mac -> dst_mac (frametype)
-
-
-
Field Detail
-
dst_mac
public byte[] dst_mac
Destination MAC address (6byte)
-
src_mac
public byte[] src_mac
Source MAC address (6byte)
-
frametype
public short frametype
Frame type
-
ETHERTYPE_PUP
public static final short ETHERTYPE_PUP
PUP protocol- See Also:
- Constant Field Values
-
ETHERTYPE_IP
public static final short ETHERTYPE_IP
IP protocol- See Also:
- Constant Field Values
-
ETHERTYPE_ARP
public static final short ETHERTYPE_ARP
Addr. resolution protocol- See Also:
- Constant Field Values
-
ETHERTYPE_REVARP
public static final short ETHERTYPE_REVARP
reverse Addr. resolution protocol- See Also:
- Constant Field Values
-
ETHERTYPE_VLAN
public static final short ETHERTYPE_VLAN
IEEE 802.1Q VLAN tagging- See Also:
- Constant Field Values
-
ETHERTYPE_IPV6
public static final short ETHERTYPE_IPV6
IPv6- See Also:
- Constant Field Values
-
ETHERTYPE_LOOPBACK
public static final short ETHERTYPE_LOOPBACK
used to test interfaces- See Also:
- Constant Field Values
-
-
Method Detail
-
getSourceAddress
public java.lang.String getSourceAddress()
Returns the MAC address of the source.- Returns:
- MAC address of the source
-
getDestinationAddress
public java.lang.String getDestinationAddress()
Returns the MAC address of the destination.- Returns:
- MAC address of the destination
-
toString
public java.lang.String toString()
Returns a string representation of this Ethernet packet.
Format: Fsrc_mac -> dst_mac (frametype)- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this Ethernet packet
-
-