I am trying to implement the ARP protocol by myself, but I'm not sure how it should behave, how I should craft an ARP request. How does it work and why it should work..
I tried to research this on the internet but nothing really helped me. I want to create an ARP_table like this:
typedef struct arp_table_entry {
uint8_t shwaddr[ETH_ALEN]; /* sender hardware address. */
uint8_t sipaddr[IPv4LEN]; /* sender ip address. */
uint8_t dhwaddr[ETH_ALEN]; /* destination hardware address. */
uint8_t dipaddr[IPv4LEN]; /* destination ip address. */
} arp_table;
But I don't know what kind of packet I should receive or what I should send or even how. Also if you could give me some information about where I could find some good definitions on: what is an interface, what is a port, what is an IP and why do we need it, things about networking in general..