arp_proto.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * @file arp_proto.h
  3. * @author Ambroz Bizjak <ambrop7@gmail.com>
  4. *
  5. * @section LICENSE
  6. *
  7. * This file is part of BadVPN.
  8. *
  9. * BadVPN is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2
  11. * as published by the Free Software Foundation.
  12. *
  13. * BadVPN is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. *
  22. * @section DESCRIPTION
  23. *
  24. * Definitions for the ARP protocol.
  25. */
  26. #ifndef BADVPN_ARP_PROTO_H
  27. #define BADVPN_ARP_PROTO_H
  28. #include <stdint.h>
  29. #define ARP_HARDWARE_TYPE_ETHERNET 1
  30. #define ARP_OPCODE_REQUEST 1
  31. #define ARP_OPCODE_REPLY 2
  32. struct arp_packet {
  33. uint16_t hardware_type;
  34. uint16_t protocol_type;
  35. uint8_t hardware_size;
  36. uint8_t protocol_size;
  37. uint16_t opcode;
  38. uint8_t sender_mac[6];
  39. uint32_t sender_ip;
  40. uint8_t target_mac[6];
  41. uint32_t target_ip;
  42. } __attribute__((packed));
  43. #endif