27 lines
615 B
C
27 lines
615 B
C
#ifndef __ARP_H
|
|
#define __ARP_H
|
|
|
|
#include "ether.h"
|
|
|
|
struct arp_packet_t {
|
|
unsigned short htype;
|
|
unsigned short ptype;
|
|
unsigned char hlen;
|
|
unsigned char plen;
|
|
unsigned short oper;
|
|
unsigned char sha[6];
|
|
unsigned int spa;
|
|
unsigned char tha[6];
|
|
unsigned int tpa;
|
|
}__attribute__((packed));
|
|
|
|
struct arp_table_t {
|
|
unsigned char mac[6];
|
|
unsigned int ipv4;
|
|
};
|
|
|
|
extern void arp_process_packet(struct ether_t *ether, struct arp_packet_t *packet);
|
|
extern void arp_update_ipv4(struct ether_t *ether, unsigned char *mac, unsigned int ipv4);
|
|
extern char *arp_req_ipv4(struct ether_t *ether, unsigned int ipv4);
|
|
#endif
|