Class Ethernet


  • public class Ethernet
    extends Packet
    Class that represents the Ethernet frame objects.
    • Constructor Detail

      • Ethernet

        public Ethernet()
        Default constructor that creates and sets the HashMap.
      • Ethernet

        public Ethernet​(boolean writeAccess)
        Constructor that sets the access level for the packet and creates and sets the HashMap.
    • Method Detail

      • setHeaderField

        public void setHeaderField​(String headerField,
                                   byte[] readValue)
        Overrides:
        setHeaderField in class Packet
      • getDestinationMACAddress

        public byte[] getDestinationMACAddress()
        Gets the destination MAC address stored.
        Returns:
        byte[] - the destinationMACAddress
      • getSourceMACAddress

        public byte[] getSourceMACAddress()
        Gets the source MAC address stored.
        Returns:
        byte[] - the sourceMACAddress
      • getEtherType

        public short getEtherType()
        Gets the etherType stored.
        Returns:
        short - the etherType
      • isBroadcast

        public boolean isBroadcast()
      • isMulticast

        public boolean isMulticast()
      • setDestinationMACAddress

        public Ethernet setDestinationMACAddress​(byte[] destinationMACAddress)
        Sets the destination MAC address for the current Ethernet object instance.
        Parameters:
        destinationMACAddress - the destinationMACAddress to set
      • setSourceMACAddress

        public Ethernet setSourceMACAddress​(byte[] sourceMACAddress)
        Sets the source MAC address for the current Ethernet object instance.
        Parameters:
        sourceMACAddress - the sourceMACAddress to set
      • setEtherType

        public Ethernet setEtherType​(short etherType)
        Sets the etherType for the current Ethernet object instance.
        Parameters:
        etherType - the etherType to set