1 5240 nordmark /* 2 5240 nordmark * CDDL HEADER START 3 5240 nordmark * 4 5240 nordmark * The contents of this file are subject to the terms of the 5 5240 nordmark * Common Development and Distribution License (the "License"). 6 5240 nordmark * You may not use this file except in compliance with the License. 7 5240 nordmark * 8 5240 nordmark * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 5240 nordmark * or http://www.opensolaris.org/os/licensing. 10 5240 nordmark * See the License for the specific language governing permissions 11 5240 nordmark * and limitations under the License. 12 5240 nordmark * 13 5240 nordmark * When distributing Covered Code, include this CDDL HEADER in each 14 5240 nordmark * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 5240 nordmark * If applicable, add the following below this CDDL HEADER, with the 16 5240 nordmark * fields enclosed by brackets "[]" replaced with your own identifying 17 5240 nordmark * information: Portions Copyright [yyyy] [name of copyright owner] 18 5240 nordmark * 19 5240 nordmark * CDDL HEADER END 20 5240 nordmark */ 21 5240 nordmark /* 22 5240 nordmark * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23 5240 nordmark * Use is subject to license terms. 24 5240 nordmark */ 25 5240 nordmark 26 5240 nordmark #pragma ident "%Z%%M% %I% %E% SMI" 27 5240 nordmark 28 5240 nordmark #include <sys/types.h> 29 5240 nordmark #include <sys/conf.h> 30 5240 nordmark #include <sys/modctl.h> 31 5240 nordmark #include <inet/common.h> 32 5240 nordmark 33 5240 nordmark /* 34 5240 nordmark * Dummy streams module that is used by ICMP, UDP, and TCP by setting 35 5240 nordmark * INETMODSTRTAB to dummymodinfo 36 5240 nordmark * 37 5240 nordmark * It's reason for existance is so that mibopen() that I_PUSH icmp, udp, and 38 5240 nordmark * tcp can continue to push modules with those names, even though all the 39 5240 nordmark * MIB information comes from IP. 40 5240 nordmark */ 41 5240 nordmark 42 5240 nordmark static int dummy_modclose(queue_t *q); 43 5240 nordmark static int dummy_modopen(queue_t *q, dev_t *devp, int flag, 44 5240 nordmark int sflag, cred_t *credp); 45 5240 nordmark 46 5240 nordmark /* 47 5240 nordmark * This is common code for the tcp, udp, and icmp streams module which is 48 5240 nordmark * an empty STREAMS module provided for compatibility for mibopen() 49 5240 nordmark * code which I_PUSH modules with those names. 50 5240 nordmark */ 51 5240 nordmark struct module_info dummy_mod_info = { 52 5240 nordmark 5799, "dummymod", 1, INFPSZ, 65536, 1024 53 5240 nordmark }; 54 5240 nordmark 55 5240 nordmark 56 5240 nordmark static struct qinit dummyrmodinit = { 57 5240 nordmark (pfi_t)putnext, NULL, dummy_modopen, dummy_modclose, NULL, 58 5240 nordmark &dummy_mod_info 59 5240 nordmark }; 60 5240 nordmark 61 5240 nordmark static struct qinit dummywmodinit = { 62 5240 nordmark (pfi_t)putnext, NULL, NULL, NULL, NULL, &dummy_mod_info 63 5240 nordmark }; 64 5240 nordmark 65 5240 nordmark struct streamtab dummymodinfo = { 66 5240 nordmark &dummyrmodinit, &dummywmodinit 67 5240 nordmark }; 68 5240 nordmark 69 5240 nordmark static int 70 5240 nordmark dummy_modclose(queue_t *q) 71 5240 nordmark { 72 5240 nordmark qprocsoff(q); 73 5240 nordmark return (0); 74 5240 nordmark } 75 5240 nordmark 76 5240 nordmark /* ARGSUSED */ 77 5240 nordmark static int 78 5240 nordmark dummy_modopen(queue_t *q, dev_t *devp, int flag, int sflag, cred_t *credp) 79 5240 nordmark { 80 5240 nordmark /* If the stream is already open, return immediately. */ 81 5240 nordmark if (q->q_ptr != NULL) 82 5240 nordmark return (0); 83 5240 nordmark 84 5240 nordmark /* If this is not a push of dummy as a module, fail. */ 85 5240 nordmark if (sflag != MODOPEN) 86 5240 nordmark return (EINVAL); 87 5240 nordmark 88 5240 nordmark qprocson(q); 89 5240 nordmark return (0); 90 5240 nordmark } 91