What is the format of an ARP packet?

The various fields of a ARP request/reply packet and their length are shown below:

    +--------+ 
    |Hardware| 2 bytes
    |MAC     |
    |Address |
    |Type    |
    +--------+
    |Protocol| 2 bytes
    |Address |
    |Type    |
    +--------+
    |Hardware| 1 byte
    |MAC     |
    |Address |
    |Size    |
    +--------+
    |Protocol| 1 byte
    |Address |
    |Size    |
    +--------+
    |Op      | 2 bytes
    +--------+ 
    |Sender  | 6 bytes (depends on the above size field)
    |MAC     |
    |Address |
    +--------+
    |Sender  | 4 bytes (depends on the above size field)
    |IP      |
    |Address |
    +--------+
    |Target  | 6 bytes (depends on the above size field)
    |MAC     |
    |Address |
    +--------+
    |Target  | 4 bytes (depends on the above size field)
    |IP      |
    |Address |
    +--------+

The fields are further explained below:

+---------+-------------------------------------------------------+
|Ethernet |For a ARP request, source MAC address is the MAC       |
|Header   |address of the host sending the ARP request,           |
|         |destination MAC address is the Ethernet broadcast      |
|         |address (FF:FF:FF:FF:FF:FF), frame type field is 0x806.|
|         |For ARP reply, source MAC address is the MAC address of|
|         |the host replying to the ARP request, destination MAC  |
|         |address is the MAC address of the host that sent the   |
|         |ARP request, and the frame type field is 0x806.        |
+---------+-------------------------------------------------------+
|Hardware |Type of the hardware MAC address which is being mapped.|
|Address  |For Ethernet the value of this field is 1.             |
|Type     |                                                       |
+---------+-------------------------------------------------------+
|Protocol |Type of the protocol address to which the MAC address  |
|Address  |is mapped.  For IP address the value of this field is  |
|Type     |0x800.                                                 |
+---------+-------------------------------------------------------+
|Hardware |Size of the hardware MAC address.  For Ethernet, the   |
|Address  |value of this field is 6.                              |
|Size     |                                                       |
+---------+-------------------------------------------------------+
|Protocol |Size of the protocol address.  For IP, the value of    |
|Address  |this field is 4.                                       |
|Size     |                                                       |
+---------+-------------------------------------------------------+
|Operation|Type of operation being performed.  The value of this  |
|         |field can be 1 (ARP request), 2 (ARP reply)            |
+---------+-------------------------------------------------------+
|Source   |The hardware MAC address of the host sending the ARP   |
|MAC      |request or reply.  This is same as the source MAC      |
|address  |address present in the Ethernet header.                |
+---------+-------------------------------------------------------+
|Source   |The IP address of the host sending the ARP request or  |
|IP       |reply.                                                 |
|address  |                                                       |
+---------+-------------------------------------------------------+
|Target   |The hardware MAC address of the host receiving the ARP |
|MAC      |request or reply.  This is same as the destination MAC |
|address  |address present in the Ethernet header.                |
+---------+-------------------------------------------------------+
|Target   |The IP address of the host receiving the ARP request   |
|IP       |or reply.                                              |
|address  |                                                       |
+---------+-------------------------------------------------------+

Contents