bcmarp.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Fundamental constants relating to ARP Protocol
  3. *
  4. * Portions of this code are copyright (c) 2020 Cypress Semiconductor Corporation
  5. *
  6. * Copyright (C) 1999-2020, Broadcom Corporation
  7. *
  8. * Unless you and Broadcom execute a separate written software license
  9. * agreement governing use of this software, this software is licensed to you
  10. * under the terms of the GNU General Public License version 2 (the "GPL"),
  11. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  12. * following added to such license:
  13. *
  14. * As a special exception, the copyright holders of this software give you
  15. * permission to link this software with independent modules, and to copy and
  16. * distribute the resulting executable under terms of your choice, provided that
  17. * you also meet, for each linked independent module, the terms and conditions of
  18. * the license of that module. An independent module is a module which is not
  19. * derived from this software. The special exception does not apply to any
  20. * modifications of the software.
  21. *
  22. * Notwithstanding the above, under no circumstances may you combine this
  23. * software in any way with any other Broadcom software provided under a license
  24. * other than the GPL, without Broadcom's express prior written consent.
  25. *
  26. *
  27. * <<Broadcom-WL-IPTag/Open:>>
  28. *
  29. * $Id: bcmarp.h 681867 2018-01-03 12:34:41Z $
  30. */
  31. #ifndef _bcmarp_h_
  32. #define _bcmarp_h_
  33. #ifndef _TYPEDEFS_H_
  34. #include <typedefs.h>
  35. #endif // endif
  36. #include <bcmip.h>
  37. /* This marks the start of a packed structure section. */
  38. #include <packed_section_start.h>
  39. #define ARP_OPC_OFFSET 6 /* option code offset */
  40. #define ARP_SRC_ETH_OFFSET 8 /* src h/w address offset */
  41. #define ARP_SRC_IP_OFFSET 14 /* src IP address offset */
  42. #define ARP_TGT_ETH_OFFSET 18 /* target h/w address offset */
  43. #define ARP_TGT_IP_OFFSET 24 /* target IP address offset */
  44. #define ARP_OPC_REQUEST 1 /* ARP request */
  45. #define ARP_OPC_REPLY 2 /* ARP reply */
  46. #define ARP_DATA_LEN 28 /* ARP data length */
  47. #define HTYPE_ETHERNET 1 /* htype for ethernet */
  48. BWL_PRE_PACKED_STRUCT struct bcmarp {
  49. uint16 htype; /* Header type (1 = ethernet) */
  50. uint16 ptype; /* Protocol type (0x800 = IP) */
  51. uint8 hlen; /* Hardware address length (Eth = 6) */
  52. uint8 plen; /* Protocol address length (IP = 4) */
  53. uint16 oper; /* ARP_OPC_... */
  54. uint8 src_eth[ETHER_ADDR_LEN]; /* Source hardware address */
  55. uint8 src_ip[IPV4_ADDR_LEN]; /* Source protocol address (not aligned) */
  56. uint8 dst_eth[ETHER_ADDR_LEN]; /* Destination hardware address */
  57. uint8 dst_ip[IPV4_ADDR_LEN]; /* Destination protocol address */
  58. } BWL_POST_PACKED_STRUCT;
  59. /* Ethernet header + Arp message */
  60. BWL_PRE_PACKED_STRUCT struct bcmetharp {
  61. struct ether_header eh;
  62. struct bcmarp arp;
  63. } BWL_POST_PACKED_STRUCT;
  64. /* IPv6 Neighbor Advertisement */
  65. #define NEIGHBOR_ADVERTISE_SRC_IPV6_OFFSET 8 /* src IPv6 address offset */
  66. #define NEIGHBOR_ADVERTISE_TYPE_OFFSET 40 /* type offset */
  67. #define NEIGHBOR_ADVERTISE_CHECKSUM_OFFSET 42 /* check sum offset */
  68. #define NEIGHBOR_ADVERTISE_FLAGS_OFFSET 44 /* R,S and O flags offset */
  69. #define NEIGHBOR_ADVERTISE_TGT_IPV6_OFFSET 48 /* target IPv6 address offset */
  70. #define NEIGHBOR_ADVERTISE_OPTION_OFFSET 64 /* options offset */
  71. #define NEIGHBOR_ADVERTISE_TYPE 136
  72. #define NEIGHBOR_SOLICITATION_TYPE 135
  73. #define OPT_TYPE_SRC_LINK_ADDR 1
  74. #define OPT_TYPE_TGT_LINK_ADDR 2
  75. #define NEIGHBOR_ADVERTISE_DATA_LEN 72 /* neighbor advertisement data length */
  76. #define NEIGHBOR_ADVERTISE_FLAGS_VALUE 0x60 /* R=0, S=1 and O=1 */
  77. /* This marks the end of a packed structure section. */
  78. #include <packed_section_end.h>
  79. #endif /* !defined(_bcmarp_h_) */