iPXE
arp.h
Go to the documentation of this file.
1#ifndef _IPXE_ARP_H
2#define _IPXE_ARP_H
3
4/** @file
5 *
6 * Address Resolution Protocol
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <ipxe/tables.h>
14#include <ipxe/netdevice.h>
15#include <ipxe/neighbour.h>
16
17/** A network-layer protocol that relies upon ARP */
19 /** Network-layer protocol */
21 /** Check existence of address
22 *
23 * @v netdev Network device
24 * @v net_addr Network-layer address
25 * @ret rc Return status code
26 */
27 int ( * check ) ( struct net_device *netdev,
28 const void *net_addr );
29};
30
31/** ARP protocol table */
32#define ARP_NET_PROTOCOLS \
33 __table ( struct arp_net_protocol, "arp_net_protocols" )
34
35/** Declare an ARP protocol */
36#define __arp_net_protocol __table_entry ( ARP_NET_PROTOCOLS, 01 )
37
38extern struct net_protocol arp_protocol __net_protocol;
40
41/**
42 * Transmit packet, determining link-layer address via ARP
43 *
44 * @v iobuf I/O buffer
45 * @v netdev Network device
46 * @v net_protocol Network-layer protocol
47 * @v net_dest Destination network-layer address
48 * @v net_source Source network-layer address
49 * @ret rc Return status code
50 */
51static inline int arp_tx ( struct io_buffer *iobuf, struct net_device *netdev,
53 const void *net_dest, const void *net_source ) {
54
55 return neighbour_tx ( iobuf, netdev, net_protocol, net_dest,
56 &arp_discovery, net_source );
57}
58
59extern int arp_tx_request ( struct net_device *netdev,
61 const void *net_dest, const void *net_source );
62
63#endif /* _IPXE_ARP_H */
struct neighbour_discovery arp_discovery
ARP neighbour discovery protocol.
Definition arp.c:104
int arp_tx_request(struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, const void *net_source)
Transmit ARP request.
Definition arp.c:60
static int arp_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, const void *net_source)
Transmit packet, determining link-layer address via ARP.
Definition arp.h:51
static struct net_device * netdev
Definition gdbudp.c:53
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
int neighbour_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, struct neighbour_discovery *discovery, const void *net_source)
Transmit packet, determining link-layer address via neighbour discovery.
Definition neighbour.c:377
Neighbour discovery.
Network device management.
#define __net_protocol
Declare a network-layer protocol.
Definition netdevice.h:474
A network-layer protocol that relies upon ARP.
Definition arp.h:18
struct net_protocol * net_protocol
Network-layer protocol.
Definition arp.h:20
int(* check)(struct net_device *netdev, const void *net_addr)
Check existence of address.
Definition arp.h:27
A persistent I/O buffer.
Definition iobuf.h:38
A neighbour discovery protocol.
Definition neighbour.h:20
A network device.
Definition netdevice.h:353
A network-layer protocol.
Definition netdevice.h:65
Linker tables.