OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      include/netinet6/ip6_mroute.h
4
//
5
//==========================================================================
6
//####BSDCOPYRIGHTBEGIN####
7
//
8
// -------------------------------------------
9
//
10
// Portions of this software may have been derived from OpenBSD, 
11
// FreeBSD or other sources, and are covered by the appropriate
12
// copyright disclaimers included herein.
13
//
14
// Portions created by Red Hat are
15
// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
16
//
17
// -------------------------------------------
18
//
19
//####BSDCOPYRIGHTEND####
20
//==========================================================================
21
 
22
/*      $KAME: ip6_mroute.h,v 1.19 2001/06/14 06:12:55 suz Exp $        */
23
 
24
/*
25
 * Copyright (C) 1998 WIDE Project.
26
 * All rights reserved.
27
 *
28
 * Redistribution and use in source and binary forms, with or without
29
 * modification, are permitted provided that the following conditions
30
 * are met:
31
 * 1. Redistributions of source code must retain the above copyright
32
 *    notice, this list of conditions and the following disclaimer.
33
 * 2. Redistributions in binary form must reproduce the above copyright
34
 *    notice, this list of conditions and the following disclaimer in the
35
 *    documentation and/or other materials provided with the distribution.
36
 * 3. Neither the name of the project nor the names of its contributors
37
 *    may be used to endorse or promote products derived from this software
38
 *    without specific prior written permission.
39
 *
40
 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
41
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
44
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50
 * SUCH DAMAGE.
51
 */
52
 
53
/*      BSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp      */
54
 
55
/*
56
 * Definitions for IP multicast forwarding.
57
 *
58
 * Written by David Waitzman, BBN Labs, August 1988.
59
 * Modified by Steve Deering, Stanford, February 1989.
60
 * Modified by Ajit Thyagarajan, PARC, August 1993.
61
 * Modified by Ajit Thyagarajan, PARC, August 1994.
62
 * Modified by Ahmed Helmy, USC, September 1996.
63
 *
64
 * MROUTING Revision: 1.2
65
 */
66
 
67
#ifndef _NETINET6_IP6_MROUTE_H_
68
#define _NETINET6_IP6_MROUTE_H_
69
 
70
/*
71
 * Multicast Routing set/getsockopt commands.
72
 */
73
#ifdef _KERNEL
74
#define MRT6_OINIT              100     /* initialize forwarder (omrt6msg) */
75
#endif
76
#define MRT6_DONE               101     /* shut down forwarder */
77
#define MRT6_ADD_MIF            102     /* add multicast interface */
78
#define MRT6_DEL_MIF            103     /* delete multicast interface */
79
#define MRT6_ADD_MFC            104     /* insert forwarding cache entry */
80
#define MRT6_DEL_MFC            105     /* delete forwarding cache entry */
81
#define MRT6_PIM                107     /* enable pim code */
82
#define MRT6_INIT               108     /* initialize forwarder (mrt6msg) */
83
 
84
#define GET_TIME(t)     microtime(&t)
85
 
86
/*
87
 * Types and macros for handling bitmaps with one bit per multicast interface.
88
 */
89
typedef u_short mifi_t;         /* type of a mif index */
90
#define MAXMIFS         64
91
 
92
#ifndef IF_SETSIZE
93
#define IF_SETSIZE      256
94
#endif
95
 
96
typedef u_int32_t       if_mask;
97
#define NIFBITS (sizeof(if_mask) * NBBY)        /* bits per mask */
98
 
99
#ifndef howmany
100
#define howmany(x, y)   (((x) + ((y) - 1)) / (y))
101
#endif
102
 
103
typedef struct if_set {
104
        if_mask ifs_bits[howmany(IF_SETSIZE, NIFBITS)];
105
} if_set;
106
 
107
#define IF_SET(n, p)    ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
108
#define IF_CLR(n, p)    ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
109
#define IF_ISSET(n, p)  ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
110
#define IF_COPY(f, t)   bcopy(f, t, sizeof(*(f)))
111
#define IF_ZERO(p)      bzero(p, sizeof(*(p)))
112
 
113
/*
114
 * Argument structure for MRT6_ADD_IF.
115
 */
116
struct mif6ctl {
117
        mifi_t      mif6c_mifi;         /* the index of the mif to be added  */
118
        u_char      mif6c_flags;        /* MIFF_ flags defined below         */
119
        u_short     mif6c_pifi;         /* the index of the physical IF */
120
#ifdef notyet
121
        u_int       mif6c_rate_limit;    /* max rate                         */
122
#endif
123
};
124
 
125
#define MIFF_REGISTER   0x1     /* mif represents a register end-point */
126
 
127
/*
128
 * Argument structure for MRT6_ADD_MFC and MRT6_DEL_MFC
129
 */
130
struct mf6cctl {
131
        struct sockaddr_in6 mf6cc_origin;       /* IPv6 origin of mcasts */
132
        struct sockaddr_in6 mf6cc_mcastgrp; /* multicast group associated */
133
        mifi_t          mf6cc_parent;   /* incoming ifindex */
134
        struct if_set   mf6cc_ifset;    /* set of forwarding ifs */
135
};
136
 
137
/*
138
 * The kernel's multicast routing statistics.
139
 */
140
struct mrt6stat {
141
        u_quad_t mrt6s_mfc_lookups;     /* # forw. cache hash table hits   */
142
        u_quad_t mrt6s_mfc_misses;      /* # forw. cache hash table misses */
143
        u_quad_t mrt6s_upcalls;         /* # calls to mrouted              */
144
        u_quad_t mrt6s_no_route;        /* no route for packet's origin    */
145
        u_quad_t mrt6s_bad_tunnel;      /* malformed tunnel options        */
146
        u_quad_t mrt6s_cant_tunnel;     /* no room for tunnel options      */
147
        u_quad_t mrt6s_wrong_if;        /* arrived on wrong interface      */
148
        u_quad_t mrt6s_upq_ovflw;       /* upcall Q overflow               */
149
        u_quad_t mrt6s_cache_cleanups;  /* # entries with no upcalls       */
150
        u_quad_t mrt6s_drop_sel;        /* pkts dropped selectively        */
151
        u_quad_t mrt6s_q_overflow;      /* pkts dropped - Q overflow       */
152
        u_quad_t mrt6s_pkt2large;       /* pkts dropped - size > BKT SIZE  */
153
        u_quad_t mrt6s_upq_sockfull;    /* upcalls dropped - socket full   */
154
};
155
 
156
#ifdef MRT6_OINIT
157
/*
158
 * Struct used to communicate from kernel to multicast router
159
 * note the convenient similarity to an IPv6 header.
160
 * XXX old version, superseded by mrt6msg.
161
 */
162
struct omrt6msg {
163
        u_long      unused1;
164
        u_char      im6_msgtype;                /* what type of message     */
165
#if 0
166
#define MRT6MSG_NOCACHE 1
167
#define MRT6MSG_WRONGMIF        2
168
#define MRT6MSG_WHOLEPKT        3               /* used for user level encap*/
169
#endif
170
        u_char      im6_mbz;                    /* must be zero             */
171
        u_char      im6_mif;                    /* mif rec'd on             */
172
        u_char      unused2;
173
        struct in6_addr  im6_src, im6_dst;
174
};
175
#endif
176
 
177
/*
178
 * Structure used to communicate from kernel to multicast router.
179
 * We'll overlay the structure onto an MLD header (not an IPv6 header
180
 * like igmpmsg{} used for IPv4 implementation). This is because this
181
 * structure will be passed via an IPv6 raw socket, on which an application
182
 * will only receive the payload i.e. the data after the IPv6 header and all
183
 * the extension headers. (see Section 3 of draft-ietf-ipngwg-2292bis-01)
184
 */
185
struct mrt6msg {
186
#define MRT6MSG_NOCACHE         1
187
#define MRT6MSG_WRONGMIF        2
188
#define MRT6MSG_WHOLEPKT        3               /* used for user level encap*/
189
        u_char      im6_mbz;                    /* must be zero             */
190
        u_char      im6_msgtype;                /* what type of message     */
191
        u_int16_t   im6_mif;                    /* mif rec'd on             */
192
        u_int32_t   im6_pad;                    /* padding for 64bit arch   */
193
        struct in6_addr  im6_src, im6_dst;
194
};
195
 
196
/*
197
 * Argument structure used by multicast routing daemon to get src-grp
198
 * packet counts
199
 */
200
struct sioc_sg_req6 {
201
        struct sockaddr_in6 src;
202
        struct sockaddr_in6 grp;
203
        u_quad_t pktcnt;
204
        u_quad_t bytecnt;
205
        u_quad_t wrong_if;
206
};
207
 
208
/*
209
 * Argument structure used by mrouted to get mif pkt counts
210
 */
211
struct sioc_mif_req6 {
212
        mifi_t mifi;            /* mif number                           */
213
        u_quad_t icount;        /* Input packet count on mif            */
214
        u_quad_t ocount;        /* Output packet count on mif           */
215
        u_quad_t ibytes;        /* Input byte count on mif              */
216
        u_quad_t obytes;        /* Output byte count on mif             */
217
};
218
 
219
#if defined(_KERNEL) || defined(KERNEL)
220
/*
221
 * The kernel's multicast-interface structure.
222
 */
223
struct mif6 {
224
        u_char          m6_flags;       /* MIFF_ flags defined above         */
225
        u_int           m6_rate_limit;  /* max rate                          */
226
#ifdef notyet
227
        struct tbf      *m6_tbf;        /* token bucket structure at intf.   */
228
#endif
229
        struct in6_addr m6_lcl_addr;    /* local interface address           */
230
        struct ifnet    *m6_ifp;        /* pointer to interface              */
231
        u_quad_t        m6_pkt_in;      /* # pkts in on interface            */
232
        u_quad_t        m6_pkt_out;     /* # pkts out on interface           */
233
        u_quad_t        m6_bytes_in;    /* # bytes in on interface           */
234
        u_quad_t        m6_bytes_out;   /* # bytes out on interface          */
235
        struct route m6_route;/* cached route if this is a tunnel */
236
#ifdef notyet
237
        u_int           m6_rsvp_on;     /* RSVP listening on this vif */
238
        struct socket   *m6_rsvpd;      /* RSVP daemon socket */
239
#endif
240
};
241
 
242
/*
243
 * The kernel's multicast forwarding cache entry structure
244
 */
245
struct mf6c {
246
        struct sockaddr_in6  mf6c_origin;       /* IPv6 origin of mcasts     */
247
        struct sockaddr_in6  mf6c_mcastgrp;     /* multicast group associated*/
248
        mifi_t           mf6c_parent;           /* incoming IF               */
249
        struct if_set    mf6c_ifset;            /* set of outgoing IFs */
250
 
251
        u_quad_t        mf6c_pkt_cnt;           /* pkt count for src-grp     */
252
        u_quad_t        mf6c_byte_cnt;          /* byte count for src-grp    */
253
        u_quad_t        mf6c_wrong_if;          /* wrong if for src-grp      */
254
        int             mf6c_expire;            /* time to clean entry up    */
255
        struct timeval  mf6c_last_assert;       /* last time I sent an assert*/
256
        struct rtdetq  *mf6c_stall;             /* pkts waiting for route */
257
        struct mf6c    *mf6c_next;              /* hash table linkage */
258
};
259
 
260
#define MF6C_INCOMPLETE_PARENT ((mifi_t)-1)
261
 
262
/*
263
 * Argument structure used for pkt info. while upcall is made
264
 */
265
#ifndef _NETINET_IP_MROUTE_H_
266
struct rtdetq {         /* XXX: rtdetq is also defined in ip_mroute.h */
267
    struct mbuf         *m;             /* A copy of the packet             */
268
    struct ifnet        *ifp;           /* Interface pkt came in on         */
269
#ifdef UPCALL_TIMING
270
    struct timeval      t;              /* Timestamp */
271
#endif /* UPCALL_TIMING */
272
    struct rtdetq       *next;
273
};
274
#endif /* _NETINET_IP_MROUTE_H_ */
275
 
276
#define MF6CTBLSIZ      256
277
#if (MF6CTBLSIZ & (MF6CTBLSIZ - 1)) == 0          /* from sys:route.h */
278
#define MF6CHASHMOD(h)  ((h) & (MF6CTBLSIZ - 1))
279
#else
280
#define MF6CHASHMOD(h)  ((h) % MF6CTBLSIZ)
281
#endif
282
 
283
#define MAX_UPQ6        4               /* max. no of pkts in upcall Q */
284
 
285
int     ip6_mrouter_set __P((struct socket *so, struct sockopt *sopt));
286
int     ip6_mrouter_get __P((struct socket *so, struct sockopt *sopt));
287
int     ip6_mrouter_done __P((void));
288
int     mrt6_ioctl __P((int, caddr_t));
289
#endif /* _KERNEL */
290
 
291
#endif /* !_NETINET6_IP6_MROUTE_H_ */

powered by: WebSVN 2.1.0

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