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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [bsd_tcpip/] [current/] [src/] [sys/] [netinet/] [in_proto.c] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      src/sys/netinet/in_proto.c
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
/*
21
 * Copyright (c) 1982, 1986, 1993
22
 *      The Regents of the University of California.  All rights reserved.
23
 *
24
 * Redistribution and use in source and binary forms, with or without
25
 * modification, are permitted provided that the following conditions
26
 * are met:
27
 * 1. Redistributions of source code must retain the above copyright
28
 *    notice, this list of conditions and the following disclaimer.
29
 * 2. Redistributions in binary form must reproduce the above copyright
30
 *    notice, this list of conditions and the following disclaimer in the
31
 *    documentation and/or other materials provided with the distribution.
32
 * 3. All advertising materials mentioning features or use of this software
33
 *    must display the following acknowledgement:
34
 *      This product includes software developed by the University of
35
 *      California, Berkeley and its contributors.
36
 * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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
 *      @(#)in_proto.c  8.2 (Berkeley) 2/9/95
53
 * $FreeBSD: src/sys/netinet/in_proto.c,v 1.53.2.4 2001/07/24 19:10:18 brooks Exp $
54
 */
55
 
56
#include <sys/param.h>
57
#include <sys/socket.h>
58
#include <sys/domain.h>
59
#include <sys/protosw.h>
60
#include <sys/queue.h>
61
#include <sys/sysctl.h>
62
 
63
#include <net/if.h>
64
#include <net/route.h>
65
 
66
#include <netinet/in.h>
67
#include <netinet/in_systm.h>
68
#include <netinet/ip.h>
69
#include <netinet/ip_var.h>
70
#include <netinet/ip_icmp.h>
71
#include <netinet/igmp_var.h>
72
#include <netinet/tcp.h>
73
#include <netinet/tcp_timer.h>
74
#include <netinet/tcp_var.h>
75
#include <netinet/udp.h>
76
#include <netinet/udp_var.h>
77
#include <netinet/ip_encap.h>
78
 
79
/*
80
 * TCP/IP protocol family: IP, ICMP, UDP, TCP.
81
 */
82
 
83
#ifdef IPSEC
84
#include <netinet6/ipsec.h>
85
#include <netinet6/ah.h>
86
#ifdef IPSEC_ESP
87
#include <netinet6/esp.h>
88
#endif
89
#include <netinet6/ipcomp.h>
90
#endif /* IPSEC */
91
 
92
#ifdef IPXIP
93
#include <netipx/ipx_ip.h>
94
#endif
95
 
96
#ifdef NSIP
97
#include <netns/ns.h>
98
#include <netns/ns_if.h>
99
#endif
100
 
101
#ifdef NATPT
102
void    natpt_init      __P((void));
103
int     natpt_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
104
struct pr_usrreqs natpt_usrreqs;
105
#endif
106
 
107
extern  struct domain inetdomain;
108
static  struct pr_usrreqs nousrreqs;
109
 
110
struct protosw inetsw[] = {
111
{ 0,             &inetdomain,    0,               0,
112
  0,             0,               0,               0,
113
  0,
114
  ip_init,      0,               ip_slowtimo,    ip_drain,
115
  &nousrreqs
116
},
117
{ SOCK_DGRAM,   &inetdomain,    IPPROTO_UDP,    PR_ATOMIC|PR_ADDR,
118
  udp_input,    0,               udp_ctlinput,   ip_ctloutput,
119
  0,
120
  udp_init,     0,               0,               0,
121
  &udp_usrreqs
122
},
123
{ SOCK_STREAM,  &inetdomain,    IPPROTO_TCP,
124
        PR_CONNREQUIRED|PR_IMPLOPCL|PR_WANTRCVD,
125
  tcp_input,    0,               tcp_ctlinput,   tcp_ctloutput,
126
  0,
127
  tcp_init,     0,               tcp_slowtimo,   tcp_drain,
128
  &tcp_usrreqs
129
},
130
{ SOCK_RAW,     &inetdomain,    IPPROTO_RAW,    PR_ATOMIC|PR_ADDR,
131
  rip_input,    0,               rip_ctlinput,   rip_ctloutput,
132
  0,
133
  0,             0,               0,               0,
134
  &rip_usrreqs
135
},
136
{ SOCK_RAW,     &inetdomain,    IPPROTO_ICMP,   PR_ATOMIC|PR_ADDR|PR_LASTHDR,
137
  icmp_input,   0,               0,               rip_ctloutput,
138
  0,
139
  0,             0,               0,               0,
140
  &rip_usrreqs
141
},
142
{ SOCK_RAW,     &inetdomain,    IPPROTO_IGMP,   PR_ATOMIC|PR_ADDR|PR_LASTHDR,
143
  igmp_input,   0,               0,               rip_ctloutput,
144
  0,
145
  igmp_init,    igmp_fasttimo,  igmp_slowtimo,  0,
146
  &rip_usrreqs
147
},
148
{ SOCK_RAW,     &inetdomain,    IPPROTO_RSVP,   PR_ATOMIC|PR_ADDR|PR_LASTHDR,
149
  rsvp_input,   0,               0,               rip_ctloutput,
150
  0,
151
  0,             0,               0,               0,
152
  &rip_usrreqs
153
},
154
#ifdef IPSEC
155
{ SOCK_RAW,     &inetdomain,    IPPROTO_AH,     PR_ATOMIC|PR_ADDR,
156
  ah4_input,    0,               0,               0,
157
  0,
158
  0,             0,               0,               0,
159
  &nousrreqs
160
},
161
#ifdef IPSEC_ESP
162
{ SOCK_RAW,     &inetdomain,    IPPROTO_ESP,    PR_ATOMIC|PR_ADDR,
163
  esp4_input,   0,               0,               0,
164
  0,
165
  0,             0,               0,               0,
166
  &nousrreqs
167
},
168
#endif
169
{ SOCK_RAW,     &inetdomain,    IPPROTO_IPCOMP, PR_ATOMIC|PR_ADDR,
170
  ipcomp4_input, 0,              0,               0,
171
  0,
172
  0,             0,               0,               0,
173
  &nousrreqs
174
},
175
#endif /* IPSEC */
176
{ SOCK_RAW,     &inetdomain,    IPPROTO_IPV4,   PR_ATOMIC|PR_ADDR|PR_LASTHDR,
177
  encap4_input, 0,               0,               rip_ctloutput,
178
  0,
179
  encap_init,           0,               0,               0,
180
  &rip_usrreqs
181
},
182
# ifdef INET6
183
{ SOCK_RAW,     &inetdomain,    IPPROTO_IPV6,   PR_ATOMIC|PR_ADDR|PR_LASTHDR,
184
  encap4_input, 0,               0,               rip_ctloutput,
185
  0,
186
  encap_init,   0,               0,               0,
187
  &rip_usrreqs
188
},
189
#endif
190
#ifdef IPDIVERT
191
{ SOCK_RAW,     &inetdomain,    IPPROTO_DIVERT, PR_ATOMIC|PR_ADDR,
192
  div_input,    0,               0,               ip_ctloutput,
193
  0,
194
  div_init,     0,               0,               0,
195
  &div_usrreqs,
196
},
197
#endif
198
#ifdef IPXIP
199
{ SOCK_RAW,     &inetdomain,    IPPROTO_IDP,    PR_ATOMIC|PR_ADDR|PR_LASTHDR,
200
  ipxip_input,  0,               ipxip_ctlinput, 0,
201
  0,
202
  0,             0,               0,               0,
203
  &rip_usrreqs
204
},
205
#endif
206
#ifdef NSIP
207
{ SOCK_RAW,     &inetdomain,    IPPROTO_IDP,    PR_ATOMIC|PR_ADDR|PR_LASTHDR,
208
  idpip_input,  0,               nsip_ctlinput,  0,
209
  0,
210
  0,             0,               0,               0,
211
  &rip_usrreqs
212
},
213
#endif
214
#ifdef NATPT
215
{ SOCK_RAW,     &inetdomain,    IPPROTO_AHIP,   PR_ATOMIC|PR_ADDR,
216
  0,             0,               0,               0,
217
  0,
218
  natpt_init,   0,               0,               0,
219
 &natpt_usrreqs
220
},
221
#endif
222
        /* raw wildcard */
223
{ SOCK_RAW,     &inetdomain,    0,               PR_ATOMIC|PR_ADDR,
224
  rip_input,    0,               0,               rip_ctloutput,
225
  0,
226
  rip_init,     0,               0,               0,
227
  &rip_usrreqs
228
},
229
};
230
 
231
extern int in_inithead __P((void **, int));
232
 
233
struct domain inetdomain =
234
    { AF_INET, "internet", 0, 0, 0,
235
      (struct protosw *)inetsw,
236
      (struct protosw *)&inetsw[sizeof(inetsw)/sizeof(inetsw[0])], 0,
237
      in_inithead, 32, sizeof(struct sockaddr_in)
238
    };
239
 
240
DOMAIN_SET(inet);
241
 
242
SYSCTL_NODE(_net,      PF_INET,         inet,   CTLFLAG_RW, 0,
243
        "Internet Family");
244
 
245
SYSCTL_NODE(_net_inet, IPPROTO_IP,      ip,     CTLFLAG_RW, 0,   "IP");
246
SYSCTL_NODE(_net_inet, IPPROTO_ICMP,    icmp,   CTLFLAG_RW, 0,   "ICMP");
247
SYSCTL_NODE(_net_inet, IPPROTO_UDP,     udp,    CTLFLAG_RW, 0,   "UDP");
248
SYSCTL_NODE(_net_inet, IPPROTO_TCP,     tcp,    CTLFLAG_RW, 0,   "TCP");
249
SYSCTL_NODE(_net_inet, IPPROTO_IGMP,    igmp,   CTLFLAG_RW, 0,   "IGMP");
250
#ifdef IPSEC
251
SYSCTL_NODE(_net_inet, IPPROTO_AH,      ipsec,  CTLFLAG_RW, 0,   "IPSEC");
252
#endif /* IPSEC */
253
SYSCTL_NODE(_net_inet, IPPROTO_RAW,     raw,    CTLFLAG_RW, 0,   "RAW");
254
#ifdef IPDIVERT
255
SYSCTL_NODE(_net_inet, IPPROTO_DIVERT,  divert, CTLFLAG_RW, 0,   "DIVERT");
256
#endif
257
 

powered by: WebSVN 2.1.0

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