1266d7902b
Intel's C compiler (icc) chokes on the zero-length arrays that we currently use as part of the mechanism for accessing linker table entries. Abstract away the zero-length arrays, to make a port to icc easier. Introduce macros such as for_each_table_entry() to simplify the common case of iterating over all entries in a linker table. Represent table names as #defined string constants rather than unquoted literals; this avoids visual confusion between table names and C variable or type names, and also allows us to force a compilation error in the event of incorrect table names.
45 lines
967 B
C
45 lines
967 B
C
#ifndef _GPXE_ARP_H
|
|
#define _GPXE_ARP_H
|
|
|
|
/** @file
|
|
*
|
|
* Address Resolution Protocol
|
|
*
|
|
*/
|
|
|
|
#include <gpxe/tables.h>
|
|
|
|
struct net_device;
|
|
struct net_protocol;
|
|
|
|
/** A network-layer protocol that relies upon ARP */
|
|
struct arp_net_protocol {
|
|
/** Network-layer protocol */
|
|
struct net_protocol *net_protocol;
|
|
/** Check existence of address
|
|
*
|
|
* @v netdev Network device
|
|
* @v net_addr Network-layer address
|
|
* @ret rc Return status code
|
|
*/
|
|
int ( * check ) ( struct net_device *netdev,
|
|
const void *net_addr );
|
|
};
|
|
|
|
/** ARP protocol table */
|
|
#define ARP_NET_PROTOCOLS "arp_net_protocols"
|
|
|
|
/** Declare an ARP protocol */
|
|
#define __arp_net_protocol \
|
|
__table ( struct arp_net_protocol, ARP_NET_PROTOCOLS, 01 )
|
|
|
|
extern struct net_protocol arp_protocol;
|
|
|
|
extern int arp_resolve ( struct net_device *netdev,
|
|
struct net_protocol *net_protocol,
|
|
const void *dest_net_addr,
|
|
const void *source_net_addr,
|
|
void *dest_ll_addr );
|
|
|
|
#endif /* _GPXE_ARP_H */
|