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