OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [include/] [netinet6/] [icmp6.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      include/netinet6_icmpv6.h
4
//
5
//      
6
//
7
//==========================================================================
8
//####BSDCOPYRIGHTBEGIN####
9
//
10
// -------------------------------------------
11
//
12
// Portions of this software may have been derived from OpenBSD or other sources,
13
// and are covered by the appropriate copyright disclaimers included herein.
14
//
15
// -------------------------------------------
16
//
17
//####BSDCOPYRIGHTEND####
18
//==========================================================================
19
//#####DESCRIPTIONBEGIN####
20
//
21
// Author(s):    gthomas
22
// Contributors: gthomas
23
// Date:         2000-01-10
24
// Purpose:      
25
// Description:  
26
//              
27
//
28
//####DESCRIPTIONEND####
29
//
30
//==========================================================================
31
 
32
 
33
/*      $OpenBSD: icmp6.h,v 1.2 1999/12/10 10:04:27 angelos Exp $       */
34
 
35
/*
36
 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
37
 * All rights reserved.
38
 *
39
 * Redistribution and use in source and binary forms, with or without
40
 * modification, are permitted provided that the following conditions
41
 * are met:
42
 * 1. Redistributions of source code must retain the above copyright
43
 *    notice, this list of conditions and the following disclaimer.
44
 * 2. Redistributions in binary form must reproduce the above copyright
45
 *    notice, this list of conditions and the following disclaimer in the
46
 *    documentation and/or other materials provided with the distribution.
47
 * 3. Neither the name of the project nor the names of its contributors
48
 *    may be used to endorse or promote products derived from this software
49
 *    without specific prior written permission.
50
 *
51
 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
52
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
53
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
54
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
55
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
56
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
57
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
59
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
60
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
61
 * SUCH DAMAGE.
62
 */
63
 
64
/*
65
 * Copyright (c) 1982, 1986, 1993
66
 *      The Regents of the University of California.  All rights reserved.
67
 *
68
 * Redistribution and use in source and binary forms, with or without
69
 * modification, are permitted provided that the following conditions
70
 * are met:
71
 * 1. Redistributions of source code must retain the above copyright
72
 *    notice, this list of conditions and the following disclaimer.
73
 * 2. Redistributions in binary form must reproduce the above copyright
74
 *    notice, this list of conditions and the following disclaimer in the
75
 *    documentation and/or other materials provided with the distribution.
76
 * 3. All advertising materials mentioning features or use of this software
77
 *    must display the following acknowledgement:
78
 *      This product includes software developed by the University of
79
 *      California, Berkeley and its contributors.
80
 * 4. Neither the name of the University nor the names of its contributors
81
 *    may be used to endorse or promote products derived from this software
82
 *    without specific prior written permission.
83
 *
84
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
85
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
86
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
87
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
88
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
89
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
90
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
91
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
92
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
93
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
94
 * SUCH DAMAGE.
95
 *
96
 *      @(#)ip_icmp.h   8.1 (Berkeley) 6/10/93
97
 */
98
 
99
#ifndef _NETINET6_ICMPV6_H_
100
#define _NETINET6_ICMPV6_H_
101
 
102
#define ICMPV6_PLD_MAXLEN       1232    /* IPV6_MMTU - sizeof(struct ip6_hdr)
103
                                           - sizeof(struct icmp6_hdr) */
104
 
105
struct icmp6_hdr {
106
        u_int8_t        icmp6_type;     /* type field */
107
        u_int8_t        icmp6_code;     /* code field */
108
        u_int16_t       icmp6_cksum;    /* checksum field */
109
        union {
110
                u_int32_t       icmp6_un_data32[1]; /* type-specific field */
111
                u_int16_t       icmp6_un_data16[2]; /* type-specific field */
112
                u_int8_t        icmp6_un_data8[4];  /* type-specific field */
113
        } icmp6_dataun;
114
};
115
 
116
#define icmp6_data32    icmp6_dataun.icmp6_un_data32
117
#define icmp6_data16    icmp6_dataun.icmp6_un_data16
118
#define icmp6_data8     icmp6_dataun.icmp6_un_data8
119
#define icmp6_pptr      icmp6_data32[0]         /* parameter prob */
120
#define icmp6_mtu       icmp6_data32[0]         /* packet too big */
121
#define icmp6_id        icmp6_data16[0]         /* echo request/reply */
122
#define icmp6_seq       icmp6_data16[1]         /* echo request/reply */
123
#define icmp6_maxdelay  icmp6_data16[0]         /* mcast group membership */
124
 
125
#define ICMP6_DST_UNREACH               1       /* dest unreachable, codes: */
126
#define ICMP6_PACKET_TOO_BIG            2       /* packet too big */
127
#define ICMP6_TIME_EXCEEDED             3       /* time exceeded, code: */
128
#define ICMP6_PARAM_PROB                4       /* ip6 header bad */
129
 
130
#define ICMP6_ECHO_REQUEST              128     /* echo service */
131
#define ICMP6_ECHO_REPLY                129     /* echo reply */
132
#define ICMP6_MEMBERSHIP_QUERY          130     /* group membership query */
133
#define MLD6_LISTENER_QUERY             130     /* multicast listener query */
134
#define ICMP6_MEMBERSHIP_REPORT         131     /* group membership report */
135
#define MLD6_LISTENER_REPORT            131     /* multicast listener report */
136
#define ICMP6_MEMBERSHIP_REDUCTION      132     /* group membership termination */
137
#define MLD6_LISTENER_DONE              132     /* multicast listener done */
138
 
139
#define ND_ROUTER_SOLICIT               133     /* router solicitation */
140
#define ND_ROUTER_ADVERT                134     /* router advertisment */
141
#define ND_NEIGHBOR_SOLICIT             135     /* neighbor solicitation */
142
#define ND_NEIGHBOR_ADVERT              136     /* neighbor advertisment */
143
#define ND_REDIRECT                     137     /* redirect */
144
 
145
#define ICMP6_ROUTER_RENUMBERING        138     /* router renumbering */
146
 
147
#define ICMP6_WRUREQUEST                139     /* who are you request */
148
#define ICMP6_WRUREPLY                  140     /* who are you reply */
149
#define ICMP6_FQDN_QUERY                139     /* FQDN query */
150
#define ICMP6_FQDN_REPLY                140     /* FQDN reply */
151
#define ICMP6_NI_QUERY                  139     /* node information request */
152
#define ICMP6_NI_REPLY                  140     /* node information reply */
153
 
154
/* The definitions below are experimental. TBA */
155
#define MLD6_MTRACE_RESP                141     /* mtrace response(to sender) */
156
#define MLD6_MTRACE                     142     /* mtrace messages */
157
 
158
#define ICMP6_MAXTYPE                   142
159
 
160
#define ICMP6_DST_UNREACH_NOROUTE       0        /* no route to destination */
161
#define ICMP6_DST_UNREACH_ADMIN         1       /* administratively prohibited */
162
#define ICMP6_DST_UNREACH_NOTNEIGHBOR   2       /* not a neighbor(obsolete) */
163
#define ICMP6_DST_UNREACH_BEYONDSCOPE   2       /* beyond scope of source address */
164
#define ICMP6_DST_UNREACH_ADDR          3       /* address unreachable */
165
#define ICMP6_DST_UNREACH_NOPORT        4       /* port unreachable */
166
 
167
#define ICMP6_TIME_EXCEED_TRANSIT       0        /* ttl==0 in transit */
168
#define ICMP6_TIME_EXCEED_REASSEMBLY    1       /* ttl==0 in reass */
169
 
170
#define ICMP6_PARAMPROB_HEADER          0        /* erroneous header field */
171
#define ICMP6_PARAMPROB_NEXTHEADER      1       /* unrecognized next header */
172
#define ICMP6_PARAMPROB_OPTION          2       /* unrecognized option */
173
 
174
#define ICMP6_INFOMSG_MASK              0x80    /* all informational messages */
175
 
176
#define ICMP6_NI_SUCESS         0        /* node information successful reply */
177
#define ICMP6_NI_REFUSED        1       /* node information request is refused */
178
#define ICMP6_NI_UNKNOWN        2       /* unknown Qtype */
179
 
180
#define ICMP6_ROUTER_RENUMBERING_COMMAND  0     /* rr command */
181
#define ICMP6_ROUTER_RENUMBERING_RESULT   1     /* rr result */
182
#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET   255     /* rr seq num reset */
183
 
184
/* Used in kernel only */
185
#define ND_REDIRECT_ONLINK      0        /* redirect to an on-link node */
186
#define ND_REDIRECT_ROUTER      1       /* redirect to a better router */
187
 
188
/*
189
 * Multicast Listener Discovery
190
 */
191
struct mld6_hdr {
192
        struct icmp6_hdr        mld6_hdr;
193
        struct in6_addr         mld6_addr; /* multicast address */
194
};
195
 
196
#define mld6_type       mld6_hdr.icmp6_type
197
#define mld6_code       mld6_hdr.icmp6_code
198
#define mld6_cksum      mld6_hdr.icmp6_cksum
199
#define mld6_maxdelay   mld6_hdr.icmp6_data16[0]
200
#define mld6_reserved   mld6_hdr.icmp6_data16[1]
201
 
202
/*
203
 * Neighbor Discovery
204
 */
205
 
206
struct nd_router_solicit {      /* router solicitation */
207
        struct icmp6_hdr        nd_rs_hdr;
208
        /* could be followed by options */
209
};
210
 
211
#define nd_rs_type      nd_rs_hdr.icmp6_type
212
#define nd_rs_code      nd_rs_hdr.icmp6_code
213
#define nd_rs_cksum     nd_rs_hdr.icmp6_cksum
214
#define nd_rs_reserved  nd_rs_hdr.icmp6_data32[0]
215
 
216
struct nd_router_advert {       /* router advertisement */
217
        struct icmp6_hdr        nd_ra_hdr;
218
        u_int32_t               nd_ra_reachable;        /* reachable time */
219
        u_int32_t               nd_ra_retransmit;       /* retransmit timer */
220
        /* could be followed by options */
221
};
222
 
223
#define nd_ra_type              nd_ra_hdr.icmp6_type
224
#define nd_ra_code              nd_ra_hdr.icmp6_code
225
#define nd_ra_cksum             nd_ra_hdr.icmp6_cksum
226
#define nd_ra_curhoplimit       nd_ra_hdr.icmp6_data8[0]
227
#define nd_ra_flags_reserved    nd_ra_hdr.icmp6_data8[1]
228
#define ND_RA_FLAG_MANAGED      0x80
229
#define ND_RA_FLAG_OTHER        0x40
230
#define nd_ra_router_lifetime   nd_ra_hdr.icmp6_data16[1]
231
 
232
struct nd_neighbor_solicit {    /* neighbor solicitation */
233
        struct icmp6_hdr        nd_ns_hdr;
234
        struct in6_addr         nd_ns_target;   /*target address */
235
        /* could be followed by options */
236
};
237
 
238
#define nd_ns_type              nd_ns_hdr.icmp6_type
239
#define nd_ns_code              nd_ns_hdr.icmp6_code
240
#define nd_ns_cksum             nd_ns_hdr.icmp6_cksum
241
#define nd_ns_reserved          nd_ns_hdr.icmp6_data32[0]
242
 
243
struct nd_neighbor_advert {     /* neighbor advertisement */
244
        struct icmp6_hdr        nd_na_hdr;
245
        struct in6_addr         nd_na_target;   /* target address */
246
        /* could be followed by options */
247
};
248
 
249
#define nd_na_type              nd_na_hdr.icmp6_type
250
#define nd_na_code              nd_na_hdr.icmp6_code
251
#define nd_na_cksum             nd_na_hdr.icmp6_cksum
252
#define nd_na_flags_reserved    nd_na_hdr.icmp6_data32[0]
253
#if BYTE_ORDER == BIG_ENDIAN
254
#define ND_NA_FLAG_ROUTER               0x80000000
255
#define ND_NA_FLAG_SOLICITED            0x40000000
256
#define ND_NA_FLAG_OVERRIDE             0x20000000
257
#else
258
#if BYTE_ORDER == LITTLE_ENDIAN
259
#define ND_NA_FLAG_ROUTER               0x80
260
#define ND_NA_FLAG_SOLICITED            0x40
261
#define ND_NA_FLAG_OVERRIDE             0x20
262
#endif
263
#endif
264
 
265
struct nd_redirect {            /* redirect */
266
        struct icmp6_hdr        nd_rd_hdr;
267
        struct in6_addr         nd_rd_target;   /* target address */
268
        struct in6_addr         nd_rd_dst;      /* destination address */
269
        /* could be followed by options */
270
};
271
 
272
#define nd_rd_type              nd_rd_hdr.icmp6_type
273
#define nd_rd_code              nd_rd_hdr.icmp6_code
274
#define nd_rd_cksum             nd_rd_hdr.icmp6_cksum
275
#define nd_rd_reserved          nd_rd_hdr.icmp6_data32[0]
276
 
277
struct nd_opt_hdr {             /* Neighbor discovery option header */
278
        u_int8_t        nd_opt_type;
279
        u_int8_t        nd_opt_len;
280
        /* followed by option specific data*/
281
};
282
 
283
#define ND_OPT_SOURCE_LINKADDR          1
284
#define ND_OPT_TARGET_LINKADDR          2
285
#define ND_OPT_PREFIX_INFORMATION       3
286
#define ND_OPT_REDIRECTED_HEADER        4
287
#define ND_OPT_MTU                      5
288
 
289
struct nd_opt_prefix_info {     /* prefix information */
290
        u_int8_t        nd_opt_pi_type;
291
        u_int8_t        nd_opt_pi_len;
292
        u_int8_t        nd_opt_pi_prefix_len;
293
        u_int8_t        nd_opt_pi_flags_reserved;
294
        u_int32_t       nd_opt_pi_valid_time;
295
        u_int32_t       nd_opt_pi_preferred_time;
296
        u_int32_t       nd_opt_pi_reserved2;
297
        struct in6_addr nd_opt_pi_prefix;
298
};
299
 
300
#define ND_OPT_PI_FLAG_ONLINK           0x80
301
#define ND_OPT_PI_FLAG_AUTO             0x40
302
 
303
struct nd_opt_rd_hdr {         /* redirected header */
304
        u_int8_t        nd_opt_rh_type;
305
        u_int8_t        nd_opt_rh_len;
306
        u_int16_t       nd_opt_rh_reserved1;
307
        u_int32_t       nd_opt_rh_reserved2;
308
        /* followed by IP header and data */
309
};
310
 
311
struct nd_opt_mtu {             /* MTU option */
312
        u_int8_t        nd_opt_mtu_type;
313
        u_int8_t        nd_opt_mtu_len;
314
        u_int16_t       nd_opt_mtu_reserved;
315
        u_int32_t       nd_opt_mtu_mtu;
316
};
317
 
318
/*
319
 * icmp6 namelookup
320
 */
321
 
322
struct icmp6_namelookup {
323
        struct icmp6_hdr        icmp6_nl_hdr;
324
        u_int64_t       icmp6_nl_nonce;
325
        u_int32_t       icmp6_nl_ttl;
326
#if 0
327
        u_int8_t        icmp6_nl_len;
328
        u_int8_t        icmp6_nl_name[3];
329
#endif
330
        /* could be followed by options */
331
};
332
 
333
/*
334
 * icmp6 node information
335
 */
336
struct icmp6_nodeinfo {
337
        struct icmp6_hdr icmp6_ni_hdr;
338
        u_int64_t icmp6_ni_nonce;
339
        /* could be followed by reply data */
340
};
341
 
342
#define ni_type         icmp6_ni_hdr.icmp6_type
343
#define ni_code         icmp6_ni_hdr.icmp6_code
344
#define ni_cksum        icmp6_ni_hdr.icmp6_cksum
345
#define ni_qtype        icmp6_ni_hdr.icmp6_data16[0]
346
#define ni_flags        icmp6_ni_hdr.icmp6_data16[1]
347
 
348
 
349
#define NI_QTYPE_NOOP           0 /* NOOP  */
350
#define NI_QTYPE_SUPTYPES       1 /* Supported Qtypes */
351
#define NI_QTYPE_FQDN           2 /* FQDN */
352
#define NI_QTYPE_NODEADDR       3 /* Node Addresses. XXX: spec says 2, but it may be a typo... */
353
 
354
#if BYTE_ORDER == BIG_ENDIAN
355
#define NI_SUPTYPE_FLAG_COMPRESS        0x1
356
#define NI_FQDN_FLAG_VALIDTTL           0x1
357
#define NI_NODEADDR_FLAG_LINKLOCAL      0x1
358
#define NI_NODEADDR_FLAG_SITELOCAL      0x2
359
#define NI_NODEADDR_FLAG_GLOBAL         0x4
360
#define NI_NODEADDR_FLAG_ALL            0x8
361
#define NI_NODEADDR_FLAG_TRUNCATE       0x10
362
#define NI_NODEADDR_FLAG_ANYCAST        0x20 /* just experimental. not in spec */
363
#elif BYTE_ORDER == LITTLE_ENDIAN
364
#define NI_SUPTYPE_FLAG_COMPRESS        0x0100
365
#define NI_FQDN_FLAG_VALIDTTL           0x0100
366
#define NI_NODEADDR_FLAG_LINKLOCAL      0x0100
367
#define NI_NODEADDR_FLAG_SITELOCAL      0x0200
368
#define NI_NODEADDR_FLAG_GLOBAL         0x0400
369
#define NI_NODEADDR_FLAG_ALL            0x0800
370
#define NI_NODEADDR_FLAG_TRUNCATE       0x1000
371
#define NI_NODEADDR_FLAG_ANYCAST        0x2000 /* just experimental. not in spec */
372
#endif
373
 
374
struct ni_reply_fqdn {
375
        u_int32_t ni_fqdn_ttl;  /* TTL */
376
        u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
377
        u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
378
};
379
 
380
/*
381
 * Router Renumbering. as router-renum-08.txt
382
 */
383
#if BYTE_ORDER == BIG_ENDIAN /* net byte order */
384
struct icmp6_router_renum {     /* router renumbering header */
385
        struct icmp6_hdr        rr_hdr;
386
        u_int8_t                rr_segnum;
387
        u_int8_t                rr_test : 1;
388
        u_int8_t                rr_reqresult : 1;
389
        u_int8_t                rr_forceapply : 1;
390
        u_int8_t                rr_specsite : 1;
391
        u_int8_t                rr_prevdone : 1;
392
        u_int8_t                rr_flags_reserved : 3;
393
        u_int16_t               rr_maxdelay;
394
        u_int32_t               rr_reserved;
395
};
396
#elif BYTE_ORDER == LITTLE_ENDIAN
397
struct icmp6_router_renum {     /* router renumbering header */
398
        struct icmp6_hdr        rr_hdr;
399
        u_int8_t                rr_segnum;
400
        u_int8_t                rr_flags_reserved : 3;
401
        u_int8_t                rr_prevdone : 1;
402
        u_int8_t                rr_specsite : 1;
403
        u_int8_t                rr_forceapply : 1;
404
        u_int8_t                rr_reqresult : 1;
405
        u_int8_t                rr_test : 1;
406
        u_int16_t               rr_maxdelay;
407
        u_int32_t               rr_reserved;
408
};
409
#endif /* BYTE_ORDER */
410
 
411
#define rr_type                 rr_hdr.icmp6_type
412
#define rr_code                 rr_hdr.icmp6_code
413
#define rr_cksum                rr_hdr.icmp6_cksum
414
#define rr_seqnum               rr_hdr.icmp6_data32[0]
415
 
416
struct rr_pco_match {           /* match prefix part */
417
        u_int8_t        rpm_code;
418
        u_int8_t        rpm_len;
419
        u_int8_t        rpm_ordinal;
420
        u_int8_t        rpm_matchlen;
421
        u_int8_t        rpm_minlen;
422
        u_int8_t        rpm_maxlen;
423
        u_int16_t       rpm_reserved;
424
        struct in6_addr rpm_prefix;
425
};
426
 
427
#define RPM_PCO_ADD             1
428
#define RPM_PCO_CHANGE          2
429
#define RPM_PCO_SETGLOBAL       3
430
#define RPM_PCO_MAX             4
431
 
432
#if BYTE_ORDER == BIG_ENDIAN /* net byte order */
433
struct rr_pco_use {             /* use prefix part */
434
        u_int8_t        rpu_uselen;
435
        u_int8_t        rpu_keeplen;
436
        u_int8_t        rpu_mask_onlink : 1;
437
        u_int8_t        rpu_mask_autonomous : 1;
438
        u_int8_t        rpu_mask_reserved : 6;
439
        u_int8_t        rpu_onlink : 1;
440
        u_int8_t        rpu_autonomous : 1;
441
        u_int8_t        rpu_raflags_reserved : 6;
442
        u_int32_t       rpu_vltime;
443
        u_int32_t       rpu_pltime;
444
        u_int32_t       rpu_decr_vltime : 1;
445
        u_int32_t       rpu_decr_pltime : 1;
446
        u_int32_t       rpu_flags_reserved : 6;
447
        u_int32_t       rpu_reserved : 24;
448
        struct in6_addr rpu_prefix;
449
};
450
#elif BYTE_ORDER == LITTLE_ENDIAN
451
struct rr_pco_use {             /* use prefix part */
452
        u_int8_t        rpu_uselen;
453
        u_int8_t        rpu_keeplen;
454
        u_int8_t        rpu_mask_reserved : 6;
455
        u_int8_t        rpu_mask_autonomous : 1;
456
        u_int8_t        rpu_mask_onlink : 1;
457
        u_int8_t        rpu_raflags_reserved : 6;
458
        u_int8_t        rpu_autonomous : 1;
459
        u_int8_t        rpu_onlink : 1;
460
        u_int32_t       rpu_vltime;
461
        u_int32_t       rpu_pltime;
462
        u_int32_t       rpu_flags_reserved : 6;
463
        u_int32_t       rpu_decr_pltime : 1;
464
        u_int32_t       rpu_decr_vltime : 1;
465
        u_int32_t       rpu_reserved : 24;
466
        struct in6_addr rpu_prefix;
467
};
468
#endif /* BYTE_ORDER */
469
 
470
#if BYTE_ORDER == BIG_ENDIAN /* net byte order */
471
struct rr_result {              /* router renumbering result message */
472
        u_int8_t        rrr_reserved;
473
        u_int8_t        rrr_flags_reserved : 6;
474
        u_int8_t        rrr_outofbound : 1;
475
        u_int8_t        rrr_forbidden : 1;
476
        u_int8_t        rrr_ordinal;
477
        u_int8_t        rrr_matchedlen;
478
        u_int32_t       rrr_ifid;
479
        struct in6_addr rrr_prefix;
480
};
481
#elif BYTE_ORDER == LITTLE_ENDIAN
482
struct rr_result {              /* router renumbering result message */
483
        u_int8_t        rrr_reserved;
484
        u_int8_t        rrr_forbidden : 1;
485
        u_int8_t        rrr_outofbound : 1;
486
        u_int8_t        rrr_flags_reserved : 6;
487
        u_int8_t        rrr_ordinal;
488
        u_int8_t        rrr_matchedlen;
489
        u_int32_t       rrr_ifid;
490
        struct in6_addr rrr_prefix;
491
};
492
#endif /* BYTE_ORDER */
493
 
494
/*
495
 * icmp6 filter structures.
496
 */
497
 
498
struct icmp6_filter {
499
        u_int32_t icmp6_filter[8];
500
};
501
 
502
#ifdef _KERNEL
503
#define ICMP6_FILTER_SETPASSALL(filterp) \
504
    {                                                           \
505
        int i; u_char *p;                                       \
506
        p = (u_char *)filterp;                                  \
507
        for (i = 0; i < sizeof(struct icmp6_filter); i++)        \
508
                p[i] = 0xff;                                    \
509
    }
510
#define ICMP6_FILTER_SETBLOCKALL(filterp) \
511
        bzero(filterp, sizeof(struct icmp6_filter))
512
#else /* _KERNEL */
513
#define ICMP6_FILTER_SETPASSALL(filterp) \
514
        memset(filterp, 0xff, sizeof(struct icmp6_filter))
515
#define ICMP6_FILTER_SETBLOCKALL(filterp) \
516
        memset(filterp, 0x00, sizeof(struct icmp6_filter))
517
#endif /* _KERNEL */
518
 
519
#define ICMP6_FILTER_SETPASS(type, filterp) \
520
        (((filterp)->icmp6_filter[(type) >> 5]) |= (1 << ((type) & 31)))
521
#define ICMP6_FILTER_SETBLOCK(type, filterp) \
522
        (((filterp)->icmp6_filter[(type) >> 5]) &= ~(1 << ((type) & 31)))
523
#define ICMP6_FILTER_WILLPASS(type, filterp) \
524
        ((((filterp)->icmp6_filter[(type) >> 5]) & (1 << ((type) & 31))) != 0)
525
#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
526
        ((((filterp)->icmp6_filter[(type) >> 5]) & (1 << ((type) & 31))) == 0)
527
 
528
/*
529
 * Variables related to this implementation
530
 * of the internet control message protocol version 6.
531
 */
532
struct icmp6stat {
533
/* statistics related to icmp6 packets generated */
534
        u_quad_t icp6s_error;           /* # of calls to icmp6_error */
535
        u_quad_t icp6s_canterror;       /* no error 'cuz old was icmp */
536
        u_quad_t icp6s_toofreq;         /* no error 'cuz rate limitation */
537
        u_quad_t icp6s_outhist[256];
538
/* statistics related to input message processed */
539
        u_quad_t icp6s_badcode;         /* icmp6_code out of range */
540
        u_quad_t icp6s_tooshort;        /* packet < sizeof(struct icmp6_hdr) */
541
        u_quad_t icp6s_checksum;        /* bad checksum */
542
        u_quad_t icp6s_badlen;          /* calculated bound mismatch */
543
        u_quad_t icp6s_reflect;         /* number of responses */
544
        u_quad_t icp6s_inhist[256];
545
        u_quad_t icp6s_nd_toomanyopt;   /* too many ND options */
546
};
547
 
548
/*
549
 * Names for ICMP sysctl objects
550
 */
551
#define ICMPV6CTL_STATS         1
552
#define ICMPV6CTL_REDIRACCEPT   2       /* accept/process redirects */
553
#define ICMPV6CTL_REDIRTIMEOUT  3       /* redirect cache time */
554
#define ICMPV6CTL_ERRRATELIMIT  5       /* ICMPv6 error rate limitation */
555
#define ICMPV6CTL_ND6_PRUNE     6
556
#define ICMPV6CTL_ND6_DELAY     8
557
#define ICMPV6CTL_ND6_UMAXTRIES 9
558
#define ICMPV6CTL_ND6_MMAXTRIES         10
559
#define ICMPV6CTL_ND6_USELOOPBACK       11
560
#define ICMPV6CTL_ND6_PROXYALL  12
561
#define ICMPV6CTL_MAXID         13
562
 
563
#define ICMPV6CTL_NAMES { \
564
        { 0, 0 }, \
565
        { 0, 0 }, \
566
        { "rediraccept", CTLTYPE_INT }, \
567
        { "redirtimeout", CTLTYPE_INT }, \
568
        { 0, 0 }, \
569
        { "errratelimit", CTLTYPE_INT }, \
570
        { "nd6_prune", CTLTYPE_INT }, \
571
        { 0, 0 }, \
572
        { "nd6_delay", CTLTYPE_INT }, \
573
        { "nd6_umaxtries", CTLTYPE_INT }, \
574
        { "nd6_mmaxtries", CTLTYPE_INT }, \
575
        { "nd6_useloopback", CTLTYPE_INT }, \
576
        { "nd6_proxyall", CTLTYPE_INT }, \
577
}
578
 
579
#define ICMPV6CTL_VARS { \
580
        0, \
581
        0, \
582
        &icmp6_rediraccept,   \
583
        &icmp6_redirtimeout,  \
584
        0, \
585
        0, \
586
        &icmp6errratelim, \
587
        &nd6_prune,     \
588
        0, \
589
        &nd6_delay,     \
590
        &nd6_umaxtries, \
591
        &nd6_mmaxtries, \
592
        &nd6_useloopback, \
593
        &nd6_proxyall, \
594
}
595
 
596
#define RTF_PROBEMTU    RTF_PROTO1
597
 
598
#ifdef _KERNEL
599
# ifdef __STDC__
600
struct  rtentry;
601
struct  rttimer;
602
struct  in6_multi;
603
# endif
604
void    icmp6_init __P((void));
605
void    icmp6_paramerror __P((struct mbuf *, int));
606
void    icmp6_error __P((struct mbuf *, int, int, int));
607
int     icmp6_input __P((struct mbuf **, int *, int));
608
void    icmp6_fasttimo __P((void));
609
void    icmp6_reflect __P((struct mbuf *, size_t));
610
void    icmp6_prepare __P((struct mbuf *));
611
void    icmp6_redirect_input __P((struct mbuf *, int));
612
void    icmp6_redirect_output __P((struct mbuf *, struct rtentry *));
613
int     icmp6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
614
 
615
/* XXX: is this the right place for these macros? */
616
#define icmp6_ifstat_inc(ifp, tag) \
617
do {                                                            \
618
        if ((ifp) && (ifp)->if_index <= if_index                        \
619
         && (ifp)->if_index < icmp6_ifstatmax                   \
620
         && icmp6_ifstat && icmp6_ifstat[(ifp)->if_index]) {    \
621
                icmp6_ifstat[(ifp)->if_index]->tag++;           \
622
        }                                                       \
623
} while (0)
624
 
625
#define icmp6_ifoutstat_inc(ifp, type, code) \
626
do { \
627
                icmp6_ifstat_inc(ifp, ifs6_out_msg); \
628
                if (type < ICMP6_INFOMSG_MASK) \
629
                        icmp6_ifstat_inc(ifp, ifs6_out_error); \
630
                switch(type) { \
631
                 case ICMP6_DST_UNREACH: \
632
                         icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
633
                         if (code == ICMP6_DST_UNREACH_ADMIN) \
634
                                 icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
635
                         break; \
636
                 case ICMP6_PACKET_TOO_BIG: \
637
                         icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
638
                         break; \
639
                 case ICMP6_TIME_EXCEEDED: \
640
                         icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
641
                         break; \
642
                 case ICMP6_PARAM_PROB: \
643
                         icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
644
                         break; \
645
                 case ICMP6_ECHO_REQUEST: \
646
                         icmp6_ifstat_inc(ifp, ifs6_out_echo); \
647
                         break; \
648
                 case ICMP6_ECHO_REPLY: \
649
                         icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
650
                         break; \
651
                 case MLD6_LISTENER_QUERY: \
652
                         icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
653
                         break; \
654
                 case MLD6_LISTENER_REPORT: \
655
                         icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
656
                         break; \
657
                 case MLD6_LISTENER_DONE: \
658
                         icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
659
                         break; \
660
                 case ND_ROUTER_SOLICIT: \
661
                         icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
662
                         break; \
663
                 case ND_ROUTER_ADVERT: \
664
                         icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
665
                         break; \
666
                 case ND_NEIGHBOR_SOLICIT: \
667
                         icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
668
                         break; \
669
                 case ND_NEIGHBOR_ADVERT: \
670
                         icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
671
                         break; \
672
                 case ND_REDIRECT: \
673
                         icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
674
                         break; \
675
                } \
676
} while (0)
677
 
678
extern int      icmp6_rediraccept;      /* accept/process redirects */
679
extern int      icmp6_redirtimeout;     /* cache time for redirect routes */
680
#endif /* _KERNEL */
681
 
682
#endif /* not _NETINET6_ICMPV6_H_ */
683
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.