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/] [ip6_mroute.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      include/netinet6/ip6_mroute.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: ip6_mroute.h,v 1.19 2001/06/14 06:12:55 suz Exp $        */
21
 
22
/*
23
 * Copyright (C) 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
/*      BSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp      */
52
 
53
/*
54
 * Definitions for IP multicast forwarding.
55
 *
56
 * Written by David Waitzman, BBN Labs, August 1988.
57
 * Modified by Steve Deering, Stanford, February 1989.
58
 * Modified by Ajit Thyagarajan, PARC, August 1993.
59
 * Modified by Ajit Thyagarajan, PARC, August 1994.
60
 * Modified by Ahmed Helmy, USC, September 1996.
61
 *
62
 * MROUTING Revision: 1.2
63
 */
64
 
65
#ifndef _NETINET6_IP6_MROUTE_H_
66
#define _NETINET6_IP6_MROUTE_H_
67
 
68
/*
69
 * Multicast Routing set/getsockopt commands.
70
 */
71
#ifdef _KERNEL
72
#define MRT6_OINIT              100     /* initialize forwarder (omrt6msg) */
73
#endif
74
#define MRT6_DONE               101     /* shut down forwarder */
75
#define MRT6_ADD_MIF            102     /* add multicast interface */
76
#define MRT6_DEL_MIF            103     /* delete multicast interface */
77
#define MRT6_ADD_MFC            104     /* insert forwarding cache entry */
78
#define MRT6_DEL_MFC            105     /* delete forwarding cache entry */
79
#define MRT6_PIM                107     /* enable pim code */
80
#define MRT6_INIT               108     /* initialize forwarder (mrt6msg) */
81
 
82
#define GET_TIME(t)     microtime(&t)
83
 
84
/*
85
 * Types and macros for handling bitmaps with one bit per multicast interface.
86
 */
87
typedef u_short mifi_t;         /* type of a mif index */
88
#define MAXMIFS         64
89
 
90
#ifndef IF_SETSIZE
91
#define IF_SETSIZE      256
92
#endif
93
 
94
typedef u_int32_t       if_mask;
95
#define NIFBITS (sizeof(if_mask) * NBBY)        /* bits per mask */
96
 
97
#ifndef howmany
98
#define howmany(x, y)   (((x) + ((y) - 1)) / (y))
99
#endif
100
 
101
typedef struct if_set {
102
        if_mask ifs_bits[howmany(IF_SETSIZE, NIFBITS)];
103
} if_set;
104
 
105
#define IF_SET(n, p)    ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
106
#define IF_CLR(n, p)    ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
107
#define IF_ISSET(n, p)  ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
108
#define IF_COPY(f, t)   bcopy(f, t, sizeof(*(f)))
109
#define IF_ZERO(p)      bzero(p, sizeof(*(p)))
110
 
111
/*
112
 * Argument structure for MRT6_ADD_IF.
113
 */
114
struct mif6ctl {
115
        mifi_t      mif6c_mifi;         /* the index of the mif to be added  */
116
        u_char      mif6c_flags;        /* MIFF_ flags defined below         */
117
        u_short     mif6c_pifi;         /* the index of the physical IF */
118
#ifdef notyet
119
        u_int       mif6c_rate_limit;    /* max rate                         */
120
#endif
121
};
122
 
123
#define MIFF_REGISTER   0x1     /* mif represents a register end-point */
124
 
125
/*
126
 * Argument structure for MRT6_ADD_MFC and MRT6_DEL_MFC
127
 */
128
struct mf6cctl {
129
        struct sockaddr_in6 mf6cc_origin;       /* IPv6 origin of mcasts */
130
        struct sockaddr_in6 mf6cc_mcastgrp; /* multicast group associated */
131
        mifi_t          mf6cc_parent;   /* incoming ifindex */
132
        struct if_set   mf6cc_ifset;    /* set of forwarding ifs */
133
};
134
 
135
/*
136
 * The kernel's multicast routing statistics.
137
 */
138
struct mrt6stat {
139
        u_quad_t mrt6s_mfc_lookups;     /* # forw. cache hash table hits   */
140
        u_quad_t mrt6s_mfc_misses;      /* # forw. cache hash table misses */
141
        u_quad_t mrt6s_upcalls;         /* # calls to mrouted              */
142
        u_quad_t mrt6s_no_route;        /* no route for packet's origin    */
143
        u_quad_t mrt6s_bad_tunnel;      /* malformed tunnel options        */
144
        u_quad_t mrt6s_cant_tunnel;     /* no room for tunnel options      */
145
        u_quad_t mrt6s_wrong_if;        /* arrived on wrong interface      */
146
        u_quad_t mrt6s_upq_ovflw;       /* upcall Q overflow               */
147
        u_quad_t mrt6s_cache_cleanups;  /* # entries with no upcalls       */
148
        u_quad_t mrt6s_drop_sel;        /* pkts dropped selectively        */
149
        u_quad_t mrt6s_q_overflow;      /* pkts dropped - Q overflow       */
150
        u_quad_t mrt6s_pkt2large;       /* pkts dropped - size > BKT SIZE  */
151
        u_quad_t mrt6s_upq_sockfull;    /* upcalls dropped - socket full   */
152
};
153
 
154
#ifdef MRT6_OINIT
155
/*
156
 * Struct used to communicate from kernel to multicast router
157
 * note the convenient similarity to an IPv6 header.
158
 * XXX old version, superseded by mrt6msg.
159
 */
160
struct omrt6msg {
161
        u_long      unused1;
162
        u_char      im6_msgtype;                /* what type of message     */
163
#if 0
164
#define MRT6MSG_NOCACHE 1
165
#define MRT6MSG_WRONGMIF        2
166
#define MRT6MSG_WHOLEPKT        3               /* used for user level encap*/
167
#endif
168
        u_char      im6_mbz;                    /* must be zero             */
169
        u_char      im6_mif;                    /* mif rec'd on             */
170
        u_char      unused2;
171
        struct in6_addr  im6_src, im6_dst;
172
};
173
#endif
174
 
175
/*
176
 * Structure used to communicate from kernel to multicast router.
177
 * We'll overlay the structure onto an MLD header (not an IPv6 header
178
 * like igmpmsg{} used for IPv4 implementation). This is because this
179
 * structure will be passed via an IPv6 raw socket, on which an application
180
 * will only receive the payload i.e. the data after the IPv6 header and all
181
 * the extension headers. (see Section 3 of draft-ietf-ipngwg-2292bis-01)
182
 */
183
struct mrt6msg {
184
#define MRT6MSG_NOCACHE         1
185
#define MRT6MSG_WRONGMIF        2
186
#define MRT6MSG_WHOLEPKT        3               /* used for user level encap*/
187
        u_char      im6_mbz;                    /* must be zero             */
188
        u_char      im6_msgtype;                /* what type of message     */
189
        u_int16_t   im6_mif;                    /* mif rec'd on             */
190
        u_int32_t   im6_pad;                    /* padding for 64bit arch   */
191
        struct in6_addr  im6_src, im6_dst;
192
};
193
 
194
/*
195
 * Argument structure used by multicast routing daemon to get src-grp
196
 * packet counts
197
 */
198
struct sioc_sg_req6 {
199
        struct sockaddr_in6 src;
200
        struct sockaddr_in6 grp;
201
        u_quad_t pktcnt;
202
        u_quad_t bytecnt;
203
        u_quad_t wrong_if;
204
};
205
 
206
/*
207
 * Argument structure used by mrouted to get mif pkt counts
208
 */
209
struct sioc_mif_req6 {
210
        mifi_t mifi;            /* mif number                           */
211
        u_quad_t icount;        /* Input packet count on mif            */
212
        u_quad_t ocount;        /* Output packet count on mif           */
213
        u_quad_t ibytes;        /* Input byte count on mif              */
214
        u_quad_t obytes;        /* Output byte count on mif             */
215
};
216
 
217
#if defined(_KERNEL) || defined(KERNEL)
218
/*
219
 * The kernel's multicast-interface structure.
220
 */
221
struct mif6 {
222
        u_char          m6_flags;       /* MIFF_ flags defined above         */
223
        u_int           m6_rate_limit;  /* max rate                          */
224
#ifdef notyet
225
        struct tbf      *m6_tbf;        /* token bucket structure at intf.   */
226
#endif
227
        struct in6_addr m6_lcl_addr;    /* local interface address           */
228
        struct ifnet    *m6_ifp;        /* pointer to interface              */
229
        u_quad_t        m6_pkt_in;      /* # pkts in on interface            */
230
        u_quad_t        m6_pkt_out;     /* # pkts out on interface           */
231
        u_quad_t        m6_bytes_in;    /* # bytes in on interface           */
232
        u_quad_t        m6_bytes_out;   /* # bytes out on interface          */
233
        struct route m6_route;/* cached route if this is a tunnel */
234
#ifdef notyet
235
        u_int           m6_rsvp_on;     /* RSVP listening on this vif */
236
        struct socket   *m6_rsvpd;      /* RSVP daemon socket */
237
#endif
238
};
239
 
240
/*
241
 * The kernel's multicast forwarding cache entry structure
242
 */
243
struct mf6c {
244
        struct sockaddr_in6  mf6c_origin;       /* IPv6 origin of mcasts     */
245
        struct sockaddr_in6  mf6c_mcastgrp;     /* multicast group associated*/
246
        mifi_t           mf6c_parent;           /* incoming IF               */
247
        struct if_set    mf6c_ifset;            /* set of outgoing IFs */
248
 
249
        u_quad_t        mf6c_pkt_cnt;           /* pkt count for src-grp     */
250
        u_quad_t        mf6c_byte_cnt;          /* byte count for src-grp    */
251
        u_quad_t        mf6c_wrong_if;          /* wrong if for src-grp      */
252
        int             mf6c_expire;            /* time to clean entry up    */
253
        struct timeval  mf6c_last_assert;       /* last time I sent an assert*/
254
        struct rtdetq  *mf6c_stall;             /* pkts waiting for route */
255
        struct mf6c    *mf6c_next;              /* hash table linkage */
256
};
257
 
258
#define MF6C_INCOMPLETE_PARENT ((mifi_t)-1)
259
 
260
/*
261
 * Argument structure used for pkt info. while upcall is made
262
 */
263
#ifndef _NETINET_IP_MROUTE_H_
264
struct rtdetq {         /* XXX: rtdetq is also defined in ip_mroute.h */
265
    struct mbuf         *m;             /* A copy of the packet             */
266
    struct ifnet        *ifp;           /* Interface pkt came in on         */
267
#ifdef UPCALL_TIMING
268
    struct timeval      t;              /* Timestamp */
269
#endif /* UPCALL_TIMING */
270
    struct rtdetq       *next;
271
};
272
#endif /* _NETINET_IP_MROUTE_H_ */
273
 
274
#define MF6CTBLSIZ      256
275
#if (MF6CTBLSIZ & (MF6CTBLSIZ - 1)) == 0          /* from sys:route.h */
276
#define MF6CHASHMOD(h)  ((h) & (MF6CTBLSIZ - 1))
277
#else
278
#define MF6CHASHMOD(h)  ((h) % MF6CTBLSIZ)
279
#endif
280
 
281
#define MAX_UPQ6        4               /* max. no of pkts in upcall Q */
282
 
283
int     ip6_mrouter_set __P((struct socket *so, struct sockopt *sopt));
284
int     ip6_mrouter_get __P((struct socket *so, struct sockopt *sopt));
285
int     ip6_mrouter_done __P((void));
286
int     mrt6_ioctl __P((int, caddr_t));
287
#endif /* _KERNEL */
288
 
289
#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.