The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
arp.c File Reference

the ARP cache (see arp.h). More...

#include "arp.h"
#include "byteorder.h"
#include "common/memory.h"
#include "ethernet.h"
#include "kernel/memory/heap.h"
#include "kernel/time/timer.h"

Macros

#define PACKET_SIZE   28
#define OP_REQUEST   1
#define OP_REPLY   2
#define RETRY_TICKS   (TIMER_HZ)

Functions

void arp_receive (netif_t *netif, const uint8_t *p, uint32_t length)
 an ARP packet from the network (net_lock held).
bool arp_lookup (netif_t *netif, uint32_t ip, uint8_t mac[ETH_ADDR_LEN])
 the Ethernet address of ip from the cache (net_lock held).
bool arp_send_ipv4 (netif_t *netif, uint32_t ip, const void *packet, uint32_t length)
 send an IPv4 packet to the host ip on the local network of netif (net_lock held).
void arp_flush (void)
 forget all entries (for the tests).

Detailed Description

the ARP cache (see arp.h).

Macro Definition Documentation

◆ PACKET_SIZE

#define PACKET_SIZE   28

◆ OP_REQUEST

#define OP_REQUEST   1

◆ OP_REPLY

#define OP_REPLY   2

◆ RETRY_TICKS

#define RETRY_TICKS   (TIMER_HZ)

Function Documentation

◆ arp_receive()

void arp_receive ( netif_t * netif,
const uint8_t * p,
uint32_t length )

an ARP packet from the network (net_lock held).

◆ arp_lookup()

bool arp_lookup ( netif_t * netif,
uint32_t ip,
uint8_t mac[ETH_ADDR_LEN] )

the Ethernet address of ip from the cache (net_lock held).

Returns
false if it is not there.

◆ arp_send_ipv4()

bool arp_send_ipv4 ( netif_t * netif,
uint32_t ip,
const void * packet,
uint32_t length )

send an IPv4 packet to the host ip on the local network of netif (net_lock held).

if its address is not known yet, the packet waits for the answer to a request.

Returns
false if the packet cannot be sent or kept.

◆ arp_flush()

void arp_flush ( void )

forget all entries (for the tests).