You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

arp.h 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef _IPXE_ARP_H
  2. #define _IPXE_ARP_H
  3. /** @file
  4. *
  5. * Address Resolution Protocol
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <ipxe/tables.h>
  10. #include <ipxe/netdevice.h>
  11. #include <ipxe/neighbour.h>
  12. /** A network-layer protocol that relies upon ARP */
  13. struct arp_net_protocol {
  14. /** Network-layer protocol */
  15. struct net_protocol *net_protocol;
  16. /** Check existence of address
  17. *
  18. * @v netdev Network device
  19. * @v net_addr Network-layer address
  20. * @ret rc Return status code
  21. */
  22. int ( * check ) ( struct net_device *netdev,
  23. const void *net_addr );
  24. };
  25. /** ARP protocol table */
  26. #define ARP_NET_PROTOCOLS \
  27. __table ( struct arp_net_protocol, "arp_net_protocols" )
  28. /** Declare an ARP protocol */
  29. #define __arp_net_protocol __table_entry ( ARP_NET_PROTOCOLS, 01 )
  30. extern struct net_protocol arp_protocol __net_protocol;
  31. extern struct neighbour_discovery arp_discovery;
  32. /**
  33. * Transmit packet, determining link-layer address via ARP
  34. *
  35. * @v iobuf I/O buffer
  36. * @v netdev Network device
  37. * @v net_protocol Network-layer protocol
  38. * @v net_dest Destination network-layer address
  39. * @v net_source Source network-layer address
  40. * @v ll_source Source link-layer address
  41. * @ret rc Return status code
  42. */
  43. static inline int arp_tx ( struct io_buffer *iobuf, struct net_device *netdev,
  44. struct net_protocol *net_protocol,
  45. const void *net_dest, const void *net_source,
  46. const void *ll_source ) {
  47. return neighbour_tx ( iobuf, netdev, net_protocol, net_dest,
  48. &arp_discovery, net_source, ll_source );
  49. }
  50. #endif /* _IPXE_ARP_H */