The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
arp.h
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* @file arp.h
5
* @brief the Address Resolution Protocol (RFC 826): the Ethernet address
6
* of an IPv4 address on the local network.
7
*
8
* the cache keeps ARP_ENTRIES addresses for ARP_LIFETIME seconds. a packet
9
* for an address not in the cache waits (one per address, the newest)
10
* while a request goes out, and is sent when the answer comes.
11
*/
12
13
#include "
netif.h
"
14
15
#define ARP_ENTRIES 16
16
#define ARP_LIFETIME 300
// seconds
17
18
/**
19
* an ARP packet from the network (net_lock held).
20
*/
21
void
arp_receive
(
netif_t
*
netif
,
const
uint8_t
*packet,
uint32_t
length);
22
23
/**
24
* send an IPv4 packet to the host ip on the local network of netif
25
* (net_lock held). if its address is not known yet, the packet waits for
26
* the answer to a request.
27
* @return false if the packet cannot be sent or kept.
28
*/
29
bool
arp_send_ipv4
(
netif_t
*
netif
,
uint32_t
ip,
const
void
*packet,
uint32_t
length);
30
31
/**
32
* the Ethernet address of ip from the cache (net_lock held).
33
* @return false if it is not there.
34
*/
35
bool
arp_lookup
(
netif_t
*
netif
,
uint32_t
ip,
uint8_t
mac[
ETH_ADDR_LEN
]);
36
37
/**
38
* forget all entries (for the tests).
39
*/
40
void
arp_flush
(
void
);
arp_flush
void arp_flush(void)
forget all entries (for the tests).
Definition
arp.c:208
arp_receive
void arp_receive(netif_t *netif, const uint8_t *p, uint32_t length)
an ARP packet from the network (net_lock held).
Definition
arp.c:131
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).
Definition
arp.c:158
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).
Definition
arp.c:169
uint32_t
unsigned int uint32_t
Definition
fb.h:17
uint8_t
unsigned char uint8_t
Definition
fb.h:18
netif.h
network interfaces: the devices that send and receive frames.
ETH_ADDR_LEN
#define ETH_ADDR_LEN
Definition
netif.h:23
netif_t
struct netif netif_t
netif
Definition
netif.h:37
src
kernel
net
arp.h
Generated by
1.18.0