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/] [src/] [sys/] [netinet/] [in_proto.c] - Blame information for rev 204

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

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      sys/netinet/in_proto.c
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
/*      $OpenBSD: in_proto.c,v 1.17 1999/12/09 03:46:59 angelos Exp $   */
34
/*      $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $   */
35
 
36
/*
37
 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
38
 * All rights reserved.
39
 *
40
 * Redistribution and use in source and binary forms, with or without
41
 * modification, are permitted provided that the following conditions
42
 * are met:
43
 * 1. Redistributions of source code must retain the above copyright
44
 *    notice, this list of conditions and the following disclaimer.
45
 * 2. Redistributions in binary form must reproduce the above copyright
46
 *    notice, this list of conditions and the following disclaimer in the
47
 *    documentation and/or other materials provided with the distribution.
48
 * 3. Neither the name of the project nor the names of its contributors
49
 *    may be used to endorse or promote products derived from this software
50
 *    without specific prior written permission.
51
 *
52
 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
53
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
56
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62
 * SUCH DAMAGE.
63
 */
64
 
65
/*
66
 * Copyright (c) 1982, 1986, 1993
67
 *      The Regents of the University of California.  All rights reserved.
68
 *
69
 * Redistribution and use in source and binary forms, with or without
70
 * modification, are permitted provided that the following conditions
71
 * are met:
72
 * 1. Redistributions of source code must retain the above copyright
73
 *    notice, this list of conditions and the following disclaimer.
74
 * 2. Redistributions in binary form must reproduce the above copyright
75
 *    notice, this list of conditions and the following disclaimer in the
76
 *    documentation and/or other materials provided with the distribution.
77
 * 3. All advertising materials mentioning features or use of this software
78
 *    must display the following acknowledgement:
79
 *      This product includes software developed by the University of
80
 *      California, Berkeley and its contributors.
81
 * 4. Neither the name of the University nor the names of its contributors
82
 *    may be used to endorse or promote products derived from this software
83
 *    without specific prior written permission.
84
 *
85
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
86
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
87
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
88
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
89
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
90
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
91
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
92
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
93
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
94
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
95
 * SUCH DAMAGE.
96
 *
97
 *      @(#)in_proto.c  8.1 (Berkeley) 6/10/93
98
 */
99
 
100
/*
101
%%% portions-copyright-nrl-95
102
Portions of this software are Copyright 1995-1998 by Randall Atkinson,
103
Ronald Lee, Daniel McDonald, Bao Phan, and Chris Winters. All Rights
104
Reserved. All rights under this copyright have been assigned to the US
105
Naval Research Laboratory (NRL). The NRL Copyright Notice and License
106
Agreement Version 1.1 (January 17, 1995) applies to these portions of the
107
software.
108
You should have received a copy of the license with this software. If you
109
didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
110
*/
111
 
112
#include <sys/param.h>
113
#include <sys/socket.h>
114
#include <sys/protosw.h>
115
#include <sys/domain.h>
116
#include <sys/mbuf.h>
117
 
118
#include <net/if.h>
119
#include <net/radix.h>
120
#include <net/route.h>
121
 
122
#include <netinet/in.h>
123
#include <netinet/in_systm.h>
124
#include <netinet/ip.h>
125
#include <netinet/ip_var.h>
126
#include <netinet/ip_icmp.h>
127
#include <netinet/in_pcb.h>
128
 
129
#ifdef INET6
130
#ifndef INET
131
#include <netinet/in.h>
132
#endif
133
#include <netinet/ip6.h>
134
#endif
135
 
136
#include <netinet/igmp_var.h>
137
#include <netinet/tcp.h>
138
#include <netinet/tcp_fsm.h>
139
#include <netinet/tcp_seq.h>
140
#include <netinet/tcp_timer.h>
141
#include <netinet/tcp_var.h>
142
#include <netinet/tcpip.h>
143
#include <netinet/tcp_debug.h>
144
#include <netinet/udp.h>
145
#include <netinet/udp_var.h>
146
/*
147
 * TCP/IP protocol family: IP, ICMP, UDP, TCP.
148
 */
149
 
150
#if 0 /*KAME IPSEC*/
151
#include <netinet6/ah.h>
152
#ifdef IPSEC_ESP
153
#include <netinet6/esp.h>
154
#endif
155
#include <netinet6/ipcomp.h>
156
#endif /* IPSEC */
157
 
158
#ifndef __ECOS
159
#include "gif.h"
160
#endif
161
#if NGIF > 0
162
#include <netinet/in_gif.h>
163
#endif
164
 
165
#ifdef NSIP
166
#include <netns/ns_var.h>
167
#include <netns/idp_var.h>
168
#endif /* NSIP */
169
 
170
#ifdef IPXIP
171
#include <netipx/ipx.h>
172
#include <netipx/ipx_ip.h>
173
#endif /* NSIP */
174
 
175
#ifdef TPIP
176
#include <netiso/tp_param.h>
177
#include <netiso/tp_var.h>
178
#endif /* TPIP */
179
 
180
#ifdef EON
181
#include <netiso/eonvar.h>
182
#endif /* EON */
183
 
184
#ifdef MROUTING
185
#include <netinet/ip_mroute.h>
186
#endif /* MROUTING */
187
 
188
#ifdef IPFILTER
189
void    iplinit __P((void));
190
#define ip_init iplinit
191
#endif
192
 
193
#ifdef INET6
194
#include <netinet6/ip6_var.h>
195
#endif /* INET6 */
196
 
197
#ifdef IPSEC
198
#include <netinet/ip_ipsp.h>
199
#include <netinet/ip_ah.h>
200
#include <netinet/ip_esp.h>
201
#include <netinet/ip_ip4.h>
202
#include <netinet/ip_ether.h>
203
#endif
204
 
205
#ifndef CYGPKG_NET_SYSCTL
206
#define ip_sysctl     0
207
#define udp_sysctl    0
208
#define tcp_sysctl    0
209
#define icmp_sysctl   0
210
#endif
211
 
212
extern  struct domain inetdomain;
213
 
214
struct protosw inetsw[] = {
215
{ 0,             &inetdomain,    0,               0,
216
  0,             ip_output,      0,               0,
217
  0,
218
  ip_init,      0,               ip_slowtimo,    ip_drain,       ip_sysctl
219
},
220
{ SOCK_DGRAM,   &inetdomain,    IPPROTO_UDP,    PR_ATOMIC|PR_ADDR,
221
  udp_input,    0,               udp_ctlinput,   ip_ctloutput,
222
  udp_usrreq,
223
  udp_init,     0,               0,               0,               udp_sysctl
224
},
225
{ SOCK_STREAM,  &inetdomain,    IPPROTO_TCP,    PR_CONNREQUIRED|PR_WANTRCVD,
226
  tcp_input,    0,               tcp_ctlinput,   tcp_ctloutput,
227
  tcp_usrreq,
228
  tcp_init,     tcp_fasttimo,   tcp_slowtimo,   tcp_drain,      tcp_sysctl
229
},
230
{ SOCK_RAW,     &inetdomain,    IPPROTO_RAW,    PR_ATOMIC|PR_ADDR,
231
  rip_input,    rip_output,     0,               rip_ctloutput,
232
  rip_usrreq,
233
  0,             0,               0,               0,
234
},
235
{ SOCK_RAW,     &inetdomain,    IPPROTO_ICMP,   PR_ATOMIC|PR_ADDR,
236
  icmp_input,   rip_output,     0,               rip_ctloutput,
237
  rip_usrreq,
238
  0,             0,               0,               0,               icmp_sysctl
239
},
240
#if NGIF > 0 && !defined(IPSEC)
241
{ SOCK_RAW,     &inetdomain,    IPPROTO_IPV4,   PR_ATOMIC|PR_ADDR,
242
  in_gif_input, 0,               0,               0,
243
  0,
244
  0,             0,               0,               0,
245
},
246
#ifdef INET6
247
{ SOCK_RAW,     &inetdomain,    IPPROTO_IPV6,   PR_ATOMIC|PR_ADDR,
248
  in_gif_input, 0,               0,               0,
249
  0,
250
  0,             0,               0,               0,
251
},
252
#endif /* INET6 */
253
#else /* NGIF */
254
#if defined(IPSEC) || defined(MROUTING)
255
{ SOCK_RAW,     &inetdomain,    IPPROTO_IPIP,   PR_ATOMIC|PR_ADDR,
256
  ip4_input,    rip_output,     0,               rip_ctloutput,
257
  rip_usrreq,   /* XXX */
258
  0,             0,               0,               0,               ip4_sysctl
259
},
260
#if NGIF > 0 && defined(INET6)
261
{ SOCK_RAW,     &inetdomain,    IPPROTO_IPV6,   PR_ATOMIC|PR_ADDR,
262
  in_gif_input, 0,               0,               0,
263
  0,
264
  0,             0,               0,               0,
265
},
266
#endif /* NGIF && INET6 */
267
#endif /* MROUTING || IPSEC */
268
#endif /*NGIF*/
269
{ SOCK_RAW,     &inetdomain,    IPPROTO_IGMP,   PR_ATOMIC|PR_ADDR,
270
  igmp_input,   rip_output,     0,               rip_ctloutput,
271
  rip_usrreq,
272
  igmp_init,    igmp_fasttimo,  igmp_slowtimo,  0,
273
},
274
#ifdef TPIP
275
{ SOCK_SEQPACKET,&inetdomain,   IPPROTO_TP,     PR_CONNREQUIRED|PR_WANTRCVD,
276
  tpip_input,   0,               tpip_ctlinput,  tp_ctloutput,
277
  tp_usrreq,
278
  tp_init,      0,               tp_slowtimo,    tp_drain,
279
},
280
#endif /* TPIP */
281
/* EON (ISO CLNL over IP) */
282
#ifdef EON
283
{ SOCK_RAW,     &inetdomain,    IPPROTO_EON,    0,
284
  eoninput,     0,               eonctlinput,            0,
285
  0,
286
  eonprotoinit, 0,               0,               0,
287
},
288
#endif /* EON */
289
#ifdef IPXIP
290
{ SOCK_RAW,     &inetdomain,    IPPROTO_IDP,    PR_ATOMIC|PR_ADDR,
291
  ipxip_input,  rip_output,     ipxip_ctlinput, 0,
292
  rip_usrreq,
293
  ipxipprotoinit,0,              0,               0,
294
},
295
#endif /* NSIP */
296
#ifdef NSIP
297
{ SOCK_RAW,     &inetdomain,    IPPROTO_IDP,    PR_ATOMIC|PR_ADDR,
298
  idpip_input,  rip_output,     nsip_ctlinput,  0,
299
  rip_usrreq,
300
  0,             0,               0,               0,
301
},
302
#endif /* NSIP */
303
#ifdef IPSEC
304
{ SOCK_RAW,   &inetdomain,    IPPROTO_AH,     PR_ATOMIC|PR_ADDR,
305
  ah_input,   rip_output,     0,              rip_ctloutput,
306
  rip_usrreq,
307
  0,          0,              0,              0,            ah_sysctl
308
},
309
{ SOCK_RAW,   &inetdomain,    IPPROTO_ESP,    PR_ATOMIC|PR_ADDR,
310
  esp_input,  rip_output,     0,              rip_ctloutput,
311
  rip_usrreq,
312
  0,          0,              0,              0,            esp_sysctl
313
},
314
{ SOCK_RAW,   &inetdomain,    IPPROTO_ETHERIP, PR_ATOMIC|PR_ADDR,
315
  etherip_input,  rip_output, 0,              rip_ctloutput,
316
  rip_usrreq,
317
  0,          0,              0,              0,            etherip_sysctl
318
},
319
#endif
320
#if 0 /*NRL IPv6*/
321
/* IPv6 in IPv4 tunneled packets... */
322
{ SOCK_RAW,   &inetdomain,    IPPROTO_IPV6,   PR_ATOMIC|PR_ADDR,
323
  ip6_input,  rip_output,     ipv6_trans_ctlinput, rip_ctloutput,
324
  rip_usrreq,
325
  0,          0,              0,              0
326
},
327
#if 0
328
/* IPv4 in IPv4 tunneled packets... */
329
{ SOCK_RAW,   &inetdomain,    IPPROTO_IPV4,   PR_ATOMIC|PR_ADDR,
330
  ipv4_input, 0,              0,              0,
331
  0,
332
  0,          0,              0,              0
333
},
334
#endif /* 0 */
335
#endif /* defined(INET6) */
336
/* raw wildcard */
337
{ SOCK_RAW,     &inetdomain,    0,               PR_ATOMIC|PR_ADDR,
338
  rip_input,    rip_output,     0,               rip_ctloutput,
339
  rip_usrreq,
340
  rip_init,     0,               0,               0,
341
},
342
};
343
 
344
struct domain inetdomain =
345
    { AF_INET, "internet", 0, 0, 0,
346
      inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])], 0,
347
      rn_inithead, 32, sizeof(struct sockaddr_in) };
348
 
349
#ifdef notyet /* XXXX */
350
#include "imp.h"
351
#if NIMP > 0
352
extern  struct domain impdomain;
353
int     rimp_output(), hostslowtimo();
354
 
355
struct protosw impsw[] = {
356
{ SOCK_RAW,     &impdomain,     0,               PR_ATOMIC|PR_ADDR,
357
  0,             rimp_output,    0,               0,
358
  rip_usrreq,
359
  0,             0,               hostslowtimo,   0,
360
},
361
};
362
 
363
struct domain impdomain =
364
    { AF_IMPLINK, "imp", 0, 0, 0,
365
      impsw, &impsw[sizeof (impsw)/sizeof(impsw[0])] };
366
#endif
367
 
368
#include "hy.h"
369
#if NHY > 0
370
/*
371
 * HYPERchannel protocol family: raw interface.
372
 */
373
int     rhy_output();
374
extern  struct domain hydomain;
375
 
376
struct protosw hysw[] = {
377
{ SOCK_RAW,     &hydomain,      0,               PR_ATOMIC|PR_ADDR,
378
  0,             rhy_output,     0,               0,
379
  rip_usrreq,
380
  0,             0,               0,               0,
381
},
382
};
383
 
384
struct domain hydomain =
385
    { AF_HYLINK, "hy", 0, 0, 0, hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] };
386
#endif
387
#endif

powered by: WebSVN 2.1.0

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