Keyboard firmwares for Atmel AVR and Cortex-M
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 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. LUFA Library
  3. Copyright (C) Dean Camera, 2014.
  4. dean [at] fourwalledcubicle [dot] com
  5. www.lufa-lib.org
  6. */
  7. /*
  8. Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com)
  9. Permission to use, copy, modify, distribute, and sell this
  10. software and its documentation for any purpose is hereby granted
  11. without fee, provided that the above copyright notice appear in
  12. all copies and that both that the copyright notice and this
  13. permission notice and warranty disclaimer appear in supporting
  14. documentation, and that the name of the author not be used in
  15. advertising or publicity pertaining to distribution of the
  16. software without specific, written prior permission.
  17. The author disclaims all warranties with regard to this
  18. software, including all implied warranties of merchantability
  19. and fitness. In no event shall the author be liable for any
  20. special, indirect or consequential damages or any damages
  21. whatsoever resulting from loss of use, data or profits, whether
  22. in an action of contract, negligence or other tortious action,
  23. arising out of or in connection with the use or performance of
  24. this software.
  25. */
  26. /** \file
  27. *
  28. * Header file for ARP.c.
  29. */
  30. #ifndef _ARP_H_
  31. #define _ARP_H_
  32. /* Includes: */
  33. #include <avr/io.h>
  34. #include <string.h>
  35. #include "EthernetProtocols.h"
  36. #include "Ethernet.h"
  37. #include "ProtocolDecoders.h"
  38. /* Macros: */
  39. /** ARP header operation constant, indicating a request from a host for an address translation. */
  40. #define ARP_OPERATION_REQUEST 1
  41. /** ARP header operation constant, indicating a reply from a host giving an address translation. */
  42. #define ARP_OPERATION_REPLY 2
  43. /* Type Defines: */
  44. /** Type define for an ARP packet inside an Ethernet frame. */
  45. typedef struct
  46. {
  47. uint16_t HardwareType; /**< Hardware type constant, indicating the hardware used */
  48. uint16_t ProtocolType; /**< Protocol being resolved, usually ETHERTYPE_IPV4 */
  49. uint8_t HLEN; /**< Length in bytes of the source/destination hardware addresses */
  50. uint8_t PLEN; /**< Length in bytes of the source/destination protocol addresses */
  51. uint16_t Operation; /**< Type of operation, either ARP_OPERATION_REQUEST or ARP_OPERATION_REPLY */
  52. MAC_Address_t SHA; /**< Sender's hardware address */
  53. IP_Address_t SPA; /**< Sender's protocol address */
  54. MAC_Address_t THA; /**< Target's hardware address */
  55. IP_Address_t TPA; /**< Target's protocol address */
  56. } ARP_Header_t;
  57. /* Function Prototypes: */
  58. int16_t ARP_ProcessARPPacket(void* InDataStart,
  59. void* OutDataStart);
  60. #endif