[NS2] ARP in NS2

/* ======================================================================
Address Resolution (ARP) Header
====================================================================== */
#define ARPHRD_ETHER 1 /* ethernet hardware format */

#define ARPOP_REQUEST 1 /* request to resolve address */
#define ARPOP_REPLY 2 /* response to previous request */
#define ARPOP_REVREQUEST 3 /* request protocol address */
#define ARPOP_REVREPLY 4 /* response giving protocol address */
#define ARPOP_INVREQUEST 8 /* request to identify peer */
#define ARPOP_INVREPLY 9 /* response identifying peer */

#define ARP_HDR_LEN 28

struct hdr_arp {
u_int16_t arp_hrd;
u_int16_t arp_pro;
u_int8_t arp_hln;
u_int8_t arp_pln;
u_int16_t arp_op;
int arp_sha;
u_int16_t pad1; // so offsets are correct
nsaddr_t arp_spa;
int arp_tha;
u_int16_t pad2; // so offsets are correct
nsaddr_t arp_tpa;

// Header access methods
static int offset_; // required by PacketHeaderManager
inline static int& offset() { return offset_; }
inline static hdr_arp* access(const Packet* p) {
return (hdr_arp*) p->access(offset_);
}
};

-------------------------------------------------------------------------
About nsaddr_t:
It is the typedef of int32_t as following:

typedef
int32_t nsaddr_t;

Reference:
http://www.auto-nomos.de/ns2doku/config_8h-source.html