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

Subversion Repositories openrisc_me

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