/* ARP protocol opcodes. */
#define ARPOP_REQUEST 1 /* ARP request. */
#define ARPOP_REPLY 2 /* ARP reply. */
#define ARPOP_RREQUEST 3 /* RARP request. */
#define ARPOP_RREPLY 4 /* RARP reply. */
#define ARPOP_InREQUEST 8 /* InARP request. */
#define ARPOP_InREPLY 9 /* InARP reply. */
#define ARPOP_NAK 10 /* (ATM)ARP NAK. */
struct arphdr //arp分组格式参考TCP/IP详解,rarp分组格式和rap基本一致,差别在帧类型上和操作代码
{
unsigned short int ar_hrd; /* Format of hardware address. */硬件类型:1表示以太网
unsigned short int ar_pro; /* Format of protocol address. */协议类型。
unsigned char ar_hln; /* Length of hardware address. */硬件地址长度
unsigned char ar_pln; /* Length of protocol address. */协议地址长度
unsigned short int ar_op; /* ARP opcode (command). */表示操作类型,见上面。
#if 0
/* Ethernet looks like this : This bit is variable sized
however... */
unsigned char __ar_sha[ETH_ALEN]; /* Sender hardware address. */发送端以太网地址
unsigned char __ar_sip[4]; /* Sender IP address. */发送端IP地址
unsigned char __ar_tha[ETH_ALEN]; /* Target hardware address. */目的以太网地址
unsigned char __ar_tip[4]; /* Target IP address. */目的IP地址
#endif
};//net/if_arp.h中
struct ether_arp {
struct arphdr ea_hdr; /* fixed-size header */
u_int8_t arp_sha[ETH_ALEN]; /* sender hardware address */
u_int8_t arp_spa[4]; /* sender protocol address */
u_int8_t arp_tha[ETH_ALEN]; /* target hardware address */
u_int8_t arp_tpa[4]; /* target protocol address */
};//在netinet/if_ether.h
#define ARPOP_REQUEST 1 /* ARP request. */
#define ARPOP_REPLY 2 /* ARP reply. */
#define ARPOP_RREQUEST 3 /* RARP request. */
#define ARPOP_RREPLY 4 /* RARP reply. */
#define ARPOP_InREQUEST 8 /* InARP request. */
#define ARPOP_InREPLY 9 /* InARP reply. */
#define ARPOP_NAK 10 /* (ATM)ARP NAK. */
struct arphdr //arp分组格式参考TCP/IP详解,rarp分组格式和rap基本一致,差别在帧类型上和操作代码
{
unsigned short int ar_hrd; /* Format of hardware address. */硬件类型:1表示以太网
unsigned short int ar_pro; /* Format of protocol address. */协议类型。
unsigned char ar_hln; /* Length of hardware address. */硬件地址长度
unsigned char ar_pln; /* Length of protocol address. */协议地址长度
unsigned short int ar_op; /* ARP opcode (command). */表示操作类型,见上面。
#if 0
/* Ethernet looks like this : This bit is variable sized
however... */
unsigned char __ar_sha[ETH_ALEN]; /* Sender hardware address. */发送端以太网地址
unsigned char __ar_sip[4]; /* Sender IP address. */发送端IP地址
unsigned char __ar_tha[ETH_ALEN]; /* Target hardware address. */目的以太网地址
unsigned char __ar_tip[4]; /* Target IP address. */目的IP地址
#endif
};//net/if_arp.h中
struct ether_arp {
struct arphdr ea_hdr; /* fixed-size header */
u_int8_t arp_sha[ETH_ALEN]; /* sender hardware address */
u_int8_t arp_spa[4]; /* sender protocol address */
u_int8_t arp_tha[ETH_ALEN]; /* target hardware address */
u_int8_t arp_tpa[4]; /* target protocol address */
};//在netinet/if_ether.h