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