net.sourceforge.jpcap.net
Class ARPPacket

java.lang.Object
  extended bynet.sourceforge.jpcap.net.Packet
      extended bynet.sourceforge.jpcap.net.EthernetPacket
          extended bynet.sourceforge.jpcap.net.ARPPacket
All Implemented Interfaces:
ARPFields, EthernetFields, java.io.Serializable

public class ARPPacket
extends EthernetPacket
implements ARPFields, java.io.Serializable

An ARP protocol packet.

Extends an ethernet packet, adding ARP header information and an ARP data payload.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sourceforge.jpcap.net.EthernetPacket
_bytes, _ethOffset
 
Fields inherited from interface net.sourceforge.jpcap.net.ARPFields
ARP_ADDR_SIZE_LEN, ARP_ADDR_TYPE_LEN, ARP_ETH_ADDR_CODE, ARP_HEADER_LEN, ARP_HW_LEN_POS, ARP_HW_TYPE_POS, ARP_IP_ADDR_CODE, ARP_OP_LEN, ARP_OP_POS, ARP_OP_REP_CODE, ARP_OP_REQ_CODE, ARP_PR_LEN_POS, ARP_PR_TYPE_POS, ARP_S_HW_ADDR_POS, ARP_S_PR_ADDR_POS, ARP_T_HW_ADDR_POS, ARP_T_PR_ADDR_POS
 
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
ARPPacket(int lLen, byte[] bytes)
          Create a new ARP packet.
 
Method Summary
 byte[] getARPData()
          Fetch data portion of the arp header.
 byte[] getARPHeader()
          Fetch the arp header, excluding arp data payload.
 java.lang.String getColor()
          Fetch ascii escape sequence of the color associated with this packet type.
 byte[] getData()
          Fetch data portion of the arp header.
 java.lang.String getDestinationHwAddress()
          Fetch the hardware destination address.
 java.lang.String getDestinationProtoAddress()
          Fetch the proto sender address.
 byte[] getHeader()
          Fetch the arp header, excluding arp data payload.
 int getOperation()
          Fetch the operation code.
 java.lang.String getSourceHwAddress()
          Fetch the hardware source address.
 java.lang.String getSourceProtoAddress()
          Fetch the proto sender address.
 java.lang.String toColoredString(boolean colored)
          Generate string with contents describing this ARP packet.
 java.lang.String toString()
          Convert this ARP packet to a readable string.
 
Methods inherited from class net.sourceforge.jpcap.net.EthernetPacket
getEthernetData, getEthernetHeader, getEthernetHeaderLength, getEthernetProtocol, getHeaderLength, getProtocol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ARPPacket

public ARPPacket(int lLen,
                 byte[] bytes)
Create a new ARP packet.

Method Detail

getSourceHwAddress

public java.lang.String getSourceHwAddress()
Fetch the hardware source address.

Overrides:
getSourceHwAddress in class EthernetPacket

getDestinationHwAddress

public java.lang.String getDestinationHwAddress()
Fetch the hardware destination address.

Overrides:
getDestinationHwAddress in class EthernetPacket

getSourceProtoAddress

public java.lang.String getSourceProtoAddress()
Fetch the proto sender address.


getDestinationProtoAddress

public java.lang.String getDestinationProtoAddress()
Fetch the proto sender address.


getOperation

public int getOperation()
Fetch the operation code. Usually one of ARPFields.{ARP_OP_REQ_CODE, ARP_OP_REP_CODE}.


getARPHeader

public byte[] getARPHeader()
Fetch the arp header, excluding arp data payload.


getARPData

public byte[] getARPData()
Fetch data portion of the arp header.


getHeader

public byte[] getHeader()
Fetch the arp header, excluding arp data payload.

Overrides:
getHeader in class EthernetPacket

getData

public byte[] getData()
Fetch data portion of the arp header.

Overrides:
getData in class EthernetPacket

toString

public java.lang.String toString()
Convert this ARP packet to a readable string.

Overrides:
toString in class EthernetPacket

toColoredString

public java.lang.String toColoredString(boolean colored)
Generate string with contents describing this ARP packet.

Overrides:
toColoredString in class EthernetPacket
Parameters:
colored - whether or not the string should contain ansi color escape sequences.

getColor

public java.lang.String getColor()
Fetch ascii escape sequence of the color associated with this packet type.

Overrides:
getColor in class EthernetPacket