1 /* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #ifndef _NETINET_ICMP6_H
20 #define _NETINET_ICMP6_H 1
22 #include <sys/types.h>
23 #include <netinet/in.h>
25 #define ICMPV6_FILTER 1
27 #define ICMPV6_FILTER_BLOCK 1
28 #define ICMPV6_FILTER_PASS 2
29 #define ICMPV6_FILTER_BLOCKOTHERS 3
30 #define ICMPV6_FILTER_PASSONLY 4
39 u_int8_t icmpv6_type; /* type field */
40 u_int8_t icmpv6_code; /* code field */
41 u_int16_t icmpv6_cksum; /* checksum field */
44 u_int32_t un_data32[1]; /* type-specific field */
45 u_int16_t un_data16[2]; /* type-specific field */
46 u_int8_t un_data8[4]; /* type-specific field */
50 #define icmpv6_data32 icmpv6_dataun.un_data32
51 #define icmpv6_data16 icmpv6_dataun.un_data16
52 #define icmpv6_data8 icmpv6_dataun.un_data8
53 #define icmpv6_pptr icmpv6_data32[0] /* parameter prob */
54 #define icmpv6_mtu icmpv6_data32[0] /* packet too big */
55 #define icmpv6_id icmpv6_data16[0] /* echo request/reply */
56 #define icmpv6_seq icmpv6_data16[1] /* echo request/reply */
57 #define icmpv6_maxdelay icmpv6_data16[0] /* mcast group membership */
59 #define ICMPV6_DEST_UNREACH 1
60 #define ICMPV6_PACKET_TOOBIG 2
61 #define ICMPV6_TIME_EXCEEDED 3
62 #define ICMPV6_PARAMETER_PROBLEM 4
63 #define ICMPV6_INFOMSG_MASK 128 /* message is info if bit set */
64 #define ICMPV6_ECHOREQUEST 128
65 #define ICMPV6_ECHOREPLY 129
66 #define ICMPV6_MGM_QUERY 130
67 #define ICMPV6_MGM_REPORT 131
68 #define ICMPV6_MGM_REDUCTION 132
70 #define ICMPV6_DEST_UNREACH_NOROUTE 0
71 #define ICMPV6_DEST_UNREACH_ADMIN 1 /* administratively prohibited */
72 #define ICMPV6_DEST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor (and must be) */
73 #define ICMPV6_DEST_UNREACH_ADDR 3
74 #define ICMPV6_DEST_UNREACH_NOPORT 4
75 #define ICMPV6_TIME_EXCEED_HOPS 0 /* Hop Limit == 0 in transit */
76 #define ICMPV6_TIME_EXCEED_REASSEMBLY 1 /* Reassembly time out */
77 #define ICMPV6_PARAMPROB_HEADER 0 /* erroneous header field */
78 #define ICMPV6_PARAMPROB_NEXTHEADER 1 /* unrecognized Next Header */
79 #define ICMPV6_PARAMPROB_OPTION 2 /* unrecognized option */
81 #define ICMPV6_FILTER_WILLPASS(type, filterp) \
82 ((((filterp)->data[(type) >> 5]) & (1 << ((type) & 31))) == 0)
84 #define ICMPV6_FILTER_WILLBLOCK(type, filterp) \
85 ((((filterp)->data[(type) >> 5]) & (1 << ((type) & 31))) != 0)
87 #define ICMPV6_FILTER_SETPASS(type, filterp) \
88 ((((filterp)->data[(type) >> 5]) &= ~(1 << ((type) & 31))))
90 #define ICMPV6_FILTER_SETBLOCK(type, filterp) \
91 ((((filterp)->data[(type) >> 5]) |= (1 << ((type) & 31))))
93 #define ICMPV6_FILTER_SETPASSALL(filterp) \
94 memset (filterp, 0, sizeof (struct icmpv6_filter));
96 #define ICMPV6_FILTER_SETBLOCKALL(filterp) \
97 memset (filterp, 0xFF, sizeof (struct icmpv6_filter));
99 #define ND6_ROUTER_SOLICITATION 133
100 #define ND6_ROUTER_ADVERTISEMENT 134
101 #define ND6_NEIGHBOR_SOLICITATION 135
102 #define ND6_NEIGHBOR_ADVERTISEMENT 136
103 #define ND6_REDIRECT 137
107 ND6_OPT_SOURCE_LINKADDR=1,
108 ND6_OPT_TARGET_LINKADDR=2,
109 ND6_OPT_PREFIX_INFORMATION=3,
110 ND6_OPT_REDIRECTED_HEADER=4,
112 ND6_OPT_ENDOFLIST=256
115 struct nd6_router_solicit /* router solicitation */
117 struct icmpv6hdr rsol_hdr;
120 #define rsol_type rsol_hdr.icmpv6_type
121 #define rsol_code rsol_hdr.icmpv6_code
122 #define rsol_cksum rsol_hdr.icmpv6_cksum
123 #define rsol_reserved rsol_hdr.icmpv6_data32[0]
125 struct nd6_router_advert
127 struct icmpv6hdr radv_hdr;
128 u_int32_t radv_reachable; /* reachable time */
129 u_int32_t radv_retransmit; /* reachable retransmit time */
132 #define radv_type radv_hdr.icmpv6_type
133 #define radv_code radv_hdr.icmpv6_code
134 #define radv_cksum radv_hdr.icmpv6_cksum
135 #define radv_maxhoplimit radv_hdr.icmpv6_data8[0]
136 #define radv_m_o_res radv_hdr.icmpv6_data8[1]
137 #define ND6_RADV_M_BIT 0x80
138 #define ND6_RADV_O_BIT 0x40
139 #define radv_router_lifetime radv_hdr.icmpv6_data16[1]
141 struct nd6_nsolicitation /* neighbor solicitation */
143 struct icmpv6hdr nsol6_hdr;
144 struct in6_addr nsol6_target;
147 struct nd6_nadvertisement /* neighbor advertisement */
149 struct icmpv6hdr nadv6_hdr;
150 struct in6_addr nadv6_target;
153 #define nadv6_flags nadv6_hdr.icmpv6_data32[0]
154 #define ND6_NADVERFLAG_ISROUTER 0x80
155 #define ND6_NADVERFLAG_SOLICITED 0x40
156 #define ND6_NADVERFLAG_OVERRIDE 0x20
158 struct nd6_redirect /* redirect */
160 struct icmpv6hdr redirect_hdr;
161 struct in6_addr redirect_target;
162 struct in6_addr redirect_destination;
165 struct nd6_opt_prefix_info /* prefix information */
169 u_int8_t opt_prefix_length;
170 u_int8_t opt_l_a_res;
171 u_int32_t opt_valid_life;
172 u_int32_t opt_preferred_life;
173 u_int32_t opt_reserved2;
174 struct in6_addr opt_prefix;
177 #define ND6_OPT_PI_L_BIT 0x80
178 #define ND6_OPT_PI_A_BIT 0x40
180 struct nd6_opt_mtu /* MTU option */
184 u_int16_t opt_reserved;
188 #endif /* netinet/icmpv6.h */