xref: /original-bsd/sys/netns/ns_proto.c (revision 860e07fc)
1 /*
2  * Copyright (c) 1984, 1985, 1986, 1987 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)ns_proto.c	7.5 (Berkeley) 07/09/92
8  */
9 
10 #include "param.h"
11 #include "socket.h"
12 #include "protosw.h"
13 #include "domain.h"
14 #include "mbuf.h"
15 #include "net/radix.h"
16 
17 #include "ns.h"
18 
19 /*
20  * NS protocol family: IDP, ERR, PE, SPP, ROUTE.
21  */
22 int	ns_init();
23 int	idp_input(), idp_output(), idp_ctlinput(), idp_usrreq();
24 int	idp_raw_usrreq(), idp_ctloutput();
25 int	spp_input(), spp_ctlinput();
26 int	spp_usrreq(), spp_usrreq_sp(), spp_ctloutput();
27 int	spp_init(), spp_fasttimo(), spp_slowtimo();
28 extern	int raw_usrreq();
29 
30 extern	struct domain nsdomain;
31 
32 struct protosw nssw[] = {
33 { 0,		&nsdomain,	0,		0,
34   0,		idp_output,	0,		0,
35   0,
36   ns_init,	0,		0,		0,
37 },
38 { SOCK_DGRAM,	&nsdomain,	0,		PR_ATOMIC|PR_ADDR,
39   0,		0,		idp_ctlinput,	idp_ctloutput,
40   idp_usrreq,
41   0,		0,		0,		0,
42 },
43 { SOCK_STREAM,	&nsdomain,	NSPROTO_SPP,	PR_CONNREQUIRED|PR_WANTRCVD,
44   spp_input,	0,		spp_ctlinput,	spp_ctloutput,
45   spp_usrreq,
46   spp_init,	spp_fasttimo,	spp_slowtimo,	0,
47 },
48 { SOCK_SEQPACKET,&nsdomain,	NSPROTO_SPP,	PR_CONNREQUIRED|PR_WANTRCVD|PR_ATOMIC,
49   spp_input,	0,		spp_ctlinput,	spp_ctloutput,
50   spp_usrreq_sp,
51   0,		0,		0,		0,
52 },
53 { SOCK_RAW,	&nsdomain,	NSPROTO_RAW,	PR_ATOMIC|PR_ADDR,
54   idp_input,	idp_output,	0,		idp_ctloutput,
55   idp_raw_usrreq,
56   0,		0,		0,		0,
57 },
58 { SOCK_RAW,	&nsdomain,	NSPROTO_ERROR,	PR_ATOMIC|PR_ADDR,
59   idp_ctlinput,	idp_output,	0,		idp_ctloutput,
60   idp_raw_usrreq,
61   0,		0,		0,		0,
62 },
63 };
64 
65 struct domain nsdomain =
66     { AF_NS, "network systems", 0, 0, 0,
67       nssw, &nssw[sizeof(nssw)/sizeof(nssw[0])], 0,
68       rn_inithead, 16, sizeof(struct sockaddr_ns)};
69 
70