6 * Address Resolution Protocol
10 FILE_LICENCE ( GPL2_OR_LATER );
12 #include <ipxe/tables.h>
13 #include <ipxe/netdevice.h>
14 #include <ipxe/neighbour.h>
16 /** A network-layer protocol that relies upon ARP */
17 struct arp_net_protocol {
18 /** Network-layer protocol */
19 struct net_protocol *net_protocol;
20 /** Check existence of address
22 * @v netdev Network device
23 * @v net_addr Network-layer address
24 * @ret rc Return status code
26 int ( * check ) ( struct net_device *netdev,
27 const void *net_addr );
30 /** ARP protocol table */
31 #define ARP_NET_PROTOCOLS \
32 __table ( struct arp_net_protocol, "arp_net_protocols" )
34 /** Declare an ARP protocol */
35 #define __arp_net_protocol __table_entry ( ARP_NET_PROTOCOLS, 01 )
37 extern struct net_protocol arp_protocol __net_protocol;
38 extern struct neighbour_discovery arp_discovery;
41 * Transmit packet, determining link-layer address via ARP
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
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 ) {
56 return neighbour_tx ( iobuf, netdev, net_protocol, net_dest,
57 &arp_discovery, net_source, ll_source );
60 #endif /* _IPXE_ARP_H */