fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark/*
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * CDDL HEADER START
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark *
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * The contents of this file are subject to the terms of the
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * Common Development and Distribution License (the "License").
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * You may not use this file except in compliance with the License.
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark *
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * or http://www.opensolaris.org/os/licensing.
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * See the License for the specific language governing permissions
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * and limitations under the License.
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark *
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * When distributing Covered Code, include this CDDL HEADER in each
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * If applicable, add the following below this CDDL HEADER, with the
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * fields enclosed by brackets "[]" replaced with your own identifying
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * information: Portions Copyright [yyyy] [name of copyright owner]
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark *
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * CDDL HEADER END
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark */
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark/*
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * Use is subject to license terms.
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark */
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark#pragma ident "%Z%%M% %I% %E% SMI"
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark#include <sys/types.h>
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark#include <sys/conf.h>
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark#include <sys/modctl.h>
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark#include <inet/common.h>
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark/*
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * Dummy streams module that is used by ICMP, UDP, and TCP by setting
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * INETMODSTRTAB to dummymodinfo
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark *
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * It's reason for existance is so that mibopen() that I_PUSH icmp, udp, and
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * tcp can continue to push modules with those names, even though all the
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * MIB information comes from IP.
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark */
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmarkstatic int dummy_modclose(queue_t *q);
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmarkstatic int dummy_modopen(queue_t *q, dev_t *devp, int flag,
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark int sflag, cred_t *credp);
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark/*
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * This is common code for the tcp, udp, and icmp streams module which is
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * an empty STREAMS module provided for compatibility for mibopen()
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark * code which I_PUSH modules with those names.
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark */
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmarkstruct module_info dummy_mod_info = {
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark 5799, "dummymod", 1, INFPSZ, 65536, 1024
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark};
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmarkstatic struct qinit dummyrmodinit = {
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark (pfi_t)putnext, NULL, dummy_modopen, dummy_modclose, NULL,
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark &dummy_mod_info
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark};
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmarkstatic struct qinit dummywmodinit = {
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark (pfi_t)putnext, NULL, NULL, NULL, NULL, &dummy_mod_info
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark};
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmarkstruct streamtab dummymodinfo = {
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark &dummyrmodinit, &dummywmodinit
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark};
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmarkstatic int
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmarkdummy_modclose(queue_t *q)
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark{
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark qprocsoff(q);
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark return (0);
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark}
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark/* ARGSUSED */
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmarkstatic int
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmarkdummy_modopen(queue_t *q, dev_t *devp, int flag, int sflag, cred_t *credp)
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark{
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark /* If the stream is already open, return immediately. */
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark if (q->q_ptr != NULL)
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark return (0);
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark /* If this is not a push of dummy as a module, fail. */
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark if (sflag != MODOPEN)
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark return (EINVAL);
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark qprocson(q);
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark return (0);
fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4nordmark}