Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / arp.h
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 );
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 */
17 struct arp_net_protocol {
18         /** Network-layer protocol */
19         struct net_protocol *net_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;
38 extern struct neighbour_discovery arp_discovery;
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 #endif /* _IPXE_ARP_H */