xref: /original-bsd/sys/netns/ns_proto.c (revision 7211505a)
1 /*
2  * Copyright (c) 1984, 1985, 1986, 1987 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)ns_proto.c	7.3 (Berkeley) 06/29/88
18  */
19 
20 #include "param.h"
21 #include "socket.h"
22 #include "protosw.h"
23 #include "domain.h"
24 #include "mbuf.h"
25 
26 #include "ns.h"
27 
28 /*
29  * NS protocol family: IDP, ERR, PE, SPP, ROUTE.
30  */
31 int	ns_init();
32 int	idp_input(), idp_output(), idp_ctlinput(), idp_usrreq();
33 int	idp_raw_usrreq(), idp_ctloutput();
34 int	spp_input(), spp_ctlinput();
35 int	spp_usrreq(), spp_usrreq_sp(), spp_ctloutput();
36 int	spp_init(), spp_fasttimo(), spp_slowtimo();
37 extern	int raw_usrreq();
38 
39 extern	struct domain nsdomain;
40 
41 struct protosw nssw[] = {
42 { 0,		&nsdomain,	0,		0,
43   0,		idp_output,	0,		0,
44   0,
45   ns_init,	0,		0,		0,
46 },
47 { SOCK_DGRAM,	&nsdomain,	0,		PR_ATOMIC|PR_ADDR,
48   0,		0,		idp_ctlinput,	idp_ctloutput,
49   idp_usrreq,
50   0,		0,		0,		0,
51 },
52 { SOCK_STREAM,	&nsdomain,	NSPROTO_SPP,	PR_CONNREQUIRED|PR_WANTRCVD,
53   spp_input,	0,		spp_ctlinput,	spp_ctloutput,
54   spp_usrreq,
55   spp_init,	spp_fasttimo,	spp_slowtimo,	0,
56 },
57 { SOCK_SEQPACKET,&nsdomain,	NSPROTO_SPP,	PR_CONNREQUIRED|PR_WANTRCVD|PR_ATOMIC,
58   spp_input,	0,		spp_ctlinput,	spp_ctloutput,
59   spp_usrreq_sp,
60   0,		0,		0,		0,
61 },
62 { SOCK_RAW,	&nsdomain,	NSPROTO_RAW,	PR_ATOMIC|PR_ADDR,
63   idp_input,	idp_output,	0,		idp_ctloutput,
64   idp_raw_usrreq,
65   0,		0,		0,		0,
66 },
67 { SOCK_RAW,	&nsdomain,	NSPROTO_ERROR,	PR_ATOMIC|PR_ADDR,
68   idp_ctlinput,	idp_output,	0,		idp_ctloutput,
69   idp_raw_usrreq,
70   0,		0,		0,		0,
71 },
72 };
73 
74 struct domain nsdomain =
75     { AF_NS, "network systems", 0, 0, 0,
76       nssw, &nssw[sizeof(nssw)/sizeof(nssw[0])] };
77 
78