Home | History | Annotate | Line # | Download | only in netinet
in_proto.c revision 1.1.1.3
      1      1.1      cgd /*
      2  1.1.1.2  thorpej  * Copyright (c) 1982, 1986, 1993
      3  1.1.1.2  thorpej  *	The Regents of the University of California.  All rights reserved.
      4      1.1      cgd  *
      5      1.1      cgd  * Redistribution and use in source and binary forms, with or without
      6      1.1      cgd  * modification, are permitted provided that the following conditions
      7      1.1      cgd  * are met:
      8      1.1      cgd  * 1. Redistributions of source code must retain the above copyright
      9      1.1      cgd  *    notice, this list of conditions and the following disclaimer.
     10      1.1      cgd  * 2. Redistributions in binary form must reproduce the above copyright
     11      1.1      cgd  *    notice, this list of conditions and the following disclaimer in the
     12      1.1      cgd  *    documentation and/or other materials provided with the distribution.
     13      1.1      cgd  * 3. All advertising materials mentioning features or use of this software
     14      1.1      cgd  *    must display the following acknowledgement:
     15      1.1      cgd  *	This product includes software developed by the University of
     16      1.1      cgd  *	California, Berkeley and its contributors.
     17      1.1      cgd  * 4. Neither the name of the University nor the names of its contributors
     18      1.1      cgd  *    may be used to endorse or promote products derived from this software
     19      1.1      cgd  *    without specific prior written permission.
     20      1.1      cgd  *
     21      1.1      cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22      1.1      cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23      1.1      cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24      1.1      cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25      1.1      cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26      1.1      cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27      1.1      cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28      1.1      cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29      1.1      cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30      1.1      cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31      1.1      cgd  * SUCH DAMAGE.
     32      1.1      cgd  *
     33  1.1.1.3  thorpej  *	@(#)in_proto.c	8.2 (Berkeley) 2/9/95
     34      1.1      cgd  */
     35      1.1      cgd 
     36  1.1.1.2  thorpej #include <sys/param.h>
     37  1.1.1.2  thorpej #include <sys/socket.h>
     38  1.1.1.2  thorpej #include <sys/protosw.h>
     39  1.1.1.2  thorpej #include <sys/domain.h>
     40  1.1.1.2  thorpej #include <sys/mbuf.h>
     41  1.1.1.2  thorpej 
     42  1.1.1.2  thorpej #include <net/if.h>
     43  1.1.1.2  thorpej #include <net/radix.h>
     44  1.1.1.2  thorpej #include <net/route.h>
     45  1.1.1.2  thorpej 
     46  1.1.1.2  thorpej #include <netinet/in.h>
     47  1.1.1.2  thorpej #include <netinet/in_systm.h>
     48  1.1.1.2  thorpej #include <netinet/ip.h>
     49  1.1.1.2  thorpej #include <netinet/ip_var.h>
     50  1.1.1.2  thorpej #include <netinet/ip_icmp.h>
     51  1.1.1.2  thorpej #include <netinet/in_pcb.h>
     52  1.1.1.2  thorpej #include <netinet/igmp_var.h>
     53  1.1.1.2  thorpej #include <netinet/tcp.h>
     54  1.1.1.2  thorpej #include <netinet/tcp_fsm.h>
     55  1.1.1.2  thorpej #include <netinet/tcp_seq.h>
     56  1.1.1.2  thorpej #include <netinet/tcp_timer.h>
     57  1.1.1.2  thorpej #include <netinet/tcp_var.h>
     58  1.1.1.2  thorpej #include <netinet/tcpip.h>
     59  1.1.1.2  thorpej #include <netinet/tcp_debug.h>
     60  1.1.1.2  thorpej #include <netinet/udp.h>
     61  1.1.1.2  thorpej #include <netinet/udp_var.h>
     62      1.1      cgd /*
     63      1.1      cgd  * TCP/IP protocol family: IP, ICMP, UDP, TCP.
     64      1.1      cgd  */
     65      1.1      cgd 
     66      1.1      cgd #ifdef NSIP
     67  1.1.1.2  thorpej void	idpip_input(), nsip_ctlinput();
     68      1.1      cgd #endif
     69      1.1      cgd 
     70      1.1      cgd #ifdef TPIP
     71  1.1.1.3  thorpej void	tpip_input(), tpip_ctlinput(), tp_init(), tp_slowtimo(), tp_drain();
     72  1.1.1.3  thorpej int	tp_ctloutput(), tp_usrreq();
     73      1.1      cgd #endif
     74      1.1      cgd 
     75      1.1      cgd #ifdef EON
     76  1.1.1.2  thorpej void	eoninput(), eonctlinput(), eonprotoinit();
     77  1.1.1.2  thorpej #endif /* EON */
     78      1.1      cgd 
     79      1.1      cgd extern	struct domain inetdomain;
     80      1.1      cgd 
     81      1.1      cgd struct protosw inetsw[] = {
     82      1.1      cgd { 0,		&inetdomain,	0,		0,
     83      1.1      cgd   0,		ip_output,	0,		0,
     84      1.1      cgd   0,
     85  1.1.1.2  thorpej   ip_init,	0,		ip_slowtimo,	ip_drain,	ip_sysctl
     86      1.1      cgd },
     87      1.1      cgd { SOCK_DGRAM,	&inetdomain,	IPPROTO_UDP,	PR_ATOMIC|PR_ADDR,
     88      1.1      cgd   udp_input,	0,		udp_ctlinput,	ip_ctloutput,
     89      1.1      cgd   udp_usrreq,
     90  1.1.1.2  thorpej   udp_init,	0,		0,		0,		udp_sysctl
     91      1.1      cgd },
     92      1.1      cgd { SOCK_STREAM,	&inetdomain,	IPPROTO_TCP,	PR_CONNREQUIRED|PR_WANTRCVD,
     93      1.1      cgd   tcp_input,	0,		tcp_ctlinput,	tcp_ctloutput,
     94      1.1      cgd   tcp_usrreq,
     95      1.1      cgd   tcp_init,	tcp_fasttimo,	tcp_slowtimo,	tcp_drain,
     96      1.1      cgd },
     97      1.1      cgd { SOCK_RAW,	&inetdomain,	IPPROTO_RAW,	PR_ATOMIC|PR_ADDR,
     98      1.1      cgd   rip_input,	rip_output,	0,		rip_ctloutput,
     99      1.1      cgd   rip_usrreq,
    100      1.1      cgd   0,		0,		0,		0,
    101      1.1      cgd },
    102      1.1      cgd { SOCK_RAW,	&inetdomain,	IPPROTO_ICMP,	PR_ATOMIC|PR_ADDR,
    103      1.1      cgd   icmp_input,	rip_output,	0,		rip_ctloutput,
    104      1.1      cgd   rip_usrreq,
    105  1.1.1.2  thorpej   0,		0,		0,		0,		icmp_sysctl
    106  1.1.1.2  thorpej },
    107  1.1.1.2  thorpej { SOCK_RAW,	&inetdomain,	IPPROTO_IGMP,	PR_ATOMIC|PR_ADDR,
    108  1.1.1.2  thorpej   igmp_input,	rip_output,	0,		rip_ctloutput,
    109  1.1.1.2  thorpej   rip_usrreq,
    110  1.1.1.2  thorpej   igmp_init,	igmp_fasttimo,	0,		0,
    111      1.1      cgd },
    112      1.1      cgd #ifdef TPIP
    113      1.1      cgd { SOCK_SEQPACKET,&inetdomain,	IPPROTO_TP,	PR_CONNREQUIRED|PR_WANTRCVD,
    114  1.1.1.2  thorpej   tpip_input,	0,		tpip_ctlinput,	tp_ctloutput,
    115      1.1      cgd   tp_usrreq,
    116      1.1      cgd   tp_init,	0,		tp_slowtimo,	tp_drain,
    117      1.1      cgd },
    118      1.1      cgd #endif
    119      1.1      cgd /* EON (ISO CLNL over IP) */
    120      1.1      cgd #ifdef EON
    121      1.1      cgd { SOCK_RAW,	&inetdomain,	IPPROTO_EON,	0,
    122      1.1      cgd   eoninput,	0,		eonctlinput,		0,
    123      1.1      cgd   0,
    124      1.1      cgd   eonprotoinit,	0,		0,		0,
    125      1.1      cgd },
    126      1.1      cgd #endif
    127      1.1      cgd #ifdef NSIP
    128      1.1      cgd { SOCK_RAW,	&inetdomain,	IPPROTO_IDP,	PR_ATOMIC|PR_ADDR,
    129      1.1      cgd   idpip_input,	rip_output,	nsip_ctlinput,	0,
    130      1.1      cgd   rip_usrreq,
    131      1.1      cgd   0,		0,		0,		0,
    132      1.1      cgd },
    133      1.1      cgd #endif
    134      1.1      cgd 	/* raw wildcard */
    135      1.1      cgd { SOCK_RAW,	&inetdomain,	0,		PR_ATOMIC|PR_ADDR,
    136      1.1      cgd   rip_input,	rip_output,	0,		rip_ctloutput,
    137      1.1      cgd   rip_usrreq,
    138  1.1.1.2  thorpej   rip_init,	0,		0,		0,
    139      1.1      cgd },
    140      1.1      cgd };
    141      1.1      cgd 
    142      1.1      cgd struct domain inetdomain =
    143      1.1      cgd     { AF_INET, "internet", 0, 0, 0,
    144  1.1.1.2  thorpej       inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])], 0,
    145  1.1.1.2  thorpej       rn_inithead, 32, sizeof(struct sockaddr_in) };
    146      1.1      cgd 
    147  1.1.1.2  thorpej #include "imp.h"
    148      1.1      cgd #if NIMP > 0
    149      1.1      cgd extern	struct domain impdomain;
    150  1.1.1.2  thorpej int	rimp_output(), hostslowtimo();
    151      1.1      cgd 
    152      1.1      cgd struct protosw impsw[] = {
    153      1.1      cgd { SOCK_RAW,	&impdomain,	0,		PR_ATOMIC|PR_ADDR,
    154      1.1      cgd   0,		rimp_output,	0,		0,
    155      1.1      cgd   rip_usrreq,
    156      1.1      cgd   0,		0,		hostslowtimo,	0,
    157      1.1      cgd },
    158      1.1      cgd };
    159      1.1      cgd 
    160      1.1      cgd struct domain impdomain =
    161      1.1      cgd     { AF_IMPLINK, "imp", 0, 0, 0,
    162      1.1      cgd       impsw, &impsw[sizeof (impsw)/sizeof(impsw[0])] };
    163      1.1      cgd #endif
    164      1.1      cgd 
    165  1.1.1.2  thorpej #include "hy.h"
    166  1.1.1.2  thorpej #if NHY > 0
    167  1.1.1.2  thorpej /*
    168  1.1.1.2  thorpej  * HYPERchannel protocol family: raw interface.
    169  1.1.1.2  thorpej  */
    170  1.1.1.2  thorpej int	rhy_output();
    171  1.1.1.2  thorpej extern	struct domain hydomain;
    172  1.1.1.2  thorpej 
    173  1.1.1.2  thorpej struct protosw hysw[] = {
    174  1.1.1.2  thorpej { SOCK_RAW,	&hydomain,	0,		PR_ATOMIC|PR_ADDR,
    175  1.1.1.2  thorpej   0,		rhy_output,	0,		0,
    176  1.1.1.2  thorpej   rip_usrreq,
    177  1.1.1.2  thorpej   0,		0,		0,		0,
    178  1.1.1.2  thorpej },
    179  1.1.1.2  thorpej };
    180  1.1.1.2  thorpej 
    181  1.1.1.2  thorpej struct domain hydomain =
    182  1.1.1.2  thorpej     { AF_HYLINK, "hy", 0, 0, 0, hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] };
    183  1.1.1.2  thorpej #endif
    184