📄 arp.h
字号:
#ifndef ARP_H
#define ARP_H
#include "ethernet.h"
#define ARP_CACHE_LENGTH 10
typedef struct {
Uint8 ip_addr[INADDR_LEN];
Uint8 mac_addr[ETH_ALEN];
Uint8 TTL;
}Arp_cache_struc;
/* ARP protocol opcodes. */
#define ARPOP_REQUEST 1 /* ARP request. */
#define ARPOP_REPLY 2 /* ARP reply. */
typedef struct {
Uint16 ar_hrd; /* Format of hardware address. */
Uint16 ar_pro; /* Format of protocol address. */
Uint8 ar_hln; /* Length of hardware address. */
Uint8 ar_pln; /* Length of protocol address. */
Uint16 ar_op; /* ARP opcode (command). */
}Arphdr_struc;
/* ARP protocol HARDWARE identifiers. */
#define ARPHRD_ETHER 1 /* Ethernet 10/100Mbps. */
// Ethernet Address Resolution Protocol.
typedef struct{
Arphdr_struc ea_hdr; /* fixed-size header */
Uint8 arp_sha[ETH_ALEN]; /* sender hardware address */
Uint8 arp_spa[INADDR_LEN]; /* sender protocol address */
Uint8 arp_tha[ETH_ALEN]; /* target hardware address */
Uint8 arp_tpa[INADDR_LEN]; /* target protocol address */
}Ether_arp_struc;
void arp_init();
Bool arp_send(Uint16, const Uint8*, const Uint8*);
Bool arp_receive(Uint8 *pbuf);
Uint8* get_macaddr( const Uint8* );
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -