iPXE
arp.h
Go to the documentation of this file.
00001 #ifndef _IPXE_ARP_H
00002 #define _IPXE_ARP_H
00003 
00004 /** @file
00005  *
00006  * Address Resolution Protocol
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <ipxe/tables.h>
00013 #include <ipxe/netdevice.h>
00014 #include <ipxe/neighbour.h>
00015 
00016 /** A network-layer protocol that relies upon ARP */
00017 struct arp_net_protocol {
00018         /** Network-layer protocol */
00019         struct net_protocol *net_protocol;
00020         /** Check existence of address
00021          *
00022          * @v netdev    Network device
00023          * @v net_addr  Network-layer address
00024          * @ret rc      Return status code
00025          */
00026         int ( * check ) ( struct net_device *netdev,
00027                           const void *net_addr );
00028 };
00029 
00030 /** ARP protocol table */
00031 #define ARP_NET_PROTOCOLS \
00032         __table ( struct arp_net_protocol, "arp_net_protocols" )
00033 
00034 /** Declare an ARP protocol */
00035 #define __arp_net_protocol __table_entry ( ARP_NET_PROTOCOLS, 01 )
00036 
00037 extern struct net_protocol arp_protocol __net_protocol;
00038 extern struct neighbour_discovery arp_discovery;
00039 
00040 /**
00041  * Transmit packet, determining link-layer address via ARP
00042  *
00043  * @v iobuf             I/O buffer
00044  * @v netdev            Network device
00045  * @v net_protocol      Network-layer protocol
00046  * @v net_dest          Destination network-layer address
00047  * @v net_source        Source network-layer address
00048  * @v ll_source         Source link-layer address
00049  * @ret rc              Return status code
00050  */
00051 static inline int arp_tx ( struct io_buffer *iobuf, struct net_device *netdev,
00052                            struct net_protocol *net_protocol,
00053                            const void *net_dest, const void *net_source,
00054                            const void *ll_source ) {
00055 
00056         return neighbour_tx ( iobuf, netdev, net_protocol, net_dest,
00057                               &arp_discovery, net_source, ll_source );
00058 }
00059 
00060 extern int arp_tx_request ( struct net_device *netdev,
00061                             struct net_protocol *net_protocol,
00062                             const void *net_dest, const void *net_source );
00063 
00064 #endif /* _IPXE_ARP_H */