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 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <ipxe/tables.h>
13 #include <ipxe/netdevice.h>
14 #include <ipxe/neighbour.h>
15 
16 /** A network-layer protocol that relies upon ARP */
18  /** Network-layer protocol */
20  /** Check existence of address
21  *
22  * @v netdev Network device
23  * @v net_addr Network-layer address
24  * @ret rc Return status code
25  */
26  int ( * check ) ( struct net_device *netdev,
27  const void *net_addr );
28 };
29 
30 /** ARP protocol table */
31 #define ARP_NET_PROTOCOLS \
32  __table ( struct arp_net_protocol, "arp_net_protocols" )
33 
34 /** Declare an ARP protocol */
35 #define __arp_net_protocol __table_entry ( ARP_NET_PROTOCOLS, 01 )
36 
37 extern struct net_protocol arp_protocol __net_protocol;
39 
40 /**
41  * Transmit packet, determining link-layer address via ARP
42  *
43  * @v iobuf I/O buffer
44  * @v netdev Network device
45  * @v net_protocol Network-layer protocol
46  * @v net_dest Destination network-layer address
47  * @v net_source Source network-layer address
48  * @v ll_source Source link-layer address
49  * @ret rc Return status code
50  */
51 static inline int arp_tx ( struct io_buffer *iobuf, struct net_device *netdev,
52  struct net_protocol *net_protocol,
53  const void *net_dest, const void *net_source,
54  const void *ll_source ) {
55 
56  return neighbour_tx ( iobuf, netdev, net_protocol, net_dest,
57  &arp_discovery, net_source, ll_source );
58 }
59 
60 extern int arp_tx_request ( struct net_device *netdev,
61  struct net_protocol *net_protocol,
62  const void *net_dest, const void *net_source );
63 
64 #endif /* _IPXE_ARP_H */
A neighbour discovery protocol.
Definition: neighbour.h:19
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct neighbour_discovery arp_discovery
ARP neighbour discovery protocol.
Definition: arp.c:103
int(* check)(struct net_device *netdev, const void *net_addr)
Check existence of address.
Definition: arp.h:26
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, const void *ll_source)
Transmit packet, determining link-layer address via ARP.
Definition: arp.h:51
A network-layer protocol that relies upon ARP.
Definition: arp.h:17
struct net_protocol * net_protocol
Network-layer protocol.
Definition: arp.h:19
static struct net_device * netdev
Definition: gdbudp.c:52
A network device.
Definition: netdevice.h:352
struct net_protocol arp_protocol __net_protocol
AoE protocol.
Definition: aoe.c:56
A network-layer protocol.
Definition: netdevice.h:64
Network device management.
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, const void *ll_source)
Transmit packet, determining link-layer address via neighbour discovery.
Definition: neighbour.c:299
Neighbour discovery.
Linker tables.
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:59
A persistent I/O buffer.
Definition: iobuf.h:33