FreeBSD/Linux Kernel Cross Reference
sys/netns/ns_proto.c
1 /* $NetBSD: ns_proto.c,v 1.12 2003/08/07 16:33:46 agc Exp $ */
2
3 /*
4 * Copyright (c) 1984, 1985, 1986, 1987, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)ns_proto.c 8.2 (Berkeley) 2/9/95
32 */
33
34 #include <sys/cdefs.h>
35 __KERNEL_RCSID(0, "$NetBSD: ns_proto.c,v 1.12 2003/08/07 16:33:46 agc Exp $");
36
37 #include <sys/param.h>
38 #include <sys/socket.h>
39 #include <sys/protosw.h>
40 #include <sys/domain.h>
41 #include <sys/mbuf.h>
42
43 #include <net/if.h>
44 #include <net/radix.h>
45 #include <net/route.h>
46
47 /*
48 * NS protocol family: IDP, ERR, PE, SPP, ROUTE.
49 */
50 #include <netns/ns.h>
51 #include <netns/ns_pcb.h>
52 #include <netns/ns_if.h>
53 #include <netns/ns_var.h>
54 #include <netns/idp.h>
55 #include <netns/idp_var.h>
56 #include <netns/ns_error.h>
57 #include <netns/sp.h>
58 #include <netns/spidp.h>
59 #include <netns/spp_timer.h>
60 #include <netns/spp_var.h>
61
62 extern struct domain nsdomain;
63
64 struct protosw nssw[] = {
65 { 0, &nsdomain, 0, 0,
66 0, idp_output, 0, 0,
67 0,
68 ns_init, 0, 0, 0,
69 },
70 { SOCK_DGRAM, &nsdomain, 0, PR_ATOMIC|PR_ADDR,
71 0, 0, idp_ctlinput, idp_ctloutput,
72 idp_usrreq,
73 0, 0, 0, 0,
74 },
75 { SOCK_STREAM, &nsdomain, NSPROTO_SPP, PR_CONNREQUIRED|PR_WANTRCVD,
76 spp_input, 0, spp_ctlinput, spp_ctloutput,
77 spp_usrreq,
78 spp_init, spp_fasttimo, spp_slowtimo, 0,
79 },
80 { SOCK_SEQPACKET,&nsdomain, NSPROTO_SPP, PR_CONNREQUIRED|PR_WANTRCVD|PR_ATOMIC|PR_LISTEN|PR_ABRTACPTDIS,
81 spp_input, 0, spp_ctlinput, spp_ctloutput,
82 spp_usrreq_sp,
83 0, 0, 0, 0,
84 },
85 { SOCK_RAW, &nsdomain, NSPROTO_RAW, PR_ATOMIC|PR_ADDR,
86 idp_input, idp_output, 0, idp_ctloutput,
87 idp_raw_usrreq,
88 0, 0, 0, 0,
89 },
90 { SOCK_RAW, &nsdomain, NSPROTO_ERROR, PR_ATOMIC|PR_ADDR,
91 0, idp_output, idp_ctlinput, idp_ctloutput,
92 idp_raw_usrreq,
93 0, 0, 0, 0,
94 },
95 };
96
97 struct domain nsdomain =
98 { PF_NS, "network systems", 0, 0, 0,
99 nssw, &nssw[sizeof(nssw)/sizeof(nssw[0])], 0,
100 rn_inithead, 16, sizeof(struct sockaddr_ns)};
101
Cache object: 5083c4e1913541db658b1f8d9ff17642
|