ARP_t
来源:互联网 发布:福建水利预算软件 编辑:程序博客网 时间:2024/05/23 11:52
/*
* Address Resolution Protocol (ARP) header.
*/
typedef struct
{
ushort ar_hrd; //目标类型
# define ARP_ETHER 1 /* Ethernet hardware address */
ushort ar_pro; //协议地址格式
uchar ar_hln; //mac地址长度
uchar ar_pln; //协议地址长度
ushort ar_op; //操作类型
# define ARPOP_REQUEST 1 /* Request to resolve address */
# define ARPOP_REPLY 2 /* Response to previous request */
# define RARPOP_REQUEST 3 /* Request to resolve address */
# define RARPOP_REPLY 4 /* Response to previous request */
/*
* The remaining fields are variable in size, according to
* the sizes above, and are defined as appropriate for
* specific hardware/protocol combinations.
*/
uchar ar_data[0];
#if 0
uchar ar_sha[]; /* Sender hardware address */
uchar ar_spa[]; /* Sender protocol address */
uchar ar_tha[]; /* Target hardware address */
uchar ar_tpa[]; /* Target protocol address */
#endif /* 0 */
} ARP_t;
#define ARP_HDR_SIZE (8+20) /* Size assuming ethernet */
* Address Resolution Protocol (ARP) header.
*/
typedef struct
{
ushort ar_hrd; //目标类型
# define ARP_ETHER 1 /* Ethernet hardware address */
ushort ar_pro; //协议地址格式
uchar ar_hln; //mac地址长度
uchar ar_pln; //协议地址长度
ushort ar_op; //操作类型
# define ARPOP_REQUEST 1 /* Request to resolve address */
# define ARPOP_REPLY 2 /* Response to previous request */
# define RARPOP_REQUEST 3 /* Request to resolve address */
# define RARPOP_REPLY 4 /* Response to previous request */
/*
* The remaining fields are variable in size, according to
* the sizes above, and are defined as appropriate for
* specific hardware/protocol combinations.
*/
uchar ar_data[0];
#if 0
uchar ar_sha[]; /* Sender hardware address */
uchar ar_spa[]; /* Sender protocol address */
uchar ar_tha[]; /* Target hardware address */
uchar ar_tpa[]; /* Target protocol address */
#endif /* 0 */
} ARP_t;
#define ARP_HDR_SIZE (8+20) /* Size assuming ethernet */