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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [include/] [netinet6/] [ipv6_var.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
//==========================================================================
2
//
3
//      include/netinet6_ipv6_var.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
/*
34
%%% copyright-nrl-95
35
This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
36
Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
37
rights under this copyright have been assigned to the US Naval Research
38
Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
39
1.1 (January 17, 1995) applies to this software.
40
You should have received a copy of the license with this software. If you
41
didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
42
 
43
*/
44
#ifndef _NETINET6_IPV6_VAR_H
45
#define _NETINET6_IPV6_VAR_H 1
46
 
47
#include <netinet6/in6.h>
48
 
49
/*
50
 * IPv6 multicast "options".  Session state for multicast, including
51
 * weird per-session multicast things.
52
 */
53
 
54
struct ipv6_moptions
55
{
56
  struct ifnet *i6mo_multicast_ifp;     /* ifp for outgoing multicasts */
57
  u_char i6mo_multicast_ttl;            /* TTL for outgoing multicasts.
58
                                           Does this matter in IPv6? */
59
  u_char i6mo_multicast_loop;           /* 1 => hear sends if a member */
60
  u_short i6mo_num_memberships;         /* no. memberships this socket */
61
  struct in6_multi *i6mo_membership[IN6_MAX_MEMBERSHIPS];
62
};
63
 
64
/*
65
 * IPv6 stats.
66
 */
67
 
68
#if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802
69
#define _IPV6STAT_TYPE u_quad_t
70
#else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802 */
71
#define _IPV6STAT_TYPE u_long
72
#endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802 */
73
 
74
struct  ipv6stat {
75
        _IPV6STAT_TYPE  ips_total;              /* total packets received */
76
        _IPV6STAT_TYPE  ips_tooshort;           /* packet too short */
77
        _IPV6STAT_TYPE  ips_toosmall;           /* not enough data */
78
        _IPV6STAT_TYPE  ips_fragments;          /* fragments received */
79
        _IPV6STAT_TYPE  ips_fragdropped;        /* frags dropped (dups, out of space) */
80
        _IPV6STAT_TYPE  ips_fragtimeout;        /* fragments timed out */
81
        _IPV6STAT_TYPE  ips_forward;            /* packets forwarded */
82
        _IPV6STAT_TYPE  ips_cantforward;        /* packets rcvd for unreachable dest */
83
        _IPV6STAT_TYPE  ips_redirectsent;       /* packets forwarded on same net */
84
        _IPV6STAT_TYPE  ips_noproto;            /* unknown or unsupported protocol */
85
        _IPV6STAT_TYPE  ips_delivered;          /* datagrams delivered to upper level*/
86
        _IPV6STAT_TYPE  ips_localout;           /* total ip packets generated here */
87
        _IPV6STAT_TYPE  ips_odropped;           /* lost packets due to nobufs, etc. */
88
        _IPV6STAT_TYPE  ips_reassembled;        /* total packets reassembled ok */
89
        _IPV6STAT_TYPE  ips_fragmented;         /* datagrams sucessfully fragmented */
90
        _IPV6STAT_TYPE  ips_ofragments;         /* output fragments created */
91
        _IPV6STAT_TYPE  ips_cantfrag;           /* don't fragment flag was set, etc. */
92
        _IPV6STAT_TYPE  ips_badoptions;         /* error in option processing */
93
        _IPV6STAT_TYPE  ips_noroute;            /* packets discarded due to no route */
94
        _IPV6STAT_TYPE  ips_badvers;            /* IPv6 version != 6 */
95
        _IPV6STAT_TYPE  ips_rawout;             /* total raw ip packets generated */
96
};
97
 
98
#if defined(_KERNEL) || defined(KERNEL)
99
/*
100
 * The IPv6 fragment queue entry structure.
101
 * Notes:
102
 *   Nodes are stored in ttl order.
103
 *   prefix comes from whichever packet gets here first.
104
 *   data contains a chain of chains of mbufs (m_next down a chain, m_nextpkt
105
 *     chaining chains together) where the chains are ordered by assembly
106
 *     position. When two chains are contiguous for reassembly, they are
107
 *     combined and the frag header disappears.
108
 *   The structure is deliberately sized so MALLOC will round up on the order
109
 *     of much less than the total size instead of doubling the size.
110
 */
111
 
112
struct ipv6_fragment
113
{
114
  struct ipv6_fragment *next;           /* Next fragment chain */
115
  struct mbuf *prefix;                  /* Headers before frag header(s) */
116
  struct mbuf *data;                    /* Frag headers + whatever data */
117
  u_char ttl;                           /* Fragment chain TTL. */
118
  u_char flags;                         /* Bit 0 indicates got end of chain */
119
};
120
 
121
/*
122
 * Structures and definitions for discovery mechanisms in IPv6.
123
 */
124
 
125
/*
126
 * Neighbor cache:
127
 *
128
 *     Number of unanswered probes is in discq.
129
 *     "Time of next event" will be in rt->rt_rmx.rmx_expire
130
 *          (rmx_expire will actually be quite overloaded, actually.)
131
 *     Status REACHABLE will be dq_unanswered < 0
132
 *     Status PROBE will be dq_unanswered >= 0
133
 *     Status INCOMPLETE will be link addr length of 0 if held,
134
 *     or deleted if not held.
135
 *
136
 *     If held, but INCOMPLETE fails set RTF_REJECT and make sure
137
 *     IPv6 and HLP's know how to deal with RTF_REJECT being set.
138
 */
139
 
140
struct discq   /* Similar to v4's llinfo_arp, discovery's "neighbor entry". */
141
{
142
  struct discq *dq_next,*dq_prev;        /* For {ins,rem}que(). */
143
  struct rtentry *dq_rt;                 /* Back pointer to routing entry for
144
                                            an address that may be dead. */
145
  struct mbuf *dq_queue;                 /* Queue of outgoing messages. */
146
  int dq_unanswered;                     /* Number of unanswered probes. */
147
};
148
 
149
#if !defined(_BSDI_VERSION) || (_BSDI_VERSION < 199802)
150
/* Routing flag redefinitions */
151
#define RTF_ISAROUTER RTF_PROTO2         /* Neighbor is a router. */
152
#define RTF_DEFAULT RTF_PROTO1           /* Default route. */
153
#endif /* !defined(_BSDI_VERSION) || (_BSDI_VERSION < 199802) */
154
 
155
/*
156
 * These should be configurable parameters, see ipv6_discovery.c.
157
 * All units are in comments besides constants.
158
 */
159
 
160
#define MAX_INITIAL_RTR_ADVERT_INTERVAL         16  /* seconds */
161
#define MAX_INITIAL_RTR_ADVERTISEMENTS          3   /* transmissions */
162
#define MAX_RTR_RESPONSE_DELAY                  2   /* seconds */
163
 
164
#define MAX_RTR_SOLICITATION_DELAY              1   /* second */
165
#define RTR_SOLICITATION_INTERVAL               3   /* seconds */
166
#define MAX_RTR_SOLICITATIONS                   3   /* transmissions */
167
 
168
#define MAX_MULTICAST_SOLICIT                   3   /* transmissions */
169
#define MAX_UNICAST_SOLICIT                     3   /* transmissions */
170
#define MAX_ANYCAST_DELAY_TIME                  1   /* seconds */
171
#define MAX_NEIGHBOR_ADVERTISEMENTS             3   /* transmissions */
172
#define MIN_NEIGHBOR_ADVERT_INTERVAL            16  /* seconds */
173
#define REACHABLE_TIME                          30  /* seconds */
174
#define RETRANS_TIMER                           3   /* seconds */
175
#define DELAY_FIRST_PROBE_TIME                  3   /* seconds */
176
/* Need to somehow define random factors. */
177
 
178
#define NEXTHOP_CLEAN_INTERVAL                  600 /* seconds */
179
#define REJECT_TIMER                            20 /* seconds */
180
 
181
/*
182
 * Child of a router or tunnel.  Is a "meta-entry" for garbage collection.
183
 */
184
 
185
struct v6child
186
{
187
  struct v6child *v6c_next,*v6c_prev;   /* For {ins,rem}que() */
188
  struct v6router *v6c_parent;         /* Parent router.  I'm null if
189
                                          I'm the router, or a tunnel
190
                                          child. */
191
  struct rtentry *v6c_route;           /* Next-hop cache entry.  I won't
192
                                          be holding it, but I'm attached
193
                                          to it, like discq is to neighbor
194
                                          cache entries. */
195
};
196
 
197
/*
198
 * Default router list entry.  Should be inserted
199
 * in priority order.  Will also have entries for non-
200
 * default routers, because I may be a router myself.
201
 */
202
 
203
struct v6router
204
{
205
  struct v6router *v6r_next,*v6r_prev;  /* For {ins,rem}que() */
206
  struct rtentry *v6r_rt;       /* Route for this.  Could be neighbor,
207
                                   could be tunnel. */
208
  struct v6child v6r_children;  /* Children of this router. */
209
 
210
  /* Metric information? */
211
  uint32_t v6r_expire;            /* Expiration time. */
212
};
213
#define V6R_SIN6(v6r)  ((struct sockaddr_in6 *)rt_key((v6r)->v6r_rt))
214
 
215
/*
216
 * Flags for "flags" argument in ipv6_output().
217
 */
218
 
219
#define IPV6_FORWARDING 0x1          /* Most of IPv6 header exists? */
220
#define IPV6_RAWOUTPUT 0x2           /* Raw IPv6 packet! */
221
#define IPV6_ROUTETOIF SO_DONTROUTE  /* Include sys/socket.h... */
222
 
223
void ipv6_init __P((void));
224
void ipv6_drain __P((void));
225
void ipv6_slowtimo __P((void));
226
int ipv6_sysctl __P((int *, uint, void *, size_t *, void *, size_t));
227
struct route6;
228
 
229
#if __FreeBSD__
230
int ipv6_ctloutput __P((struct socket *, struct sockopt *));
231
int ripv6_ctloutput __P((struct socket *, struct sockopt *));
232
#else /* __FreeBSD__ */
233
int ipv6_ctloutput __P((int, struct socket *,int,int, struct mbuf **));
234
int ripv6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
235
#endif /* __FreeBSD__ */
236
void     ripv6_init __P((void));
237
#if __OpenBSD__
238
void     ripv6_input __P((struct mbuf *, ...));
239
int      ripv6_output __P((struct mbuf *, ...));
240
#else /* __OpenBSD__ */
241
void     ripv6_input __P((struct mbuf *, int));
242
int      ripv6_output __P((struct mbuf *, struct socket *, struct in6_addr *, struct mbuf *));
243
#endif /* __OpenBSD__ */
244
 
245
#if __NetBSD__ || __FreeBSD__
246
int ripv6_usrreq_send(struct socket *, int, struct mbuf *, struct sockaddr *,
247
                      struct mbuf *, struct proc *);
248
#else /* __NetBSD__ || __FreeBSD__ */
249
int ripv6_usrreq_send(struct socket *, int, struct mbuf *, struct sockaddr *,
250
                      struct mbuf *);
251
#endif /* __NetBSD__ || __FreeBSD__ */
252
 
253
#if __FreeBSD__
254
int ripv6_usrreq_abort(struct socket *);
255
int ripv6_usrreq_attach(struct socket *, int , struct proc *);
256
int ripv6_usrreq_bind(struct socket *, struct sockaddr *, struct proc *);
257
int ripv6_usrreq_connect(struct socket *, struct sockaddr *, struct proc *);
258
int ripv6_usrreq_control(struct socket *, u_long, caddr_t, struct ifnet *,
259
                         struct proc *);
260
int ripv6_usrreq_detach(struct socket *);
261
int ripv6_usrreq_peeraddr(struct socket *, struct sockaddr **);
262
int ripv6_usrreq_sense(struct socket *, struct stat *);
263
int ripv6_usrreq_shutdown(struct socket *);
264
int ripv6_usrreq_sockaddr(struct socket *, struct sockaddr **);
265
#else /* __FreeBSD__ */
266
#if __NetBSD__
267
int ripv6_usrreq __P((struct socket *, int, struct mbuf *, struct mbuf *,
268
                      struct mbuf *, struct proc *));
269
#else /* __NetBSD__ */
270
int ripv6_usrreq __P((struct socket *, int, struct mbuf *, struct mbuf *,
271
                      struct mbuf *));
272
#endif /* __NetBSD__ */
273
#endif /* __FreeBSD__ */
274
 
275
#if __OpenBSD__
276
void ipv6_input __P((struct mbuf *, ...));
277
int ipv6_output __P((struct mbuf *, ...));
278
#else /* __OpenBSD__ */
279
void ipv6_input __P((struct mbuf *, int));
280
int ipv6_output __P((struct mbuf *, struct route6 *, int, struct ipv6_moptions *, struct ifnet *, struct socket *));
281
#endif /* __OpenBSD__ */
282
void ipv6_reasm __P((struct mbuf *, int));
283
void ipv6_hop __P((struct mbuf *, int));
284
 
285
#if __FreeBSD__
286
int in6_control __P((struct socket *,int, caddr_t, struct ifnet *,int, struct proc *));
287
#else /* __FreeBSD__ */
288
#if __NetBSD__
289
int in6_control __P((struct socket *,u_long, caddr_t, struct ifnet *,int, struct proc *));
290
#else /* __NetBSD__ */
291
int in6_control __P((struct socket *,int, caddr_t, struct ifnet *,int));
292
#endif /* __NetBSD__ */
293
#endif /* __FreeBSD__ */
294
void ipv6_stripoptions __P((struct mbuf *, int));
295
struct in6_multi *in6_addmulti __P((struct in6_addr *,struct ifnet *));
296
void in6_delmulti __P((struct in6_multi *));
297
 
298
#if __FreeBSD__
299
/* ripv6_usrreq  and  ipv6_icmp_usrreq functions */
300
extern struct pr_usrreqs ripv6_usrreqs;
301
extern struct pr_usrreqs ipv6_icmp_usrreqs;
302
 
303
extern int ripv6_usr_attach(struct socket *, int , struct proc *);
304
extern int ripv6_usr_disconnect(struct socket *);
305
extern int ripv6_usr_abort(struct socket *);
306
extern int ripv6_usr_detach(struct socket *);
307
extern int ripv6_usr_bind(struct socket *, struct sockaddr *, struct proc *);
308
extern int ripv6_usr_connect(struct socket *, struct sockaddr *, struct proc *);
309
extern int ripv6_usr_shutdown(struct socket *);
310
extern int ripv6_usr_send(struct socket *, int, struct mbuf *,
311
                          struct sockaddr *, struct mbuf *, struct proc *);
312
extern int ripv6_usr_control(struct socket *, int, caddr_t,
313
                             struct ifnet *, struct proc *);
314
extern int ripv6_usr_sense(struct socket *, struct stat *);
315
extern int ripv6_usr_sockaddr(struct socket *, struct sockaddr **);
316
extern int ripv6_usr_peeraddr(struct socket *, struct sockaddr **);
317
#endif /* __FreeBSD__ */
318
 
319
extern int ipv6_icmp_send(struct socket *, int, struct mbuf *,
320
                          struct sockaddr *, struct mbuf *, struct proc *);
321
 
322
#if __OpenBSD__
323
#ifdef NRL_IPSEC
324
void *ipv6_trans_ctlinput __P((int, struct sockaddr *, void *, struct mbuf *));
325
#else /* NRL_IPSEC */
326
void *ipv6_trans_ctlinput __P((int, struct sockaddr *, void *));
327
#endif /* NRL_IPSEC */
328
#else /* __OpenBSD__ */
329
struct ip;
330
#ifdef NRL_IPSEC
331
void ipv6_trans_ctlinput __P((int, struct sockaddr *, struct ip *, struct mbuf *));
332
#else /* NRL_IPSEC */
333
void ipv6_trans_ctlinput __P((int, struct sockaddr *, struct ip *));
334
#endif /* NRL_IPSEC */
335
#endif /* __OpenBSD__ */
336
 
337
/* These might belong in in_pcb.h */
338
struct inpcb;
339
#if __FreeBSD__
340
/*
341
 * FreeBSD, having done away with the *_usrreq() functions no longer needs to
342
 * pass mbufs to these functions.  Thus they pass in sockaddrs instead.
343
 */
344
int in6_pcbbind(struct inpcb *, struct sockaddr *);
345
int in6_pcbconnect(struct inpcb *, struct sockaddr *);
346
int in6_setsockaddr(struct inpcb *, struct sockaddr **);
347
int in6_setpeeraddr(struct inpcb *, struct sockaddr **);
348
#else /* __FreeBSD__ */
349
int in6_pcbbind(struct inpcb *, struct mbuf *);
350
int in6_pcbconnect(struct inpcb *, struct mbuf *);
351
int in6_setsockaddr(struct inpcb *, struct mbuf *);
352
int in6_setpeeraddr(struct inpcb *, struct mbuf *);
353
#endif /* __FreeBSD__ */
354
void ipv6_onlink_query(struct sockaddr_in6 *);
355
int ipv6_verify_onlink(struct sockaddr_in6 *);
356
 
357
#if __FreeBSD__ 
358
struct inpcbhead;               /* XXX?  Forward declaration needed. */
359
#define __IN6_PCBNOTIFY_FIRSTARG struct inpcbhead *
360
#endif /* __FreeBSD__ */
361
#if __NetBSD__ || __OpenBSD__
362
struct inpcbtable;
363
#define __IN6_PCBNOTIFY_FIRSTARG struct inpcbtable *
364
#endif /* __NetBSD__ || __OpenBSD__ */
365
#if __bsdi__
366
struct inpcb;
367
#define __IN6_PCBNOTIFY_FIRSTARG struct inpcb *
368
#endif /* __bsdi__ */
369
 
370
#if (!__OpenBSD__ && defined(IPSEC)) || (__OpenBSD__ && defined(NRL_IPSEC))
371
int in6_pcbnotify __P((__IN6_PCBNOTIFY_FIRSTARG, struct sockaddr *, uint,
372
                       struct in6_addr *, uint, int, void (*)(struct inpcb *,
373
                       int), struct mbuf *, int));
374
#else /* (!__OpenBSD__ && defined(IPSEC)) || (__OpenBSD__ && defined(NRL_IPSEC)) */
375
int in6_pcbnotify __P((__IN6_PCBNOTIFY_FIRSTARG, struct sockaddr *, uint,
376
                       struct in6_addr *, uint, int, void (*)(struct inpcb *,
377
                       int)));
378
#endif /* (!__OpenBSD__ && defined(IPSEC)) || (__OpenBSD__ && defined(NRL_IPSEC)) */
379
 
380
#undef __IN6_PCBNOTIFY_FIRSTARG
381
 
382
void ipv6_freemoptions __P((struct ipv6_moptions *));
383
 
384
int ipv6_controltoheader(struct mbuf **m, struct mbuf *control, struct ifnet **forceifp, int *);
385
struct mbuf *ipv6_headertocontrol(struct mbuf *m, int extra, int inp_flags);
386
#endif /* defined(_KERNEL) || defined(KERNEL) */
387
 
388
#endif /* _NETINET6_IPV6_VAR_H */

powered by: WebSVN 2.1.0

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