Unleashed v1.4
[unleashed.git] / kernel / net / ip / ip_dummy.c
blob0cdb3b1304ad9bcdfcf983a57acf4c4de05e92b8
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #include <sys/types.h>
27 #include <sys/conf.h>
28 #include <sys/modctl.h>
29 #include <inet/common.h>
32 * Dummy streams module that is used by ICMP, UDP, and TCP by setting
33 * INETMODSTRTAB to dummymodinfo
35 * It's reason for existance is so that mibopen() that I_PUSH icmp, udp, and
36 * tcp can continue to push modules with those names, even though all the
37 * MIB information comes from IP.
40 static int dummy_wput(queue_t *, mblk_t *);
41 static int dummy_modclose(queue_t *, int, cred_t *);
42 static int dummy_modopen(queue_t *q, dev_t *devp, int flag,
43 int sflag, cred_t *credp);
46 * This is common code for the tcp, udp, and icmp streams module which is
47 * an empty STREAMS module provided for compatibility for mibopen()
48 * code which I_PUSH modules with those names.
50 struct module_info dummy_mod_info = {
51 5799, "dummymod", 1, INFPSZ, 65536, 1024
55 static struct qinit dummyrmodinit = {
56 dummy_wput, NULL, dummy_modopen, dummy_modclose, NULL,
57 &dummy_mod_info
60 static struct qinit dummywmodinit = {
61 dummy_wput, NULL, NULL, NULL, NULL, &dummy_mod_info
64 struct streamtab dummymodinfo = {
65 &dummyrmodinit, &dummywmodinit
68 /* ARGSUSED */
69 static int
70 dummy_wput(queue_t *q, mblk_t *m)
72 putnext(q, m);
73 return (0);
76 static int
77 dummy_modclose(queue_t *q, int flags __unused, cred_t *credp __unused)
79 qprocsoff(q);
80 return (0);
83 /* ARGSUSED */
84 static int
85 dummy_modopen(queue_t *q, dev_t *devp, int flag, int sflag, cred_t *credp)
87 /* If the stream is already open, return immediately. */
88 if (q->q_ptr != NULL)
89 return (0);
91 /* If this is not a push of dummy as a module, fail. */
92 if (sflag != MODOPEN)
93 return (EINVAL);
95 qprocson(q);
96 return (0);