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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [tcpip/] [current/] [include/] [netinet6/] [nd6.h] - Blame information for rev 856

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      include/netinet6.nd6.h
4
//
5
//      
6
//
7
//==========================================================================
8
// ####BSDALTCOPYRIGHTBEGIN####                                             
9
// -------------------------------------------                              
10
// Portions of this software may have been derived from OpenBSD             
11
// or other sources, and if so are covered by the appropriate copyright     
12
// and license included herein.                                             
13
// -------------------------------------------                              
14
// ####BSDALTCOPYRIGHTEND####                                               
15
//==========================================================================
16
//#####DESCRIPTIONBEGIN####
17
//
18
// Author(s):    gthomas
19
// Contributors: gthomas
20
// Date:         2000-01-10
21
// Purpose:      
22
// Description:  
23
//              
24
//
25
//####DESCRIPTIONEND####
26
//
27
//==========================================================================
28
 
29
/*      $OpenBSD: nd6.h,v 1.1 1999/12/08 06:50:23 itojun Exp $  */
30
 
31
/*
32
 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
33
 * All rights reserved.
34
 *
35
 * Redistribution and use in source and binary forms, with or without
36
 * modification, are permitted provided that the following conditions
37
 * are met:
38
 * 1. Redistributions of source code must retain the above copyright
39
 *    notice, this list of conditions and the following disclaimer.
40
 * 2. Redistributions in binary form must reproduce the above copyright
41
 *    notice, this list of conditions and the following disclaimer in the
42
 *    documentation and/or other materials provided with the distribution.
43
 * 3. Neither the name of the project nor the names of its contributors
44
 *    may be used to endorse or promote products derived from this software
45
 *    without specific prior written permission.
46
 *
47
 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
48
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
51
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57
 * SUCH DAMAGE.
58
 */
59
 
60
#ifndef _NETINET6_ND6_H_
61
#define _NETINET6_ND6_H_
62
 
63
#include <sys/queue.h>
64
 
65
struct  llinfo_nd6 {
66
        struct  llinfo_nd6 *ln_next;
67
        struct  llinfo_nd6 *ln_prev;
68
        struct  rtentry *ln_rt;
69
        struct  mbuf *ln_hold;  /* last packet until resolved/timeout */
70
        long    ln_asked;       /* number of queries already sent for this addr */
71
        u_long  ln_expire;      /* lifetime for NDP state transition */
72
        short   ln_state;       /* reachability state */
73
        short   ln_router;      /* 2^0: ND6 router bit */
74
};
75
 
76
#define ND6_LLINFO_NOSTATE      -2
77
#define ND6_LLINFO_WAITDELETE   -1
78
#define ND6_LLINFO_INCOMPLETE   0
79
#define ND6_LLINFO_REACHABLE    1
80
#define ND6_LLINFO_STALE        2
81
#define ND6_LLINFO_DELAY        3
82
#define ND6_LLINFO_PROBE        4
83
 
84
struct nd_ifinfo {
85
        u_int32_t linkmtu;              /* LinkMTU */
86
        u_int32_t maxmtu;               /* Upper bound of LinkMTU */
87
        u_int32_t basereachable;        /* BaseReachableTime */
88
        u_int32_t reachable;            /* Reachable Time */
89
        u_int32_t retrans;              /* Retrans Timer */
90
        int recalctm;                   /* BaseReacable re-calculation timer */
91
        u_int8_t chlim;                 /* CurHopLimit */
92
        u_int8_t receivedra;
93
};
94
 
95
struct in6_nbrinfo {
96
        char ifname[IFNAMSIZ];  /* if name, e.g. "en0" */
97
        struct in6_addr addr;   /* IPv6 address of the neighbor */
98
        long    asked;          /* number of queries already sent for this addr */
99
        int     isrouter;       /* if it acts as a router */
100
        int     state;          /* reachability state */
101
        int     expire;         /* lifetime for NDP state transition */
102
};
103
 
104
#define DRLSTSIZ 10
105
#define PRLSTSIZ 10
106
struct  in6_drlist {
107
        char ifname[IFNAMSIZ];
108
        struct {
109
                struct  in6_addr rtaddr;
110
                u_char  flags;
111
                u_short rtlifetime;
112
                u_long  expire;
113
                u_short if_index;
114
        } defrouter[DRLSTSIZ];
115
};
116
 
117
struct  in6_prlist {
118
        char ifname[IFNAMSIZ];
119
        struct {
120
                struct  in6_addr prefix;
121
                struct prf_ra raflags;
122
                u_char  prefixlen;
123
                u_long  vltime;
124
                u_long  pltime;
125
                u_long  expire;
126
                u_short if_index;
127
                u_short advrtrs; /* number of advertisement routers */
128
                struct  in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
129
        } prefix[PRLSTSIZ];
130
};
131
 
132
struct  in6_ndireq {
133
        char ifname[IFNAMSIZ];
134
        struct nd_ifinfo ndi;
135
};
136
 
137
/* protocol constants */
138
#define MAX_RTR_SOLICITATION_DELAY      1       /*1sec*/
139
#define RTR_SOLICITATION_INTERVAL       4       /*4sec*/
140
#define MAX_RTR_SOLICITATIONS           3
141
 
142
#define ND6_INFINITE_LIFETIME           0xffffffff
143
 
144
#ifdef _KERNEL
145
/* node constants */
146
#define MAX_REACHABLE_TIME              3600000 /* msec */
147
#define REACHABLE_TIME                  30000   /* msec */
148
#define RETRANS_TIMER                   1000    /* msec */
149
#define MIN_RANDOM_FACTOR               512     /* 1024 * 0.5 */
150
#define MAX_RANDOM_FACTOR               1536    /* 1024 * 1.5 */
151
#define ND_COMPUTE_RTIME(x) \
152
                (((MIN_RANDOM_FACTOR * (x >> 10)) + (random() & \
153
                ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)
154
 
155
struct  nd_defrouter {
156
        LIST_ENTRY(nd_defrouter) dr_entry;
157
#define dr_next dr_entry.le_next
158
        struct  in6_addr rtaddr;
159
        u_char  flags;
160
        u_short rtlifetime;
161
        u_long  expire;
162
        struct  ifnet *ifp;
163
};
164
 
165
struct nd_prefix {
166
        struct ifnet *ndpr_ifp;
167
        LIST_ENTRY(nd_prefix) ndpr_entry;
168
        struct sockaddr_in6 ndpr_prefix;        /* prefix */
169
        struct in6_addr ndpr_mask; /* netmask derived from the prefix */
170
        struct in6_addr ndpr_addr; /* address that is derived from the prefix */
171
        u_int32_t ndpr_vltime;  /* advertised valid lifetime */
172
        u_int32_t ndpr_pltime;  /* advertised preferred lifetime */
173
        time_t ndpr_expire;     /* expiration time of the prefix */
174
        time_t ndpr_preferred;  /* preferred time of the prefix */
175
        struct prf_ra ndpr_flags;
176
        /* list of routers that advertise the prefix: */
177
        LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs;
178
        u_char  ndpr_plen;
179
        struct  ndpr_stateflags {
180
                /* if this prefix can be regarded as on-link */
181
                u_char onlink : 1;
182
        } ndpr_stateflags;
183
};
184
 
185
#define ndpr_next               ndpr_entry.le_next
186
 
187
#define ndpr_raf                ndpr_flags
188
#define ndpr_raf_onlink         ndpr_flags.onlink
189
#define ndpr_raf_auto           ndpr_flags.autonomous
190
 
191
#define ndpr_statef_onlink      ndpr_stateflags.onlink
192
#define ndpr_statef_addmark     ndpr_stateflags.addmark
193
 
194
/*
195
 * We keep expired prefix for certain amount of time, for validation purposes.
196
 * 1800s = MaxRtrAdvInterval
197
 */
198
#define NDPR_KEEP_EXPIRED       (1800 * 2)
199
 
200
/*
201
 * Message format for use in obtaining information about prefixes
202
 * from inet6 sysctl function
203
 */
204
struct inet6_ndpr_msghdr {
205
        u_short inpm_msglen;    /* to skip over non-understood messages */
206
        u_char  inpm_version;   /* future binary compatability */
207
        u_char  inpm_type;      /* message type */
208
        struct in6_addr inpm_prefix;
209
        u_long  prm_vltim;
210
        u_long  prm_pltime;
211
        u_long  prm_expire;
212
        u_long  prm_preferred;
213
        struct in6_prflags prm_flags;
214
        u_short prm_index;      /* index for associated ifp */
215
        u_char  prm_plen;       /* length of prefix in bits */
216
};
217
 
218
#define prm_raf_onlink          prm_flags.prf_ra.onlink
219
#define prm_raf_auto            prm_flags.prf_ra.autonomous
220
 
221
#define prm_statef_onlink       prm_flags.prf_state.onlink
222
 
223
#define prm_rrf_decrvalid       prm_flags.prf_rr.decrvalid
224
#define prm_rrf_decrprefd       prm_flags.prf_rr.decrprefd
225
 
226
#define ifpr2ndpr(ifpr) ((struct nd_prefix *)(ifpr))
227
#define ndpr2ifpr(ndpr) ((struct ifprefix *)(ndpr))
228
 
229
struct nd_pfxrouter {
230
        LIST_ENTRY(nd_pfxrouter) pfr_entry;
231
#define pfr_next pfr_entry.le_next
232
        struct nd_defrouter *router;
233
};
234
 
235
LIST_HEAD(nd_drhead, nd_defrouter);
236
LIST_HEAD(nd_prhead, nd_prefix);
237
 
238
/* nd6.c */
239
extern int nd6_prune;
240
extern int nd6_delay;
241
extern int nd6_umaxtries;
242
extern int nd6_mmaxtries;
243
extern int nd6_useloopback;
244
extern int nd6_proxyall;
245
extern struct llinfo_nd6 llinfo_nd6;
246
extern struct nd_ifinfo *nd_ifinfo;
247
extern struct nd_drhead nd_defrouter;
248
extern struct nd_prhead nd_prefix;
249
 
250
union nd_opts {
251
        struct nd_opt_hdr *nd_opt_array[9];
252
        struct {
253
                struct nd_opt_hdr *zero;
254
                struct nd_opt_hdr *src_lladdr;
255
                struct nd_opt_hdr *tgt_lladdr;
256
                struct nd_opt_prefix_info *pi_beg;/* multiple opts, start */
257
                struct nd_opt_rd_hdr *rh;
258
                struct nd_opt_mtu *mtu;
259
                struct nd_opt_hdr *search;      /* multiple opts */
260
                struct nd_opt_hdr *last;        /* multiple opts */
261
                int done;
262
                struct nd_opt_prefix_info *pi_end;/* multiple opts, end */
263
        } nd_opt_each;
264
};
265
#define nd_opts_src_lladdr      nd_opt_each.src_lladdr
266
#define nd_opts_tgt_lladdr      nd_opt_each.tgt_lladdr
267
#define nd_opts_pi              nd_opt_each.pi_beg
268
#define nd_opts_pi_end          nd_opt_each.pi_end
269
#define nd_opts_rh              nd_opt_each.rh
270
#define nd_opts_mtu             nd_opt_each.mtu
271
#define nd_opts_search          nd_opt_each.search
272
#define nd_opts_last            nd_opt_each.last
273
#define nd_opts_done            nd_opt_each.done
274
 
275
/* XXX: need nd6_var.h?? */
276
/* nd6.c */
277
void nd6_init __P((void));
278
void nd6_ifattach __P((struct ifnet *));
279
int nd6_is_addr_neighbor __P((struct in6_addr *, struct ifnet *));
280
void nd6_option_init __P((void *, int, union nd_opts *));
281
struct nd_opt_hdr *nd6_option __P((union nd_opts *));
282
int nd6_options __P((union nd_opts *));
283
struct  rtentry *nd6_lookup __P((struct in6_addr *, int, struct ifnet *));
284
void nd6_setmtu __P((struct ifnet *));
285
void nd6_timer __P((void *));
286
void nd6_free __P((struct rtentry *));
287
void nd6_nud_hint __P((struct rtentry *, struct in6_addr *));
288
int nd6_resolve __P((struct ifnet *, struct rtentry *,
289
                     struct mbuf *, struct sockaddr *, u_char *));
290
#if defined(__bsdi__) && _BSDI_VERSION >= 199802
291
void nd6_rtrequest __P((int, struct rtentry *, struct rt_addrinfo *));
292
void nd6_p2p_rtrequest __P((int, struct rtentry *, struct rt_addrinfo *));
293
#else
294
void nd6_rtrequest __P((int, struct rtentry *, struct sockaddr *));
295
void nd6_p2p_rtrequest __P((int, struct rtentry *, struct sockaddr *));
296
#endif
297
int nd6_ioctl __P((u_long, caddr_t, struct ifnet *));
298
struct rtentry *nd6_cache_lladdr __P((struct ifnet *, struct in6_addr *,
299
        char *, int, int, int));
300
/* for test */
301
int nd6_output __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *,
302
                    struct rtentry *));
303
int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *,
304
                         struct sockaddr *, u_char *));
305
 
306
/* nd6_nbr.c */
307
void nd6_na_input __P((struct mbuf *, int, int));
308
void nd6_na_output __P((struct ifnet *, struct in6_addr *,
309
                        struct in6_addr *, u_long, int));
310
void nd6_ns_input __P((struct mbuf *, int, int));
311
void nd6_ns_output __P((struct ifnet *, struct in6_addr *,
312
                        struct in6_addr *, struct llinfo_nd6 *, int));
313
caddr_t nd6_ifptomac __P((struct ifnet *));
314
void nd6_dad_start __P((struct ifaddr *, int *));
315
void nd6_dad_duplicated __P((struct ifaddr *));
316
 
317
/* nd6_rtr.c */
318
void nd6_rs_input __P((struct mbuf *, int, int));
319
void nd6_ra_input __P((struct mbuf *, int, int));
320
void prelist_del __P((struct nd_prefix *));
321
void defrouter_addreq __P((struct nd_defrouter *));
322
void defrouter_delreq __P((struct nd_defrouter *, int));
323
void defrtrlist_del __P((struct nd_defrouter *));
324
void prelist_remove __P((struct nd_prefix *));
325
int prelist_update __P((struct nd_prefix *, struct nd_defrouter *,
326
        struct mbuf *));
327
struct nd_defrouter *defrouter_lookup __P((struct in6_addr *,
328
                                           struct ifnet *));
329
int in6_ifdel __P((struct ifnet *, struct in6_addr *));
330
int in6_init_prefix_ltimes __P((struct nd_prefix *ndpr));
331
void rt6_flush __P((struct in6_addr *, struct ifnet *));
332
 
333
#endif /* _KERNEL */
334
 
335
#endif /* _NETINET6_ND6_H_ */

powered by: WebSVN 2.1.0

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