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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [bsd_tcpip/] [current/] [include/] [netinet6/] [in6_var.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      include/netinet6/in6_var.h
4
//
5
//==========================================================================
6
// ####BSDCOPYRIGHTBEGIN####                                    
7
// -------------------------------------------                  
8
// This file is part of eCos, the Embedded Configurable Operating System.
9
//
10
// Portions of this software may have been derived from FreeBSD 
11
// or other sources, and if so are covered by the appropriate copyright
12
// and license included herein.                                 
13
//
14
// Portions created by the Free Software Foundation are         
15
// Copyright (C) 2002 Free Software Foundation, Inc.            
16
// -------------------------------------------                  
17
// ####BSDCOPYRIGHTEND####                                      
18
//==========================================================================
19
 
20
/*      $KAME: in6_var.h,v 1.74 2001/12/24 10:39:30 jinmei Exp $        */
21
 
22
/*
23
 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
24
 * All rights reserved.
25
 *
26
 * Redistribution and use in source and binary forms, with or without
27
 * modification, are permitted provided that the following conditions
28
 * are met:
29
 * 1. Redistributions of source code must retain the above copyright
30
 *    notice, this list of conditions and the following disclaimer.
31
 * 2. Redistributions in binary form must reproduce the above copyright
32
 *    notice, this list of conditions and the following disclaimer in the
33
 *    documentation and/or other materials provided with the distribution.
34
 * 3. Neither the name of the project nor the names of its contributors
35
 *    may be used to endorse or promote products derived from this software
36
 *    without specific prior written permission.
37
 *
38
 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
39
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
41
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
42
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
44
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
45
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
46
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
47
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48
 * SUCH DAMAGE.
49
 */
50
 
51
/*
52
 * Copyright (c) 1985, 1986, 1993
53
 *      The Regents of the University of California.  All rights reserved.
54
 *
55
 * Redistribution and use in source and binary forms, with or without
56
 * modification, are permitted provided that the following conditions
57
 * are met:
58
 * 1. Redistributions of source code must retain the above copyright
59
 *    notice, this list of conditions and the following disclaimer.
60
 * 2. Redistributions in binary form must reproduce the above copyright
61
 *    notice, this list of conditions and the following disclaimer in the
62
 *    documentation and/or other materials provided with the distribution.
63
 * 3. All advertising materials mentioning features or use of this software
64
 *    must display the following acknowledgement:
65
 *      This product includes software developed by the University of
66
 *      California, Berkeley and its contributors.
67
 * 4. Neither the name of the University nor the names of its contributors
68
 *    may be used to endorse or promote products derived from this software
69
 *    without specific prior written permission.
70
 *
71
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
72
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
73
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
74
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
75
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
76
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
77
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
78
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
79
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
80
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
81
 * SUCH DAMAGE.
82
 *
83
 *      @(#)in_var.h    8.1 (Berkeley) 6/10/93
84
 */
85
 
86
#ifndef _NETINET6_IN6_VAR_H_
87
#define _NETINET6_IN6_VAR_H_
88
 
89
/*
90
 * Interface address, Internet version.  One of these structures
91
 * is allocated for each interface with an Internet address.
92
 * The ifaddr structure contains the protocol-independent part
93
 * of the structure and is assumed to be first.
94
 */
95
 
96
/*
97
 * pltime/vltime are just for future reference (required to implements 2
98
 * hour rule for hosts).  they should never be modified by nd6_timeout or
99
 * anywhere else.
100
 *      userland -> kernel: accept pltime/vltime
101
 *      kernel -> userland: throw up everything
102
 *      in kernel: modify preferred/expire only
103
 */
104
struct in6_addrlifetime {
105
        time_t ia6t_expire;     /* valid lifetime expiration time */
106
        time_t ia6t_preferred;  /* preferred lifetime expiration time */
107
        u_int32_t ia6t_vltime;  /* valid lifetime */
108
        u_int32_t ia6t_pltime;  /* prefix lifetime */
109
};
110
 
111
#ifdef MEASURE_PERFORMANCE
112
/*
113
 * Structure for hashing "local" IPv6 addresses for lookup in IPv6 input.
114
 */
115
struct in6hash {
116
        struct  in6hash *in6h_next;
117
        struct  in6_addr in6h_addr;
118
        struct  in6_ifaddr *in6h_ifa;
119
        int     in6h_flags;
120
        int     in6h_hit;       /* number of hits for this entry */
121
        int     in6h_miss;      /* number of failures for this entry */
122
};
123
#endif
124
 
125
struct  in6_ifaddr {
126
        struct  ifaddr ia_ifa;          /* protocol-independent info */
127
#define ia_ifp          ia_ifa.ifa_ifp
128
#define ia_flags        ia_ifa.ifa_flags
129
        struct  sockaddr_in6 ia_addr;   /* interface address */
130
        struct  sockaddr_in6 ia_net;    /* network number of interface */
131
        struct  sockaddr_in6 ia_dstaddr; /* space for destination addr */
132
        struct  sockaddr_in6 ia_prefixmask; /* prefix mask */
133
        u_int32_t ia_plen;              /* prefix length */
134
        struct  in6_ifaddr *ia_next;    /* next in6 list of IP6 addresses */
135
#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
136
        LIST_HEAD(in6_multihead, in6_multi) ia6_multiaddrs;
137
                                        /* list of multicast addresses */
138
#endif
139
        int     ia6_flags;
140
 
141
        struct in6_addrlifetime ia6_lifetime;
142
        time_t  ia6_createtime; /* the creation time of this address, which is
143
                                 * currently used for temporary addresses only.
144
                                 */
145
        time_t  ia6_updatetime;
146
 
147
        /* back pointer to the ND prefix (for autoconfigured addresses only) */
148
        struct nd_prefix *ia6_ndpr;
149
 
150
#ifdef MEASURE_PERFORMANCE
151
        struct in6hash ia6_hash;        /* hash for ia_addr */
152
#endif
153
 
154
        /* multicast addresses joined from the kernel */
155
        LIST_HEAD(, in6_multi_mship) ia6_memberships;
156
};
157
 
158
/* control structure to manage address selection policy */
159
struct in6_addrpolicy {
160
        struct sockaddr_in6 addr; /* prefix address */
161
        struct sockaddr_in6 addrmask; /* prefix mask */
162
        int preced;             /* precedence */
163
        int label;              /* matching label */
164
        u_quad_t use;           /* statistics */
165
};
166
 
167
/*
168
 * IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12).
169
 */
170
struct in6_ifstat {
171
        u_quad_t ifs6_in_receive;       /* # of total input datagram */
172
        u_quad_t ifs6_in_hdrerr;        /* # of datagrams with invalid hdr */
173
        u_quad_t ifs6_in_toobig;        /* # of datagrams exceeded MTU */
174
        u_quad_t ifs6_in_noroute;       /* # of datagrams with no route */
175
        u_quad_t ifs6_in_addrerr;       /* # of datagrams with invalid dst */
176
        u_quad_t ifs6_in_protounknown;  /* # of datagrams with unknown proto */
177
                                        /* NOTE: increment on final dst if */
178
        u_quad_t ifs6_in_truncated;     /* # of truncated datagrams */
179
        u_quad_t ifs6_in_discard;       /* # of discarded datagrams */
180
                                        /* NOTE: fragment timeout is not here */
181
        u_quad_t ifs6_in_deliver;       /* # of datagrams delivered to ULP */
182
                                        /* NOTE: increment on final dst if */
183
        u_quad_t ifs6_out_forward;      /* # of datagrams forwarded */
184
                                        /* NOTE: increment on outgoing if */
185
        u_quad_t ifs6_out_request;      /* # of outgoing datagrams from ULP */
186
                                        /* NOTE: does not include forwrads */
187
        u_quad_t ifs6_out_discard;      /* # of discarded datagrams */
188
        u_quad_t ifs6_out_fragok;       /* # of datagrams fragmented */
189
        u_quad_t ifs6_out_fragfail;     /* # of datagrams failed on fragment */
190
        u_quad_t ifs6_out_fragcreat;    /* # of fragment datagrams */
191
                                        /* NOTE: this is # after fragment */
192
        u_quad_t ifs6_reass_reqd;       /* # of incoming fragmented packets */
193
                                        /* NOTE: increment on final dst if */
194
        u_quad_t ifs6_reass_ok;         /* # of reassembled packets */
195
                                        /* NOTE: this is # after reass */
196
                                        /* NOTE: increment on final dst if */
197
        u_quad_t ifs6_reass_fail;       /* # of reass failures */
198
                                        /* NOTE: may not be packet count */
199
                                        /* NOTE: increment on final dst if */
200
        u_quad_t ifs6_in_mcast;         /* # of inbound multicast datagrams */
201
        u_quad_t ifs6_out_mcast;        /* # of outbound multicast datagrams */
202
};
203
 
204
/*
205
 * ICMPv6 interface statistics, as defined in RFC2466 Ipv6IfIcmpEntry.
206
 * XXX: I'm not sure if this file is the right place for this structure...
207
 */
208
struct icmp6_ifstat {
209
        /*
210
         * Input statistics
211
         */
212
        /* ipv6IfIcmpInMsgs, total # of input messages */
213
        u_quad_t ifs6_in_msg;
214
        /* ipv6IfIcmpInErrors, # of input error messages */
215
        u_quad_t ifs6_in_error;
216
        /* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */
217
        u_quad_t ifs6_in_dstunreach;
218
        /* ipv6IfIcmpInAdminProhibs, # of input administratively prohibited errs */
219
        u_quad_t ifs6_in_adminprohib;
220
        /* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */
221
        u_quad_t ifs6_in_timeexceed;
222
        /* ipv6IfIcmpInParmProblems, # of input parameter problem errors */
223
        u_quad_t ifs6_in_paramprob;
224
        /* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */
225
        u_quad_t ifs6_in_pkttoobig;
226
        /* ipv6IfIcmpInEchos, # of input echo requests */
227
        u_quad_t ifs6_in_echo;
228
        /* ipv6IfIcmpInEchoReplies, # of input echo replies */
229
        u_quad_t ifs6_in_echoreply;
230
        /* ipv6IfIcmpInRouterSolicits, # of input router solicitations */
231
        u_quad_t ifs6_in_routersolicit;
232
        /* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */
233
        u_quad_t ifs6_in_routeradvert;
234
        /* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */
235
        u_quad_t ifs6_in_neighborsolicit;
236
        /* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advertisements */
237
        u_quad_t ifs6_in_neighboradvert;
238
        /* ipv6IfIcmpInRedirects, # of input redirects */
239
        u_quad_t ifs6_in_redirect;
240
        /* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */
241
        u_quad_t ifs6_in_mldquery;
242
        /* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */
243
        u_quad_t ifs6_in_mldreport;
244
        /* ipv6IfIcmpInGroupMembReductions, # of input MLD done */
245
        u_quad_t ifs6_in_mlddone;
246
 
247
        /*
248
         * Output statistics. We should solve unresolved routing problem...
249
         */
250
        /* ipv6IfIcmpOutMsgs, total # of output messages */
251
        u_quad_t ifs6_out_msg;
252
        /* ipv6IfIcmpOutErrors, # of output error messages */
253
        u_quad_t ifs6_out_error;
254
        /* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */
255
        u_quad_t ifs6_out_dstunreach;
256
        /* ipv6IfIcmpOutAdminProhibs, # of output administratively prohibited errs */
257
        u_quad_t ifs6_out_adminprohib;
258
        /* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */
259
        u_quad_t ifs6_out_timeexceed;
260
        /* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */
261
        u_quad_t ifs6_out_paramprob;
262
        /* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */
263
        u_quad_t ifs6_out_pkttoobig;
264
        /* ipv6IfIcmpOutEchos, # of output echo requests */
265
        u_quad_t ifs6_out_echo;
266
        /* ipv6IfIcmpOutEchoReplies, # of output echo replies */
267
        u_quad_t ifs6_out_echoreply;
268
        /* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */
269
        u_quad_t ifs6_out_routersolicit;
270
        /* ipv6IfIcmpOutRouterAdvertisements, # of output router advertisements */
271
        u_quad_t ifs6_out_routeradvert;
272
        /* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */
273
        u_quad_t ifs6_out_neighborsolicit;
274
        /* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advertisements */
275
        u_quad_t ifs6_out_neighboradvert;
276
        /* ipv6IfIcmpOutRedirects, # of output redirects */
277
        u_quad_t ifs6_out_redirect;
278
        /* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */
279
        u_quad_t ifs6_out_mldquery;
280
        /* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */
281
        u_quad_t ifs6_out_mldreport;
282
        /* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */
283
        u_quad_t ifs6_out_mlddone;
284
};
285
 
286
struct  in6_ifreq {
287
        char    ifr_name[IFNAMSIZ];
288
        union {
289
                struct  sockaddr_in6 ifru_addr;
290
                struct  sockaddr_in6 ifru_dstaddr;
291
                short   ifru_flags;
292
                int     ifru_flags6;
293
                int     ifru_metric;
294
                caddr_t ifru_data;
295
                struct in6_addrlifetime ifru_lifetime;
296
                struct in6_ifstat ifru_stat;
297
                struct icmp6_ifstat ifru_icmp6stat;
298
                u_int32_t ifru_scope_id[16];
299
        } ifr_ifru;
300
};
301
 
302
struct  in6_aliasreq {
303
        char    ifra_name[IFNAMSIZ];
304
        struct  sockaddr_in6 ifra_addr;
305
        struct  sockaddr_in6 ifra_dstaddr;
306
        struct  sockaddr_in6 ifra_prefixmask;
307
        int     ifra_flags;
308
        struct in6_addrlifetime ifra_lifetime;
309
};
310
 
311
/* prefix type macro */
312
#define IN6_PREFIX_ND   1
313
#define IN6_PREFIX_RR   2
314
 
315
/*
316
 * prefix related flags passed between kernel(NDP related part) and
317
 * user land command(ifconfig) and daemon(rtadvd).
318
 */
319
struct in6_prflags {
320
        struct prf_ra {
321
                u_char onlink : 1;
322
                u_char autonomous : 1;
323
                u_char router : 1;
324
                u_char reserved : 5;
325
        } prf_ra;
326
        u_char prf_reserved1;
327
        u_short prf_reserved2;
328
        /* want to put this on 4byte offset */
329
        struct prf_rr {
330
                u_char decrvalid : 1;
331
                u_char decrprefd : 1;
332
                u_char reserved : 6;
333
        } prf_rr;
334
        u_char prf_reserved3;
335
        u_short prf_reserved4;
336
};
337
 
338
struct  in6_prefixreq {
339
        char    ipr_name[IFNAMSIZ];
340
        u_char  ipr_origin;
341
        u_char  ipr_plen;
342
        u_int32_t ipr_vltime;
343
        u_int32_t ipr_pltime;
344
        struct in6_prflags ipr_flags;
345
        struct  sockaddr_in6 ipr_prefix;
346
};
347
 
348
#define PR_ORIG_RA      0
349
#define PR_ORIG_RR      1
350
#define PR_ORIG_STATIC  2
351
#define PR_ORIG_KERNEL  3
352
 
353
#define ipr_raf_onlink          ipr_flags.prf_ra.onlink
354
#define ipr_raf_auto            ipr_flags.prf_ra.autonomous
355
 
356
#define ipr_statef_onlink       ipr_flags.prf_state.onlink
357
 
358
#define ipr_rrf_decrvalid       ipr_flags.prf_rr.decrvalid
359
#define ipr_rrf_decrprefd       ipr_flags.prf_rr.decrprefd
360
 
361
struct  in6_rrenumreq {
362
        char    irr_name[IFNAMSIZ];
363
        u_char  irr_origin;
364
        u_char  irr_m_len;      /* match len for matchprefix */
365
        u_char  irr_m_minlen;   /* minlen for matching prefix */
366
        u_char  irr_m_maxlen;   /* maxlen for matching prefix */
367
        u_char  irr_u_uselen;   /* uselen for adding prefix */
368
        u_char  irr_u_keeplen;  /* keeplen from matching prefix */
369
        struct irr_raflagmask {
370
                u_char onlink : 1;
371
                u_char autonomous : 1;
372
                u_char reserved : 6;
373
        } irr_raflagmask;
374
        u_int32_t irr_vltime;
375
        u_int32_t irr_pltime;
376
        struct in6_prflags irr_flags;
377
        struct  sockaddr_in6 irr_matchprefix;
378
        struct  sockaddr_in6 irr_useprefix;
379
};
380
 
381
#define irr_raf_mask_onlink     irr_raflagmask.onlink
382
#define irr_raf_mask_auto       irr_raflagmask.autonomous
383
#define irr_raf_mask_reserved   irr_raflagmask.reserved
384
 
385
#define irr_raf_onlink          irr_flags.prf_ra.onlink
386
#define irr_raf_auto            irr_flags.prf_ra.autonomous
387
 
388
#define irr_statef_onlink       irr_flags.prf_state.onlink
389
 
390
#define irr_rrf                 irr_flags.prf_rr
391
#define irr_rrf_decrvalid       irr_flags.prf_rr.decrvalid
392
#define irr_rrf_decrprefd       irr_flags.prf_rr.decrprefd
393
 
394
/*
395
 * Given a pointer to an in6_ifaddr (ifaddr),
396
 * return a pointer to the addr as a sockaddr_in6
397
 */
398
#define IA6_IN6(ia)     (&((ia)->ia_addr.sin6_addr))
399
#define IA6_DSTIN6(ia)  (&((ia)->ia_dstaddr.sin6_addr))
400
#define IA6_MASKIN6(ia) (&((ia)->ia_prefixmask.sin6_addr))
401
#define IA6_SIN6(ia)    (&((ia)->ia_addr))
402
#define IA6_DSTSIN6(ia) (&((ia)->ia_dstaddr))
403
#define IFA_IN6(x)      (&((struct sockaddr_in6 *)((x)->ifa_addr))->sin6_addr)
404
#define IFA_DSTIN6(x)   (&((struct sockaddr_in6 *)((x)->ifa_dstaddr))->sin6_addr)
405
 
406
#ifdef _KERNEL
407
#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m)      (       \
408
        (((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \
409
        (((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \
410
        (((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \
411
        (((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 )
412
#endif
413
 
414
#define SIOCSIFADDR_IN6          _IOW('i', 12, struct in6_ifreq)
415
#define SIOCGIFADDR_IN6         _IOWR('i', 33, struct in6_ifreq)
416
 
417
#ifdef _KERNEL
418
/*
419
 * SIOCSxxx ioctls should be unused (see comments in in6.c), but
420
 * we do not shift numbers for binary compatibility.
421
 */
422
#define SIOCSIFDSTADDR_IN6       _IOW('i', 14, struct in6_ifreq)
423
#define SIOCSIFNETMASK_IN6       _IOW('i', 22, struct in6_ifreq)
424
#endif
425
 
426
#define SIOCGIFDSTADDR_IN6      _IOWR('i', 34, struct in6_ifreq)
427
#define SIOCGIFNETMASK_IN6      _IOWR('i', 37, struct in6_ifreq)
428
 
429
#define SIOCDIFADDR_IN6          _IOW('i', 25, struct in6_ifreq)
430
#define SIOCAIFADDR_IN6          _IOW('i', 26, struct in6_aliasreq)
431
 
432
#define SIOCSIFPHYADDR_IN6       _IOW('i', 70, struct in6_aliasreq)
433
#define SIOCGIFPSRCADDR_IN6     _IOWR('i', 71, struct in6_ifreq)
434
#define SIOCGIFPDSTADDR_IN6     _IOWR('i', 72, struct in6_ifreq)
435
 
436
#define SIOCGIFAFLAG_IN6        _IOWR('i', 73, struct in6_ifreq)
437
 
438
#define SIOCGDRLST_IN6          _IOWR('i', 74, struct in6_drlist)
439
#define SIOCGPRLST_IN6          _IOWR('i', 75, struct in6_oprlist)
440
#ifdef _KERNEL
441
#define OSIOCGIFINFO_IN6        _IOWR('i', 76, struct in6_ondireq)
442
#endif
443
#define SIOCGIFINFO_IN6         _IOWR('i', 108, struct in6_ndireq)
444
#define SIOCSNDFLUSH_IN6        _IOWR('i', 77, struct in6_ifreq)
445
#define SIOCGNBRINFO_IN6        _IOWR('i', 78, struct in6_nbrinfo)
446
#define SIOCSPFXFLUSH_IN6       _IOWR('i', 79, struct in6_ifreq)
447
#define SIOCSRTRFLUSH_IN6       _IOWR('i', 80, struct in6_ifreq)
448
 
449
#define SIOCGIFALIFETIME_IN6    _IOWR('i', 81, struct in6_ifreq)
450
#define SIOCSIFALIFETIME_IN6    _IOWR('i', 82, struct in6_ifreq)
451
#define SIOCGIFSTAT_IN6         _IOWR('i', 83, struct in6_ifreq)
452
#define SIOCGIFSTAT_ICMP6       _IOWR('i', 84, struct in6_ifreq)
453
 
454
#define SIOCSDEFIFACE_IN6       _IOWR('i', 85, struct in6_ndifreq)
455
#define SIOCGDEFIFACE_IN6       _IOWR('i', 86, struct in6_ndifreq)
456
 
457
#define SIOCSIFINFO_FLAGS       _IOWR('i', 87, struct in6_ndireq) /* XXX */
458
 
459
#define SIOCSSCOPE6             _IOW('i', 88, struct in6_ifreq)
460
#define SIOCGSCOPE6             _IOWR('i', 89, struct in6_ifreq)
461
#define SIOCGSCOPE6DEF          _IOWR('i', 90, struct in6_ifreq)
462
 
463
#define SIOCSIFPREFIX_IN6       _IOW('i', 100, struct in6_prefixreq) /* set */
464
#define SIOCGIFPREFIX_IN6       _IOWR('i', 101, struct in6_prefixreq) /* get */
465
#define SIOCDIFPREFIX_IN6       _IOW('i', 102, struct in6_prefixreq) /* del */
466
#define SIOCAIFPREFIX_IN6       _IOW('i', 103, struct in6_rrenumreq) /* add */
467
#define SIOCCIFPREFIX_IN6       _IOW('i', 104, \
468
                                     struct in6_rrenumreq) /* change */
469
#define SIOCSGIFPREFIX_IN6      _IOW('i', 105, \
470
                                     struct in6_rrenumreq) /* set global */
471
 
472
#define SIOCGETSGCNT_IN6        _IOWR('u', 106, \
473
                                      struct sioc_sg_req6) /* get s,g pkt cnt */
474
#define SIOCGETMIFCNT_IN6       _IOWR('u', 107, \
475
                                      struct sioc_mif_req6) /* get pkt cnt per if */
476
 
477
#define SIOCAADDRCTL_POLICY     _IOW('u', 108, struct in6_addrpolicy)
478
#define SIOCDADDRCTL_POLICY     _IOW('u', 109, struct in6_addrpolicy)
479
 
480
#define IN6_IFF_ANYCAST         0x01    /* anycast address */
481
#define IN6_IFF_TENTATIVE       0x02    /* tentative address */
482
#define IN6_IFF_DUPLICATED      0x04    /* DAD detected duplicate */
483
#define IN6_IFF_DETACHED        0x08    /* may be detached from the link */
484
#define IN6_IFF_DEPRECATED      0x10    /* deprecated address */
485
#define IN6_IFF_NODAD           0x20    /* don't perform DAD on this address
486
                                         * (used only at first SIOC* call)
487
                                         */
488
#define IN6_IFF_AUTOCONF        0x40    /* autoconfigurable address. */
489
#define IN6_IFF_TEMPORARY       0x80    /* temporary (anonymous) address. */
490
#define IN6_IFF_HOME            0x100   /* MIP6 home address. */
491
 
492
/* do not input/output */
493
#define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)
494
 
495
#ifdef _KERNEL
496
#define IN6_ARE_SCOPE_CMP(a,b) ((a)-(b))
497
#define IN6_ARE_SCOPE_EQUAL(a,b) ((a)==(b))
498
#endif
499
 
500
#ifdef _KERNEL
501
extern struct in6_ifaddr *in6_ifaddr;
502
 
503
extern struct in6_ifstat **in6_ifstat;
504
extern size_t in6_ifstatmax;
505
extern struct icmp6stat icmp6stat;
506
extern struct icmp6_ifstat **icmp6_ifstat;
507
extern size_t icmp6_ifstatmax;
508
#define in6_ifstat_inc(ifp, tag) \
509
do {                                                            \
510
        if ((ifp) && (ifp)->if_index <= if_index                \
511
         && (ifp)->if_index < in6_ifstatmax                     \
512
         && in6_ifstat && in6_ifstat[(ifp)->if_index]) {        \
513
                in6_ifstat[(ifp)->if_index]->tag++;             \
514
        }                                                       \
515
} while (0)
516
 
517
extern struct ifqueue ip6intrq;         /* IP6 packet input queue */
518
extern struct in6_addr zeroin6_addr;
519
extern int inet6ctlerrmap[];
520
extern unsigned long in6_maxmtu;
521
 
522
/*
523
 * Macro for finding the internet address structure (in6_ifaddr) corresponding
524
 * to a given interface (ifnet structure).
525
 */
526
#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
527
 
528
#define IFP_TO_IA6(ifp, ia)                             \
529
/* struct ifnet *ifp; */                                \
530
/* struct in6_ifaddr *ia; */                            \
531
do {                                                                    \
532
        struct ifaddr *ifa;                                             \
533
        for (ifa = (ifp)->if_addrlist; ifa; ifa = ifa->ifa_next) {      \
534
                if (!ifa->ifa_addr)                                     \
535
                        continue;                                       \
536
                if (ifa->ifa_addr->sa_family == AF_INET6)               \
537
                        break;                                          \
538
        }                                                               \
539
        (ia) = (struct in6_ifaddr *)ifa;                                \
540
} while (0)
541
 
542
#else
543
 
544
#define IFP_TO_IA6(ifp, ia)                             \
545
/* struct ifnet *ifp; */                                \
546
/* struct in6_ifaddr *ia; */                            \
547
do {                                                                    \
548
        struct ifaddr *ifa;                                             \
549
        for (ifa = (ifp)->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) {   \
550
                if (!ifa->ifa_addr)                                     \
551
                        continue;                                       \
552
                if (ifa->ifa_addr->sa_family == AF_INET6)               \
553
                        break;                                          \
554
        }                                                               \
555
        (ia) = (struct in6_ifaddr *)ifa;                                \
556
} while (0)
557
#endif
558
 
559
#endif /* _KERNEL */
560
 
561
/*
562
 * Multi-cast membership entry.  One for each group/ifp that a PCB
563
 * belongs to.
564
 */
565
struct in6_multi_mship {
566
        struct  in6_multi *i6mm_maddr;  /* Multicast address pointer */
567
        LIST_ENTRY(in6_multi_mship) i6mm_chain;  /* multicast options chain */
568
};
569
 
570
struct  in6_multi {
571
        LIST_ENTRY(in6_multi) in6m_entry; /* list glue */
572
        struct  in6_addr in6m_addr;     /* IP6 multicast address */
573
        struct  ifnet *in6m_ifp;        /* back pointer to ifnet */
574
#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
575
        struct  in6_ifaddr *in6m_ia;    /* back pointer to in6_ifaddr */
576
#else
577
        struct  ifmultiaddr *in6m_ifma; /* back pointer to ifmultiaddr */
578
#endif
579
        u_int   in6m_refcount;          /* # membership claims by sockets */
580
        u_int   in6m_state;             /* state of the membership */
581
        u_int   in6m_timer;             /* MLD6 listener report timer */
582
};
583
 
584
#ifdef _KERNEL
585
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
586
extern LIST_HEAD(in6_multihead, in6_multi) in6_multihead;
587
#endif
588
 
589
/*
590
 * Structure used by macros below to remember position when stepping through
591
 * all of the in6_multi records.
592
 */
593
struct  in6_multistep {
594
        struct  in6_ifaddr *i_ia;
595
        struct  in6_multi *i_in6m;
596
};
597
 
598
/*
599
 * Macros for looking up the in6_multi record for a given IP6 multicast
600
 * address on a given interface. If no matching record is found, "in6m"
601
 * returns NLL.
602
 */
603
 
604
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
605
 
606
#define IN6_LOOKUP_MULTI(addr, ifp, in6m)                       \
607
/* struct in6_addr addr; */                                     \
608
/* struct ifnet *ifp; */                                        \
609
/* struct in6_multi *in6m; */                                   \
610
do { \
611
        struct ifmultiaddr *ifma; \
612
        for (ifma = (ifp)->if_multiaddrs.lh_first; ifma; \
613
             ifma = ifma->ifma_link.le_next) { \
614
                if (ifma->ifma_addr->sa_family == AF_INET6 \
615
                    && IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifma->ifma_addr)->sin6_addr, \
616
                                          &(addr))) \
617
                        break; \
618
        } \
619
        (in6m) = (struct in6_multi *)(ifma ? ifma->ifma_protospec : 0); \
620
} while(0)
621
 
622
/*
623
 * Macro to step through all of the in6_multi records, one at a time.
624
 * The current position is remembered in "step", which the caller must
625
 * provide.  IN6_FIRST_MULTI(), below, must be called to initialize "step"
626
 * and get the first record.  Both macros return a NULL "in6m" when there
627
 * are no remaining records.
628
 */
629
#define IN6_NEXT_MULTI(step, in6m)                                      \
630
/* struct in6_multistep step; */                                        \
631
/* struct in6_multi *in6m; */                                           \
632
do { \
633
        if (((in6m) = (step).i_in6m) != NULL) \
634
                (step).i_in6m = (step).i_in6m->in6m_entry.le_next; \
635
} while(0)
636
 
637
#define IN6_FIRST_MULTI(step, in6m)             \
638
/* struct in6_multistep step; */                \
639
/* struct in6_multi *in6m */                    \
640
do { \
641
        (step).i_in6m = in6_multihead.lh_first; \
642
                IN6_NEXT_MULTI((step), (in6m)); \
643
} while(0)
644
 
645
#else /* not FreeBSD3 */
646
 
647
#define IN6_LOOKUP_MULTI(addr, ifp, in6m)                       \
648
/* struct in6_addr addr; */                                     \
649
/* struct ifnet *ifp; */                                        \
650
/* struct in6_multi *in6m; */                                   \
651
do {                                                            \
652
        struct in6_ifaddr *ia;                                  \
653
                                                                \
654
        IFP_TO_IA6((ifp), ia);                                  \
655
        if (ia == NULL)                                         \
656
                (in6m) = NULL;                                  \
657
        else                                                    \
658
                for ((in6m) = ia->ia6_multiaddrs.lh_first;      \
659
                     (in6m) != NULL &&                          \
660
                     !IN6_ARE_ADDR_EQUAL(&(in6m)->in6m_addr, &(addr));  \
661
                     (in6m) = in6m->in6m_entry.le_next)         \
662
                        continue;                               \
663
} while (0)
664
 
665
/*
666
 * Macro to step through all of the in6_multi records, one at a time.
667
 * The current position is remembered in "step", which the caller must
668
 * provide.  IN6_FIRST_MULTI(), below, must be called to initialize "step"
669
 * and get the first record.  Both macros return a NULL "in6m" when there
670
 * are no remaining records.
671
 */
672
#define IN6_NEXT_MULTI(step, in6m)                                      \
673
/* struct in6_multistep step; */                                        \
674
/* struct in6_multi *in6m; */                                           \
675
do {                                                                    \
676
        if (((in6m) = (step).i_in6m) != NULL)                           \
677
                (step).i_in6m = (in6m)->in6m_entry.le_next;             \
678
        else                                                            \
679
                while ((step).i_ia != NULL) {                           \
680
                        (in6m) = (step).i_ia->ia6_multiaddrs.lh_first;  \
681
                        (step).i_ia = (step).i_ia->ia_next;             \
682
                        if ((in6m) != NULL) {                           \
683
                                (step).i_in6m = (in6m)->in6m_entry.le_next; \
684
                                break;                                  \
685
                        }                                               \
686
                }                                                       \
687
} while (0)
688
 
689
#define IN6_FIRST_MULTI(step, in6m)             \
690
/* struct in6_multistep step; */                \
691
/* struct in6_multi *in6m */                    \
692
do {                                            \
693
        (step).i_ia = in6_ifaddr;               \
694
        (step).i_in6m = NULL;                   \
695
        IN6_NEXT_MULTI((step), (in6m));         \
696
} while (0)
697
 
698
#endif /* not FreeBSD3 */
699
 
700
struct  in6_multi *in6_addmulti __P((struct in6_addr *, struct ifnet *,
701
                                     int *));
702
void    in6_delmulti __P((struct in6_multi *));
703
struct in6_multi_mship *in6_joingroup __P((struct ifnet *, struct in6_addr *,
704
        int *));
705
int in6_leavegroup __P((struct in6_multi_mship *));
706
extern int in6_ifindex2scopeid __P((int));
707
extern int in6_mask2len __P((struct in6_addr *, u_char *));
708
#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3)
709
int     in6_control __P((struct socket *,
710
                         u_long, caddr_t, struct ifnet *, struct proc *));
711
#else
712
int     in6_control __P((struct socket *, u_long, caddr_t, struct ifnet *));
713
#endif
714
int     in6_update_ifa __P((struct ifnet *, struct in6_aliasreq *,
715
                            struct in6_ifaddr *));
716
void    in6_purgeaddr __P((struct ifaddr *));
717
int     in6if_do_dad __P((struct ifnet *));
718
void    in6_purgeif __P((struct ifnet *));
719
void    in6_savemkludge __P((struct in6_ifaddr *));
720
void    in6_setmaxmtu   __P((void));
721
void    in6_restoremkludge __P((struct in6_ifaddr *, struct ifnet *));
722
void    in6_createmkludge __P((struct ifnet *));
723
void    in6_purgemkludge __P((struct ifnet *));
724
struct in6_ifaddr *in6ifa_ifpforlinklocal __P((struct ifnet *, int));
725
struct in6_ifaddr *in6ifa_ifpwithaddr __P((struct ifnet *,
726
                                             struct in6_addr *));
727
char    *ip6_sprintf __P((const struct in6_addr *));
728
int64_t in6_addr2zoneid __P((struct ifnet *, struct in6_addr *));
729
int     in6_matchlen __P((struct in6_addr *, struct in6_addr *));
730
int     in6_are_prefix_equal __P((struct in6_addr *p1, struct in6_addr *p2,
731
                                  int len));
732
void    in6_prefixlen2mask __P((struct in6_addr *maskp, int len));
733
void    in6_prefix_remove_ifid __P((int iilen, struct in6_ifaddr *ia));
734
void    in6_purgeprefix __P((struct ifnet *));
735
 
736
int     in6_is_addr_deprecated __P((struct sockaddr_in6 *));
737
int in6_embedscope __P((struct in6_addr *, const struct sockaddr_in6 *));
738
int in6_recoverscope __P((struct sockaddr_in6 *, const struct in6_addr *,
739
        struct ifnet *));
740
void in6_clearscope __P((struct in6_addr *));
741
int in6_src_ioctl __P((u_long, caddr_t));
742
 
743
#ifdef MEASURE_PERFORMANCE
744
void in6h_hashinit __P((void));
745
void in6h_addifa __P((struct in6_ifaddr *));
746
struct in6hash *in6h_lookup __P((const struct in6_addr *, struct ifnet *));
747
void in6h_rebuild __P((int));
748
#endif
749
#endif /* _KERNEL */
750
 
751
#endif /* _NETINET6_IN6_VAR_H_ */

powered by: WebSVN 2.1.0

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