allow coexistance of N build and AC build.
[tomato.git] / release / src-rt-6.x / include / proto / bcmipv6.h
blob7fb7025c63b4aa190952fb4a39ffb716faf5fc17
1 /*
2 * Copyright (C) 2011, Broadcom Corporation. All Rights Reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 * Fundamental constants relating to Neighbor Discovery Protocol
18 * $Id: bcmipv6.h 305568 2011-12-29 20:21:17Z $
21 #ifndef _bcmipv6_h_
22 #define _bcmipv6_h_
24 #ifndef _TYPEDEFS_H_
25 #include <typedefs.h>
26 #endif
28 /* This marks the start of a packed structure section. */
29 #include <packed_section_start.h>
31 #define ICMPV6_HEADER_TYPE 0x3A
32 #define ICMPV6_PKT_TYPE_NS 135
33 #define ICMPV6_PKT_TYPE_NA 136
35 #define ICMPV6_ND_OPT_TYPE_TARGET_MAC 2
36 #define ICMPV6_ND_OPT_TYPE_SRC_MAC 1
38 #define IPV6_VERSION 6
39 #define IPV6_HOP_LIMIT 255
41 #define IPV6_ADDR_NULL(a) ((a[0] | a[1] | a[2] | a[3] | a[4] | \
42 a[5] | a[6] | a[7] | a[8] | a[9] | \
43 a[10] | a[11] | a[12] | a[13] | \
44 a[14] | a[15]) == 0)
46 /* IPV6 address */
47 BWL_PRE_PACKED_STRUCT struct ipv6_addr {
48 uint8 addr[16];
49 } BWL_POST_PACKED_STRUCT;
51 #ifndef IL_BIGENDIAN
53 /* ICMPV6 Header */
54 BWL_PRE_PACKED_STRUCT struct icmp6_hdr {
55 uint8 icmp6_type;
56 uint8 icmp6_code;
57 uint16 icmp6_cksum;
58 BWL_PRE_PACKED_STRUCT union {
59 uint32 reserved;
60 BWL_PRE_PACKED_STRUCT struct nd_advt {
61 uint32 reserved1:5,
62 override:1,
63 solicited:1,
64 router:1,
65 reserved2:24;
66 } BWL_POST_PACKED_STRUCT nd_advt;
67 } BWL_POST_PACKED_STRUCT opt;
68 } BWL_POST_PACKED_STRUCT;
70 /* Ipv6 Header Format */
71 BWL_PRE_PACKED_STRUCT struct ipv6_hdr {
72 uint8 priority:4,
73 version:4;
74 uint8 flow_lbl[3];
75 uint16 payload_len;
76 uint8 nexthdr;
77 uint8 hop_limit;
78 struct ipv6_addr saddr;
79 struct ipv6_addr daddr;
80 } BWL_POST_PACKED_STRUCT;
82 /* Neighbor Advertisement/Solicitation Packet Structure */
83 BWL_PRE_PACKED_STRUCT struct nd_msg {
84 struct icmp6_hdr icmph;
85 struct ipv6_addr target;
86 } BWL_POST_PACKED_STRUCT;
89 /* Neighibor Solicitation/Advertisement Optional Structure */
90 BWL_PRE_PACKED_STRUCT struct nd_msg_opt {
91 uint8 type;
92 uint8 len;
93 uint8 mac_addr[ETHER_ADDR_LEN];
94 } BWL_POST_PACKED_STRUCT;
96 #endif /* IL_BIGENDIAN */
98 /* This marks the end of a packed structure section. */
99 #include <packed_section_end.h>
101 #endif /* !defined(_bcmipv6_h_) */