--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/meta-packages/history/SUNWnet-snmp-addons.p5m Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,34 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# Legacy package information for renamed SUNWnet-snmp-addons package
+#
+
+set name=pkg.fmri value=pkg://solaris/[email protected],5.11-0.133
+set name=pkg.renamed value=true
+
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+
+depend fmri=consolidation/sfw/sfw-incorporation type=require
+depend fmri=system/management/snmp/net-snmp/[email protected] type=require
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/meta-packages/history/SUNWnet-snmp-core.p5m Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,34 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# Legacy package information for renamed SUNWnet-snmp-core package
+#
+
+set name=pkg.fmri value=pkg://solaris/[email protected],5.11-0.133
+set name=pkg.renamed value=true
+
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+
+depend fmri=consolidation/sfw/sfw-incorporation type=require
+depend fmri=system/management/snmp/[email protected] type=require
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/meta-packages/history/SUNWnet-snmp-doc.p5m Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,34 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# Legacy package information for renamed SUNWnet-snmp-doc package
+#
+
+set name=pkg.fmri value=pkg://solaris/[email protected],5.11-0.133
+set name=pkg.renamed value=true
+
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+
+depend fmri=consolidation/sfw/sfw-incorporation type=require
+depend fmri=system/management/snmp/net-snmp/[email protected] type=require
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/meta-packages/history/SUNWnet-snmp-utils.p5m Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,34 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# Legacy package information for renamed SUNWnet-snmp-utils package
+#
+
+set name=pkg.fmri value=pkg://solaris/[email protected],5.11-0.132
+set name=pkg.renamed value=true
+
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+
+depend [email protected] type=require
+depend fmri=consolidation/sfw/sfw-incorporation type=require
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,122 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../make-rules/shared-macros.mk
+
+PATH=$(SPRO_VROOT)/bin:/usr/gnu/bin:/usr/bin
+DOXYGEN=/usr/bin/doxygen
+
+COMPONENT_NAME= net-snmp
+COMPONENT_VERSION= 5.4.1
+PERL_VERSION= 5.8.4
+COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.gz
+COMPONENT_ARCHIVE_HASH= sha1:ac5ba033c10d53d3057415121f8c4936c643c208
+#COMPONENT_ARCHIVE_URL= http://ftp.ntua.gr/mirror/net-snmp/net-snmp/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
+COMPONENT_ARCHIVE_URL= http://ftp.ntua.gr/mirror/net-snmp/OldFiles/net-snmp-5.4.x/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
+
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/configure.mk
+include $(WS_TOP)/make-rules/ips.mk
+
+CFLAGS += $(studio_C99_ENABLE)
+CPPFLAGS += "-DFALSE_SHARING_ALIGN=64"
+
+CONFIGURE_OPTIONS += --with-default-snmp-version=3
+CONFIGURE_OPTIONS += --with-sys-contact="root@localhost"
+CONFIGURE_OPTIONS += --with-sys-location=Unknown
+CONFIGURE_OPTIONS += --with-logfile=/var/log/snmpd.log
+CONFIGURE_OPTIONS += --with-persistent-directory=/var/net-snmp
+
+CONFIGURE_OPTIONS += --with-mibdirs=/etc/net-snmp/snmp/mibs
+CONFIGURE_OPTIONS += --enable-agentx-dom-sock-only
+CONFIGURE_OPTIONS += --enable-ucd-snmp-compatibility
+CONFIGURE_OPTIONS += --enable-ipv6
+CONFIGURE_OPTIONS += --enable-mfd-rewrites
+CONFIGURE_OPTIONS += --with-pkcs
+CONFIGURE_OPTIONS += --with-transports="UDP TCP UDPIPv6 TCPIPv6"
+
+# Which MIB modules do we want to build
+MIB_MOBULES.sparc = ucd-snmp/lmSensors
+MIB_MODULES = host disman/event-mib ucd-snmp/diskio udp-mib tcp-mib if-mib
+MIB_MOBULES += $(MIB_MODULES.$(MACH))
+CONFIGURE_OPTIONS += --with-mib-modules="$(MIB_MODULES)"
+
+# Only build 32 bit Perl support
+PERL_ARGS = DESTDIR=$(PROTO_DIR) INSTALLDIRS=vendor
+CONFIGURE_OPTIONS.32 += PERL="$(PERL)"
+CONFIGURE_OPTIONS.32 += --with-perl-modules="$(PERL_ARGS)"
+CONFIGURE_OPTIONS.32 += --disable-perl-cc-checks
+
+CONFIGURE_OPTIONS.64 += --disable-embedded-perl
+CONFIGURE_OPTIONS.64 += --without-perl-modules
+
+CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
+CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)"
+CONFIGURE_OPTIONS += CC="$(CC)"
+
+ARCHNAME=$(shell $(PERL) -V:archname | sed -e "s/archname='\(.*\)'\;/\1/")
+
+PKG_MACROS += ARCHNAME=$(ARCHNAME)
+PKG_MACROS += BUILD_DIR=$(BUILD_DIR)
+PKG_MACROS += PERL_VERSION=$(PERL_VERSION)
+
+COMPONENT_PRE_CONFIGURE_ACTION = \
+ ($(CLONEY) $(SOURCE_DIR) $(@D); $(CLONEY) $(COMPONENT_DIR)/sun $(@D)/sun)
+
+# for the goofy definition of ARCH in the extra Makefiles
+ARCH=32
+ARCH=$(BITS:64=$(MACH64))
+
+CCSMAKE_ARGS = CC="$(CC)" CFGPREFIX=/usr CFGLIB64=/usr/lib/$(MACH64)
+CCSMAKE_ARGS += CFGLIB=/usr/lib ARCH=$(ARCH) ROOT=$(PROTO_DIR)
+
+$(BUILD_32): COMPONENT_POST_BUILD_ACTION= \
+ (cd $(BUILD_DIR)/$(MACH32)/sun ; ls agent; $(CCSMAKE) -e $(CCSMAKE_ARGS))
+
+$(BUILD_64): COMPONENT_POST_BUILD_ACTION= \
+ (cd $(BUILD_DIR)/$(MACH64)/sun ; ls agent; $(CCSMAKE) -e $(CCSMAKE_ARGS))
+
+$(INSTALL_32): COMPONENT_POST_INSTALL_ACTION= \
+ ($(MKDIR) -p $(BUILD_DIR)/prototype/$(MACH)/etc/net-snmp/snmp/mibs; \
+ cd $(BUILD_DIR)/$(MACH32)/sun ; ls agent; $(CCSMAKE) -e $(CCSMAKE_ARGS) install)
+
+$(INSTALL_64): COMPONENT_POST_INSTALL_ACTION= \
+ ($(MKDIR) -p $(BUILD_DIR)/prototype/$(MACH64)/etc/net-snmp/snmp/mibs; \
+ cd $(BUILD_DIR)/$(MACH64)/sun ; ls agent; $(CCSMAKE) -e $(CCSMAKE_ARGS) install)
+
+# common targets
+build: $(BUILD_32_and_64) $(BUILD_DIR_32)/.docs
+
+$(INSTALL_64): COMPONENT_INSTALL_ARGS += DESTDIR=$(BUILD_DIR)/prototype/$(MACH64)
+
+install: build $(INSTALL_32_and_64)
+
+test: $(BUILD_32)
+ $(KSH93) ./run-tests $(BUILD_DIR) $(MACH32) $(MACH64)
+
+# build the docs
+$(BUILD_DIR_32)/.docs:
+ (cd $(@D) ; $(ENV) srcdir=$(@D) $(DOXYGEN) -u $(@D)/doxygen.conf ; \
+ $(ENV) srcdir=$(@D) $(DOXYGEN) $(@D)/doxygen.conf)
+ $(TOUCH) $@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/net-snmp-addons.p5m Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,44 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+
+set name=pkg.fmri value=pkg:/system/management/snmp/net-snmp/addons@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary value="Net-SNMP addon libraries"
+set name=info.classification value="org.opensolaris.category.2008:System/Enterprise Management"
+set name=info.upstream_url value="http://www.net-snmp.org/"
+set name=info.source_url value=$(COMPONENT_ARCHIVE_URL)
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+set name=opensolaris.arc_url \
+ value=http://arc.opensolaris.org/caselog/LSARC/2008/355
+
+license COPYING license="BSD, BSD-like"
+
+dir path=usr
+dir path=usr/lib
+dir path=usr/lib/$(MACH64)
+
+file $(MACH64)/sun/agent/modules/seaExtensions/libseaExtensions.so path=usr/lib/$(MACH64)/libseaExtensions.so
+file $(MACH32)/sun/agent/modules/seaExtensions/libseaExtensions.so path=usr/lib/libseaExtensions.so
+
+legacy pkg=SUNWnet-snmp-addons \
+ name="Net-SNMP addon libraries" \
+ desc="Net-SNMP addon libraries (5.4.1)"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/net-snmp-base.p5m Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,590 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+
+<transform file path=usr.*/man/.+ -> default mangler.man.stability volatile>
+
+set name=pkg.fmri value=pkg:/system/management/snmp/net-snmp@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary value="Net-SNMP Agent files and libraries"
+set name=info.upstream_url value="http://www.net-snmp.org/"
+set name=info.source_url value=$(COMPONENT_ARCHIVE_URL)
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+set name=info.classification value="org.opensolaris.category.2008:System/Enterprise Management"
+
+set name=opensolaris.arc_url \
+ value=http://arc.opensolaris.org/caselog/LSARC/2008/355
+
+license COPYING license="BSD, BSD-like"
+
+dir path=etc
+dir path=etc/net-snmp
+dir path=etc/net-snmp/snmp
+dir path=etc/net-snmp/snmp/mib2c-data
+dir path=etc/net-snmp/snmp/mibs
+dir path=etc/net-snmp/snmp/snmpconf-data
+dir path=etc/net-snmp/snmp/snmpconf-data/snmp-data
+dir path=etc/net-snmp/snmp/snmpconf-data/snmpd-data
+dir path=etc/net-snmp/snmp/snmpconf-data/snmptrapd-data
+dir path=lib
+dir path=lib/svc
+dir path=lib/svc/manifest group=sys
+dir path=lib/svc/manifest/application group=sys
+dir path=lib/svc/manifest/application/management group=sys
+dir path=lib/svc/method
+dir path=usr
+dir path=usr/bin
+dir path=usr/include
+dir path=usr/include/net-snmp
+dir path=usr/include/net-snmp/agent
+dir path=usr/include/net-snmp/library
+dir path=usr/include/net-snmp/machine
+dir path=usr/include/net-snmp/snmplib
+dir path=usr/include/net-snmp/system
+dir path=usr/include/ucd-snmp
+dir path=usr/lib
+dir path=usr/lib/$(MACH64)
+dir path=usr/lib/net-snmp
+dir path=usr/perl5
+dir path=usr/perl5/$(PERL_VERSION)
+dir path=usr/perl5/$(PERL_VERSION)/man
+dir path=usr/perl5/$(PERL_VERSION)/man/man3
+dir path=usr/perl5/vendor_perl
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/Bundle
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/Bundle/NetSNMP
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/agent
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/agent/default_store
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/ASN
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/default_store
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/OID
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/TrapReceiver
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/SNMP
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/Bundle
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/NetSNMP
+dir path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/NetSNMP/agent
+dir path=usr/sbin
+dir path=usr/sbin/$(MACH64)
+dir path=usr/sbin/$(MACH32)
+file local/mib2c-conf.d/default-mfd-top.m2c path=etc/net-snmp/snmp/mib2c-data/default-mfd-top.m2c
+file local/mib2c-conf.d/details-enums.m2i path=etc/net-snmp/snmp/mib2c-data/details-enums.m2i
+file local/mib2c-conf.d/details-node.m2i path=etc/net-snmp/snmp/mib2c-data/details-node.m2i
+file local/mib2c-conf.d/details-table.m2i path=etc/net-snmp/snmp/mib2c-data/details-table.m2i
+file local/mib2c-conf.d/generic-ctx-copy.m2i path=etc/net-snmp/snmp/mib2c-data/generic-ctx-copy.m2i
+file local/mib2c-conf.d/generic-ctx-get.m2i path=etc/net-snmp/snmp/mib2c-data/generic-ctx-get.m2i
+file local/mib2c-conf.d/generic-ctx-set.m2i path=etc/net-snmp/snmp/mib2c-data/generic-ctx-set.m2i
+file local/mib2c-conf.d/generic-data-allocate.m2i path=etc/net-snmp/snmp/mib2c-data/generic-data-allocate.m2i
+file local/mib2c-conf.d/generic-data-context.m2i path=etc/net-snmp/snmp/mib2c-data/generic-data-context.m2i
+file local/mib2c-conf.d/generic-get-char.m2i path=etc/net-snmp/snmp/mib2c-data/generic-get-char.m2i
+file local/mib2c-conf.d/generic-get-decl-bot.m2i path=etc/net-snmp/snmp/mib2c-data/generic-get-decl-bot.m2i
+file local/mib2c-conf.d/generic-get-decl.m2i path=etc/net-snmp/snmp/mib2c-data/generic-get-decl.m2i
+file local/mib2c-conf.d/generic-get-long.m2i path=etc/net-snmp/snmp/mib2c-data/generic-get-long.m2i
+file local/mib2c-conf.d/generic-get-oid.m2i path=etc/net-snmp/snmp/mib2c-data/generic-get-oid.m2i
+file local/mib2c-conf.d/generic-header-bottom.m2i path=etc/net-snmp/snmp/mib2c-data/generic-header-bottom.m2i
+file local/mib2c-conf.d/generic-header-top.m2i path=etc/net-snmp/snmp/mib2c-data/generic-header-top.m2i
+file local/mib2c-conf.d/generic-source-includes.m2i path=etc/net-snmp/snmp/mib2c-data/generic-source-includes.m2i
+file local/mib2c-conf.d/generic-table-constants.m2c path=etc/net-snmp/snmp/mib2c-data/generic-table-constants.m2c
+file local/mib2c-conf.d/generic-table-enums.m2c path=etc/net-snmp/snmp/mib2c-data/generic-table-enums.m2c
+file local/mib2c-conf.d/generic-table-indexes-from-oid.m2i path=etc/net-snmp/snmp/mib2c-data/generic-table-indexes-from-oid.m2i
+file local/mib2c-conf.d/generic-table-indexes-set.m2i path=etc/net-snmp/snmp/mib2c-data/generic-table-indexes-set.m2i
+file local/mib2c-conf.d/generic-table-indexes-to-oid.m2i path=etc/net-snmp/snmp/mib2c-data/generic-table-indexes-to-oid.m2i
+file local/mib2c-conf.d/generic-table-indexes-varbind-setup.m2i path=etc/net-snmp/snmp/mib2c-data/generic-table-indexes-varbind-setup.m2i
+file local/mib2c-conf.d/generic-table-indexes.m2i path=etc/net-snmp/snmp/mib2c-data/generic-table-indexes.m2i
+file local/mib2c-conf.d/generic-table-oids.m2c path=etc/net-snmp/snmp/mib2c-data/generic-table-oids.m2c
+file local/mib2c-conf.d/generic-value-map-func.m2i path=etc/net-snmp/snmp/mib2c-data/generic-value-map-func.m2i
+file local/mib2c-conf.d/generic-value-map-reverse.m2i path=etc/net-snmp/snmp/mib2c-data/generic-value-map-reverse.m2i
+file local/mib2c-conf.d/generic-value-map.m2i path=etc/net-snmp/snmp/mib2c-data/generic-value-map.m2i
+file local/mib2c-conf.d/m2c-internal-warning.m2i path=etc/net-snmp/snmp/mib2c-data/m2c-internal-warning.m2i
+file local/mib2c-conf.d/m2c_setup_enum.m2i path=etc/net-snmp/snmp/mib2c-data/m2c_setup_enum.m2i
+file local/mib2c-conf.d/m2c_setup_node.m2i path=etc/net-snmp/snmp/mib2c-data/m2c_setup_node.m2i
+file local/mib2c-conf.d/m2c_setup_table.m2i path=etc/net-snmp/snmp/mib2c-data/m2c_setup_table.m2i
+file local/mib2c-conf.d/m2c_table_save_defaults.m2i path=etc/net-snmp/snmp/mib2c-data/m2c_table_save_defaults.m2i
+file local/mib2c-conf.d/mfd-access-container-cached-defines.m2i path=etc/net-snmp/snmp/mib2c-data/mfd-access-container-cached-defines.m2i
+file local/mib2c-conf.d/mfd-access-unsorted-external-defines.m2i path=etc/net-snmp/snmp/mib2c-data/mfd-access-unsorted-external-defines.m2i
+file local/mib2c-conf.d/mfd-data-access.m2c path=etc/net-snmp/snmp/mib2c-data/mfd-data-access.m2c
+file local/mib2c-conf.d/mfd-data-get.m2c path=etc/net-snmp/snmp/mib2c-data/mfd-data-get.m2c
+file local/mib2c-conf.d/mfd-data-set.m2c path=etc/net-snmp/snmp/mib2c-data/mfd-data-set.m2c
+file local/mib2c-conf.d/mfd-doxygen.m2c path=etc/net-snmp/snmp/mib2c-data/mfd-doxygen.m2c
+file local/mib2c-conf.d/mfd-interactive-setup.m2c path=etc/net-snmp/snmp/mib2c-data/mfd-interactive-setup.m2c
+file local/mib2c-conf.d/mfd-interface.m2c path=etc/net-snmp/snmp/mib2c-data/mfd-interface.m2c
+file local/mib2c-conf.d/mfd-makefile.m2m path=etc/net-snmp/snmp/mib2c-data/mfd-makefile.m2m
+file local/mib2c-conf.d/mfd-persistence.m2i path=etc/net-snmp/snmp/mib2c-data/mfd-persistence.m2i
+file local/mib2c-conf.d/mfd-readme.m2c path=etc/net-snmp/snmp/mib2c-data/mfd-readme.m2c
+file local/mib2c-conf.d/mfd-top.m2c path=etc/net-snmp/snmp/mib2c-data/mfd-top.m2c
+file local/mib2c-conf.d/node-get.m2i path=etc/net-snmp/snmp/mib2c-data/node-get.m2i
+file local/mib2c-conf.d/node-set.m2i path=etc/net-snmp/snmp/mib2c-data/node-set.m2i
+file local/mib2c-conf.d/node-storage.m2i path=etc/net-snmp/snmp/mib2c-data/node-storage.m2i
+file local/mib2c-conf.d/node-validate.m2i path=etc/net-snmp/snmp/mib2c-data/node-validate.m2i
+file local/mib2c-conf.d/node-varbind-validate.m2i path=etc/net-snmp/snmp/mib2c-data/node-varbind-validate.m2i
+file local/mib2c-conf.d/parent-dependencies.m2i path=etc/net-snmp/snmp/mib2c-data/parent-dependencies.m2i
+file local/mib2c-conf.d/parent-set.m2i path=etc/net-snmp/snmp/mib2c-data/parent-set.m2i
+file local/mib2c-conf.d/subagent.m2c path=etc/net-snmp/snmp/mib2c-data/subagent.m2c
+file local/mib2c-conf.d/syntax-COUNTER64-get.m2i path=etc/net-snmp/snmp/mib2c-data/syntax-COUNTER64-get.m2i
+file local/mib2c-conf.d/syntax-DateAndTime-get.m2d path=etc/net-snmp/snmp/mib2c-data/syntax-DateAndTime-get.m2d
+file local/mib2c-conf.d/syntax-DateAndTime-get.m2i path=etc/net-snmp/snmp/mib2c-data/syntax-DateAndTime-get.m2i
+file local/mib2c-conf.d/syntax-DateAndTime-readme.m2i path=etc/net-snmp/snmp/mib2c-data/syntax-DateAndTime-readme.m2i
+file local/mib2c-conf.d/syntax-InetAddress-get.m2i path=etc/net-snmp/snmp/mib2c-data/syntax-InetAddress-get.m2i
+file local/mib2c-conf.d/syntax-InetAddress-set.m2i path=etc/net-snmp/snmp/mib2c-data/syntax-InetAddress-set.m2i
+file local/mib2c-conf.d/syntax-InetAddressType-get.m2i path=etc/net-snmp/snmp/mib2c-data/syntax-InetAddressType-get.m2i
+file local/mib2c-conf.d/syntax-InetAddressType-set.m2i path=etc/net-snmp/snmp/mib2c-data/syntax-InetAddressType-set.m2i
+file local/mib2c-conf.d/syntax-RowStatus-dependencies.m2i path=etc/net-snmp/snmp/mib2c-data/syntax-RowStatus-dependencies.m2i
+file local/mib2c-conf.d/syntax-RowStatus-get.m2i path=etc/net-snmp/snmp/mib2c-data/syntax-RowStatus-get.m2i
+file local/mib2c-conf.d/syntax-RowStatus-varbind-validate.m2i path=etc/net-snmp/snmp/mib2c-data/syntax-RowStatus-varbind-validate.m2i
+file local/mib2c-conf.d/syntax-StorageType-dependencies.m2i path=etc/net-snmp/snmp/mib2c-data/syntax-StorageType-dependencies.m2i
+file local/mib2c-conf.d/syntax-TestAndIncr-get.m2i path=etc/net-snmp/snmp/mib2c-data/syntax-TestAndIncr-get.m2i
+file local/mib2c.access_functions.conf path=etc/net-snmp/snmp/mib2c.access_functions.conf
+file local/mib2c.array-user.conf path=etc/net-snmp/snmp/mib2c.array-user.conf
+file local/mib2c.check_values.conf path=etc/net-snmp/snmp/mib2c.check_values.conf
+file local/mib2c.check_values_local.conf path=etc/net-snmp/snmp/mib2c.check_values_local.conf
+file local/mib2c.column_defines.conf path=etc/net-snmp/snmp/mib2c.column_defines.conf
+file local/mib2c.column_enums.conf path=etc/net-snmp/snmp/mib2c.column_enums.conf
+file local/mib2c.column_storage.conf path=etc/net-snmp/snmp/mib2c.column_storage.conf
+file local/mib2c.conf path=etc/net-snmp/snmp/mib2c.conf
+file local/mib2c.container.conf path=etc/net-snmp/snmp/mib2c.container.conf
+file local/mib2c.create-dataset.conf path=etc/net-snmp/snmp/mib2c.create-dataset.conf
+file local/mib2c.emulation.conf path=etc/net-snmp/snmp/mib2c.emulation.conf
+file local/mib2c.genhtml.conf path=etc/net-snmp/snmp/mib2c.genhtml.conf
+file local/mib2c.int_watch.conf path=etc/net-snmp/snmp/mib2c.int_watch.conf
+file local/mib2c.iterate.conf path=etc/net-snmp/snmp/mib2c.iterate.conf
+file local/mib2c.iterate_access.conf path=etc/net-snmp/snmp/mib2c.iterate_access.conf
+file local/mib2c.mfd.conf path=etc/net-snmp/snmp/mib2c.mfd.conf
+file local/mib2c.notify.conf path=etc/net-snmp/snmp/mib2c.notify.conf
+file local/mib2c.old-api.conf path=etc/net-snmp/snmp/mib2c.old-api.conf
+file local/mib2c.perl.conf path=etc/net-snmp/snmp/mib2c.perl.conf
+file local/mib2c.row.conf path=etc/net-snmp/snmp/mib2c.row.conf
+file local/mib2c.scalar.conf path=etc/net-snmp/snmp/mib2c.scalar.conf
+file local/mib2c.table_data.conf path=etc/net-snmp/snmp/mib2c.table_data.conf
+file $(MACH32)/sun/agent/mibs/ENTITY-MIB.txt path=etc/net-snmp/snmp/mibs/ENTITY-MIB.txt
+file $(MACH64)/mibs/LM-SENSORS-MIB.txt path=etc/net-snmp/snmp/mibs/LM-SENSORS-MIB.txt
+file $(MACH64)/mibs/NETWORK-SERVICES-MIB.txt path=etc/net-snmp/snmp/mibs/NETWORK-SERVICES-MIB.txt
+file $(MACH32)/sun/agent/mibs/SUN-MIB.txt path=etc/net-snmp/snmp/mibs/SUN-MIB.txt
+file $(MACH32)/sun/agent/mibs/SUN-SEA-EXTENSIONS-MIB.txt path=etc/net-snmp/snmp/mibs/SUN-SEA-EXTENSIONS-MIB.txt
+file $(MACH32)/sun/agent/mibs/SUN-SEA-PROXY-MIB.txt path=etc/net-snmp/snmp/mibs/SUN-SEA-PROXY-MIB.txt
+file $(MACH32)/sun/agent/mibs/smatrap.mib path=etc/net-snmp/snmp/mibs/smatrap.mib
+file mibs/AGENTX-MIB.txt path=etc/net-snmp/snmp/mibs/AGENTX-MIB.txt
+file mibs/DISMAN-EVENT-MIB.txt path=etc/net-snmp/snmp/mibs/DISMAN-EVENT-MIB.txt
+file mibs/DISMAN-EXPRESSION-MIB.txt path=etc/net-snmp/snmp/mibs/DISMAN-EXPRESSION-MIB.txt
+file mibs/DISMAN-NSLOOKUP-MIB.txt path=etc/net-snmp/snmp/mibs/DISMAN-NSLOOKUP-MIB.txt
+file mibs/DISMAN-PING-MIB.txt path=etc/net-snmp/snmp/mibs/DISMAN-PING-MIB.txt
+file mibs/DISMAN-SCHEDULE-MIB.txt path=etc/net-snmp/snmp/mibs/DISMAN-SCHEDULE-MIB.txt
+file mibs/DISMAN-SCRIPT-MIB.txt path=etc/net-snmp/snmp/mibs/DISMAN-SCRIPT-MIB.txt
+file mibs/DISMAN-TRACEROUTE-MIB.txt path=etc/net-snmp/snmp/mibs/DISMAN-TRACEROUTE-MIB.txt
+file mibs/EtherLike-MIB.txt path=etc/net-snmp/snmp/mibs/EtherLike-MIB.txt
+file mibs/HCNUM-TC.txt path=etc/net-snmp/snmp/mibs/HCNUM-TC.txt
+file mibs/HOST-RESOURCES-MIB.txt path=etc/net-snmp/snmp/mibs/HOST-RESOURCES-MIB.txt
+file mibs/HOST-RESOURCES-TYPES.txt path=etc/net-snmp/snmp/mibs/HOST-RESOURCES-TYPES.txt
+file mibs/IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt path=etc/net-snmp/snmp/mibs/IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt
+file mibs/IANA-LANGUAGE-MIB.txt path=etc/net-snmp/snmp/mibs/IANA-LANGUAGE-MIB.txt
+file mibs/IANA-RTPROTO-MIB.txt path=etc/net-snmp/snmp/mibs/IANA-RTPROTO-MIB.txt
+file mibs/IANAifType-MIB.txt path=etc/net-snmp/snmp/mibs/IANAifType-MIB.txt
+file mibs/IF-INVERTED-STACK-MIB.txt path=etc/net-snmp/snmp/mibs/IF-INVERTED-STACK-MIB.txt
+file mibs/IF-MIB.txt path=etc/net-snmp/snmp/mibs/IF-MIB.txt
+file mibs/INET-ADDRESS-MIB.txt path=etc/net-snmp/snmp/mibs/INET-ADDRESS-MIB.txt
+file mibs/IP-FORWARD-MIB.txt path=etc/net-snmp/snmp/mibs/IP-FORWARD-MIB.txt
+file mibs/IP-MIB.txt path=etc/net-snmp/snmp/mibs/IP-MIB.txt
+file mibs/IPV6-FLOW-LABEL-MIB.txt path=etc/net-snmp/snmp/mibs/IPV6-FLOW-LABEL-MIB.txt
+file mibs/IPV6-ICMP-MIB.txt path=etc/net-snmp/snmp/mibs/IPV6-ICMP-MIB.txt
+file mibs/IPV6-MIB.txt path=etc/net-snmp/snmp/mibs/IPV6-MIB.txt
+file mibs/IPV6-TC.txt path=etc/net-snmp/snmp/mibs/IPV6-TC.txt
+file mibs/IPV6-TCP-MIB.txt path=etc/net-snmp/snmp/mibs/IPV6-TCP-MIB.txt
+file mibs/IPV6-UDP-MIB.txt path=etc/net-snmp/snmp/mibs/IPV6-UDP-MIB.txt
+file mibs/MTA-MIB.txt path=etc/net-snmp/snmp/mibs/MTA-MIB.txt
+file mibs/NET-SNMP-AGENT-MIB.txt path=etc/net-snmp/snmp/mibs/NET-SNMP-AGENT-MIB.txt
+file mibs/NET-SNMP-EXAMPLES-MIB.txt path=etc/net-snmp/snmp/mibs/NET-SNMP-EXAMPLES-MIB.txt
+file mibs/NET-SNMP-EXTEND-MIB.txt path=etc/net-snmp/snmp/mibs/NET-SNMP-EXTEND-MIB.txt
+file mibs/NET-SNMP-MIB.txt path=etc/net-snmp/snmp/mibs/NET-SNMP-MIB.txt
+file mibs/NET-SNMP-MONITOR-MIB.txt path=etc/net-snmp/snmp/mibs/NET-SNMP-MONITOR-MIB.txt
+file mibs/NET-SNMP-SYSTEM-MIB.txt path=etc/net-snmp/snmp/mibs/NET-SNMP-SYSTEM-MIB.txt
+file mibs/NET-SNMP-TC.txt path=etc/net-snmp/snmp/mibs/NET-SNMP-TC.txt
+file mibs/NET-SNMP-VACM-MIB.txt path=etc/net-snmp/snmp/mibs/NET-SNMP-VACM-MIB.txt
+file mibs/NOTIFICATION-LOG-MIB.txt path=etc/net-snmp/snmp/mibs/NOTIFICATION-LOG-MIB.txt
+file mibs/RFC-1215.txt path=etc/net-snmp/snmp/mibs/RFC-1215.txt
+file mibs/RFC1155-SMI.txt path=etc/net-snmp/snmp/mibs/RFC1155-SMI.txt
+file mibs/RFC1213-MIB.txt path=etc/net-snmp/snmp/mibs/RFC1213-MIB.txt
+file mibs/RMON-MIB.txt path=etc/net-snmp/snmp/mibs/RMON-MIB.txt
+file mibs/SMUX-MIB.txt path=etc/net-snmp/snmp/mibs/SMUX-MIB.txt
+file mibs/SNMP-COMMUNITY-MIB.txt path=etc/net-snmp/snmp/mibs/SNMP-COMMUNITY-MIB.txt
+file mibs/SNMP-FRAMEWORK-MIB.txt path=etc/net-snmp/snmp/mibs/SNMP-FRAMEWORK-MIB.txt
+file mibs/SNMP-MPD-MIB.txt path=etc/net-snmp/snmp/mibs/SNMP-MPD-MIB.txt
+file mibs/SNMP-NOTIFICATION-MIB.txt path=etc/net-snmp/snmp/mibs/SNMP-NOTIFICATION-MIB.txt
+file mibs/SNMP-PROXY-MIB.txt path=etc/net-snmp/snmp/mibs/SNMP-PROXY-MIB.txt
+file mibs/SNMP-TARGET-MIB.txt path=etc/net-snmp/snmp/mibs/SNMP-TARGET-MIB.txt
+file mibs/SNMP-USER-BASED-SM-MIB.txt path=etc/net-snmp/snmp/mibs/SNMP-USER-BASED-SM-MIB.txt
+file mibs/SNMP-USM-AES-MIB.txt path=etc/net-snmp/snmp/mibs/SNMP-USM-AES-MIB.txt
+file mibs/SNMP-USM-DH-OBJECTS-MIB.txt path=etc/net-snmp/snmp/mibs/SNMP-USM-DH-OBJECTS-MIB.txt
+file mibs/SNMP-VIEW-BASED-ACM-MIB.txt path=etc/net-snmp/snmp/mibs/SNMP-VIEW-BASED-ACM-MIB.txt
+file mibs/SNMPv2-CONF.txt path=etc/net-snmp/snmp/mibs/SNMPv2-CONF.txt
+file mibs/SNMPv2-MIB.txt path=etc/net-snmp/snmp/mibs/SNMPv2-MIB.txt
+file mibs/SNMPv2-SMI.txt path=etc/net-snmp/snmp/mibs/SNMPv2-SMI.txt
+file mibs/SNMPv2-TC.txt path=etc/net-snmp/snmp/mibs/SNMPv2-TC.txt
+file mibs/SNMPv2-TM.txt path=etc/net-snmp/snmp/mibs/SNMPv2-TM.txt
+file mibs/TCP-MIB.txt path=etc/net-snmp/snmp/mibs/TCP-MIB.txt
+file mibs/TRANSPORT-ADDRESS-MIB.txt path=etc/net-snmp/snmp/mibs/TRANSPORT-ADDRESS-MIB.txt
+file mibs/TUNNEL-MIB.txt path=etc/net-snmp/snmp/mibs/TUNNEL-MIB.txt
+file mibs/UCD-DEMO-MIB.txt path=etc/net-snmp/snmp/mibs/UCD-DEMO-MIB.txt
+file mibs/UCD-DISKIO-MIB.txt path=etc/net-snmp/snmp/mibs/UCD-DISKIO-MIB.txt
+file mibs/UCD-DLMOD-MIB.txt path=etc/net-snmp/snmp/mibs/UCD-DLMOD-MIB.txt
+file mibs/UCD-IPFILTER-MIB.txt path=etc/net-snmp/snmp/mibs/UCD-IPFILTER-MIB.txt
+file mibs/UCD-IPFWACC-MIB.txt path=etc/net-snmp/snmp/mibs/UCD-IPFWACC-MIB.txt
+file mibs/UCD-SNMP-MIB-OLD.txt path=etc/net-snmp/snmp/mibs/UCD-SNMP-MIB-OLD.txt
+file mibs/UCD-SNMP-MIB.txt path=etc/net-snmp/snmp/mibs/UCD-SNMP-MIB.txt
+file mibs/UDP-MIB.txt path=etc/net-snmp/snmp/mibs/UDP-MIB.txt
+file apps/snmp_perl_trapd.pl path=etc/net-snmp/snmp/snmp_perl_trapd.pl
+file local/snmpconf.dir/snmp-data/authopts path=etc/net-snmp/snmp/snmpconf-data/snmp-data/authopts
+file local/snmpconf.dir/snmp-data/debugging path=etc/net-snmp/snmp/snmpconf-data/snmp-data/debugging
+file local/snmpconf.dir/snmp-data/mibs path=etc/net-snmp/snmp/snmpconf-data/snmp-data/mibs
+file local/snmpconf.dir/snmp-data/output path=etc/net-snmp/snmp/snmpconf-data/snmp-data/output
+file local/snmpconf.dir/snmp-data/snmpconf-config path=etc/net-snmp/snmp/snmpconf-data/snmp-data/snmpconf-config
+file local/snmpconf.dir/snmpd-data/acl path=etc/net-snmp/snmp/snmpconf-data/snmpd-data/acl
+file local/snmpconf.dir/snmpd-data/basic_setup path=etc/net-snmp/snmp/snmpconf-data/snmpd-data/basic_setup
+file local/snmpconf.dir/snmpd-data/extending path=etc/net-snmp/snmp/snmpconf-data/snmpd-data/extending
+file local/snmpconf.dir/snmpd-data/monitor path=etc/net-snmp/snmp/snmpconf-data/snmpd-data/monitor
+file local/snmpconf.dir/snmpd-data/operation path=etc/net-snmp/snmp/snmpconf-data/snmpd-data/operation
+file local/snmpconf.dir/snmpd-data/snmpconf-config path=etc/net-snmp/snmp/snmpconf-data/snmpd-data/snmpconf-config
+file local/snmpconf.dir/snmpd-data/system path=etc/net-snmp/snmp/snmpconf-data/snmpd-data/system
+file local/snmpconf.dir/snmpd-data/trapsinks path=etc/net-snmp/snmp/snmpconf-data/snmpd-data/trapsinks
+file local/snmpconf.dir/snmptrapd-data/authentication path=etc/net-snmp/snmp/snmpconf-data/snmptrapd-data/authentication
+file local/snmpconf.dir/snmptrapd-data/formatting path=etc/net-snmp/snmp/snmpconf-data/snmptrapd-data/formatting
+file local/snmpconf.dir/snmptrapd-data/logging path=etc/net-snmp/snmp/snmpconf-data/snmptrapd-data/logging
+file local/snmpconf.dir/snmptrapd-data/runtime path=etc/net-snmp/snmp/snmpconf-data/snmptrapd-data/runtime
+file local/snmpconf.dir/snmptrapd-data/snmpconf-config path=etc/net-snmp/snmp/snmpconf-data/snmptrapd-data/snmpconf-config
+file local/snmpconf.dir/snmptrapd-data/traphandle path=etc/net-snmp/snmp/snmpconf-data/snmptrapd-data/traphandle
+file $(MACH32)/sun/snmpd.conf path=etc/net-snmp/snmp/snmpd.conf
+file net-snmp.xml path=lib/svc/manifest/application/management/net-snmp.xml restart_fmri=svc:/system/manifest-import:default
+file svc-net-snmp path=lib/svc/method/svc-net-snmp
+file path=usr/bin/encode_keychange
+file path=usr/bin/fixproc
+file path=usr/bin/ipf-mod.pl
+file path=usr/bin/mib2c
+file path=usr/bin/mib2c-update
+file usr/bin/net-snmp-config path=usr/bin/net-snmp-config-32
+file build/prototype/$(MACH64)/usr/bin/$(MACH64)/net-snmp-config path=usr/bin/net-snmp-config-64
+file path=usr/bin/snmpbulkget
+file path=usr/bin/snmpbulkwalk
+file path=usr/bin/snmpcheck
+file path=usr/bin/snmpconf
+file path=usr/bin/snmpdelta
+file path=usr/bin/snmpdf
+file path=usr/bin/snmpget
+file path=usr/bin/snmpgetnext
+file path=usr/bin/snmpnetstat
+file path=usr/bin/snmpset
+file path=usr/bin/snmpstatus
+file path=usr/bin/snmptable
+file path=usr/bin/snmptest
+file path=usr/bin/snmptranslate
+file path=usr/bin/snmptrap
+file path=usr/bin/snmpusm
+file path=usr/bin/snmpvacm
+file path=usr/bin/snmpwalk
+file path=usr/bin/tkmib
+file path=usr/bin/traptoemail
+file path=usr/include/net-snmp/agent/agent_callbacks.h
+file path=usr/include/net-snmp/agent/agent_handler.h
+file path=usr/include/net-snmp/agent/agent_index.h
+file path=usr/include/net-snmp/agent/agent_module_config.h
+file path=usr/include/net-snmp/agent/agent_read_config.h
+file path=usr/include/net-snmp/agent/agent_registry.h
+file path=usr/include/net-snmp/agent/agent_trap.h
+file path=usr/include/net-snmp/agent/all_helpers.h
+file path=usr/include/net-snmp/agent/auto_nlist.h
+file path=usr/include/net-snmp/agent/baby_steps.h
+file path=usr/include/net-snmp/agent/bulk_to_next.h
+file path=usr/include/net-snmp/agent/cache_handler.h
+file path=usr/include/net-snmp/agent/debug_handler.h
+file path=usr/include/net-snmp/agent/ds_agent.h
+file path=usr/include/net-snmp/agent/instance.h
+file path=usr/include/net-snmp/agent/mfd.h
+file path=usr/include/net-snmp/agent/mib_module_config.h
+file path=usr/include/net-snmp/agent/mib_module_includes.h
+file path=usr/include/net-snmp/agent/mib_modules.h
+file path=usr/include/net-snmp/agent/mode_end_call.h
+file path=usr/include/net-snmp/agent/multiplexer.h
+file path=usr/include/net-snmp/agent/net-snmp-agent-includes.h
+file path=usr/include/net-snmp/agent/null.h
+file path=usr/include/net-snmp/agent/old_api.h
+file path=usr/include/net-snmp/agent/read_only.h
+file path=usr/include/net-snmp/agent/row_merge.h
+file path=usr/include/net-snmp/agent/scalar_group.h
+file path=usr/include/net-snmp/agent/scalar.h
+file path=usr/include/net-snmp/agent/serialize.h
+file path=usr/include/net-snmp/agent/set_helper.h
+file path=usr/include/net-snmp/agent/snmp_agent.h
+file path=usr/include/net-snmp/agent/snmp_vars.h
+file path=usr/include/net-snmp/agent/stash_cache.h
+file path=usr/include/net-snmp/agent/stash_to_next.h
+file path=usr/include/net-snmp/agent/table_array.h
+file path=usr/include/net-snmp/agent/table_container.h
+file path=usr/include/net-snmp/agent/table_data.h
+file path=usr/include/net-snmp/agent/table_dataset.h
+file path=usr/include/net-snmp/agent/table_iterator.h
+file path=usr/include/net-snmp/agent/table_tdata.h
+file path=usr/include/net-snmp/agent/table.h
+file path=usr/include/net-snmp/agent/util_funcs.h
+file path=usr/include/net-snmp/agent/var_struct.h
+file path=usr/include/net-snmp/agent/watcher.h
+file path=usr/include/net-snmp/config_api.h
+file path=usr/include/net-snmp/definitions.h
+file path=usr/include/net-snmp/library/asn1.h
+file path=usr/include/net-snmp/library/callback.h
+file path=usr/include/net-snmp/library/check_varbind.h
+file path=usr/include/net-snmp/library/cmu_compat.h
+file path=usr/include/net-snmp/library/container_binary_array.h
+file path=usr/include/net-snmp/library/container_iterator.h
+file path=usr/include/net-snmp/library/container_list_ssll.h
+file path=usr/include/net-snmp/library/container_null.h
+file path=usr/include/net-snmp/library/container.h
+file path=usr/include/net-snmp/library/data_list.h
+file path=usr/include/net-snmp/library/default_store.h
+file path=usr/include/net-snmp/library/factory.h
+file path=usr/include/net-snmp/library/fd_event_manager.h
+file path=usr/include/net-snmp/library/file_utils.h
+file path=usr/include/net-snmp/library/getopt.h
+file path=usr/include/net-snmp/library/int64.h
+file path=usr/include/net-snmp/library/keytools.h
+file path=usr/include/net-snmp/library/lcd_time.h
+file path=usr/include/net-snmp/library/md5.h
+file path=usr/include/net-snmp/library/mib.h
+file path=usr/include/net-snmp/library/mt_support.h
+file path=usr/include/net-snmp/library/oid_stash.h
+file path=usr/include/net-snmp/library/parse.h
+file path=usr/include/net-snmp/library/read_config.h
+file path=usr/include/net-snmp/library/README
+file path=usr/include/net-snmp/library/scapi.h
+file path=usr/include/net-snmp/library/snmp_alarm.h
+file path=usr/include/net-snmp/library/snmp_api.h
+file path=usr/include/net-snmp/library/snmp_assert.h
+file path=usr/include/net-snmp/library/snmp_client.h
+file path=usr/include/net-snmp/library/snmp_debug.h
+file path=usr/include/net-snmp/library/snmp_enum.h
+file path=usr/include/net-snmp/library/snmp_impl.h
+file path=usr/include/net-snmp/library/snmp_logging.h
+file path=usr/include/net-snmp/library/snmp_parse_args.h
+file path=usr/include/net-snmp/library/snmp_secmod.h
+file path=usr/include/net-snmp/library/snmp_service.h
+file path=usr/include/net-snmp/library/snmp_transport.h
+file path=usr/include/net-snmp/library/snmp-tc.h
+file path=usr/include/net-snmp/library/snmp.h
+file path=usr/include/net-snmp/library/snmpCallbackDomain.h
+file path=usr/include/net-snmp/library/snmpTCPDomain.h
+file path=usr/include/net-snmp/library/snmpTCPIPv6Domain.h
+file path=usr/include/net-snmp/library/snmpUDPDomain.h
+file path=usr/include/net-snmp/library/snmpUDPIPv6Domain.h
+file path=usr/include/net-snmp/library/snmpUnixDomain.h
+file path=usr/include/net-snmp/library/snmpusm.h
+file path=usr/include/net-snmp/library/snmpv3-security-includes.h
+file path=usr/include/net-snmp/library/snmpv3.h
+file path=usr/include/net-snmp/library/system.h
+file path=usr/include/net-snmp/library/text_utils.h
+file path=usr/include/net-snmp/library/tools.h
+file path=usr/include/net-snmp/library/transform_oids.h
+file path=usr/include/net-snmp/library/ucd_compat.h
+file path=usr/include/net-snmp/library/vacm.h
+file path=usr/include/net-snmp/library/winpipe.h
+file path=usr/include/net-snmp/library/winservice.h
+file path=usr/include/net-snmp/machine/generic.h
+file path=usr/include/net-snmp/mib_api.h
+file path=usr/include/net-snmp/net-snmp-config.h
+file path=usr/include/net-snmp/net-snmp-includes.h
+file path=usr/include/net-snmp/output_api.h
+file path=usr/include/net-snmp/pdu_api.h
+file path=usr/include/net-snmp/session_api.h
+file path=usr/include/net-snmp/snmpv3_api.h
+file path=usr/include/net-snmp/system/aix.h
+file path=usr/include/net-snmp/system/bsd.h
+file path=usr/include/net-snmp/system/bsdi.h
+file path=usr/include/net-snmp/system/bsdi3.h
+file path=usr/include/net-snmp/system/bsdi4.h
+file path=usr/include/net-snmp/system/cygwin.h
+file path=usr/include/net-snmp/system/darwin.h
+file path=usr/include/net-snmp/system/darwin7.h
+file path=usr/include/net-snmp/system/darwin8.h
+file path=usr/include/net-snmp/system/darwin9.h
+file path=usr/include/net-snmp/system/dragonfly.h
+file path=usr/include/net-snmp/system/dynix.h
+file path=usr/include/net-snmp/system/freebsd.h
+file path=usr/include/net-snmp/system/freebsd2.h
+file path=usr/include/net-snmp/system/freebsd3.h
+file path=usr/include/net-snmp/system/freebsd4.h
+file path=usr/include/net-snmp/system/freebsd5.h
+file path=usr/include/net-snmp/system/freebsd6.h
+file path=usr/include/net-snmp/system/generic.h
+file path=usr/include/net-snmp/system/hpux.h
+file path=usr/include/net-snmp/system/irix.h
+file path=usr/include/net-snmp/system/linux.h
+file path=usr/include/net-snmp/system/mingw32.h
+file path=usr/include/net-snmp/system/mips.h
+file path=usr/include/net-snmp/system/netbsd.h
+file path=usr/include/net-snmp/system/openbsd.h
+file path=usr/include/net-snmp/system/osf5.h
+file path=usr/include/net-snmp/system/solaris.h
+file path=usr/include/net-snmp/system/solaris2.3.h
+file path=usr/include/net-snmp/system/solaris2.4.h
+file path=usr/include/net-snmp/system/solaris2.5.h
+file path=usr/include/net-snmp/system/solaris2.6.h
+file path=usr/include/net-snmp/system/sunos.h
+file path=usr/include/net-snmp/system/svr5.h
+file path=usr/include/net-snmp/system/sysv.h
+file path=usr/include/net-snmp/system/ultrix4.h
+file path=usr/include/net-snmp/types.h
+file path=usr/include/net-snmp/utilities.h
+file path=usr/include/net-snmp/varbind_api.h
+file path=usr/include/net-snmp/version.h
+file path=usr/include/ucd-snmp/agent_index.h
+file path=usr/include/ucd-snmp/agent_read_config.h
+file path=usr/include/ucd-snmp/agent_registry.h
+file path=usr/include/ucd-snmp/agent_trap.h
+file path=usr/include/ucd-snmp/asn1.h
+file path=usr/include/ucd-snmp/auto_nlist.h
+file path=usr/include/ucd-snmp/callback.h
+file path=usr/include/ucd-snmp/default_store.h
+file path=usr/include/ucd-snmp/ds_agent.h
+file path=usr/include/ucd-snmp/header_complex.h
+file path=usr/include/ucd-snmp/int64.h
+file path=usr/include/ucd-snmp/keytools.h
+file path=usr/include/ucd-snmp/mib_module_config.h
+file path=usr/include/ucd-snmp/mib.h
+file path=usr/include/ucd-snmp/mibincl.h
+file path=usr/include/ucd-snmp/parse.h
+file path=usr/include/ucd-snmp/read_config.h
+file path=usr/include/ucd-snmp/scapi.h
+file path=usr/include/ucd-snmp/snmp_agent.h
+file path=usr/include/ucd-snmp/snmp_alarm.h
+file path=usr/include/ucd-snmp/snmp_api.h
+file path=usr/include/ucd-snmp/snmp_client.h
+file path=usr/include/ucd-snmp/snmp_debug.h
+file path=usr/include/ucd-snmp/snmp_impl.h
+file path=usr/include/ucd-snmp/snmp_logging.h
+file path=usr/include/ucd-snmp/snmp_parse_args.h
+file path=usr/include/ucd-snmp/snmp_vars.h
+file path=usr/include/ucd-snmp/snmp-tc.h
+file path=usr/include/ucd-snmp/snmp.h
+file path=usr/include/ucd-snmp/snmpusm.h
+file path=usr/include/ucd-snmp/snmpv3.h
+file path=usr/include/ucd-snmp/struct.h
+file path=usr/include/ucd-snmp/system.h
+file path=usr/include/ucd-snmp/tools.h
+file path=usr/include/ucd-snmp/transform_oids.h
+file path=usr/include/ucd-snmp/ucd-snmp-agent-includes.h
+file path=usr/include/ucd-snmp/ucd-snmp-config.h
+file path=usr/include/ucd-snmp/ucd-snmp-includes.h
+file path=usr/include/ucd-snmp/util_funcs.h
+file path=usr/include/ucd-snmp/var_struct.h
+file path=usr/include/ucd-snmp/version.h
+file $(MACH64)/sun/agent/modules/entityMib/libentity.so path=usr/lib/$(MACH64)/libentity.so
+file build/prototype/$(MACH64)/usr/lib/$(MACH64)/libnetsnmp.so.15.1.0 path=usr/lib/$(MACH64)/libnetsnmp.so.15.1.0
+file build/prototype/$(MACH64)/usr/lib/$(MACH64)/libnetsnmpagent.so.15.1.0 path=usr/lib/$(MACH64)/libnetsnmpagent.so.15.1.0
+file build/prototype/$(MACH64)/usr/lib/$(MACH64)/libnetsnmphelpers.so.15.1.0 path=usr/lib/$(MACH64)/libnetsnmphelpers.so.15.1.0
+file build/prototype/$(MACH64)/usr/lib/$(MACH64)/libnetsnmpmibs.so.15.1.0 path=usr/lib/$(MACH64)/libnetsnmpmibs.so.15.1.0
+file build/prototype/$(MACH64)/usr/lib/$(MACH64)/libnetsnmptrapd.so.15.1.0 path=usr/lib/$(MACH64)/libnetsnmptrapd.so.15.1.0
+file $(MACH32)/sun/agent/modules/entityMib/libentity.so path=usr/lib/libentity.so
+file path=usr/lib/libnetsnmp.so.15.1.0
+file path=usr/lib/libnetsnmpagent.so.15.1.0
+file path=usr/lib/libnetsnmphelpers.so.15.1.0
+file path=usr/lib/libnetsnmpmibs.so.15.1.0
+file path=usr/lib/libnetsnmptrapd.so.15.1.0
+file path=usr/lib/libsnmp.so.15.1.0
+file $(MACH32)/sun/masfcnv path=usr/lib/net-snmp/masfcnv
+file $(MACH32)/sun/masfd path=usr/lib/net-snmp/masfd
+file path=usr/perl5/$(PERL_VERSION)/man/man3/NetSNMP::agent::default_store.3
+file path=usr/perl5/$(PERL_VERSION)/man/man3/NetSNMP::agent.3
+file path=usr/perl5/$(PERL_VERSION)/man/man3/NetSNMP::ASN.3
+file path=usr/perl5/$(PERL_VERSION)/man/man3/NetSNMP::default_store.3
+file path=usr/perl5/$(PERL_VERSION)/man/man3/NetSNMP::netsnmp_request_infoPtr.3
+file path=usr/perl5/$(PERL_VERSION)/man/man3/NetSNMP::OID.3
+file path=usr/perl5/$(PERL_VERSION)/man/man3/NetSNMP::TrapReceiver.3
+file path=usr/perl5/$(PERL_VERSION)/man/man3/SNMP.3
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/Bundle/NetSNMP/.packlist
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/agent/agent.bs
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/agent/agent.so
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/agent/autosplit.ix
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/agent/default_store/autosplit.ix
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/agent/default_store/default_store.bs
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/agent/default_store/default_store.so
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/ASN/ASN.bs
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/ASN/ASN.so
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/ASN/autosplit.ix
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/default_store/autosplit.ix
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/default_store/default_store.bs
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/default_store/default_store.so
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/OID/autosplit.ix
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/OID/OID.bs
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/OID/OID.so
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/TrapReceiver/autosplit.ix
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/TrapReceiver/TrapReceiver.bs
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/NetSNMP/TrapReceiver/TrapReceiver.so
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/SNMP/autosplit.ix
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/SNMP/SNMP.bs
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/auto/SNMP/SNMP.so
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/Bundle/Makefile.subs.pl
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/NetSNMP/agent.pm
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/NetSNMP/agent/default_store.pm
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/NetSNMP/agent/netsnmp_request_infoPtr.pm
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/NetSNMP/agent/Support.pm
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/NetSNMP/ASN.pm
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/NetSNMP/default_store.pm
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/NetSNMP/OID.pm
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/NetSNMP/TrapReceiver.pm
+file path=usr/perl5/vendor_perl/$(PERL_VERSION)/$(ARCHNAME)/SNMP.pm
+file build/prototype/$(MACH64)/usr/sbin/$(MACH64)/snmpd path=usr/sbin/$(MACH64)/snmpd
+file build/prototype/$(MACH64)/usr/sbin/$(MACH64)/snmptrapd path=usr/sbin/$(MACH64)/snmptrapd
+file usr/sbin/snmpd path=usr/sbin/$(MACH32)/snmpd
+file usr/sbin/snmptrapd path=usr/sbin/$(MACH32)/snmptrapd
+hardlink path=usr/sbin/snmpd target=../../usr/lib/isaexec
+hardlink path=usr/sbin/snmptrapd target=../../usr/lib/isaexec
+link path=usr/bin/net-snmp-config target=./net-snmp-config-32 variant.arch=i386
+link path=usr/bin/net-snmp-config target=./net-snmp-config-64 variant.arch=sparc
+link path=usr/bin/snmpinform target=snmptrap
+link path=usr/lib/$(MACH64)/libnetsnmp.so target=./libnetsnmp.so.15.1.0
+link path=usr/lib/$(MACH64)/libnetsnmp.so.15 target=./libnetsnmp.so.15.1.0
+link path=usr/lib/$(MACH64)/libnetsnmpagent.so target=./libnetsnmpagent.so.15.1.0
+link path=usr/lib/$(MACH64)/libnetsnmpagent.so.15 target=./libnetsnmpagent.so.15.1.0
+link path=usr/lib/$(MACH64)/libnetsnmphelpers.so target=./libnetsnmphelpers.so.15.1.0
+link path=usr/lib/$(MACH64)/libnetsnmphelpers.so.15 target=./libnetsnmphelpers.so.15.1.0
+link path=usr/lib/$(MACH64)/libnetsnmpmibs.so target=./libnetsnmpmibs.so.15.1.0
+link path=usr/lib/$(MACH64)/libnetsnmpmibs.so.15 target=./libnetsnmpmibs.so.15.1.0
+link path=usr/lib/$(MACH64)/libnetsnmptrapd.so target=./libnetsnmptrapd.so.15.1.0
+link path=usr/lib/$(MACH64)/libnetsnmptrapd.so.15 target=./libnetsnmptrapd.so.15.1.0
+link path=usr/lib/libnetsnmp.so target=./libnetsnmp.so.15.1.0
+link path=usr/lib/libnetsnmp.so.15 target=./libnetsnmp.so.15.1.0
+link path=usr/lib/libnetsnmpagent.so target=./libnetsnmpagent.so.15.1.0
+link path=usr/lib/libnetsnmpagent.so.15 target=./libnetsnmpagent.so.15.1.0
+link path=usr/lib/libnetsnmphelpers.so target=./libnetsnmphelpers.so.15.1.0
+link path=usr/lib/libnetsnmphelpers.so.15 target=./libnetsnmphelpers.so.15.1.0
+link path=usr/lib/libnetsnmpmibs.so target=./libnetsnmpmibs.so.15.1.0
+link path=usr/lib/libnetsnmpmibs.so.15 target=./libnetsnmpmibs.so.15.1.0
+link path=usr/lib/libnetsnmptrapd.so target=./libnetsnmptrapd.so.15.1.0
+link path=usr/lib/libnetsnmptrapd.so.15 target=./libnetsnmptrapd.so.15.1.0
+link path=usr/lib/libsnmp.so target=./libsnmp.so.15.1.0
+link path=usr/lib/libsnmp.so.15 target=./libsnmp.so.15.1.0
+
+legacy pkg=SUNWnet-snmp-utils \
+ name="Net-SNMP Agent applications and utilities" \
+ desc="Net-SNMP Agent applications and utilities (5.4.1)"
+legacy pkg=SUNWnet-snmp-mgr \
+ name="Net-SNMP Agent Configuration files and Startup scripts" \
+ desc="Net-SNMP Agent Configuration files and Startup scripts (5.4.1)"
+legacy pkg=SUNWnet-snmp-core \
+ name="Net-SNMP Agent files and libraries" \
+ desc="Net-SNMP Agent files and libraries (5.4.1)"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/net-snmp-documentation.p5m Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,641 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+
+<transform file path=usr.*/man/.+ -> default mangler.man.stability volatile>
+
+set name=info.classification value="org.opensolaris.category.2008:System/Enterprise Management"
+set name=pkg.summary value="Net-SNMP Agent manpages and html documentation files"
+set name=info.upstream_url value="http://www.net-snmp.org/"
+set name=info.source_url value=$(COMPONENT_ARCHIVE_URL)
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+set name=pkg.fmri value=pkg:/system/management/snmp/net-snmp/documentation@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+
+set name=opensolaris.arc_url \
+ value=http://arc.opensolaris.org/caselog/LSARC/2008/355
+
+license COPYING license="BSD, BSD-like"
+
+dir path=usr
+dir path=usr/demo
+dir path=usr/demo/net-snmp
+dir path=usr/demo/net-snmp/demo_module_1
+dir path=usr/demo/net-snmp/demo_module_10
+dir path=usr/demo/net-snmp/demo_module_11
+dir path=usr/demo/net-snmp/demo_module_12
+dir path=usr/demo/net-snmp/demo_module_2
+dir path=usr/demo/net-snmp/demo_module_3
+dir path=usr/demo/net-snmp/demo_module_4
+dir path=usr/demo/net-snmp/demo_module_5
+dir path=usr/demo/net-snmp/demo_module_6
+dir path=usr/demo/net-snmp/demo_module_7
+dir path=usr/demo/net-snmp/demo_module_8
+dir path=usr/demo/net-snmp/demo_module_9
+dir path=usr/share
+dir path=usr/share/doc
+dir path=usr/share/doc/net-snmp
+dir path=usr/share/doc/net-snmp/html
+dir path=usr/share/man
+dir path=usr/share/man/man1
+dir path=usr/share/man/man3
+dir path=usr/share/man/man5
+dir path=usr/share/man/man8
+file build/$(MACH32)/sun/sdk/demo/demo_module_6/demo_module_6.h path=usr/demo/net-snmp/demo_module_6/demo_module_6.h
+file build/$(MACH32)/sun/sdk/demo/demo_module_6/SDK-DEMO6-MIB.txt path=usr/demo/net-snmp/demo_module_6/SDK-DEMO6-MIB.txt
+file build/$(MACH32)/sun/sdk/demo/demo_module_6/README_demo_module_6 path=usr/demo/net-snmp/demo_module_6/README_demo_module_6
+file build/$(MACH32)/sun/sdk/demo/demo_module_6/Makefile path=usr/demo/net-snmp/demo_module_6/Makefile
+file build/$(MACH32)/sun/sdk/demo/demo_module_6/demo_module_6.c path=usr/demo/net-snmp/demo_module_6/demo_module_6.c
+file build/$(MACH32)/sun/sdk/demo/demo_module_6/get_demo_module_6 path=usr/demo/net-snmp/demo_module_6/get_demo_module_6
+file build/$(MACH32)/sun/sdk/demo/demo_module_10/SDK-DEMO10-MIB.txt path=usr/demo/net-snmp/demo_module_10/SDK-DEMO10-MIB.txt
+file build/$(MACH32)/sun/sdk/demo/demo_module_10/get_status path=usr/demo/net-snmp/demo_module_10/get_status
+file build/$(MACH32)/sun/sdk/demo/demo_module_10/Makefile path=usr/demo/net-snmp/demo_module_10/Makefile
+file build/$(MACH32)/sun/sdk/demo/demo_module_10/demo_module_10.c path=usr/demo/net-snmp/demo_module_10/demo_module_10.c
+file build/$(MACH32)/sun/sdk/demo/demo_module_10/set_status path=usr/demo/net-snmp/demo_module_10/set_status
+file build/$(MACH32)/sun/sdk/demo/demo_module_10/walk_demo_module_10 path=usr/demo/net-snmp/demo_module_10/walk_demo_module_10
+file build/$(MACH32)/sun/sdk/demo/demo_module_10/get_data path=usr/demo/net-snmp/demo_module_10/get_data
+file build/$(MACH32)/sun/sdk/demo/demo_module_10/demo_module_10.h path=usr/demo/net-snmp/demo_module_10/demo_module_10.h
+file build/$(MACH32)/sun/sdk/demo/demo_module_10/README_demo_module_10 path=usr/demo/net-snmp/demo_module_10/README_demo_module_10
+file build/$(MACH32)/sun/sdk/demo/demo_module_10/get_refreshtime path=usr/demo/net-snmp/demo_module_10/get_refreshtime
+file build/$(MACH32)/sun/sdk/demo/demo_module_1/SDK-DEMO1-MIB.txt path=usr/demo/net-snmp/demo_module_1/SDK-DEMO1-MIB.txt
+file build/$(MACH32)/sun/sdk/demo/demo_module_1/README_demo_module_1 path=usr/demo/net-snmp/demo_module_1/README_demo_module_1
+file build/$(MACH32)/sun/sdk/demo/demo_module_1/demo_module_1.h path=usr/demo/net-snmp/demo_module_1/demo_module_1.h
+file build/$(MACH32)/sun/sdk/demo/demo_module_1/Makefile path=usr/demo/net-snmp/demo_module_1/Makefile
+file build/$(MACH32)/sun/sdk/demo/demo_module_1/demo_module_1.c path=usr/demo/net-snmp/demo_module_1/demo_module_1.c
+file build/$(MACH32)/sun/sdk/demo/demo_module_5/demo_module_5.h path=usr/demo/net-snmp/demo_module_5/demo_module_5.h
+file build/$(MACH32)/sun/sdk/demo/demo_module_5/SDK-DEMO5-MIB.txt path=usr/demo/net-snmp/demo_module_5/SDK-DEMO5-MIB.txt
+file build/$(MACH32)/sun/sdk/demo/demo_module_5/README_demo_module_5 path=usr/demo/net-snmp/demo_module_5/README_demo_module_5
+file build/$(MACH32)/sun/sdk/demo/demo_module_5/demo_module_5.c path=usr/demo/net-snmp/demo_module_5/demo_module_5.c
+file build/$(MACH32)/sun/sdk/demo/demo_module_5/Makefile path=usr/demo/net-snmp/demo_module_5/Makefile
+file build/$(MACH32)/sun/sdk/demo/demo_module_8/Makefile path=usr/demo/net-snmp/demo_module_8/Makefile
+file build/$(MACH32)/sun/sdk/demo/demo_module_8/getme1LoadGroup path=usr/demo/net-snmp/demo_module_8/getme1LoadGroup
+file build/$(MACH32)/sun/sdk/demo/demo_module_8/README_demo_module_8 path=usr/demo/net-snmp/demo_module_8/README_demo_module_8
+file build/$(MACH32)/sun/sdk/demo/demo_module_8/me1LoadGroup.h path=usr/demo/net-snmp/demo_module_8/me1LoadGroup.h
+file build/$(MACH32)/sun/sdk/demo/demo_module_8/SDK-DEMO1-MIB.txt path=usr/demo/net-snmp/demo_module_8/SDK-DEMO1-MIB.txt
+file build/$(MACH32)/sun/sdk/demo/demo_module_8/me1LoadGroup.c path=usr/demo/net-snmp/demo_module_8/me1LoadGroup.c
+file build/$(MACH32)/sun/sdk/demo/demo_module_8/demo_module_8.c path=usr/demo/net-snmp/demo_module_8/demo_module_8.c
+file build/$(MACH32)/sun/sdk/demo/demo_module_2/demo_module_2.h path=usr/demo/net-snmp/demo_module_2/demo_module_2.h
+file build/$(MACH32)/sun/sdk/demo/demo_module_2/README_demo_module_2 path=usr/demo/net-snmp/demo_module_2/README_demo_module_2
+file build/$(MACH32)/sun/sdk/demo/demo_module_2/Makefile path=usr/demo/net-snmp/demo_module_2/Makefile
+file build/$(MACH32)/sun/sdk/demo/demo_module_2/SDK-DEMO1-MIB.txt path=usr/demo/net-snmp/demo_module_2/SDK-DEMO1-MIB.txt
+file build/$(MACH32)/sun/sdk/demo/demo_module_2/demo_module_2.c path=usr/demo/net-snmp/demo_module_2/demo_module_2.c
+file build/$(MACH32)/sun/sdk/demo/demo_module_11/MyTable.c path=usr/demo/net-snmp/demo_module_11/MyTable.c
+file build/$(MACH32)/sun/sdk/demo/demo_module_11/README_demo_module_11 path=usr/demo/net-snmp/demo_module_11/README_demo_module_11
+file build/$(MACH32)/sun/sdk/demo/demo_module_11/Makefile path=usr/demo/net-snmp/demo_module_11/Makefile
+file build/$(MACH32)/sun/sdk/demo/demo_module_11/MyTable.h path=usr/demo/net-snmp/demo_module_11/MyTable.h
+file build/$(MACH32)/sun/agent/modules/entityMib/entAliasMappingTable.h path=usr/demo/net-snmp/demo_module_11/entAliasMappingTable.h
+file build/$(MACH32)/sun/agent/modules/entityMib/entLPMappingTable.h path=usr/demo/net-snmp/demo_module_11/entLPMappingTable.h
+file build/$(MACH32)/sun/agent/modules/entityMib/entLastChangeTime.h path=usr/demo/net-snmp/demo_module_11/entLastChangeTime.h
+file build/$(MACH32)/sun/agent/modules/entityMib/entLogicalTable.h path=usr/demo/net-snmp/demo_module_11/entLogicalTable.h
+file build/$(MACH32)/sun/agent/modules/entityMib/entPhysicalContainsTable.h path=usr/demo/net-snmp/demo_module_11/entPhysicalContainsTable.h
+file build/$(MACH32)/sun/agent/modules/entityMib/entPhysicalTable.h path=usr/demo/net-snmp/demo_module_11/entPhysicalTable.h
+file build/$(MACH32)/sun/agent/modules/entityMib/stdhdr.h path=usr/demo/net-snmp/demo_module_11/stdhdr.h
+file build/$(MACH32)/sun/sdk/demo/demo_module_7/get_filesize path=usr/demo/net-snmp/demo_module_7/get_filesize
+file build/$(MACH32)/sun/sdk/demo/demo_module_7/register_file path=usr/demo/net-snmp/demo_module_7/register_file
+file build/$(MACH32)/sun/sdk/demo/demo_module_7/README_demo_module_7 path=usr/demo/net-snmp/demo_module_7/README_demo_module_7
+file build/$(MACH32)/sun/sdk/demo/demo_module_7/SDK-DEMO6-MIB.txt path=usr/demo/net-snmp/demo_module_7/SDK-DEMO6-MIB.txt
+file build/$(MACH32)/sun/sdk/demo/demo_module_7/demo_module_7.h path=usr/demo/net-snmp/demo_module_7/demo_module_7.h
+file build/$(MACH32)/sun/sdk/demo/demo_module_7/unregister_file path=usr/demo/net-snmp/demo_module_7/unregister_file
+file build/$(MACH32)/sun/sdk/demo/demo_module_7/demo_module_7.c path=usr/demo/net-snmp/demo_module_7/demo_module_7.c
+file build/$(MACH32)/sun/sdk/demo/demo_module_7/Makefile path=usr/demo/net-snmp/demo_module_7/Makefile
+file build/$(MACH32)/sun/sdk/demo/demo_module_3/demo_module_3.h path=usr/demo/net-snmp/demo_module_3/demo_module_3.h
+file build/$(MACH32)/sun/sdk/demo/demo_module_3/README_demo_module_3 path=usr/demo/net-snmp/demo_module_3/README_demo_module_3
+file build/$(MACH32)/sun/sdk/demo/demo_module_3/SDK-DEMO1-MIB.txt path=usr/demo/net-snmp/demo_module_3/SDK-DEMO1-MIB.txt
+file build/$(MACH32)/sun/sdk/demo/demo_module_3/demo_module_3.c path=usr/demo/net-snmp/demo_module_3/demo_module_3.c
+file build/$(MACH32)/sun/sdk/demo/demo_module_3/Makefile path=usr/demo/net-snmp/demo_module_3/Makefile
+file build/$(MACH32)/sun/sdk/demo/demo_module_9/Makefile path=usr/demo/net-snmp/demo_module_9/Makefile
+file build/$(MACH32)/sun/sdk/demo/demo_module_9/demo_module_9.c path=usr/demo/net-snmp/demo_module_9/demo_module_9.c
+file build/$(MACH32)/sun/sdk/demo/demo_module_9/set_demo_module_9 path=usr/demo/net-snmp/demo_module_9/set_demo_module_9
+file build/$(MACH32)/sun/sdk/demo/demo_module_9/SDK-DEMO9-MIB.txt path=usr/demo/net-snmp/demo_module_9/SDK-DEMO9-MIB.txt
+file build/$(MACH32)/sun/sdk/demo/demo_module_9/walk_demo_module_9 path=usr/demo/net-snmp/demo_module_9/walk_demo_module_9
+file build/$(MACH32)/sun/sdk/demo/demo_module_9/get_demo_module_9 path=usr/demo/net-snmp/demo_module_9/get_demo_module_9
+file build/$(MACH32)/sun/sdk/demo/demo_module_9/README_demo_module_9 path=usr/demo/net-snmp/demo_module_9/README_demo_module_9
+file build/$(MACH32)/sun/sdk/demo/demo_module_9/demo_module_9.h path=usr/demo/net-snmp/demo_module_9/demo_module_9.h
+file build/$(MACH32)/sun/sdk/demo/demo_module_12/EXAMPLE-MIB.txt path=usr/demo/net-snmp/demo_module_12/EXAMPLE-MIB.txt
+file build/$(MACH32)/sun/sdk/demo/demo_module_12/README_demo_module_12 path=usr/demo/net-snmp/demo_module_12/README_demo_module_12
+file build/$(MACH32)/sun/sdk/demo/demo_module_12/runmib2c path=usr/demo/net-snmp/demo_module_12/runmib2c
+file build/$(MACH32)/sun/sdk/demo/demo_module_12/runmibcodegen path=usr/demo/net-snmp/demo_module_12/runmibcodegen
+file build/$(MACH32)/sun/sdk/demo/demo_module_4/me4LoadGroup.h path=usr/demo/net-snmp/demo_module_4/me4LoadGroup.h
+file build/$(MACH32)/sun/sdk/demo/demo_module_4/README_demo_module_4 path=usr/demo/net-snmp/demo_module_4/README_demo_module_4
+file build/$(MACH32)/sun/sdk/demo/demo_module_4/Makefile path=usr/demo/net-snmp/demo_module_4/Makefile
+file build/$(MACH32)/sun/sdk/demo/demo_module_4/demo_module_4.conf path=usr/demo/net-snmp/demo_module_4/demo_module_4.conf
+file build/$(MACH32)/sun/sdk/demo/demo_module_4/me4LoadGroup.c path=usr/demo/net-snmp/demo_module_4/me4LoadGroup.c
+file build/$(MACH32)/sun/sdk/demo/demo_module_4/SDK-DEMO4-MIB.txt path=usr/demo/net-snmp/demo_module_4/SDK-DEMO4-MIB.txt
+file build/$(MACH32)/docs/html/acconfig_8h-source.html path=usr/share/doc/net-snmp/html/acconfig_8h-source.html
+file build/$(MACH32)/docs/html/agent__callbacks_8h-source.html path=usr/share/doc/net-snmp/html/agent__callbacks_8h-source.html
+file build/$(MACH32)/docs/html/agent__handler_8c-source.html path=usr/share/doc/net-snmp/html/agent__handler_8c-source.html
+file build/$(MACH32)/docs/html/agent__handler_8h-source.html path=usr/share/doc/net-snmp/html/agent__handler_8h-source.html
+file build/$(MACH32)/docs/html/agent__handler_8h.html path=usr/share/doc/net-snmp/html/agent__handler_8h.html
+file build/$(MACH32)/docs/html/agent__index_8c-source.html path=usr/share/doc/net-snmp/html/agent__index_8c-source.html
+file build/$(MACH32)/docs/html/agent__index_8h-source.html path=usr/share/doc/net-snmp/html/agent__index_8h-source.html
+file build/$(MACH32)/docs/html/agent__module__config_8h-source.html path=usr/share/doc/net-snmp/html/agent__module__config_8h-source.html
+file build/$(MACH32)/docs/html/agent__read__config_8c-source.html path=usr/share/doc/net-snmp/html/agent__read__config_8c-source.html
+file build/$(MACH32)/docs/html/agent__read__config_8h-source.html path=usr/share/doc/net-snmp/html/agent__read__config_8h-source.html
+file build/$(MACH32)/docs/html/agent__registry_8c-source.html path=usr/share/doc/net-snmp/html/agent__registry_8c-source.html
+file build/$(MACH32)/docs/html/agent__registry_8h-source.html path=usr/share/doc/net-snmp/html/agent__registry_8h-source.html
+file build/$(MACH32)/docs/html/agent__trap_8c-source.html path=usr/share/doc/net-snmp/html/agent__trap_8c-source.html
+file build/$(MACH32)/docs/html/agent__trap_8h-source.html path=usr/share/doc/net-snmp/html/agent__trap_8h-source.html
+file build/$(MACH32)/docs/html/all__helpers_8c-source.html path=usr/share/doc/net-snmp/html/all__helpers_8c-source.html
+file build/$(MACH32)/docs/html/all__helpers_8h-source.html path=usr/share/doc/net-snmp/html/all__helpers_8h-source.html
+file build/$(MACH32)/docs/html/annotated.html path=usr/share/doc/net-snmp/html/annotated.html
+file build/$(MACH32)/docs/html/asn1_8c-source.html path=usr/share/doc/net-snmp/html/asn1_8c-source.html
+file build/$(MACH32)/docs/html/asn1_8h-source.html path=usr/share/doc/net-snmp/html/asn1_8h-source.html
+file build/$(MACH32)/docs/html/auto__nlist_8c-source.html path=usr/share/doc/net-snmp/html/auto__nlist_8c-source.html
+file build/$(MACH32)/docs/html/auto__nlist_8h-source.html path=usr/share/doc/net-snmp/html/auto__nlist_8h-source.html
+file build/$(MACH32)/docs/html/autonlist_8h-source.html path=usr/share/doc/net-snmp/html/autonlist_8h-source.html
+file build/$(MACH32)/docs/html/baby__steps_8c-source.html path=usr/share/doc/net-snmp/html/baby__steps_8c-source.html
+file build/$(MACH32)/docs/html/baby__steps_8h-source.html path=usr/share/doc/net-snmp/html/baby__steps_8h-source.html
+file build/$(MACH32)/docs/html/bulk__to__next_8c-source.html path=usr/share/doc/net-snmp/html/bulk__to__next_8c-source.html
+file build/$(MACH32)/docs/html/bulk__to__next_8h-source.html path=usr/share/doc/net-snmp/html/bulk__to__next_8h-source.html
+file build/$(MACH32)/docs/html/cache__handler_8c-source.html path=usr/share/doc/net-snmp/html/cache__handler_8c-source.html
+file build/$(MACH32)/docs/html/cache__handler_8h-source.html path=usr/share/doc/net-snmp/html/cache__handler_8h-source.html
+file build/$(MACH32)/docs/html/callback_8c-source.html path=usr/share/doc/net-snmp/html/callback_8c-source.html
+file build/$(MACH32)/docs/html/callback_8h-source.html path=usr/share/doc/net-snmp/html/callback_8h-source.html
+file build/$(MACH32)/docs/html/check__varbind_8c-source.html path=usr/share/doc/net-snmp/html/check__varbind_8c-source.html
+file build/$(MACH32)/docs/html/check__varbind_8h-source.html path=usr/share/doc/net-snmp/html/check__varbind_8h-source.html
+file build/$(MACH32)/docs/html/classes.html path=usr/share/doc/net-snmp/html/classes.html
+file build/$(MACH32)/docs/html/cmu__compat_8c-source.html path=usr/share/doc/net-snmp/html/cmu__compat_8c-source.html
+file build/$(MACH32)/docs/html/cmu__compat_8h-source.html path=usr/share/doc/net-snmp/html/cmu__compat_8h-source.html
+file build/$(MACH32)/docs/html/config__api_8h-source.html path=usr/share/doc/net-snmp/html/config__api_8h-source.html
+file build/$(MACH32)/docs/html/container_8c-source.html path=usr/share/doc/net-snmp/html/container_8c-source.html
+file build/$(MACH32)/docs/html/container_8h-source.html path=usr/share/doc/net-snmp/html/container_8h-source.html
+file build/$(MACH32)/docs/html/container__binary__array_8c-source.html path=usr/share/doc/net-snmp/html/container__binary__array_8c-source.html
+file build/$(MACH32)/docs/html/container__binary__array_8h-source.html path=usr/share/doc/net-snmp/html/container__binary__array_8h-source.html
+file build/$(MACH32)/docs/html/container__iterator_8c-source.html path=usr/share/doc/net-snmp/html/container__iterator_8c-source.html
+file build/$(MACH32)/docs/html/container__iterator_8h-source.html path=usr/share/doc/net-snmp/html/container__iterator_8h-source.html
+file build/$(MACH32)/docs/html/container__iterator_8h.html path=usr/share/doc/net-snmp/html/container__iterator_8h.html
+file build/$(MACH32)/docs/html/container__list__ssll_8c-source.html path=usr/share/doc/net-snmp/html/container__list__ssll_8c-source.html
+file build/$(MACH32)/docs/html/container__list__ssll_8h-source.html path=usr/share/doc/net-snmp/html/container__list__ssll_8h-source.html
+file build/$(MACH32)/docs/html/container__null_8c-source.html path=usr/share/doc/net-snmp/html/container__null_8c-source.html
+file build/$(MACH32)/docs/html/container__null_8h-source.html path=usr/share/doc/net-snmp/html/container__null_8h-source.html
+file build/$(MACH32)/docs/html/data__list_8c-source.html path=usr/share/doc/net-snmp/html/data__list_8c-source.html
+file build/$(MACH32)/docs/html/data__list_8h-source.html path=usr/share/doc/net-snmp/html/data__list_8h-source.html
+file build/$(MACH32)/docs/html/data__set_8c-example.html path=usr/share/doc/net-snmp/html/data__set_8c-example.html
+file build/$(MACH32)/docs/html/data__set_8c-source.html path=usr/share/doc/net-snmp/html/data__set_8c-source.html
+file build/$(MACH32)/docs/html/data__set_8h-source.html path=usr/share/doc/net-snmp/html/data__set_8h-source.html
+file build/$(MACH32)/docs/html/debug__handler_8c-source.html path=usr/share/doc/net-snmp/html/debug__handler_8c-source.html
+file build/$(MACH32)/docs/html/debug__handler_8h-source.html path=usr/share/doc/net-snmp/html/debug__handler_8h-source.html
+file build/$(MACH32)/docs/html/default__store_8c-source.html path=usr/share/doc/net-snmp/html/default__store_8c-source.html
+file build/$(MACH32)/docs/html/default__store_8h-source.html path=usr/share/doc/net-snmp/html/default__store_8h-source.html
+file build/$(MACH32)/docs/html/definitions_8h-source.html path=usr/share/doc/net-snmp/html/definitions_8h-source.html
+file build/$(MACH32)/docs/html/delayed__instance_8c-example.html path=usr/share/doc/net-snmp/html/delayed__instance_8c-example.html
+file build/$(MACH32)/docs/html/delayed__instance_8c-source.html path=usr/share/doc/net-snmp/html/delayed__instance_8c-source.html
+file build/$(MACH32)/docs/html/delayed__instance_8h-source.html path=usr/share/doc/net-snmp/html/delayed__instance_8h-source.html
+file build/$(MACH32)/docs/html/deprecated.html path=usr/share/doc/net-snmp/html/deprecated.html
+file build/$(MACH32)/docs/html/ds__agent_8h-source.html path=usr/share/doc/net-snmp/html/ds__agent_8h-source.html
+file build/$(MACH32)/docs/html/example_8c-source.html path=usr/share/doc/net-snmp/html/example_8c-source.html
+file build/$(MACH32)/docs/html/example_8h-source.html path=usr/share/doc/net-snmp/html/example_8h-source.html
+file build/$(MACH32)/docs/html/examples.html path=usr/share/doc/net-snmp/html/examples.html
+file build/$(MACH32)/docs/html/factory_8h-source.html path=usr/share/doc/net-snmp/html/factory_8h-source.html
+file build/$(MACH32)/docs/html/fd__event__manager_8c-source.html path=usr/share/doc/net-snmp/html/fd__event__manager_8c-source.html
+file build/$(MACH32)/docs/html/fd__event__manager_8h-source.html path=usr/share/doc/net-snmp/html/fd__event__manager_8h-source.html
+file build/$(MACH32)/docs/html/file__utils_8c-source.html path=usr/share/doc/net-snmp/html/file__utils_8c-source.html
+file build/$(MACH32)/docs/html/file__utils_8h-source.html path=usr/share/doc/net-snmp/html/file__utils_8h-source.html
+file build/$(MACH32)/docs/html/files.html path=usr/share/doc/net-snmp/html/files.html
+file build/$(MACH32)/docs/html/functions.html path=usr/share/doc/net-snmp/html/functions.html
+file build/$(MACH32)/docs/html/functions_vars.html path=usr/share/doc/net-snmp/html/functions_vars.html
+file build/$(MACH32)/docs/html/getopt_8c-source.html path=usr/share/doc/net-snmp/html/getopt_8c-source.html
+file build/$(MACH32)/docs/html/getopt_8h-source.html path=usr/share/doc/net-snmp/html/getopt_8h-source.html
+file build/$(MACH32)/docs/html/globals.html path=usr/share/doc/net-snmp/html/globals.html
+file build/$(MACH32)/docs/html/globals_defs.html path=usr/share/doc/net-snmp/html/globals_defs.html
+file build/$(MACH32)/docs/html/globals_func.html path=usr/share/doc/net-snmp/html/globals_func.html
+file build/$(MACH32)/docs/html/globals_type.html path=usr/share/doc/net-snmp/html/globals_type.html
+file build/$(MACH32)/docs/html/group__access__multiplexer.html path=usr/share/doc/net-snmp/html/group__access__multiplexer.html
+file build/$(MACH32)/docs/html/group__agent.html path=usr/share/doc/net-snmp/html/group__agent.html
+file build/$(MACH32)/docs/html/group__agent__registry.html path=usr/share/doc/net-snmp/html/group__agent__registry.html
+file build/$(MACH32)/docs/html/group__agent__trap.html path=usr/share/doc/net-snmp/html/group__agent__trap.html
+file build/$(MACH32)/docs/html/group__asn1__packet__parse.html path=usr/share/doc/net-snmp/html/group__asn1__packet__parse.html
+file build/$(MACH32)/docs/html/group__baby__steps.html path=usr/share/doc/net-snmp/html/group__baby__steps.html
+file build/$(MACH32)/docs/html/group__bulk__to__next.html path=usr/share/doc/net-snmp/html/group__bulk__to__next.html
+file build/$(MACH32)/docs/html/group__cache__handler.html path=usr/share/doc/net-snmp/html/group__cache__handler.html
+file build/$(MACH32)/docs/html/group__callback.html path=usr/share/doc/net-snmp/html/group__callback.html
+file build/$(MACH32)/docs/html/group__container.html path=usr/share/doc/net-snmp/html/group__container.html
+file build/$(MACH32)/docs/html/group__container__iterator.html path=usr/share/doc/net-snmp/html/group__container__iterator.html
+file build/$(MACH32)/docs/html/group__data__list.html path=usr/share/doc/net-snmp/html/group__data__list.html
+file build/$(MACH32)/docs/html/group__debug.html path=usr/share/doc/net-snmp/html/group__debug.html
+file build/$(MACH32)/docs/html/group__default__store.html path=usr/share/doc/net-snmp/html/group__default__store.html
+file build/$(MACH32)/docs/html/group__handler.html path=usr/share/doc/net-snmp/html/group__handler.html
+file build/$(MACH32)/docs/html/group__instance.html path=usr/share/doc/net-snmp/html/group__instance.html
+file build/$(MACH32)/docs/html/group__leaf.html path=usr/share/doc/net-snmp/html/group__leaf.html
+file build/$(MACH32)/docs/html/group__library.html path=usr/share/doc/net-snmp/html/group__library.html
+file build/$(MACH32)/docs/html/group__mib__maintenance.html path=usr/share/doc/net-snmp/html/group__mib__maintenance.html
+file build/$(MACH32)/docs/html/group__mib__utilities.html path=usr/share/doc/net-snmp/html/group__mib__utilities.html
+file build/$(MACH32)/docs/html/group__mode__end__call.html path=usr/share/doc/net-snmp/html/group__mode__end__call.html
+file build/$(MACH32)/docs/html/group__multiplexer.html path=usr/share/doc/net-snmp/html/group__multiplexer.html
+file build/$(MACH32)/docs/html/group__oid__stash.html path=usr/share/doc/net-snmp/html/group__oid__stash.html
+file build/$(MACH32)/docs/html/group__old__api.html path=usr/share/doc/net-snmp/html/group__old__api.html
+file build/$(MACH32)/docs/html/group__read__config.html path=usr/share/doc/net-snmp/html/group__read__config.html
+file build/$(MACH32)/docs/html/group__read__only.html path=usr/share/doc/net-snmp/html/group__read__only.html
+file build/$(MACH32)/docs/html/group__row__merge.html path=usr/share/doc/net-snmp/html/group__row__merge.html
+file build/$(MACH32)/docs/html/group__scalar.html path=usr/share/doc/net-snmp/html/group__scalar.html
+file build/$(MACH32)/docs/html/group__scalar__group__group.html path=usr/share/doc/net-snmp/html/group__scalar__group__group.html
+file build/$(MACH32)/docs/html/group__serialize.html path=usr/share/doc/net-snmp/html/group__serialize.html
+file build/$(MACH32)/docs/html/group__snmp__agent.html path=usr/share/doc/net-snmp/html/group__snmp__agent.html
+file build/$(MACH32)/docs/html/group__snmp__alarm.html path=usr/share/doc/net-snmp/html/group__snmp__alarm.html
+file build/$(MACH32)/docs/html/group__snmp__client.html path=usr/share/doc/net-snmp/html/group__snmp__client.html
+file build/$(MACH32)/docs/html/group__snmp__logging.html path=usr/share/doc/net-snmp/html/group__snmp__logging.html
+file build/$(MACH32)/docs/html/group__stash__cache.html path=usr/share/doc/net-snmp/html/group__stash__cache.html
+file build/$(MACH32)/docs/html/group__stash__to__next.html path=usr/share/doc/net-snmp/html/group__stash__to__next.html
+file build/$(MACH32)/docs/html/group__table.html path=usr/share/doc/net-snmp/html/group__table.html
+file build/$(MACH32)/docs/html/group__table__array.html path=usr/share/doc/net-snmp/html/group__table__array.html
+file build/$(MACH32)/docs/html/group__table__container.html path=usr/share/doc/net-snmp/html/group__table__container.html
+file build/$(MACH32)/docs/html/group__table__data.html path=usr/share/doc/net-snmp/html/group__table__data.html
+file build/$(MACH32)/docs/html/group__table__dataset.html path=usr/share/doc/net-snmp/html/group__table__dataset.html
+file build/$(MACH32)/docs/html/group__table__generic.html path=usr/share/doc/net-snmp/html/group__table__generic.html
+file build/$(MACH32)/docs/html/group__table__indexes.html path=usr/share/doc/net-snmp/html/group__table__indexes.html
+file build/$(MACH32)/docs/html/group__table__iterator.html path=usr/share/doc/net-snmp/html/group__table__iterator.html
+file build/$(MACH32)/docs/html/group__table__maintenance.html path=usr/share/doc/net-snmp/html/group__table__maintenance.html
+file build/$(MACH32)/docs/html/group__table__row.html path=usr/share/doc/net-snmp/html/group__table__row.html
+file build/$(MACH32)/docs/html/group__table__rows.html path=usr/share/doc/net-snmp/html/group__table__rows.html
+file build/$(MACH32)/docs/html/group__tdata.html path=usr/share/doc/net-snmp/html/group__tdata.html
+file build/$(MACH32)/docs/html/group__util.html path=usr/share/doc/net-snmp/html/group__util.html
+file build/$(MACH32)/docs/html/group__utilities.html path=usr/share/doc/net-snmp/html/group__utilities.html
+file build/$(MACH32)/docs/html/group__watcher.html path=usr/share/doc/net-snmp/html/group__watcher.html
+file build/$(MACH32)/docs/html/index.html path=usr/share/doc/net-snmp/html/index.html
+file build/$(MACH32)/docs/html/inet__ntop_8c-source.html path=usr/share/doc/net-snmp/html/inet__ntop_8c-source.html
+file build/$(MACH32)/docs/html/inet__pton_8c-source.html path=usr/share/doc/net-snmp/html/inet__pton_8c-source.html
+file build/$(MACH32)/docs/html/instance_8c-source.html path=usr/share/doc/net-snmp/html/instance_8c-source.html
+file build/$(MACH32)/docs/html/instance_8h-source.html path=usr/share/doc/net-snmp/html/instance_8h-source.html
+file build/$(MACH32)/docs/html/int64_8c-source.html path=usr/share/doc/net-snmp/html/int64_8c-source.html
+file build/$(MACH32)/docs/html/int64_8h-source.html path=usr/share/doc/net-snmp/html/int64_8h-source.html
+file build/$(MACH32)/docs/html/kernel_8c-source.html path=usr/share/doc/net-snmp/html/kernel_8c-source.html
+file build/$(MACH32)/docs/html/kernel_8h-source.html path=usr/share/doc/net-snmp/html/kernel_8h-source.html
+file build/$(MACH32)/docs/html/keytools_8c-source.html path=usr/share/doc/net-snmp/html/keytools_8c-source.html
+file build/$(MACH32)/docs/html/keytools_8h-source.html path=usr/share/doc/net-snmp/html/keytools_8h-source.html
+file build/$(MACH32)/docs/html/lcd__time_8c-source.html path=usr/share/doc/net-snmp/html/lcd__time_8c-source.html
+file build/$(MACH32)/docs/html/lcd__time_8h-source.html path=usr/share/doc/net-snmp/html/lcd__time_8h-source.html
+file build/$(MACH32)/docs/html/libsnmp_8h-source.html path=usr/share/doc/net-snmp/html/libsnmp_8h-source.html
+file build/$(MACH32)/docs/html/m2m_8h-source.html path=usr/share/doc/net-snmp/html/m2m_8h-source.html
+file build/$(MACH32)/docs/html/md5_8c-source.html path=usr/share/doc/net-snmp/html/md5_8c-source.html
+file build/$(MACH32)/docs/html/md5_8h-source.html path=usr/share/doc/net-snmp/html/md5_8h-source.html
+file build/$(MACH32)/docs/html/mfd_8h-source.html path=usr/share/doc/net-snmp/html/mfd_8h-source.html
+file build/$(MACH32)/docs/html/mib_8c-source.html path=usr/share/doc/net-snmp/html/mib_8c-source.html
+file build/$(MACH32)/docs/html/mib_8h-source.html path=usr/share/doc/net-snmp/html/mib_8h-source.html
+file build/$(MACH32)/docs/html/mib__api_8h-source.html path=usr/share/doc/net-snmp/html/mib__api_8h-source.html
+file build/$(MACH32)/docs/html/mib__module__config_8h-source.html path=usr/share/doc/net-snmp/html/mib__module__config_8h-source.html
+file build/$(MACH32)/docs/html/mib__modules_8c-source.html path=usr/share/doc/net-snmp/html/mib__modules_8c-source.html
+file build/$(MACH32)/docs/html/mib__modules_8h-source.html path=usr/share/doc/net-snmp/html/mib__modules_8h-source.html
+file build/$(MACH32)/docs/html/mode__end__call_8c-source.html path=usr/share/doc/net-snmp/html/mode__end__call_8c-source.html
+file build/$(MACH32)/docs/html/mode__end__call_8h-source.html path=usr/share/doc/net-snmp/html/mode__end__call_8h-source.html
+file build/$(MACH32)/docs/html/modules.html path=usr/share/doc/net-snmp/html/modules.html
+file build/$(MACH32)/docs/html/mt__support_8c-source.html path=usr/share/doc/net-snmp/html/mt__support_8c-source.html
+file build/$(MACH32)/docs/html/mt__support_8h-source.html path=usr/share/doc/net-snmp/html/mt__support_8h-source.html
+file build/$(MACH32)/docs/html/multiplexer_8c-source.html path=usr/share/doc/net-snmp/html/multiplexer_8c-source.html
+file build/$(MACH32)/docs/html/multiplexer_8h-source.html path=usr/share/doc/net-snmp/html/multiplexer_8h-source.html
+file build/$(MACH32)/docs/html/net-snmp-agent-includes_8h-source.html path=usr/share/doc/net-snmp/html/net-snmp-agent-includes_8h-source.html
+file build/$(MACH32)/docs/html/net-snmp-config_8h-source.html path=usr/share/doc/net-snmp/html/net-snmp-config_8h-source.html
+file build/$(MACH32)/docs/html/net-snmp-includes_8h-source.html path=usr/share/doc/net-snmp/html/net-snmp-includes_8h-source.html
+file build/$(MACH32)/docs/html/netSnmpHostsTable_8c-source.html path=usr/share/doc/net-snmp/html/netSnmpHostsTable_8c-source.html
+file build/$(MACH32)/docs/html/netSnmpHostsTable_8h-source.html path=usr/share/doc/net-snmp/html/netSnmpHostsTable_8h-source.html
+file build/$(MACH32)/docs/html/netSnmpHostsTable__access_8c-source.html path=usr/share/doc/net-snmp/html/netSnmpHostsTable__access_8c-source.html
+file build/$(MACH32)/docs/html/netSnmpHostsTable__access_8h-source.html path=usr/share/doc/net-snmp/html/netSnmpHostsTable__access_8h-source.html
+file build/$(MACH32)/docs/html/netSnmpHostsTable__checkfns_8c-source.html path=usr/share/doc/net-snmp/html/netSnmpHostsTable__checkfns_8c-source.html
+file build/$(MACH32)/docs/html/netSnmpHostsTable__checkfns_8h-source.html path=usr/share/doc/net-snmp/html/netSnmpHostsTable__checkfns_8h-source.html
+file build/$(MACH32)/docs/html/netSnmpHostsTable__checkfns__local_8c-source.html path=usr/share/doc/net-snmp/html/netSnmpHostsTable__checkfns__local_8c-source.html
+file build/$(MACH32)/docs/html/netSnmpHostsTable__checkfns__local_8h-source.html path=usr/share/doc/net-snmp/html/netSnmpHostsTable__checkfns__local_8h-source.html
+file build/$(MACH32)/docs/html/netSnmpHostsTable__columns_8h-source.html path=usr/share/doc/net-snmp/html/netSnmpHostsTable__columns_8h-source.html
+file build/$(MACH32)/docs/html/netSnmpHostsTable__enums_8h-source.html path=usr/share/doc/net-snmp/html/netSnmpHostsTable__enums_8h-source.html
+file build/$(MACH32)/docs/html/notification_8c-example.html path=usr/share/doc/net-snmp/html/notification_8c-example.html
+file build/$(MACH32)/docs/html/notification_8c-source.html path=usr/share/doc/net-snmp/html/notification_8c-source.html
+file build/$(MACH32)/docs/html/notification_8h-source.html path=usr/share/doc/net-snmp/html/notification_8h-source.html
+file build/$(MACH32)/docs/html/null_8c-source.html path=usr/share/doc/net-snmp/html/null_8c-source.html
+file build/$(MACH32)/docs/html/null_8h-source.html path=usr/share/doc/net-snmp/html/null_8h-source.html
+file build/$(MACH32)/docs/html/object__monitor_8c-source.html path=usr/share/doc/net-snmp/html/object__monitor_8c-source.html
+file build/$(MACH32)/docs/html/object__monitor_8h-source.html path=usr/share/doc/net-snmp/html/object__monitor_8h-source.html
+file build/$(MACH32)/docs/html/oid__stash_8c-source.html path=usr/share/doc/net-snmp/html/oid__stash_8c-source.html
+file build/$(MACH32)/docs/html/oid__stash_8h-source.html path=usr/share/doc/net-snmp/html/oid__stash_8h-source.html
+file build/$(MACH32)/docs/html/old__api_8c-source.html path=usr/share/doc/net-snmp/html/old__api_8c-source.html
+file build/$(MACH32)/docs/html/old__api_8h-source.html path=usr/share/doc/net-snmp/html/old__api_8h-source.html
+file build/$(MACH32)/docs/html/output__api_8h-source.html path=usr/share/doc/net-snmp/html/output__api_8h-source.html
+file build/$(MACH32)/docs/html/pages.html path=usr/share/doc/net-snmp/html/pages.html
+file build/$(MACH32)/docs/html/parse_8c-source.html path=usr/share/doc/net-snmp/html/parse_8c-source.html
+file build/$(MACH32)/docs/html/parse_8h-source.html path=usr/share/doc/net-snmp/html/parse_8h-source.html
+file build/$(MACH32)/docs/html/pdu__api_8h-source.html path=usr/share/doc/net-snmp/html/pdu__api_8h-source.html
+file build/$(MACH32)/docs/html/pkcs_8c-source.html path=usr/share/doc/net-snmp/html/pkcs_8c-source.html
+file build/$(MACH32)/docs/html/read__config_8c-source.html path=usr/share/doc/net-snmp/html/read__config_8c-source.html
+file build/$(MACH32)/docs/html/read__config_8h-source.html path=usr/share/doc/net-snmp/html/read__config_8h-source.html
+file build/$(MACH32)/docs/html/read__only_8c-source.html path=usr/share/doc/net-snmp/html/read__only_8c-source.html
+file build/$(MACH32)/docs/html/read__only_8h-source.html path=usr/share/doc/net-snmp/html/read__only_8h-source.html
+file build/$(MACH32)/docs/html/row__merge_8c-source.html path=usr/share/doc/net-snmp/html/row__merge_8c-source.html
+file build/$(MACH32)/docs/html/row__merge_8h-source.html path=usr/share/doc/net-snmp/html/row__merge_8h-source.html
+file build/$(MACH32)/docs/html/scalar_8c-source.html path=usr/share/doc/net-snmp/html/scalar_8c-source.html
+file build/$(MACH32)/docs/html/scalar_8h-source.html path=usr/share/doc/net-snmp/html/scalar_8h-source.html
+file build/$(MACH32)/docs/html/scalar__group_8c-source.html path=usr/share/doc/net-snmp/html/scalar__group_8c-source.html
+file build/$(MACH32)/docs/html/scalar__group_8h-source.html path=usr/share/doc/net-snmp/html/scalar__group_8h-source.html
+file build/$(MACH32)/docs/html/scalar__int_8c-example.html path=usr/share/doc/net-snmp/html/scalar__int_8c-example.html
+file build/$(MACH32)/docs/html/scalar__int_8c-source.html path=usr/share/doc/net-snmp/html/scalar__int_8c-source.html
+file build/$(MACH32)/docs/html/scalar__int_8h-source.html path=usr/share/doc/net-snmp/html/scalar__int_8h-source.html
+file build/$(MACH32)/docs/html/scapi_8c-source.html path=usr/share/doc/net-snmp/html/scapi_8c-source.html
+file build/$(MACH32)/docs/html/scapi_8h-source.html path=usr/share/doc/net-snmp/html/scapi_8h-source.html
+file build/$(MACH32)/docs/html/serialize_8c-source.html path=usr/share/doc/net-snmp/html/serialize_8c-source.html
+file build/$(MACH32)/docs/html/serialize_8h-source.html path=usr/share/doc/net-snmp/html/serialize_8h-source.html
+file build/$(MACH32)/docs/html/session__api_8h-source.html path=usr/share/doc/net-snmp/html/session__api_8h-source.html
+file build/$(MACH32)/docs/html/set__helper_8h-source.html path=usr/share/doc/net-snmp/html/set__helper_8h-source.html
+file build/$(MACH32)/docs/html/snmp-tc_8c-source.html path=usr/share/doc/net-snmp/html/snmp-tc_8c-source.html
+file build/$(MACH32)/docs/html/snmp-tc_8h-source.html path=usr/share/doc/net-snmp/html/snmp-tc_8h-source.html
+file build/$(MACH32)/docs/html/snmpAAL5PVCDomain_8c-source.html path=usr/share/doc/net-snmp/html/snmpAAL5PVCDomain_8c-source.html
+file build/$(MACH32)/docs/html/snmpAAL5PVCDomain_8h-source.html path=usr/share/doc/net-snmp/html/snmpAAL5PVCDomain_8h-source.html
+file build/$(MACH32)/docs/html/snmpCallbackDomain_8c-source.html path=usr/share/doc/net-snmp/html/snmpCallbackDomain_8c-source.html
+file build/$(MACH32)/docs/html/snmpCallbackDomain_8h-source.html path=usr/share/doc/net-snmp/html/snmpCallbackDomain_8h-source.html
+file build/$(MACH32)/docs/html/snmpIPXDomain_8c-source.html path=usr/share/doc/net-snmp/html/snmpIPXDomain_8c-source.html
+file build/$(MACH32)/docs/html/snmpIPXDomain_8h-source.html path=usr/share/doc/net-snmp/html/snmpIPXDomain_8h-source.html
+file build/$(MACH32)/docs/html/snmpSTDDomain_8c-source.html path=usr/share/doc/net-snmp/html/snmpSTDDomain_8c-source.html
+file build/$(MACH32)/docs/html/snmpSTDDomain_8h-source.html path=usr/share/doc/net-snmp/html/snmpSTDDomain_8h-source.html
+file build/$(MACH32)/docs/html/snmpTCPDomain_8c-source.html path=usr/share/doc/net-snmp/html/snmpTCPDomain_8c-source.html
+file build/$(MACH32)/docs/html/snmpTCPDomain_8h-source.html path=usr/share/doc/net-snmp/html/snmpTCPDomain_8h-source.html
+file build/$(MACH32)/docs/html/snmpTCPIPv6Domain_8c-source.html path=usr/share/doc/net-snmp/html/snmpTCPIPv6Domain_8c-source.html
+file build/$(MACH32)/docs/html/snmpTCPIPv6Domain_8h-source.html path=usr/share/doc/net-snmp/html/snmpTCPIPv6Domain_8h-source.html
+file build/$(MACH32)/docs/html/snmpUDPDomain_8c-source.html path=usr/share/doc/net-snmp/html/snmpUDPDomain_8c-source.html
+file build/$(MACH32)/docs/html/snmpUDPDomain_8h-source.html path=usr/share/doc/net-snmp/html/snmpUDPDomain_8h-source.html
+file build/$(MACH32)/docs/html/snmpUDPIPv6Domain_8c-source.html path=usr/share/doc/net-snmp/html/snmpUDPIPv6Domain_8c-source.html
+file build/$(MACH32)/docs/html/snmpUDPIPv6Domain_8h-source.html path=usr/share/doc/net-snmp/html/snmpUDPIPv6Domain_8h-source.html
+file build/$(MACH32)/docs/html/snmpUnixDomain_8c-source.html path=usr/share/doc/net-snmp/html/snmpUnixDomain_8c-source.html
+file build/$(MACH32)/docs/html/snmpUnixDomain_8h-source.html path=usr/share/doc/net-snmp/html/snmpUnixDomain_8h-source.html
+file build/$(MACH32)/docs/html/snmp_8c-source.html path=usr/share/doc/net-snmp/html/snmp_8c-source.html
+file build/$(MACH32)/docs/html/snmp_8h-source.html path=usr/share/doc/net-snmp/html/snmp_8h-source.html
+file build/$(MACH32)/docs/html/snmp__agent_8c-source.html path=usr/share/doc/net-snmp/html/snmp__agent_8c-source.html
+file build/$(MACH32)/docs/html/snmp__agent_8h-source.html path=usr/share/doc/net-snmp/html/snmp__agent_8h-source.html
+file build/$(MACH32)/docs/html/snmp__alarm_8c-source.html path=usr/share/doc/net-snmp/html/snmp__alarm_8c-source.html
+file build/$(MACH32)/docs/html/snmp__alarm_8h-source.html path=usr/share/doc/net-snmp/html/snmp__alarm_8h-source.html
+file build/$(MACH32)/docs/html/snmp__api_8c-source.html path=usr/share/doc/net-snmp/html/snmp__api_8c-source.html
+file build/$(MACH32)/docs/html/snmp__api_8h-source.html path=usr/share/doc/net-snmp/html/snmp__api_8h-source.html
+file build/$(MACH32)/docs/html/snmp__assert_8h-source.html path=usr/share/doc/net-snmp/html/snmp__assert_8h-source.html
+file build/$(MACH32)/docs/html/snmp__auth_8c-source.html path=usr/share/doc/net-snmp/html/snmp__auth_8c-source.html
+file build/$(MACH32)/docs/html/snmp__client_8c-source.html path=usr/share/doc/net-snmp/html/snmp__client_8c-source.html
+file build/$(MACH32)/docs/html/snmp__client_8h-source.html path=usr/share/doc/net-snmp/html/snmp__client_8h-source.html
+file build/$(MACH32)/docs/html/snmp__debug_8c-source.html path=usr/share/doc/net-snmp/html/snmp__debug_8c-source.html
+file build/$(MACH32)/docs/html/snmp__debug_8h-source.html path=usr/share/doc/net-snmp/html/snmp__debug_8h-source.html
+file build/$(MACH32)/docs/html/snmp__enum_8c-source.html path=usr/share/doc/net-snmp/html/snmp__enum_8c-source.html
+file build/$(MACH32)/docs/html/snmp__enum_8h-source.html path=usr/share/doc/net-snmp/html/snmp__enum_8h-source.html
+file build/$(MACH32)/docs/html/snmp__impl_8h-source.html path=usr/share/doc/net-snmp/html/snmp__impl_8h-source.html
+file build/$(MACH32)/docs/html/snmp__logging_8c-source.html path=usr/share/doc/net-snmp/html/snmp__logging_8c-source.html
+file build/$(MACH32)/docs/html/snmp__logging_8h-source.html path=usr/share/doc/net-snmp/html/snmp__logging_8h-source.html
+file build/$(MACH32)/docs/html/snmp__parse__args_8c-source.html path=usr/share/doc/net-snmp/html/snmp__parse__args_8c-source.html
+file build/$(MACH32)/docs/html/snmp__parse__args_8h-source.html path=usr/share/doc/net-snmp/html/snmp__parse__args_8h-source.html
+file build/$(MACH32)/docs/html/snmp__perl_8c-source.html path=usr/share/doc/net-snmp/html/snmp__perl_8c-source.html
+file build/$(MACH32)/docs/html/snmp__secmod_8c-source.html path=usr/share/doc/net-snmp/html/snmp__secmod_8c-source.html
+file build/$(MACH32)/docs/html/snmp__secmod_8h-source.html path=usr/share/doc/net-snmp/html/snmp__secmod_8h-source.html
+file build/$(MACH32)/docs/html/snmp__service_8c-source.html path=usr/share/doc/net-snmp/html/snmp__service_8c-source.html
+file build/$(MACH32)/docs/html/snmp__service_8h-source.html path=usr/share/doc/net-snmp/html/snmp__service_8h-source.html
+file build/$(MACH32)/docs/html/snmp__transport_8c-source.html path=usr/share/doc/net-snmp/html/snmp__transport_8c-source.html
+file build/$(MACH32)/docs/html/snmp__transport_8h-source.html path=usr/share/doc/net-snmp/html/snmp__transport_8h-source.html
+file build/$(MACH32)/docs/html/snmp__vars_8c-source.html path=usr/share/doc/net-snmp/html/snmp__vars_8c-source.html
+file build/$(MACH32)/docs/html/snmp__vars_8h-source.html path=usr/share/doc/net-snmp/html/snmp__vars_8h-source.html
+file build/$(MACH32)/docs/html/snmp__version_8c-source.html path=usr/share/doc/net-snmp/html/snmp__version_8c-source.html
+file build/$(MACH32)/docs/html/snmpd_8c-source.html path=usr/share/doc/net-snmp/html/snmpd_8c-source.html
+file build/$(MACH32)/docs/html/snmpd_8h-source.html path=usr/share/doc/net-snmp/html/snmpd_8h-source.html
+file build/$(MACH32)/docs/html/snmpksm_8c-source.html path=usr/share/doc/net-snmp/html/snmpksm_8c-source.html
+file build/$(MACH32)/docs/html/snmpksm_8h-source.html path=usr/share/doc/net-snmp/html/snmpksm_8h-source.html
+file build/$(MACH32)/docs/html/snmplocalsm_8c-source.html path=usr/share/doc/net-snmp/html/snmplocalsm_8c-source.html
+file build/$(MACH32)/docs/html/snmplocalsm_8h-source.html path=usr/share/doc/net-snmp/html/snmplocalsm_8h-source.html
+file build/$(MACH32)/docs/html/snmpsm__init_8h-source.html path=usr/share/doc/net-snmp/html/snmpsm__init_8h-source.html
+file build/$(MACH32)/docs/html/snmpusm_8c-source.html path=usr/share/doc/net-snmp/html/snmpusm_8c-source.html
+file build/$(MACH32)/docs/html/snmpusm_8h-source.html path=usr/share/doc/net-snmp/html/snmpusm_8h-source.html
+file build/$(MACH32)/docs/html/snmpv3-security-includes_8h-source.html path=usr/share/doc/net-snmp/html/snmpv3-security-includes_8h-source.html
+file build/$(MACH32)/docs/html/snmpv3_8c-source.html path=usr/share/doc/net-snmp/html/snmpv3_8c-source.html
+file build/$(MACH32)/docs/html/snmpv3_8h-source.html path=usr/share/doc/net-snmp/html/snmpv3_8h-source.html
+file build/$(MACH32)/docs/html/snmpv3__api_8h-source.html path=usr/share/doc/net-snmp/html/snmpv3__api_8h-source.html
+file build/$(MACH32)/docs/html/snprintf_8c-source.html path=usr/share/doc/net-snmp/html/snprintf_8c-source.html
+file build/$(MACH32)/docs/html/stash__cache_8c-source.html path=usr/share/doc/net-snmp/html/stash__cache_8c-source.html
+file build/$(MACH32)/docs/html/stash__cache_8h-source.html path=usr/share/doc/net-snmp/html/stash__cache_8h-source.html
+file build/$(MACH32)/docs/html/stash__to__next_8c-source.html path=usr/share/doc/net-snmp/html/stash__to__next_8c-source.html
+file build/$(MACH32)/docs/html/stash__to__next_8h-source.html path=usr/share/doc/net-snmp/html/stash__to__next_8h-source.html
+file build/$(MACH32)/docs/html/strlcpy_8c-source.html path=usr/share/doc/net-snmp/html/strlcpy_8c-source.html
+file build/$(MACH32)/docs/html/strtok__r_8c-source.html path=usr/share/doc/net-snmp/html/strtok__r_8c-source.html
+file build/$(MACH32)/docs/html/strtol_8c-source.html path=usr/share/doc/net-snmp/html/strtol_8c-source.html
+file build/$(MACH32)/docs/html/strtoul_8c-source.html path=usr/share/doc/net-snmp/html/strtoul_8c-source.html
+file build/$(MACH32)/docs/html/structiterator__info__s.html path=usr/share/doc/net-snmp/html/structiterator__info__s.html
+file build/$(MACH32)/docs/html/structnetsnmp__agent__request__info__s.html path=usr/share/doc/net-snmp/html/structnetsnmp__agent__request__info__s.html
+file build/$(MACH32)/docs/html/structnetsnmp__column__info__t.html path=usr/share/doc/net-snmp/html/structnetsnmp__column__info__t.html
+file build/$(MACH32)/docs/html/structnetsnmp__data__list__s.html path=usr/share/doc/net-snmp/html/structnetsnmp__data__list__s.html
+file build/$(MACH32)/docs/html/structnetsnmp__handler__registration__s.html path=usr/share/doc/net-snmp/html/structnetsnmp__handler__registration__s.html
+file build/$(MACH32)/docs/html/structnetsnmp__iterator__info__s.html path=usr/share/doc/net-snmp/html/structnetsnmp__iterator__info__s.html
+file build/$(MACH32)/docs/html/structnetsnmp__mib__handler__access__methods.html path=usr/share/doc/net-snmp/html/structnetsnmp__mib__handler__access__methods.html
+file build/$(MACH32)/docs/html/structnetsnmp__mib__handler__methods.html path=usr/share/doc/net-snmp/html/structnetsnmp__mib__handler__methods.html
+file build/$(MACH32)/docs/html/structnetsnmp__mib__handler__s.html path=usr/share/doc/net-snmp/html/structnetsnmp__mib__handler__s.html
+file build/$(MACH32)/docs/html/structnetsnmp__monitor__callback__header__s.html path=usr/share/doc/net-snmp/html/structnetsnmp__monitor__callback__header__s.html
+file build/$(MACH32)/docs/html/structnetsnmp__request__info__s.html path=usr/share/doc/net-snmp/html/structnetsnmp__request__info__s.html
+file build/$(MACH32)/docs/html/structnetsnmp__table__registration__info__s.html path=usr/share/doc/net-snmp/html/structnetsnmp__table__registration__info__s.html
+file build/$(MACH32)/docs/html/structnetsnmp__table__request__info__s.html path=usr/share/doc/net-snmp/html/structnetsnmp__table__request__info__s.html
+file build/$(MACH32)/docs/html/structsnmp__pdu.html path=usr/share/doc/net-snmp/html/structsnmp__pdu.html
+file build/$(MACH32)/docs/html/structsnmp__session.html path=usr/share/doc/net-snmp/html/structsnmp__session.html
+file build/$(MACH32)/docs/html/structvariable__list.html path=usr/share/doc/net-snmp/html/structvariable__list.html
+file build/$(MACH32)/docs/html/system_8c-source.html path=usr/share/doc/net-snmp/html/system_8c-source.html
+file build/$(MACH32)/docs/html/system_8h-source.html path=usr/share/doc/net-snmp/html/system_8h-source.html
+file build/$(MACH32)/docs/html/table_8c-source.html path=usr/share/doc/net-snmp/html/table_8c-source.html
+file build/$(MACH32)/docs/html/table_8h-source.html path=usr/share/doc/net-snmp/html/table_8h-source.html
+file build/$(MACH32)/docs/html/table__array_8c-source.html path=usr/share/doc/net-snmp/html/table__array_8c-source.html
+file build/$(MACH32)/docs/html/table__array_8h-source.html path=usr/share/doc/net-snmp/html/table__array_8h-source.html
+file build/$(MACH32)/docs/html/table__container_8c-source.html path=usr/share/doc/net-snmp/html/table__container_8c-source.html
+file build/$(MACH32)/docs/html/table__container_8h-source.html path=usr/share/doc/net-snmp/html/table__container_8h-source.html
+file build/$(MACH32)/docs/html/table__data_8c-source.html path=usr/share/doc/net-snmp/html/table__data_8c-source.html
+file build/$(MACH32)/docs/html/table__data_8h-source.html path=usr/share/doc/net-snmp/html/table__data_8h-source.html
+file build/$(MACH32)/docs/html/table__dataset_8c-source.html path=usr/share/doc/net-snmp/html/table__dataset_8c-source.html
+file build/$(MACH32)/docs/html/table__dataset_8h-source.html path=usr/share/doc/net-snmp/html/table__dataset_8h-source.html
+file build/$(MACH32)/docs/html/table__generic_8c-source.html path=usr/share/doc/net-snmp/html/table__generic_8c-source.html
+file build/$(MACH32)/docs/html/table__iterator_8c-source.html path=usr/share/doc/net-snmp/html/table__iterator_8c-source.html
+file build/$(MACH32)/docs/html/table__iterator_8h-source.html path=usr/share/doc/net-snmp/html/table__iterator_8h-source.html
+file build/$(MACH32)/docs/html/table__iterator_8h.html path=usr/share/doc/net-snmp/html/table__iterator_8h.html
+file build/$(MACH32)/docs/html/table__row_8c-source.html path=usr/share/doc/net-snmp/html/table__row_8c-source.html
+file build/$(MACH32)/docs/html/table__tdata_8c-source.html path=usr/share/doc/net-snmp/html/table__tdata_8c-source.html
+file build/$(MACH32)/docs/html/table__tdata_8h-source.html path=usr/share/doc/net-snmp/html/table__tdata_8h-source.html
+file build/$(MACH32)/docs/html/test__binary__array_8c-source.html path=usr/share/doc/net-snmp/html/test__binary__array_8c-source.html
+file build/$(MACH32)/docs/html/text__utils_8c-source.html path=usr/share/doc/net-snmp/html/text__utils_8c-source.html
+file build/$(MACH32)/docs/html/text__utils_8h-source.html path=usr/share/doc/net-snmp/html/text__utils_8h-source.html
+file build/$(MACH32)/docs/html/todo.html path=usr/share/doc/net-snmp/html/todo.html
+file build/$(MACH32)/docs/html/tools_8c-source.html path=usr/share/doc/net-snmp/html/tools_8c-source.html
+file build/$(MACH32)/docs/html/tools_8h-source.html path=usr/share/doc/net-snmp/html/tools_8h-source.html
+file build/$(MACH32)/docs/html/tools_8h.html path=usr/share/doc/net-snmp/html/tools_8h.html
+file build/$(MACH32)/docs/html/transform__oids_8h-source.html path=usr/share/doc/net-snmp/html/transform__oids_8h-source.html
+file build/$(MACH32)/docs/html/types_8h-source.html path=usr/share/doc/net-snmp/html/types_8h-source.html
+file build/$(MACH32)/docs/html/ucd-snmp-includes_8h-source.html path=usr/share/doc/net-snmp/html/ucd-snmp-includes_8h-source.html
+file build/$(MACH32)/docs/html/ucdDemoPublic_8c-source.html path=usr/share/doc/net-snmp/html/ucdDemoPublic_8c-source.html
+file build/$(MACH32)/docs/html/ucdDemoPublic_8h-source.html path=usr/share/doc/net-snmp/html/ucdDemoPublic_8h-source.html
+file build/$(MACH32)/docs/html/ucd__compat_8c-source.html path=usr/share/doc/net-snmp/html/ucd__compat_8c-source.html
+file build/$(MACH32)/docs/html/ucd__compat_8h-source.html path=usr/share/doc/net-snmp/html/ucd__compat_8h-source.html
+file build/$(MACH32)/docs/html/utilities_8h-source.html path=usr/share/doc/net-snmp/html/utilities_8h-source.html
+file build/$(MACH32)/docs/html/vacm_8c-source.html path=usr/share/doc/net-snmp/html/vacm_8c-source.html
+file build/$(MACH32)/docs/html/vacm_8h-source.html path=usr/share/doc/net-snmp/html/vacm_8h-source.html
+file build/$(MACH32)/docs/html/var__struct_8h-source.html path=usr/share/doc/net-snmp/html/var__struct_8h-source.html
+file build/$(MACH32)/docs/html/varbind__api_8h-source.html path=usr/share/doc/net-snmp/html/varbind__api_8h-source.html
+file build/$(MACH32)/docs/html/version_8h-source.html path=usr/share/doc/net-snmp/html/version_8h-source.html
+file build/$(MACH32)/docs/html/watched_8c-example.html path=usr/share/doc/net-snmp/html/watched_8c-example.html
+file build/$(MACH32)/docs/html/watched_8c-source.html path=usr/share/doc/net-snmp/html/watched_8c-source.html
+file build/$(MACH32)/docs/html/watched_8h-source.html path=usr/share/doc/net-snmp/html/watched_8h-source.html
+file build/$(MACH32)/docs/html/watcher_8c-source.html path=usr/share/doc/net-snmp/html/watcher_8c-source.html
+file build/$(MACH32)/docs/html/watcher_8h-source.html path=usr/share/doc/net-snmp/html/watcher_8h-source.html
+file build/$(MACH32)/docs/html/winpipe_8c-source.html path=usr/share/doc/net-snmp/html/winpipe_8c-source.html
+file build/$(MACH32)/docs/html/winpipe_8h-source.html path=usr/share/doc/net-snmp/html/winpipe_8h-source.html
+file build/$(MACH32)/docs/html/winservice_8c-source.html path=usr/share/doc/net-snmp/html/winservice_8c-source.html
+file build/$(MACH32)/docs/html/winservice_8h-source.html path=usr/share/doc/net-snmp/html/winservice_8h-source.html
+file path=usr/share/man/man1/encode_keychange.1
+file path=usr/share/man/man1/fixproc.1
+file path=usr/share/man/man1/mib2c-update.1
+file path=usr/share/man/man1/mib2c.1
+file path=usr/share/man/man1/net-snmp-config.1
+file path=usr/share/man/man1/snmpbulkget.1
+file path=usr/share/man/man1/snmpbulkwalk.1
+file path=usr/share/man/man1/snmpcmd.1
+file path=usr/share/man/man1/snmpconf.1
+file path=usr/share/man/man1/snmpdelta.1
+file path=usr/share/man/man1/snmpdf.1
+file path=usr/share/man/man1/snmpget.1
+file path=usr/share/man/man1/snmpgetnext.1
+file path=usr/share/man/man1/snmpinform.1
+file path=usr/share/man/man1/snmpnetstat.1
+file path=usr/share/man/man1/snmpset.1
+file path=usr/share/man/man1/snmptable.1
+file path=usr/share/man/man1/snmptest.1
+file path=usr/share/man/man1/snmptranslate.1
+file path=usr/share/man/man1/snmptrap.1
+file path=usr/share/man/man1/snmpusm.1
+file path=usr/share/man/man1/snmpvacm.1
+file path=usr/share/man/man1/snmpwalk.1
+file path=usr/share/man/man1/tkmib.1
+file path=usr/share/man/man1/traptoemail.1
+file path=usr/share/man/man3/add_mibdir.3
+file path=usr/share/man/man3/add_module_replacement.3
+file path=usr/share/man/man3/config_perror.3
+file path=usr/share/man/man3/config_pwarn.3
+file path=usr/share/man/man3/default_store.3
+file path=usr/share/man/man3/fprint_description.3
+file path=usr/share/man/man3/fprint_objid.3
+file path=usr/share/man/man3/fprint_value.3
+file path=usr/share/man/man3/fprint_variable.3
+file path=usr/share/man/man3/get_module_node.3
+file path=usr/share/man/man3/init_mib.3
+file path=usr/share/man/man3/init_mib_internals.3
+file path=usr/share/man/man3/mib_api.3
+file path=usr/share/man/man3/netsnmp_Container_iterator.3
+file path=usr/share/man/man3/netsnmp_agent.3
+file path=usr/share/man/man3/netsnmp_baby_steps.3
+file path=usr/share/man/man3/netsnmp_bulk_to_next.3
+file path=usr/share/man/man3/netsnmp_cache_handler.3
+file path=usr/share/man/man3/netsnmp_container.3
+file path=usr/share/man/man3/netsnmp_debug.3
+file path=usr/share/man/man3/netsnmp_ds_get_boolean.3
+file path=usr/share/man/man3/netsnmp_ds_get_int.3
+file path=usr/share/man/man3/netsnmp_ds_get_string.3
+file path=usr/share/man/man3/netsnmp_ds_register_config.3
+file path=usr/share/man/man3/netsnmp_ds_register_premib.3
+file path=usr/share/man/man3/netsnmp_ds_set_boolean.3
+file path=usr/share/man/man3/netsnmp_ds_set_int.3
+file path=usr/share/man/man3/netsnmp_ds_set_string.3
+file path=usr/share/man/man3/netsnmp_ds_shutdown.3
+file path=usr/share/man/man3/netsnmp_example_scalar_int.3
+file path=usr/share/man/man3/netsnmp_handler.3
+file path=usr/share/man/man3/netsnmp_instance.3
+file path=usr/share/man/man3/netsnmp_iterator_info_s.3
+file path=usr/share/man/man3/netsnmp_leaf.3
+file path=usr/share/man/man3/netsnmp_library.3
+file path=usr/share/man/man3/netsnmp_mib_handler_methods.3
+file path=usr/share/man/man3/netsnmp_mib_utilities.3
+file path=usr/share/man/man3/netsnmp_mode_end_call.3
+file path=usr/share/man/man3/netsnmp_multiplexer.3
+file path=usr/share/man/man3/netsnmp_old_api.3
+file path=usr/share/man/man3/netsnmp_read_only.3
+file path=usr/share/man/man3/netsnmp_row_merge.3
+file path=usr/share/man/man3/netsnmp_scalar.3
+file path=usr/share/man/man3/netsnmp_scalar_group_group.3
+file path=usr/share/man/man3/netsnmp_serialize.3
+file path=usr/share/man/man3/netsnmp_stash_cache.3
+file path=usr/share/man/man3/netsnmp_table.3
+file path=usr/share/man/man3/netsnmp_table_array.3
+file path=usr/share/man/man3/netsnmp_table_data.3
+file path=usr/share/man/man3/netsnmp_table_dataset.3
+file path=usr/share/man/man3/netsnmp_table_iterator.3
+file path=usr/share/man/man3/netsnmp_utilities.3
+file path=usr/share/man/man3/netsnmp_watcher.3
+file path=usr/share/man/man3/print_description.3
+file path=usr/share/man/man3/print_mib.3
+file path=usr/share/man/man3/print_objid.3
+file path=usr/share/man/man3/print_value.3
+file path=usr/share/man/man3/print_variable.3
+file path=usr/share/man/man3/read_all_mibs.3
+file path=usr/share/man/man3/read_config.3
+file path=usr/share/man/man3/read_config_print_usage.3
+file path=usr/share/man/man3/read_configs.3
+file path=usr/share/man/man3/read_mib.3
+file path=usr/share/man/man3/read_module.3
+file path=usr/share/man/man3/read_module_node.3
+file path=usr/share/man/man3/read_objid.3
+file path=usr/share/man/man3/read_premib_configs.3
+file path=usr/share/man/man3/register_app_config_handler.3
+file path=usr/share/man/man3/register_app_premib_handler.3
+file path=usr/share/man/man3/register_config_handler.3
+file path=usr/share/man/man3/register_mib_handlers.3
+file path=usr/share/man/man3/register_premib_handler.3
+file path=usr/share/man/man3/send_easy_trap.3
+file path=usr/share/man/man3/send_trap_vars.3
+file path=usr/share/man/man3/send_v2trap.3
+file path=usr/share/man/man3/shutdown_mib.3
+file path=usr/share/man/man3/snmp_agent_api.3
+file path=usr/share/man/man3/snmp_alarm.3
+file path=usr/share/man/man3/snmp_alarm_register.3
+file path=usr/share/man/man3/snmp_alarm_register_hr.3
+file path=usr/share/man/man3/snmp_alarm_unregister.3
+file path=usr/share/man/man3/snmp_api.3
+file path=usr/share/man/man3/snmp_api_errstring.3
+file path=usr/share/man/man3/snmp_close.3
+file path=usr/share/man/man3/snmp_error.3
+file path=usr/share/man/man3/snmp_free_pdu.3
+file path=usr/share/man/man3/snmp_open.3
+file path=usr/share/man/man3/snmp_perror.3
+file path=usr/share/man/man3/snmp_read.3
+file path=usr/share/man/man3/snmp_select_info.3
+file path=usr/share/man/man3/snmp_send.3
+file path=usr/share/man/man3/snmp_sess_api.3
+file path=usr/share/man/man3/snmp_sess_async_send.3
+file path=usr/share/man/man3/snmp_sess_close.3
+file path=usr/share/man/man3/snmp_sess_error.3
+file path=usr/share/man/man3/snmp_sess_init.3
+file path=usr/share/man/man3/snmp_sess_open.3
+file path=usr/share/man/man3/snmp_sess_perror.3
+file path=usr/share/man/man3/snmp_sess_read.3
+file path=usr/share/man/man3/snmp_sess_select_info.3
+file path=usr/share/man/man3/snmp_sess_send.3
+file path=usr/share/man/man3/snmp_sess_session.3
+file path=usr/share/man/man3/snmp_sess_timeout.3
+file path=usr/share/man/man3/snmp_set_mib_warnings.3
+file path=usr/share/man/man3/snmp_set_save_descriptions.3
+file path=usr/share/man/man3/snmp_timeout.3
+file path=usr/share/man/man3/snmp_trap_api.3
+file path=usr/share/man/man3/snprint_objid.3
+file path=usr/share/man/man3/snprint_value.3
+file path=usr/share/man/man3/snprint_variable.3
+file path=usr/share/man/man3/sprint_realloc_objid.3
+file path=usr/share/man/man3/sprint_realloc_value.3
+file path=usr/share/man/man3/sprint_realloc_variable.3
+file path=usr/share/man/man3/unregister_app_config_handler.3
+file path=usr/share/man/man3/unregister_config_handler.3
+file path=usr/share/man/man5/mib2c.conf.5
+file path=usr/share/man/man5/snmp.conf.5
+file path=usr/share/man/man5/snmp_config.5
+file path=usr/share/man/man5/snmpd.conf.5
+file path=usr/share/man/man5/snmpd.examples.5
+file path=usr/share/man/man5/snmpd.internal.5
+file path=usr/share/man/man5/snmptrapd.conf.5
+file path=usr/share/man/man5/variables.5
+file path=usr/share/man/man8/snmpd.8
+file path=usr/share/man/man8/snmptrapd.8
+legacy pkg=SUNWnet-snmp-doc \
+ name="Net-SNMP Agent manpages and html documentation files" \
+ desc="Net-SNMP Agent manpages and html documentation files (5.4.1)"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/net-snmp.xml Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,157 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+ CDDL HEADER START
+
+ The contents of this file are subject to the terms of the
+ Common Development and Distribution License (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+ Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+
+ NOTE: This service description is not editable; its contents
+ may be overwritten by package or patch operations, including
+ operating system upgrade. Make customizations in a different
+ file.
+
+ Service manifest for the net-snmp daemon
+-->
+
+<service_bundle type='manifest' name='SUNWnet-snmp-core:net-snmp'>
+
+<service
+ name='application/management/net-snmp'
+ type='service'
+ version='1'>
+
+ <create_default_instance enabled='false' />
+
+ <single_instance />
+
+ <dependency
+ name='milestone'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/milestone/sysconfig' />
+ </dependency>
+
+ <!-- Need / & /usr filesystems mounted, /var mounted read/write -->
+ <dependency
+ name='fs-local'
+ type='service'
+ grouping='require_all'
+ restart_on='none'>
+ <service_fmri value='svc:/system/filesystem/local' />
+ </dependency>
+
+ <dependency
+ name='name-services'
+ grouping='optional_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/milestone/name-services' />
+ </dependency>
+
+ <dependency
+ name='system-log'
+ grouping='optional_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/system-log' />
+ </dependency>
+
+ <dependency
+ name='rstat'
+ grouping='optional_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/network/rpc/rstat' />
+ </dependency>
+
+ <dependency name='cryptosvc'
+ grouping='require_all'
+ restart_on='restart'
+ type='service'>
+ <service_fmri value='svc:/system/cryptosvc' />
+ </dependency>
+
+ <dependency
+ name='network'
+ grouping='require_all'
+ restart_on='restart'
+ type='service'>
+ <service_fmri value='svc:/milestone/network' />
+ </dependency>
+
+ <dependency
+ name='config-file'
+ grouping='require_all'
+ restart_on='refresh'
+ type='path'>
+ <service_fmri
+ value='file://localhost/etc/net-snmp/snmp/snmpd.conf' />
+ </dependency>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/lib/svc/method/svc-net-snmp'
+ timeout_seconds='60'>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':kill'
+ timeout_seconds='60'>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='refresh'
+ exec=':kill -HUP'
+ timeout_seconds='60'>
+ </exec_method>
+
+ <property_group name='general' type='framework'>
+ <!-- to start/stop net-snmp -->
+ <propval name='action_authorization' type='astring'
+ value='solaris.smf.manage.net-snmp' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.manage.net-snmp' />
+ <propval name='arch_type' type='integer' value='0' />
+ </property_group>
+
+ <stability value='Unstable' />
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ net-snmp SNMP daemon
+ </loctext>
+ </common_name>
+
+ <documentation>
+ <manpage title='snmpd' section='8'
+ manpath='/usr/share/man/' />
+ </documentation>
+
+ </template>
+
+</service>
+
+</service_bundle>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/001.scapi.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,31 @@
+--- net-snmp-5.4.1/snmplib/scapi.c Fri Sep 15 05:47:01 2006
++++ net-snmp-5.4.1.mod/snmplib/scapi.c Sat Jul 4 02:58:34 2009
+@@ -406,11 +406,11 @@
+ int rval = SNMPERR_SUCCESS;
+ #endif
+ int ret;
++ unsigned int tmp_len;
+
+ #ifdef NETSNMP_USE_OPENSSL
+ const EVP_MD *hashfn;
+ EVP_MD_CTX ctx, *cptr;
+- unsigned int tmp_len;
+ #endif
+
+ DEBUGTRACE;
+@@ -479,13 +479,11 @@
+
+ #ifndef NETSNMP_DISABLE_MD5
+ if (ISTRANSFORM(hashtype, HMACMD5Auth)) {
+- rval = pkcs_digest(CKM_MD5, buf, buf_len, MAC, &tmp_len);
+- *MAC_len = tmp_len;
++ rval = pkcs_digest(CKM_MD5, buf, buf_len, MAC, MAC_len);
+ } else
+ #endif
+ if (ISTRANSFORM(hashtype, HMACSHA1Auth)) {
+- rval = pkcs_digest(CKM_SHA_1, buf, buf_len, MAC, &tmp_len);
+- *MAC_len = tmp_len;
++ rval = pkcs_digest(CKM_SHA_1, buf, buf_len, MAC, MAC_len);
+ } else {
+ return (SNMPERR_GENERR);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/002.pkcs.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,31 @@
+--- net-snmp-5.4.1/snmplib/pkcs.c Tue Nov 6 02:00:04 2007
++++ net-snmp-5.4.1/snmplib/pkcs.mod.c Tue Nov 6 01:58:30 2007
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
++ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+@@ -107,10 +107,12 @@
+ {
+ int slotcount, i;
+
++ (void) C_Finalize(NULL);
++
+ if (pSlot != NULL) {
+ slotcount = pSlot->count;
+ for (i = 0; i < slotcount; i++) {
+- if (pSlot->pSession->hdl != NULL) {
++ if (pSlot->pSession != NULL) {
+ free(pSlot->pSession->hdl);
+ }
+ }
+@@ -117,7 +119,6 @@
+ free(pSlot);
+ }
+
+- (void) C_Finalize(NULL);
+ return 0;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/003.solaris-ip-mib.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,491 @@
+--- net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/systemstats_solaris2.c (revision 0)
++++ net-snmp-5.4.1-patch/agent/mibgroup/ip-mib/data_access/systemstats_solaris2.c (revision 0)
+@@ -0,0 +1,199 @@
++#include <net-snmp/net-snmp-config.h>
++#include <net-snmp/net-snmp-includes.h>
++
++#include <net-snmp/agent/net-snmp-agent-includes.h>
++#include <net-snmp/data_access/ipstats.h>
++#include <net-snmp/data_access/systemstats.h>
++
++#include "kernel_sunos5.h"
++
++static int _systemstats(mibgroup_e, netsnmp_container *, u_int);
++static void _add_ipstats(mib2_ipIfStatsEntry_t *, mib2_ipIfStatsEntry_t *);
++static int _insert_entry(netsnmp_container *, mib2_ipIfStatsEntry_t *);
++
++void
++netsnmp_access_systemstats_arch_init(void)
++{
++ init_kernel_sunos5();
++}
++
++/*
++ * @retval 0 success
++ * @retval -1 container error
++ * @retval -2 could not create entry (probably malloc)
++ */
++int
++netsnmp_access_systemstats_container_arch_load(netsnmp_container* container,
++ u_int load_flags)
++{
++ int rc;
++
++ if (container == NULL)
++ return (-1);
++
++ if ((rc = _systemstats(MIB_IP_TRAFFIC_STATS, container, load_flags)) < 0)
++ return (rc);
++#if defined(NETSNMP_ENABLE_IPV6)
++ if ((rc = _systemstats(MIB_IP6, container, load_flags)) < 0) {
++ netsnmp_access_systemstats_container_free(container,
++ NETSNMP_ACCESS_SYSTEMSTATS_FREE_NOFLAGS);
++ return (rc);
++ }
++#endif
++ return (0);
++}
++
++/*
++ * @retval 0 success
++ * @retval <0 error
++ */
++static int
++_systemstats(mibgroup_e mib, netsnmp_container *container, u_int load_flags)
++{
++ mib2_ipIfStatsEntry_t ipe, iptot;
++ req_e req = GET_FIRST;
++ int ipversion = (mib == MIB_IP6) ? MIB2_INETADDRESSTYPE_ipv6 :
++ MIB2_INETADDRESSTYPE_ipv4;
++ bzero((void *)&iptot, sizeof(iptot));
++
++ while (getMibstat(mib, &ipe, sizeof(ipe), req,
++ &Get_everything, NULL) == 0) {
++ req = GET_NEXT;
++ netsnmp_assert(ipe.ipIfStatsIPVersion == ipversion);
++ _add_ipstats(&iptot, &ipe);
++ }
++ iptot.ipIfStatsIPVersion = ipversion;
++ return _insert_entry(container, &iptot);
++}
++
++static void
++_add_ipstats(mib2_ipIfStatsEntry_t *o1, mib2_ipIfStatsEntry_t *o2)
++{
++ o1->ipIfStatsInHdrErrors += o2->ipIfStatsInHdrErrors;
++ o1->ipIfStatsInTooBigErrors += o2->ipIfStatsInTooBigErrors;
++ o1->ipIfStatsInNoRoutes += o2->ipIfStatsInNoRoutes;
++ o1->ipIfStatsInAddrErrors += o2->ipIfStatsInAddrErrors;
++ o1->ipIfStatsInUnknownProtos += o2->ipIfStatsInUnknownProtos;
++ o1->ipIfStatsInTruncatedPkts += o2->ipIfStatsInTruncatedPkts;
++ o1->ipIfStatsInDiscards += o2->ipIfStatsInDiscards;
++ o1->ipIfStatsOutDiscards += o2->ipIfStatsOutDiscards;
++ o1->ipIfStatsOutFragOKs += o2->ipIfStatsOutFragOKs;
++ o1->ipIfStatsOutFragFails += o2->ipIfStatsOutFragFails;
++ o1->ipIfStatsOutFragCreates += o2->ipIfStatsOutFragCreates;
++ o1->ipIfStatsReasmReqds += o2->ipIfStatsReasmReqds;
++ o1->ipIfStatsReasmOKs += o2->ipIfStatsReasmOKs;
++ o1->ipIfStatsReasmFails += o2->ipIfStatsReasmFails;
++ o1->ipIfStatsOutNoRoutes += o2->ipIfStatsOutNoRoutes;
++ o1->ipIfStatsReasmDuplicates += o2->ipIfStatsReasmDuplicates;
++ o1->ipIfStatsReasmPartDups += o2->ipIfStatsReasmPartDups;
++ o1->ipIfStatsForwProhibits += o2->ipIfStatsForwProhibits;
++ o1->udpInCksumErrs += o2->udpInCksumErrs;
++ o1->udpInOverflows += o2->udpInOverflows;
++ o1->rawipInOverflows += o2->rawipInOverflows;
++ o1->ipIfStatsInWrongIPVersion += o2->ipIfStatsInWrongIPVersion;
++ o1->ipIfStatsOutWrongIPVersion += o2->ipIfStatsOutWrongIPVersion;
++ o1->ipIfStatsOutSwitchIPVersion += o2->ipIfStatsOutSwitchIPVersion;
++ o1->ipIfStatsHCInReceives += o2->ipIfStatsHCInReceives;
++ o1->ipIfStatsHCInOctets += o2->ipIfStatsHCInOctets;
++ o1->ipIfStatsHCInForwDatagrams += o2->ipIfStatsHCInForwDatagrams;
++ o1->ipIfStatsHCInDelivers += o2->ipIfStatsHCInDelivers;
++ o1->ipIfStatsHCOutRequests += o2->ipIfStatsHCOutRequests;
++ o1->ipIfStatsHCOutForwDatagrams += o2->ipIfStatsHCOutForwDatagrams;
++ o1->ipIfStatsOutFragReqds += o2->ipIfStatsOutFragReqds;
++ o1->ipIfStatsHCOutTransmits += o2->ipIfStatsHCOutTransmits;
++ o1->ipIfStatsHCOutOctets += o2->ipIfStatsHCOutOctets;
++ o1->ipIfStatsHCInMcastPkts += o2->ipIfStatsHCInMcastPkts;
++ o1->ipIfStatsHCInMcastOctets += o2->ipIfStatsHCInMcastOctets;
++ o1->ipIfStatsHCOutMcastPkts += o2->ipIfStatsHCOutMcastPkts;
++ o1->ipIfStatsHCOutMcastOctets += o2->ipIfStatsHCOutMcastOctets;
++ o1->ipIfStatsHCInBcastPkts += o2->ipIfStatsHCInBcastPkts;
++ o1->ipIfStatsHCOutBcastPkts += o2->ipIfStatsHCOutBcastPkts;
++ o1->ipsecInSucceeded += o2->ipsecInSucceeded;
++ o1->ipsecInFailed += o2->ipsecInFailed;
++ o1->ipInCksumErrs += o2->ipInCksumErrs;
++ o1->tcpInErrs += o2->tcpInErrs;
++ o1->udpNoPorts += o2->udpNoPorts;
++}
++
++/*
++ * @retval 0 entry was successfully inserted in the container
++ * @retval -1 container error
++ * @retval -2 memory allocation error
++ */
++static int
++_insert_entry(netsnmp_container *container, mib2_ipIfStatsEntry_t *ipe)
++{
++ netsnmp_systemstats_entry *ep =
++ netsnmp_access_systemstats_entry_create(ipe->ipIfStatsIPVersion);
++
++ DEBUGMSGTL(("access:systemstats:arch", "insert entry for v%d\n",
++ ipe->ipIfStatsIPVersion));
++ if (ep == NULL) {
++ DEBUGMSGT(("access:systemstats:arch", "insert failed (alloc)"));
++ return (-2);
++ }
++
++ ep->stats.HCInReceives.low =
++ ipe->ipIfStatsHCInReceives & 0xffffffff;
++ ep->stats.HCInReceives.high = ipe->ipIfStatsHCInReceives >> 32;
++ ep->stats.HCInOctets.low =
++ ipe->ipIfStatsHCInOctets & 0xffffffff;
++ ep->stats.HCInOctets.high = ipe->ipIfStatsHCInOctets >> 32;
++ ep->stats.InHdrErrors = ipe->ipIfStatsInHdrErrors;
++ ep->stats.InAddrErrors = ipe->ipIfStatsInAddrErrors;
++ ep->stats.InUnknownProtos = ipe->ipIfStatsInUnknownProtos;
++ ep->stats.InTruncatedPkts = ipe->ipIfStatsInTruncatedPkts;
++ ep->stats.HCInForwDatagrams.low =
++ ipe->ipIfStatsHCInForwDatagrams & 0xffffffff;
++ ep->stats.HCInForwDatagrams.high =
++ ipe->ipIfStatsHCInForwDatagrams >> 32;
++ ep->stats.ReasmReqds = ipe->ipIfStatsReasmReqds;
++ ep->stats.ReasmOKs = ipe->ipIfStatsReasmOKs;
++ ep->stats.ReasmFails = ipe->ipIfStatsReasmFails;
++ ep->stats.InDiscards = ipe->ipIfStatsInDiscards;
++ ep->stats.HCInDelivers.low =
++ ipe->ipIfStatsHCInDelivers & 0xffffffff;
++ ep->stats.HCInDelivers.high =
++ ipe->ipIfStatsHCInDelivers >> 32;
++ ep->stats.HCOutRequests.low =
++ ipe->ipIfStatsHCOutRequests & 0xffffffff;
++ ep->stats.HCOutRequests.high =
++ ipe->ipIfStatsHCOutRequests >> 32;
++ ep->stats.OutNoRoutes = ipe->ipIfStatsOutNoRoutes;
++ ep->stats.HCOutForwDatagrams.low =
++ ipe->ipIfStatsHCOutForwDatagrams & 0xffffffff;
++ ep->stats.HCOutForwDatagrams.high =
++ ipe->ipIfStatsHCOutForwDatagrams >> 32;
++ ep->stats.OutDiscards = ipe->ipIfStatsOutDiscards;
++ ep->stats.OutFragOKs = ipe->ipIfStatsOutFragOKs;
++ ep->stats.OutFragFails = ipe->ipIfStatsOutFragFails;
++ ep->stats.OutFragCreates = ipe->ipIfStatsOutFragCreates;
++ ep->stats.HCOutTransmits.low =
++ ipe->ipIfStatsHCOutTransmits & 0xffffffff;
++ ep->stats.HCOutTransmits.high = ipe->ipIfStatsHCOutTransmits >> 32;
++ ep->stats.HCOutOctets.low = ipe->ipIfStatsHCOutOctets & 0xffffffff;
++ ep->stats.HCOutOctets.high = ipe->ipIfStatsHCOutOctets >> 32;
++ ep->stats.HCInMcastPkts.low = ipe->ipIfStatsHCInMcastPkts & 0xffffffff;
++ ep->stats.HCInMcastPkts.high = ipe->ipIfStatsHCInMcastPkts >> 32;
++ ep->stats.HCInMcastOctets.low =
++ ipe->ipIfStatsHCInMcastOctets & 0xffffffff;
++ ep->stats.HCInMcastOctets.high = ipe->ipIfStatsHCInMcastOctets >> 32;
++ ep->stats.HCOutMcastPkts.low =
++ ipe->ipIfStatsHCOutMcastPkts & 0xffffffff;
++ ep->stats.HCOutMcastPkts.high = ipe->ipIfStatsHCOutMcastPkts >> 32;
++ ep->stats.HCOutMcastOctets.low =
++ ipe->ipIfStatsHCOutMcastOctets & 0xffffffff;
++ ep->stats.HCOutMcastOctets.high = ipe->ipIfStatsHCOutMcastOctets >> 32;
++ ep->stats.HCInBcastPkts.low = ipe->ipIfStatsHCInBcastPkts & 0xffffffff;
++ ep->stats.HCInBcastPkts.high = ipe->ipIfStatsHCInBcastPkts >> 32;
++ ep->stats.HCOutBcastPkts.low =
++ ipe->ipIfStatsHCOutBcastPkts & 0xffffffff;
++ ep->stats.HCOutBcastPkts.high = ipe->ipIfStatsHCOutBcastPkts >> 32;
++
++ if (CONTAINER_INSERT(container, ep) < 0) {
++ DEBUGMSGT(("access:systemstats:arch", "unable to insert entry"));
++ netsnmp_access_systemstats_entry_free(ep);
++ return (-1);
++ }
++ return (0);
++}
+--- net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_solaris2.c (revision 0)
++++ net-snmp-5.4.1-patch/agent/mibgroup/ip-mib/data_access/ipaddress_solaris2.c (revision 0)
+@@ -0,0 +1,286 @@
++/*
++ * IP-MIB architecture support
++ *
++ */
++#include <net-snmp/net-snmp-config.h>
++#include <net-snmp/net-snmp-includes.h>
++
++#include <net-snmp/agent/net-snmp-agent-includes.h>
++#include <net-snmp/data_access/ipaddress.h>
++#include <net-snmp/data_access/interface.h>
++
++#include "ip-mib/ipAddressTable/ipAddressTable_constants.h"
++
++#include "kernel_sunos5.h"
++#include "mibII/mibII_common.h"
++
++static int _load_v4(netsnmp_container *container, int idx_offset);
++#if defined( NETSNMP_ENABLE_IPV6 )
++static int _load_v6(netsnmp_container *container, int idx_offset);
++#endif
++
++/*
++ * initialize arch specific storage
++ *
++ * @retval 0: success
++ * @retval <0: error
++ */
++int
++netsnmp_arch_ipaddress_entry_init(netsnmp_ipaddress_entry *entry)
++{
++ init_kernel_sunos5();
++ return 0;
++}
++
++/*
++ * cleanup arch specific storage
++ */
++void
++netsnmp_arch_ipaddress_entry_cleanup(netsnmp_ipaddress_entry *entry)
++{
++ /*
++ * Nothing to do.
++ */
++}
++
++/*
++ * copy arch specific storage
++ */
++int
++netsnmp_arch_ipaddress_entry_copy(netsnmp_ipaddress_entry *lhs,
++ netsnmp_ipaddress_entry *rhs)
++{
++ /*
++ * Nothing to do.
++ */
++ return 0;
++}
++
++/*
++ * create a new entry
++ */
++int
++netsnmp_arch_ipaddress_create(netsnmp_ipaddress_entry *entry)
++{
++ if (NULL == entry)
++ return -1;
++
++ DEBUGMSGT(("access:ipaddress:create", "not applicable\n"));
++ return 0;
++}
++
++/*
++ * delete an entry
++ */
++int
++netsnmp_arch_ipaddress_delete(netsnmp_ipaddress_entry *entry)
++{
++ if (NULL == entry)
++ return -1;
++
++ DEBUGMSGT(("access:ipaddress:create", "not applicable\n"));
++ return 0;
++}
++
++/**
++ *
++ * @retval 0 no errors
++ * @retval !0 errors
++ */
++int
++netsnmp_arch_ipaddress_container_load(netsnmp_container *container,
++ u_int load_flags)
++{
++ int rc = 0, idx_offset = 0;
++
++ if (!(load_flags & NETSNMP_ACCESS_IPADDRESS_LOAD_IPV6_ONLY)) {
++ rc = _load_v4(container, idx_offset);
++ if(rc < 0) {
++ u_int flags = NETSNMP_ACCESS_IPADDRESS_FREE_KEEP_CONTAINER;
++ netsnmp_access_ipaddress_container_free(container, flags);
++ }
++ }
++
++#if defined( NETSNMP_ENABLE_IPV6 )
++
++ if (!(load_flags & NETSNMP_ACCESS_IPADDRESS_LOAD_IPV4_ONLY)) {
++ if (rc < 0)
++ rc = 0;
++
++ idx_offset = rc;
++
++ rc = _load_v6(container, idx_offset);
++ if(rc < 0) {
++ u_int flags = NETSNMP_ACCESS_IPADDRESS_FREE_KEEP_CONTAINER;
++ netsnmp_access_ipaddress_container_free(container, flags);
++ }
++ }
++#endif
++
++ /*
++ * return no errors (0) if we found any interfaces
++ */
++ if(rc > 0)
++ rc = 0;
++ return rc;
++}
++
++/*
++ * @retval >=idx_offset ok
++ * @retval -1 memory allocation error
++ * @retval -2 interface lookup error
++ * @retval -3 container error
++ */
++static int
++_load_v4(netsnmp_container *container, int idx_offset)
++{
++ mib2_ipAddrEntry_t ipae;
++ netsnmp_ipaddress_entry *entry;
++ req_e req = GET_FIRST;
++ int rc = 0;
++
++ DEBUGMSGTL(("access:ipaddress:container", "loading v4\n"));
++ while ((rc = getMibstat(MIB_IP_ADDR, &ipae, sizeof(ipae), req,
++ &Get_everything, NULL)) == 0) {
++ req = GET_NEXT;
++ entry = netsnmp_access_ipaddress_entry_create();
++ if (entry == NULL)
++ return (-1);
++ if (ipae.ipAdEntAddr == INADDR_ANY)
++ continue;
++
++ ipae.ipAdEntIfIndex.o_bytes[ipae.ipAdEntIfIndex.o_length] = '\0';
++ DEBUGMSGTL(("access:ipaddress:container", "found if %s\n",
++ ipae.ipAdEntIfIndex.o_bytes));
++ /* Obtain interface index */
++ entry->if_index =
++ netsnmp_access_interface_index_find(ipae.ipAdEntIfIndex.o_bytes);
++ if (entry->if_index == 0) {
++ DEBUGMSGTL(("access:ipaddress:container", "cannot find if %s\n",
++ ipae.ipAdEntIfIndex));
++ netsnmp_access_ipaddress_entry_free(entry);
++ return (-2);
++ }
++
++ if (strchr((const char *)&ipae.ipAdEntIfIndex.o_bytes, ':') != 0)
++ entry->flags |= NETSNMP_ACCESS_IPADDRESS_ISALIAS;
++
++ /* Get the address */
++ entry->ia_address_len = sizeof(ipae.ipAdEntAddr);
++ netsnmp_assert(entry->ia_address_len == 4 &&
++ entry->ia_address_len <= sizeof(entry->ia_address));
++ memcpy(&entry->ia_address, &ipae.ipAdEntAddr, entry->ia_address_len);
++
++ /* prefix */
++ entry->ia_prefix_len = ipae.ipAdEntInfo.ae_subnet_len;
++
++ /* set the Origin */
++ if (ipae.ipAdEntInfo.ae_flags & IFF_DHCPRUNNING)
++ entry->ia_origin = IPADDRESSORIGINTC_DHCP;
++ else
++ entry->ia_origin = IPADDRESSORIGINTC_MANUAL;
++
++ /* set ipv4 constants */
++ entry->ia_type = IPADDRESSTYPE_UNICAST;
++ entry->ia_status = IPADDRESSSTATUSTC_PREFERRED;
++
++ entry->ns_ia_index = ++idx_offset;
++
++ DEBUGMSGTL(("access:ipaddress:container", "insert if %d, addrlen %d\n",
++ entry->if_index, entry->ia_address_len));
++
++ if (CONTAINER_INSERT(container, entry) < 0) {
++ DEBUGMSGTL(("access:ipaddress:container", "unable to insert %s\n",
++ ipae.ipAdEntIfIndex.o_bytes));
++ netsnmp_access_ipaddress_entry_free(entry);
++ return (-3);
++ }
++ }
++ return (idx_offset);
++}
++
++/*
++ * @retval >=idx_offset ok
++ * @retval -1 memory allocation error
++ * @retval -2 interface lookup error
++ * @retval -3 container error
++ */
++#if defined( NETSNMP_ENABLE_IPV6 )
++static int
++_load_v6(netsnmp_container *container, int idx_offset)
++{
++ mib2_ipv6AddrEntry_t ip6ae;
++ netsnmp_ipaddress_entry *entry;
++ req_e req = GET_FIRST;
++ int rc = 0;
++
++ DEBUGMSGTL(("access:ipaddress:container", "loading v6... cache %d\n",
++ MIB_IP6_ADDR));
++ while ((rc = getMibstat(MIB_IP6_ADDR, &ip6ae, sizeof(ip6ae), req,
++ &Get_everything, NULL)) == 0) {
++ req = GET_NEXT;
++ entry = netsnmp_access_ipaddress_entry_create();
++ if (entry == NULL)
++ return (-1);
++ if (bcmp((const void *)&ip6ae.ipv6AddrAddress,
++ (const void *)&in6addr_any,
++ sizeof (ip6ae.ipv6AddrAddress)) == 0)
++ continue;
++
++ ip6ae.ipv6AddrIfIndex.o_bytes[ip6ae.ipv6AddrIfIndex.o_length] = '\0';
++ DEBUGMSGTL(("access:ipaddress:container", "found if %s\n",
++ ip6ae.ipv6AddrIfIndex.o_bytes));
++
++ /* Obtain interface index */
++ entry->if_index =
++ netsnmp_access_interface_index_find(
++ ip6ae.ipv6AddrIfIndex.o_bytes);
++ if (entry->if_index == 0) {
++ DEBUGMSGTL(("access:ipaddress:container", "cannot find if %s\n",
++ ip6ae.ipv6AddrIfIndex.o_bytes));
++ netsnmp_access_ipaddress_entry_free(entry);
++ return (-2);
++ }
++
++ /* Get the address */
++ entry->ia_address_len = sizeof(ip6ae.ipv6AddrAddress);
++ netsnmp_assert(entry->ia_address_len == 16 &&
++ entry->ia_address_len <= sizeof(entry->ia_address));
++ memcpy(&entry->ia_address, &ip6ae.ipv6AddrAddress,
++ entry->ia_address_len);
++
++ /* prefix */
++ entry->ia_prefix_len = ip6ae.ipv6AddrPfxLength;
++
++ /* type is anycast? (mib2.h: 1 = yes, 2 = no) */
++ entry->ia_type = (ip6ae.ipv6AddrAnycastFlag == 1) ?
++ IPADDRESSTYPE_ANYCAST : IPADDRESSTYPE_UNICAST;
++
++ /* origin (mib2.h: 1 = stateless, 2 = stateful, 3 = unknown) */
++ DEBUGMSGTL(("access:ipaddress:container", "origin %d\n",
++ ip6ae.ipv6AddrType));
++ if (ip6ae.ipv6AddrType == 1)
++ entry->ia_origin = IPADDRESSORIGINTC_LINKLAYER;
++ else if (ip6ae.ipv6AddrInfo.ae_flags & IFF_DHCPRUNNING)
++ entry->ia_origin = IPADDRESSORIGINTC_DHCP;
++ else
++ entry->ia_origin = IPADDRESSORIGINTC_MANUAL;
++
++ /* status */
++ entry->ia_status = ip6ae.ipv6AddrStatus;
++
++ entry->ns_ia_index = ++idx_offset;
++
++ DEBUGMSGTL(("access:ipaddress:container", "insert if %d, addrlen %d\n",
++ entry->if_index, entry->ia_address_len));
++
++ if (CONTAINER_INSERT(container, entry) < 0) {
++ DEBUGMSGTL(("access:ipaddress:container", "unable to insert %s\n",
++ ip6ae.ipv6AddrIfIndex.o_bytes));
++ netsnmp_access_ipaddress_entry_free(entry);
++ return (-3);
++ }
++ }
++ return (idx_offset);
++}
++#endif /* defined( NETSNMP_ENABLE_IPV6 ) */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/004.16436.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,162 @@
+Index: net-snmp/include/net-snmp/system/solaris.h
+===================================================================
+--- net-snmp/include/net-snmp/system/solaris.h (revision 16435)
++++ net-snmp/include/net-snmp/system/solaris.h (revision 16436)
+@@ -38,3 +38,10 @@
+
+ /* Solaris 7+ */
+ #define NETSNMP_DONT_USE_NLIST 1
++
++/*
++ * NEW_MIB_COMPLIANT is a define used in Solaris 10U4+ to enable additional
++ * MIB information (it affects the structs in <inet/mib2.h>
++ */
++
++#define NEW_MIB_COMPLIANT
+Index: net-snmp/configure.in
+===================================================================
+--- net-snmp/configure.in (revision 16435)
++++ net-snmp/configure.in (revision 16436)
+@@ -1339,8 +1339,9 @@
+ AC_CHECK_TYPES([off64_t])
+ AC_CHECK_TYPES([uintptr_t, intptr_t])
+
+-# solaris specific type
++# solaris specific types
+ AC_CHECK_TYPES([Counter64],,,[#include <inet/mib2.h>])
++AC_CHECK_TYPES([mib2_ipIfStatsEntry_t],,,[#include <inet/mib2.h>])
+
+ # guess IPv6 stack type.
+ if test "x$enable_ipv6" = "xyes"; then
+Index: net-snmp/agent/mibgroup/kernel_sunos5.h
+===================================================================
+--- net-snmp/agent/mibgroup/kernel_sunos5.h (revision 16435)
++++ net-snmp/agent/mibgroup/kernel_sunos5.h (revision 16436)
+@@ -71,7 +71,11 @@
+ MIB_TRANSMISSION = 14,
+ MIB_SNMP = 15,
+ #ifdef SOLARIS_HAVE_IPV6_MIB_SUPPORT
+- MIB_IP6_ADDR = 16,
++#ifdef SOLARIS_HAVE_RFC4293_SUPPORT
++ MIB_IP_TRAFFIC_STATS,
++#endif
++ MIB_IP6,
++ MIB_IP6_ADDR,
+ MIB_TCP6_CONN,
+ MIB_UDP6_ENDPOINT,
+ #endif
+Index: net-snmp/agent/mibgroup/if-mib/data_access/interface_solaris2.c
+===================================================================
+--- net-snmp/agent/mibgroup/if-mib/data_access/interface_solaris2.c (revision 16435)
++++ net-snmp/agent/mibgroup/if-mib/data_access/interface_solaris2.c (revision 16436)
+@@ -3,9 +3,9 @@
+ */
+ #include <net-snmp/net-snmp-config.h>
+ #include <net-snmp/net-snmp-includes.h>
+-#include "mibII/mibII_common.h"
+ #include "if-mib/ifTable/ifTable_constants.h"
+ #include "kernel_sunos5.h"
++#include "mibII/mibII_common.h"
+
+ #include <net-snmp/agent/net-snmp-agent-includes.h>
+
+Index: net-snmp/agent/mibgroup/ip-mib/data_access/ipaddress.h
+===================================================================
+--- net-snmp/agent/mibgroup/ip-mib/data_access/ipaddress.h (revision 16435)
++++ net-snmp/agent/mibgroup/ip-mib/data_access/ipaddress.h (revision 16436)
+@@ -20,6 +20,8 @@
+ config_require(ip-mib/data_access/ipaddress_common)
+ #if defined( linux )
+ config_require(ip-mib/data_access/ipaddress_linux)
++#elif defined( solaris2 )
++config_require(ip-mib/data_access/ipaddress_solaris2)
+ #else
+ config_error(the ipaddress data access library is not available in this environment.)
+ #endif
+Index: net-snmp/agent/mibgroup/ip-mib/data_access/systemstats.h
+===================================================================
+--- net-snmp/agent/mibgroup/ip-mib/data_access/systemstats.h (revision 16435)
++++ net-snmp/agent/mibgroup/ip-mib/data_access/systemstats.h (revision 16436)
+@@ -20,6 +20,8 @@
+ config_require(ip-mib/data_access/systemstats_common)
+ #if defined( linux )
+ config_require(ip-mib/data_access/systemstats_linux)
++#elif defined( solaris2 )
++config_require(ip-mib/data_access/systemstats_solaris2)
+ #else
+ config_error(the systemstats data access library is not available in this environment.)
+ #endif
+Index: net-snmp/agent/mibgroup/mibII.h
+===================================================================
+--- net-snmp/agent/mibgroup/mibII.h (revision 16435)
++++ net-snmp/agent/mibgroup/mibII.h (revision 16436)
+@@ -30,3 +30,10 @@
+ #if defined( linux )
+ config_require(ip-mib ip-forward-mib tcp-mib udp-mib)
+ #endif
++
++/*
++ * For Solaris, enable additional tables when it has extended MIB support.
++ */
++#if defined( solaris2 ) && defined( HAVE_MIB2_IPIFSTATSENTRY_T )
++config_require(ip-mib/ipSystemStatsTable ip-mib/ipAddressTable)
++#endif
+Index: net-snmp/agent/mibgroup/kernel_sunos5.c
+===================================================================
+--- net-snmp/agent/mibgroup/kernel_sunos5.c (revision 16435)
++++ net-snmp/agent/mibgroup/kernel_sunos5.c (revision 16436)
+@@ -45,6 +45,7 @@
+ #include <kstat.h>
+ #include <errno.h>
+ #include <time.h>
++#include <ctype.h>
+
+ #include <sys/sockio.h>
+ #include <sys/socket.h>
+@@ -103,6 +104,13 @@
+ {MIB_TRANSMISSION, 0, (void *) -1, 0, 0, 0, 0},
+ {MIB_SNMP, 0, (void *) -1, 0, 0, 0, 0},
+ #ifdef SOLARIS_HAVE_IPV6_MIB_SUPPORT
++#ifdef SOLARIS_HAVE_RFC4293_SUPPORT
++ {MIB_IP_TRAFFIC_STATS, 20 * sizeof(mib2_ipIfStatsEntry_t), (void *)-1, 0,
++ 30, 0, 0},
++ {MIB_IP6, 20 * sizeof(mib2_ipIfStatsEntry_t), (void *)-1, 0, 30, 0, 0},
++#else
++ {MIB_IP6, 20 * sizeof(mib2_ipv6IfStatsEntry_t), (void *)-1, 0, 30, 0, 0},
++#endif
+ {MIB_IP6_ADDR, 20 * sizeof(mib2_ipv6AddrEntry_t), (void *)-1, 0, 30, 0, 0},
+ {MIB_TCP6_CONN, 1000 * sizeof(mib2_tcp6ConnEntry_t), (void *) -1, 0, 30,
+ 0, 0},
+@@ -131,6 +139,10 @@
+ {MIB2_TRANSMISSION, 0,},
+ {MIB2_SNMP, 0,},
+ #ifdef SOLARIS_HAVE_IPV6_MIB_SUPPORT
++#ifdef SOLARIS_HAVE_RFC4293_SUPPORT
++ {MIB2_IP, MIB2_IP_TRAFFIC_STATS},
++#endif
++ {MIB2_IP6, 0},
+ {MIB2_IP6, MIB2_IP6_ADDR},
+ {MIB2_TCP6, MIB2_TCP6_CONN},
+ {MIB2_UDP6, MIB2_UDP6_ENTRY},
+@@ -343,7 +355,8 @@
+ kstat_ctl_t *ksc;
+ kstat_t *ks, *kstat_data;
+ kstat_named_t *d;
+- size_t i, instance;
++ uint_t i;
++ int instance;
+ char module_name[64];
+ int ret;
+ u_longlong_t val; /* The largest value */
+@@ -900,7 +913,11 @@
+ req = (struct opthdr *)(tor + 1);
+ req->level = groupname;
+ req->name = subgroupname;
++#if defined( SOLARIS_HAVE_RFC4293_SUPPORT )
++ req->len = 1; /* Used as a flag for S10 to grab extra data */
++#else
+ req->len = 0;
++#endif
+ strbuf.len = tor->OPT_length + tor->OPT_offset;
+ flags = 0;
+ if ((rc = putmsg(sd, &strbuf, NULL, flags))) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/005.16736.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,759 @@
+Index: net-snmp/agent/mibgroup/kernel_sunos5.h
+===================================================================
+--- net-snmp/agent/mibgroup/kernel_sunos5.h (revision 16735)
++++ net-snmp/agent/mibgroup/kernel_sunos5.h (revision 16736)
+@@ -193,6 +193,8 @@
+ int getKstatString(const char *statname, const char *varname,
+ char *value, size_t value_len);
+
++ int solaris2_if_nametoindex(const char *, int);
++
+ #ifdef _STDC_COMPAT
+ #ifdef __cplusplus
+ }
+Index: net-snmp/agent/mibgroup/if-mib/data_access/interface_solaris2.c
+===================================================================
+--- net-snmp/agent/mibgroup/if-mib/data_access/interface_solaris2.c (revision 16735)
++++ net-snmp/agent/mibgroup/if-mib/data_access/interface_solaris2.c (revision 16736)
+@@ -14,6 +14,7 @@
+ #include <sys/ioctl.h>
+ #include <sys/sockio.h>
+ #include <strings.h>
++#include <string.h>
+
+ static int _set_ip_flags_v4(netsnmp_interface_entry *, mib2_ifEntry_t *);
+ static int _match_ifname_v4addr(void *ifname, void *ipaddr);
+@@ -43,25 +44,7 @@
+ #if defined(HAVE_IF_NAMETOINDEX)
+ return if_nametoindex(name);
+ #else /* use GIFINDEX */
+- int sd;
+- struct ifreq ifr;
+-
+- if (name == 0) {
+- return (0);
+- }
+-
+- if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+- return (0);
+- }
+-
+- strncpy(ifr.ifr_name, name, IFNAMSIZ);
+- if (ioctl(sd, SIOCGIFINDEX, (char *) &ifr) < 0) {
+- close(sd);
+- return (0);
+- }
+-
+- close(sd);
+- return (ifr.ifr_index);
++ return solaris2_if_nametoindex(name, strlen(name));
+ #endif /* defined(HAVE_IF_NAMETOINDEX) */
+ }
+
+Index: net-snmp/agent/mibgroup/mibII/interfaces.c
+===================================================================
+--- net-snmp/agent/mibgroup/mibII/interfaces.c (revision 16735)
++++ net-snmp/agent/mibgroup/mibII/interfaces.c (revision 16736)
+@@ -2245,71 +2245,7 @@
+ int
+ Interface_Index_By_Name(char *Name, int Len)
+ {
+- int i, sd, lastlen = 0, interfaces = 0;
+- struct ifconf ifc;
+- struct ifreq *ifrp = NULL;
+- char *buf = NULL;
+-
+- if (Name == 0) {
+- return 0;
+- }
+- if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+- return 0;
+- }
+-
+- /*
+- * Cope with lots of interfaces and brokenness of ioctl SIOCGIFCONF
+- * on some platforms; see W. R. Stevens, ``Unix Network Programming
+- * Volume I'', p.435.
+- */
+-
+- for (i = 8;; i += 8) {
+- buf = calloc(i, sizeof(struct ifreq));
+- if (buf == NULL) {
+- close(sd);
+- return 0;
+- }
+- ifc.ifc_len = i * sizeof(struct ifreq);
+- ifc.ifc_buf = (caddr_t) buf;
+-
+- if (ioctl(sd, SIOCGIFCONF, (char *) &ifc) < 0) {
+- if (errno != EINVAL || lastlen != 0) {
+- /*
+- * Something has gone genuinely wrong.
+- */
+- free(buf);
+- close(sd);
+- return 0;
+- }
+- /*
+- * Otherwise, it could just be that the buffer is too small.
+- */
+- } else {
+- if (ifc.ifc_len == lastlen) {
+- /*
+- * The length is the same as the last time; we're done.
+- */
+- break;
+- }
+- lastlen = ifc.ifc_len;
+- }
+- free(buf);
+- }
+-
+- ifrp = ifc.ifc_req;
+- interfaces = (ifc.ifc_len / sizeof(struct ifreq)) + 1;
+-
+- for (i = 1; i < interfaces; i++, ifrp++) {
+- if (strncmp(ifrp->ifr_name, Name, Len) == 0) {
+- free(buf);
+- close(sd);
+- return i;
+- }
+- }
+-
+- free(buf);
+- close(sd);
+- return 0;
++ return (solaris2_if_nametoindex(Name, Len));
+ }
+
+ #endif /* solaris2 */
+Index: net-snmp/agent/mibgroup/kernel_sunos5.c
+===================================================================
+--- net-snmp/agent/mibgroup/kernel_sunos5.c (revision 16735)
++++ net-snmp/agent/mibgroup/kernel_sunos5.c (revision 16736)
+@@ -169,11 +169,14 @@
+ getif(mib2_ifEntry_t *ifbuf, size_t size, req_e req_type, mib2_ifEntry_t *resp,
+ size_t *length, int (*comp)(void *, void *), void *arg);
+ static void
+-set_if_info(mib2_ifEntry_t *ifp, unsigned index, char *name, uint64_t flags,int mtu);
++set_if_info(mib2_ifEntry_t *ifp, unsigned index, char *name, uint64_t flags,
++ int mtu);
+ static int get_if_stats(mib2_ifEntry_t *ifp);
+
+-static int get_phys_address(mib2_ifEntry_t *ifp);
+-static int _dlpi_phys_address(int fd, char *paddr, int maxlen, int *paddrlen);
++static int _dlpi_open(const char *devname);
++static int _dlpi_get_phys_address(int fd, char *paddr, int maxlen,
++ int *paddrlen);
++static int _dlpi_get_iftype(int fd, unsigned int *iftype);
+ static int _dlpi_attach(int fd, int ppa);
+ static int _dlpi_parse_devname(char *devname, int *ppap);
+
+@@ -1047,7 +1050,7 @@
+ mib2_ifEntry_t *resp, size_t *length, int (*comp)(void *, void *),
+ void *arg)
+ {
+- int i, ret;
++ int fd, i, ret;
+ int ifsd, ifsd6 = -1;
+ struct lifreq lifreq, *lifrp;
+ mib2_ifEntry_t *ifp;
+@@ -1109,6 +1112,15 @@
+
+ memset(ifp, 0, sizeof(mib2_ifEntry_t));
+
++ if ((fd = _dlpi_open(ifnp->if_name)) != -1) {
++ /* Could open DLPI... now try to grab some info */
++ (void) _dlpi_get_phys_address(fd, ifp->ifPhysAddress.o_bytes,
++ sizeof(ifp->ifPhysAddress.o_bytes),
++ &ifp->ifPhysAddress.o_length);
++ (void) _dlpi_get_iftype(fd, &ifp->ifType);
++ close(fd);
++ }
++
+ set_if_info(ifp, ifnp->if_index, ifnp->if_name, if_flags,
+ lifrp->lifr_metric);
+
+@@ -1117,9 +1129,6 @@
+ continue;
+ }
+
+- /* try to obtain the physical address */
+- (void) get_phys_address(ifp);
+-
+ /*
+ * Once we reach here we know that all went well, so move to
+ * the next ifEntry.
+@@ -1294,8 +1303,11 @@
+ #endif /*defined(HAVE_IF_NAMEINDEX)&&defined(NETSNMP_INCLUDE_IFTABLE_REWRITES)*/
+
+ static void
+-set_if_info(mib2_ifEntry_t *ifp, unsigned index, char *name, uint64_t flags, int mtu)
++set_if_info(mib2_ifEntry_t *ifp, unsigned index, char *name, uint64_t flags,
++ int mtu)
+ {
++ boolean_t havespeed = B_FALSE;
++
+ /*
+ * Set basic information
+ */
+@@ -1307,101 +1319,122 @@
+ ifp->ifLastChange = 0; /* Who knows ... */
+ ifp->flags = flags;
+ ifp->ifMtu = mtu;
++ ifp->ifSpeed = 0;
+
+- /* make ifOperStatus depend on link status if available */
+- if (ifp->ifAdminStatus == 1) {
+- int i_tmp;
+- /* only UPed interfaces get correct link status - if any */
+- if (getKstatInt(NULL, name,"link_up",&i_tmp) == 0) {
+- ifp->ifOperStatus = i_tmp ? 1 : 2;
+- }
+- }
+-
+ /*
+- * Set link Type and Speed
++ * Get link speed
+ */
+- ifp->ifType = 1;
+- ifp->ifSpeed = 0;
+-
+- if ((getKstatInt(NULL, name, "ifspeed", &ifp->ifSpeed) == 0) &&
+- (ifp->ifSpeed != 0)) {
++ if ((getKstatInt(NULL, name, "ifspeed", &ifp->ifSpeed) == 0)) {
+ /*
+ * check for SunOS patch with half implemented ifSpeed
+ */
+- if (ifp->ifSpeed < 10000) {
++ if (ifp->ifSpeed > 0 && ifp->ifSpeed < 10000) {
+ ifp->ifSpeed *= 1000000;
+ }
++ havespeed = B_TRUE;
+ } else if (getKstatInt(NULL, name, "ifSpeed", &ifp->ifSpeed) == 0) {
+ /*
+ * this is good
+ */
++ havespeed = B_TRUE;
+ }
+
+- switch (name[0]) {
+- case 'a': /* ath (802.11) */
+- if (name[1] == 't' && name[2] == 'h')
+- ifp->ifType = 71;
+- break;
+- case 'l': /* le / lo / lane (ATM LAN Emulation) */
+- if (name[1] == 'o') {
+- if (!ifp->ifSpeed)
+- ifp->ifSpeed = 127000000;
+- ifp->ifType = 24;
+- } else if (name[1] == 'e') {
+- if (!ifp->ifSpeed)
+- ifp->ifSpeed = 10000000;
+- ifp->ifType = 6;
+- } else if (name[1] == 'a') {
+- if (!ifp->ifSpeed)
+- ifp->ifSpeed = 155000000;
+- ifp->ifType = 37;
+- }
+- break;
++ /* make ifOperStatus depend on link status if available */
++ if (ifp->ifAdminStatus == 1) {
++ int i_tmp;
++ /* only UPed interfaces get correct link status - if any */
++ if (getKstatInt(NULL, name,"link_up",&i_tmp) == 0) {
++ ifp->ifOperStatus = i_tmp ? 1 : 2;
++#ifdef IFF_FAILED
++ } else if (flags & IFF_FAILED) {
++ /*
++ * If IPMP is used, and if the daemon marks the interface
++ * as 'failed', then we know for sure something is amiss.
++ */
++ ifp->ifOperStatus = 2;
++#endif
++ } else if (havespeed == B_TRUE && ifp->ifSpeed == 0) {
++ /* Heuristic */
++ ifp->ifOperStatus = 2;
++ }
++ }
+
+- case 'g': /* ge (gigabit ethernet card) */
+- case 'c': /* ce (Cassini Gigabit-Ethernet (PCI) */
+- if (!ifp->ifSpeed)
+- ifp->ifSpeed = 1000000000;
+- ifp->ifType = 6;
+- break;
+-
+- case 'h': /* hme (SBus card) */
+- case 'e': /* eri (PCI card) */
+- case 'b': /* be */
+- case 'd': /* dmfe -- found on netra X1 */
+- if (!ifp->ifSpeed)
+- ifp->ifSpeed = 100000000;
+- ifp->ifType = 6;
+- break;
+-
+- case 'f': /* fa (Fore ATM) */
+- if (!ifp->ifSpeed)
+- ifp->ifSpeed = 155000000;
+- ifp->ifType = 37;
+- break;
+-
+- case 'q': /* qe (QuadEther)/qa (Fore ATM)/qfe (QuadFastEther) */
+- if (name[1] == 'a') {
+- if (!ifp->ifSpeed)
+- ifp->ifSpeed = 155000000;
+- ifp->ifType = 37;
+- } else if (name[1] == 'e') {
++ /*
++ * Set link Type and Speed (if it could not be determined from kstat)
++ */
++ if (ifp->ifType == 24) {
++ ifp->ifSpeed = 127000000;
++ } else if (ifp->ifType == 1 || ifp->ifType == 0) {
++ /*
++ * Could not get the type from DLPI, so lets fall back to the hardcoded
++ * values.
++ */
++ switch (name[0]) {
++ case 'a': /* ath (802.11) */
++ if (name[1] == 't' && name[2] == 'h')
++ ifp->ifType = 71;
++ break;
++ case 'l': /* le / lo / lane (ATM LAN Emulation) */
++ if (name[1] == 'o') {
+ if (!ifp->ifSpeed)
++ ifp->ifSpeed = 127000000;
++ ifp->ifType = 24;
++ } else if (name[1] == 'e') {
++ if (!ifp->ifSpeed)
+ ifp->ifSpeed = 10000000;
+ ifp->ifType = 6;
+- } else if (name[1] == 'f') {
++ } else if (name[1] == 'a') {
+ if (!ifp->ifSpeed)
+- ifp->ifSpeed = 100000000;
++ ifp->ifSpeed = 155000000;
++ ifp->ifType = 37;
++ }
++ break;
++
++ case 'g': /* ge (gigabit ethernet card) */
++ case 'c': /* ce (Cassini Gigabit-Ethernet (PCI) */
++ if (!ifp->ifSpeed)
++ ifp->ifSpeed = 1000000000;
+ ifp->ifType = 6;
++ break;
++
++ case 'h': /* hme (SBus card) */
++ case 'e': /* eri (PCI card) */
++ case 'b': /* be */
++ case 'd': /* dmfe -- found on netra X1 */
++ if (!ifp->ifSpeed)
++ ifp->ifSpeed = 100000000;
++ ifp->ifType = 6;
++ break;
++
++ case 'f': /* fa (Fore ATM) */
++ if (!ifp->ifSpeed)
++ ifp->ifSpeed = 155000000;
++ ifp->ifType = 37;
++ break;
++
++ case 'q': /* qe (QuadEther)/qa (Fore ATM)/qfe (QuadFastEther) */
++ if (name[1] == 'a') {
++ if (!ifp->ifSpeed)
++ ifp->ifSpeed = 155000000;
++ ifp->ifType = 37;
++ } else if (name[1] == 'e') {
++ if (!ifp->ifSpeed)
++ ifp->ifSpeed = 10000000;
++ ifp->ifType = 6;
++ } else if (name[1] == 'f') {
++ if (!ifp->ifSpeed)
++ ifp->ifSpeed = 100000000;
++ ifp->ifType = 6;
++ }
++ break;
++
++ case 'i': /* ibd (Infiniband)/ip.tun (IP tunnel) */
++ if (name[1] == 'b')
++ ifp->ifType = 199;
++ else if (name[1] == 'p')
++ ifp->ifType = 131;
++ break;
+ }
+- break;
+-
+- case 'i': /* ibd (Infiniband)/ip.tun (IP tunnel) */
+- if (name[1] == 'b')
+- ifp->ifType = 199;
+- else if (name[1] == 'p')
+- ifp->ifType = 131;
+- break;
+ }
+ }
+
+@@ -1491,68 +1524,69 @@
+ }
+
+ /*
+- * Obtain the physical address using DLPI. Pieces of this code is directly
+- * taken from libdlpi, which unfortunately is not yet commonly available.
++ * Open a DLPI device.
++ *
++ * On success the file descriptor is returned.
++ * On error -1 is returned.
+ */
+-
+-static int
+-get_phys_address(mib2_ifEntry_t *ifp)
++static int
++_dlpi_open(const char *devname)
+ {
+- char *devstr;
+- int fd;
+- int ppa = -1;
+- int rc = -1;
++ char *devstr;
++ int fd = -1;
++ int ppa = -1;
+
+- DEBUGMSGTL(("kernel_sunos5", "get_phys_address called\n"));
++ DEBUGMSGTL(("kernel_sunos5", "_dlpi_open called\n"));
+
+- if ((devstr = malloc(5 + ifp->ifDescr.o_length + 1)) == NULL)
++ if (devname == NULL)
+ return (-1);
+- (void) sprintf(devstr, "/dev/%s", ifp->ifDescr.o_bytes);
++
++ if ((devstr = malloc(5 + strlen(devname) + 1)) == NULL)
++ return (-1);
++ (void) sprintf(devstr, "/dev/%s", devname);
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "devstr(%s)\n", devstr));
+ /*
+ * First try opening the device using style 1, if the device does not
+ * exist we try style 2. Modules will not be pushed, so something like
+ * ip tunnels will not work.
+ */
+- if ((fd = open(devstr, O_RDWR | O_NONBLOCK)) != -1) {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open(%s)\n", devstr));
+- rc = _dlpi_phys_address(fd, ifp->ifPhysAddress.o_bytes,
+- sizeof(ifp->ifPhysAddress.o_bytes),
+- &ifp->ifPhysAddress.o_length);
+- } else if (_dlpi_parse_devname(devstr, &ppa) == 0) {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 parse: %s, %d\n",
+- devstr, ppa));
+- /* try style 2 */
+- if ((fd = open(devstr, O_RDWR | O_NONBLOCK)) != -1) {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 open(%s)\n", devstr));
+- if (_dlpi_attach(fd, ppa) == 0) {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "attached\n"));
+- rc = _dlpi_phys_address(fd, ifp->ifPhysAddress.o_bytes,
+- sizeof(ifp->ifPhysAddress.o_bytes),
+- &ifp->ifPhysAddress.o_length);
+- }
+- }
+- }
++
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open(%s)\n", devstr));
++ if ((fd = open(devstr, O_RDWR | O_NONBLOCK)) < 0) {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open failed\n"));
++ if (_dlpi_parse_devname(devstr, &ppa) == 0) {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 parse: %s, %d\n",
++ devstr, ppa));
++ /* try style 2 */
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 open(%s)\n", devstr));
+
+- free(devstr);
+- if (fd != -1)
+- close(fd);
++ if ((fd = open(devstr, O_RDWR | O_NONBLOCK)) != -1) {
++ if (_dlpi_attach(fd, ppa) == 0) {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "attached\n"));
++ } else {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "attached failed\n"));
++ close(fd);
++ fd = -1;
++ }
++ } else {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 open failed\n"));
++ }
++ }
++ } else {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open succeeded\n"));
++ }
+
+- if (rc == 0) {
+- /* successful */
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "got phys addr using DLPI\n"));
+- return (0);
+- } else {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "unable to get phys address\n"));
+- return (-1);
+- }
++ /* clean up */
++ free(devstr);
++
++ return (fd);
+ }
+
+ /*
+- *
++ * Obtain the physical address of the interface using DLPI
+ */
+ static int
+-_dlpi_phys_address(int fd, char *addr, int maxlen, int *addrlen)
++_dlpi_get_phys_address(int fd, char *addr, int maxlen, int *addrlen)
+ {
+ dl_phys_addr_req_t paddr_req;
+ union DL_primitives *dlp;
+@@ -1560,6 +1594,8 @@
+ char buf[MAX(DL_PHYS_ADDR_ACK_SIZE+64, DL_ERROR_ACK_SIZE)];
+ int flag = 0;
+
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "_dlpi_get_phys_address\n"));
++
+ paddr_req.dl_primitive = DL_PHYS_ADDR_REQ;
+ paddr_req.dl_addr_type = DL_CURR_PHYS_ADDR;
+ ctlbuf.buf = (char *)&paddr_req;
+@@ -1570,7 +1606,7 @@
+ ctlbuf.maxlen = sizeof(buf);
+ ctlbuf.len = 0;
+ ctlbuf.buf = buf;
+- if (getmsg(fd, &ctlbuf, NULL, &flag) != 0)
++ if (getmsg(fd, &ctlbuf, NULL, &flag) < 0)
+ return (-1);
+
+ if (ctlbuf.len < sizeof(uint32_t))
+@@ -1580,6 +1616,7 @@
+ case DL_PHYS_ADDR_ACK: {
+ dl_phys_addr_ack_t *phyp = (dl_phys_addr_ack_t *)buf;
+
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "got ACK\n"));
+ if (ctlbuf.len < DL_PHYS_ADDR_ACK_SIZE || phyp->dl_addr_length > maxlen)
+ return (-1);
+ (void) memcpy(addr, buf+phyp->dl_addr_offset, phyp->dl_addr_length);
+@@ -1589,16 +1626,137 @@
+ case DL_ERROR_ACK: {
+ dl_error_ack_t *errp = (dl_error_ack_t *)buf;
+
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "got ERROR ACK\n"));
+ if (ctlbuf.len < DL_ERROR_ACK_SIZE)
+ return (-1);
+ return (errp->dl_errno);
+ }
+ default:
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "got type: %x\n", dlp->dl_primitive));
+ return (-1);
+ }
+ }
+
++/*
++ * Query the interface about it's type.
++ */
+ static int
++_dlpi_get_iftype(int fd, unsigned int *iftype)
++{
++ dl_info_req_t info_req;
++ union DL_primitives *dlp;
++ struct strbuf ctlbuf;
++ char buf[MAX(DL_INFO_ACK_SIZE, DL_ERROR_ACK_SIZE)];
++ int flag = 0;
++
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "_dlpi_get_iftype\n"));
++
++ info_req.dl_primitive = DL_INFO_REQ;
++ ctlbuf.buf = (char *)&info_req;
++ ctlbuf.len = DL_INFO_REQ_SIZE;
++ if (putmsg(fd, &ctlbuf, NULL, 0) < 0) {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "putmsg failed: %d\nn", errno));
++ return (-1);
++ }
++
++ ctlbuf.maxlen = sizeof(buf);
++ ctlbuf.len = 0;
++ ctlbuf.buf = buf;
++ if (getmsg(fd, &ctlbuf, NULL, &flag) < 0) {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "getmsg failed: %d\n", errno));
++ return (-1);
++ }
++
++ if (ctlbuf.len < sizeof(uint32_t))
++ return (-1);
++ dlp = (union DL_primitives *)buf;
++ switch (dlp->dl_primitive) {
++ case DL_INFO_ACK: {
++ dl_info_ack_t *info = (dl_info_ack_t *)buf;
++
++ if (ctlbuf.len < DL_INFO_ACK_SIZE)
++ return (-1);
++
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "dl_mac_type: %x\n",
++ info->dl_mac_type));
++ switch (info->dl_mac_type) {
++ case DL_CSMACD:
++ case DL_ETHER:
++ case DL_ETH_CSMA:
++ *iftype = 6;
++ break;
++ case DL_TPB: /* Token Passing Bus */
++ *iftype = 8;
++ break;
++ case DL_TPR: /* Token Passing Ring */
++ *iftype = 9;
++ break;
++ case DL_HDLC:
++ *iftype = 118;
++ break;
++ case DL_FDDI:
++ *iftype = 15;
++ break;
++ case DL_FC: /* Fibre channel */
++ *iftype = 56;
++ break;
++ case DL_ATM:
++ *iftype = 37;
++ break;
++ case DL_X25:
++ case DL_ISDN:
++ *iftype = 63;
++ break;
++ case DL_HIPPI:
++ *iftype = 47;
++ break;
++#ifdef DL_IB
++ case DL_IB:
++ *iftype = 199;
++ break;
++#endif
++ case DL_FRAME: /* Frame Relay */
++ *iftype = 32;
++ break;
++ case DL_LOOP:
++ *iftype = 24;
++ break;
++#ifdef DL_WIFI
++ case DL_WIFI:
++ *iftype = 71;
++ break;
++#endif
++#ifdef DL_IPV4 /* then IPv6 is also defined */
++ case DL_IPV4: /* IPv4 Tunnel */
++ case DL_IPV6: /* IPv6 Tunnel */
++ *iftype = 131;
++ break;
++#endif
++ default:
++ *iftype = 1; /* Other */
++ break;
++ }
++
++ return (0);
++ }
++ case DL_ERROR_ACK: {
++ dl_error_ack_t *errp = (dl_error_ack_t *)buf;
++
++ DEBUGMSGTL(("kernel_sunos5:dlpi",
++ "got DL_ERROR_ACK: dlpi %d, error %d\n", errp->dl_errno,
++ errp->dl_unix_errno));
++
++ if (ctlbuf.len < DL_ERROR_ACK_SIZE)
++ return (-1);
++ return (errp->dl_errno);
++ }
++ default:
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "got type %x\n", dlp->dl_primitive));
++ return (-1);
++ }
++}
++
++static int
+ _dlpi_attach(int fd, int ppa)
+ {
+ dl_attach_req_t attach_req;
+@@ -1680,8 +1838,83 @@
+ } else {
+ return 1;
+ }
+-}
++}
+
++/*
++ * Try to determine the index of a particular interface. If mfd-rewrites is
++ * specified, then this function would only be used when the system does not
++ * have if_nametoindex(3SOCKET).
++ */
++int
++solaris2_if_nametoindex(const char *Name, int Len)
++{
++ int i, sd, lastlen = 0, interfaces = 0;
++ struct ifconf ifc;
++ struct ifreq *ifrp = NULL;
++ char *buf = NULL;
++
++ if (Name == 0) {
++ return 0;
++ }
++ if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
++ return 0;
++ }
++
++ /*
++ * Cope with lots of interfaces and brokenness of ioctl SIOCGIFCONF
++ * on some platforms; see W. R. Stevens, ``Unix Network Programming
++ * Volume I'', p.435.
++ */
++
++ for (i = 8;; i += 8) {
++ buf = calloc(i, sizeof(struct ifreq));
++ if (buf == NULL) {
++ close(sd);
++ return 0;
++ }
++ ifc.ifc_len = i * sizeof(struct ifreq);
++ ifc.ifc_buf = (caddr_t) buf;
++
++ if (ioctl(sd, SIOCGIFCONF, (char *) &ifc) < 0) {
++ if (errno != EINVAL || lastlen != 0) {
++ /*
++ * Something has gone genuinely wrong.
++ */
++ free(buf);
++ close(sd);
++ return 0;
++ }
++ /*
++ * Otherwise, it could just be that the buffer is too small.
++ */
++ } else {
++ if (ifc.ifc_len == lastlen) {
++ /*
++ * The length is the same as the last time; we're done.
++ */
++ break;
++ }
++ lastlen = ifc.ifc_len;
++ }
++ free(buf);
++ }
++
++ ifrp = ifc.ifc_req;
++ interfaces = (ifc.ifc_len / sizeof(struct ifreq)) + 1;
++
++ for (i = 1; i < interfaces; i++, ifrp++) {
++ if (strncmp(ifrp->ifr_name, Name, Len) == 0) {
++ free(buf);
++ close(sd);
++ return i;
++ }
++ }
++
++ free(buf);
++ close(sd);
++ return 0;
++}
++
+ #ifdef _STDC_COMPAT
+ #ifdef __cplusplus
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/006.16742.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,625 @@
+Index: net-snmp/agent/mibgroup/kernel_sunos5.c
+===================================================================
+--- net-snmp/agent/mibgroup/kernel_sunos5.c (revision 16741)
++++ net-snmp/agent/mibgroup/kernel_sunos5.c (revision 16742)
+@@ -173,12 +173,14 @@
+ int mtu);
+ static int get_if_stats(mib2_ifEntry_t *ifp);
+
++#if defined(HAVE_IF_NAMEINDEX) && defined(NETSNMP_INCLUDE_IFTABLE_REWRITES)
+ static int _dlpi_open(const char *devname);
+ static int _dlpi_get_phys_address(int fd, char *paddr, int maxlen,
+ int *paddrlen);
+ static int _dlpi_get_iftype(int fd, unsigned int *iftype);
+ static int _dlpi_attach(int fd, int ppa);
+ static int _dlpi_parse_devname(char *devname, int *ppap);
++#endif
+
+
+
+@@ -1044,8 +1046,300 @@
+ * Get info for interfaces group. Mimics getmib interface as much as possible
+ * to be substituted later if SunSoft decides to extend its mib2 interface.
+ */
++
+ #if defined(HAVE_IF_NAMEINDEX) && defined(NETSNMP_INCLUDE_IFTABLE_REWRITES)
++
++/*
++ * If IFTABLE_REWRITES is enabled, then we will also rely on DLPI to obtain
++ * information from the NIC.
++ */
++
++/*
++ * Open a DLPI device.
++ *
++ * On success the file descriptor is returned.
++ * On error -1 is returned.
++ */
+ static int
++_dlpi_open(const char *devname)
++{
++ char *devstr;
++ int fd = -1;
++ int ppa = -1;
++
++ DEBUGMSGTL(("kernel_sunos5", "_dlpi_open called\n"));
++
++ if (devname == NULL)
++ return (-1);
++
++ if ((devstr = malloc(5 + strlen(devname) + 1)) == NULL)
++ return (-1);
++ (void) sprintf(devstr, "/dev/%s", devname);
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "devstr(%s)\n", devstr));
++ /*
++ * First try opening the device using style 1, if the device does not
++ * exist we try style 2. Modules will not be pushed, so something like
++ * ip tunnels will not work.
++ */
++
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open(%s)\n", devstr));
++ if ((fd = open(devstr, O_RDWR | O_NONBLOCK)) < 0) {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open failed\n"));
++ if (_dlpi_parse_devname(devstr, &ppa) == 0) {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 parse: %s, %d\n",
++ devstr, ppa));
++ /* try style 2 */
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 open(%s)\n", devstr));
++
++ if ((fd = open(devstr, O_RDWR | O_NONBLOCK)) != -1) {
++ if (_dlpi_attach(fd, ppa) == 0) {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "attached\n"));
++ } else {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "attached failed\n"));
++ close(fd);
++ fd = -1;
++ }
++ } else {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 open failed\n"));
++ }
++ }
++ } else {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open succeeded\n"));
++ }
++
++ /* clean up */
++ free(devstr);
++
++ return (fd);
++}
++
++/*
++ * Obtain the physical address of the interface using DLPI
++ */
++static int
++_dlpi_get_phys_address(int fd, char *addr, int maxlen, int *addrlen)
++{
++ dl_phys_addr_req_t paddr_req;
++ union DL_primitives *dlp;
++ struct strbuf ctlbuf;
++ char buf[MAX(DL_PHYS_ADDR_ACK_SIZE+64, DL_ERROR_ACK_SIZE)];
++ int flag = 0;
++
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "_dlpi_get_phys_address\n"));
++
++ paddr_req.dl_primitive = DL_PHYS_ADDR_REQ;
++ paddr_req.dl_addr_type = DL_CURR_PHYS_ADDR;
++ ctlbuf.buf = (char *)&paddr_req;
++ ctlbuf.len = DL_PHYS_ADDR_REQ_SIZE;
++ if (putmsg(fd, &ctlbuf, NULL, 0) < 0)
++ return (-1);
++
++ ctlbuf.maxlen = sizeof(buf);
++ ctlbuf.len = 0;
++ ctlbuf.buf = buf;
++ if (getmsg(fd, &ctlbuf, NULL, &flag) < 0)
++ return (-1);
++
++ if (ctlbuf.len < sizeof(uint32_t))
++ return (-1);
++ dlp = (union DL_primitives *)buf;
++ switch (dlp->dl_primitive) {
++ case DL_PHYS_ADDR_ACK: {
++ dl_phys_addr_ack_t *phyp = (dl_phys_addr_ack_t *)buf;
++
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "got ACK\n"));
++ if (ctlbuf.len < DL_PHYS_ADDR_ACK_SIZE || phyp->dl_addr_length > maxlen)
++ return (-1);
++ (void) memcpy(addr, buf+phyp->dl_addr_offset, phyp->dl_addr_length);
++ *addrlen = phyp->dl_addr_length;
++ return (0);
++ }
++ case DL_ERROR_ACK: {
++ dl_error_ack_t *errp = (dl_error_ack_t *)buf;
++
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "got ERROR ACK\n"));
++ if (ctlbuf.len < DL_ERROR_ACK_SIZE)
++ return (-1);
++ return (errp->dl_errno);
++ }
++ default:
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "got type: %x\n", dlp->dl_primitive));
++ return (-1);
++ }
++}
++
++/*
++ * Query the interface about it's type.
++ */
++static int
++_dlpi_get_iftype(int fd, unsigned int *iftype)
++{
++ dl_info_req_t info_req;
++ union DL_primitives *dlp;
++ struct strbuf ctlbuf;
++ char buf[MAX(DL_INFO_ACK_SIZE, DL_ERROR_ACK_SIZE)];
++ int flag = 0;
++
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "_dlpi_get_iftype\n"));
++
++ info_req.dl_primitive = DL_INFO_REQ;
++ ctlbuf.buf = (char *)&info_req;
++ ctlbuf.len = DL_INFO_REQ_SIZE;
++ if (putmsg(fd, &ctlbuf, NULL, 0) < 0) {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "putmsg failed: %d\nn", errno));
++ return (-1);
++ }
++
++ ctlbuf.maxlen = sizeof(buf);
++ ctlbuf.len = 0;
++ ctlbuf.buf = buf;
++ if (getmsg(fd, &ctlbuf, NULL, &flag) < 0) {
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "getmsg failed: %d\n", errno));
++ return (-1);
++ }
++
++ if (ctlbuf.len < sizeof(uint32_t))
++ return (-1);
++ dlp = (union DL_primitives *)buf;
++ switch (dlp->dl_primitive) {
++ case DL_INFO_ACK: {
++ dl_info_ack_t *info = (dl_info_ack_t *)buf;
++
++ if (ctlbuf.len < DL_INFO_ACK_SIZE)
++ return (-1);
++
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "dl_mac_type: %x\n",
++ info->dl_mac_type));
++ switch (info->dl_mac_type) {
++ case DL_CSMACD:
++ case DL_ETHER:
++ case DL_ETH_CSMA:
++ *iftype = 6;
++ break;
++ case DL_TPB: /* Token Passing Bus */
++ *iftype = 8;
++ break;
++ case DL_TPR: /* Token Passing Ring */
++ *iftype = 9;
++ break;
++ case DL_HDLC:
++ *iftype = 118;
++ break;
++ case DL_FDDI:
++ *iftype = 15;
++ break;
++ case DL_FC: /* Fibre channel */
++ *iftype = 56;
++ break;
++ case DL_ATM:
++ *iftype = 37;
++ break;
++ case DL_X25:
++ case DL_ISDN:
++ *iftype = 63;
++ break;
++ case DL_HIPPI:
++ *iftype = 47;
++ break;
++#ifdef DL_IB
++ case DL_IB:
++ *iftype = 199;
++ break;
++#endif
++ case DL_FRAME: /* Frame Relay */
++ *iftype = 32;
++ break;
++ case DL_LOOP:
++ *iftype = 24;
++ break;
++#ifdef DL_WIFI
++ case DL_WIFI:
++ *iftype = 71;
++ break;
++#endif
++#ifdef DL_IPV4 /* then IPv6 is also defined */
++ case DL_IPV4: /* IPv4 Tunnel */
++ case DL_IPV6: /* IPv6 Tunnel */
++ *iftype = 131;
++ break;
++#endif
++ default:
++ *iftype = 1; /* Other */
++ break;
++ }
++
++ return (0);
++ }
++ case DL_ERROR_ACK: {
++ dl_error_ack_t *errp = (dl_error_ack_t *)buf;
++
++ DEBUGMSGTL(("kernel_sunos5:dlpi",
++ "got DL_ERROR_ACK: dlpi %d, error %d\n", errp->dl_errno,
++ errp->dl_unix_errno));
++
++ if (ctlbuf.len < DL_ERROR_ACK_SIZE)
++ return (-1);
++ return (errp->dl_errno);
++ }
++ default:
++ DEBUGMSGTL(("kernel_sunos5:dlpi", "got type %x\n", dlp->dl_primitive));
++ return (-1);
++ }
++}
++
++static int
++_dlpi_attach(int fd, int ppa)
++{
++ dl_attach_req_t attach_req;
++ struct strbuf ctlbuf;
++ union DL_primitives *dlp;
++ char buf[MAX(DL_OK_ACK_SIZE, DL_ERROR_ACK_SIZE)];
++ int flag = 0;
++
++ attach_req.dl_primitive = DL_ATTACH_REQ;
++ attach_req.dl_ppa = ppa;
++ ctlbuf.buf = (char *)&attach_req;
++ ctlbuf.len = DL_ATTACH_REQ_SIZE;
++ if (putmsg(fd, &ctlbuf, NULL, 0) != 0)
++ return (-1);
++
++ ctlbuf.buf = buf;
++ ctlbuf.len = 0;
++ ctlbuf.maxlen = sizeof(buf);
++ if (getmsg(fd, &ctlbuf, NULL, &flag) != 0)
++ return (-1);
++
++ if (ctlbuf.len < sizeof(uint32_t))
++ return (-1);
++
++ dlp = (union DL_primitives *)buf;
++ if (dlp->dl_primitive == DL_OK_ACK && ctlbuf.len >= DL_OK_ACK_SIZE)
++ return (0);
++ return (-1);
++}
++
++static int
++_dlpi_parse_devname(char *devname, int *ppap)
++{
++ int ppa = 0;
++ int m = 1;
++ int i = strlen(devname) - 1;
++
++ while (i >= 0 && isdigit(devname[i])) {
++ ppa += m * (devname[i] - '0');
++ m *= 10;
++ i--;
++ }
++
++ if (m == 1) {
++ return (-1);
++ }
++ *ppap = ppa;
++ devname[i + 1] = '\0';
++
++ return (0);
++}
++static int
+ getif(mib2_ifEntry_t *ifbuf, size_t size, req_e req_type,
+ mib2_ifEntry_t *resp, size_t *length, int (*comp)(void *, void *),
+ void *arg)
+@@ -1229,7 +1523,8 @@
+
+ if (ioctl(ifsd, SIOCGIFFLAGS, ifrp) < 0) {
+ ret = -1;
+- snmp_log(LOG_ERR, "SIOCGIFFLAGS %s: %s\n", ifrp->ifr_name, strerror(errno));
++ snmp_log(LOG_ERR, "SIOCGIFFLAGS %s: %s\n", ifrp->ifr_name,
++ strerror(errno));
+ goto Return;
+ }
+ if_flags = ifrp->ifr_flags;
+@@ -1522,294 +1817,7 @@
+ ifp->ifHCOutMulticastPkts);
+ return(0);
+ }
+-
+ /*
+- * Open a DLPI device.
+- *
+- * On success the file descriptor is returned.
+- * On error -1 is returned.
+- */
+-static int
+-_dlpi_open(const char *devname)
+-{
+- char *devstr;
+- int fd = -1;
+- int ppa = -1;
+-
+- DEBUGMSGTL(("kernel_sunos5", "_dlpi_open called\n"));
+-
+- if (devname == NULL)
+- return (-1);
+-
+- if ((devstr = malloc(5 + strlen(devname) + 1)) == NULL)
+- return (-1);
+- (void) sprintf(devstr, "/dev/%s", devname);
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "devstr(%s)\n", devstr));
+- /*
+- * First try opening the device using style 1, if the device does not
+- * exist we try style 2. Modules will not be pushed, so something like
+- * ip tunnels will not work.
+- */
+-
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open(%s)\n", devstr));
+- if ((fd = open(devstr, O_RDWR | O_NONBLOCK)) < 0) {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open failed\n"));
+- if (_dlpi_parse_devname(devstr, &ppa) == 0) {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 parse: %s, %d\n",
+- devstr, ppa));
+- /* try style 2 */
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 open(%s)\n", devstr));
+-
+- if ((fd = open(devstr, O_RDWR | O_NONBLOCK)) != -1) {
+- if (_dlpi_attach(fd, ppa) == 0) {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "attached\n"));
+- } else {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "attached failed\n"));
+- close(fd);
+- fd = -1;
+- }
+- } else {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 open failed\n"));
+- }
+- }
+- } else {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open succeeded\n"));
+- }
+-
+- /* clean up */
+- free(devstr);
+-
+- return (fd);
+-}
+-
+-/*
+- * Obtain the physical address of the interface using DLPI
+- */
+-static int
+-_dlpi_get_phys_address(int fd, char *addr, int maxlen, int *addrlen)
+-{
+- dl_phys_addr_req_t paddr_req;
+- union DL_primitives *dlp;
+- struct strbuf ctlbuf;
+- char buf[MAX(DL_PHYS_ADDR_ACK_SIZE+64, DL_ERROR_ACK_SIZE)];
+- int flag = 0;
+-
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "_dlpi_get_phys_address\n"));
+-
+- paddr_req.dl_primitive = DL_PHYS_ADDR_REQ;
+- paddr_req.dl_addr_type = DL_CURR_PHYS_ADDR;
+- ctlbuf.buf = (char *)&paddr_req;
+- ctlbuf.len = DL_PHYS_ADDR_REQ_SIZE;
+- if (putmsg(fd, &ctlbuf, NULL, 0) < 0)
+- return (-1);
+-
+- ctlbuf.maxlen = sizeof(buf);
+- ctlbuf.len = 0;
+- ctlbuf.buf = buf;
+- if (getmsg(fd, &ctlbuf, NULL, &flag) < 0)
+- return (-1);
+-
+- if (ctlbuf.len < sizeof(uint32_t))
+- return (-1);
+- dlp = (union DL_primitives *)buf;
+- switch (dlp->dl_primitive) {
+- case DL_PHYS_ADDR_ACK: {
+- dl_phys_addr_ack_t *phyp = (dl_phys_addr_ack_t *)buf;
+-
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "got ACK\n"));
+- if (ctlbuf.len < DL_PHYS_ADDR_ACK_SIZE || phyp->dl_addr_length > maxlen)
+- return (-1);
+- (void) memcpy(addr, buf+phyp->dl_addr_offset, phyp->dl_addr_length);
+- *addrlen = phyp->dl_addr_length;
+- return (0);
+- }
+- case DL_ERROR_ACK: {
+- dl_error_ack_t *errp = (dl_error_ack_t *)buf;
+-
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "got ERROR ACK\n"));
+- if (ctlbuf.len < DL_ERROR_ACK_SIZE)
+- return (-1);
+- return (errp->dl_errno);
+- }
+- default:
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "got type: %x\n", dlp->dl_primitive));
+- return (-1);
+- }
+-}
+-
+-/*
+- * Query the interface about it's type.
+- */
+-static int
+-_dlpi_get_iftype(int fd, unsigned int *iftype)
+-{
+- dl_info_req_t info_req;
+- union DL_primitives *dlp;
+- struct strbuf ctlbuf;
+- char buf[MAX(DL_INFO_ACK_SIZE, DL_ERROR_ACK_SIZE)];
+- int flag = 0;
+-
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "_dlpi_get_iftype\n"));
+-
+- info_req.dl_primitive = DL_INFO_REQ;
+- ctlbuf.buf = (char *)&info_req;
+- ctlbuf.len = DL_INFO_REQ_SIZE;
+- if (putmsg(fd, &ctlbuf, NULL, 0) < 0) {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "putmsg failed: %d\nn", errno));
+- return (-1);
+- }
+-
+- ctlbuf.maxlen = sizeof(buf);
+- ctlbuf.len = 0;
+- ctlbuf.buf = buf;
+- if (getmsg(fd, &ctlbuf, NULL, &flag) < 0) {
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "getmsg failed: %d\n", errno));
+- return (-1);
+- }
+-
+- if (ctlbuf.len < sizeof(uint32_t))
+- return (-1);
+- dlp = (union DL_primitives *)buf;
+- switch (dlp->dl_primitive) {
+- case DL_INFO_ACK: {
+- dl_info_ack_t *info = (dl_info_ack_t *)buf;
+-
+- if (ctlbuf.len < DL_INFO_ACK_SIZE)
+- return (-1);
+-
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "dl_mac_type: %x\n",
+- info->dl_mac_type));
+- switch (info->dl_mac_type) {
+- case DL_CSMACD:
+- case DL_ETHER:
+- case DL_ETH_CSMA:
+- *iftype = 6;
+- break;
+- case DL_TPB: /* Token Passing Bus */
+- *iftype = 8;
+- break;
+- case DL_TPR: /* Token Passing Ring */
+- *iftype = 9;
+- break;
+- case DL_HDLC:
+- *iftype = 118;
+- break;
+- case DL_FDDI:
+- *iftype = 15;
+- break;
+- case DL_FC: /* Fibre channel */
+- *iftype = 56;
+- break;
+- case DL_ATM:
+- *iftype = 37;
+- break;
+- case DL_X25:
+- case DL_ISDN:
+- *iftype = 63;
+- break;
+- case DL_HIPPI:
+- *iftype = 47;
+- break;
+-#ifdef DL_IB
+- case DL_IB:
+- *iftype = 199;
+- break;
+-#endif
+- case DL_FRAME: /* Frame Relay */
+- *iftype = 32;
+- break;
+- case DL_LOOP:
+- *iftype = 24;
+- break;
+-#ifdef DL_WIFI
+- case DL_WIFI:
+- *iftype = 71;
+- break;
+-#endif
+-#ifdef DL_IPV4 /* then IPv6 is also defined */
+- case DL_IPV4: /* IPv4 Tunnel */
+- case DL_IPV6: /* IPv6 Tunnel */
+- *iftype = 131;
+- break;
+-#endif
+- default:
+- *iftype = 1; /* Other */
+- break;
+- }
+-
+- return (0);
+- }
+- case DL_ERROR_ACK: {
+- dl_error_ack_t *errp = (dl_error_ack_t *)buf;
+-
+- DEBUGMSGTL(("kernel_sunos5:dlpi",
+- "got DL_ERROR_ACK: dlpi %d, error %d\n", errp->dl_errno,
+- errp->dl_unix_errno));
+-
+- if (ctlbuf.len < DL_ERROR_ACK_SIZE)
+- return (-1);
+- return (errp->dl_errno);
+- }
+- default:
+- DEBUGMSGTL(("kernel_sunos5:dlpi", "got type %x\n", dlp->dl_primitive));
+- return (-1);
+- }
+-}
+-
+-static int
+-_dlpi_attach(int fd, int ppa)
+-{
+- dl_attach_req_t attach_req;
+- struct strbuf ctlbuf;
+- union DL_primitives *dlp;
+- char buf[MAX(DL_OK_ACK_SIZE, DL_ERROR_ACK_SIZE)];
+- int flag = 0;
+-
+- attach_req.dl_primitive = DL_ATTACH_REQ;
+- attach_req.dl_ppa = ppa;
+- ctlbuf.buf = (char *)&attach_req;
+- ctlbuf.len = DL_ATTACH_REQ_SIZE;
+- if (putmsg(fd, &ctlbuf, NULL, 0) != 0)
+- return (-1);
+-
+- ctlbuf.buf = buf;
+- ctlbuf.len = 0;
+- ctlbuf.maxlen = sizeof(buf);
+- if (getmsg(fd, &ctlbuf, NULL, &flag) != 0)
+- return (-1);
+-
+- if (ctlbuf.len < sizeof(uint32_t))
+- return (-1);
+-
+- dlp = (union DL_primitives *)buf;
+- if (dlp->dl_primitive == DL_OK_ACK && ctlbuf.len >= DL_OK_ACK_SIZE)
+- return (0);
+- return (-1);
+-}
+-
+-static int
+-_dlpi_parse_devname(char *devname, int *ppap)
+-{
+- int ppa = 0;
+- int m = 1;
+- int i = strlen(devname) - 1;
+-
+- while (i >= 0 && isdigit(devname[i])) {
+- ppa += m * (devname[i] - '0');
+- m *= 10;
+- i--;
+- }
+-
+- if (m == 1) {
+- return (-1);
+- }
+- *ppap = ppa;
+- devname[i + 1] = '\0';
+-
+- return (0);
+-}
+-
+-/*
+ * Always TRUE. May be used as a comparison function in getMibstat
+ * to obtain the whole table (GET_FIRST should be used)
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/007.16863.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,13 @@
+Index: net-snmp/snmplib/asn1.c
+===================================================================
+--- net-snmp/snmplib/asn1.c (revision 16862)
++++ net-snmp/snmplib/asn1.c (revision 16863)
+@@ -2735,7 +2735,7 @@
+ }
+
+ CHECK_OVERFLOW_S(integer,10);
+- testvalue = (*intp < 0) ? -1 : 0;
++ testvalue = (integer < 0) ? -1 : 0;
+
+ if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
+ return 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/008.ip-mib.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,13 @@
+--- net-snmp-5.4.1/agent/mibgroup/mibII.h (revision 16428)
++++ net-snmp-5.4.1-patch/agent/mibgroup/mibII.h (working copy)
+@@ -30,3 +30,10 @@
+ #if defined( linux )
+ config_require(ip-mib ip-forward-mib tcp-mib udp-mib)
+ #endif
++
++/*
++ * For Solaris, enable additional tables.
++ */
++#if defined( solaris2 )
++config_require(ip-mib/ipSystemStatsTable ip-mib/ipAddressTable)
++#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/009.ltmain.sh.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,31 @@
+--- net-snmp-5.4.2.1/ltmain.sh Fri Jun 6 02:34:34 2008
++++ net-snmp-5.4.2.1/ltmain.mod.sh Tue Feb 3 11:02:05 2009
+@@ -1425,7 +1425,9 @@
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+- *) rpath="$rpath $arg" ;;
++ *) rpath="$rpath $arg"
++ # This is make sure only $libdir path is encoded in RUNPATH
++ sma_rpath="$rpath" ;;
+ esac
+ else
+ case "$xrpath " in
+@@ -3915,7 +3917,7 @@
+ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+- dep_rpath=
++ dep_rpath="-R $sma_rpath"
+ rpath="$finalize_rpath"
+ test "$mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+@@ -3935,7 +3937,7 @@
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+- dep_rpath="$dep_rpath $flag"
++ #dep_rpath="$dep_rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/010.if-mib-zone.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,90 @@
+--- net-snmp-5.4.1/agent/mibgroup/kernel_sunos5.c 2009-05-11 15:32:06.000000000 -0700
++++ net-snmp-5.4.1.fix/agent/mibgroup/kernel_sunos5.c 2009-05-11 16:47:40.637063871 -0700
+@@ -170,7 +170,7 @@
+ size_t *length, int (*comp)(void *, void *), void *arg);
+ static void
+ set_if_info(mib2_ifEntry_t *ifp, unsigned index, char *name, uint64_t flags,
+- int mtu);
++ boolean_t flags_unknown, int mtu);
+ static int get_if_stats(mib2_ifEntry_t *ifp);
+
+ #if defined(HAVE_IF_NAMEINDEX) && defined(NETSNMP_INCLUDE_IFTABLE_REWRITES)
+@@ -1332,8 +1332,9 @@
+ mib2_ifEntry_t *ifp;
+ int nentries = size / sizeof(mib2_ifEntry_t);
+ found_e result = NOT_FOUND;
+- boolean_t if_isv6;
++ boolean_t if_isv6, flags_unknown;
+ uint64_t if_flags;
++ short mtu = 0;
+ struct if_nameindex *ifname, *ifnp;
+
+ lifrp = &lifreq;
+@@ -1365,6 +1366,7 @@
+ memcpy(lifrp->lifr_name, ifnp->if_name, LIFNAMSIZ);
+ if_isv6 = B_FALSE;
+
++ flags_unknown = B_FALSE;
+ if (ioctl(ifsd, SIOCGLIFFLAGS, lifrp) < 0) {
+ if (ifsd6 == -1) {
+ if ((ifsd6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
+@@ -1373,17 +1375,19 @@
+ }
+ }
+ if (ioctl(ifsd6, SIOCGLIFFLAGS, lifrp) < 0) {
+- snmp_log(LOG_ERR, "SIOCGLIFFLAGS %s: %s\n",
+- lifrp->lifr_name, strerror(errno));
+- continue;
++ DEBUGMSGTL(("kernel_sunos5",
++ "...... SIOCGLIFFLAGS failed\n"));
++ flags_unknown = B_TRUE;
+ }
+ if_isv6 = B_TRUE;
+ }
+ if_flags = lifrp->lifr_flags;
+
+ if (ioctl(if_isv6?ifsd6:ifsd, SIOCGLIFMTU, lifrp) < 0) {
++ mtu = 0;
+ DEBUGMSGTL(("kernel_sunos5", "...... SIOCGLIFMTU failed\n"));
+- continue;
++ } else {
++ mtu = lifrp->lifr_mtu;
+ }
+
+ memset(ifp, 0, sizeof(mib2_ifEntry_t));
+@@ -1398,11 +1402,12 @@
+ }
+
+ set_if_info(ifp, ifnp->if_index, ifnp->if_name, if_flags,
+- lifrp->lifr_metric);
++ flags_unknown, mtu);
+
+ if (get_if_stats(ifp) < 0) {
++ snmp_log(LOG_ERR, "Failed to get interface statistics for %s\n",
++ ifnp->if_name);
+ DEBUGMSGTL(("kernel_sunos5", "...... get_if_stats failed\n"));
+- continue;
+ }
+
+ /*
+@@ -1581,7 +1586,7 @@
+
+ static void
+ set_if_info(mib2_ifEntry_t *ifp, unsigned index, char *name, uint64_t flags,
+- int mtu)
++ boolean_t flags_unknown, int mtu)
+ {
+ boolean_t havespeed = B_FALSE;
+
+@@ -1592,7 +1597,10 @@
+ ifp->ifDescr.o_length = strlen(name);
+ strcpy(ifp->ifDescr.o_bytes, name);
+ ifp->ifAdminStatus = (flags & IFF_UP) ? 1 : 2;
+- ifp->ifOperStatus = ((flags & IFF_UP) && (flags & IFF_RUNNING)) ? 1 : 2;
++ if (flags_unknown)
++ ifp->ifOperStatus = 4; /* status unknown */
++ else
++ ifp->ifOperStatus = ((flags & IFF_UP) && (flags & IFF_RUNNING)) ? 1 : 2;
+ ifp->ifLastChange = 0; /* Who knows ... */
+ ifp->flags = flags;
+ ifp->ifMtu = mtu;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/011.Makefile.in.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,70 @@
+Only in net-snmp-5.4.1.mod: .patches.011.Makefile.in.patch
+diff -ru net-snmp-5.4.1/agent/Makefile.in net-snmp-5.4.1.mod/agent/Makefile.in
+--- net-snmp-5.4.1/agent/Makefile.in 2007-07-05 04:56:56.000000000 +0530
++++ net-snmp-5.4.1.mod/agent/Makefile.in 2009-06-24 06:08:28.858891018 +0530
+@@ -120,8 +120,11 @@
+ OBJS = $(LIBAGENTOBJS) $(AGENTOBJS) mib_modules.o auto_nlist.o
+ LOBJS = $(LLIBAGENTOBJS) $(LAGENTOBJS) mib_modules.lo auto_nlist.lo
+
++LIB_LD_ADD_AGENT =-lnetsnmp -lnetsnmphelpers
++
++LIB_LD_ADD_PATH_MIBS =-Lhelpers -L../snmplib
+
+-all: agentlib subdirs miblib $(INSTALLBINPROGS) $(INSTALLSBINPROGS)
++all: agentlib subdirs miblib relinklib $(INSTALLBINPROGS) $(INSTALLSBINPROGS)
+
+ #
+ # build stuff targets
+@@ -152,6 +155,10 @@
+
+ agentlib: $(AGENTLIB)
+
++relinklib: ${LLIBAGENTOBJS} $(USELIBS)
++ $(LIB_LD_CMD) $(AGENTLIB) $(LIB_LD_ADD_PATH_MIBS) ${LLIBAGENTOBJS} $(USELIBS) ${LAGENTLIBS} $(LDFLAGS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) $(LIB_LD_ADD_AGENT)
++ $(RANLIB) $(AGENTLIB) $(LIB_LD_ADD_AGENT)
++
+ miblib: $(MIBLIB)
+
+ libs: $(INSTALLLIBS)
+Only in net-snmp-5.4.1.mod/agent: Makefile.in~
+diff -ru net-snmp-5.4.1/agent/helpers/Makefile.in net-snmp-5.4.1.mod/agent/helpers/Makefile.in
+--- net-snmp-5.4.1/agent/helpers/Makefile.in 2007-06-27 03:15:20.000000000 +0530
++++ net-snmp-5.4.1.mod/agent/helpers/Makefile.in 2009-06-24 06:01:35.912702710 +0530
+@@ -137,8 +137,11 @@
+ table_tdata.lo \
+ watcher.lo
+
++LIB_LD_ADD =-lnetsnmp
++LIB_LD_ADD_PATH =-L../../snmplib
++
+ all: standardall
+
+ libnetsnmphelpers.$(LIB_EXTENSION)$(LIB_VERSION): $(LOBJS)
+- $(LIB_LD_CMD) $@ $(LOBJS) $(AGENTLIB) $(NETSNMPLIB) $(LDFLAGS) $(LIB_LD_LIBS)
+- $(RANLIB) $@
++ $(LIB_LD_CMD) $@ $(LIB_LD_ADD_PATH) $(LOBJS) $(AGENTLIB) $(NETSNMPLIB) $(LDFLAGS) $(LIB_LD_LIBS) $(LIB_LD_ADD)
++ $(RANLIB) $@ $(LIB_LD_ADD)
+diff -ru net-snmp-5.4.1/snmplib/Makefile.in net-snmp-5.4.1.mod/snmplib/Makefile.in
+--- net-snmp-5.4.1/snmplib/Makefile.in 2007-06-19 03:04:43.000000000 +0530
++++ net-snmp-5.4.1.mod/snmplib/Makefile.in 2009-06-24 06:01:35.912972597 +0530
+@@ -181,6 +181,9 @@
+ # just in case someone wants to remove libtool, change this to OBJS.
+ TOBJS=$(LOBJS)
+
++# To satisfy -zdefs
++LIB_LD_ADD =-lnsl -lsocket -L$(libdir)
++
+ #
+ CPPFLAGS = $(TOP_INCLUDES) -I. $(SNMPLIB_INCLUDES) @CPPFLAGS@
+
+@@ -188,8 +191,8 @@
+
+ # how to build the libraries.
+ libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION): $(TOBJS)
+- $(LIB_LD_CMD) $@ $(TOBJS) $(LDFLAGS) @LNETSNMPLIBS@
+- $(RANLIB) $@
++ $(LIB_LD_CMD) $@ $(TOBJS) $(LDFLAGS) @LNETSNMPLIBS@ } $(LIB_LD_ADD)
++ $(RANLIB) $@ $(LIB_LD_ADD)
+
+ libsnmp.$(LIB_EXTENSION)$(LIB_VERSION): $(TOBJS)
+ $(LIB_LD_CMD) $@ $(TOBJS) $(LDFLAGS) @LNETSNMPLIBS@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/012.Makefile.PL.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,11 @@
+--- net-snmp-5.4.1/perl/agent/Makefile.PL Thu May 31 04:23:09 2007
++++ net-snmp-5.4.1.mod/perl/agent/Makefile.PL Tue Jul 7 06:34:37 2009
+@@ -90,7 +90,7 @@
+ $Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ -L../../agent/.libs -L../../agent/ -L../../agent/helpers/.libs -L../../agent/helpers/ " . $Params{'LIBS'};
+ $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
+ # } else {
+- $Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . $Params{'LIBS'};
++ $Params{'LIBS'} = $Params{'LIBS'} . `$opts->{'nsconfig'} --libdir`
+ # $Params{'PREREQ_PM'} = {'NetSNMP::OID' => '0.1'};
+ }
+ $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/013.6852099.proxy.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,29 @@
+--- net-snmp-5.4.1/agent/mibgroup/ucd-snmp/proxy.c Tue Oct 17 09:16:29 2006
++++ patch/net-snmp-5.4.1/agent/mibgroup/ucd-snmp/proxy.c Tue Sep 29 07:36:48 2009
+@@ -408,6 +408,8 @@
+ /*
+ * too large
+ */
++ if (pdu)
++ snmp_free_pdu(pdu);
+ snmp_log(LOG_ERR,
+ "proxy oid request length is too long\n");
+ return SNMP_ERR_NOERROR;
+@@ -437,6 +439,8 @@
+ */
+ if (!proxy_fill_in_session(handler, reqinfo, (void **)&configured)) {
+ netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
++ if (pdu)
++ snmp_free_pdu(pdu);
+ return SNMP_ERR_NOERROR;
+ }
+
+@@ -451,6 +455,8 @@
+
+ /* Free any special parameters generated on the session */
+ proxy_free_filled_in_session_args(sp->sess, (void **)&configured);
++ if (pdu)
++ snmp_free_pdu(pdu);
+
+ return SNMP_ERR_NOERROR;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/014.6801093.vmstat_solaris2.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,16 @@
+--- patch/net-snmp-5.4.1/agent/mibgroup/ucd-snmp/vmstat_solaris2.c Thu Sep 14 17:48:50 2006
++++ net-snmp-5.4.1/agent/mibgroup/ucd-snmp/vmstat_solaris2.c Tue Oct 6 02:03:44 2009
+@@ -525,6 +525,13 @@
+ DEBUGMSGTL(("ucd-snmp/vmstat_solaris2.c:update_stats",
+ "time_diff: %lld\n", time_diff));
+
++ /*
++ * Assign a minimum value to get around divide by zero case
++ */
++ if (time_diff == 0) {
++ time_diff = 1;
++ }
++
+ /*
+ * swapin and swapout are in pages, MIB wants kB/s,so we just need to get kB and seconds
+ * For the others we need to get value per second
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/015.6956251.vmstat_solaris2.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,16 @@
+--- patch/net-snmp-5.4.1/agent/mibgroup/ucd-snmp/vmstat_solaris2.c Tue Aug 3 06:04:52 2010
++++ net-snmp-5.4.1/agent/mibgroup/ucd-snmp/vmstat_solaris2.c Wed Oct 6 01:27:48 2010
+@@ -589,6 +589,13 @@
+ cpu_sum += (css_new->css_cpu[i] - css_old->css_cpu[i]);
+ }
+
++ /*
++ * Assign a minimum value to get around divide by zero case
++ */
++ if (cpu_sum == 0) {
++ cpu_sum = 1;
++ }
++
+ /*
+ * Now calculate the absolute percentage values
+ * Looks somewhat complicated sometimes but tries to get around using floats to increase speed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/016.6934478.vmstat_solaris2.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,72 @@
+--- patch/net-snmp-5.4.1/agent/mibgroup/ucd-snmp/vmstat_solaris2.c Tue Oct 12 07:37:07 2010
++++ net-snmp-5.4.1/agent/mibgroup/ucd-snmp/vmstat_solaris2.c Tue Oct 12 07:34:41 2010
+@@ -709,7 +709,12 @@
+ case CPUIDLE:
+ return ((u_char *) (&cpu_perc[CPU_IDLE]));
+ case CPURAWUSER:
+- take_snapshot(&raw_values);
++ /* Take the current snapshot */
++ if ((take_snapshot(&raw_values) == -1) && (raw_values.css_cpus == 0)) {
++ snmp_log(LOG_WARNING,
++ "vmstat_solaris2 (var_extensible_vmstat): Something went wrong with take_snapshot.\n");
++ return (NULL);
++ }
+ /*
+ * LINTED has to be 'long'
+ */
+@@ -723,7 +728,12 @@
+ * (Has been changed to Counter32 in the latest MIB version!)
+ */
+ case CPURAWSYSTEM:
+- take_snapshot(&raw_values);
++ /* Take the current snapshot */
++ if ((take_snapshot(&raw_values) == -1) && (raw_values.css_cpus == 0)) {
++ snmp_log(LOG_WARNING,
++ "vmstat_solaris2 (var_extensible_vmstat): Something went wrong with take_snapshot.\n");
++ return (NULL);
++ }
+ /*
+ * LINTED has to be 'long'
+ */
+@@ -732,7 +742,12 @@
+ raw_values.css_cpu[CPU_WAIT]) / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWIDLE:
+- take_snapshot(&raw_values);
++ /* Take the current snapshot */
++ if ((take_snapshot(&raw_values) == -1) && (raw_values.css_cpus == 0)) {
++ snmp_log(LOG_WARNING,
++ "vmstat_solaris2 (var_extensible_vmstat): Something went wrong with take_snapshot.\n");
++ return (NULL);
++ }
+ /*
+ * LINTED has to be 'long'
+ */
+@@ -740,7 +755,12 @@
+ (long) (raw_values.css_cpu[CPU_IDLE] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWWAIT:
+- take_snapshot(&raw_values);
++ /* Take the current snapshot */
++ if ((take_snapshot(&raw_values) == -1) && (raw_values.css_cpus == 0)) {
++ snmp_log(LOG_WARNING,
++ "vmstat_solaris2 (var_extensible_vmstat): Something went wrong with take_snapshot.\n");
++ return (NULL);
++ }
+ /*
+ * LINTED has to be 'long'
+ */
+@@ -748,7 +768,12 @@
+ (long) (raw_values.css_cpu[CPU_WAIT] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWKERNEL:
+- take_snapshot(&raw_values);
++ /* Take the current snapshot */
++ if ((take_snapshot(&raw_values) == -1) && (raw_values.css_cpus == 0)) {
++ snmp_log(LOG_WARNING,
++ "vmstat_solaris2 (var_extensible_vmstat): Something went wrong with take_snapshot.\n");
++ return (NULL);
++ }
+ /*
+ * LINTED has to be 'long'
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/017.6984919.kernel_sunos5.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,11 @@
+--- patch/net-snmp-5.4.1/agent/mibgroup/kernel_sunos5.c Tue Oct 12 06:55:48 2010
++++ net-snmp-5.4.1/agent/mibgroup/kernel_sunos5.c Tue Oct 12 07:03:49 2010
+@@ -82,7 +82,7 @@
+ static
+ mibcache Mibcache[MIBCACHE_SIZE+1] = {
+ {MIB_SYSTEM, 0, (void *) -1, 0, 0, 0, 0},
+- {MIB_INTERFACES, 10 * sizeof(mib2_ifEntry_t), (void *) -1, 0, 30, 0,
++ {MIB_INTERFACES, 50 * sizeof(mib2_ifEntry_t), (void *) -1, 0, 30, 0,
+ 0},
+ {MIB_AT, 0, (void *) -1, 0, 0, 0, 0},
+ {MIB_IP, sizeof(mib2_ip_t), (void *) -1, 0, 60, 0, 0},
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/018.6932608.systemstats_common.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,19 @@
+--- patch/net-snmp-5.4.1-64/agent/mibgroup/ip-mib/data_access/systemstats_common.c Tue Feb 8 13:58:36 2005
++++ net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/systemstats_common.c Mon Aug 2 05:21:15 2010
+@@ -339,7 +339,7 @@
+ */
+ if (0 == need_wrap_check) {
+ SNMP_FREE(prev_vals->old_stats);
+- }
++ } else {
+
+ /*
+ * update old stats from new stats.
+@@ -346,6 +346,7 @@
+ * careful - old_stats is a pointer to stats...
+ */
+ memcpy(prev_vals->old_stats, &new_vals->stats, sizeof(new_vals->stats));
++ }
+
+ return 0;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/019.6998845.container.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,314 @@
+--- net-snmp/include/net-snmp/library/container.h Mon Dec 5 00:13:04 2005
++++ net-snmp/include/net-snmp/library/container.h Fri Jan 14 17:35:37 2011
+@@ -31,8 +31,16 @@
+ struct netsnmp_container_s; /** forward declare */
+
+ /*
+- * function returning an int for an operation on a container
++ * function for performing an operation on a container which
++ * returns (maybe the same) container.
+ */
++
++ typedef struct netsnmp_container_s* (netsnmp_container_mod_op)
++ (struct netsnmp_container_s *, void *context, u_int flags);
++
++ /*
++ * function for setting an option on a container
++ */
+ typedef int (netsnmp_container_option)(struct netsnmp_container_s *,
+ int set, u_int flags);
+
+@@ -192,6 +200,14 @@
+ netsnmp_container_op *insert_filter;
+
+ /*
++ * OPTIONAL function to duplicate a container. Defaults to a shallow
++ * copy. Only the specified container is copied (i.e. sub-containers
++ * not included).
++ */
++
++ netsnmp_container_mod_op *duplicate;
++
++ /*
+ * function to compare two object stored in the container.
+ *
+ * Returns:
+@@ -219,11 +235,16 @@
+
+ /*
+ * sort count, for iterators to track (insert/delete
+- * bumps coutner, invalidates iterator
++ * bumps counter, invalidates iterator)
+ */
+ u_long sync;
+
+ /*
++ * flags
++ */
++ u_int flags;
++
++ /*
+ * containers can contain other containers (additional indexes)
+ */
+ struct netsnmp_container_s *next, *prev;
+@@ -288,15 +309,15 @@
+ #define CONTAINER_SET_OPTIONS(x,o,rc) do { \
+ if (NULL==(x)->options) \
+ rc = -1; \
+- else \
++ else { \
+ rc = (x)->options(x, 1, o); \
++ if (rc != -1 ) \
++ (x)->flags |= o; \
++ } \
+ } while(0)
+
+ #define CONTAINER_CHECK_OPTION(x,o,rc) do { \
+- if (NULL==(x)->options) \
+- rc = -1; \
+- else \
+- rc = (x)->options(x,0, o); \
++ rc = x->flags & 0; \
+ } while(0)
+
+
+@@ -335,6 +356,12 @@
+ int CONTAINER_REMOVE(netsnmp_container *x, const void *k);
+
+ /*
++ * duplicate container
++ */
++ netsnmp_container *CONTAINER_DUP(netsnmp_container *x, void *ctx,
++ u_int flags);
++
++ /*
+ * clear all containers. When clearing the *first* container, and
+ * *only* the first container, call the function f for each item.
+ * After calling this function, all containers should be empty.
+@@ -364,7 +391,7 @@
+ continue;
+ rc2 = x->insert(x,k);
+ if (rc2) {
+- snmp_log(LOG_ERR,"error on subcontainer '%s' insert (%d)\n",
++ snmp_log(LOG_DEBUG,"error on subcontainer '%s' insert (%d)\n",
+ x->container_name ? x->container_name : "", rc2);
+ rc = rc2;
+ }
+@@ -402,6 +429,22 @@
+ * container.c. If you change one, change them both.
+ */
+ NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
++ netsnmp_container *CONTAINER_DUP(netsnmp_container *x, void *ctx,
++ u_int flags)
++ {
++ if (NULL == x->duplicate) {
++ snmp_log(LOG_ERR, "container '%s' does not support duplicate\n",
++ x->container_name ? x->container_name : "");
++ return NULL;
++ }
++ return x->duplicate(x, ctx, flags);
++ }
++
++ /*------------------------------------------------------------------
++ * These functions should EXACTLY match the function version in
++ * container.c. If you change one, change them both.
++ */
++ NETSNMP_STATIC_INLINE /* gcc docs recommend static w/inline */
+ int CONTAINER_FREE(netsnmp_container *x)
+ {
+ int rc2, rc = 0;
+@@ -474,6 +517,10 @@
+ }
+
+ #endif
++
++ /** Duplicate container meta-data. */
++ int netsnmp_container_data_dup(netsnmp_container *dup,
++ netsnmp_container *c);
+
+ /*************************************************************************
+ *
+--- net-snmp/snmplib/container_binary_array.c Wed Aug 23 21:23:22 2006
++++ net-snmp/snmplib/container_binary_array.c Fri Jan 14 17:35:37 2011
+@@ -36,7 +36,6 @@
+ typedef struct binary_array_table_s {
+ size_t max_size; /* Size of the current data table */
+ size_t count; /* Index of the next free entry */
+- u_int flags; /* flags */
+ int dirty;
+ int data_size; /* Size of an individual entry */
+ void **data; /* The table itself */
+@@ -99,7 +98,7 @@
+ netsnmp_assert(t!=NULL);
+ netsnmp_assert(c->compare!=NULL);
+
+- if (t->flags & CONTAINER_KEY_UNSORTED)
++ if (c->flags & CONTAINER_KEY_UNSORTED)
+ return 0;
+
+ if (t->dirty) {
+@@ -204,11 +203,16 @@
+ int
+ netsnmp_binary_array_options_set(netsnmp_container *c, int set, u_int flags)
+ {
+- binary_array_table *t = (binary_array_table*)c->container_data;
+- if (set)
+- t->flags = flags;
++#define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
++
++ if (set) {
++ if ((flags & BA_FLAGS) == flags)
++ c->flags = flags;
++ else
++ flags = (u_int)-1; /* unsupported flag */
++ }
+ else
+- return ((t->flags & flags) == flags);
++ return ((c->flags & flags) == flags);
+ return flags;
+ }
+
+@@ -371,7 +375,7 @@
+ /*
+ * check for duplicates
+ */
+- if (! (t->flags & CONTAINER_KEY_ALLOW_DUPLICATES)) {
++ if (! (c->flags & CONTAINER_KEY_ALLOW_DUPLICATES)) {
+ new_data = netsnmp_binary_array_get(c, entry, 1);
+ if (NULL != new_data) {
+ DEBUGMSGTL(("container","not inserting duplicate key\n"));
+@@ -579,6 +583,56 @@
+ return va;
+ }
+
++static netsnmp_container *
++_ba_duplicate(netsnmp_container *c, void *ctx, u_int flags)
++{
++ netsnmp_container *dup;
++ binary_array_table *dupt, *t;
++
++ if (flags) {
++ snmp_log(LOG_ERR, "binary arry duplicate does not supprt flags yet\n");
++ return NULL;
++ }
++
++ dup = netsnmp_container_get_binary_array();
++ if (NULL == dup) {
++ snmp_log(LOG_ERR," no memory for binary array duplicate\n");
++ return NULL;
++ }
++ /*
++ * deal with container stuff
++ */
++ if (netsnmp_container_data_dup(dup, c) != 0) {
++ netsnmp_binary_array_release(dup);
++ return NULL;
++ }
++
++ /*
++ * deal with data
++ */
++ dupt = (binary_array_table*)dup->container_data;
++ t = (binary_array_table*)c->container_data;
++
++ dupt->max_size = t->max_size;
++ dupt->count = t->count;
++ dupt->dirty = t->dirty;
++ dupt->data_size = t->data_size;
++
++ /*
++ * shallow copy
++ */
++ dupt->data = (void**) calloc(dupt->max_size, dupt->data_size);
++ if (NULL == dupt->data) {
++ snmp_log(LOG_ERR, "no memory for binary array duplicate\n");
++ netsnmp_binary_array_release(dup);
++ return NULL;
++ }
++
++ memcpy(dupt->data, t->data, dupt->max_size * dupt->data_size);
++
++ return dup;
++}
++
+ netsnmp_container *
+ netsnmp_container_get_binary_array(void)
+ {
+@@ -592,7 +646,11 @@
+ }
+
+ c->container_data = netsnmp_binary_array_initialize();
+-
++
++ /*
++ * NOTE: CHANGES HERE MUST BE DUPLICATED IN duplicate AS WELL!!
++ */
++
+ c->get_size = _ba_size;
+ c->init = NULL;
+ c->cfree = _ba_free;
+@@ -604,6 +662,7 @@
+ c->get_iterator = _ba_iterator_get;
+ c->for_each = _ba_for_each;
+ c->clear = _ba_clear;
++ c->duplicate = _ba_duplicate;
+
+ return c;
+ }
+--- net-snmp/snmplib/container.c Fri Aug 25 15:11:06 2006
++++ net-snmp/snmplib/container.c Fri Jan 14 17:35:37 2011
+@@ -278,7 +278,7 @@
+ continue;
+ rc2 = x->insert(x,k);
+ if (rc2) {
+- snmp_log(LOG_ERR,"error on subcontainer '%s' insert (%d)\n",
++ snmp_log(LOG_DEBUG,"error on subcontainer '%s' insert (%d)\n",
+ x->container_name ? x->container_name : "", rc2);
+ rc = rc2;
+ }
+@@ -311,6 +311,20 @@
+ }
+
+ /*------------------------------------------------------------------
++ * These functions should EXACTLY match the function version in
++ * container.c. If you change one, change them both.
++ */
++netsnmp_container *CONTAINER_DUP(netsnmp_container *x, void *ctx, u_int flags)
++{
++ if (NULL == x->duplicate) {
++ snmp_log(LOG_ERR, "container '%s' does not support duplicate\n",
++ x->container_name ? x->container_name : "");
++ return NULL;
++ }
++ return x->duplicate(x, ctx, flags);
++}
++
++/*------------------------------------------------------------------
+ * These functions should EXACTLY match the inline version in
+ * container.h. If you change one, change them both.
+ */
+@@ -408,6 +422,24 @@
+ c->find = fnd;
+ }
+
++int
++netsnmp_container_data_dup(netsnmp_container *dup, netsnmp_container *c)
++{
++ if (!dup || !c)
++ return -1;
++
++ if (c->container_name)
++ dup->container_name = strdup(c->container_name);
++ dup->compare = c->compare;
++ dup->ncompare = c->ncompare;
++ dup->release = c->release;
++ dup->insert_filter = c->insert_filter;
++ dup->sync = c->sync;
++ dup->flags = c->flags;
++
++ return 0;
++}
++
+ /*------------------------------------------------------------------
+ *
+ * simple comparison routines
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/020.7018550.kernel_sunos5.patch Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,29 @@
+--- net-snmp/agent/mibgroup/kernel_sunos5.c Sat Apr 30 03:25:14 2011
++++ kernel_sunos5.c Sat Apr 30 03:28:48 2011
+@@ -86,7 +86,7 @@
+ 0},
+ {MIB_AT, 0, (void *) -1, 0, 0, 0, 0},
+ {MIB_IP, sizeof(mib2_ip_t), (void *) -1, 0, 60, 0, 0},
+- {MIB_IP_ADDR, 20 * sizeof(mib2_ipAddrEntry_t), (void *) -1, 0, 60, 0,
++ {MIB_IP_ADDR, 50 * sizeof(mib2_ipAddrEntry_t), (void *) -1, 0, 60, 0,
+ 0},
+ {MIB_IP_ROUTE, 200 * sizeof(mib2_ipRouteEntry_t), (void *) -1, 0, 30,
+ 0, 0},
+@@ -105,13 +105,13 @@
+ {MIB_SNMP, 0, (void *) -1, 0, 0, 0, 0},
+ #ifdef SOLARIS_HAVE_IPV6_MIB_SUPPORT
+ #ifdef SOLARIS_HAVE_RFC4293_SUPPORT
+- {MIB_IP_TRAFFIC_STATS, 20 * sizeof(mib2_ipIfStatsEntry_t), (void *)-1, 0,
++ {MIB_IP_TRAFFIC_STATS, 50 * sizeof(mib2_ipIfStatsEntry_t), (void *)-1, 0,
+ 30, 0, 0},
+- {MIB_IP6, 20 * sizeof(mib2_ipIfStatsEntry_t), (void *)-1, 0, 30, 0, 0},
++ {MIB_IP6, 50 * sizeof(mib2_ipIfStatsEntry_t), (void *)-1, 0, 30, 0, 0},
+ #else
+- {MIB_IP6, 20 * sizeof(mib2_ipv6IfStatsEntry_t), (void *)-1, 0, 30, 0, 0},
++ {MIB_IP6, 50 * sizeof(mib2_ipv6IfStatsEntry_t), (void *)-1, 0, 30, 0, 0},
+ #endif
+- {MIB_IP6_ADDR, 20 * sizeof(mib2_ipv6AddrEntry_t), (void *)-1, 0, 30, 0, 0},
++ {MIB_IP6_ADDR, 50 * sizeof(mib2_ipv6AddrEntry_t), (void *)-1, 0, 30, 0, 0},
+ {MIB_TCP6_CONN, 1000 * sizeof(mib2_tcp6ConnEntry_t), (void *) -1, 0, 30,
+ 0, 0},
+ {MIB_UDP6_ENDPOINT, 1000 * sizeof(mib2_udp6Entry_t), (void *) -1, 0, 30,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/run-tests Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,102 @@
+#!/bin/ksh93 -x
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+#
+#pragma ident "@(#)run-tests 1.1 09/07/08 SMI"
+#
+# *
+# * U.S. Government Rights - Commercial software. Government users are subject
+# * to the Sun Microsystems, Inc. standard license agreement and applicable
+# * provisions of the FAR and its supplements.
+#
+# Use is subject to license terms.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+# Run Net-SNMP testing kit
+
+# get the arch that we are building on
+arch=`uname -p`
+
+DIR=$1
+MACH32=$2
+MACH64=$3
+IPRE=usr
+IARCH=`arch`
+IPROC=`uname -p | grep sparc > /dev/null && echo sparcv9 || echo amd64`
+IROOTB=/${IPRE}/bin
+IROOTS=/${IPRE}/sbin
+
+VER=${DIR}/${MACH32}
+VER64=${DIR}/${MACH64}
+
+cd ${VER}/testing
+
+if [ ${IPROC} == "amd64" ]; then
+PATH=${IROOT}/usr/sbin/i86:${IROOTB}:${IROOTS}:/usr/ccs/bin:/usr/bin:${SPRO_VROOT}/bin:/usr/sbin:/sbin:/usr/bin:/usr/etc:/usr/sbin:/etc:.:/usr/openwin/bin
+export PATH
+#./RUNTESTS -a > test.32.out 2>&1
+./RUNTESTS -a > ${VER}/test.32.out 2>&1
+if [ $? -ne 0 ]; then
+ echo ""
+ echo "=================================================================="
+ echo "======= Tests failed for i386 architecture ===================="
+ echo "======= see test.32.out in ================="
+ echo "=================================================================="
+ echo ""
+fi
+
+PATH=${IROOT}/usr/sbin/amd64:${IROOT}/usr/bin:/usr/ccs/bin:/usr/bin:${SPRO_VROOT}/bin:/usr/sbin:/sbin:/usr/bin:/usr/etc:/usr/sbin:/etc:.:/usr/openwin/bin
+export PATH
+cd ${VER64}/testing
+./RUNTESTS -a > ${VER64}/test.64.out 2>&1
+if [ $? -ne 0 ]; then
+ echo ""
+ echo "=================================================================="
+ echo "======= Tests failed for AMD architecture ===================="
+ echo "======= see test.64.out in $testdir ================="
+ echo "=================================================================="
+ echo ""
+fi
+fi
+
+if [ ${IPROC} == "sparcv9" ]; then
+cd ${VER64}/testing
+PATH=${IROOT}/usr/sbin:${IROOT}/usr/bin:/usr/ccs/bin:/usr/bin:${SPRO_VROOT}/bin:/usr/sbin:/sbin:/usr/bin:/usr/etc:/usr/sbin:/etc:.:/usr/openwin/bin
+export PATH
+./RUNTESTS -a > ${VER64}/test.64.out 2>&1
+if [ $? -ne 0 ]; then
+ echo ""
+ echo "=================================================================="
+ echo "======= Tests failed for SPARC architecture ===================="
+ echo "======= see test.64.out in $testdir ================="
+ echo "=================================================================="
+ echo ""
+fi
+fi
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,92 @@
+#
+# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile for sun directory in SMA
+#
+# $Log: Makefile,v $
+# Revision 1.10 2004/01/09 14:04:14 rr144420
+# 4974843 - directory change per LSARC
+#
+# Revision 1.9 2003/12/11 16:20:17 rr144420
+# 4964336 - eliminate sdk_buildrev
+#
+# Revision 1.8 2003/12/05 15:04:26 rr144420
+# 4964325 - Sun: pass ARCH=isa to make install
+#
+# Revision 1.7 2003/11/17 17:52:11 pcarroll
+# 4953668 - Sun: updated masfcnv migration script needs to be added to pkg
+#
+# Revision 1.6 2003/11/11 22:49:24 pcarroll
+# 4952508 - Sun: need to add a script to SMA pkgs for Enchilada migration
+#
+# Revision 1.5 2003/10/24 11:45:48 rr144420
+# 4943260 - add sdk_buildrev
+#
+# Revision 1.4 2003/08/21 14:41:58 rr144420
+# 4908816 - further makefile changes to install into correct lib
+#
+# Revision 1.3 2003/08/12 21:14:34 rr144420
+# 4895376 - correct Sun copyright statements. Cannot use (c), and must use Copyright Copyright in makefiles
+#
+# Revision 1.2 2003/08/01 16:32:12 rr144420
+# more of Paul's changes for packaging
+#
+# Revision 1.1 2003/07/23 15:53:28 rr144420
+# new makefiles for building sun directory
+#
+#
+SUBDIRS = agent
+BUILDREV_SRCS = sma_buildrev.c
+BUILDREV_PROGS = $(BUILDREV_SRCS:.c=)
+SCRIPT_PROG = masfcnv \
+ masfd \
+ snmpd.conf
+
+all: subdirs buildrevs
+
+buildrevs:$(BUILDREV_PROGS)
+.c:
+ $(CC) $< -o $@
+
+subdirs:
+ echo "SUBDIRS: $(MAKE) CFGPREFIX=$(CFGPREFIX) CFGLIB64=$(CFGLIB64) CFGLIB=$(CFGLIB) CC=$(CC) DEBUG=$(DEBUG) ARCH=$(ARCH)" ;
+ @if test "$(SUBDIRS)" != ""; then \
+ it="$(SUBDIRS)" ; \
+ for i in $$it ; do \
+ echo "making all in `pwd`/$$i"; \
+ ( cd $$i ; $(MAKE) CFGPREFIX=$(CFGPREFIX) CFGLIB64=$(CFGLIB64) CFGLIB=$(CFGLIB) CC=$(CC) DEBUG=$(DEBUG) ARCH=$(ARCH) ) ; \
+ if test $$? != 0 ; then \
+ exit 1 ; \
+ fi \
+ done \
+ fi
+
+subdirs_install:
+ @if test "$(SUBDIRS)" != ""; then \
+ it="$(SUBDIRS)" ; \
+ for i in $$it ; do \
+ echo "making install in `pwd`/$$i"; \
+ ( cd $$i ; $(MAKE) CFGPREFIX=$(CFGPREFIX) CFGLIB64=$(CFGLIB64) CFGLIB=$(CFGLIB) install ARCH=$(ARCH) ) ; \
+ if test $$? != 0 ; then \
+ exit 1 ; \
+ fi \
+ done \
+ fi
+
+install: subdirs_install
+
+force:
+# dummy target to force rebuilding
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,62 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile for sun/agent directory in SMA
+#
+# $Log: Makefile,v $
+# Revision 1.5 2003/09/18 11:39:08 rr144420
+# 4922904 - include sea directory in makefile
+#
+# Revision 1.4 2003/08/21 14:42:00 rr144420
+# 4908816 - further makefile changes to install into correct lib
+#
+# Revision 1.3 2003/08/12 21:14:36 rr144420
+# 4895376 - correct Sun copyright statements. Cannot use (c), and must use Copyright Copyright in makefiles
+#
+# Revision 1.2 2003/08/01 16:32:16 rr144420
+# more of Paul's changes for packaging
+#
+# Revision 1.1 2003/07/23 15:53:29 rr144420
+# new makefiles for building sun directory
+#
+#
+
+SUBDIRS = modules mibs
+
+all:
+ @if test "$(SUBDIRS)" != ""; then \
+ it="$(SUBDIRS)" ; \
+ for i in $$it ; do \
+ echo "making all in `pwd`/$$i"; \
+ echo "SUBDIRS2: $(MAKE) CC=$(CC) DEBUG=$(DEBUG) ARCH=$(ARCH)" ; \
+ ( cd $$i ; $(MAKE) CC=$(CC) DEBUG=$(DEBUG) ARCH=$(ARCH) ROOT=$(ROOT) ) ; \
+ if test $$? != 0 ; then \
+ exit 1 ; \
+ fi \
+ done \
+ fi
+
+install:
+ @if test "$(SUBDIRS)" != ""; then \
+ it="$(SUBDIRS)" ; \
+ for i in $$it ; do \
+ echo "making install in `pwd`/$$i"; \
+ ( cd $$i ; $(MAKE) install ARCH=$(ARCH) ) ; \
+ if test $$? != 0 ; then \
+ exit 1 ; \
+ fi \
+ done \
+ fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/mibs/ENTITY-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,1217 @@
+
+IMPORTS
+ MODULE-IDENTITY, OBJECT-TYPE, mib-2, NOTIFICATION-TYPE
+ FROM SNMPv2-SMI
+ TDomain, TAddress, TEXTUAL-CONVENTION,
+ AutonomousType, RowPointer, TimeStamp, TruthValue
+ FROM SNMPv2-TC
+ MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP
+ FROM SNMPv2-CONF
+ SnmpAdminString
+ FROM SNMP-FRAMEWORK-MIB;
+
+entityMIB MODULE-IDENTITY
+ LAST-UPDATED "9912070000Z"
+ ORGANIZATION "IETF ENTMIB Working Group"
+ CONTACT-INFO
+ " WG E-mail: [email protected]
+ Subscribe: [email protected]
+ msg body: subscribe entmib
+
+ Keith McCloghrie
+ ENTMIB Working Group Chair
+ Cisco Systems Inc.
+ 170 West Tasman Drive
+ San Jose, CA 95134
+ +1 408-526-5260
+ [email protected]
+
+ Andy Bierman
+ ENTMIB Working Group Editor
+ Cisco Systems Inc.
+ 170 West Tasman Drive
+ San Jose, CA 95134
+ +1 408-527-3711
+ [email protected]"
+ DESCRIPTION
+ "The MIB module for representing multiple logical
+ entities supported by a single SNMP agent."
+ REVISION "9912070000Z"
+ DESCRIPTION
+ "Initial Version of Entity MIB (Version 2).
+ This revision obsoletes RFC 2037.
+ This version published as RFC 2737."
+ REVISION "9610310000Z"
+ DESCRIPTION
+ "Initial version (version 1), published as
+ RFC 2037."
+ ::= { mib-2 47 }
+
+entityMIBObjects OBJECT IDENTIFIER ::= { entityMIB 1 }
+
+entityPhysical OBJECT IDENTIFIER ::= { entityMIBObjects 1 }
+entityLogical OBJECT IDENTIFIER ::= { entityMIBObjects 2 }
+entityMapping OBJECT IDENTIFIER ::= { entityMIBObjects 3 }
+entityGeneral OBJECT IDENTIFIER ::= { entityMIBObjects 4 }
+
+PhysicalIndex ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "An arbitrary value which uniquely identifies the physical
+ entity. The value should be a small positive integer; index
+ values for different physical entities are not necessarily
+ contiguous."
+ SYNTAX INTEGER (1..2147483647)
+
+PhysicalClass ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "An enumerated value which provides an indication of the
+ general hardware type of a particular physical entity.
+ There are no restrictions as to the number of
+ entPhysicalEntries of each entPhysicalClass, which must be
+ instantiated by an agent.
+
+ The enumeration 'other' is applicable if the physical entity
+ class is known, but does not match any of the supported
+ values.
+
+ The enumeration 'unknown' is applicable if the physical
+ entity class is unknown to the agent.
+
+ The enumeration 'chassis' is applicable if the physical
+ entity class is an overall container for networking
+ equipment. Any class of physical entity except a stack may
+ be contained within a chassis, and a chassis may only be
+ contained within a stack.
+
+ The enumeration 'backplane' is applicable if the physical
+ entity class is some sort of device for aggregating and
+ forwarding networking traffic, such as a shared backplane in
+ a modular ethernet switch. Note that an agent may model a
+ backplane as a single physical entity, which is actually
+ implemented as multiple discrete physical components (within
+ a chassis or stack).
+
+ The enumeration 'container' is applicable if the physical
+ entity class is capable of containing one or more removable
+ physical entities, possibly of different types. For example,
+ each (empty or full) slot in a chassis will be modeled as a
+ container. Note that all removable physical entities should
+ be modeled within a container entity, such as field-
+ replaceable modules, fans, or power supplies. Note that all
+ known containers should be modeled by the agent, including
+ empty containers.
+
+ The enumeration 'powerSupply' is applicable if the physical
+ entity class is a power-supplying component.
+
+ The enumeration 'fan' is applicable if the physical entity
+ class is a fan or other heat-reduction component.
+
+ The enumeration 'sensor' is applicable if the physical
+ entity class is some sort of sensor, such as a temperature
+ sensor within a router chassis.
+
+ The enumeration 'module' is applicable if the physical
+ entity class is some sort of self-contained sub-system. If
+ it is removable, then it should be modeled within a
+ container entity, otherwise it should be modeled directly
+ within another physical entity (e.g., a chassis or another
+ module).
+
+ The enumeration 'port' is applicable if the physical entity
+ class is some sort of networking port, capable of receiving
+ and/or transmitting networking traffic.
+
+ The enumeration 'stack' is applicable if the physical entity
+ class is some sort of super-container (possibly virtual),
+ intended to group together multiple chassis entities. A
+ stack may be realized by a 'virtual' cable, a real
+ interconnect cable, attached to multiple chassis, or may in
+ fact be comprised of multiple interconnect cables. A stack
+ should not be modeled within any other physical entities,
+ but a stack may be contained within another stack. Only
+ chassis entities should be contained within a stack."
+ SYNTAX INTEGER {
+ other(1),
+ unknown(2),
+ chassis(3),
+ backplane(4),
+ container(5),
+ powerSupply(6),
+ fan(7),
+ sensor(8),
+ module(9),
+ port(10),
+ stack(11)
+ }
+
+SnmpEngineIdOrNone ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "A specially formatted SnmpEngineID string for use with the
+ Entity MIB.
+
+ If an instance of an object of SYNTAX SnmpEngineIdOrNone has
+ a non-zero length, then the object encoding and semantics
+ are defined by the SnmpEngineID textual convention (see RFC
+ 2571 [RFC2571]).
+
+ If an instance of an object of SYNTAX SnmpEngineIdOrNone
+ contains a zero-length string, then no appropriate
+ SnmpEngineID is associated with the logical entity (i.e.,
+ SNMPv3 not supported)."
+ SYNTAX OCTET STRING (SIZE(0..32))
+
+entPhysicalTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF EntPhysicalEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "This table contains one row per physical entity. There is
+ always at least one row for an 'overall' physical entity."
+ ::= { entityPhysical 1 }
+
+entPhysicalEntry OBJECT-TYPE
+ SYNTAX EntPhysicalEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Information about a particular physical entity.
+
+ Each entry provides objects (entPhysicalDescr,
+ entPhysicalVendorType, and entPhysicalClass) to help an NMS
+ identify and characterize the entry, and objects
+ (entPhysicalContainedIn and entPhysicalParentRelPos) to help
+ an NMS relate the particular entry to other entries in this
+ table."
+ INDEX { entPhysicalIndex }
+ ::= { entPhysicalTable 1 }
+
+EntPhysicalEntry ::= SEQUENCE {
+ entPhysicalIndex PhysicalIndex,
+ entPhysicalDescr SnmpAdminString,
+ entPhysicalVendorType AutonomousType,
+ entPhysicalContainedIn INTEGER,
+ entPhysicalClass PhysicalClass,
+ entPhysicalParentRelPos INTEGER,
+ entPhysicalName SnmpAdminString,
+ entPhysicalHardwareRev SnmpAdminString,
+ entPhysicalFirmwareRev SnmpAdminString,
+ entPhysicalSoftwareRev SnmpAdminString,
+ entPhysicalSerialNum SnmpAdminString,
+ entPhysicalMfgName SnmpAdminString,
+ entPhysicalModelName SnmpAdminString,
+ entPhysicalAlias SnmpAdminString,
+ entPhysicalAssetID SnmpAdminString,
+ entPhysicalIsFRU TruthValue
+}
+
+entPhysicalIndex OBJECT-TYPE
+ SYNTAX PhysicalIndex
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "The index for this entry."
+ ::= { entPhysicalEntry 1 }
+
+entPhysicalDescr OBJECT-TYPE
+ SYNTAX SnmpAdminString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "A textual description of physical entity. This object
+ should contain a string which identifies the manufacturer's
+ name for the physical entity, and should be set to a
+ distinct value for each version or model of the physical
+ entity. "
+ ::= { entPhysicalEntry 2 }
+
+entPhysicalVendorType OBJECT-TYPE
+ SYNTAX AutonomousType
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "An indication of the vendor-specific hardware type of the
+ physical entity. Note that this is different from the
+ definition of MIB-II's sysObjectID.
+
+ An agent should set this object to a enterprise-specific
+ registration identifier value indicating the specific
+ equipment type in detail. The associated instance of
+ entPhysicalClass is used to indicate the general type of
+ hardware device.
+
+ If no vendor-specific registration identifier exists for
+ this physical entity, or the value is unknown by this agent,
+ then the value { 0 0 } is returned."
+ ::= { entPhysicalEntry 3 }
+
+entPhysicalContainedIn OBJECT-TYPE
+ SYNTAX INTEGER (0..2147483647)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The value of entPhysicalIndex for the physical entity which
+ 'contains' this physical entity. A value of zero indicates
+ this physical entity is not contained in any other physical
+ entity. Note that the set of 'containment' relationships
+ define a strict hierarchy; that is, recursion is not
+ allowed.
+
+ In the event a physical entity is contained by more than one
+ physical entity (e.g., double-wide modules), this object
+ should identify the containing entity with the lowest value
+ of entPhysicalIndex."
+ ::= { entPhysicalEntry 4 }
+
+entPhysicalClass OBJECT-TYPE
+ SYNTAX PhysicalClass
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "An indication of the general hardware type of the physical
+ entity.
+
+ An agent should set this object to the standard enumeration
+ value which most accurately indicates the general class of
+ the physical entity, or the primary class if there is more
+ than one.
+
+ If no appropriate standard registration identifier exists
+ for this physical entity, then the value 'other(1)' is
+ returned. If the value is unknown by this agent, then the
+ value 'unknown(2)' is returned."
+ ::= { entPhysicalEntry 5 }
+
+entPhysicalParentRelPos OBJECT-TYPE
+ SYNTAX INTEGER (-1..2147483647)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "An indication of the relative position of this 'child'
+ component among all its 'sibling' components. Sibling
+ components are defined as entPhysicalEntries which share the
+ same instance values of each of the entPhysicalContainedIn
+ and entPhysicalClass objects.
+
+ An NMS can use this object to identify the relative ordering
+ for all sibling components of a particular parent
+ (identified by the entPhysicalContainedIn instance in each
+ sibling entry).
+
+ This value should match any external labeling of the
+ physical component if possible. For example, for a container
+ (e.g., card slot) labeled as 'slot #3',
+ entPhysicalParentRelPos should have the value '3'. Note
+ that the entPhysicalEntry for the module plugged in slot 3
+ should have an entPhysicalParentRelPos value of '1'.
+
+ If the physical position of this component does not match
+ any external numbering or clearly visible ordering, then
+ user documentation or other external reference material
+ should be used to determine the parent-relative position. If
+ this is not possible, then the the agent should assign a
+ consistent (but possibly arbitrary) ordering to a given set
+ of 'sibling' components, perhaps based on internal
+ representation of the components.
+
+ If the agent cannot determine the parent-relative position
+ for some reason, or if the associated value of
+ entPhysicalContainedIn is '0', then the value '-1' is
+ returned. Otherwise a non-negative integer is returned,
+ indicating the parent-relative position of this physical
+ entity.
+
+ Parent-relative ordering normally starts from '1' and
+ continues to 'N', where 'N' represents the highest
+ positioned child entity. However, if the physical entities
+ (e.g., slots) are labeled from a starting position of zero,
+ then the first sibling should be associated with a
+ entPhysicalParentRelPos value of '0'. Note that this
+ ordering may be sparse or dense, depending on agent
+ implementation.
+
+ The actual values returned are not globally meaningful, as
+ each 'parent' component may use different numbering
+ algorithms. The ordering is only meaningful among siblings
+ of the same parent component.
+
+ The agent should retain parent-relative position values
+ across reboots, either through algorithmic assignment or use
+ of non-volatile storage."
+ ::= { entPhysicalEntry 6 }
+
+entPhysicalName OBJECT-TYPE
+ SYNTAX SnmpAdminString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The textual name of the physical entity. The value of this
+ object should be the name of the component as assigned by
+ the local device and should be suitable for use in commands
+ entered at the device's `console'. This might be a text
+ name, such as `console' or a simple component number (e.g.,
+ port or module number), such as `1', depending on the
+ physical component naming syntax of the device.
+
+ If there is no local name, or this object is otherwise not
+ applicable, then this object contains a zero-length string.
+
+ Note that the value of entPhysicalName for two physical
+ entities will be the same in the event that the console
+ interface does not distinguish between them, e.g., slot-1
+ and the card in slot-1."
+ ::= { entPhysicalEntry 7 }
+
+entPhysicalHardwareRev OBJECT-TYPE
+ SYNTAX SnmpAdminString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The vendor-specific hardware revision string for the
+ physical entity. The preferred value is the hardware
+ revision identifier actually printed on the component itself
+ (if present).
+
+ Note that if revision information is stored internally in a
+ non-printable (e.g., binary) format, then the agent must
+ convert such information to a printable format, in an
+ implementation-specific manner.
+
+ If no specific hardware revision string is associated with
+ the physical component, or this information is unknown to
+ the agent, then this object will contain a zero-length
+ string."
+ ::= { entPhysicalEntry 8 }
+
+entPhysicalFirmwareRev OBJECT-TYPE
+ SYNTAX SnmpAdminString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The vendor-specific firmware revision string for the
+ physical entity.
+
+ Note that if revision information is stored internally in a
+ non-printable (e.g., binary) format, then the agent must
+ convert such information to a printable format, in an
+ implementation-specific manner.
+
+ If no specific firmware programs are associated with the
+ physical component, or this information is unknown to the
+ agent, then this object will contain a zero-length string."
+ ::= { entPhysicalEntry 9 }
+
+entPhysicalSoftwareRev OBJECT-TYPE
+ SYNTAX SnmpAdminString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The vendor-specific software revision string for the
+ physical entity.
+
+ Note that if revision information is stored internally in a
+ non-printable (e.g., binary) format, then the agent must
+ convert such information to a printable format, in an
+ implementation-specific manner.
+
+ If no specific software programs are associated with the
+ physical component, or this information is unknown to the
+ agent, then this object will contain a zero-length string."
+ ::= { entPhysicalEntry 10 }
+
+entPhysicalSerialNum OBJECT-TYPE
+ SYNTAX SnmpAdminString (SIZE (0..32))
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "The vendor-specific serial number string for the physical
+ entity. The preferred value is the serial number string
+ actually printed on the component itself (if present).
+
+ On the first instantiation of an physical entity, the value
+ of entPhysicalSerialNum associated with that entity is set
+ to the correct vendor-assigned serial number, if this
+ information is available to the agent. If a serial number
+ is unknown or non-existent, the entPhysicalSerialNum will be
+ set to a zero-length string instead.
+
+ Note that implementations which can correctly identify the
+ serial numbers of all installed physical entities do not
+ need to provide write access to the entPhysicalSerialNum
+ object. Agents which cannot provide non-volatile storage for
+ the entPhysicalSerialNum strings are not required to
+ implement write access for this object.
+
+ Not every physical component will have a serial number, or
+ even need one. Physical entities for which the associated
+ value of the entPhysicalIsFRU object is equal to 'false(2)'
+ (e.g., the repeater ports within a repeater module), do not
+ need their own unique serial number. An agent does not have
+ to provide write access for such entities, and may return a
+ zero-length string.
+
+ If write access is implemented for an instance of
+ entPhysicalSerialNum, and a value is written into the
+ instance, the agent must retain the supplied value in the
+ entPhysicalSerialNum instance associated with the same
+ physical entity for as long as that entity remains
+ instantiated. This includes instantiations across all re-
+ initializations/reboots of the network management system,
+ including those which result in a change of the physical
+ entity's entPhysicalIndex value."
+ ::= { entPhysicalEntry 11 }
+
+entPhysicalMfgName OBJECT-TYPE
+ SYNTAX SnmpAdminString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The name of the manufacturer of this physical component.
+ The preferred value is the manufacturer name string actually
+ printed on the component itself (if present).
+ Note that comparisons between instances of the
+ entPhysicalModelName, entPhysicalFirmwareRev,
+ entPhysicalSoftwareRev, and the entPhysicalSerialNum
+ objects, are only meaningful amongst entPhysicalEntries with
+ the same value of entPhysicalMfgName.
+
+ If the manufacturer name string associated with the physical
+ component is unknown to the agent, then this object will
+ contain a zero-length string."
+ ::= { entPhysicalEntry 12 }
+
+entPhysicalModelName OBJECT-TYPE
+ SYNTAX SnmpAdminString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The vendor-specific model name identifier string associated
+ with this physical component. The preferred value is the
+ customer-visible part number, which may be printed on the
+ component itself.
+
+ If the model name string associated with the physical
+ component is unknown to the agent, then this object will
+ contain a zero-length string."
+ ::= { entPhysicalEntry 13 }
+
+entPhysicalAlias OBJECT-TYPE
+ SYNTAX SnmpAdminString (SIZE (0..32))
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "This object is an 'alias' name for the physical entity as
+ specified by a network manager, and provides a non-volatile
+ 'handle' for the physical entity.
+
+ On the first instantiation of an physical entity, the value
+ of entPhysicalAlias associated with that entity is set to
+ the zero-length string. However, agent may set the value to
+ a locally unique default value, instead of a zero-length
+ string.
+
+ If write access is implemented for an instance of
+ entPhysicalAlias, and a value is written into the instance,
+ the agent must retain the supplied value in the
+ entPhysicalAlias instance associated with the same physical
+ entity for as long as that entity remains instantiated.
+ This includes instantiations across all re-
+ initializations/reboots of the network management system,
+ including those which result in a change of the physical
+ entity's entPhysicalIndex value."
+ ::= { entPhysicalEntry 14 }
+
+entPhysicalAssetID OBJECT-TYPE
+ SYNTAX SnmpAdminString (SIZE (0..32))
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "This object is a user-assigned asset tracking identifier
+ for the physical entity as specified by a network manager,
+ and provides non-volatile storage of this information.
+
+ On the first instantiation of an physical entity, the value
+ of entPhysicalAssetID associated with that entity is set to
+ the zero-length string.
+
+ Not every physical component will have a asset tracking
+ identifier, or even need one. Physical entities for which
+ the associated value of the entPhysicalIsFRU object is equal
+ to 'false(2)' (e.g., the repeater ports within a repeater
+ module), do not need their own unique asset tracking
+ identifier. An agent does not have to provide write access
+ for such entities, and may instead return a zero-length
+ string.
+
+ If write access is implemented for an instance of
+ entPhysicalAssetID, and a value is written into the
+ instance, the agent must retain the supplied value in the
+ entPhysicalAssetID instance associated with the same
+ physical entity for as long as that entity remains
+ instantiated. This includes instantiations across all re-
+ initializations/reboots of the network management system,
+ including those which result in a change of the physical
+ entity's entPhysicalIndex value.
+
+ If no asset tracking information is associated with the
+ physical component, then this object will contain a zero-
+ length string."
+ ::= { entPhysicalEntry 15 }
+
+entPhysicalIsFRU OBJECT-TYPE
+ SYNTAX TruthValue
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "This object indicates whether or not this physical entity
+ is considered a 'field replaceable unit' by the vendor. If
+ this object contains the value 'true(1)' then this
+ entPhysicalEntry identifies a field replaceable unit. For
+ all entPhysicalEntries which represent components that are
+ permanently contained within a field replaceable unit, the
+ value 'false(2)' should be returned for this object."
+
+ ::= { entPhysicalEntry 16 }
+
+entLogicalTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF EntLogicalEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "This table contains one row per logical entity. For agents
+ which implement more than one naming scope, at least one
+ entry must exist. Agents which instantiate all MIB objects
+ within a single naming scope are not required to implement
+ this table."
+ ::= { entityLogical 1 }
+
+entLogicalEntry OBJECT-TYPE
+ SYNTAX EntLogicalEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Information about a particular logical entity. Entities
+ may be managed by this agent or other SNMP agents (possibly)
+ in the same chassis."
+ INDEX { entLogicalIndex }
+ ::= { entLogicalTable 1 }
+
+EntLogicalEntry ::= SEQUENCE {
+ entLogicalIndex INTEGER,
+ entLogicalDescr SnmpAdminString,
+ entLogicalType AutonomousType,
+ entLogicalCommunity OCTET STRING,
+ entLogicalTAddress TAddress,
+ entLogicalTDomain TDomain,
+ entLogicalContextEngineID SnmpEngineIdOrNone,
+ entLogicalContextName SnmpAdminString
+}
+
+entLogicalIndex OBJECT-TYPE
+ SYNTAX INTEGER (1..2147483647)
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "The value of this object uniquely identifies the logical
+ entity. The value should be a small positive integer; index
+ values for different logical entities are are not
+ necessarily contiguous."
+ ::= { entLogicalEntry 1 }
+
+entLogicalDescr OBJECT-TYPE
+ SYNTAX SnmpAdminString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "A textual description of the logical entity. This object
+ should contain a string which identifies the manufacturer's
+ name for the logical entity, and should be set to a distinct
+ value for each version of the logical entity. "
+ ::= { entLogicalEntry 2 }
+
+entLogicalType OBJECT-TYPE
+ SYNTAX AutonomousType
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "An indication of the type of logical entity. This will
+ typically be the OBJECT IDENTIFIER name of the node in the
+ SMI's naming hierarchy which represents the major MIB
+ module, or the majority of the MIB modules, supported by the
+ logical entity. For example:
+ a logical entity of a regular host/router -> mib-2
+ a logical entity of a 802.1d bridge -> dot1dBridge
+ a logical entity of a 802.3 repeater -> snmpDot3RptrMgmt
+ If an appropriate node in the SMI's naming hierarchy cannot
+ be identified, the value 'mib-2' should be used."
+ ::= { entLogicalEntry 3 }
+
+entLogicalCommunity OBJECT-TYPE
+ SYNTAX OCTET STRING (SIZE (0..255))
+ MAX-ACCESS read-only
+ STATUS deprecated
+ DESCRIPTION
+ "An SNMPv1 or SNMPv2C community-string which can be used to
+ access detailed management information for this logical
+ entity. The agent should allow read access with this
+ community string (to an appropriate subset of all managed
+ objects) and may also return a community string based on the
+ privileges of the request used to read this object. Note
+ that an agent may return a community string with read-only
+ privileges, even if this object is accessed with a read-
+ write community string. However, the agent must take care
+ not to return a community string which allows more
+ privileges than the community string used to access this
+ object.
+
+ A compliant SNMP agent may wish to conserve naming scopes by
+ representing multiple logical entities in a single 'default'
+ naming scope. This is possible when the logical entities
+ represented by the same value of entLogicalCommunity have no
+ object instances in common. For example, 'bridge1' and
+ 'repeater1' may be part of the main naming scope, but at
+ least one additional community string is needed to represent
+ 'bridge2' and 'repeater2'.
+
+ Logical entities 'bridge1' and 'repeater1' would be
+ represented by sysOREntries associated with the 'default'
+ naming scope.
+
+ For agents not accessible via SNMPv1 or SNMPv2C, the value
+ of this object is the empty string. This object may also
+ contain an empty string if a community string has not yet
+ been assigned by the agent, or no community string with
+ suitable access rights can be returned for a particular SNMP
+ request.
+
+ Note that this object is deprecated. Agents which implement
+ SNMPv3 access should use the entLogicalContextEngineID and
+ entLogicalContextName objects to identify the context
+ associated with each logical entity. SNMPv3 agents may
+ return a zero-length string for this object, or may continue
+ to return a community string (e.g., tri-lingual agent
+ support)."
+ ::= { entLogicalEntry 4 }
+
+entLogicalTAddress OBJECT-TYPE
+ SYNTAX TAddress
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The transport service address by which the logical entity
+ receives network management traffic, formatted according to
+ the corresponding value of entLogicalTDomain.
+
+ For snmpUDPDomain, a TAddress is 6 octets long, the initial
+ 4 octets containing the IP-address in network-byte order and
+ the last 2 containing the UDP port in network-byte order.
+ Consult 'Transport Mappings for Version 2 of the Simple
+ Network Management Protocol' (RFC 1906 [RFC1906]) for
+ further information on snmpUDPDomain."
+ ::= { entLogicalEntry 5 }
+
+entLogicalTDomain OBJECT-TYPE
+ SYNTAX TDomain
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Indicates the kind of transport service by which the
+ logical entity receives network management traffic.
+ Possible values for this object are presently found in the
+ Transport Mappings for SNMPv2 document (RFC 1906
+ [RFC1906])."
+ ::= { entLogicalEntry 6 }
+
+entLogicalContextEngineID OBJECT-TYPE
+ SYNTAX SnmpEngineIdOrNone
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The authoritative contextEngineID that can be used to send
+ an SNMP message concerning information held by this logical
+ entity, to the address specified by the associated
+ 'entLogicalTAddress/entLogicalTDomain' pair.
+
+ This object, together with the associated
+ entLogicalContextName object, defines the context associated
+ with a particular logical entity, and allows access to SNMP
+ engines identified by a contextEngineId and contextName
+ pair.
+
+ If no value has been configured by the agent, a zero-length
+ string is returned, or the agent may choose not to
+ instantiate this object at all."
+ ::= { entLogicalEntry 7 }
+
+entLogicalContextName OBJECT-TYPE
+ SYNTAX SnmpAdminString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The contextName that can be used to send an SNMP message
+ concerning information held by this logical entity, to the
+ address specified by the associated
+ 'entLogicalTAddress/entLogicalTDomain' pair.
+
+ This object, together with the associated
+ entLogicalContextEngineID object, defines the context
+ associated with a particular logical entity, and allows
+ access to SNMP engines identified by a contextEngineId and
+ contextName pair.
+
+ If no value has been configured by the agent, a zero-length
+ string is returned, or the agent may choose not to
+ instantiate this object at all."
+ ::= { entLogicalEntry 8 }
+
+entLPMappingTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF EntLPMappingEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "This table contains zero or more rows of logical entity to
+ physical equipment associations. For each logical entity
+ known by this agent, there are zero or more mappings to the
+ physical resources which are used to realize that logical
+ entity.
+
+ An agent should limit the number and nature of entries in
+ this table such that only meaningful and non-redundant
+ information is returned. For example, in a system which
+ contains a single power supply, mappings between logical
+ entities and the power supply are not useful and should not
+ be included.
+
+ Also, only the most appropriate physical component which is
+ closest to the root of a particular containment tree should
+ be identified in an entLPMapping entry.
+
+ For example, suppose a bridge is realized on a particular
+ module, and all ports on that module are ports on this
+ bridge. A mapping between the bridge and the module would be
+ useful, but additional mappings between the bridge and each
+ of the ports on that module would be redundant (since the
+ entPhysicalContainedIn hierarchy can provide the same
+ information). If, on the other hand, more than one bridge
+ was utilizing ports on this module, then mappings between
+ each bridge and the ports it used would be appropriate.
+
+ Also, in the case of a single backplane repeater, a mapping
+ for the backplane to the single repeater entity is not
+ necessary."
+ ::= { entityMapping 1 }
+
+entLPMappingEntry OBJECT-TYPE
+ SYNTAX EntLPMappingEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Information about a particular logical entity to physical
+ equipment association. Note that the nature of the
+ association is not specifically identified in this entry.
+ It is expected that sufficient information exists in the
+ MIBs used to manage a particular logical entity to infer how
+ physical component information is utilized."
+ INDEX { entLogicalIndex, entLPPhysicalIndex }
+ ::= { entLPMappingTable 1 }
+
+EntLPMappingEntry ::= SEQUENCE {
+ entLPPhysicalIndex PhysicalIndex
+}
+
+entLPPhysicalIndex OBJECT-TYPE
+ SYNTAX PhysicalIndex
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The value of this object identifies the index value of a
+ particular entPhysicalEntry associated with the indicated
+ entLogicalEntity."
+ ::= { entLPMappingEntry 1 }
+
+entAliasMappingTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF EntAliasMappingEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "This table contains zero or more rows, representing
+ mappings of logical entity and physical component to
+ external MIB identifiers. Each physical port in the system
+ may be associated with a mapping to an external identifier,
+ which itself is associated with a particular logical
+ entity's naming scope. A 'wildcard' mechanism is provided
+ to indicate that an identifier is associated with more than
+ one logical entity."
+ ::= { entityMapping 2 }
+
+entAliasMappingEntry OBJECT-TYPE
+ SYNTAX EntAliasMappingEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Information about a particular physical equipment, logical
+ entity to external identifier binding. Each logical
+ entity/physical component pair may be associated with one
+ alias mapping. The logical entity index may also be used as
+ a 'wildcard' (refer to the entAliasLogicalIndexOrZero object
+ DESCRIPTION clause for details.)
+
+ Note that only entPhysicalIndex values which represent
+ physical ports (i.e. associated entPhysicalClass value is
+ 'port(10)') are permitted to exist in this table."
+ INDEX { entPhysicalIndex, entAliasLogicalIndexOrZero }
+ ::= { entAliasMappingTable 1 }
+
+EntAliasMappingEntry ::= SEQUENCE {
+ entAliasLogicalIndexOrZero INTEGER,
+ entAliasMappingIdentifier RowPointer
+}
+
+entAliasLogicalIndexOrZero OBJECT-TYPE
+ SYNTAX INTEGER (0..2147483647)
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "The value of this object identifies the logical entity
+ which defines the naming scope for the associated instance
+ of the 'entAliasMappingIdentifier' object.
+
+ If this object has a non-zero value, then it identifies the
+ logical entity named by the same value of entLogicalIndex.
+
+ If this object has a value of zero, then the mapping between
+ the physical component and the alias identifier for this
+ entAliasMapping entry is associated with all unspecified
+ logical entities. That is, a value of zero (the default
+ mapping) identifies any logical entity which does not have
+ an explicit entry in this table for a particular
+ entPhysicalIndex/entAliasMappingIdentifier pair.
+
+ For example, to indicate that a particular interface (e.g.,
+ physical component 33) is identified by the same value of
+ ifIndex for all logical entities, the following instance
+ might exist:
+
+ entAliasMappingIdentifier.33.0 = ifIndex.5
+
+ In the event an entPhysicalEntry is associated differently
+ for some logical entities, additional entAliasMapping
+ entries may exist, e.g.:
+
+ entAliasMappingIdentifier.33.0 = ifIndex.6
+ entAliasMappingIdentifier.33.4 = ifIndex.1
+ entAliasMappingIdentifier.33.5 = ifIndex.1
+ entAliasMappingIdentifier.33.10 = ifIndex.12
+
+ Note that entries with non-zero entAliasLogicalIndexOrZero
+ index values have precedence over any zero-indexed entry. In
+ this example, all logical entities except 4, 5, and 10,
+ associate physical entity 33 with ifIndex.6."
+ ::= { entAliasMappingEntry 1 }
+
+entAliasMappingIdentifier OBJECT-TYPE
+ SYNTAX RowPointer
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The value of this object identifies a particular conceptual
+ row associated with the indicated entPhysicalIndex and
+ entLogicalIndex pair.
+
+ Since only physical ports are modeled in this table, only
+ entries which represent interfaces or ports are allowed. If
+ an ifEntry exists on behalf of a particular physical port,
+ then this object should identify the associated 'ifEntry'.
+ For repeater ports, the appropriate row in the
+ 'rptrPortGroupTable' should be identified instead.
+
+ For example, suppose a physical port was represented by
+ entPhysicalEntry.3, entLogicalEntry.15 existed for a
+ repeater, and entLogicalEntry.22 existed for a bridge. Then
+ there might be two related instances of
+ entAliasMappingIdentifier:
+ entAliasMappingIdentifier.3.15 == rptrPortGroupIndex.5.2
+ entAliasMappingIdentifier.3.22 == ifIndex.17
+ It is possible that other mappings (besides interfaces and
+ repeater ports) may be defined in the future, as required.
+
+ Bridge ports are identified by examining the Bridge MIB and
+ appropriate ifEntries associated with each 'dot1dBasePort',
+ and are thus not represented in this table."
+ ::= { entAliasMappingEntry 2 }
+
+entPhysicalContainsTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF EntPhysicalContainsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table which exposes the container/'containee'
+ relationships between physical entities. This table provides
+ all the information found by constructing the virtual
+ containment tree for a given entPhysicalTable, but in a more
+ direct format.
+
+ In the event a physical entity is contained by more than one
+ other physical entity (e.g., double-wide modules), this
+ table should include these additional mappings, which cannot
+ be represented in the entPhysicalTable virtual containment
+ tree."
+ ::= { entityMapping 3 }
+
+entPhysicalContainsEntry OBJECT-TYPE
+ SYNTAX EntPhysicalContainsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A single container/'containee' relationship."
+ INDEX { entPhysicalIndex, entPhysicalChildIndex }
+ ::= { entPhysicalContainsTable 1 }
+
+EntPhysicalContainsEntry ::= SEQUENCE {
+ entPhysicalChildIndex PhysicalIndex
+}
+
+entPhysicalChildIndex OBJECT-TYPE
+ SYNTAX PhysicalIndex
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The value of entPhysicalIndex for the contained physical
+ entity."
+ ::= { entPhysicalContainsEntry 1 }
+
+entLastChangeTime OBJECT-TYPE
+ SYNTAX TimeStamp
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The value of sysUpTime at the time a conceptual row is
+ created, modified, or deleted in any of these tables:
+ - entPhysicalTable
+ - entLogicalTable
+ - entLPMappingTable
+ - entAliasMappingTable
+ - entPhysicalContainsTable
+ "
+ ::= { entityGeneral 1 }
+
+entityMIBTraps OBJECT IDENTIFIER ::= { entityMIB 2 }
+entityMIBTrapPrefix OBJECT IDENTIFIER ::= { entityMIBTraps 0 }
+
+entConfigChange NOTIFICATION-TYPE
+ STATUS current
+ DESCRIPTION
+ "An entConfigChange notification is generated when the value
+ of entLastChangeTime changes. It can be utilized by an NMS
+ to trigger logical/physical entity table maintenance polls.
+
+ An agent should not generate more than one entConfigChange
+ 'notification-event' in a given time interval (five seconds
+ is the suggested default). A 'notification-event' is the
+ transmission of a single trap or inform PDU to a list of
+ notification destinations.
+
+ If additional configuration changes occur within the
+ throttling period, then notification-events for these
+ changes should be suppressed by the agent until the current
+ throttling period expires. At the end of a throttling
+ period, one notification-event should be generated if any
+ configuration changes occurred since the start of the
+ throttling period. In such a case, another throttling period
+ is started right away.
+
+ An NMS should periodically check the value of
+ entLastChangeTime to detect any missed entConfigChange
+ notification-events, e.g., due to throttling or transmission
+ loss."
+ ::= { entityMIBTrapPrefix 1 }
+
+entityConformance OBJECT IDENTIFIER ::= { entityMIB 3 }
+
+entityCompliances OBJECT IDENTIFIER ::= { entityConformance 1 }
+entityGroups OBJECT IDENTIFIER ::= { entityConformance 2 }
+
+entityCompliance MODULE-COMPLIANCE
+ STATUS deprecated
+ DESCRIPTION
+ "The compliance statement for SNMP entities which implement
+ version 1 of the Entity MIB."
+ MODULE
+ MANDATORY-GROUPS {
+ entityPhysicalGroup,
+ entityLogicalGroup,
+ entityMappingGroup,
+ entityGeneralGroup,
+ entityNotificationsGroup
+ }
+ ::= { entityCompliances 1 }
+
+entity2Compliance MODULE-COMPLIANCE
+ STATUS current
+ DESCRIPTION
+ "The compliance statement for SNMP entities which implement
+ version 2 of the Entity MIB."
+ MODULE
+ MANDATORY-GROUPS {
+ entityPhysicalGroup,
+ entityPhysical2Group,
+ entityGeneralGroup,
+ entityNotificationsGroup
+ }
+ GROUP entityLogical2Group
+ DESCRIPTION
+ "Implementation of this group is not mandatory for agents
+ which model all MIB object instances within a single naming
+ scope."
+
+ GROUP entityMappingGroup
+ DESCRIPTION
+ "Implementation of the entPhysicalContainsTable is mandatory
+ for all agents. Implementation of the entLPMappingTable and
+ entAliasMappingTables are not mandatory for agents which
+ model all MIB object instances within a single naming scope.
+
+ Note that the entAliasMappingTable may be useful for all
+ agents, however implementation of the entityLogicalGroup or
+ entityLogical2Group is required to support this table."
+
+ OBJECT entPhysicalSerialNum
+ MIN-ACCESS not-accessible
+ DESCRIPTION
+ "Read and write access is not required for agents which
+ cannot identify serial number information for physical
+ entities, and/or cannot provide non-volatile storage for
+ NMS-assigned serial numbers.
+
+ Write access is not required for agents which can identify
+ serial number information for physical entities, but cannot
+ provide non-volatile storage for NMS-assigned serial
+ numbers.
+
+ Write access is not required for physical entities for
+ physical entities for which the associated value of the
+ entPhysicalIsFRU object is equal to 'false(2)'."
+
+ OBJECT entPhysicalAlias
+ MIN-ACCESS read-only
+ DESCRIPTION
+ "Write access is required only if the associated
+ entPhysicalClass value is equal to 'chassis(3)'."
+
+ OBJECT entPhysicalAssetID
+ MIN-ACCESS not-accessible
+ DESCRIPTION
+ "Read and write access is not required for agents which
+ cannot provide non-volatile storage for NMS-assigned asset
+ identifiers.
+
+ Write access is not required for physical entities for which
+ the associated value of entPhysicalIsFRU is equal to
+ 'false(2)'."
+ ::= { entityCompliances 2 }
+
+entityPhysicalGroup OBJECT-GROUP
+ OBJECTS {
+ entPhysicalDescr,
+ entPhysicalVendorType,
+ entPhysicalContainedIn,
+ entPhysicalClass,
+ entPhysicalParentRelPos,
+ entPhysicalName
+ }
+ STATUS current
+ DESCRIPTION
+ "The collection of objects which are used to represent
+ physical system components, for which a single agent
+ provides management information."
+ ::= { entityGroups 1 }
+
+entityLogicalGroup OBJECT-GROUP
+ OBJECTS {
+ entLogicalDescr,
+ entLogicalType,
+ entLogicalCommunity,
+ entLogicalTAddress,
+ entLogicalTDomain
+ }
+ STATUS deprecated
+ DESCRIPTION
+ "The collection of objects which are used to represent the
+ list of logical entities for which a single agent provides
+ management information."
+ ::= { entityGroups 2 }
+
+entityMappingGroup OBJECT-GROUP
+ OBJECTS {
+ entLPPhysicalIndex,
+ entAliasMappingIdentifier,
+ entPhysicalChildIndex
+ }
+ STATUS current
+ DESCRIPTION
+ "The collection of objects which are used to represent the
+ associations between multiple logical entities, physical
+ components, interfaces, and port identifiers for which a
+ single agent provides management information."
+ ::= { entityGroups 3 }
+
+entityGeneralGroup OBJECT-GROUP
+ OBJECTS {
+ entLastChangeTime
+ }
+ STATUS current
+ DESCRIPTION
+ "The collection of objects which are used to represent
+ general entity information for which a single agent provides
+ management information."
+ ::= { entityGroups 4 }
+
+entityNotificationsGroup NOTIFICATION-GROUP
+ NOTIFICATIONS { entConfigChange }
+ STATUS current
+ DESCRIPTION
+ "The collection of notifications used to indicate Entity MIB
+ data consistency and general status information."
+ ::= { entityGroups 5 }
+
+entityPhysical2Group OBJECT-GROUP
+ OBJECTS {
+ entPhysicalHardwareRev,
+ entPhysicalFirmwareRev,
+ entPhysicalSoftwareRev,
+ entPhysicalSerialNum,
+ entPhysicalMfgName,
+ entPhysicalModelName,
+ entPhysicalAlias,
+ entPhysicalAssetID,
+ entPhysicalIsFRU
+ }
+
+ STATUS current
+ DESCRIPTION
+ "The collection of objects which are used to represent
+ physical system components, for which a single agent
+ provides management information. This group augments the
+ objects contained in the entityPhysicalGroup."
+ ::= { entityGroups 6 }
+
+entityLogical2Group OBJECT-GROUP
+ OBJECTS {
+ entLogicalDescr,
+ entLogicalType,
+ entLogicalTAddress,
+ entLogicalTDomain,
+ entLogicalContextEngineID,
+ entLogicalContextName
+ }
+ STATUS current
+ DESCRIPTION
+ "The collection of objects which are used to represent the
+ list of logical entities for which a single SNMP entity
+ provides management information."
+ ::= { entityGroups 7 }
+
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/mibs/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+# Makefile to install mibs
+#
+# usage:
+# "make install"
+
+# removed health-monitor-mib.mib
+
+MIBFILES= smatrap.mib \
+ ENTITY-MIB.txt \
+ SUN-MIB.txt \
+ SUN-SEA-EXTENSIONS-MIB.txt \
+ SUN-SEA-PROXY-MIB.txt
+
+all:
+# make all does nothing, but the upper-level makefile calls it
+
+install:
+ cp ./$(MIBFILES) $(ROOT)/etc/net-snmp/snmp/mibs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/mibs/SUN-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,39 @@
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are subject to
+-- the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun, Sun
+-- Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+--
+--
+
+---------------------------------------------------------------
+-- Systems Management Agent (SMA) SUN Enterprise definition MIB
+---------------------------------------------------------------
+
+SUN-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ enterprises, MODULE-IDENTITY FROM SNMPv2-SMI;
+
+sunMIB MODULE-IDENTITY
+ LAST-UPDATED "200309180000Z"
+ ORGANIZATION "Sun Microsystems, Inc."
+ CONTACT-INFO "Customer support"
+ DESCRIPTION
+ "MIB that defines the Sun enterprise
+ "
+ ::= { enterprises 42 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+management OBJECT IDENTIFIER ::= { products 2 }
+sma OBJECT IDENTIFIER ::= { management 4 }
+
+
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/mibs/SUN-SEA-EXTENSIONS-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,384 @@
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are subject to
+-- the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun, Sun
+-- Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+--
+--
+
+----------------------------------------------------
+-- Systems Management Agent (SMA) SEA Extensions MIB
+----------------------------------------------------
+
+SUN-SEA-EXTENSIONS-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ enterprises, mgmt, NetworkAddress, IpAddress, Counter, Gauge, TimeTicks
+ FROM RFC1155-SMI
+ DisplayString
+ FROM SNMPv2-TC
+ sunMIB
+ FROM SUN-MIB;
+
+sunSeaExtensionsMIB MODULE-IDENTITY
+ LAST-UPDATED "200309180000Z"
+ ORGANIZATION "Sun Microsystems, Inc."
+ CONTACT-INFO "Customer support"
+ DESCRIPTION
+ "The MIB that describes the sun-specific extensions to mib-2
+ "
+ ::= { sunMIB 3 }
+
+
+-- **********************************************************************
+-- SUN EXTENSIONS
+-- **********************************************************************
+
+ sunSystem OBJECT IDENTIFIER ::= { sunSeaExtensionsMIB 1 }
+ sunInterfaces OBJECT IDENTIFIER ::= { sunSeaExtensionsMIB 2 }
+ sunAt OBJECT IDENTIFIER ::= { sunSeaExtensionsMIB 3 }
+ sunIp OBJECT IDENTIFIER ::= { sunSeaExtensionsMIB 4 }
+ sunIcmp OBJECT IDENTIFIER ::= { sunSeaExtensionsMIB 5 }
+ sunTcp OBJECT IDENTIFIER ::= { sunSeaExtensionsMIB 6 }
+ sunUdp OBJECT IDENTIFIER ::= { sunSeaExtensionsMIB 7 }
+ sunSnmp OBJECT IDENTIFIER ::= { sunSeaExtensionsMIB 11 }
+ sunProcesses OBJECT IDENTIFIER ::= { sunSeaExtensionsMIB 12 }
+ sunHostPerf OBJECT IDENTIFIER ::= { sunSeaExtensionsMIB 13 }
+
+-- **********************************************************************
+-- SUN SYSTEM GROUP
+-- **********************************************************************
+
+ agentDescr OBJECT-TYPE
+ SYNTAX DisplayString (SIZE (0..255))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The SNMP agent's description of itself."
+ ::= { sunSystem 1 }
+
+ hostID OBJECT-TYPE
+ SYNTAX OCTET STRING (SIZE (4))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The unique Sun hardware identifier.
+ The value returned is four byte binary
+ string."
+ ::= { sunSystem 2 }
+
+ motd OBJECT-TYPE
+ SYNTAX DisplayString (SIZE (0..255))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The first line of /etc/motd."
+ ::= { sunSystem 3 }
+
+ unixTime OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The Unix system time. Measured in seconds
+ since January 1, 1970 GMT."
+ ::= { sunSystem 4 }
+
+-- the Sun Processes group
+-- the Sun Process table table
+-- This table is lists all the processes currently
+-- in execution.
+
+ sunProcessTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF PsEntry
+ ACCESS read-only
+ STATUS mandatory
+ ::= { sunProcesses 1 }
+
+ psEntry OBJECT-TYPE
+ SYNTAX PsEntry
+ ACCESS read-only
+ STATUS mandatory
+ INDEX { psProcessID }
+ ::= { sunProcessTable 1 }
+ PsEntry ::= SEQUENCE {
+ psProcessID
+ INTEGER,
+ psParentProcessID
+ INTEGER,
+ psProcessSize
+ INTEGER,
+ psProcessCpuTime
+ INTEGER,
+ psProcessState
+ DisplayString,
+ psProcessWaitChannel
+ DisplayString,
+ psProcessTTY
+ DisplayString,
+ psProcessUserName
+ DisplayString,
+ psProcessUserID
+ INTEGER,
+ psProcessName
+ DisplayString,
+ psProcessStatus
+ INTEGER
+ }
+
+ psProcessID OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The process identifier for this process."
+ ::= { psEntry 1 }
+
+ psParentProcessID OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The process identifier of this process's parent."
+ ::= { psEntry 2 }
+
+ psProcessSize OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The combined size of the data and stack segments
+ (in kilobytes.)"
+ ::= { psEntry 3 }
+
+ psProcessCpuTime OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The CPU time (including both user and system
+ time) consumed so far."
+ ::= { psEntry 4 }
+
+ psProcessState OBJECT-TYPE
+ SYNTAX DisplayString (SIZE (0..4))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The run-state of the process.
+ R - Runnable
+ T - Stopped
+ P - In page wait
+ D - Non-interruptable wait
+ S - Sleeping (less than 20 seconds)
+ I - Idle (more than 20 seconds)
+ Z - Zombie"
+ ::= { psEntry 5 }
+
+ psProcessWaitChannel OBJECT-TYPE
+ SYNTAX DisplayString (SIZE (0..16))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Reason process is waiting."
+ ::= { psEntry 6 }
+
+ psProcessTTY OBJECT-TYPE
+ SYNTAX DisplayString (SIZE (0..16))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Terminal, if any, controlling this process."
+ ::= { psEntry 7 }
+
+ psProcessUserName OBJECT-TYPE
+ SYNTAX DisplayString (SIZE (0..16))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Name of the user associated with this process."
+ ::= { psEntry 8 }
+
+ psProcessUserID OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Numeric form of the name of the user associated
+ with this process."
+ ::= { psEntry 9 }
+
+ psProcessName OBJECT-TYPE
+ SYNTAX DisplayString (SIZE (0..64))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Command name used to invoke this process."
+ ::= { psEntry 10 }
+
+ psProcessStatus OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "Setting this variable will cause a signal
+ of the set value to be sent to the process."
+ ::= { psEntry 11 }
+
+-- the Sun Hostperf group
+
+ rsUserProcessTime OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "total number of timeticks used by user processes
+ since the system was last booted."
+ ::= { sunHostPerf 1 }
+
+ rsNiceModeTime OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "total number of timeticks used by nice mode since
+ the system was last booted."
+ ::= { sunHostPerf 2 }
+
+ rsSystemProcessTime OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "total number of timeticks used by system processes
+ since the system was last booted."
+ ::= { sunHostPerf 3 }
+
+ rsIdleModeTime OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "total number of timeticks used in idle mode since
+ the system was last booted."
+ ::= { sunHostPerf 4 }
+
+ rsDiskXfer1 OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ ""
+ ::= { sunHostPerf 5 }
+
+ rsDiskXfer2 OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ ""
+ ::= { sunHostPerf 6 }
+
+ rsDiskXfer3 OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ ""
+ ::= { sunHostPerf 7 }
+
+ rsDiskXfer4 OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ ""
+ ::= { sunHostPerf 8 }
+
+ rsVPagesIn OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Number of pages read in from disk."
+ ::= { sunHostPerf 9 }
+
+ rsVPagesOut OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Number of pages written to disk."
+ ::= { sunHostPerf 10 }
+
+ rsVSwapIn OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Number of pages swapped in."
+ ::= { sunHostPerf 11 }
+
+ rsVSwapOut OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Number of pages swapped out."
+ ::= { sunHostPerf 12 }
+
+ rsVIntr OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Number of device interrupts."
+ ::= { sunHostPerf 13 }
+
+ rsIfInPackets OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Number of input packets."
+ ::= { sunHostPerf 14 }
+
+ rsIfOutPackets OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Number of output packets."
+ ::= { sunHostPerf 15 }
+
+ rsIfInErrors OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Number of input errors."
+ ::= { sunHostPerf 16 }
+
+ rsIfOutErrors OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Number of output errors."
+ ::= { sunHostPerf 17 }
+
+ rsIfCollisions OBJECT-TYPE
+ SYNTAX Counter
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Number of output collisions."
+ ::= { sunHostPerf 18 }
+
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/mibs/SUN-SEA-PROXY-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,529 @@
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are subject to
+-- the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun, Sun
+-- Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+--
+--
+
+------------------------------------------------
+-- Systems Management Agent (SMA) SEA Proxy MIB
+------------------------------------------------
+
+SUN-SEA-PROXY-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ DisplayString
+ FROM SNMPv2-TC
+ products
+ FROM SUN-MIB;
+
+sunSeaProxyMIB MODULE-IDENTITY
+ LAST-UPDATED "200309180000Z"
+ ORGANIZATION "Sun Microsystems, Inc."
+ CONTACT-INFO "Customer support"
+ DESCRIPTION
+ "The MIB used to manage the snmpdx master agent daemon
+ "
+ ::= { products 15 }
+
+
+--
+-- ********** Global Master agent Information ******
+--
+
+ sunSeaProxyMIBStatusFile OBJECT-TYPE
+ SYNTAX DisplayString
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "This file stores the process id's of all the sub agents
+ that are invoked by the master agent.
+ The purpose of this file is for Master Agent recovery in
+ case the Master Agent dies or is killed. When the Master
+ Agent restarts, the entries in this file will indicate
+ which subagents are spawned by it previously and what
+ were their port numbers."
+ ::= { sunSeaProxyMIB 1 }
+
+ sunSeaProxyMIBResourceConfigFile OBJECT-TYPE
+ SYNTAX DisplayString
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "This file is exclusively used by the Master Agent.
+ When the Master Agent comes up, it reads this file.
+ This files stores information for all those agents
+ that can be managed by the Master Agent. Each entry
+ in the configuration file also includes the methods
+ for invoking these subagents. It is also possible for
+ a subagent not to have an entry in this configuration
+ file. Such a subagent can dynamically come up and
+ register with the Master Agent when it comes up."
+ ::= { sunSeaProxyMIB 2 }
+
+ sunSeaProxyMIBConfigurationDir OBJECT-TYPE
+ SYNTAX DisplayString
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "This is the directory that contains the configuration
+ files for the Master Agent."
+ ::= { sunSeaProxyMIB 3 }
+
+ sunSeaProxyMIBTrapPort OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "This is the port that master agent opens to receive SNMP trap
+ notifications from various subagents. The master agent
+ forwards these traps to the managers appropriately."
+ ::= { sunSeaProxyMIB 4 }
+
+ sunCheckSubAgentName OBJECT-TYPE
+ SYNTAX DisplayString
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "This variable is of use to the sub agents only. It is
+ used by the sub agents to check with the master
+ to check for duplicate sub agent names."
+ ::= { sunSeaProxyMIB 5 }
+
+ sunSeaProxyMIBPollInterval OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "This variable speicifies the time interval after which
+ the Master Agent will perform activities other than
+ receiving/sending of SNMP messages. The other activities
+ include trying to find out if there is a change in the
+ resource file, discover if all the agents are responding,
+ and other such routine house keeping activities.
+ This field contains values in seconds."
+ ::= { sunSeaProxyMIB 6 }
+
+ sunSeaProxyMIBMaxAgentTimeOut OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The value of this field can be specified in microseconds.
+ This field signifies the max allowed time-out a subagent
+ can request during registration; e.g., when the Master
+ Agent sends a request to a subagent. It waits for some
+ time-out to receive the response. This time-out can be
+ specified in the registration file or can also be set
+ using dynamic registration. If an agent sets this time-out
+ outrageously high, it can create problems for the
+ Master Agent and other agents. To avoid such a problem,
+ the Master Agent can have a policy of specifying a
+ maximum value for which the Master Agent will wait for
+ a response from the subagent. This maximum value of
+ time-out is specified with this variable."
+ ::= { sunSeaProxyMIB 7 }
+
+--
+-- *********** agentTable **************
+--
+ sunSubAgentTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF SunSubAgentEntry
+ ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "This table lists all the sub-agents that are registered
+ with the master agent. The list contains the names of all
+ the sub agents that are currently running on the system.
+ Some of these sub agents could be invoked by the master
+ agent and other's could have benn invoked by other means."
+ ::= { sunSeaProxyMIB 8 }
+
+ sunSubAgentTableIndex OBJECT-TYPE
+ SYNTAX INTEGER (0..65535)
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "The next available index in sunSubAgentTable."
+ ::= { sunSeaProxyMIB 9 }
+
+--
+-- ************** agentEntry(Table Entry) ************
+--
+ sunSubAgentEntry OBJECT-TYPE
+ SYNTAX SunSubAgentEntry
+ ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "An entry in the sub-agent table."
+ INDEX { sunSubAgentID }
+ ::= { sunSubAgentTable 1}
+
+ SunSubAgentEntry ::=
+ SEQUENCE {
+ sunSubAgentID
+ INTEGER,
+ sunSubAgentStatus
+ INTEGER,
+ sunSubAgentTimeout
+ INTEGER,
+ sunSubAgentPortNumber
+ INTEGER,
+ sunSubAgentRegistrationFile
+ DisplayString,
+ sunSubAgentAccessControlFile
+ DisplayString,
+ sunSubAgentExecutable
+ DisplayString,
+ sunSubAgentVersionNum
+ DisplayString,
+ sunSubAgentProcessID
+ INTEGER,
+ sunSubAgentName
+ DisplayString,
+ sunSubAgentSystemUpTime
+ TimeTicks,
+ sunSubAgentWatchDogTime
+ INTEGER
+ }
+
+
+ sunSubAgentID OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "This is the id for each sub agent that is running and
+ registered with the master agent."
+ ::= { sunSubAgentEntry 1 }
+
+ sunSubAgentStatus OBJECT-TYPE
+ SYNTAX INTEGER { init(1), load(2), active(3), inactive(4), destroy(5) }
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "This variable provides the state of the sub-agent. When the
+ sub-agent is started the state is 'init'. Once the sub-agent
+ has read it's configuration files, but has not registered
+ with the master , the state is 'load'. After the 'load'
+ state the sub-agent goes into 'active' state. In this state
+ the sub-agent has registered with the master agent and
+ would respond to any requests from the master agent and can
+ also generate traps."
+ ::= { sunSubAgentEntry 2 }
+
+ sunSubAgentTimeout OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "The max. time for which the master agent would wait
+ for a sub-agent to complete the request. The value is
+ specified in usec. "
+ ::= { sunSubAgentEntry 3 }
+
+ sunSubAgentPortNumber OBJECT-TYPE
+ SYNTAX INTEGER (0..65535)
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "The port number of the sub-agent on which it listens for
+ requests from the master agent."
+ ::= { sunSubAgentEntry 4 }
+
+ sunSubAgentRegistrationFile OBJECT-TYPE
+ SYNTAX DisplayString
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "This is the registration file of a sub-agent. Each sub-agent
+ has its own registration file. This file contains information
+ pertinent to each agent. The information includes the name
+ of the agent, the subtree OIDs managed by the respective
+ agent, request time out, the preferred port number, etc."
+ ::= { sunSubAgentEntry 5 }
+
+ sunSubAgentAccessControlFile OBJECT-TYPE
+ SYNTAX DisplayString
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "This is a file that has the access control information
+ for each sub agent. It stores SNMP-related community
+ information. Every subagent and a Master Agent can have
+ its own access control file."
+ ::= { sunSubAgentEntry 6 }
+
+ sunSubAgentExecutable OBJECT-TYPE
+ SYNTAX DisplayString
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "The executable file of the sub-agent."
+ ::= { sunSubAgentEntry 7 }
+
+ sunSubAgentVersionNum OBJECT-TYPE
+ SYNTAX DisplayString
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "The version number of the sub-agent."
+ ::= { sunSubAgentEntry 8 }
+
+ sunSubAgentProcessID OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "The process id of the sub-agent."
+ ::= { sunSubAgentEntry 9 }
+
+ sunSubAgentName OBJECT-TYPE
+ SYNTAX DisplayString
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "The name of the sub-agent. This is assigned by the user."
+ ::= { sunSubAgentEntry 10 }
+
+ sunSubAgentSystemUpTime OBJECT-TYPE
+ SYNTAX TimeTicks
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "The system up time of the sub-agent."
+ ::= { sunSubAgentEntry 11 }
+
+ sunSubAgentWatchDogTime OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "This timeout is used by the Master Agent to determine
+ if the subagent is up or not. The Master Agent will poll
+ the subagent only if there has been no activity between
+ the Master Agent and the subagent for this specified
+ interval. This interval is specified in seconds."
+ ::= { sunSubAgentEntry 12 }
+
+
+
+--
+-- ********** SubTreeConfigurationTable ****************
+--
+ sunSubTreeConfigurationTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF SunSubTreeConfigurationEntry
+ ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "This is the table of subtree registration requests made
+ by the sub agents. The enteries in this table also include
+ the sub tree OID's of those agents that are invkoed by
+ the master agent. This table thus consists of enteries
+ as configured in the sub agent registration files. These
+ sub tree OID's are flattened into a OID sub tree dispatch
+ table in the master agent which is also defined in this MIB."
+ ::= { sunSeaProxyMIB 10 }
+
+ sunSubTreeConfigurationTableIndex OBJECT-TYPE
+ SYNTAX INTEGER (0..65535)
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The next available index in sunSubTreeConfigurationTable."
+ ::= { sunSeaProxyMIB 11 }
+
+--
+-- ************** RegTreeEntry(Table Entry) ************
+--
+ sunSubTreeConfigurationEntry OBJECT-TYPE
+ SYNTAX SunSubTreeConfigurationEntry
+ ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "An entry for table registration."
+ INDEX { sunSubTreeAgentID, sunSubTreeIndex }
+ ::= { sunSubTreeConfigurationTable 1 }
+
+ SunSubTreeConfigurationEntry ::=
+ SEQUENCE {
+ sunSubTreeIndex
+ INTEGER,
+ sunSubTreeAgentID
+ INTEGER,
+ sunSubTreeOID
+ OBJECT IDENTIFIER,
+ sunSubTreeStartColumn
+ INTEGER,
+ sunSubTreeEndColumn
+ INTEGER,
+ sunSubTreeStartRow
+ INTEGER,
+ sunSubTreeEndRow
+ INTEGER,
+-- sunSubTreeView
+-- DisplayString,
+ sunSubTreeStatus
+ INTEGER
+ }
+
+ sunSubTreeIndex OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The index of the table registration."
+ ::= { sunSubTreeConfigurationEntry 1 }
+
+ sunSubTreeAgentID OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "ID of the sub-agent."
+ ::= { sunSubTreeConfigurationEntry 2 }
+
+ sunSubTreeOID OBJECT-TYPE
+ SYNTAX OBJECT IDENTIFIER
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "The oid of the subtree table that is being registered. A
+ sub agent can have multiple sub tree oid's registered
+ as seperate enteries."
+ ::= { sunSubTreeConfigurationEntry 3 }
+
+ sunSubTreeStartColumn OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "Starting column of the sub table."
+ ::= { sunSubTreeConfigurationEntry 4 }
+
+ sunSubTreeEndColumn OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "Ending column of the sub table."
+ ::= { sunSubTreeConfigurationEntry 5 }
+
+ sunSubTreeStartRow OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "Starting row of the sub table."
+ ::= { sunSubTreeConfigurationEntry 6 }
+
+ sunSubTreeEndRow OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "Ending row of the sub table."
+ ::= { sunSubTreeConfigurationEntry 7 }
+
+
+ sunSubTreeStatus OBJECT-TYPE
+ SYNTAX INTEGER { active(1), inactive(2) }
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "The variable allows to activate or delete the enteries
+ in this table."
+ ::= { sunSubTreeConfigurationEntry 8 }
+
+--
+-- ********** RegTreeTable ****************
+--
+ sunSubTreeDispatchTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF SunSubTreeDispatchEntry
+ ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "This table lists all the OID enteries that are
+ used by the master agent to dispatch the requests to the
+ sub agents. This table is based on the sub-tree
+ registration configured in the sub agents registration
+ files."
+ ::= { sunSeaProxyMIB 12 }
+
+ sunSubTreeDispatchTableIndex OBJECT-TYPE
+ SYNTAX INTEGER (0..65535)
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The next available index in sunSubTreeDispatchTable."
+ ::= { sunSeaProxyMIB 13 }
+
+
+--
+-- ************** Dispatch Table ************
+--
+ sunSubTreeDispatchEntry OBJECT-TYPE
+ SYNTAX SunSubTreeDispatchEntry
+ ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "An entry for tree registration."
+ INDEX { sunSubTreeDispatchAgentID, sunSubTreeDispatchIndex }
+ ::= { sunSubTreeDispatchTable 1 }
+
+ SunSubTreeDispatchEntry ::=
+ SEQUENCE {
+ sunSubTreeDispatchIndex
+ INTEGER,
+ sunSubTreeDispatchAgentID
+ INTEGER,
+ sunSubTreeDispatchOID
+ OBJECT IDENTIFIER,
+ sunSubTreeDispatchStatus
+ INTEGER
+ }
+
+
+ sunSubTreeDispatchIndex OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The index of the dispatch table entry."
+ ::= { sunSubTreeDispatchEntry 1 }
+
+ sunSubTreeDispatchAgentID OBJECT-TYPE
+ SYNTAX INTEGER
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ ""
+ ::= { sunSubTreeDispatchEntry 2 }
+
+ sunSubTreeDispatchOID OBJECT-TYPE
+ SYNTAX OBJECT IDENTIFIER
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "The oid of the subtree."
+ ::= { sunSubTreeDispatchEntry 3 }
+
+
+ sunSubTreeDispatchStatus OBJECT-TYPE
+ SYNTAX INTEGER { active(1), inactive(2) }
+ ACCESS read-write
+ STATUS mandatory
+ DESCRIPTION
+ "The variable allows to activate or delete the enteries
+ in this table."
+ ::= { sunSubTreeDispatchEntry 4 }
+
+
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/mibs/health-monitor-mib.mib Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,487 @@
+
+--
+-- Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are subject
+-- to the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun,
+-- Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+--
+--
+-------------------------------------------------------
+-- Sun Management Center
+-------------------------------------------------------
+
+
+HEALTH-MONITOR-SUNMANAGEMENTCENTER-MIB DEFINITIONS ::= BEGIN
+
+
+ IMPORTS
+ enterprises, MODULE-IDENTITY, OBJECT-TYPE, Integer32, Unsigned32
+ FROM SNMPv2-SMI
+ OBJECT-GROUP
+ FROM SNMPv2-CONF
+ DisplayString
+ FROM SNMPv2-TC;
+
+
+healthMonitor MODULE-IDENTITY
+ LAST-UPDATED "0009181435Z"
+ ORGANIZATION "Sun Microsystems Inc."
+ CONTACT-INFO
+ " Sun Microsystems Inc.
+ Customer Support
+ Postal: 901 San Antonio Road
+ Palo Alto, CA-94303-4900
+ USA
+ Tel: 650-960-1300
+ E-mail: [email protected]"
+ DESCRIPTION
+ "Health Monitor allows to monitor the overall state of the machine,
+ including the state of the disk, networks, RAM, and so on.
+ This module uses a set of performance rules to determine valid
+ component states."
+
+ REVISION "9907201505Z"
+ DESCRIPTION
+ "Rev 1.0 20th July 1999 15:05, Initial version Of MIB."
+ REVISION "0009181435Z"
+ DESCRIPTION
+ "Rev 1.1 18th Sep 2000 14:35. Changed the type of mibnode hmDNLCHits
+ and hmDNLCMisses from Integer32 to Unsigned32."
+ ::= { modules 11 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+sunsymon OBJECT IDENTIFIER ::= { products 12 }
+agent OBJECT IDENTIFIER ::= { sunsymon 2 }
+modules OBJECT IDENTIFIER ::= { agent 2 }
+
+hmSwap OBJECT IDENTIFIER ::= { healthMonitor 1 }
+
+hmKernelcontention OBJECT IDENTIFIER ::= { healthMonitor 2 }
+
+hmNFS OBJECT IDENTIFIER ::= { healthMonitor 3 }
+
+hmCPU OBJECT IDENTIFIER ::= { healthMonitor 4 }
+
+hmDiskGroup OBJECT-GROUP
+ OBJECTS { hmDiskName, hmDiskAliasName, hmAvgWaitTransactions,
+ hmDiskBusyPcnt, hmAvgDiskSvcTime }
+ STATUS current
+ DESCRIPTION
+ "Disk related statistics."
+ ::= { healthMonitor 5 }
+
+
+
+
+hmRAM OBJECT IDENTIFIER ::= { healthMonitor 6 }
+
+hmKMEM OBJECT IDENTIFIER ::= { healthMonitor 7 }
+
+hmDNLC OBJECT IDENTIFIER ::= { healthMonitor 8 }
+
+
+
+hmSwapSpaceGroup OBJECT-GROUP
+ OBJECTS { hmAvailableSwapSpace, hmReservedSwapSpace,
+ hmAllocatedSwapSpace, hmUsedSwapSpace }
+ STATUS current
+ DESCRIPTION
+ "Swap space related statistics."
+ ::= { hmSwap 1 }
+
+
+hmAvailableSwapSpace OBJECT-TYPE
+ SYNTAX Integer32
+ UNITS "kB"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The total swap space (in 1024 byte blocks) that is currently
+ available for reservation and allocation."
+ ::= { hmSwapSpaceGroup 1 }
+
+hmReservedSwapSpace OBJECT-TYPE
+ SYNTAX Integer32
+ UNITS "kB"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The total amount of swap space (in 1024 byte blocks) that is
+ not currently allocated, but is claimed by memory mappings for
+ possible future use."
+ ::= { hmSwapSpaceGroup 2 }
+
+hmAllocatedSwapSpace OBJECT-TYPE
+ SYNTAX Integer32
+ UNITS "kB"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The total amount of swap space (in 1024 byte blocks)
+ currently allocated for use."
+ ::= { hmSwapSpaceGroup 3 }
+
+hmUsedSwapSpace OBJECT-TYPE
+ SYNTAX Integer32
+ UNITS "kB"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The total amount of swap space (in 1024 byte blocks) that is
+ either allocated or reserved."
+ ::= { hmSwapSpaceGroup 4 }
+
+
+hmMutexGroup OBJECT-GROUP
+ OBJECTS { hmSpinsOnMutexes, hmTotNumOfCPUs }
+ STATUS current
+ DESCRIPTION
+ "Mutex related statistics."
+ ::= { hmKernelcontention 1 }
+
+
+hmSpinsOnMutexes OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Sum of spins on mutexes (lock not acquired on first try)
+ for all CPUs."
+ ::= { hmMutexGroup 1 }
+
+hmTotNumOfCPUs OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of CPUs."
+ ::= { hmMutexGroup 2 }
+
+
+hmNFSClientRPCGroup OBJECT-GROUP
+ OBJECTS { hmTotRPCCalls, hmTotBadRPCCalls, hmTotRPCRetransmissions,
+ hmTotBadRPCReplies, hmTotRPCCallsTimedOut,
+ hmTotNumOfAuthRefresh, hmTotFailedCallsBV, hmTimers,
+ hmTotMemAllocFails, hmTotSendFails }
+ STATUS current
+ DESCRIPTION
+ "Client RPC call-related statistics."
+ ::= { hmNFS 1 }
+
+
+hmTotRPCCalls OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of RPC calls received."
+ ::= { hmNFSClientRPCGroup 1 }
+
+hmTotBadRPCCalls OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of calls rejected by the RPC layer."
+ ::= { hmNFSClientRPCGroup 2 }
+
+hmTotRPCRetransmissions OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of calls retransmitted due to a timeout."
+ ::= { hmNFSClientRPCGroup 3 }
+
+hmTotBadRPCReplies OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of replies from server that do not correspond to
+ any outside call."
+ ::= { hmNFSClientRPCGroup 4 }
+
+hmTotRPCCallsTimedOut OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of calls timed out while waiting for a reply from
+ server."
+ ::= { hmNFSClientRPCGroup 5 }
+
+hmTotNumOfAuthRefresh OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of times authentication information was refreshed."
+ ::= { hmNFSClientRPCGroup 6 }
+
+hmTotFailedCallsBV OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of calls failed due to a bad verifier in response."
+ ::= { hmNFSClientRPCGroup 7 }
+
+hmTimers OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of times calculated time-out exceeds minimum
+ specified timeout value for a call."
+ ::= { hmNFSClientRPCGroup 8 }
+
+hmTotMemAllocFails OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of failures to allocate memory."
+ ::= { hmNFSClientRPCGroup 9 }
+
+hmTotSendFails OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of failures where client is not able to send
+ the packets for any reason."
+ ::= { hmNFSClientRPCGroup 10 }
+
+
+
+hmCPUProcInStatesGroup OBJECT-GROUP
+ OBJECTS { hmTotProcInRunQueue, hmTotProcBlocked, hmTotProcReadyInSwap }
+ STATUS current
+ DESCRIPTION
+ "Statistics related to the number of processes in different states."
+ ::= { hmCPU 1 }
+
+
+hmTotProcInRunQueue OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of processes in the run queue."
+ ::= { hmCPUProcInStatesGroup 1 }
+
+hmTotProcBlocked OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of processes blocked for resources."
+ ::= { hmCPUProcInStatesGroup 2 }
+
+hmTotProcReadyInSwap OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of processes runnable but swapped."
+ ::= { hmCPUProcInStatesGroup 3 }
+
+
+hmDiskTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF HmDiskEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Table of information for all the disks installed on
+ the system."
+ ::= { hmDiskGroup 1 }
+
+hmDiskEntry OBJECT-TYPE
+ SYNTAX HmDiskEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Monitoring information for one disk on the system."
+ INDEX { hmDiskName }
+ ::= { hmDiskTable 1 }
+
+HmDiskEntry ::=
+ SEQUENCE {
+ hmDiskName
+ DisplayString,
+ hmDiskAliasName
+ DisplayString,
+ hmAvgWaitTransactions
+ DisplayString,
+ hmDiskBusyPcnt
+ DisplayString,
+ hmAvgDiskSvcTime
+ DisplayString
+ }
+
+
+hmDiskName OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Name of the disk."
+ ::= { hmDiskEntry 1 }
+
+hmDiskAliasName OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Name of the disk alias (for example, c0t0d0)."
+ ::= { hmDiskEntry 2 }
+
+
+hmAvgWaitTransactions OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Average number of transactions waiting for service."
+ ::= { hmDiskEntry 3 }
+
+hmDiskBusyPcnt OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "%"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Percent of time the disk is busy."
+ ::= { hmDiskEntry 4 }
+
+hmAvgDiskSvcTime OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "msec"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Average service time."
+ ::= { hmDiskEntry 5 }
+
+
+
+hmRamMemoryPagingGroup OBJECT-GROUP
+ OBJECTS { hmHandspread, hmPageScanRate }
+ STATUS current
+ DESCRIPTION
+ "Memory paging-related statistics."
+ ::= { hmRAM 1 }
+
+hmHandspread OBJECT-TYPE
+ SYNTAX Integer32
+ UNITS "MB"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The distance (in pages) between front and back pageout
+ daemon hands. The pageout daemon manages two hands on
+ the clock. The front hand moves through memory, clearing
+ the reference bit, and stealing pages from processes that
+ exceed the value maxrss. The back hand travels behind the
+ front hand, freeing pages that have not been referenced
+ since the front hand passed. If the pages have been modified,
+ they are pushed to the swap space before being freed. After
+ pageout examines a page of memory, the amount of time that
+ is needed to reclaim the page increases as the distance
+ increases between the two hands, and decreases as the scan
+ rate rises."
+ ::= { hmRamMemoryPagingGroup 1 }
+
+hmPageScanRate OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of pages scanned per second."
+ ::= { hmRamMemoryPagingGroup 2 }
+
+
+hmKmemStatisticsGroup OBJECT-GROUP
+ OBJECTS { hmKmemErrors, hmKmemFreeMem }
+ STATUS current
+ DESCRIPTION
+ "Kernel-memory-related statistics."
+ ::= { hmKMEM 1 }
+
+
+hmKmemErrors OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of error occured related to kernel memory.
+ These errors may be..
+ KMERR_MODIFIED: buffer modified after being fread
+ KMERR_READZONE: readzone violation, write past end of buffer
+ KMERR_BADADDR: invalid free
+ KMERR_DUPFREE: duplicate free
+ KMERR_BADBUFTAG: boundary tag corrupted
+ etc."
+ ::= { hmKmemStatisticsGroup 1 }
+
+hmKmemFreeMem OBJECT-TYPE
+ SYNTAX Integer32
+ UNITS "MB"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total amount of free kernel memory in MB."
+ ::= { hmKmemStatisticsGroup 2 }
+
+
+hmDNLCStatGroup OBJECT-GROUP
+ OBJECTS { hmDNLCHits, hmDNLCMisses, hmDNLCHitRate, hmDNLCRefRate }
+ STATUS current
+ DESCRIPTION
+ "DNLC related statistics."
+ ::= { hmDNLC 1 }
+
+
+hmDNLCHits OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times a name is looked up and is found in DNLC
+ (Directory Name Lookup Cache)."
+ ::= { hmDNLCStatGroup 1 }
+
+hmDNLCMisses OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times a name is looked up and is not found in DNLC
+ (Directory Name Lookup Cache). "
+ ::= { hmDNLCStatGroup 2 }
+
+hmDNLCHitRate OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of DNLC hits as a proportion of all DNLC lookups."
+ ::= { hmDNLCStatGroup 3 }
+
+hmDNLCRefRate OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The number of times per second, the DNLC is looked up."
+ ::= { hmDNLCStatGroup 4 }
+
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/mibs/smatrap.mib Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,141 @@
+
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are subject
+-- to the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun,
+-- Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+--
+--
+
+SMA-NOTIFICATION-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ MODULE-IDENTITY, OBJECT-TYPE, Counter32, Gauge32, Counter64,
+ Integer32, TimeTicks, mib-2,
+ NOTIFICATION-TYPE, enterprises FROM SNMPv2-SMI
+ TEXTUAL-CONVENTION, DisplayString,
+ PhysAddress, TruthValue, RowStatus,
+ TimeStamp, AutonomousType, TestAndIncr FROM SNMPv2-TC
+ MODULE-COMPLIANCE, OBJECT-GROUP,
+ NOTIFICATION-GROUP FROM SNMPv2-CONF
+ snmpTraps FROM SNMPv2-MIB
+ IANAifType FROM IANAifType-MIB;
+
+notifications MODULE-IDENTITY
+ LAST-UPDATED "9808040000Z"
+ ORGANIZATION "Sun Microsystems Inc."
+ CONTACT-INFO
+ " Sun Microsystems Inc
+ 4150 Network Circle
+ Santa Clara, CA 95054
+ e-mail: [email protected]
+ "
+ DESCRIPTION
+ "This MIB module defines notifications that are
+ generated by some monitoring modules loaded on
+ System Management Agent (SMA)."
+ ::= { sma 3 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+management OBJECT IDENTIFIER ::= { products 2 }
+sma OBJECT IDENTIFIER ::= { management 4 }
+
+traps OBJECT IDENTIFIER ::= { notifications 0 }
+trapInfo OBJECT IDENTIFIER ::= { notifications 1 }
+
+statusChange NOTIFICATION-TYPE
+OBJECTS { hostName, moduleName, statusOID, statusOIDContext, status, description , dataValue, dataValueType }
+STATUS current
+DESCRIPTION "A statusChange trap signifies that the status of an object has changed." ::= { traps 1 }
+
+hostName OBJECT-TYPE
+SYNTAX DisplayString (SIZE (0..255))
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The name of the host on which the event occurred."
+::= { trapInfo 1 }
+
+moduleName OBJECT-TYPE
+SYNTAX DisplayString (SIZE (0..255))
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The name of the module on which the event has occured."
+::= { trapInfo 2 }
+
+statusOID OBJECT-TYPE
+SYNTAX OBJECT IDENTIFIER
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The identification of the object for which the status changed."
+::= { trapInfo 3 }
+
+statusOIDContext OBJECT-TYPE
+SYNTAX DisplayString (SIZE (0..255))
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The name of context incase the status OID is registered under a particular
+ context. If there is no special context, the value for this field will be null."
+::= { trapInfo 4 }
+
+status OBJECT-TYPE
+SYNTAX DisplayString (SIZE (0..255))
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The current status of the object. One of OK, INFO, WARNING, ERROR."
+::= { trapInfo 5 }
+
+description OBJECT-TYPE
+SYNTAX DisplayString (SIZE (0..255))
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The detailed description of the event."
+::= { trapInfo 6 }
+
+dataValue OBJECT-TYPE
+SYNTAX DisplayString (SIZE (0..255))
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The current value of the object, that generates the event."
+::= { trapInfo 7 }
+
+dataValueType OBJECT-TYPE
+SYNTAX INTEGER {
+ none(0),
+ integer(1),
+ octetString(2),
+ objectIdentifier(3),
+ integer32(4),
+ ipAddress(5),
+ counter32(6),
+ gauge32(7),
+ unsigned32(8),
+ timeTicks(9),
+ opaque(10),
+ counter64(11),
+ displayString(12),
+ physAddress(13),
+ macAddress(14),
+ truthValue(15),
+ testAndIncr(16),
+ autonomousType(17),
+ variablePointer(18),
+ rowPointer(19),
+ rowStatus(20),
+ storageType(21),
+ tDomain(22),
+ tAddress(23),
+ other(100)
+ }
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The data type of the value that is present in dataValue varbind"
+::= { trapInfo 8 }
+
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,72 @@
+
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile for sun/agent/modules directory in SMA
+#
+# $Log: Makefile,v $
+# Revision 1.7 2003/09/04 17:53:26 rr144420
+# 4917378 - remove healthMonitor from makefiles
+#
+# Revision 1.6 2003/08/21 14:42:01 rr144420
+# 4908816 - further makefile changes to install into correct lib
+#
+# Revision 1.5 2003/08/12 21:14:38 rr144420
+# 4895376 - correct Sun copyright statements. Cannot use (c), and must use Copyright Copyright in makefiles
+#
+# Revision 1.4 2003/08/04 17:10:57 dporter
+# 4890836 - build new seaProxy module
+#
+# Revision 1.3 2003/07/31 21:34:44 pcarroll
+# Add seaExtensions to Makefile
+#
+# Revision 1.2 2003/07/28 19:27:15 augustus
+# This is the complete Entity MIB Implementation.
+#
+# Revision 1.1 2003/07/23 15:53:32 rr144420
+# new makefiles for building sun directory
+#
+#
+
+# removed healthMonitor
+
+SUBDIRS = entityMib seaExtensions
+
+all:
+ @if test "$(SUBDIRS)" != ""; then \
+ it="$(SUBDIRS)" ; \
+ for i in $$it ; do \
+ echo "making all in `pwd`/$$i"; \
+ echo "SUBDIRS3: $(MAKE) CC=$(CC) DEBUG=$(DEBUG) ARCH=$(ARCH)" ; \
+ ( cd $$i ; $(MAKE) CC=$(CC) DEBUG=$(DEBUG) ARCH=$(ARCH) ROOT=$(ROOT) ) ; \
+ echo "====> Makeing in dir $$i"; \
+ if test $$? != 0 ; then \
+ exit 1 ; \
+ fi \
+ done \
+ fi
+
+install:
+ @if test "$(SUBDIRS)" != ""; then \
+ it="$(SUBDIRS)" ; \
+ for i in $$it ; do \
+ echo "making install in `pwd`/$$i"; \
+ ( cd $$i ; $(MAKE) install ARCH=$(ARCH) ) ; \
+ if test $$? != 0 ; then \
+ exit 1 ; \
+ fi \
+ done \
+ fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,76 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate libentity.so
+#
+# usage:
+# "make" : generate library for 64bit / sparc
+# "make ARCH=32" : generate library for 32bit / sparc
+# "make ARCH=32 MACH=x86" : generate library for 32bit / x86
+# "make ARCH=amd64" : generate 64bit AMD64 libraries
+# "make clean" : remove *.o , *.so
+#
+
+MARCH=$(ARCH)
+LDFLAGS_sparcv9=-m64 -I$(ROOT)$(CFGPREFIX)/include -I.
+LDFLAGS_32=-I$(ROOT)$(CFGPREFIX)/include -I.
+LDFLAGS_amd64=-m64 -I$(ROOT)$(CFGPREFIX)/include -I.
+LDFLAGS=$(LDFLAGS_$(MARCH))
+
+LDLIBS=
+
+CFLAGS_32=-Kpic
+CFLAGS_sparcv9=-Kpic
+CFLAGS_amd64=-Kpic
+CFLAGS=$(CFLAGS_$(MARCH))
+
+PROG= libentity.so
+SRCS= entPhysicalTable.c entLPMappingTable.c entPhysicalContainsTable.c \
+ entLogicalTable.c entAliasMappingTable.c entLastChangeTime.c entity.c
+
+OBJS = $(SRCS:.c=.o)
+
+HEADERS= \
+ entAliasMappingTable.h \
+ entLogicalTable.h \
+ stdhdr.h \
+ entLPMappingTable.h \
+ entPhysicalContainsTable.h \
+ entLastChangeTime.h \
+ entPhysicalTable.h
+
+
+all:$(PROG)
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) $(LDLIBS) -G -o $@ $(OBJS)
+.c.o:
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -c $<
+
+clean:
+ rm -f entPhysicalTable.o entLPMappingTable.o \
+ entPhysicalContainsTable.o entLogicalTable.o \
+ entAliasMappingTable.o entLastChangeTime.o entity.o libentity.so
+
+install:
+ if test "$(ARCH)" = "sparcv9" ; then \
+ cp $(PROG) $(ROOT)/$(CFGLIB64); \
+ elif test "$(ARCH)" = "32" ; then \
+ cp $(PROG) $(ROOT)/$(CFGLIB); \
+ elif test "$(ARCH)" = "amd64" ; then \
+ cp $(PROG) $(ROOT)/$(CFGLIB64); \
+ fi
+
+#all
+#cp $(PROG) /usr/local/lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entAliasMappingTable.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,617 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.5 2002/12/16 22:50:18 hardaker Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "stdhdr.h"
+#include "entAliasMappingTable.h"
+#include "entLogicalTable.h"
+#include "entPhysicalTable.h"
+#include "entLastChangeTime.h"
+
+entAliasMappingTableEntry_t *gAliasMappingTableHead;
+int gAliasMappingTableSize;
+static logicalAlias *gCurAliasEntry;
+
+
+
+/** Initialize the entAliasMappingTable table by defining its contents and how it's structured */
+void
+initialize_table_entAliasMappingTable(void)
+{
+ static oid entAliasMappingTable_oid[] = {1,3,6,1,2,1,47,1,3,2};
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /* create the table structure itself */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /* if your table is read only, it's easiest to change the
+ HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
+ /* Fix for 4910624 - changing HANDLER_CAN_RWRITE to HANDLER_CAN_RONLY */
+ my_handler = netsnmp_create_handler_registration("entAliasMappingTable",
+ entAliasMappingTable_handler,
+ entAliasMappingTable_oid,
+ OID_LENGTH(entAliasMappingTable_oid),
+ HANDLER_CAN_RONLY);
+ /* End of Fix for 4910624 */
+
+ if (!my_handler || !table_info || !iinfo)
+ return; /* mallocs failed */
+
+ /***************************************************
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_INTEGER, /* index: entPhysicalIndex */
+ ASN_INTEGER, /* index: entAliasLogicalIndexOrZero */
+ 0);
+
+ table_info->min_column = 2;
+ table_info->max_column = 2;
+
+ /* iterator access routines */
+ iinfo->get_first_data_point = entAliasMappingTable_get_first_data_point;
+ iinfo->get_next_data_point = entAliasMappingTable_get_next_data_point;
+
+ iinfo->table_reginfo = table_info;
+
+ /***************************************************
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_entAliasMappingTable",
+ "Registering table entAliasMappingTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initializes the entAliasMappingTable module */
+void
+init_entAliasMappingTable(void)
+{
+
+ /* here we initialize all the tables we're planning on supporting */
+ initialize_table_entAliasMappingTable();
+ gAliasMappingTableSize = 0;
+ gAliasMappingTableHead = NULL;
+ gCurAliasEntry = NULL;
+}
+
+/** returns the first data point within the entAliasMappingTable table data.
+
+ Set the my_loop_context variable to the first data point structure
+ of your choice (from which you can find the next one). This could
+ be anything from the first node in a linked list, to an integer
+ pointer containing the beginning of an array variable.
+
+ Set the my_data_context variable to something to be returned to
+ you later that will provide you with the data to return in a given
+ row. This could be the same pointer as what my_loop_context is
+ set to, or something different.
+
+ The put_index_data variable contains a list of snmp variable
+ bindings, one for each index in your table. Set the values of
+ each appropriately according to the data matching the first row
+ and return the put_index_data variable at the end of the function.
+*/
+netsnmp_variable_list *
+entAliasMappingTable_get_first_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ netsnmp_variable_list *vptr;
+ entAliasMappingTableEntry_t *zRunner, *zpValidEntry;
+ logicalAlias *zlogicalAliases, *zValidAlias;
+ int bFound=0;
+
+ zRunner = gAliasMappingTableHead;
+ zpValidEntry = NULL;
+ gCurAliasEntry = NULL;
+ while (zRunner) {
+ if (zRunner->entPhysicalIndex > 0) {
+ zlogicalAliases = zRunner->entlogicalAliases;
+ while ((zlogicalAliases != NULL) &&
+ (zlogicalAliases->entAliasMapIdSize >= 0)){
+ if (zlogicalAliases->entAliasLogicalIndexorZero >= 0) {
+ bFound = 1;
+ break;
+ }
+ zlogicalAliases++;
+ }
+ if (bFound) {
+ zpValidEntry = zRunner;
+ zValidAlias = zlogicalAliases;
+ break;
+ }
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ if (zRunner == NULL) return NULL;
+
+ *my_loop_context = (void *) zpValidEntry;
+ *my_data_context = (void *) zValidAlias;
+ gCurAliasEntry = zValidAlias;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) &zpValidEntry->entPhysicalIndex, sizeof(zpValidEntry->entPhysicalIndex));
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) &zValidAlias->entAliasLogicalIndexorZero, sizeof(zValidAlias->entAliasLogicalIndexorZero));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+/** functionally the same as entAliasMappingTable_get_first_data_point, but
+ my_loop_context has already been set to a previous value and should
+ be updated to the next in the list. For example, if it was a
+ linked list, you might want to cast it and the return
+ my_loop_context->next. The my_data_context pointer should be set
+ to something you need later and the indexes in put_index_data
+ updated again. */
+
+netsnmp_variable_list *
+entAliasMappingTable_get_next_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ netsnmp_variable_list *vptr;
+ entAliasMappingTableEntry_t *zRunner, *zpValidEntry;
+ logicalAlias *zlogicalAliases, *zValidAlias;
+ int bFound=0;
+
+ zRunner = (entAliasMappingTableEntry_t *)*my_loop_context;
+ zlogicalAliases = (logicalAlias *) *my_data_context;
+ zlogicalAliases = gCurAliasEntry;
+
+ if (zlogicalAliases != NULL)
+ zlogicalAliases++;
+
+ while (zRunner) {
+ if (zRunner->entPhysicalIndex > 0) {
+ while ((zlogicalAliases != NULL) &&
+ (zlogicalAliases->entAliasMapIdSize >= 0)){
+ if (zlogicalAliases->entAliasLogicalIndexorZero >= 0) {
+ bFound = 1;
+ break;
+ }
+ zlogicalAliases++;
+ }
+ if (bFound) {
+ zpValidEntry = zRunner;
+ zValidAlias = zlogicalAliases;
+ break;
+ }
+ }
+ zRunner = zRunner->pNextEntry;
+ if (zRunner)
+ zlogicalAliases = zRunner->entlogicalAliases;
+ }
+ if (zRunner == NULL) return NULL;
+
+ *my_loop_context = (void *) zpValidEntry;
+ *my_data_context = (void *) zValidAlias;
+ gCurAliasEntry = zValidAlias;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) &zpValidEntry->entPhysicalIndex, sizeof(zpValidEntry->entPhysicalIndex));
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) &zValidAlias->entAliasLogicalIndexorZero, sizeof(zValidAlias->entAliasLogicalIndexorZero));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+/** handles requests for the entAliasMappingTable table, if anything else needs to be done */
+int
+entAliasMappingTable_handler(
+ netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests) {
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+ logicalAlias *zAliasEntry;
+
+ for(request = requests; request; request = request->next) {
+ var = request->requestvb;
+ if (request->processed != 0)
+ continue;
+
+ /* perform anything here that you need to do before each
+ request is processed. */
+
+ /* the following extracts the my_data_context pointer set in
+ the loop functions above. You can then use the results to
+ help return data for the columns of the entAliasMappingTable table in question */
+ zAliasEntry = (logicalAlias *) netsnmp_extract_iterator_context(request);
+ if (zAliasEntry == NULL) {
+ if (reqinfo->mode == MODE_GET) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ /* XXX: no row existed, if you support creation and this is a
+ set, start dealing with it here, else continue */
+ }
+
+ /* extracts the information about the table from the request */
+ table_info = netsnmp_extract_table_info(request);
+ /* table_info->colnum contains the column number requested */
+ /* table_info->indexes contains a linked list of snmp variable
+ bindings for the indexes of the table. Values in the list
+ have been set corresponding to the indexes of the
+ request */
+ if (table_info==NULL) {
+ continue;
+ }
+
+ switch(reqinfo->mode) {
+ /* the table_iterator helper should change all GETNEXTs
+ into GETs for you automatically, so you don't have to
+ worry about the GETNEXT case. Only GETs and SETs need
+ to be dealt with here */
+ case MODE_GET:
+ switch(table_info->colnum) {
+ case COLUMN_ENTALIASMAPPINGIDENTIFIER:
+ snmp_set_var_typed_value(var, ASN_OBJECT_ID, (u_char *) zAliasEntry->entAliasMapId, zAliasEntry->entAliasMapIdSize);
+ break;
+
+ default:
+ /* We shouldn't get here */
+ snmp_log(LOG_ERR, "problem encountered in entAliasMappingTable_handler: unknown column\n");
+ }
+ break;
+
+ case MODE_SET_RESERVE1:
+ /* set handling... */
+
+ default:
+ snmp_log(LOG_ERR, "problem encountered in entAliasMappingTable_handler: unsupported mode\n");
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+/* Add an entry into the Alias Mapping Table
+ returns 0 for success
+ 1 for entry already exist
+ -1 for failure
+ -2 for stale index
+*/
+
+int
+addAliasMappingTableEntry(int xentPhysicalIndex, int xentLogicalIndex,
+ oid *xAliasMapId, int xAliasMapIdSize)
+{
+ entAliasMappingTableEntry_t *zAliasTableEntry, *zRunner, *zlastEntry;
+ entPhysicalEntry_t *physentry;
+ entLogicalEntry_t *zLogicalEntry;
+ logicalAlias *zLogicalAliases;
+
+ /* Fix for 4927412: Rejects NULL xAliasMapId */
+ if (xAliasMapId == NULL)
+ return -1;
+ /* End of Fix for 4927412 */
+
+ /* Fix for 4888088: logical index cannot be smaller than zero, */
+ /* and physical index cannot be smaller than */
+ /* or equal to zero. -2 for stale entries */
+ if (xentPhysicalIndex <= 0 || xentPhysicalIndex > MAX_ENTITY_INDEX || xentLogicalIndex < 0 || xentLogicalIndex > MAX_ENTITY_INDEX)
+ return -1;
+ physentry = getPhysicalTableStaleEntry(xentPhysicalIndex);
+ if (physentry != NULL)
+ return -2;
+
+ zLogicalEntry = getLogicalTableStaleEntry(xentLogicalIndex);
+ if (zLogicalEntry != NULL)
+ return -2;
+ /* End of Fix for 4888088 */
+
+ physentry = getPhysicalTableEntry(xentPhysicalIndex);
+
+ if (physentry != NULL) {
+ if (physentry->entPhysicalClass != 10) return (-1);
+ } else return (-1);
+
+ if (xentLogicalIndex != 0) {
+ zLogicalEntry = getLogicalTableEntry(xentLogicalIndex);
+ if (zLogicalEntry == NULL) return (-1);
+ }
+ if (xAliasMapId == NULL) return (-1);
+
+ zlastEntry = NULL;
+ zRunner = gAliasMappingTableHead;
+ while (zRunner != NULL) {
+ if (zRunner->entPhysicalIndex == xentPhysicalIndex) {
+ break;
+ }
+ zlastEntry = zRunner;
+ zRunner = zRunner->pNextEntry;
+ }
+ if (zRunner != NULL ) {/* Found a entry with physical index */
+ logicalAlias *p;
+ p = zRunner->entlogicalAliases;
+ if (p == NULL) {
+ zLogicalAliases = (logicalAlias *) malloc(2 * sizeof (logicalAlias));
+ if (!zLogicalAliases) return -1;
+ zLogicalAliases[0].entAliasLogicalIndexorZero = xentLogicalIndex;
+ zLogicalAliases[0].entAliasMapId = malloc(xAliasMapIdSize);
+ if (!zLogicalAliases[0].entAliasMapId) return -1;
+ memcpy(zLogicalAliases[0].entAliasMapId, xAliasMapId,
+ xAliasMapIdSize);
+ zLogicalAliases[0].entAliasMapIdSize = xAliasMapIdSize;
+ zLogicalAliases[1].entAliasLogicalIndexorZero = 0;
+ zLogicalAliases[1].entAliasMapId = NULL;
+ zLogicalAliases[1].entAliasMapIdSize = -1;
+ zRunner->entlogicalAliases = zLogicalAliases;
+ } else {/* Add phy index to last entry in the array */
+ int i=0;
+ while (p != NULL && p->entAliasMapIdSize >= 0) {
+ if (p->entAliasLogicalIndexorZero == xentLogicalIndex) return (1);
+ if (p->entAliasMapIdSize < 0 ) {
+ p->entAliasLogicalIndexorZero = xentLogicalIndex;
+ p->entAliasMapId = malloc(xAliasMapIdSize);
+ if (!p->entAliasMapId) return -1;
+ memcpy(p->entAliasMapId, xAliasMapId, xAliasMapIdSize);
+ p->entAliasMapIdSize = xAliasMapIdSize;
+ }
+ p++;
+ i++;
+ }
+ zRunner->entlogicalAliases =
+ (logicalAlias *)realloc(zRunner->entlogicalAliases, (i + 2)*sizeof(logicalAlias));
+ zRunner->entlogicalAliases[i].entAliasLogicalIndexorZero =
+ xentLogicalIndex;
+ zRunner->entlogicalAliases[i].entAliasMapId =
+ malloc(xAliasMapIdSize);
+ if (!zRunner->entlogicalAliases[i].entAliasMapId) return -1;
+ memcpy(zRunner->entlogicalAliases[i].entAliasMapId, xAliasMapId,
+ xAliasMapIdSize);
+ zRunner->entlogicalAliases[i].entAliasMapIdSize = xAliasMapIdSize;
+ zRunner->entlogicalAliases[i+1].entAliasLogicalIndexorZero = 0;
+ zRunner->entlogicalAliases[i+1].entAliasMapId = NULL;
+ zRunner->entlogicalAliases[i+1].entAliasMapIdSize = -1;
+ }
+ configChanged();
+ return (0);
+ }
+
+ /* New entry*/
+ zAliasTableEntry = (entAliasMappingTableEntry_t *)malloc(sizeof(entAliasMappingTableEntry_t));
+ if (!zAliasTableEntry) return -1;
+ zAliasTableEntry->entPhysicalIndex = xentPhysicalIndex;
+ zLogicalAliases = (logicalAlias *) malloc(2 * sizeof (logicalAlias));
+ if (!zLogicalAliases) return -1;
+ zLogicalAliases[0].entAliasLogicalIndexorZero = xentLogicalIndex;
+ zLogicalAliases[0].entAliasMapId = malloc(xAliasMapIdSize);
+ if (!zLogicalAliases[0].entAliasMapId) return -1;
+ memcpy(zLogicalAliases[0].entAliasMapId, xAliasMapId,
+ xAliasMapIdSize);
+ zLogicalAliases[0].entAliasMapIdSize = xAliasMapIdSize;
+ zLogicalAliases[1].entAliasLogicalIndexorZero = 0;
+ zLogicalAliases[1].entAliasMapId = NULL;
+ zLogicalAliases[1].entAliasMapIdSize = -1;
+ zAliasTableEntry->entlogicalAliases = zLogicalAliases;
+ zAliasTableEntry->pNextEntry = NULL;
+ if (gAliasMappingTableHead){
+ zlastEntry->pNextEntry = zAliasTableEntry;
+ } else {
+ gAliasMappingTableHead = zAliasTableEntry;
+ }
+ gAliasMappingTableSize++;
+ configChanged();
+ return (0);
+}
+
+/* Returns 0 for successful deletion
+ -1 for entry not found
+ -2 for stale entry
+*/
+int
+deleteAliasMappingTableEntry(int xentPhysicalIndex, int xentLogicalIndex)
+{
+ entAliasMappingTableEntry_t *zRunner;
+ logicalAlias *zLogicalAliases;
+ int zPhyIndx;
+ entPhysicalEntry_t *zPhysicalEntry;
+ entLogicalEntry_t *zLogicalEntry;
+
+ /* Fix for 4888088: logical index cannot be smaller than zero, */
+ /* and physical index cannot be smaller than */
+ /* or equal to zero. -2 for stale entries */
+ if (xentPhysicalIndex <= 0 || xentPhysicalIndex > MAX_ENTITY_INDEX || xentLogicalIndex < 0 || xentLogicalIndex > MAX_ENTITY_INDEX)
+ return -1;
+ zPhysicalEntry = getPhysicalTableStaleEntry(xentPhysicalIndex);
+ if (zPhysicalEntry != NULL)
+ return -2;
+
+ zLogicalEntry = getLogicalTableStaleEntry(xentLogicalIndex);
+ if (zLogicalEntry != NULL)
+ return -2;
+ /* End of Fix for 4888088 */
+
+ zRunner = gAliasMappingTableHead;
+
+ while (zRunner != NULL) {
+ zPhyIndx = zRunner->entPhysicalIndex;
+
+ if (zPhyIndx > 0) {
+ if (zPhyIndx == xentPhysicalIndex) {
+ zLogicalAliases = zRunner->entlogicalAliases;
+ while (zLogicalAliases != NULL
+ && zLogicalAliases->entAliasMapIdSize >= 0) {
+ int zLogIndx = zLogicalAliases->entAliasLogicalIndexorZero;
+ if (zLogIndx >=0 ) {
+ if (zLogIndx == xentLogicalIndex) {
+ zLogicalAliases->entAliasLogicalIndexorZero = -1;
+ free(zLogicalAliases->entAliasMapId);
+ zLogicalAliases->entAliasMapId = NULL;
+ zLogicalAliases->entAliasMapIdSize = 0;
+ configChanged();
+ return (0);
+ }
+ }
+ zLogicalAliases++;
+ }
+ return (-1); /* Entry not found */
+ }
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ return (-1);
+}
+
+static int
+FreeAliasMappingTableEntry(entAliasMappingTableEntry_t *xEntry)
+{
+ logicalAlias *zAliases;
+ int nEntries=0;
+ if (xEntry == NULL) return (-1);
+ zAliases = xEntry->entlogicalAliases;
+ while (zAliases != NULL && zAliases->entAliasMapIdSize >= 0) {
+ /* Fix for 4906853: we only need to free it (and count) if */
+ /* entAliasMapId != NULL. A better fix is to use a link list */
+ /* instead of an array for this structure */
+ if (zAliases->entAliasMapId != NULL) {
+ free(zAliases->entAliasMapId);
+ nEntries++;
+ }
+ /* End of Fix for 4906853 */
+ zAliases++;
+ }
+ free(xEntry->entlogicalAliases);
+ free(xEntry);
+ xEntry = NULL;
+ return nEntries;
+}
+
+/* Deletes all the entries in the table with primary index as
+ given physical index
+ Return number of entries deleted on success,
+ -1 on failure
+ -2 for a existing stale entry
+*/
+
+int
+deleteAliasMappingPhysicalIndex(int xentPhysicalIndex)
+{
+ entAliasMappingTableEntry_t *zRunner, *temp, *prevEntry;
+ int zPhyIndx, nEntries=0;
+ entPhysicalEntry_t *zPhysicalEntry;
+
+ /* Fix for 4888088: We do not need the check for 4883511 anymore, */
+ /* because entAliasLogicalIndexorZero will never be set */
+ /* to negative values. Instead we will check if the */
+ /* entries are stale (except when xentLogicalIndex = 0) */
+ if (xentPhysicalIndex <= 0 || xentPhysicalIndex > MAX_ENTITY_INDEX)
+ return -1;
+ zPhysicalEntry = getPhysicalTableStaleEntry(xentPhysicalIndex);
+ if (zPhysicalEntry != NULL)
+ return -2;
+ /* End of Fix for 4888088 */
+
+ zRunner = gAliasMappingTableHead;
+ prevEntry = NULL;
+
+ while (zRunner != NULL) {
+ zPhyIndx = zRunner->entPhysicalIndex;
+
+ if (zPhyIndx > 0) {
+ if (zPhyIndx == xentPhysicalIndex) {
+ temp = zRunner->pNextEntry;
+ zRunner->pNextEntry = NULL;
+ if (prevEntry)
+ prevEntry->pNextEntry = temp;
+ else
+ gAliasMappingTableHead = temp;
+ nEntries = FreeAliasMappingTableEntry(zRunner);
+ gAliasMappingTableSize--;
+ configChanged();
+ return nEntries;
+ }
+ }
+ prevEntry = zRunner;
+ zRunner = zRunner->pNextEntry;
+ }
+ return (-1);
+}
+
+/* Deletes all entries of the table for a given logical index.
+ Returns the number if entries deleted
+ -1 if the entry is not found
+ -2 if the logical index is stale
+ The memory allocated is freed when the primary index, physical index
+ is deleted.
+*/
+int
+deleteAliasMappingLogicalIndex(int xentLogicalIndex)
+{
+ entAliasMappingTableEntry_t *zRunner;
+ logicalAlias *zLogicalAliases;
+ int zPhyIndx, nFound=0;
+ entLogicalEntry_t *zLogicalEntry;
+
+ /* Fix for 4888088: Here we are not allowing logical index = 0. We are */
+ /* forcing the user to use deleteAliasMappingTableEntry */
+ if (xentLogicalIndex <= 0 || xentLogicalIndex > MAX_ENTITY_INDEX)
+ return -1;
+ zLogicalEntry = getLogicalTableStaleEntry(xentLogicalIndex);
+ if (zLogicalEntry != NULL)
+ return -2;
+ /* End of Fix for 4888088 */
+
+ zRunner = gAliasMappingTableHead;
+
+ while (zRunner != NULL) {
+ zPhyIndx = zRunner->entPhysicalIndex;
+ if (zPhyIndx > 0) {
+ zLogicalAliases = zRunner->entlogicalAliases;
+ while (zLogicalAliases != NULL
+ && zLogicalAliases->entAliasMapIdSize >= 0) {
+ int zLogIndx = zLogicalAliases->entAliasLogicalIndexorZero;
+ if (zLogIndx >= 0 ) {
+ if (zLogIndx == xentLogicalIndex) {
+ zLogicalAliases->entAliasLogicalIndexorZero = -1;
+ free(zLogicalAliases->entAliasMapId);
+ zLogicalAliases->entAliasMapId = NULL;
+ zLogicalAliases->entAliasMapIdSize = 0;
+ nFound++;
+ break;
+ }
+ }
+ zLogicalAliases++;
+ }
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ /* Fix for 4888088 */
+ if (nFound) {
+ configChanged();
+ return (nFound);
+ } else {
+ return -1;
+ }
+ /* End of Fix for 4888088 */
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entAliasMappingTable.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.5 2002/12/16 22:50:18 hardaker Exp $
+ */
+#ifndef ENTALIASMAPPINGTABLE_H
+#define ENTALIASMAPPINGTABLE_H
+
+/* function declarations */
+void init_entAliasMappingTable(void);
+void initialize_table_entAliasMappingTable(void);
+Netsnmp_Node_Handler entAliasMappingTable_handler;
+
+Netsnmp_First_Data_Point entAliasMappingTable_get_first_data_point;
+Netsnmp_Next_Data_Point entAliasMappingTable_get_next_data_point;
+
+/* column number definitions for table entAliasMappingTable */
+ #define COLUMN_ENTALIASLOGICALINDEXORZERO 1
+ #define COLUMN_ENTALIASMAPPINGIDENTIFIER 2
+
+typedef struct logicalAlias_s {
+ int_l entAliasLogicalIndexorZero;
+ oid *entAliasMapId;
+ int_l entAliasMapIdSize;
+} logicalAlias;
+
+typedef struct entAliasMappingTableEntry_s {
+ int_l entPhysicalIndex;
+ logicalAlias *entlogicalAliases; /*array of LogicalAlias structs*/
+ struct entAliasMappingTableEntry_s *pNextEntry;
+} entAliasMappingTableEntry_t;
+
+extern int addAliasMappingTableEntry(int, int, oid*, int);
+extern int deleteAliasMappingLogicalIndex(int xentLogicalIndex);
+extern int deleteAliasMappingPhysicalIndex(int xentPhysicalIndex);
+extern int deleteAliasMappingTableEntry(int xentPhysicalIndex, int xentLogicalIndex);
+
+
+
+
+
+#endif /* ENTALIASMAPPINGTABLE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entLPMappingTable.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,606 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+#pragma ident "@(#)entLPMappingTable.c 1.1 03/02/24 SMI"
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.4 2002/09/11 22:42:04 hardaker Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "stdhdr.h"
+#include "entLPMappingTable.h"
+#include "entLogicalTable.h"
+#include "entPhysicalTable.h"
+#include "entLastChangeTime.h"
+
+typedef struct LPIndex_s {
+ entLPMappingTableEntry_t *pLPEntry;
+ int_l *pPhyIndex; /* Pointer to the current phy index */
+} LPIndex_t;
+
+static LPIndex_t tracker;
+
+
+entLPMappingTableEntry_t* gLPMappingTableHead;
+int gLPMappingTableSize;
+
+/*
+ * Initialize the entLPMappingTable table by defining its contents and how
+ * it's structured
+ */
+void
+initialize_table_entLPMappingTable(void)
+{
+ static oid entLPMappingTable_oid[] = { 1, 3, 6, 1, 2, 1, 47, 1, 3, 1 };
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /*
+ * create the table structure itself
+ */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /*
+ * if your table is read only, it's easiest to change the
+ * HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY
+ */
+ my_handler =
+ netsnmp_create_handler_registration("entLPMappingTable",
+ entLPMappingTable_handler, entLPMappingTable_oid,
+ OID_LENGTH(entLPMappingTable_oid), HANDLER_CAN_RONLY);
+
+ if (!my_handler || !table_info || !iinfo)
+ return; /* mallocs failed */
+
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_INTEGER, /* index: entLogicalIndex */
+ ASN_INTEGER, /* index: entLPPhysicalIndex */
+ 0);
+
+ table_info->min_column = 1;
+ table_info->max_column = 1;
+
+ /*
+ * iterator access routines
+ */
+ iinfo->get_first_data_point = entLPMappingTable_get_first_data_point;
+ iinfo->get_next_data_point = entLPMappingTable_get_next_data_point;
+
+ iinfo->table_reginfo = table_info;
+
+ /*
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_entLPMappingTable",
+ "Registering table entLPMappingTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/* Initializes the entLPMappingTable module */
+void
+init_entLPMappingTable(void)
+{
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_entLPMappingTable();
+ gLPMappingTableSize = 0;
+ gLPMappingTableHead = NULL;
+}
+
+/*
+ * returns the first data point within the entLPMappingTable table data.
+ *
+ * Set the my_loop_context variable to the first data point structure
+ * of your choice (from which you can find the next one). This could
+ * be anything from the first node in a linked list, to an integer
+ * pointer containing the beginning of an array variable.
+ *
+ * Set the my_data_context variable to something to be returned to
+ * you later that will provide you with the data to return in a given
+ * row. This could be the same pointer as what my_loop_context is
+ * set to, or something different.
+ *
+ * The put_index_data variable contains a list of snmp variable
+ * bindings, one for each index in your table. Set the values of
+ * each appropriately according to the data matching the first row
+ * and return the put_index_data variable at the end of the function.
+ */
+netsnmp_variable_list *
+entLPMappingTable_get_first_data_point(void **my_loop_context,
+ void **my_data_context, netsnmp_variable_list * put_index_data,
+ netsnmp_iterator_info * mydata)
+{
+ netsnmp_variable_list *vptr;
+ entLPMappingTableEntry_t *zRunner, *zpValidEntry;
+ int_l *zPhyIndexes, zValidPhyIdx=0, *zpValidPhyIdx;
+
+ zRunner = gLPMappingTableHead;
+ while (zRunner) {
+ if (zRunner->entLogicalIndex > 0) {
+ zPhyIndexes = zRunner->physicalIndexes;
+ while ((zPhyIndexes != NULL) && (*zPhyIndexes != 0)){
+ if (*zPhyIndexes > 0) {
+ zValidPhyIdx = *zPhyIndexes;
+ break;
+ }
+ zPhyIndexes++;
+ }
+ if (zValidPhyIdx) {
+ zpValidEntry = zRunner;
+ zpValidPhyIdx = zPhyIndexes;
+ break;
+ }
+ }
+ zRunner = zRunner->pNextLPMappingTableEntry;
+ }
+ if (zRunner == NULL) return NULL;
+
+ *my_loop_context = (void *) zpValidEntry;
+ *my_data_context = (void *) zpValidPhyIdx;
+ tracker.pPhyIndex = zpValidPhyIdx;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) &zpValidEntry->entLogicalIndex,
+ sizeof(zpValidEntry->entLogicalIndex));
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) zpValidPhyIdx, sizeof(int_l));
+ vptr = vptr->next_variable;
+
+ return (put_index_data);
+}
+
+/*
+ * functionally the same as entLPMappingTable_get_first_data_point, but
+ * my_loop_context has already been set to a previous value and should
+ * be updated to the next in the list. For example, if it was a
+ * linked list, you might want to cast it and the return
+ * my_loop_context->next. The my_data_context pointer should be set
+ * to something you need later and the indexes in put_index_data
+ * updated again.
+ */
+
+netsnmp_variable_list *
+entLPMappingTable_get_next_data_point(void **my_loop_context,
+ void **my_data_context, netsnmp_variable_list * put_index_data,
+ netsnmp_iterator_info * mydata)
+{
+ netsnmp_variable_list *vptr;
+ entLPMappingTableEntry_t *zRunner, *zpValidEntry;
+ int_l *zPhyIndexes, zValidPhyIdx=0, *zpValidPhyIdx;
+
+ zRunner = (entLPMappingTableEntry_t *)*my_loop_context;
+ zPhyIndexes = tracker.pPhyIndex;
+ if (zPhyIndexes != NULL)
+ zPhyIndexes++;
+ while (zRunner) {
+ if (zRunner->entLogicalIndex > 0) {
+ while ((zPhyIndexes != NULL) && (*zPhyIndexes != 0)){
+ if (*zPhyIndexes > 0) {
+ zValidPhyIdx = *zPhyIndexes;
+ break;
+ }
+ zPhyIndexes++;
+ }
+ if (zValidPhyIdx) {
+ zpValidEntry = zRunner;
+ zpValidPhyIdx = zPhyIndexes;
+ break;
+ }
+ }
+ zRunner = zRunner->pNextLPMappingTableEntry;
+ if (zRunner)
+ zPhyIndexes = zRunner->physicalIndexes;
+ }
+ if (zRunner == NULL) return NULL;
+
+
+ *my_loop_context = (void *) zpValidEntry;
+ *my_data_context = (void *) zpValidPhyIdx;
+ tracker.pPhyIndex = zpValidPhyIdx;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) &zpValidEntry->entLogicalIndex,
+ sizeof(int_l));
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) zpValidPhyIdx, sizeof(int_l));
+ vptr = vptr->next_variable;
+
+ return (put_index_data);
+}
+
+/*
+ * handles requests for the entLPMappingTable table, if anything else
+ * needs to be done
+ */
+int
+entLPMappingTable_handler(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)
+{
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+ int_l *idx;
+
+ for (request = requests; request; request = request->next) {
+ var = request->requestvb;
+ if (request->processed != 0)
+ continue;
+
+ /*
+ * perform anything here that you need to do. The request have
+ * already been processed by the master table_dataset handler,
+ * but this gives you chance to act on the request in some
+ * other way if need be.
+ */
+
+ /*
+ * the following extracts the my_data_context pointer set in
+ * the loop functions above. You can then use the results to
+ * help return data for the columns of the entLPMappingTable
+ * table in question
+ */
+ /*
+ * XXX
+ */
+ idx = (int_l *) netsnmp_extract_iterator_context(request);
+ if (idx == NULL) {
+ if (reqinfo->mode == MODE_GET) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ /*
+ * XXX: no row existed, if you support creation and
+ * this is a set, start dealing with it here, else
+ * continue
+ */
+ }
+
+ /*
+ * extracts the information about the table from the request
+ */
+ table_info = netsnmp_extract_table_info(request);
+ /*
+ * table_info->colnum contains the column number requested
+ */
+ /*
+ * table_info->indexes contains a linked list of snmp variable
+ * bindings for the indexes of the table. Values in the list
+ * have been set corresponding to the indexes of the
+ * request
+ */
+ if (table_info == NULL) {
+ continue;
+ }
+
+ switch (reqinfo->mode) {
+ /*
+ * the table_iterator helper should change all GETNEXTs
+ * into GETs for you automatically, so you don't have to
+ * worry about the GETNEXT case. Only GETs and SETs need
+ * to be dealt with here
+ */
+ case MODE_GET:
+ switch (table_info->colnum) {
+ case COLUMN_ENTLPPHYSICALINDEX:
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (u_char *) idx,
+ sizeof (idx));
+ break;
+
+ default:
+ /*
+ * We shouldn't get here
+ */
+ snmp_log(LOG_ERR, "problem encountered in entLPMappingTable_handler: unknown column\n");
+ }
+ break;
+
+ case MODE_SET_RESERVE1:
+ /*
+ * set handling...
+ */
+
+ default:
+ snmp_log(LOG_ERR, "problem encountered in entLPMappingTable_handler: unsupported mode\n");
+ }
+ }
+ return (SNMP_ERR_NOERROR);
+}
+
+/* Return 0 for success
+ 1 for entry already exists
+ -1 for failure
+ -2 for stale index */
+int
+addLPMappingTableEntry(int xentLogicalIndex, int xentPhysicalIndex)
+{
+ entLogicalEntry_t *zLogicalEntry;
+ entPhysicalEntry_t *physentry;
+ entLPMappingTableEntry_t *zLPMappingTableEntry, *zRunner, *zlastEntry;
+ int_l *zPhyIndexes;
+
+ /* Fix for 4888088: return -1 for out of bound index, return -2 for */
+ /* stale entry */
+ if (xentLogicalIndex <= 0 || xentLogicalIndex > MAX_ENTITY_INDEX || xentPhysicalIndex <= 0 || xentPhysicalIndex > MAX_ENTITY_INDEX)
+ return -1;
+ zLogicalEntry = getLogicalTableStaleEntry(xentLogicalIndex);
+ physentry = getPhysicalTableStaleEntry(xentPhysicalIndex);
+ if ((zLogicalEntry != NULL) || (physentry != NULL)) {
+ return -2;
+ }
+ /* End of Fix for 4888088 */
+
+ zLogicalEntry = getLogicalTableEntry(xentLogicalIndex);
+ physentry = getPhysicalTableEntry(xentPhysicalIndex);
+
+ if ((zLogicalEntry == NULL) || (physentry == NULL)) {
+/*
+ Handle error here. Send it to log files
+*/
+ return (-1);
+ }
+ zlastEntry = NULL;
+ zRunner = gLPMappingTableHead;
+ while (zRunner != NULL) {
+ if (zRunner->entLogicalIndex == xentLogicalIndex) {
+ break;
+ }
+ zlastEntry = zRunner;
+ zRunner = zRunner->pNextLPMappingTableEntry;
+ }
+ if (zRunner != NULL ) {/* Found a entry with log index */
+ int_l *p;
+ p = zRunner->physicalIndexes;
+ if (p == NULL) {
+ zPhyIndexes = (int_l *) malloc(2 * sizeof (int_l));
+ if (!zPhyIndexes) return -1;
+ zPhyIndexes[0] = xentPhysicalIndex;
+ zPhyIndexes[1] = 0;
+ zRunner->physicalIndexes = zPhyIndexes;
+ } else {/* Add phy index to last entry in the array */
+ int i=0;
+ while (p != NULL && *p != 0) {
+ /* Fix for 4888088: entry already exists, return 1 */
+ if (*p == xentPhysicalIndex)
+ return (1);
+ /* End of Fix for 4888088 */
+ if (*p == -xentPhysicalIndex) { /* Reuse a 'deleted' entry */
+ *p = xentPhysicalIndex;
+ /* Fix for 4928821 - does not generate notification event */
+ configChanged();
+ /* End of Fix for 4928821 */
+ return (0);
+ }
+ p++;
+ i++;
+ }
+ zRunner->physicalIndexes =
+ (int_l *)realloc(zRunner->physicalIndexes, (i + 2)*sizeof(int_l));
+ zRunner->physicalIndexes[i] = xentPhysicalIndex;
+ zRunner->physicalIndexes[i+1] = 0;
+ }
+ configChanged();
+ return (0);
+ }
+
+ /* New entry*/
+ zLPMappingTableEntry = (entLPMappingTableEntry_t *)malloc(sizeof(entLPMappingTableEntry_t));
+ if (!zLPMappingTableEntry) return -1; /* malloc failed */
+ zLPMappingTableEntry->entLogicalIndex = xentLogicalIndex;
+ zPhyIndexes = (int_l *) malloc(2 * sizeof (int_l));
+ if (!zPhyIndexes) return -1;
+ zPhyIndexes[0] = xentPhysicalIndex;
+ zPhyIndexes[1] = 0;
+ zLPMappingTableEntry->physicalIndexes = zPhyIndexes;
+ zLPMappingTableEntry->pNextLPMappingTableEntry = NULL;
+ if (gLPMappingTableHead){
+ zlastEntry->pNextLPMappingTableEntry = zLPMappingTableEntry;
+ } else {
+ gLPMappingTableHead = zLPMappingTableEntry;
+ }
+ gLPMappingTableSize++;
+ configChanged();
+ return (0);
+}
+
+
+/*
+ This function deletes the table entries for a given logical index
+ and physical index.
+ Returns 0 for success,
+ -1 for failure,
+ -2 for stale entry
+ */
+int
+deleteLPMappingTableEntry(int xentLogicalIndex, int xentPhysicalIndex)
+{
+ entLPMappingTableEntry_t *zRunner;
+ int_l *p;
+
+ /* Fix for 4888088: return -1 for invalid index, -2 for stale entry */
+ entLogicalEntry_t *zLogicalEntry;
+ entPhysicalEntry_t *zPhysicalEntry;
+
+ if (xentLogicalIndex <= 0 || xentLogicalIndex > MAX_ENTITY_INDEX || xentPhysicalIndex <= 0 || xentPhysicalIndex > MAX_ENTITY_INDEX)
+ return -1;
+ zLogicalEntry = getLogicalTableStaleEntry(xentLogicalIndex);
+ if (zLogicalEntry != NULL)
+ return -2;
+
+ zPhysicalEntry = getPhysicalTableStaleEntry(xentPhysicalIndex);
+ if (zPhysicalEntry != NULL)
+ return -2;
+
+ zLogicalEntry = getLogicalTableEntry(xentLogicalIndex);
+ if (zLogicalEntry == NULL)
+ return -1;
+ zPhysicalEntry = getPhysicalTableEntry(xentPhysicalIndex);
+ if (zPhysicalEntry == NULL)
+ return -1;
+ /* End of Fix for 4888088 */
+
+ zRunner = gLPMappingTableHead;
+ while (zRunner != NULL) {
+ if ((zRunner->entLogicalIndex == xentLogicalIndex)) {
+ p = zRunner->physicalIndexes;
+ while (p != NULL && *p != 0) {
+ if (*p == xentPhysicalIndex) {
+ *p = -xentPhysicalIndex;
+ configChanged();
+ return (0);
+ }
+ p++;
+ }
+ return (-1);
+ }
+ zRunner = zRunner->pNextLPMappingTableEntry;
+ }
+ return (-1);
+}
+
+static int
+FreeLPMappingTableEntry(entLPMappingTableEntry_t *xEntry)
+{
+ int nFound = 0;
+ /* Fix for 4888088 */
+ int_l *zPhyIndexes;
+ /* End of Fix for 4888088 */
+
+ if (xEntry == NULL) return (-1);
+ /* Fix for 4888088: We need to count the number of entries deleted, and */
+ /* return that accordingly. Hence the loop */
+ zPhyIndexes = xEntry->physicalIndexes;
+ while ((zPhyIndexes != NULL) && (*zPhyIndexes != 0)) {
+ if (*zPhyIndexes > 0) {
+ /* Only count valid entries (i.e. non-negative ones) */
+ nFound++;
+ }
+ zPhyIndexes++;
+ }
+ /* End of Fix for 4888088 */
+ free(xEntry->physicalIndexes);
+ free(xEntry);
+ xEntry = NULL;
+ /* Fix for 4888088 */
+ return (nFound);
+ /* End of Fix for 4888088 */
+}
+
+/* Returns num of successful deletion
+ -1 for entry not found
+ -2 for stale physical entry
+*/
+int
+deleteLPMappingPhysicalIndex(int xentPhysicalIndex) {
+ entLPMappingTableEntry_t *zRunner;
+ int_l *p;
+ int num=0;
+
+ /* Fix for 4888088: -2 for stale entry, -1 for invalid index */
+ entPhysicalEntry_t *zPhysicalEntry;
+ if (xentPhysicalIndex <= 0 || xentPhysicalIndex > MAX_ENTITY_INDEX)
+ return -1;
+ zPhysicalEntry = getPhysicalTableStaleEntry(xentPhysicalIndex);
+ if (zPhysicalEntry != NULL)
+ return -2;
+ zPhysicalEntry = getPhysicalTableEntry(xentPhysicalIndex);
+ if (zPhysicalEntry == NULL)
+ return -1;
+ /* End of Fix for 4888088 */
+
+ zRunner = gLPMappingTableHead;
+ while (zRunner != NULL) {
+ p = zRunner->physicalIndexes;
+ while (p != NULL && *p != 0) {
+ if (*p == xentPhysicalIndex) {
+ *p = -xentPhysicalIndex;
+ num++;
+ break;
+ }
+ p++;
+ }
+ zRunner = zRunner->pNextLPMappingTableEntry;
+ }
+ if (num) {
+ configChanged();
+ return (num);
+ } else {
+ return -1;
+ }
+}
+
+/* Returns num of successful deletion
+ -1 for entry not found
+ -2 for stale logical entry
+*/
+int
+deleteLPMappingLogicalIndex(int xentLogicalIndex) {
+ entLPMappingTableEntry_t *zRunner, *temp, *prevEntry;
+ int zLogicalIndex, nEntries=0;
+
+ /* Fix for 4888088: -1 for invalid index, -2 for stale entry */
+ entLogicalEntry_t *zLogicalEntry;
+ if (xentLogicalIndex <= 0 || xentLogicalIndex > MAX_ENTITY_INDEX)
+ return -1;
+ zLogicalEntry = getLogicalTableStaleEntry(xentLogicalIndex);
+ if (zLogicalEntry != NULL)
+ return -2;
+ zLogicalEntry = getLogicalTableEntry(xentLogicalIndex);
+ if (zLogicalEntry == NULL)
+ return -1;
+ /* End of Fix for 4888088 */
+
+ zRunner = gLPMappingTableHead;
+ prevEntry = NULL;
+ while (zRunner != NULL) {
+ zLogicalIndex = zRunner->entLogicalIndex;
+ if (zLogicalIndex > 0) {
+ if (zLogicalIndex == xentLogicalIndex) {
+ temp = zRunner->pNextLPMappingTableEntry;
+ zRunner->pNextLPMappingTableEntry = NULL;
+ if (prevEntry)
+ prevEntry->pNextLPMappingTableEntry = temp;
+ else
+ gLPMappingTableHead = temp;
+ /* Fix for 4888088: we are going to return the number of */
+ /* entries removed */
+ nEntries = FreeLPMappingTableEntry(zRunner);
+ /* End of Fix for 4888088 */
+ gLPMappingTableSize--;
+ configChanged();
+ /* Fix for 4888088 */
+ return (nEntries); /* Successful deletion */
+ /* End of Fix for 4888088 */
+ }
+ }
+ prevEntry = zRunner;
+ zRunner = zRunner->pNextLPMappingTableEntry;
+ }
+ return (-1); /* Entry not found */
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entLPMappingTable.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+#pragma ident "@(#)entLPMappingTable.h 1.1 03/02/24 SMI"
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.4 2002/09/11 22:42:04 hardaker Exp $
+ */
+#ifndef ENTLPMAPPINGTABLE_H
+#define ENTLPMAPPINGTABLE_H
+
+/*
+ * function declarations
+ */
+void init_entLPMappingTable(void);
+void initialize_table_entLPMappingTable(void);
+Netsnmp_Node_Handler entLPMappingTable_handler;
+
+Netsnmp_First_Data_Point entLPMappingTable_get_first_data_point;
+Netsnmp_Next_Data_Point entLPMappingTable_get_next_data_point;
+
+/*
+ * column number definitions for table entLPMappingTable
+ */
+#define COLUMN_ENTLPPHYSICALINDEX 1
+
+typedef struct entLPMappingTableEntry_s {
+ int_l entLogicalIndex;
+ int_l *physicalIndexes; /* array of Physical Table indexes */
+ struct entLPMappingTableEntry_s *pNextLPMappingTableEntry;
+} entLPMappingTableEntry_t;
+
+extern int addLPMappingTableEntry(int xentLogicalIndex, int xentPhysicalIndex);
+
+/*
+ This function deletes the table entries for a given logical index
+ and physical index.
+
+ Returns 1 for success and -1 for failure.
+*/
+
+extern int deleteLPMappingTableEntry(int xLogicalIndex, int xPhysicalIndex);
+extern int deleteLPMappingLogicalIndex(int xentLogicalIndex);
+extern int deleteLPMappingPhysicalIndex(int xentPhysicalIndex);
+
+
+#endif /* ENTLPMAPPINGTABLE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entLastChangeTime.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+#pragma ident "@(#)entLastChangeTime.c 1.1 03/02/24 SMI"
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "stdhdr.h"
+#include "entLastChangeTime.h"
+
+/* Fix for 4929068 */
+static int creg;
+/* End of Fix for 4929068 */
+
+static void poll_entLastChangeTime();
+static void send_entConfigChange_trap();
+
+/* time between entConfigChange traps in 1/1000th of a second */
+#define TRAP_THROTTLE_PERIOD 5000
+/* Fix for 4929068 */
+#define TRAP_THROTTLE_PERIOD_SECS TRAP_THROTTLE_PERIOD/1000
+/* End of Fix for 4929068 */
+
+/* Fix for 4928832 */
+/* Static storage for markers */
+static struct timeval entLastChangeTimeStorage;
+static struct timeval trapLastIssuedStorage;
+
+/* Pointers to storage for markers */
+static marker_t entLastChangeTime;
+static marker_t trapLastIssued;
+/* End of Fix for 4928832 */
+
+/* 4929068 - structures for debugging throttling period waits
+static struct timeval alarmTimeStorage;
+static marker_t alarmTime;
+*/
+
+static oid entityMIBTrapsOID[] = { entityMIBTraps };
+
+
+/*
+ * returns the value of sysUpTime in TimeTicks
+ */
+static unsigned long
+entLastChangeTime_TimeTicks()
+{
+ return (unsigned long) netsnmp_marker_uptime(entLastChangeTime) &
+ 0xFFFFFFFF;
+}
+
+/* Initializes the entLastChangeTime module */
+void
+init_entLastChangeTime(void)
+{
+ static oid entLastChangeTime_oid[] =
+ { 1, 3, 6, 1, 2, 1, 47, 1, 4, 1, 0 };
+
+ DEBUGMSGTL(("entLastChangeTime", "Initializing\n"));
+
+/* Fix for 4928832 */
+ entLastChangeTime = (marker_t)&entLastChangeTimeStorage;
+ trapLastIssued = (marker_t)&trapLastIssuedStorage;
+/* End of Fix for 4928832 */
+/* Fix for 4928828 */
+ entLastChangeTimeStorage.tv_sec = 0;
+ entLastChangeTimeStorage.tv_usec = 0;
+ atime_setMarker(entLastChangeTime);
+/* End of Fix for 4928828 */
+
+/* 4929068 - debug code
+ alarmTime = (marker_t)&alarmTimeStorage;
+*/
+
+ if (!entLastChangeTime || !trapLastIssued)
+ return;
+
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("entLastChangeTime", get_entLastChangeTime, entLastChangeTime_oid,
+ OID_LENGTH(entLastChangeTime_oid), HANDLER_CAN_RONLY));
+}
+
+/* Fix for 4929068 */
+/*
+ * alarm_entLastChangeTime - called after throttle period over,
+ * poll to see if anything was suppressed.
+ */
+static void alarm_entLastChangeTime(unsigned int regnum, void *data) {
+/* 4929068 - debug code
+ atime_setMarker(alarmTime);
+ printf("alarm_entLastChangeTime, marker time = %d\n",
+ (netsnmp_marker_uptime(alarmTime) & 0xFFFFFFFF));
+*/
+
+ poll_entLastChangeTime();
+}
+/* End of Fix for 4929068 */
+
+int
+get_entLastChangeTime(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)
+{
+ unsigned long t;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ t = entLastChangeTime_TimeTicks();
+ snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS,
+ (u_char *) & t, sizeof (t));
+ break;
+
+ default:
+ /*
+ * we should never get here, so this is a really bad error
+ */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+void
+configChanged()
+{
+ atime_setMarker(entLastChangeTime);
+ poll_entLastChangeTime();
+}
+
+static void
+poll_entLastChangeTime()
+{
+ long diff;
+
+ /* don't issue trap if within throttle period */
+ if (!atime_ready(trapLastIssued, TRAP_THROTTLE_PERIOD))
+ return;
+
+ diff = atime_diff(entLastChangeTime, trapLastIssued);
+ if (diff <= 0 ) {
+ /* there was a change since the last trap was issued */
+
+ send_entConfigChange_trap();
+
+ atime_setMarker(trapLastIssued);
+ /* Fix for 4929068 */
+ /*
+ * Set up alarm to wake up TRAP_THROTTLE_PERIOD_SECS seconds
+ * after the last trap was sent. If anything was suppressed,
+ * a trap will be sent.
+ */
+ creg = snmp_alarm_register(TRAP_THROTTLE_PERIOD_SECS, NULL,
+ alarm_entLastChangeTime, NULL);
+ /* End of Fix for 4929068 */
+ }
+}
+
+static void
+send_entConfigChange_trap()
+{
+ send_enterprise_trap_vars(SNMP_TRAP_ENTERPRISESPECIFIC, 1,
+ entityMIBTrapsOID, OID_LENGTH(entityMIBTrapsOID), NULL);
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entLastChangeTime.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+#pragma ident "@(#)entLastChangeTime.h 1.1 03/02/24 SMI"
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+#ifndef ENTLASTCHANGETIME_H
+#define ENTLASTCHANGETIME_H
+
+/*
+ * function declarations
+ */
+void init_entLastChangeTime(void);
+Netsnmp_Node_Handler get_entLastChangeTime;
+
+/**
+ * Call this whenever entLastChangeTime should be changed, as specified in RFC
+ * 2737.
+ */
+extern void configChanged();
+
+#endif /* ENTLASTCHANGETIME_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entLogicalTable.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,778 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.5 2002/12/16 22:50:18 hardaker Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "stdhdr.h"
+#include "entLogicalTable.h"
+#include "entAliasMappingTable.h"
+#include "entLastChangeTime.h"
+#include "entLPMappingTable.h"
+
+static int AddToLogicalTable(entLogicalEntry_t *);
+static int FreeLogicalEntry(entLogicalEntry_t *);
+
+entLogicalEntry_t *gLogicalTableHead, *gLogicalTableTail;
+int gLogicalTableSize;
+
+
+/** Initialize the entLogicalTable table by defining its contents and how it's structured */
+void
+initialize_table_entLogicalTable(void)
+{
+ static oid entLogicalTable_oid[] = {1,3,6,1,2,1,47,1,2,1};
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /* create the table structure itself */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /* if your table is read only, it's easiest to change the
+ HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
+ /* Fix for 4910624 - changing HANDLER_CAN_RWRITE to HANDLER_CAN_RONLY */
+ my_handler = netsnmp_create_handler_registration("entLogicalTable",
+ entLogicalTable_handler,
+ entLogicalTable_oid,
+ OID_LENGTH(entLogicalTable_oid),
+ HANDLER_CAN_RONLY);
+ /* End of Fix for 4910624 */
+
+ if (!my_handler || !table_info || !iinfo)
+ return; /* mallocs failed */
+
+ /***************************************************
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_INTEGER, /* index: entLogicalIndex */
+ 0);
+
+ table_info->min_column = 2;
+ table_info->max_column = 8;
+
+ /* iterator access routines */
+ iinfo->get_first_data_point = entLogicalTable_get_first_data_point;
+ iinfo->get_next_data_point = entLogicalTable_get_next_data_point;
+
+ iinfo->table_reginfo = table_info;
+
+ /***************************************************
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_entLogicalTable",
+ "Registering table entLogicalTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initializes the entLogicalTable module */
+void
+init_entLogicalTable(void)
+{
+
+ /* here we initialize all the tables we're planning on supporting */
+ initialize_table_entLogicalTable();
+ gLogicalTableHead = NULL;
+ gLogicalTableSize = 0;
+ gLogicalTableTail = NULL;
+}
+
+/** returns the first data point within the entLogicalTable table data.
+
+ Set the my_loop_context variable to the first data point structure
+ of your choice (from which you can find the next one). This could
+ be anything from the first node in a linked list, to an integer
+ pointer containing the beginning of an array variable.
+
+ Set the my_data_context variable to something to be returned to
+ you later that will provide you with the data to return in a given
+ row. This could be the same pointer as what my_loop_context is
+ set to, or something different.
+
+ The put_index_data variable contains a list of snmp variable
+ bindings, one for each index in your table. Set the values of
+ each appropriately according to the data matching the first row
+ and return the put_index_data variable at the end of the function.
+*/
+netsnmp_variable_list *
+entLogicalTable_get_first_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ netsnmp_variable_list *vptr;
+ entLogicalEntry_t *zRunner;
+ zRunner = gLogicalTableHead;
+
+ while (zRunner) {
+ if (zRunner->entLogicalIndex > 0)
+ break;
+ zRunner = zRunner->pNextEntry;
+ }
+
+ if (zRunner == NULL) return NULL;
+
+ *my_loop_context = (void *)zRunner;
+ *my_data_context = (void *)zRunner;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *)&zRunner->entLogicalIndex, sizeof(zRunner->entLogicalIndex));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+
+}
+
+/** functionally the same as entLogicalTable_get_first_data_point, but
+ my_loop_context has already been set to a previous value and should
+ be updated to the next in the list. For example, if it was a
+ linked list, you might want to cast it and the return
+ my_loop_context->next. The my_data_context pointer should be set
+ to something you need later and the indexes in put_index_data
+ updated again. */
+
+netsnmp_variable_list *
+entLogicalTable_get_next_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ entLogicalEntry_t *zRunner;
+ netsnmp_variable_list *vptr;
+
+ zRunner = (entLogicalEntry_t *) *my_loop_context;
+
+ while (zRunner) {
+ zRunner = zRunner->pNextEntry;
+ if (zRunner && zRunner->entLogicalIndex > 0)
+ break;
+ }
+
+ if (zRunner == NULL) return NULL;
+
+ *my_loop_context = (void *)zRunner;
+ *my_data_context = (void *)zRunner;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *)&zRunner->entLogicalIndex, sizeof(zRunner->entLogicalIndex));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+
+}
+
+/** handles requests for the entLogicalTable table, if anything else needs to be done */
+int
+entLogicalTable_handler(
+ netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests) {
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+ entLogicalEntry_t *zLogicalEntry;
+
+ for(request = requests; request; request = request->next) {
+ var = request->requestvb;
+ if (request->processed != 0)
+ continue;
+
+ /* perform anything here that you need to do before each
+ request is processed. */
+
+ /* the following extracts the my_data_context pointer set in
+ the loop functions above. You can then use the results to
+ help return data for the columns of the entLogicalTable table in question */
+ zLogicalEntry = (entLogicalEntry_t *) netsnmp_extract_iterator_context(request);
+
+ if ((zLogicalEntry == NULL) || (zLogicalEntry->entLogicalIndex <= 0) ) {
+ if (reqinfo->mode == MODE_GET) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ /* XXX: no row existed, if you support creation and this is a
+ set, start dealing with it here, else continue */
+ }
+
+ /* extracts the information about the table from the request */
+ table_info = netsnmp_extract_table_info(request);
+ /* table_info->colnum contains the column number requested */
+ /* table_info->indexes contains a linked list of snmp variable
+ bindings for the indexes of the table. Values in the list
+ have been set corresponding to the indexes of the
+ request */
+ if (table_info==NULL) {
+ continue;
+ }
+
+ switch(reqinfo->mode) {
+ /* the table_iterator helper should change all GETNEXTs
+ into GETs for you automatically, so you don't have to
+ worry about the GETNEXT case. Only GETs and SETs need
+ to be dealt with here */
+ case MODE_GET:
+ switch(table_info->colnum) {
+ case COLUMN_ENTLOGICALDESCR:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zLogicalEntry->entLogicalDescr, strlen(zLogicalEntry->entLogicalDescr));
+ break;
+
+ case COLUMN_ENTLOGICALTYPE:
+ snmp_set_var_typed_value(var, ASN_OBJECT_ID, (u_char *) zLogicalEntry->entLogicalType, zLogicalEntry->entLogicalTypeSize);
+ break;
+
+ case COLUMN_ENTLOGICALCOMMUNITY:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zLogicalEntry->entLogicalCommunity, strlen(zLogicalEntry->entLogicalCommunity));
+ break;
+
+ case COLUMN_ENTLOGICALTADDRESS:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zLogicalEntry->entLogicalTAddress, strlen(zLogicalEntry->entLogicalTAddress));
+ break;
+
+ case COLUMN_ENTLOGICALTDOMAIN:
+ snmp_set_var_typed_value(var, ASN_OBJECT_ID, (u_char *) zLogicalEntry->entLogicalTDomain, zLogicalEntry->entLogicalTDomainSize);
+ break;
+
+ case COLUMN_ENTLOGICALCONTEXTENGINEID:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zLogicalEntry->entLogicalContextEngineId, strlen(zLogicalEntry->entLogicalContextEngineId));
+ break;
+
+ case COLUMN_ENTLOGICALCONTEXTNAME:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zLogicalEntry->entLogicalContextName, strlen(zLogicalEntry->entLogicalContextName));
+ break;
+
+ default:
+ /* We shouldn't get here */
+ snmp_log(LOG_ERR, "problem encountered in entLogicalTable_handler: unknown column\n");
+ }
+ break;
+
+ case MODE_SET_RESERVE1:
+ /* set handling... */
+
+ default:
+ snmp_log(LOG_ERR, "problem encountered in entLogicalTable_handler: unsupported mode\n");
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+void populate_entLogicalEntry(entLogicalEntry_t *xLogicalStatic,
+ char *entLogicalDescr,
+ oid *entLogicalType,
+ int entLogicalTypeSize,
+ char *entLogicalCommunity,
+ char *entLogicalTAddress,
+ oid *entLogicalTDomain,
+ int entLogicalTDomainSize,
+ char *entLogicalContextEngineId,
+ char *entLogicalContextName)
+{
+ xLogicalStatic->entLogicalDescr = entLogicalDescr;
+ xLogicalStatic->entLogicalType = entLogicalType;
+ xLogicalStatic->entLogicalTypeSize = entLogicalTypeSize;
+ xLogicalStatic->entLogicalCommunity = entLogicalCommunity;
+ xLogicalStatic->entLogicalTAddress = entLogicalTAddress;
+ xLogicalStatic->entLogicalTDomain = entLogicalTDomain;
+ xLogicalStatic->entLogicalTDomainSize = entLogicalTDomainSize;
+ xLogicalStatic->entLogicalContextEngineId = entLogicalContextEngineId;
+ xLogicalStatic->entLogicalContextName = entLogicalContextName;
+}
+
+
+/*
+ * Allocates a Logical entry. if logicidx >0 attempts to reuse an
+ * existing entry
+ */
+
+int
+allocLogicalEntry(int xLogicalIdx, entLogicalEntry_t * xnewLogicalEntry)
+{
+ entLogicalEntry_t *logicent;
+ int index;
+ /* Fix for 4893101 */
+ static oid mib2oid[] = { 1,3,6,1,2,1 };
+ /* End of Fix for 4893101 */
+ /* Fix for 4927412 */
+ char emptystring[1] = "";
+ /* End of Fix for 4927412 */
+
+ /* Fix for 4927412: according to RFC 2737, entLogicalDescr has to be */
+ /* unique - NULL should be rejected. */
+ /* entLogicalTAddress should not accept NULL or "". */
+ /* entLogicalTDomain should not accept NULL */
+ /* entLogicalType will default to mib-2 for */
+ /* NULL. For the rest, we will force NULL = "" */
+ /* (zero-length string) */
+ if (xnewLogicalEntry->entLogicalDescr == NULL)
+ return -1;
+ /* Fix for 4893101: We have to check for NULL so that it does not */
+ /* crash. Also we need to have mib-2 as the default, */
+ /* as outlined in the RFC */
+ if (xnewLogicalEntry->entLogicalType == NULL) {
+ xnewLogicalEntry->entLogicalType = mib2oid;
+ xnewLogicalEntry->entLogicalTypeSize = sizeof(mib2oid);
+ }
+ /* End of Fix for 4893101 */
+ if (xnewLogicalEntry->entLogicalCommunity == NULL)
+ xnewLogicalEntry->entLogicalCommunity = emptystring;
+ if (xnewLogicalEntry->entLogicalTAddress == NULL)
+ return -1;
+ else if (strcmp((const char *)xnewLogicalEntry->entLogicalTAddress, "") == 0)
+ return -1;
+ if (xnewLogicalEntry->entLogicalTDomain == NULL)
+ return -1;
+ if (xnewLogicalEntry->entLogicalContextEngineId == NULL)
+ xnewLogicalEntry->entLogicalContextEngineId = emptystring;
+ if (xnewLogicalEntry->entLogicalContextName == NULL)
+ xnewLogicalEntry->entLogicalContextName = emptystring;
+ /* End of Fix for 4927412 */
+
+ /* Fix for 4921309 */
+ if (xLogicalIdx < 0 || xLogicalIdx > MAX_ENTITY_INDEX)
+ return NULL;
+ /* End of Fix for 4921309 */
+
+ /* Fix for 4911817: Check for size and boundary limits */
+ /* entLogicalDescr 0..255 */
+ if (strlen(xnewLogicalEntry->entLogicalDescr) > 255)
+ return -1;
+
+ /* entLogicalCommunity 0..255 (deprecated) */
+ if (strlen(xnewLogicalEntry->entLogicalCommunity) > 255)
+ return -1;
+
+ /* entLogicalTAddress 1..255 */
+ if (strlen(xnewLogicalEntry->entLogicalTAddress) < 1 || strlen(xnewLogicalEntry->entLogicalTAddress) > 255)
+ return -1;
+
+ /* entLogicalContextEngineId 0..32 */
+ if (strlen(xnewLogicalEntry->entLogicalContextEngineId) > 32)
+ return -1;
+
+ /* entLogicalContextName 0..255 */
+ if (strlen(xnewLogicalEntry->entLogicalContextName) > 255)
+ return -1;
+ /* End of Fix for 4911817 */
+
+ logicent = malloc(sizeof (entLogicalEntry_t));
+ if (logicent == NULL) {
+ return (-1);
+ }
+
+ logicent->entLogicalIndex = xLogicalIdx;
+
+ logicent->entLogicalDescr = strdup(xnewLogicalEntry->entLogicalDescr);
+ /* Fix for 4884526 */
+ if (logicent->entLogicalDescr == NULL) {
+ free (logicent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+
+ logicent->entLogicalType = malloc(xnewLogicalEntry->entLogicalTypeSize);
+ /* Fix for 4884526 */
+ if (logicent->entLogicalType == NULL) {
+ free(logicent->entLogicalDescr);
+ free (logicent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+
+ memcpy(logicent->entLogicalType, xnewLogicalEntry->entLogicalType,
+ xnewLogicalEntry->entLogicalTypeSize);
+ logicent->entLogicalTypeSize = xnewLogicalEntry->entLogicalTypeSize;
+
+ logicent->entLogicalCommunity =
+ strdup(xnewLogicalEntry->entLogicalCommunity);
+ /* Fix for 4884526 */
+ if (logicent->entLogicalCommunity == NULL) {
+ free(logicent->entLogicalType);
+ free(logicent->entLogicalDescr);
+ free (logicent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+ logicent->entLogicalTAddress =
+ strdup(xnewLogicalEntry->entLogicalTAddress);
+ /* Fix for 4884526 */
+ if (logicent->entLogicalTAddress == NULL) {
+ free(logicent->entLogicalCommunity);
+ free(logicent->entLogicalType);
+ free(logicent->entLogicalDescr);
+ free (logicent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+
+ /* Fix for 4926767: We do not want NULL TDomain */
+ if (xnewLogicalEntry->entLogicalTDomain == NULL) {
+ logicent->entLogicalTDomain = NULL;
+ } else {
+ logicent->entLogicalTDomain =
+ malloc(xnewLogicalEntry->entLogicalTDomainSize);
+ }
+ /* End of Fix for 4926767 */
+
+ /* Fix for 4884526 */
+ if (logicent->entLogicalTDomain == NULL) {
+ free(logicent->entLogicalTAddress);
+ free(logicent->entLogicalCommunity);
+ free(logicent->entLogicalType);
+ free(logicent->entLogicalDescr);
+ free (logicent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+
+ memcpy(logicent->entLogicalTDomain, xnewLogicalEntry->entLogicalTDomain,
+ xnewLogicalEntry->entLogicalTDomainSize);
+ logicent->entLogicalTDomainSize = xnewLogicalEntry->entLogicalTDomainSize;
+
+ logicent->entLogicalContextEngineId =
+ strdup(xnewLogicalEntry->entLogicalContextEngineId);
+ /* Fix for 4884526 */
+ if (logicent->entLogicalContextEngineId == NULL) {
+ free(logicent->entLogicalTDomain);
+ free(logicent->entLogicalTAddress);
+ free(logicent->entLogicalCommunity);
+ free(logicent->entLogicalType);
+ free(logicent->entLogicalDescr);
+ free (logicent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+ logicent->entLogicalContextName =
+ strdup(xnewLogicalEntry->entLogicalContextName);
+ /* Fix for 4884526 */
+ if (logicent->entLogicalContextName == NULL) {
+ free(logicent->entLogicalContextEngineId);
+ free(logicent->entLogicalTDomain);
+ free(logicent->entLogicalTAddress);
+ free(logicent->entLogicalCommunity);
+ free(logicent->entLogicalType);
+ free(logicent->entLogicalDescr);
+ free (logicent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+
+ logicent->pNextEntry = NULL;
+
+ index = AddToLogicalTable(logicent);
+ return (index);
+}
+
+static int
+AddToLogicalTable(entLogicalEntry_t * xnewLogicalEntry)
+{
+ entLogicalEntry_t *zRunner, *temp;
+ int placeFound; /* Fix for 4921309 */
+ int zIndex;
+ zRunner = gLogicalTableHead;
+
+ if (xnewLogicalEntry == NULL) return (-1);
+ xnewLogicalEntry->pNextEntry = NULL;
+
+ /* Fix for 4921309 */
+ /* If index > 0, attempt to insert in appropriate place. */
+ if (xnewLogicalEntry->entLogicalIndex > 0) {
+ placeFound = 0;
+ temp = zRunner;
+ while (zRunner != NULL) {
+ if (xnewLogicalEntry->entLogicalIndex >
+ abs(zRunner->entLogicalIndex)) {
+ temp = zRunner;
+ zRunner = zRunner->pNextEntry;
+ } else {
+ break;
+ }
+ }
+
+ /* If the indexes don't match, we can use the specified index */
+ if (temp == NULL) {
+ /* List is empty, make this the first/last entry */
+ gLogicalTableHead = xnewLogicalEntry;
+ gLogicalTableTail = xnewLogicalEntry;
+ placeFound = 1;
+ } else if (zRunner == NULL) {
+ /* Index > last value, make this the last entry */
+ temp->pNextEntry = xnewLogicalEntry;
+ gLogicalTableTail = xnewLogicalEntry;
+ placeFound = 1;
+ } else if (xnewLogicalEntry->entLogicalIndex !=
+ abs(zRunner->entLogicalIndex)) {
+ /* Index < zRunner, insert entry before it */
+ xnewLogicalEntry->pNextEntry = zRunner;
+ if (zRunner == gLogicalTableHead) {
+ /* Index fits before list head, insert entry */
+ gLogicalTableHead = xnewLogicalEntry;
+ } else {
+ /* Index fits between two entries, insert entry */
+ temp->pNextEntry = xnewLogicalEntry;
+ }
+ placeFound = 1;
+ }
+
+ if (placeFound) {
+ gLogicalTableSize++;
+ configChanged();
+ return (xnewLogicalEntry->entLogicalIndex);
+ } else {
+ /* Re-initialize for code that follows */
+ zRunner = gLogicalTableHead;
+ }
+ }
+
+ /* Either index was zero or specified index is already taken */
+ /* End of Fix for 4921309 */
+
+ if (gLogicalTableSize > LARGE_TABLE) {
+ gLogicalTableTail->pNextEntry = xnewLogicalEntry;
+ zIndex = abs(gLogicalTableTail->entLogicalIndex) + 1;
+ xnewLogicalEntry->entLogicalIndex = zIndex;
+ gLogicalTableTail = xnewLogicalEntry;
+ gLogicalTableSize++;
+ configChanged();
+ return (zIndex);
+ }
+
+ if (gLogicalTableHead) { /* A slightly slower way to add into the list */
+ while (zRunner->pNextEntry != NULL) {
+ if ((abs(zRunner->pNextEntry->entLogicalIndex)
+ - abs(zRunner->entLogicalIndex)) > 1) {
+ temp = zRunner->pNextEntry;
+ zRunner->pNextEntry = xnewLogicalEntry;
+ zIndex = abs(zRunner->entLogicalIndex) + 1;
+ xnewLogicalEntry->entLogicalIndex = zIndex;
+ xnewLogicalEntry->pNextEntry = temp;
+ gLogicalTableSize++;
+ configChanged();
+ return (zIndex);
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ zIndex = abs(zRunner->entLogicalIndex) + 1;
+ xnewLogicalEntry->entLogicalIndex = zIndex;
+ zRunner->pNextEntry = xnewLogicalEntry;
+ } else {
+ zIndex = xnewLogicalEntry->entLogicalIndex = 1;
+ gLogicalTableHead = xnewLogicalEntry;
+ }
+ gLogicalTableTail = xnewLogicalEntry;
+ gLogicalTableSize++;
+ configChanged();
+ return (zIndex);
+}
+
+int
+makeLogicalTableEntryStale(int xLogicalIndex)
+{
+
+ entLogicalEntry_t *zRunner;
+ int zLogicalIndex;
+
+ /* Fix for 4888088 */
+ if (xLogicalIndex <= 0 || xLogicalIndex > MAX_ENTITY_INDEX)
+ return (-1);
+ /* End of Fix for 4888088 */
+
+ zRunner = gLogicalTableHead;
+
+ while (zRunner) {
+ zLogicalIndex = zRunner->entLogicalIndex;
+ if (zLogicalIndex < 0) {
+ if (zLogicalIndex == -(xLogicalIndex))
+ return (-2); /* Entry is already stale */
+ }
+ if (zLogicalIndex == xLogicalIndex) {
+ /* Fix for 4918876: We need to delete the related entries first */
+
+/*
+ Delete all instances of this logical index in all other
+ tables to maintain table integrity. Should we roll-back if a
+ deletion fails, perhaps not
+*/
+ deleteAliasMappingLogicalIndex( xLogicalIndex); /*Alias mapping*/
+ deleteLPMappingLogicalIndex( xLogicalIndex); /* LPTable */
+ /* End of Fix for 4918876 */
+
+ zRunner->entLogicalIndex = -zLogicalIndex;
+
+ configChanged();
+
+ return (0);
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ return (-1);
+}
+
+int
+makeLogicalTableEntryLive(int xLogicalIndex)
+{
+ entLogicalEntry_t *zRunner;
+ int zLogicalIndex;
+
+ /* Fix for 4888088 */
+ if (xLogicalIndex <= 0 || xLogicalIndex > MAX_ENTITY_INDEX)
+ return (-1);
+ /* End of Fix for 4888088 */
+
+ zRunner = gLogicalTableHead;
+
+ while (zRunner) {
+ zLogicalIndex = zRunner->entLogicalIndex;
+ if (zLogicalIndex > 0) {
+ if (zLogicalIndex == xLogicalIndex)
+ return (-2); /* Entry is already live */
+ }
+ if (zLogicalIndex == -(xLogicalIndex)) {
+ zRunner->entLogicalIndex = xLogicalIndex;
+ configChanged();
+ return (0);
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ return (-1);
+}
+
+entLogicalEntry_t*
+getLogicalTableEntry(int xLogicalIndex)
+{
+ entLogicalEntry_t *zRunner;
+ int zLogicalIndex;
+
+ /* Fix for 4888088 */
+ if (xLogicalIndex <= 0 || xLogicalIndex > MAX_ENTITY_INDEX)
+ return NULL;
+ /* End of Fix for 4888088 */
+
+ zRunner = gLogicalTableHead;
+ while (zRunner) {
+ zLogicalIndex = zRunner->entLogicalIndex;
+ if (zLogicalIndex > 0) {
+ if (zLogicalIndex == xLogicalIndex)
+ return zRunner;
+ }
+ if (zLogicalIndex == -(xLogicalIndex)) {
+ return NULL; /* The stale entry exist, we can stop the search*/
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ return NULL;
+}
+
+entLogicalEntry_t*
+getLogicalTableStaleEntry(int xLogicalIndex)
+{
+ entLogicalEntry_t *zRunner;
+ int zLogicalIndex;
+
+ /* Fix for 4888088 */
+ if (xLogicalIndex <= 0 || xLogicalIndex > MAX_ENTITY_INDEX)
+ return NULL;
+ /* End of Fix for 4888088 */
+
+ zRunner = gLogicalTableHead;
+ while (zRunner) {
+ zLogicalIndex = zRunner->entLogicalIndex;
+ if (zLogicalIndex < 0) {
+ if (zLogicalIndex == -(xLogicalIndex))
+ return zRunner;
+ }
+ if (zLogicalIndex == xLogicalIndex) {
+ return NULL; /* The live entry exist, we can stop the search*/
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ return NULL;
+}
+
+
+int
+deleteLogicalTableEntry(int xLogicalIndex)
+{
+ entLogicalEntry_t *zRunner, *temp, *prevEntry;
+ int zLogicalIndex;
+
+ /* Fix for 4888088 */
+ if (xLogicalIndex <= 0 || xLogicalIndex > MAX_ENTITY_INDEX)
+ return -1;
+ /* End of Fix for 4888088 */
+
+ zRunner = gLogicalTableHead;
+ prevEntry = NULL;
+ while (zRunner) {
+ zLogicalIndex = zRunner->entLogicalIndex;
+ if (zLogicalIndex > 0) {
+ if (zLogicalIndex == xLogicalIndex) {
+ /* Fix for 4918876: We need to delete the related entries */
+ /* first */
+/*
+ Delete all instances of this logical index in all other
+ tables to maintain table integrity. Should we roll-back if a
+ deletion fails, perhaps not
+*/
+ deleteAliasMappingLogicalIndex( xLogicalIndex); /*Alias mapping*/
+ deleteLPMappingLogicalIndex( xLogicalIndex); /* LPTable */
+ /* End of Fix for 4918876 */
+
+ temp = zRunner->pNextEntry;
+ zRunner->pNextEntry = NULL;
+ if (prevEntry)
+ prevEntry->pNextEntry = temp;
+ else
+ gLogicalTableHead = temp;;
+ FreeLogicalEntry(zRunner);
+
+ configChanged();
+
+ gLogicalTableSize--;
+ return (0);
+ }
+ }
+ if (zLogicalIndex == -(xLogicalIndex)) {
+ return (-2); /* The stale entry exist, we can stop the search*/
+ }
+ prevEntry = zRunner;
+ zRunner = zRunner->pNextEntry;
+ }
+ return (-1);
+}
+
+int
+FreeLogicalEntry(entLogicalEntry_t *xEntry)
+{
+ if (xEntry == NULL) return (-1);
+ free(xEntry->entLogicalDescr);
+ free(xEntry->entLogicalType);
+ free(xEntry->entLogicalCommunity);
+ free(xEntry->entLogicalTAddress);
+ free(xEntry->entLogicalTDomain);
+ free(xEntry->entLogicalContextEngineId);
+ free(xEntry->entLogicalContextName);
+ free(xEntry);
+ xEntry = NULL;
+ return (1);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entLogicalTable.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.5 2002/12/16 22:50:18 hardaker Exp $
+ */
+#ifndef ENTLOGICALTABLE_H
+#define ENTLOGICALTABLE_H
+
+/* function declarations */
+void init_entLogicalTable(void);
+void initialize_table_entLogicalTable(void);
+Netsnmp_Node_Handler entLogicalTable_handler;
+
+Netsnmp_First_Data_Point entLogicalTable_get_first_data_point;
+Netsnmp_Next_Data_Point entLogicalTable_get_next_data_point;
+
+#define ENT_LOGICAL_TABLE "ENT_LOGICAL_TABLE"
+
+/* column number definitions for table entLogicalTable */
+ #define COLUMN_ENTLOGICALINDEX 1
+ #define COLUMN_ENTLOGICALDESCR 2
+ #define COLUMN_ENTLOGICALTYPE 3
+ #define COLUMN_ENTLOGICALCOMMUNITY 4
+ #define COLUMN_ENTLOGICALTADDRESS 5
+ #define COLUMN_ENTLOGICALTDOMAIN 6
+ #define COLUMN_ENTLOGICALCONTEXTENGINEID 7
+ #define COLUMN_ENTLOGICALCONTEXTNAME 8
+
+typedef struct entLogicalEntry_s {
+
+ int_l entLogicalIndex;
+ char *entLogicalDescr;
+ oid *entLogicalType;
+ int_l entLogicalTypeSize;
+ char *entLogicalCommunity;
+ char *entLogicalTAddress;
+ oid *entLogicalTDomain;
+ int_l entLogicalTDomainSize;
+ char *entLogicalContextEngineId;
+ char *entLogicalContextName;
+ struct entLogicalEntry_s* pNextEntry;
+
+} entLogicalEntry_t;
+
+extern void populate_entLogicalEntry(entLogicalEntry_t*, char*, oid*, int, char*, char*, oid*, int, char*, char*);
+
+extern int allocLogicalEntry(int , entLogicalEntry_t*);
+
+extern entLogicalEntry_t* getLogicalTableEntry(int xLogicalIndex);
+extern entLogicalEntry_t* getLogicalTableStaleEntry(int xLogicalIndex);
+extern int deleteLogicalTableEntry(int xLogicalIndex);
+extern int makeLogicalTableEntryStale(int xLogicalIndex);
+extern int makeLogicalTableEntryLive(int xLogicalIndex);
+
+
+#endif /* ENTLOGICALTABLE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entPhysicalContainsTable.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,769 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.5 2002/12/16 22:50:18 hardaker Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "stdhdr.h"
+#include "entPhysicalContainsTable.h"
+#include "entPhysicalTable.h"
+#include "entLastChangeTime.h"
+
+static int FreePhyContainsTableEntry(physIndexAndChildIndex_t *);
+static int isRecursiveChild(int, int);
+
+physIndexAndChildIndex_t *gPhyContainsTableHead;
+int gPhyContainsTableSize;
+/* Fix for 4910641 */
+int_l *zChildIndexesTracker;
+/* End of Fix for 4910641 */
+
+/** Initialize the entPhysicalContainsTable table by defining its contents and how it's structured */
+void
+initialize_table_entPhysicalContainsTable(void)
+{
+ static oid entPhysicalContainsTable_oid[] = {1,3,6,1,2,1,47,1,3,3};
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /* create the table structure itself */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /* if your table is read only, it's easiest to change the
+ HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
+ /* Fix for 4910624 - changing HANDLER_CAN_RWRITE to HANDLER_CAN_RONLY */
+ my_handler = netsnmp_create_handler_registration("entPhysicalContainsTable",
+ entPhysicalContainsTable_handler,
+ entPhysicalContainsTable_oid,
+ OID_LENGTH(entPhysicalContainsTable_oid),
+ HANDLER_CAN_RONLY);
+ /* End of Fix for 4910624 */
+
+ if (!my_handler || !table_info || !iinfo)
+ return; /* mallocs failed */
+
+ /***************************************************
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_INTEGER, /* index: entPhysicalIndex */
+ ASN_INTEGER, /* index: entPhysicalChildIndex */
+ 0);
+
+ table_info->min_column = 1;
+ table_info->max_column = 1;
+
+ /* iterator access routines */
+ iinfo->get_first_data_point = entPhysicalContainsTable_get_first_data_point;
+ iinfo->get_next_data_point = entPhysicalContainsTable_get_next_data_point;
+
+ iinfo->table_reginfo = table_info;
+
+ /***************************************************
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_entPhysicalContainsTable",
+ "Registering table entPhysicalContainsTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initializes the entPhysicalContainsTable module */
+void
+init_entPhysicalContainsTable(void)
+{
+
+ /* here we initialize all the tables we're planning on supporting */
+ initialize_table_entPhysicalContainsTable();
+ gPhyContainsTableHead = NULL;
+ gPhyContainsTableSize = 0;
+}
+
+/** returns the first data point within the entPhysicalContainsTable table data.
+
+ Set the my_loop_context variable to the first data point structure
+ of your choice (from which you can find the next one). This could
+ be anything from the first node in a linked list, to an integer
+ pointer containing the beginning of an array variable.
+
+ Set the my_data_context variable to something to be returned to
+ you later that will provide you with the data to return in a given
+ row. This could be the same pointer as what my_loop_context is
+ set to, or something different.
+
+ The put_index_data variable contains a list of snmp variable
+ bindings, one for each index in your table. Set the values of
+ each appropriately according to the data matching the first row
+ and return the put_index_data variable at the end of the function.
+*/
+netsnmp_variable_list *
+entPhysicalContainsTable_get_first_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ netsnmp_variable_list *vptr;
+ physIndexAndChildIndex_t *zRunner, *zpValidEntry;
+ int_l *zChildIndexes, zValidChildIdx=0, *zpValidChildIdx;
+
+ zRunner = gPhyContainsTableHead;
+ while (zRunner) {
+ if (zRunner->entPhysicalIndex > 0) {
+ zChildIndexes = zRunner->childIndexes;
+ while ((zChildIndexes != NULL) && (*zChildIndexes != 0)){
+ if (*zChildIndexes > 0) {
+ zValidChildIdx = *zChildIndexes;
+ break;
+ }
+ zChildIndexes++;
+ }
+ if (zValidChildIdx) {
+ zpValidEntry = zRunner;
+ zpValidChildIdx = zChildIndexes;
+ break;
+ }
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ if (zRunner == NULL) return NULL;
+
+ /* Fix for 4910641: No idea why it worked in Sparc with the original */
+ /* version. *my_loop_context was pointing to */
+ /* temporary address, and maybe Intel and Sparc handles */
+ /* memory differently - that is probably why it worked */
+ /* on Sparc but not on Intel. This version is */
+ /* valid, and easier to trace and understand. */
+ *my_loop_context = (void *) zpValidEntry;
+ *my_data_context = (void *) zpValidChildIdx;
+ zChildIndexesTracker = zpValidChildIdx;
+ /* End of Fix for 4910641 */
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) &zpValidEntry->entPhysicalIndex, sizeof(zpValidEntry->entPhysicalIndex));
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) zpValidChildIdx, sizeof(int_l));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+/** functionally the same as entPhysicalContainsTable_get_first_data_point, but
+ my_loop_context has already been set to a previous value and should
+ be updated to the next in the list. For example, if it was a
+ linked list, you might want to cast it and the return
+ my_loop_context->next. The my_data_context pointer should be set
+ to something you need later and the indexes in put_index_data
+ updated again. */
+
+netsnmp_variable_list *
+entPhysicalContainsTable_get_next_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ netsnmp_variable_list *vptr;
+ physIndexAndChildIndex_t *zRunner, *zpValidEntry;
+ int_l *zChildIndexes, zValidChildIdx=0, *zpValidChildIdx;
+
+ /* Fix for 4910641: We need to dereference the pointers, and cast */
+ /* them back to the appropriate data structure */
+ zRunner = (physIndexAndChildIndex_t *)*my_loop_context;
+ zChildIndexes = zChildIndexesTracker;
+ /* End of Fix for 4910641 */
+
+ if (zChildIndexes)
+ zChildIndexes++;
+ while (zRunner) {
+ if (zRunner->entPhysicalIndex > 0) {
+ while ((zChildIndexes != NULL) && (*zChildIndexes != 0)){
+ if (*zChildIndexes > 0) {
+ zValidChildIdx = *zChildIndexes;
+ break;
+ }
+ zChildIndexes++;
+ }
+ if (zValidChildIdx) {
+ zpValidEntry = zRunner;
+ zpValidChildIdx = zChildIndexes;
+ break;
+ }
+ }
+ zRunner = zRunner->pNextEntry;
+ if (zRunner)
+ zChildIndexes = zRunner->childIndexes;
+ }
+ if (zRunner == NULL) return NULL;
+
+ /* Fix for 4910641: We are making sure that *my_loop_context and */
+ /* *my_data_context are pointing to valid entries. */
+ *my_loop_context = (void *) zpValidEntry;
+ *my_data_context = (void *) zpValidChildIdx;
+ zChildIndexesTracker = zpValidChildIdx;
+ /* End Fix for 4910641 */
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) &zpValidEntry->entPhysicalIndex, sizeof(zpValidEntry->entPhysicalIndex));
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) zpValidChildIdx, sizeof(int_l));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+/** handles requests for the entPhysicalContainsTable table, if anything else needs to be done */
+int
+entPhysicalContainsTable_handler(
+ netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests) {
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+ int_l *idx;
+
+ for(request = requests; request; request = request->next) {
+ var = request->requestvb;
+ if (request->processed != 0)
+ continue;
+
+ /* perform anything here that you need to do before each
+ request is processed. */
+
+ /* the following extracts the my_data_context pointer set in
+ the loop functions above. You can then use the results to
+ help return data for the columns of the entPhysicalContainsTable table in question */
+ idx = (int_l *) netsnmp_extract_iterator_context(request);
+ if (idx == NULL) {
+ if (reqinfo->mode == MODE_GET) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ /* XXX: no row existed, if you support creation and this is a
+ set, start dealing with it here, else continue */
+ }
+
+ /* extracts the information about the table from the request */
+ table_info = netsnmp_extract_table_info(request);
+ /* table_info->colnum contains the column number requested */
+ /* table_info->indexes contains a linked list of snmp variable
+ bindings for the indexes of the table. Values in the list
+ have been set corresponding to the indexes of the
+ request */
+ if (table_info==NULL) {
+ continue;
+ }
+
+ switch(reqinfo->mode) {
+ /* the table_iterator helper should change all GETNEXTs
+ into GETs for you automatically, so you don't have to
+ worry about the GETNEXT case. Only GETs and SETs need
+ to be dealt with here */
+ case MODE_GET:
+ switch(table_info->colnum) {
+ case COLUMN_ENTPHYSICALCHILDINDEX:
+ snmp_set_var_typed_value(var, ASN_INTEGER, (u_char *) idx, sizeof(idx));
+ break;
+
+ default:
+ /* We shouldn't get here */
+ snmp_log(LOG_ERR, "problem encountered in entPhysicalContainsTable_handler: unknown column\n");
+ }
+ break;
+
+ case MODE_SET_RESERVE1:
+ /* set handling... */
+
+ default:
+ snmp_log(LOG_ERR, "problem encountered in entPhysicalContainsTable_handler: unsupported mode\n");
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+/* Returns 0 for success
+ 1 if the entry already exists
+ -1 for failure
+ -2 for stale index */
+/* Fix for 4915033 */
+int addPhysicalContainsTableEntry(int xentPhysicalIndex, int xentChildIndex)
+/* End of Fix for 4915033 */
+{
+ entPhysicalEntry_t *physentry, *childentry;
+ physIndexAndChildIndex_t *zContainsTableEntry, *zRunner, *zlastEntry;
+ int_l *zChildIndexes;
+
+ /* Fix for 4890316: Check that adding itself as a child is not allowed */
+ if (xentPhysicalIndex == xentChildIndex) {
+ return (-1);
+ }
+ /* End of Fix for 4890316 */
+
+ /* Fix for 48888088: -1 for invalid index, -2 for stale entries */
+ if (xentPhysicalIndex <= 0 || xentPhysicalIndex > MAX_ENTITY_INDEX || xentChildIndex <= 0 || xentChildIndex > MAX_ENTITY_INDEX)
+ return -1;
+ physentry = getPhysicalTableStaleEntry(xentPhysicalIndex);
+ if (physentry != NULL)
+ return -2;
+ childentry = getPhysicalTableStaleEntry(xentChildIndex);
+ if (childentry != NULL)
+ return -2;
+ /* End of Fix for 4888088 */
+
+ physentry = getPhysicalTableEntry(xentPhysicalIndex);
+ childentry = getPhysicalTableEntry(xentChildIndex);
+
+ if (physentry == NULL || childentry == NULL) {
+/*
+ Handle error here. Send it to log files
+*/
+ return (-1);
+ }
+
+ /* Fix for 4915080 */
+ if (isRecursiveChild(xentChildIndex, xentPhysicalIndex))
+ return (-1);
+ /* End of Fix for 4915080 */
+
+ zlastEntry = NULL;
+ zRunner = gPhyContainsTableHead;
+ while (zRunner != NULL) {
+ if (zRunner->entPhysicalIndex == xentPhysicalIndex) {
+ break;
+ }
+ zlastEntry = zRunner;
+ zRunner = zRunner->pNextEntry;
+ }
+ if (zRunner != NULL ) {/* Found a entry with log index */
+ int_l *p;
+ p = zRunner->childIndexes;
+ if (p == NULL) {
+ zChildIndexes = (int_l *) malloc(2 * sizeof (int_l));
+ if (!zChildIndexes) return -1;
+ zChildIndexes[0] = xentChildIndex;
+ zChildIndexes[1] = 0;
+ zRunner->childIndexes = zChildIndexes;
+ } else {/* Add phy index to last entry in the array */
+ int i=0;
+ int_l *empty = NULL;
+ while (p != NULL && *p != 0) {
+ if (*p == xentChildIndex) {
+ /* Already in the array, return a 1 */
+ return (1);
+ }
+ if (*p == -1) /* Empty Slot */
+ empty = p;
+ p++;
+ i++;
+ }
+ if (empty) { /* Reuse a empty spot */
+ *empty = xentChildIndex;
+ } else {
+ zRunner->childIndexes =
+ (int_l *)realloc(zRunner->childIndexes, (i + 2)*sizeof(int_l));
+ if (!zRunner->childIndexes) return -1;
+ zRunner->childIndexes[i] = xentChildIndex;
+ zRunner->childIndexes[i+1] = 0;
+ }
+ }
+ /* Fix for 4891869: We replace entPhysicalContainedIn with this */
+ /* entry only when this index is lower */
+ if (childentry->entPhysicalContainedIn == 0 || childentry->entPhysicalContainedIn > xentPhysicalIndex)
+ childentry->entPhysicalContainedIn = xentPhysicalIndex;
+ /* End of Fix for 4891869 */
+ configChanged();
+ return (0);
+ }
+
+ /* New entry*/
+ zContainsTableEntry = (physIndexAndChildIndex_t *)malloc(sizeof(physIndexAndChildIndex_t));
+ if (!zContainsTableEntry) return -1;
+ zContainsTableEntry->entPhysicalIndex = xentPhysicalIndex;
+ zChildIndexes = (int_l *) malloc(2 * sizeof (int_l));
+ if (!zChildIndexes) return -1;
+ zChildIndexes[0] = xentChildIndex;
+ zChildIndexes[1] = 0;
+ zContainsTableEntry->childIndexes = zChildIndexes;
+ zContainsTableEntry->pNextEntry = NULL;
+ if (zlastEntry){
+ zlastEntry->pNextEntry = zContainsTableEntry;
+ } else {
+ gPhyContainsTableHead = zContainsTableEntry;
+ }
+ /* Fix for 4891869: We replace entPhysicalContainedIn with this entry */
+ /* only when this index is lower */
+ if (childentry->entPhysicalContainedIn == 0 || childentry->entPhysicalContainedIn > xentPhysicalIndex)
+ childentry->entPhysicalContainedIn = xentPhysicalIndex;
+ /* End of Fix for 4891869 */
+ gPhyContainsTableSize++;
+ configChanged();
+ return (0);
+}
+
+/*
+ * Returns NULL if children, else returns int array with null termination
+ * The array is not a copy and SHOULD NOT be written to unless the
+ * intent is to update the master information
+ */
+/* Fix for 4915033 */
+int *getPhysicalContainsChildren(int parentIndex)
+/* End of Fix for 4915033 */
+{
+ entPhysicalEntry_t *physentry;
+ int_l *childIndexes=NULL;
+ /* Fix for 4914153 */
+ int *resultIndexes=NULL, i = 0;
+ /* End of Fix for 4914153 */
+ physIndexAndChildIndex_t *zRunner;
+
+ /*
+ * Find parent
+ */
+ physentry = getPhysicalTableEntry(parentIndex);
+ if (physentry == NULL) {
+ return (NULL); /* assume no children */
+ }
+
+ zRunner = gPhyContainsTableHead;
+ while (zRunner != NULL) {
+ if ((zRunner->entPhysicalIndex == parentIndex)) {
+ childIndexes = zRunner->childIndexes;
+ /* Fix for 4914153: From this childIndexes array, we only */
+ /* returns the true children array, excluding those "-1" entries */
+ if (childIndexes != NULL) {
+ while (*childIndexes != 0) {
+ /* We only need to count this entry if it is a valid */
+ /* (> -1) entry. Else we move on until the end of the */
+ /* list */
+ if (*childIndexes > 0) {
+ resultIndexes = realloc(resultIndexes, (i + 1)*sizeof(int));
+ if (resultIndexes == NULL)
+ return NULL; /* Not enough memory, just return NULL */
+ resultIndexes[i] = *childIndexes;
+ i++;
+
+ }
+ childIndexes++;
+ }
+ }
+ /* We can break here because this condition: */
+ /* zRunner->entPhysicalIndex == parentIndex condition */
+ /* can only happen once in the entPhysicalContains linked list */
+ break;
+ /* End of Fix for 4914153 */
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ /* Fix for 4914153: returns a NULL terminated list */
+ if (i > 0) /* at least one child is found */
+ resultIndexes = realloc(resultIndexes, (i + 1)*sizeof(int));
+ if (resultIndexes == NULL) /* Not enough memory or no child found -> NULL */
+ return NULL;
+ resultIndexes[i] = 0;
+ return (resultIndexes);
+ /* End of Fix for 4914153 */
+}
+
+/* Fix for 4915033 */
+/* This function will delete all the entries which has the parent index = */
+/* xParentIndex. */
+/* Returns number of entries deleted for success, */
+/* -1 if entry not found */
+/* -2 if stale */
+int deletePhysicalContainsParentIndex(int xParentIndex)
+{
+ /* We go through the ContainsTable, and remove the parent */
+ physIndexAndChildIndex_t *zRunner, *prevEntry, *temp=NULL;
+ int num=0;
+ /* Fix for 4926042*/
+ int *childIndexes, *zchildIndexes;
+ /* End of Fix for 4926042 */
+ int_l *childIndexes2;
+ int lowest_index = 0;
+ entPhysicalEntry_t *physentry;
+ int num_child=0;
+
+ /* Fix for 4888088 */
+ if (xParentIndex <= 0 || xParentIndex > MAX_ENTITY_INDEX)
+ return -1;
+ physentry = getPhysicalTableStaleEntry(xParentIndex);
+ if (physentry != NULL)
+ return -2;
+ /* End of Fix for 4888088 */
+
+ zRunner = gPhyContainsTableHead;
+ prevEntry = NULL;
+
+ while (zRunner != NULL) {
+ if (zRunner->entPhysicalIndex == xParentIndex) {
+ temp = zRunner->pNextEntry;
+ zRunner->pNextEntry = NULL;
+
+ /* Fix for 4891869: we need to figure out the list of children */
+ /* belonging to this parent, before actually */
+ /* deleting the parent */
+ childIndexes = getPhysicalContainsChildren(xParentIndex);
+ /* Fix for 4926042 */
+ zchildIndexes = childIndexes;
+ /* End of Fix for 4926042 */
+ /* End of Fix for 4891869 */
+
+ if (prevEntry)
+ prevEntry->pNextEntry = temp;
+ else
+ gPhyContainsTableHead = temp;
+ FreePhyContainsTableEntry(zRunner);
+ num++;
+ gPhyContainsTableSize--;
+ break;
+ }
+ prevEntry = zRunner;
+ zRunner = zRunner->pNextEntry;
+ }
+ if (num) {
+ /* Fix for 4891869: We need to sync the entPhysicalContainedIn */
+ /* 1. Find all the children that has this as a parent */
+ /* 2. If the parent is the last one for this child, reset the */
+ /* entPhysicalContainedIn to 0 */
+ /* 3. If more than one parent, and if this is the lowest index, */
+ /* then reset this to the next lowest */
+ /* 4. Otherwise do nothing */
+ num_child = 0;
+ while (childIndexes != NULL && *childIndexes != 0) {
+ physentry = getPhysicalTableEntry(*childIndexes);
+ if (physentry != NULL) {
+ /* Need to reset entPhysicalContainedIn only if the */
+ /* xParentIndex is already the lowest index. In this case, */
+ /* we will go through the ContainsTable and search for */
+ /* all the parents for this particular child, and set it */
+ /* to the second lowest index */
+ if (physentry->entPhysicalContainedIn == xParentIndex) {
+ zRunner = gPhyContainsTableHead;
+ lowest_index = 0; /* First reset to zero */
+
+ while (zRunner != NULL) {
+ childIndexes2 = zRunner->childIndexes;
+ while (childIndexes2 != NULL && *childIndexes2 != 0) {
+ if (*childIndexes2 == *childIndexes) {
+ if (lowest_index == 0)
+ lowest_index = zRunner->entPhysicalIndex;
+ else if (lowest_index > zRunner->entPhysicalIndex)
+ lowest_index = zRunner->entPhysicalIndex;
+ break;
+ }
+ childIndexes2++;
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ physentry->entPhysicalContainedIn = lowest_index;
+ }
+ }
+ /* Fix for 4888088: count the number of children */
+ if (*childIndexes > 0)
+ num_child++;
+ /* End of Fix for 4888088 */
+ childIndexes++;
+ }
+ /* End of Fix for 4891869 */
+ configChanged();
+ /* Fix for 4926042 */
+ free (zchildIndexes);
+ /* End of Fix for 4926042 */
+ return (num_child);
+ } else {
+ return (-1);
+ }
+}
+
+/* This function will delete all the entries which has the child index = */
+/* xChildIndex */
+/* Returns number of entries deleted for success, */
+/* -1 if entry not found */
+/* -2 if entry is stale */
+int deletePhysicalContainsChildIndex(int xChildIndex)
+{
+ physIndexAndChildIndex_t *zRunner;
+ int_l *childIndexes=NULL;
+ int num=0;
+
+ /* Fix for 4888088 */
+ entPhysicalEntry_t *physentry;
+ if (xChildIndex <= 0 || xChildIndex > MAX_ENTITY_INDEX)
+ return -1;
+ physentry = getPhysicalTableStaleEntry(xChildIndex);
+ if (physentry != NULL)
+ return -2;
+ /* End of Fix for 4888088 */
+
+ zRunner = gPhyContainsTableHead;
+ while (zRunner != NULL) {
+ childIndexes = zRunner->childIndexes;
+ while (childIndexes != NULL && *childIndexes != 0) {
+ if (*childIndexes == xChildIndex) {
+ deletePhysicalContainsTableEntry((int)zRunner->entPhysicalIndex, xChildIndex);
+ num++;
+ }
+ childIndexes++;
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ if (num) {
+ configChanged();
+ return (num);
+ } else {
+ return (-1);
+ }
+}
+
+/* Delete the entry specified by the xParentIndex and xChildIndex */
+/* returns 0 if successful */
+/* -1 if entry not found */
+/* -2 if entry is stale */
+int deletePhysicalContainsTableEntry(int xParentIndex, int xChildIndex)
+{
+ physIndexAndChildIndex_t *zRunner;
+ entPhysicalEntry_t *physentry;
+ int zparentIdx;
+ int num=0;
+ int_l *childIndexes=NULL;
+ int lowest_index = 0;
+
+ /* Fix for 4888088 */
+ if (xParentIndex <= 0 || xParentIndex > MAX_ENTITY_INDEX || xChildIndex <= 0 || xChildIndex > MAX_ENTITY_INDEX)
+ return -1;
+ physentry = getPhysicalTableStaleEntry(xParentIndex);
+ if (physentry != NULL)
+ return -2;
+ physentry = getPhysicalTableStaleEntry(xChildIndex);
+ if (physentry != NULL)
+ return -2;
+ /* End of Fix for 4888088 */
+
+ zRunner = gPhyContainsTableHead;
+
+ while (zRunner != NULL) {
+ zparentIdx = zRunner->entPhysicalIndex;
+ if (zparentIdx == xParentIndex) {
+ childIndexes = zRunner->childIndexes;
+ while (childIndexes != NULL && *childIndexes != 0) {
+ if (*childIndexes == xChildIndex) {
+ *childIndexes = -1;
+ num++;
+ }
+ childIndexes++;
+ }
+ break;
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ if (num) {
+ /* Fix for 4891869: we need to make sure that we reset the */
+ /* entPhysicalContainedIn when necessary */
+ physentry = getPhysicalTableEntry(xChildIndex);
+ if (physentry != NULL) {
+ if (physentry->entPhysicalContainedIn == xParentIndex) {
+ /* we want to set entPhysicalContainedIn to the lowest value */
+ /* or to zero if necessary */
+ zRunner = gPhyContainsTableHead;
+ while (zRunner != NULL) {
+ childIndexes = zRunner->childIndexes;
+ while (childIndexes != NULL && *childIndexes != 0) {
+ if (*childIndexes == xChildIndex) {
+ if (lowest_index == 0)
+ lowest_index = zRunner->entPhysicalIndex;
+ else if (lowest_index > zRunner->entPhysicalIndex)
+ lowest_index = zRunner->entPhysicalIndex;
+ break;
+ }
+ childIndexes++;
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ physentry->entPhysicalContainedIn = lowest_index;
+ }
+ }
+ /* End of Fix for 4891869 */
+ configChanged();
+ return (0);
+ } else {
+ return (-1);
+ }
+}
+/* End of Fix for 4915033 */
+
+static int
+FreePhyContainsTableEntry(physIndexAndChildIndex_t *xEntry)
+{
+ if (xEntry == NULL) return (-1);
+ free(xEntry->childIndexes);
+ free(xEntry);
+ xEntry = NULL;
+ return 0;
+}
+
+/* Fix for 4915080 */
+/* Check to see if childIndex is really related to the parentIndex, in */
+/* a directed graph way. Return 1 if it is related, 0 if not. */
+static int isRecursiveChild(int parentIndex, int childIndex)
+{
+ int i, ret;
+ int *childlist;
+ int *childlist2;
+
+ i = 0;
+ ret = 0;
+
+ if (parentIndex == childIndex)
+ return 1;
+
+ /* Check for the entPhysicalContainedIn */
+ childlist = getAllChildrenFromPhysicalContainedIn(parentIndex);
+ if (childlist != NULL) {
+ while (childlist[i] != NULL) {
+ ret = isRecursiveChild(childlist[i], childIndex);
+ if (ret == 1) {
+ free(childlist);
+ return 1;
+ }
+ i++;
+ }
+ free(childlist);
+ }
+
+ /* Now we deal with the entPhysicalContainsTable */
+ childlist2 = getPhysicalContainsChildren(parentIndex);
+ i = 0;
+ if (childlist2 != NULL) {
+ while (childlist2[i] != NULL) {
+ ret = isRecursiveChild(childlist2[i], childIndex);
+ if (ret == 1) {
+ free(childlist2);
+ return 1;
+ }
+ i++;
+ }
+ free(childlist2);
+ }
+
+ return 0;
+}
+/* End of Fix for 4915080 */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entPhysicalContainsTable.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.5 2002/12/16 22:50:18 hardaker Exp $
+ */
+#ifndef ENTPHYSICALCONTAINSTABLE_H
+#define ENTPHYSICALCONTAINSTABLE_H
+
+/* function declarations */
+void init_entPhysicalContainsTable(void);
+void initialize_table_entPhysicalContainsTable(void);
+Netsnmp_Node_Handler entPhysicalContainsTable_handler;
+
+Netsnmp_First_Data_Point entPhysicalContainsTable_get_first_data_point;
+Netsnmp_Next_Data_Point entPhysicalContainsTable_get_next_data_point;
+
+/* column number definitions for table entPhysicalContainsTable */
+#define COLUMN_ENTPHYSICALCHILDINDEX 1
+
+typedef struct physIndexAndChildIndex_s {
+ int_l entPhysicalIndex;
+ int_l *childIndexes; /* array of child indexes */
+ struct physIndexAndChildIndex_s *pNextEntry;
+} physIndexAndChildIndex_t;
+
+typedef struct {
+ physIndexAndChildIndex_t *pCurEntry;
+ int_l *pCuridx;
+} PhysChildtable;
+
+/* Fix for 4915033 */
+extern int addPhysicalContainsTableEntry(int xentPhysicalIndex, int xentChildIndex);
+extern int* getPhysicalContainsChildren(int parentIndex);
+extern int deletePhysicalContainsTableEntry(int xParentIndex, int xChildIndex);
+extern int deletePhysicalContainsParentIndex(int xParentIndex);
+extern int deletePhysicalContainsChildIndex(int xChildIndex);
+/* End of Fix for 4915033 */
+
+#endif /* ENTPHYSICALCONTAINSTABLE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entPhysicalTable.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,1201 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.5 2002/12/16 22:50:18 hardaker Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "stdhdr.h"
+#include "entPhysicalTable.h"
+#include "entPhysicalContainsTable.h"
+#include "entLastChangeTime.h"
+#include "entAliasMappingTable.h"
+#include "entLPMappingTable.h"
+
+entPhysicalEntry_t *gPhysicalTableTail, *gPhysicalTableHead;
+int gPhysicalTableSize;
+#define ENTPHYSICALSERIALNUM_CACHE "entphyserialnum_cache"
+/* Fix for 4915824 */
+#define ENTPHYSICALALIAS_CACHE "entphyalias_cache"
+#define ENTPHYSICALASSETID_CACHE "entphyassetid_cache"
+/* End of Fix for 4915824 */
+
+static int AddToPhysicalTable(entPhysicalEntry_t *);
+static int FreePhysicalEntry(entPhysicalEntry_t *);
+
+/** Initialize the entPhysicalTable table by defining its contents and how it's structured */
+void
+initialize_table_entPhysicalTable(void)
+{
+ static oid entPhysicalTable_oid[] = {1,3,6,1,2,1,47,1,1,1};
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /* create the table structure itself */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /* if your table is read only, it's easiest to change the
+ HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
+ /* Fix for 4921485: Temporarily disabling write access, until we */
+ /* actually need to re-enable it */
+ my_handler = netsnmp_create_handler_registration("entPhysicalTable",
+ entPhysicalTable_handler,
+ entPhysicalTable_oid,
+ OID_LENGTH(entPhysicalTable_oid),
+ HANDLER_CAN_RONLY);
+ /* End of Fix for 4921485 */
+
+ /* Future Fix for 4922782: When we re-enable write access, we will also */
+ /* look into 4914919 - persistency. Of course */
+ /* we need to remove 4921485 and enable the */
+ /* CAN_RWRITE. Treat the write handling code */
+ /* in entPhysicalTable_handlerNeeds as hostile: */
+ /* everything should be tested and properly */
+ /* reviewed. Pay special attention to when */
+ /* to return error codes */
+/*
+ my_handler = netsnmp_create_handler_registration("entPhysicalTable",
+ entPhysicalTable_handler,
+ entPhysicalTable_oid,
+ OID_LENGTH(entPhysicalTable_oid),
+ HANDLER_CAN_RWRITE);
+*/
+ /* End of Future Fix for 4922782 */
+
+ if (!my_handler || !table_info || !iinfo)
+ return; /* mallocs failed */
+
+ /***************************************************
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_INTEGER, /* index: entPhysicalIndex */
+ 0);
+
+ table_info->min_column = 2;
+ table_info->max_column = 16;
+
+ /* iterator access routines */
+ iinfo->get_first_data_point = entPhysicalTable_get_first_data_point;
+ iinfo->get_next_data_point = entPhysicalTable_get_next_data_point;
+
+ iinfo->table_reginfo = table_info;
+
+ /***************************************************
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_entPhysicalTable",
+ "Registering table entPhysicalTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initializes the entPhysicalTable module */
+void
+init_entPhysicalTable(void)
+{
+
+ /* here we initialize all the tables we're planning on supporting */
+ initialize_table_entPhysicalTable();
+ gPhysicalTableTail = gPhysicalTableHead = NULL;
+ gPhysicalTableSize = 0;
+}
+
+/** returns the first data point within the entPhysicalTable table data.
+
+ Set the my_loop_context variable to the first data point structure
+ of your choice (from which you can find the next one). This could
+ be anything from the first node in a linked list, to an integer
+ pointer containing the beginning of an array variable.
+
+ Set the my_data_context variable to something to be returned to
+ you later that will provide you with the data to return in a given
+ row. This could be the same pointer as what my_loop_context is
+ set to, or something different.
+
+ The put_index_data variable contains a list of snmp variable
+ bindings, one for each index in your table. Set the values of
+ each appropriately according to the data matching the first row
+ and return the put_index_data variable at the end of the function.
+*/
+netsnmp_variable_list *
+entPhysicalTable_get_first_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ netsnmp_variable_list *vptr;
+ entPhysicalEntry_t *zRunner;
+ zRunner = gPhysicalTableHead;
+
+ while (zRunner) {
+ if (zRunner->entPhysicalIndex > 0)
+ break;
+ zRunner = zRunner->pNextEntry;
+ }
+
+ if (zRunner == NULL) return NULL;
+
+ *my_loop_context = (void *)zRunner;
+ *my_data_context = (void *)zRunner;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *)&zRunner->entPhysicalIndex, sizeof(zRunner->entPhysicalIndex));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+/** functionally the same as entPhysicalTable_get_first_data_point, but
+ my_loop_context has already been set to a previous value and should
+ be updated to the next in the list. For example, if it was a
+ linked list, you might want to cast it and the return
+ my_loop_context->next. The my_data_context pointer should be set
+ to something you need later and the indexes in put_index_data
+ updated again. */
+
+netsnmp_variable_list *
+entPhysicalTable_get_next_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ netsnmp_variable_list *vptr;
+ entPhysicalEntry_t *zRunner;
+
+ zRunner = (entPhysicalEntry_t *) *my_loop_context;
+
+ while (zRunner) {
+ zRunner = zRunner->pNextEntry;
+ if (zRunner && zRunner->entPhysicalIndex > 0)
+ break;
+ }
+
+ if (zRunner == NULL) return NULL;
+
+ *my_loop_context = (void *)zRunner;
+ *my_data_context = (void *)zRunner;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *)&zRunner->entPhysicalIndex, sizeof(zRunner->entPhysicalIndex));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+/** handles requests for the entPhysicalTable table, if anything else needs to be done */
+int
+entPhysicalTable_handler(
+ netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests) {
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+ entPhysicalEntry_t *zPhysicalEntry;
+ static char *zentPhySerialNum, *zentPhyAlias, *zentPhyAssetId;
+ static char *zOldentPhySerialNum, *zOldentPhyAlias, *zOldentPhyAssetId;
+
+ for(request = requests; request; request = request->next) {
+ var = request->requestvb;
+ if (request->processed != 0)
+ continue;
+
+ /* perform anything here that you need to do before each
+ request is processed. */
+
+ /* the following extracts the my_data_context pointer set in
+ the loop functions above. You can then use the results to
+ help return data for the columns of the entPhysicalTable table in question */
+ zPhysicalEntry = (entPhysicalEntry_t *) netsnmp_extract_iterator_context(request);
+ if ((zPhysicalEntry==NULL)||(zPhysicalEntry->entPhysicalIndex <= 0) ) {
+ if (reqinfo->mode == MODE_GET) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ /* XXX: no row existed, if you support creation and this is a
+ set, start dealing with it here, else continue */
+ }
+
+ /* extracts the information about the table from the request */
+ table_info = netsnmp_extract_table_info(request);
+ /* table_info->colnum contains the column number requested */
+ /* table_info->indexes contains a linked list of snmp variable
+ bindings for the indexes of the table. Values in the list
+ have been set corresponding to the indexes of the
+ request */
+ if (table_info==NULL) {
+ continue;
+ }
+
+ switch(reqinfo->mode) {
+ /* the table_iterator helper should change all GETNEXTs
+ into GETs for you automatically, so you don't have to
+ worry about the GETNEXT case. Only GETs and SETs need
+ to be dealt with here */
+ case MODE_GET:
+ switch(table_info->colnum) {
+ case COLUMN_ENTPHYSICALDESCR:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zPhysicalEntry->entPhysicalDescr, strlen(zPhysicalEntry->entPhysicalDescr));
+ break;
+
+ case COLUMN_ENTPHYSICALVENDORTYPE:
+ snmp_set_var_typed_value(var, ASN_OBJECT_ID, (u_char *) zPhysicalEntry->entPhysicalVendorType, zPhysicalEntry->entPhysicalVendorTypeSize);
+ break;
+
+ case COLUMN_ENTPHYSICALCONTAINEDIN:
+ snmp_set_var_typed_value(var, ASN_INTEGER, (u_char *)&zPhysicalEntry->entPhysicalContainedIn, sizeof(zPhysicalEntry->entPhysicalContainedIn));
+ break;
+
+ case COLUMN_ENTPHYSICALCLASS:
+ snmp_set_var_typed_value(var, ASN_INTEGER, (u_char *)&zPhysicalEntry->entPhysicalClass, sizeof(zPhysicalEntry->entPhysicalClass));
+ break;
+
+ case COLUMN_ENTPHYSICALPARENTRELPOS:
+ snmp_set_var_typed_value(var, ASN_INTEGER, (u_char *)&zPhysicalEntry->entPhysicalParentRelPos, sizeof(zPhysicalEntry->entPhysicalParentRelPos));
+ break;
+
+ case COLUMN_ENTPHYSICALNAME:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zPhysicalEntry->entPhysicalName, strlen(zPhysicalEntry->entPhysicalName));
+ break;
+
+ case COLUMN_ENTPHYSICALHARDWAREREV:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zPhysicalEntry->entPhysicalHardwareRev, strlen(zPhysicalEntry->entPhysicalHardwareRev));
+ break;
+
+ case COLUMN_ENTPHYSICALFIRMWAREREV:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zPhysicalEntry->entPhysicalFirmwareRev, strlen(zPhysicalEntry->entPhysicalFirmwareRev));
+ break;
+
+ case COLUMN_ENTPHYSICALSOFTWAREREV:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zPhysicalEntry->entPhysicalSoftwareRev, strlen(zPhysicalEntry->entPhysicalSoftwareRev));
+ break;
+
+ case COLUMN_ENTPHYSICALSERIALNUM:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zPhysicalEntry->entPhysicalSerialNum, strlen(zPhysicalEntry->entPhysicalSerialNum));
+ break;
+
+ case COLUMN_ENTPHYSICALMFGNAME:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zPhysicalEntry->entPhysicalMfgName, strlen(zPhysicalEntry->entPhysicalMfgName));
+ break;
+
+ case COLUMN_ENTPHYSICALMODELNAME:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zPhysicalEntry->entPhysicalModelName, strlen(zPhysicalEntry->entPhysicalModelName));
+ break;
+
+ case COLUMN_ENTPHYSICALALIAS:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zPhysicalEntry->entPhysicalAlias, strlen(zPhysicalEntry->entPhysicalAlias));
+ break;
+
+ case COLUMN_ENTPHYSICALASSETID:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) zPhysicalEntry->entPhysicalAssetID, strlen(zPhysicalEntry->entPhysicalAssetID));
+ break;
+
+ case COLUMN_ENTPHYSICALISFRU:
+ snmp_set_var_typed_value(var, ASN_INTEGER, (u_char *) &zPhysicalEntry->entPhysicalIsFRU, sizeof(zPhysicalEntry->entPhysicalIsFRU));
+ break;
+
+ default:
+ /* We shouldn't get here */
+ snmp_log(LOG_ERR, "problem encountered in entPhysicalTable_handler: unknown column\n");
+ }
+ break;
+
+ /* Fix for 4915824: We have rewritten much of the section here, and */
+ /* we have also improved the way the boundary */
+ /* checking and return code is handled */
+ case MODE_SET_RESERVE1:
+ switch(table_info->colnum) {
+ case COLUMN_ENTPHYSICALSERIALNUM:
+ if (var->type != ASN_OCTET_STR) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ /* Fix for 4911817: Check for size and boundary limits */
+ else if ((const char*)var->val.string != NULL) {
+ if (var->val_len > 32) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGLENGTH);
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ }
+ /* End of Fix for 4911817 */
+ break;
+ case COLUMN_ENTPHYSICALALIAS:
+ if (var->type != ASN_OCTET_STR) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ /* Fix for 4911817: Check for size and boundary limits */
+ else if ((const char*)var->val.string != NULL) {
+ if (var->val_len > 32) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGLENGTH);
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ }
+ /* End of Fix for 4911817 */
+ break;
+ case COLUMN_ENTPHYSICALASSETID:
+ if (var->type != ASN_OCTET_STR) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ /* Fix for 4911817: Check for size and boundary limits */
+ else if ((const char*)var->val.string != NULL) {
+ if (var->val_len > 32) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGLENGTH);
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ }
+ /* End of Fix for 4911817 */
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_NOTWRITABLE);
+ }
+ break;
+ case MODE_SET_RESERVE2:
+ switch(table_info->colnum) {
+ case COLUMN_ENTPHYSICALSERIALNUM:
+ zOldentPhySerialNum = strdup(zPhysicalEntry->entPhysicalSerialNum);
+ if (zOldentPhySerialNum == NULL)
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_RESOURCEUNAVAILABLE);
+ netsnmp_request_add_list_data (request,
+ netsnmp_create_data_list(ENTPHYSICALSERIALNUM_CACHE,
+ zOldentPhySerialNum,
+ free));
+ break;
+ case COLUMN_ENTPHYSICALALIAS:
+ zOldentPhyAlias = strdup(zPhysicalEntry->entPhysicalAlias);
+ if (zOldentPhyAlias == NULL)
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_RESOURCEUNAVAILABLE);
+ netsnmp_request_add_list_data (request,
+ netsnmp_create_data_list(ENTPHYSICALALIAS_CACHE,
+ zOldentPhyAlias,
+ free));
+ break;
+ case COLUMN_ENTPHYSICALASSETID:
+ zOldentPhyAssetId = strdup(zPhysicalEntry->entPhysicalAssetID);
+ if (zOldentPhyAssetId == NULL)
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_RESOURCEUNAVAILABLE);
+ netsnmp_request_add_list_data (request,
+ netsnmp_create_data_list(ENTPHYSICALASSETID_CACHE,
+ zOldentPhyAssetId,
+ free));
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_NOTWRITABLE);
+ }
+ break;
+ case MODE_SET_FREE:
+ switch(table_info->colnum) {
+ /* We do not need to free anything, because the zOld* will be */
+ /* freed as part of the request */
+ case COLUMN_ENTPHYSICALSERIALNUM:
+ break;
+ case COLUMN_ENTPHYSICALALIAS:
+ break;
+ case COLUMN_ENTPHYSICALASSETID:
+ break;
+
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_NOTWRITABLE);
+ }
+ break;
+ case MODE_SET_ACTION:
+ switch(table_info->colnum) {
+ case COLUMN_ENTPHYSICALSERIALNUM:
+ /* As part of the 4915824 fix, we have improved */
+ /* the way we are doing the string copying. Using */
+ /* var->val_len will guarantee that we are not copying junk, */
+ /* since var->val.string is not NULL terminated*/
+ free (zPhysicalEntry->entPhysicalSerialNum);
+ zPhysicalEntry->entPhysicalSerialNum = (char *)malloc(sizeof(char) * (var->val_len + 1));
+ if (zPhysicalEntry->entPhysicalSerialNum == NULL)
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_RESOURCEUNAVAILABLE);
+ else {
+ strncpy(zPhysicalEntry->entPhysicalSerialNum, (const char *)var->val.string, var->val_len);
+ zPhysicalEntry->entPhysicalSerialNum[var->val_len] = 0;
+ }
+ break;
+ case COLUMN_ENTPHYSICALALIAS:
+ free (zPhysicalEntry->entPhysicalAlias);
+ zPhysicalEntry->entPhysicalAlias = (char *)malloc(sizeof(char) * (var->val_len + 1));
+ if (zPhysicalEntry->entPhysicalAlias == NULL)
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_RESOURCEUNAVAILABLE);
+ else {
+ strncpy(zPhysicalEntry->entPhysicalAlias, (const char *)var->val.string, var->val_len);
+ zPhysicalEntry->entPhysicalAlias[var->val_len] = 0;
+ }
+ break;
+ case COLUMN_ENTPHYSICALASSETID:
+ free (zPhysicalEntry->entPhysicalAssetID);
+ zPhysicalEntry->entPhysicalAssetID = (char *)malloc(sizeof(char) * (var->val_len + 1));
+ if (zPhysicalEntry->entPhysicalAssetID == NULL)
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_RESOURCEUNAVAILABLE);
+ else {
+ strncpy(zPhysicalEntry->entPhysicalAssetID, (const char *)var->val.string, var->val_len);
+ zPhysicalEntry->entPhysicalAssetID[var->val_len] = 0;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_NOTWRITABLE);
+ }
+ break;
+ case MODE_SET_COMMIT:
+ switch(table_info->colnum) {
+ case COLUMN_ENTPHYSICALSERIALNUM:
+ /* Fix for 4910657: There is no need to free the data set, */
+ /* as it is handled by the agent */
+ /* infrastructure. However, Purify should */
+ /* be run to make sure that there is no */
+ /* memory leak */
+ /* End of Fix 4910657 */
+ break;
+ case COLUMN_ENTPHYSICALALIAS:
+ break;
+ case COLUMN_ENTPHYSICALASSETID:
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_NOTWRITABLE);
+ }
+ break;
+ case MODE_SET_UNDO:
+ switch(table_info->colnum) {
+ case COLUMN_ENTPHYSICALSERIALNUM:
+ free(zPhysicalEntry->entPhysicalSerialNum);
+ zentPhySerialNum = strdup((char *)netsnmp_request_get_list_data(request, ENTPHYSICALSERIALNUM_CACHE));
+ zPhysicalEntry->entPhysicalSerialNum = zentPhySerialNum;
+ break;
+ case COLUMN_ENTPHYSICALALIAS:
+ free(zPhysicalEntry->entPhysicalAlias);
+ zentPhyAlias = strdup((char *)netsnmp_request_get_list_data(request, ENTPHYSICALALIAS_CACHE));
+ zPhysicalEntry->entPhysicalAlias = zentPhyAlias;
+ break;
+ case COLUMN_ENTPHYSICALASSETID:
+ free(zPhysicalEntry->entPhysicalAssetID);
+ zentPhyAssetId = strdup((char *)netsnmp_request_get_list_data(request, ENTPHYSICALASSETID_CACHE));
+ zPhysicalEntry->entPhysicalAssetID = zentPhyAssetId;
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_NOTWRITABLE);
+ }
+ break;
+ /* End of Fix for 4915824 */
+ default:
+ snmp_log(LOG_ERR, "problem encountered in entPhysicalTable_handler: unsupported mode\n");
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+/*
+ * Allocates a physical entry. if physidx >0 attempts to reuse an
+ * existing entry
+ */
+int
+allocPhysicalEntry(int physidx, entPhysicalEntry_t * newPhysEntry)
+{
+ entPhysicalEntry_t *physent;
+ int index;
+ /* Fix for 4927388 */
+ oid zerooid[] = { 0, 0 };
+ /* End of Fix for 4927388 */
+ /* Fix for 4927412 */
+ char emptystring[1] = "";
+ /* End of Fix for 4927412 */
+
+ /* Fix for 4927412: according to RFC 2737, entPhysicalDescr has to be */
+ /* unique - NULL should be rejected. */
+ /* entPhysicalVendorType will default to { 0, 0 } for */
+ /* NULL. For the rest, we will force NULL = "" */
+ /* (zero-length string) */
+ if (newPhysEntry->entPhysicalDescr == NULL)
+ return -1;
+ /* Fix for 4927388 */
+ if (newPhysEntry->entPhysicalVendorType == NULL) {
+ newPhysEntry->entPhysicalVendorType = zerooid;
+ newPhysEntry->entPhysicalVendorTypeSize = sizeof(zerooid);
+ }
+ /* End of Fix for 4927388 */
+ if (newPhysEntry->entPhysicalName == NULL)
+ newPhysEntry->entPhysicalName = emptystring;
+ if (newPhysEntry->entPhysicalHardwareRev == NULL)
+ newPhysEntry->entPhysicalHardwareRev = emptystring;
+ if (newPhysEntry->entPhysicalFirmwareRev == NULL)
+ newPhysEntry->entPhysicalFirmwareRev = emptystring;
+ if (newPhysEntry->entPhysicalSoftwareRev == NULL)
+ newPhysEntry->entPhysicalSoftwareRev = emptystring;
+ if (newPhysEntry->entPhysicalSerialNum == NULL)
+ newPhysEntry->entPhysicalSerialNum = emptystring;
+ if (newPhysEntry->entPhysicalMfgName == NULL)
+ newPhysEntry->entPhysicalMfgName = emptystring;
+ if (newPhysEntry->entPhysicalModelName == NULL)
+ newPhysEntry->entPhysicalModelName = emptystring;
+ if (newPhysEntry->entPhysicalAlias == NULL)
+ newPhysEntry->entPhysicalAlias = emptystring;
+ if (newPhysEntry->entPhysicalAssetID == NULL)
+ newPhysEntry->entPhysicalAssetID = emptystring;
+ /* End of Fix for 4927412 */
+
+ /* Fix for 4921309 */
+ if (physidx < 0 || physidx > MAX_ENTITY_INDEX)
+ return NULL;
+ /* End of Fix for 4921309 */
+
+ /* Fix for 4884681: Check entPhysicalClass and make sure that it
+ is between 1 and 11 - read the Entity MIB RFC
+ for details */
+ if (newPhysEntry->entPhysicalClass < ENTPHYSICAL_CLASS_OTHER || newPhysEntry->entPhysicalClass > ENTPHYSICAL_CLASS_STACK) {
+ return (-1);
+ }
+ /* End of Fix for 4884681 */
+
+ /* Fix for 4884702: */
+ /* Make sure when entPhysicalContainedIn is 0 that */
+ /* entPhysicalParentRelPos is -1. Also check for boundary */
+ if (newPhysEntry->entPhysicalParentRelPos < -1 || newPhysEntry->entPhysicalParentRelPos > MAX_ENTITY_INDEX)
+ return -1;
+ if (newPhysEntry->entPhysicalContainedIn == 0 && newPhysEntry->entPhysicalParentRelPos != -1)
+ return -1;
+ /* End of Fix for 4884702 */
+
+ /* Fix for 4929711 */
+ /* Make sure when entPhysicalRelPos is -1 that */
+ /* entPhysicalParentContainedIn is 0. */
+ if (newPhysEntry->entPhysicalParentRelPos == -1
+ && newPhysEntry->entPhysicalContainedIn != 0)
+ return -1;
+ /* End of Fix for 4929711 */
+
+ /* Fix for 4893121: */
+ /* check for invalid entries: negative number or greater than allowed */
+ /* range, stale, or non-existing entry. */
+ if ((newPhysEntry->entPhysicalContainedIn < 0 || newPhysEntry->entPhysicalContainedIn > MAX_ENTITY_INDEX)) {
+ /* reject because it is beyond the valid physical index range */
+ return (-1);
+ } else if (newPhysEntry->entPhysicalContainedIn != 0 && getPhysicalTableEntry(newPhysEntry->entPhysicalContainedIn) == NULL) {
+ /* If the intended parent (newPhysEntry->entPhysicalContainedIn) is */
+ /* a possible index (0 - 2^31-1), but it is stale or does not exist, */
+ /* then we will reject the entry */
+ return (-1);
+ }
+
+ /* End of Fix for 4893121 */
+
+ /* Fix for 4911817: Check for size and boundary limits */
+ /* entPhysicalDescr 0..255 */
+ if (strlen(newPhysEntry->entPhysicalDescr) > 255)
+ return -1;
+
+ /* entPhysicalName 0..255 */
+ if (strlen(newPhysEntry->entPhysicalName) > 255)
+ return -1;
+
+ /* entPhysicalHardwareRev 0..255 */
+ if (strlen(newPhysEntry->entPhysicalHardwareRev) > 255)
+ return -1;
+
+ /* entPhysicalFirmwareRev 0..255 */
+ if (strlen(newPhysEntry->entPhysicalFirmwareRev) > 255)
+ return -1;
+
+ /* entPhysicalSoftwareRev 0..255 */
+ if (strlen(newPhysEntry->entPhysicalSoftwareRev) > 255)
+ return -1;
+
+ /* entPhysicalSerialNum 0..32 */
+ if (strlen(newPhysEntry->entPhysicalSerialNum) > 32)
+ return -1;
+
+ /* entPhysicalMfgName 0..255 */
+ if (strlen(newPhysEntry->entPhysicalMfgName) > 255)
+ return -1;
+
+ /* entPhysicalModelName 0..255 */
+ if (strlen(newPhysEntry->entPhysicalModelName) > 255)
+ return -1;
+
+ /* entPhysicalAlias 0..32 */
+ if (strlen(newPhysEntry->entPhysicalAlias) > 32)
+ return -1;
+
+ /* entPhysicalAssetID 0..32 */
+ if (strlen(newPhysEntry->entPhysicalAssetID) > 32)
+ return -1;
+
+ /* entPhysicalIsFRU only MIB_TRUE and MIB_FALSE */
+ if (newPhysEntry->entPhysicalIsFRU < MIB_TRUE || newPhysEntry->entPhysicalIsFRU > MIB_FALSE)
+ return (-1);
+ /* End of Fix for 4911817 */
+
+ physent = malloc(sizeof (entPhysicalEntry_t));
+ if (physent == NULL) {
+ /* sent a message to log file */
+ return (-1);
+ }
+
+ physent->entPhysicalIndex = physidx;
+
+ physent->entPhysicalDescr = strdup(newPhysEntry->entPhysicalDescr);
+ /* Fix for 4884526 */
+ if (physent->entPhysicalDescr == NULL) {
+ free(physent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+
+ physent->entPhysicalVendorType =
+ malloc(newPhysEntry->entPhysicalVendorTypeSize);
+
+ /* Fix for 4884526 */
+ if (physent->entPhysicalVendorType == NULL) {
+ free(physent->entPhysicalDescr);
+ free(physent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+
+ memcpy(physent->entPhysicalVendorType,
+ newPhysEntry->entPhysicalVendorType,
+ newPhysEntry->entPhysicalVendorTypeSize);
+ physent->entPhysicalVendorTypeSize =
+ newPhysEntry->entPhysicalVendorTypeSize;
+
+ physent->entPhysicalContainedIn = newPhysEntry->entPhysicalContainedIn;
+ physent->entPhysicalClass = newPhysEntry->entPhysicalClass;
+ physent->entPhysicalParentRelPos =
+ newPhysEntry->entPhysicalParentRelPos;
+ physent->entPhysicalName = strdup(newPhysEntry->entPhysicalName);
+ /* Fix for 4884526 */
+ if (physent->entPhysicalName == NULL) {
+ free(physent->entPhysicalVendorType);
+ free(physent->entPhysicalDescr);
+ free(physent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+ physent->entPhysicalHardwareRev =
+ strdup(newPhysEntry->entPhysicalHardwareRev);
+ /* Fix for 4884526 */
+ if (physent->entPhysicalHardwareRev == NULL) {
+ free(physent->entPhysicalName);
+ free(physent->entPhysicalVendorType);
+ free(physent->entPhysicalDescr);
+ free(physent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+ physent->entPhysicalFirmwareRev =
+ strdup(newPhysEntry->entPhysicalFirmwareRev);
+ /* Fix for 4884526 */
+ if (physent->entPhysicalFirmwareRev == NULL) {
+ free(physent->entPhysicalHardwareRev);
+ free(physent->entPhysicalName);
+ free(physent->entPhysicalVendorType);
+ free(physent->entPhysicalDescr);
+ free(physent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+ physent->entPhysicalSoftwareRev =
+ strdup(newPhysEntry->entPhysicalSoftwareRev);
+ /* Fix for 4884526 */
+ if (physent->entPhysicalSoftwareRev == NULL) {
+ free(physent->entPhysicalFirmwareRev);
+ free(physent->entPhysicalHardwareRev);
+ free(physent->entPhysicalName);
+ free(physent->entPhysicalVendorType);
+ free(physent->entPhysicalDescr);
+ free(physent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+ physent->entPhysicalSerialNum =
+ strdup(newPhysEntry->entPhysicalSerialNum);
+ /* Fix for 4884526 */
+ if (physent->entPhysicalSerialNum == NULL) {
+ free(physent->entPhysicalSoftwareRev);
+ free(physent->entPhysicalFirmwareRev);
+ free(physent->entPhysicalHardwareRev);
+ free(physent->entPhysicalName);
+ free(physent->entPhysicalVendorType);
+ free(physent->entPhysicalDescr);
+ free(physent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+ physent->entPhysicalMfgName =
+ strdup(newPhysEntry->entPhysicalMfgName);
+ /* Fix for 4884526 */
+ if (physent->entPhysicalMfgName == NULL) {
+ free(physent->entPhysicalSerialNum);
+ free(physent->entPhysicalSoftwareRev);
+ free(physent->entPhysicalFirmwareRev);
+ free(physent->entPhysicalHardwareRev);
+ free(physent->entPhysicalName);
+ free(physent->entPhysicalVendorType);
+ free(physent->entPhysicalDescr);
+ free(physent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+ physent->entPhysicalModelName =
+ strdup(newPhysEntry->entPhysicalModelName);
+ /* Fix for 4884526 */
+ if (physent->entPhysicalModelName == NULL) {
+ free(physent->entPhysicalMfgName);
+ free(physent->entPhysicalSerialNum);
+ free(physent->entPhysicalSoftwareRev);
+ free(physent->entPhysicalFirmwareRev);
+ free(physent->entPhysicalHardwareRev);
+ free(physent->entPhysicalName);
+ free(physent->entPhysicalVendorType);
+ free(physent->entPhysicalDescr);
+ free(physent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+ physent->entPhysicalAlias =
+ strdup(newPhysEntry->entPhysicalAlias);
+ /* Fix for 4884526 */
+ if (physent->entPhysicalAlias == NULL) {
+ free(physent->entPhysicalModelName);
+ free(physent->entPhysicalMfgName);
+ free(physent->entPhysicalSerialNum);
+ free(physent->entPhysicalSoftwareRev);
+ free(physent->entPhysicalFirmwareRev);
+ free(physent->entPhysicalHardwareRev);
+ free(physent->entPhysicalName);
+ free(physent->entPhysicalVendorType);
+ free(physent->entPhysicalDescr);
+ free(physent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+ physent->entPhysicalAssetID =
+ strdup(newPhysEntry->entPhysicalAssetID);
+ /* Fix for 4884526 */
+ if (physent->entPhysicalAssetID == NULL) /* Memory allocation failed */
+ {
+ free(physent->entPhysicalAlias);
+ free(physent->entPhysicalModelName);
+ free(physent->entPhysicalMfgName);
+ free(physent->entPhysicalSerialNum);
+ free(physent->entPhysicalSoftwareRev);
+ free(physent->entPhysicalFirmwareRev);
+ free(physent->entPhysicalHardwareRev);
+ free(physent->entPhysicalName);
+ free(physent->entPhysicalVendorType);
+ free(physent->entPhysicalDescr);
+ free(physent);
+ return (-1);
+ }
+ /* End of Fix for 4884526 */
+
+ physent->entPhysicalIsFRU = newPhysEntry->entPhysicalIsFRU;
+
+ index = AddToPhysicalTable(physent);
+ return (index);
+}
+
+static int
+AddToPhysicalTable(entPhysicalEntry_t * xnewPhysicalEntry)
+{
+ entPhysicalEntry_t *zRunner, *temp;
+ int placeFound; /* Fix for 4921309 */
+ int zIndex;
+ zRunner = gPhysicalTableHead;
+
+ if (xnewPhysicalEntry == NULL) return (-1);
+ xnewPhysicalEntry->pNextEntry = NULL;
+
+ /* Fix for 4921309 */
+ /* If index > 0, attempt to insert in appropriate place. */
+ if (xnewPhysicalEntry->entPhysicalIndex > 0) {
+ placeFound = 0;
+ temp = zRunner;
+ while (zRunner != NULL) {
+ if (xnewPhysicalEntry->entPhysicalIndex >
+ abs(zRunner->entPhysicalIndex)) {
+ temp = zRunner;
+ zRunner = zRunner->pNextEntry;
+ } else {
+ break;
+ }
+ }
+
+ /* If the indexes don't match, we can use the specified index */
+ if (temp == NULL) {
+ /* List is empty, make this the first/last entry */
+ gPhysicalTableHead = xnewPhysicalEntry;
+ gPhysicalTableTail = xnewPhysicalEntry;
+ placeFound = 1;
+ } else if (zRunner == NULL) {
+ /* Index > last value, make this the last entry */
+ temp->pNextEntry = xnewPhysicalEntry;
+ gPhysicalTableTail = xnewPhysicalEntry;
+ placeFound = 1;
+ } else if (xnewPhysicalEntry->entPhysicalIndex !=
+ abs(zRunner->entPhysicalIndex)) {
+ /* Index < zRunner, insert entry before it */
+ xnewPhysicalEntry->pNextEntry = zRunner;
+ if (zRunner == gPhysicalTableHead) {
+ /* Index fits before list head, insert entry */
+ gPhysicalTableHead = xnewPhysicalEntry;
+ } else {
+ /* Index fits between two entries, insert entry */
+ temp->pNextEntry = xnewPhysicalEntry;
+ }
+ placeFound = 1;
+ }
+
+ if (placeFound) {
+ gPhysicalTableSize++;
+ configChanged();
+ return (xnewPhysicalEntry->entPhysicalIndex);
+ } else {
+ /* Re-initialize for code that follows */
+ zRunner = gPhysicalTableHead;
+ }
+ }
+
+ /* Either index was zero or specified index is already taken */
+ /* End of Fix for 4921309 */
+
+ if (gPhysicalTableSize > LARGE_TABLE) {
+ gPhysicalTableTail->pNextEntry = xnewPhysicalEntry;
+ zIndex = abs(gPhysicalTableTail->entPhysicalIndex) + 1;
+ xnewPhysicalEntry->entPhysicalIndex = zIndex;
+ gPhysicalTableTail = xnewPhysicalEntry;
+ gPhysicalTableSize++;
+ configChanged();
+ return (zIndex);
+ }
+
+ if (gPhysicalTableHead) { /* A slightly slower way to add into the list */
+ while (zRunner->pNextEntry != NULL) {
+ if ((abs(zRunner->pNextEntry->entPhysicalIndex)
+ - abs(zRunner->entPhysicalIndex)) > 1) {
+ temp = zRunner->pNextEntry;
+ zRunner->pNextEntry = xnewPhysicalEntry;
+ zIndex = abs(zRunner->entPhysicalIndex) + 1;
+ xnewPhysicalEntry->entPhysicalIndex = zIndex;
+ xnewPhysicalEntry->pNextEntry = temp;
+ gPhysicalTableSize++;
+ configChanged();
+ return (zIndex);
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ zIndex = abs(zRunner->entPhysicalIndex) + 1;
+ xnewPhysicalEntry->entPhysicalIndex = zIndex;
+ zRunner->pNextEntry = xnewPhysicalEntry;
+ } else {
+ zIndex = xnewPhysicalEntry->entPhysicalIndex = 1;
+ gPhysicalTableHead = xnewPhysicalEntry;
+ }
+ gPhysicalTableTail = xnewPhysicalEntry;
+ gPhysicalTableSize++;
+ configChanged();
+ return (zIndex);
+}
+
+entPhysicalEntry_t*
+getPhysicalTableEntry(int xPhysicalIndex)
+{
+ entPhysicalEntry_t *zRunner;
+ int zPhysicalIndex;
+
+ /* Fix for 4888088 */
+ if (xPhysicalIndex <= 0 || xPhysicalIndex > MAX_ENTITY_INDEX)
+ return NULL;
+ /* End of Fix for 4888088 */
+
+ zRunner = gPhysicalTableHead;
+ while (zRunner) {
+ zPhysicalIndex = zRunner->entPhysicalIndex;
+ if (zPhysicalIndex > 0) {
+ if (zPhysicalIndex == xPhysicalIndex)
+ return zRunner;
+ }
+ if (zPhysicalIndex == -(xPhysicalIndex)) {
+ return NULL; /* The stale entry exist, we can stop the search*/
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ return NULL;
+}
+
+entPhysicalEntry_t*
+getPhysicalTableStaleEntry(int xPhysicalIndex)
+{
+ entPhysicalEntry_t *zRunner;
+ int zPhysicalIndex;
+
+ /* Fix for 4888088 */
+ if (xPhysicalIndex <= 0 || xPhysicalIndex > MAX_ENTITY_INDEX)
+ return NULL;
+ /* End of Fix for 4888088 */
+
+ zRunner = gPhysicalTableHead;
+ while (zRunner) {
+ zPhysicalIndex = zRunner->entPhysicalIndex;
+ if (zPhysicalIndex < 0) {
+ if (zPhysicalIndex == -(xPhysicalIndex))
+ return zRunner;
+ }
+ if (zPhysicalIndex == xPhysicalIndex) {
+ return NULL; /* The live entry exist, we can stop the search*/
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ return NULL;
+}
+
+
+void populate_entPhysicalEntry(entPhysicalEntry_t *phyStatic,
+ char *entPhysicalDescr,
+ oid *entPhysicalVendorType,
+ int entPhysicalVendorTypeSize,
+ int entPhysicalContainedIn,
+ int entPhysicalClass,
+ int entPhysicalParentRelPos,
+ char *entPhysicalName,
+ char *entPhysicalHardwareRev,
+ char *entPhysicalFirmwareRev,
+ char *entPhysicalSoftwareRev,
+ char *entPhysicalSerialNum,
+ char *entPhysicalMfgName,
+ char *entPhysicalModelName,
+ char *entPhysicalAlias,
+ char *entPhysicalAssetID,
+ int entPhysicalIsFRU)
+{
+ phyStatic->entPhysicalDescr = entPhysicalDescr;
+ phyStatic->entPhysicalVendorType = entPhysicalVendorType;
+ phyStatic->entPhysicalVendorTypeSize = entPhysicalVendorTypeSize;
+ phyStatic->entPhysicalContainedIn = entPhysicalContainedIn;
+ phyStatic->entPhysicalClass = entPhysicalClass;
+ phyStatic->entPhysicalParentRelPos = entPhysicalParentRelPos;
+ phyStatic->entPhysicalName = entPhysicalName;
+ phyStatic->entPhysicalHardwareRev = entPhysicalHardwareRev;
+ phyStatic->entPhysicalFirmwareRev = entPhysicalFirmwareRev;
+ phyStatic->entPhysicalSoftwareRev = entPhysicalSoftwareRev;
+ phyStatic->entPhysicalSerialNum = entPhysicalSerialNum;
+ phyStatic->entPhysicalMfgName = entPhysicalMfgName;
+ phyStatic->entPhysicalModelName = entPhysicalModelName;
+ phyStatic->entPhysicalAlias = entPhysicalAlias;
+ phyStatic->entPhysicalAssetID = entPhysicalAssetID;
+ phyStatic->entPhysicalIsFRU = entPhysicalIsFRU;
+}
+
+int
+deletePhysicalTableEntry(int xPhysicalIndex)
+{
+ entPhysicalEntry_t *zRunner, *temp, *prevEntry;
+ int zPhysicalIndex;
+
+ /* Fix for 4888088 */
+ if (xPhysicalIndex <= 0 || xPhysicalIndex > MAX_ENTITY_INDEX)
+ return (-1);
+ /* End of Fix for 4888088 */
+
+ zRunner = gPhysicalTableHead;
+ prevEntry = NULL;
+ while (zRunner) {
+ zPhysicalIndex = zRunner->entPhysicalIndex;
+ if (zPhysicalIndex > 0) {
+ if (zPhysicalIndex == xPhysicalIndex) {
+ /* Fix for 4918876: We need to delete the related entries */
+ /* first */
+/*
+ Delete all instances of this physical index in all other
+ tables to maintain table integrity. Should we roll-back if a
+ deletion fails, perhaps not ?
+*/
+ deleteAliasMappingPhysicalIndex(xPhysicalIndex); /*Alias mapping*/
+ deleteLPMappingPhysicalIndex(xPhysicalIndex); /* LPTable */
+ /* Fix for 4891869 */
+ deletePhysicalContainsParentIndex(xPhysicalIndex);
+ deletePhysicalContainsChildIndex(xPhysicalIndex);
+ /* End of Fix for 4891869 */
+ /* End of Fix for 4918876 */
+
+ temp = zRunner->pNextEntry;
+ zRunner->pNextEntry = NULL;
+ if (prevEntry)
+ prevEntry->pNextEntry = temp;
+ else
+ gPhysicalTableHead = temp;
+ FreePhysicalEntry(zRunner);
+ gPhysicalTableSize--;
+
+ configChanged();
+ return (0);
+ }
+ }
+ if (zPhysicalIndex == -(xPhysicalIndex)) {
+ return (-2); /* The stale entry exist, we can stop the search*/
+ }
+ prevEntry = zRunner;
+ zRunner = zRunner->pNextEntry;
+ }
+ return (-1);
+}
+
+static int
+FreePhysicalEntry(entPhysicalEntry_t *xEntry)
+{
+ if (xEntry == NULL) return (-1);
+ free(xEntry->entPhysicalDescr);
+ free(xEntry->entPhysicalVendorType);
+ free(xEntry->entPhysicalName);
+ free(xEntry->entPhysicalHardwareRev);
+ free(xEntry->entPhysicalFirmwareRev);
+ free(xEntry->entPhysicalSoftwareRev);
+ free(xEntry->entPhysicalSerialNum);
+ free(xEntry->entPhysicalMfgName);
+ free(xEntry->entPhysicalModelName);
+ free(xEntry->entPhysicalAlias);
+ free(xEntry->entPhysicalAssetID);
+ free(xEntry);
+ xEntry = NULL;
+ return (1);
+}
+
+int
+makePhysicalTableEntryStale(int xPhysicalIndex)
+{
+
+ entPhysicalEntry_t *zRunner;
+ int zPhysicalIndex;
+
+ /* Fix for 4888088 */
+ if (xPhysicalIndex <= 0 || xPhysicalIndex > MAX_ENTITY_INDEX)
+ return (-1);
+ /* End of Fix for 4888088 */
+
+ zRunner = gPhysicalTableHead;
+
+ while (zRunner) {
+ zPhysicalIndex = zRunner->entPhysicalIndex;
+ if (zPhysicalIndex < 0) {
+ if (zPhysicalIndex == -(xPhysicalIndex))
+ return (-2); /* Entry is already stale */
+ }
+ if (zPhysicalIndex == xPhysicalIndex) {
+ /* Fix for 4918876: We need to delete the related entries first */
+/*
+ Delete all instances of this physical index in all other
+ tables to maintain table integrity. Should we roll-back if a
+ deletion fails, perhaps not ?
+*/
+ deleteAliasMappingPhysicalIndex(xPhysicalIndex); /*Alias mapping*/
+ deleteLPMappingPhysicalIndex(xPhysicalIndex); /* LPTable */
+ /* Fix for 4891869 */
+ deletePhysicalContainsParentIndex(xPhysicalIndex);
+ deletePhysicalContainsChildIndex(xPhysicalIndex);
+ /* End of Fix for 4891869 */
+ /* End of Fix for 4918876 */
+
+ zRunner->entPhysicalIndex = -zPhysicalIndex;
+
+ configChanged();
+
+ return (0);
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ return (-1);
+}
+
+int
+makePhysicalTableEntryLive(int xPhysicalIndex)
+{
+ entPhysicalEntry_t *zRunner;
+ int zPhysicalIndex;
+
+ /* Fix for 4888088 */
+ if (xPhysicalIndex <= 0 || xPhysicalIndex > MAX_ENTITY_INDEX)
+ return (-1);
+ /* End of Fix for 4888088 */
+
+ zRunner = gPhysicalTableHead;
+
+ while (zRunner) {
+ zPhysicalIndex = zRunner->entPhysicalIndex;
+ if (zPhysicalIndex > 0) {
+ if (zPhysicalIndex == xPhysicalIndex)
+ return (-2); /* Entry is already live */
+ }
+ if (zPhysicalIndex == -(xPhysicalIndex)) {
+ zRunner->entPhysicalIndex = xPhysicalIndex;
+ configChanged();
+ return (0);
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ return (-1);
+}
+
+/* Fix for 4915080 */
+/* Given a parent, find all its children based on the relationship defined */
+/* in entPhysicalContainedIn. Needs to free the memory after */
+int *getAllChildrenFromPhysicalContainedIn(int parentIdx)
+{
+ int *child_list, *temp, i;
+ entPhysicalEntry_t *zRunner;
+
+ child_list = NULL;
+ i = 0;
+ /* Fix for 4888088 */
+ if (parentIdx <= 0 || parentIdx > MAX_ENTITY_INDEX)
+ return NULL;
+ /* End of Fix for 4888088 */
+
+ zRunner = gPhysicalTableHead;
+ while (zRunner) {
+ if (zRunner->entPhysicalContainedIn == parentIdx) {
+ if (child_list == NULL) {
+ child_list = (int *)malloc(2 * sizeof(int));
+ if (child_list == NULL)
+ return NULL;
+ child_list[0] = zRunner->entPhysicalIndex;
+ child_list[1] = 0;
+ i++;
+ } else {
+ temp = child_list;
+ child_list = (int *)realloc(child_list, (i + 2)*sizeof(int));
+ if (child_list == NULL) {
+ free(temp);
+ return NULL;
+ }
+ child_list[i] = zRunner->entPhysicalIndex;
+ child_list[i+1] = 0;
+ }
+ }
+ zRunner = zRunner->pNextEntry;
+ }
+ return child_list;
+}
+/* End of Fix for 4915080 */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entPhysicalTable.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.5 2002/12/16 22:50:18 hardaker Exp $
+ */
+#ifndef ENTPHYSICALTABLE_H
+#define ENTPHYSICALTABLE_H
+
+/* function declarations */
+void init_entPhysicalTable(void);
+void initialize_table_entPhysicalTable(void);
+Netsnmp_Node_Handler entPhysicalTable_handler;
+
+Netsnmp_First_Data_Point entPhysicalTable_get_first_data_point;
+Netsnmp_Next_Data_Point entPhysicalTable_get_next_data_point;
+
+/* column number definitions for table entPhysicalTable */
+ #define COLUMN_ENTPHYSICALINDEX 1
+ #define COLUMN_ENTPHYSICALDESCR 2
+ #define COLUMN_ENTPHYSICALVENDORTYPE 3
+ #define COLUMN_ENTPHYSICALCONTAINEDIN 4
+ #define COLUMN_ENTPHYSICALCLASS 5
+ #define COLUMN_ENTPHYSICALPARENTRELPOS 6
+ #define COLUMN_ENTPHYSICALNAME 7
+ #define COLUMN_ENTPHYSICALHARDWAREREV 8
+ #define COLUMN_ENTPHYSICALFIRMWAREREV 9
+ #define COLUMN_ENTPHYSICALSOFTWAREREV 10
+ #define COLUMN_ENTPHYSICALSERIALNUM 11
+ #define COLUMN_ENTPHYSICALMFGNAME 12
+ #define COLUMN_ENTPHYSICALMODELNAME 13
+ #define COLUMN_ENTPHYSICALALIAS 14
+ #define COLUMN_ENTPHYSICALASSETID 15
+ #define COLUMN_ENTPHYSICALISFRU 16
+
+typedef struct entPhysicalEntry_s {
+ int_l entPhysicalIndex;
+ char *entPhysicalDescr;
+ oid *entPhysicalVendorType;
+ int_l entPhysicalVendorTypeSize;
+ int_l entPhysicalContainedIn;
+ int_l entPhysicalClass; /* see ENTPHYSICAL_CLASS_XXX */
+ int_l entPhysicalParentRelPos;
+ char *entPhysicalName;
+ char *entPhysicalHardwareRev;
+ char *entPhysicalFirmwareRev;
+ char *entPhysicalSoftwareRev;
+ char *entPhysicalSerialNum;
+ char *entPhysicalMfgName;
+ char *entPhysicalModelName;
+ char *entPhysicalAlias;
+ char *entPhysicalAssetID;
+ int_l entPhysicalIsFRU;
+ struct entPhysicalEntry_s *pNextEntry;
+} entPhysicalEntry_t;
+
+
+#define ENTPHYSICAL_CLASS_OTHER 1
+#define ENTPHYSICAL_CLASS_UNKNOWN 2
+#define ENTPHYSICAL_CLASS_CHASSIS 3
+#define ENTPHYSICAL_CLASS_BACKPLANE 4
+#define ENTPHYSICAL_CLASS_CONTAINER 5
+#define ENTPHYSICAL_CLASS_POWERSUPPLY 6
+#define ENTPHYSICAL_CLASS_FAN 7
+#define ENTPHYSICAL_CLASS_SENSOR 8
+#define ENTPHYSICAL_CLASS_MODULE 9
+#define ENTPHYSICAL_CLASS_PORT 10
+#define ENTPHYSICAL_CLASS_STACK 11
+
+extern entPhysicalEntry_t* getPhysicalTableEntry(int xPhysicalIndex);
+extern entPhysicalEntry_t* getPhysicalTableStaleEntry(int xPhysicalIndex);
+extern int allocPhysicalEntry(int physidx, entPhysicalEntry_t * newPhysEntry);
+
+extern void populate_entPhysicalEntry(entPhysicalEntry_t *phyStatic,
+ char *entPhysicalDescr,
+ oid *entPhysicalVendorType,
+ int entPhysicalVendorTypeSize,
+ int entPhysicalContainedIn,
+ int entPhysicalClass,
+ int entPhysicalParentRelPos,
+ char *entPhysicalName,
+ char *entPhysicalHardwareRev,
+ char *entPhysicalFirmwareRev,
+ char *entPhysicalSoftwareRev,
+ char *entPhysicalSerialNum,
+ char *entPhysicalMfgName,
+ char *entPhysicalModelName,
+ char *entPhysicalAlias,
+ char *entPhysicalAssetID,
+ int entPhysicalIsFRU);
+
+extern int makePhysicalTableEntryLive(int xPhysicalIndex);
+extern int makePhysicalTableEntryStale(int xPhysicalIndex);
+extern int deletePhysicalTableEntry(int xPhysicalIndex);
+/* Fix for 4915080 */
+extern int *getAllChildrenFromPhysicalContainedIn(int parentIndex);
+/* End of Fix for 4915080 */
+#endif /* ENTPHYSICALTABLE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entity.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "stdhdr.h"
+#include "entPhysicalTable.h"
+#include "entLogicalTable.h"
+#include "entLPMappingTable.h"
+#include "entAliasMappingTable.h"
+#include "entPhysicalContainsTable.h"
+#include "entLastChangeTime.h"
+
+
+void
+init_entity(void)
+{
+ init_entPhysicalTable();
+ init_entLogicalTable();
+ init_entLPMappingTable();
+ init_entAliasMappingTable();
+ init_entPhysicalContainsTable();
+ init_entLastChangeTime();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/entity_apidoc.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,395 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+List of Entity MIB APIs
+-----------------------
+
+Physical Table (entPhysicalTable)
+---------------------------------
+extern int allocPhysicalEntry(int physidx, entPhysicalEntry_t *newPhysEntry);
+
+ - Allocates an entry in the Physical Table. The physidx parameter
+ is the physical index requested. If physidx = 0, it will try to use
+ the first available index in the table. If physidx > 0, then it will try
+ to use the slot indicated by the index.
+
+ The API returns a physical index alloted to the entry, and this may or may
+ not be the same as the requested physical index.
+
+ The memory associated with newPhysEntry can be freed. The API creates an
+ internal copy of the data.
+
+ Returns:
+ - the index allocated to the physical entry
+ - -1 for error in adding the entry
+
+ Check the log for more details.
+
+ NOTE: The physidx (other than 0) is not used in this release of the API,
+ this is present for future purposes.
+
+entPhysicalEntry_t *getPhysicalTableEntry(int index);
+
+ - This API returns the actual Physical Table entry for the
+ particular index. The caller must NOT change the values or release
+ the memory of the entry that is returned.
+
+ Returns:
+ - the entry for that index
+ - NULL on error in finding the entry or if the entry is stale
+
+extern int deletePhysicalTableEntry(int xPhysicalIndex);
+
+ - Delete the Physical Table entry associated with the xPhysicalIndex. The
+ instances of xPhysicalIndex in the Alias Mapping Table, LP Mapping Table
+ and the Physical Contains Table will also be deleted to maintain
+ integrity among the various Entity MIB tables.
+
+ Returns:
+ - 0 for success
+ - -1 if the xPhysicalIndex is not found
+ - -2 if a stale entry was found for xPhysicalIndex.
+
+extern int makePhysicalTableEntryStale(int xPhysicalIndex);
+
+ - Makes the Physical Table entry associated with the xPhysicalIndex stale.
+ Stale means that the entry details are present in the agent's memory but
+ it will not be displayed during any SNMP operation. The entry can be
+ made available again with the call to the makePhysicalTableEntryLive
+ API.
+ The index allocated to a stale entry will not be allocated to another
+ entry.
+
+ The instances of xPhysicalIndex in the Alias Mapping Table, LP Mapping
+ Table and the Physical Contains Table will be deleted to maintain
+ integrity among the various Entity MIB tables.
+
+ Returns:
+ - 0 for success
+ - -1 if the xPhysicalIndex is not found
+ - -2 if a stale entry already exists for xPhysicalIndex.
+
+extern int makePhysicalTableEntryLive(int xPhysicalIndex);
+
+ - Makes the stale Physical Table entry associated with the xPhysicalIndex
+ live.
+ Live means that the entry details that are present in the agent's memory
+ will be displayed during SNMP operations. The entry can be
+ made stale with the call to the makePhysicalTableEntryStale API.
+
+ Returns:
+ - 0 for success
+ - -1 if the xPhysicalIndex is not found
+ - -2 if a live entry already exists for xPhysicalIndex.
+
+entPhysicalEntry_t *getPhysicalStaleEntry(int index);
+
+ - This API returns the stale Physical Table entry for the
+ particular index. The caller must NOT change the values or release
+ the memory of the entry that is returned.
+
+ Returns:
+ - the stale entry for that index
+ - NULL on error in finding the entry or if a live entry exists.
+
+int *getAllChildrenFromPhysicalContainedIn(int parentIndex);
+
+ - Get the indexes for all the children in the Physical Table which has
+ parentIndex as their parent (in the entPhysicalContainedIn field).
+
+ Returns:
+ - returns an array of indexes (integers) with null termination
+ - NULL if no children, or invalid index, or not enough memory when
+ allocating the array
+
+ NOTE: The array is a copy and SHOULD be freed when done
+
+Logical Table (entLogicalTable)
+-------------------------------
+
+extern int allocLogicalEntry(int logidx, entLogicalEntry_t * xnewLogicalEntry);
+
+ - Allocates an entry in the Logical Table. The logidx parameter
+ is the logical index requested. If logidx = 0, it will try to use
+ the first available index in the table. If physidx > 0, then it will try
+ to use the slot indicated by the index.
+
+ The API returns a logical index alloted to the entry, and this may or may
+ not be the same as the requested logical index.
+
+ The memory associated with xnewLogicalEntry can be freed. The API creates
+ an internal copy of the data.
+
+ Returns:
+ - the index allocated to the logical entry
+ - -1 for error in adding the entry
+
+ Check the log for more details.
+
+ NOTE: The logidx (other than 0) is not used in this release of the API,
+ this is present for future purposes.
+
+
+entLogicalEntry_t* getLogicalTableEntry(int xLogicalIndex);
+
+ - This API returns the actual Logical Table entry for the
+ particular index. The caller must NOT change the values or release
+ the memory of the entry that is returned.
+
+ Returns:
+ - the entry for that index
+ - NULL on error in finding the entry or if a stale entry exists.
+
+extern int deleteLogicalTableEntry(int xLogicalIndex);
+
+ - Delete the Logical Table entry associated with the xLogicalIndex. The
+ instances of xLogicalIndex in the Alias Mapping Table, and the
+ LP Mapping Table will also be deleted to maintain integrity among the
+ various Entity MIB tables.
+
+ Returns:
+ - 0 for success
+ - -1 if the xLogicalIndex is not found
+ - -2 if a stale entry was found for xLogicalIndex.
+
+extern int makeLogicalTableEntryStale(int xLogicalIndex);
+
+ - Makes the Logical Table entry associated with the xLogicalIndex stale.
+ Stale means that the entry details are present in the agent's memory but
+ it will not be displayed during any SNMP operation. The entry can be
+ made available again with the call to the makeLogicalTableEntryLive API.
+ The index allocated to a stale entry will not be allocated to another
+ entry.
+
+ The instances of xLogicalIndex in the Alias Mapping Table, and the
+ LP Mapping Table will be deleted to maintain integrity among the various
+ Entity MIB tables.
+
+ Returns:
+ - 0 for success
+ - -1 if the xPhysicalIndex is not found
+ - -2 if a stale entry already exists for xPhysicalIndex.
+
+extern int makeLogicalTableEntryLive(int xLogicalIndex);
+
+ - Makes the stale Logical Table entry associated with the xLogicalIndex
+ live.
+ Live means that the entry details that are present in the agent's memory
+ will be displayed during SNMP operations. The entry can be
+ made stale with the call to the makeLogicalTableEntryStale API.
+
+ Returns:
+ - 0 for success
+ - -1 if the xLogicalIndex is not found
+ - -2 if a live entry already exists for xLogicalIndex.
+
+entLogicalEntry_t *getLogicalStaleEntry(int index);
+
+ - This API returns the stale Logical Table entry for the
+ particular index. The caller must NOT change the values or release
+ the memory of the entry that is returned.
+
+ Returns:
+ - the stale entry for that index
+ - NULL on error in finding the entry or if a live entry exists.
+
+LP Mapping Table (entLPMappingTable)
+------------------------------------
+extern int addLPMappingTableEntry(int xentLogicalIndex, int xentPhysicalIndex);
+
+ - Adds an entry to the LP Mapping Table with the xentLogicalIndex as the
+ primary index and xentPhysicalIndex as the secondary index.
+
+ Returns:
+ - 0 for successful addition
+ - 1 if the entry for the given xentPhysicalIndex and
+ xentLogicalIndex already exists.
+ - -1 for failure
+
+extern int deleteLPMappingTableEntry(int xLogicalIndex, int xPhysicalIndex);
+
+ - Deletes the entry of the LP Mapping Table with the xLogicalIndex as
+ the primary index and xPhysicalIndex as the secondary index.
+
+ Returns:
+ - 0 for successful deletion
+ - -1 for failure
+ - -2 for stale entry (either logical or physical index, or both)
+
+extern int deleteLPMappingLogicalIndex(int xentLogicalIndex);
+
+ - Deletes all the entries of the LP Mapping Table with the xentLogicalIndex
+ as the primary index.
+
+ Returns:
+ - number of deleted entries for successful deletion
+ - -1 for failure
+ - -2 for stale logical entry
+
+extern int deleteLPMappingPhysicalIndex(int xentPhysicalIndex);
+
+ - Deletes all the entries of the LP Mapping Table with the xentPhysicalIndex
+ as the secondary index.
+
+ Returns:
+ - number of deleted entries for successful deletion
+ - -1 if no entry was deleted.
+ - -2 for stale physical entry
+
+Alias Mapping Table (entAliasMappingTable)
+------------------------------------------
+extern int addAliasMappingTableEntry(int xentPhysicalIndex, int xentLogicalIndex, oid* xAliasMapId, int xAliasMapIdSize);
+
+ - Adds an entry to the Alias Mapping Table with xentPhysicalIndex as
+ the primary index and xentLogicalIndex as the secondary index.
+ xAliasMapId is the alias (OID) for the entry and xAliasMapIdSize is a size
+ in bytes of xAliasMapId
+
+ Returns:
+ - 0 for successful addition
+ - 1 if the entry already exists for the given xentPhysicalIndex and
+ xentLogicalIndex already exists.
+ - -1 for failure
+
+extern int deleteAliasMappingTableEntry(int xentPhysicalIndex, int xentLogicalIndex);
+
+ - Deletes the entry of the Alias Mapping Table with xentPhysicalIndex as
+ the primary index and xentLogicalIndex as the secondary index.
+
+ Returns:
+ - 0 for successful deletion
+ - -1 for entry not found
+ - -2 for stale entry
+
+extern int deleteAliasMappingLogicalIndex(int xentLogicalIndex);
+
+ - Deletes all the entries of the Alias Mapping Table with the
+ xentLogicalIndex as the secondary index
+
+ Returns:
+ - number of deleted entries for successful deletion
+ - -1 for entry not found
+ - -2 for stale logical entry
+
+ NOTE: This API cannot be used to delete all indexes with
+ xentLogicalIndex = 0. Use the deleteAliasMappingTableEntry API
+ to delete such entries one by one, with the appropriate
+ entPhysicalIndex specified.
+
+extern int deleteAliasMappingPhysicalIndex(int xentPhysicalIndex);
+
+ - Deletes all the entries in the Alias Mapping Table with the
+ primary index same as the given physical index
+
+ Returns:
+ - number of deleted entries for on success
+ - -1 for entry not found
+ - -2 for stale physical entry
+
+Physical Contains Table (entPhysicalContainsTable)
+--------------------------------------------------
+extern int addPhysicalContainsTableEntry(int entPhysicalIndex, int childIndex);
+
+ - Adds an entry to the Physical Contains Table for the given entPhysicalIndex
+ and childIndex. The entPhysicalContainedIn OID present in the Physical
+ Table for the childIndex will be replaced by the entPhysicalIndex if the
+ entPhysicalIndex has a lower index than the original one
+
+ Returns:
+ - 0 for successful addition
+ - 1 if the entry already exists for the given entPhysicalIndex and
+ childIndex.
+ - -1 for failure to add.
+
+
+extern int deletePhysicalContainsTableEntry(int parentIndex, int childIndex);
+
+ - Deletes the parentIndex/childIndex entry present in the Physical Contains
+ Table.
+
+ Returns:
+ - 0 for success
+ - -1 for failure
+ - -2 for stale entry (either parent or child, or both)
+
+extern int deletePhysicalContainsParentIndex(int parentIndex);
+
+ - Deletes all the entries in the Physical Contains Table where the parent
+ index = parentIndex.
+
+ Returns:
+ - number of children deleted for that parent
+ - -1 for failure
+ - -2 for stale parent entry
+
+extern int deletePhysicalContainsChildIndex(int childIndex);
+
+ - Deletes all the entries in the Physical Contains Table where the child
+ index = childIndex.
+
+ Returns:
+ - number of parents deleted for that child
+ - -1 for failure
+ - -2 for stale child entry
+
+extern int* getPhysicalContainsChildren(int parentIndex);
+
+ - Get the indexes for all the children in the Physical Contains
+ Table, given a parent.
+
+ Returns:
+ - returns an array of indexes (integers) with null termination
+ - NULL if no children, or not enough memory when allocating the array
+
+ NOTE: The array is a copy and SHOULD be freed when done
+
+Data Structures
+---------------
+The corresponding header files will be public interfaces as well, because the
+data structures are defined there.
+
+typedef struct entPhysicalEntry_s {
+ int entPhysicalIndex;
+ char *entPhysicalDescr;
+ oid *entPhysicalVendorType;
+ int entPhysicalVendorTypeSize;
+ int entPhysicalContainedIn;
+ int entPhysicalClass; /* see ENTPHYSICAL_CLASS_XXX */
+ int entPhysicalParentRelPos;
+ char *entPhysicalName;
+ char *entPhysicalHardwareRev;
+ char *entPhysicalFirmwareRev;
+ char *entPhysicalSoftwareRev;
+ char *entPhysicalSerialNum;
+ char *entPhysicalMfgName;
+ char *entPhysicalModelName;
+ char *entPhysicalAlias;
+ char *entPhysicalAssetID;
+ int entPhysicalIsFRU;
+ struct entPhysicalEntry_s *pNextEntry;
+} entPhysicalEntry_t;
+
+typedef struct entLogicalEntry_s {
+ int entLogicalIndex;
+ char *entLogicalDescr;
+ oid *entLogicalType;
+ int entLogicalTypeSize;
+ char *entLogicalCommunity;
+ char *entLogicalTAddress;
+ oid *entLogicalTDomain;
+ int entLogicalTDomainSize;
+ char *entLogicalContextEngineId;
+ char *entLogicalContextName;
+ struct entLogicalEntry_s* pNextEntry;
+} entLogicalEntry_t;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/entityMib/stdhdr.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+#ifndef STDHDR_H
+#define STDHDR_H
+
+#define LARGE_TABLE 200
+#define MIB_TRUE 1
+#define MIB_FALSE 2
+
+#define entityMIB 1,3,6,1,2,1,47
+#define entityMIBObjects entityMIB,1
+#define entityMIBTraps entityMIB,2
+#define entityMIBTrapPrefix entityMIBTraps,0
+#define entityPhysical entityMIBObjects,1
+#define entPhysicalTable entityPhysical,1
+#define entPhysicalEntry entPhysicalTable,1
+#define entPhysicalDesc entPhysicalEntry,2
+/* 2^31 - 1 limit on all the indexes */
+#define MAX_ENTITY_INDEX 2147483647
+
+typedef long int_l; /* This is a workaround for ASN.c unable to handle
+ int data type properly
+ in a 64 bit environment */
+
+
+#endif /* STDHDR_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/healthMonitor/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,58 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate libhealthMonitor.so
+#
+# usage:
+# "make" : generate library for 64bit / sparc
+# "make ARCH=32" : generate library for 32bit / sparc
+# "make ARCH=32 MACH=x86" : generate library for 32bit / x86
+# "make ARCH=amd64" : generate 64bit AMD64 libraries
+# "make clean" : remove *.o , *.so
+#
+
+
+MARCH=$(ARCH)
+LDFLAGS_sparcv9=-m64 -I$(ROOT)$(CFGPREFIX)/include -I.
+LDFLAGS_32=-I$(ROOT)$(CFGPREFIX)/include -I.
+LDFLAGS_amd64=-m64 -I$(ROOT)$(CFGPREFIX)/include -I.
+LDFLAGS=$(LDFLAGS_$(MARCH))
+
+CFLAGS_32=-Kpic
+CFLAGS_sparcv9=-Kpic
+CFLAGS_amd64=-Kpic
+CFLAGS=$(CFLAGS_$(MARCH))
+
+LDLIBS_sparcv9= -L/usr/lib/sparcv9 -l kstat
+LDLIBS_32= -l kstat
+LDLIBS_amd64= -L /usr/lib/amd64 -lkstat
+LDLIBS=$(LDLIBS_$(MARCH))
+
+
+TARGET= libhealthMonitor.so
+PROG= libhealthMonitor.so
+SRCS= dsr.c kr_iostat.c kr_memory.c kr_nfsstat.c kr_vmstat.c healthMonitor.c
+OBJS = $(SRCS:.c=.o)
+
+all: $(PROG)
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) $(LDLIBS) -G -o $@ $(OBJS)
+.c.o:
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -c $<
+clean:
+ rm -f *.o *.so
+
+install:
+ /usr/bin/cp health_monitor.conf $(ROOT)/etc/net-snmp/snmp ; \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/healthMonitor/dsr.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,656 @@
+/*
+* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+*
+* U.S. Government Rights - Commercial software. Government users are subject
+* to the Sun Microsystems, Inc. standard license agreement and applicable
+* provisions of the FAR and its supplements.
+*
+*
+* This distribution may include materials developed by third parties. Sun,
+* Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+* trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+*
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <limits.h>
+#include <string.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <sys/mnttab.h>
+#include <sys/systeminfo.h>
+#include <sys/dklabel.h>
+#include <sys/dkio.h>
+
+typedef struct nms {
+ char *dsk;
+ int dnum;
+ char *dty;
+ char *real;
+ int devtype;
+ struct nms *next;
+} nms_t;
+
+typedef struct list_of_disks {
+ char *dtype;
+ int dnum;
+ char *dsk;
+ char *dpart[NDKMAP];
+ struct list_of_disks *next;
+} disk_list_t;
+
+static nms_t *rummage_dev_dsk(void);
+static void do_snm(char *, char *);
+static int look_up_name(const char *, nms_t *);
+static void make_an_entry(char *, const char *, nms_t **, int);
+static char *trim(char *);
+static void rummage_path_to_inst(nms_t *);
+static nms_t *find_str(const char *, nms_t *);
+static int pline(char *, nms_t *);
+static void insert_dlist_ent(const char *, const int, const char *,
+ int, disk_list_t **);
+static void mk_list_of_disks(nms_t *, disk_list_t **);
+static int str_is_digit(char *);
+
+extern void *build_disk_list(void *);
+extern char *lookup_ks_name(char *, void *);
+
+#define DISK 0
+#define TAPE 1
+
+#define MAX_TYPES 2
+
+
+/*
+ * Build a list of disks attached to the system. if a previous list is passed
+ * in, delete that list before building the new list.
+ */
+
+void *
+build_disk_list(void *v)
+{
+ nms_t *list;
+ nms_t *t;
+ disk_list_t *rv=NULL;
+ disk_list_t *p;
+ int i;
+
+ p = (disk_list_t *)v;
+ if (p != (disk_list_t *)NULL) {
+ disk_list_t *t;
+ while (p) {
+ (void) free(p->dtype);
+ (void) free(p->dsk);
+ for (i = 0; i < NDKMAP; i++)
+ (void) free(p->dpart[i]);
+ t = p;
+ p = p->next;
+ (void) free(t);
+ }
+ }
+ /*
+ * Build the list of devices connected to the system.
+ */
+ list = rummage_dev_dsk();
+ rummage_path_to_inst(list);
+ mk_list_of_disks(list, &rv);
+ t = list;
+ while (t) {
+ nms_t *f;
+ (void) free(t->real);
+ f = t;
+ t = t->next;
+ if (t != list) {
+ (void) free(f);
+ }
+ }
+ return (rv);
+}
+
+
+/*
+ * Currently it isn't necessary to look below the cntndn level....
+ */
+
+static nms_t *
+rummage_dev_dsk(void)
+{
+ nms_t *list = (nms_t *)0;
+ DIR *dskp;
+ int i;
+
+ for (i = 0; i < MAX_TYPES; i++) {
+ switch (i) {
+
+ case DISK:
+ dskp = opendir("/dev/dsk");
+ break;
+ case TAPE:
+ dskp = opendir("/dev/rmt");
+ break;
+ default:
+ dskp = NULL;
+ break;
+ }
+
+ if (dskp != NULL) {
+ struct dirent *bpt;
+ while ((bpt = readdir(dskp)) != NULL) {
+ struct stat sbuf;
+ char dnmbuf[1025];
+ char snm[256];
+ char lnm[256];
+ char *npt;
+ char nmbuf[1025];
+
+ if (bpt->d_name[0] == '.')
+ continue;
+
+ if (i == DISK) {
+ (void) strcpy(lnm, bpt->d_name);
+ do_snm(bpt->d_name, snm);
+ } else {
+ /*
+ * don't want all rewind/etc
+ * devices for a tape
+ */
+ if (!str_is_digit(bpt->d_name))
+ continue;
+ (void) sprintf(snm, "rmt/%s",
+ bpt->d_name);
+ (void) sprintf(lnm, "rmt/%s",
+ bpt->d_name);
+ }
+ if (look_up_name(snm, list) != 0)
+ continue;
+
+ if (i == DISK) {
+ (void) sprintf(dnmbuf,
+ "/dev/dsk/%s", bpt->d_name);
+ } else {
+ (void) sprintf(dnmbuf,
+ "/dev/rmt/%s", bpt->d_name);
+ }
+ if (lstat(dnmbuf, &sbuf) != -1) {
+ int cnt;
+ if ((sbuf.st_mode & S_IFMT)
+ == S_IFLNK) {
+
+ nmbuf[0] = '\0';
+ if ((cnt = readlink(dnmbuf, nmbuf, sizeof (nmbuf))) != 1) {
+ nmbuf[cnt] = '\0';
+ npt = nmbuf;
+ } else
+ npt = (char *)0;
+ } else
+ npt = lnm;
+ if (npt)
+ make_an_entry(npt, snm,
+ &list, i);
+ }
+ }
+ (void) closedir(dskp);
+ }
+ }
+ return (list);
+}
+
+
+static int
+look_up_name(const char *nm, nms_t *list)
+{
+ int rv = 0;
+
+ while (list != (nms_t *)NULL) {
+ if (strcmp(list->dsk, nm) != 0)
+ list = list->next;
+ else {
+ rv++;
+ break;
+ }
+ }
+ return (rv);
+}
+
+
+static void
+do_snm(char *orig, char *shortnm)
+{
+ while (*orig != 's' && *orig != 'p')
+ *shortnm++ = *orig++;
+ *shortnm = '\0';
+}
+
+
+static void
+make_an_entry(char *lname, const char *shortnm, nms_t **list, int devtype)
+{
+ nms_t *entry;
+
+ entry = (nms_t *)malloc(sizeof (nms_t));
+ if (entry != (nms_t *)NULL) {
+ int len;
+ char *nlnm;
+
+ nlnm = trim(lname);
+ len = strlen(nlnm);
+ len++;
+ entry->real = (char *)malloc(len);
+ if (entry->real) {
+ (void) strcpy(entry->real, nlnm);
+ len = strlen(shortnm);
+ len++;
+ entry->dsk = (char *)malloc(len);
+ if (entry->dsk) {
+ (void) strcpy(entry->dsk, shortnm);
+ entry->dnum = -1;
+ entry->dty = (char *)NULL;
+ entry->next = (nms_t *)NULL;
+ entry->devtype = devtype;
+ if (*list != (nms_t *)NULL) {
+ entry->next = *list;
+ *list = entry;
+ } else
+ *list = entry;
+ } else {
+ (void) free(entry->real);
+ (void) free(entry);
+ }
+ } else
+ (void) free(entry);
+ }
+}
+
+
+static char *
+trim(char *fnm)
+{
+ char *ptr;
+ char *lname = "../../devices";
+
+ while (*lname == *fnm) {
+ lname++;
+ fnm++;
+ }
+ if ((ptr = strrchr(fnm, (int)':')) != (char *)NULL)
+ *ptr = '\0';
+ return (fnm);
+}
+
+
+static void
+rummage_path_to_inst(nms_t *list)
+{
+ FILE *inpt;
+
+ inpt = fopen("/etc/path_to_inst", "r");
+ if (inpt) {
+ char ibuf[1024];
+
+ while (fgets(ibuf, sizeof (ibuf), inpt) != (char *)NULL) {
+ if (ibuf[0] != '#') {
+ (void) pline(ibuf, list);
+ }
+ }
+ (void) fclose(inpt);
+ }
+}
+
+
+/*
+ * Process an /etc/path_to_inst line. The line is of the format:
+ * "/pathname/device@unit,instance" devicenumber We want to extract the
+ * devicenumber and the device from this string if it is one of the ones in
+ * /dev/dsk.
+ */
+
+
+static int
+pline(char *ib, nms_t *list)
+{
+ char *rpt;
+ char *bpt;
+ nms_t *entry;
+ int rv = 0;
+ int done;
+ int len;
+ char *v;
+ /*
+ * Skip over any stuff at the beginning of the line before a leading
+ * '/' If we don't find a '/', the line is malformed and we just skip
+ * it.
+ */
+ while (*ib) {
+ if (*ib != '/')
+ ib++;
+ else
+ break;
+ }
+ if (!(*ib))
+ goto done;
+
+ /*
+ * Find the trailing '"' in the line. If not found, we just
+ * skip the line.
+ */
+
+ rpt = strchr(ib, (int)'""');
+ if (rpt != NULL)
+ rpt = strchr(rpt, (int)'""');
+
+ /*
+ * Find a matching entry in the list of names from /dev/dsk.
+ * If no match, we're not interested.
+ */
+ if (!rpt)
+ goto done;
+
+ *rpt = '\0';
+
+
+ if ((entry = find_str(ib, list)) == (nms_t *)NULL)
+ goto done;
+
+ bpt = rpt;
+ /*
+ * Extract the device number at the end of
+ * the line. We expect whitespace followed by
+ * the beginning of the currently numeric
+ * device id string;
+ */
+ rpt++;
+ done = 0;
+ while (!done) {
+ if (*rpt) {
+ if (*rpt != '\n') {
+ if (isspace((int)*rpt))
+ rpt++;
+ else
+ done++;
+ } else
+ done++;
+ } else
+ done++;
+ }
+ /*
+ * Should now be at the beginning of the
+ * device number. Point entry->dn at the
+ * string.
+ */
+ if (*rpt) {
+ v = rpt;
+ len = 0;
+ while (v) {
+ if (*v != '\n') {
+ v++;
+ len++;
+ } else {
+ *v = '\0';
+ v = (char *)NULL;
+ }
+ }
+ if (len) {
+ entry->dnum = atoi(rpt);
+ while (bpt > ib) {
+ if (*bpt != '@')
+ bpt--;
+ else
+ break;
+ }
+ if (bpt > ib) {
+ *bpt-- = '\0';
+ len = 0;
+ while (bpt > ib) {
+ if (*bpt != '/') {
+ bpt--;
+ len++;
+ } else
+ break;
+ }
+ if (bpt > ib) {
+ bpt++;
+ len++;
+ entry->dty = (char *)malloc(len);
+ if (entry->dty) {
+ (void) strcpy(entry->dty, bpt);
+ rv++;
+ }
+ }
+ }
+ }
+ }
+done:
+ return (rv);
+}
+
+
+
+static nms_t *
+find_str(const char *inbuf, nms_t *list)
+{
+ while (list) {
+ if (strcmp(inbuf, list->real) != 0)
+ list = list->next;
+ else
+ break;
+ }
+ return (list);
+}
+
+
+
+static void
+mk_list_of_disks(nms_t *list, disk_list_t **hd)
+{
+ while (list) {
+ insert_dlist_ent(list->dsk, list->dnum, list->dty,
+ list->devtype, hd);
+ list = list->next;
+ }
+}
+
+
+
+/*
+ * Determine if a name is already in the list of disks. If not, insert the
+ * name in the list.
+ */
+
+
+static void
+insert_dlist_ent(const char *nm, const int dn, const char *dty,
+ int devtype, disk_list_t ** hd)
+{
+ disk_list_t *stuff;
+ int i, len;
+
+ if (dty == NULL)
+ return;
+
+ stuff = *hd;
+ while (stuff) {
+ if (strcmp(nm, stuff->dsk) != 0)
+ stuff = stuff->next;
+ else
+ break;
+ }
+ if (!stuff) {
+ disk_list_t *entry;
+ int mv;
+
+ entry = (disk_list_t *)malloc(
+ sizeof (disk_list_t));
+ if (entry) {
+ entry->dnum = dn;
+ entry->dsk = (char *)nm;
+ entry->dtype = (char *)dty;
+
+ len = strlen(nm) + 4;
+ for (i = 0; i < NDKMAP; i++) {
+ if (devtype == DISK) {
+ entry->dpart[i] = (char *)malloc(len);
+ if (entry->dpart[i]) {
+ (void) sprintf(entry->dpart[i],
+ "%ss%d\0", nm, i);
+ }
+ } else
+ entry->dpart[i] = NULL;
+ }
+ /*
+ * Figure out where to insert the name. The list is
+ * ostensibly in sorted order.
+ */
+ if (*hd != (disk_list_t *)NULL) {
+ disk_list_t *follw;
+ stuff = *hd;
+
+ /*
+ * Look through the list. While the strcmp
+ * value is less than the current value,
+ */
+ while (stuff) {
+ if ((mv = strcmp(entry->dtype,
+ stuff->dtype)) < 0) {
+ follw = stuff;
+ stuff = stuff->next;
+ } else
+ break;
+ }
+ if (mv == 0) {
+ while (stuff) {
+ if (strcmp(entry->dtype,
+ stuff->dtype) != 0)
+ break;
+ if (dn > stuff->dnum) {
+ follw = stuff;
+ stuff = stuff->next;
+ } else
+ break;
+ }
+ }
+ /*
+ * We should now be ready to insert an
+ * entry...
+ */
+ if (mv >= 0) {
+ if (stuff == *hd) {
+ entry->next = stuff;
+ *hd = entry;
+ } else {
+ entry->next = follw->next;
+ follw->next = entry;
+ }
+ } else {
+ /*
+ * insert at the end of the
+ * list
+ */
+ follw->next = entry;
+ entry->next = (disk_list_t *)NULL;
+ }
+ } else {
+ *hd = entry;
+ entry->next = (disk_list_t *)NULL;
+ }
+ }
+ }
+}
+
+
+
+char *
+lookup_ks_name(char *dev_nm, void *val)
+{
+ char *rv = (char *)0;
+ int dv;
+ char *device;
+ int len;
+ char cmpbuf[1024];
+ struct list_of_disks *list;
+ char nmbuf[1024];
+ char *tmpnm;
+ char *nm;
+ int partition;
+
+ tmpnm = nm = nmbuf;
+ while ((*dev_nm) && (*dev_nm != ',')) {
+ *tmpnm++ = *dev_nm++;
+ }
+ *tmpnm = '\0';
+
+ if (*dev_nm == ',') {
+ dev_nm++;
+ partition = (int)(*dev_nm - 'a');
+ if ((partition < 0) || (partition > NDKMAP))
+ partition = -1;
+ } else
+ partition = -1;
+
+ list = (disk_list_t *)val;
+ device = nm;
+ len = 0;
+ while (*nm) {
+ if (isalpha((int)*nm)) {
+ nm++;
+ len++;
+ } else
+ break;
+ }
+ (void) strncpy(cmpbuf, device, len);
+ cmpbuf[len] = '\0';
+
+ if (*nm) {
+ int mv;
+
+ dv = atoi(nm);
+ while (list) {
+ if ((mv = strcmp(cmpbuf, list->dtype)) < 0)
+ list = list->next;
+ else
+ break;
+ }
+ if (mv == 0) {
+ while (list) {
+ if (list->dnum < dv)
+ list = list->next;
+ else
+ break;
+ }
+ if(list) {
+ if (list->dnum == dv) {
+ if ((partition != -1) &&
+ (list->dpart[partition] != NULL))
+ rv = list->dpart[partition];
+ else
+ rv = list->dsk;
+ }
+ }
+ }
+ }
+ return (rv);
+}
+
+
+
+static int
+str_is_digit(char *str)
+{
+ int i;
+ int j = 0;
+
+ for (i = 0; i < (int)strlen(str); i++) {
+ if (isdigit(str[i])) j++;
+ }
+
+ if (j == strlen(str))
+ return (1);
+ else
+ return (0);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/healthMonitor/healthMonitor.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,3388 @@
+
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject to
+ * the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun, Sun
+ * Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using :
+ * mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+
+/*
+ * This Module implements all the nodes in health-monitor-mib.mib.
+ * mib2c.scalar.conf is used to generate template for all nodes except the
+ * hmDiskGroup mib2c.iterate.conf is used to generate template for
+ * hmDiskGroup (which contains a Table) The two templates are merged so that
+ * all the implementation for health-monitor-mib is present as one module.
+ * Template functions are filled and new functions are added to do the
+ * following: 1) Data Acquisition, 2) Automatic refresh, 3) trap generation,
+ * 4) subscribe for thresholds from health_monitor.conf file.
+ */
+
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "healthMonitor.h"
+#include <netdb.h>
+
+
+/*
+ * DATA: Following are the variables in which data collected for various
+ * nodes is stored. The values are refreshed every "refresh interval"
+ * (default 60 seconds). The value stored in this variable is returned
+ * whenever a "get" request comes.
+ */
+
+/* Data for SWAP node */
+int swapavail_data, swapresv_data, swapalloc_data, swapused_data,
+ swaptotal_data;
+
+/* Data for Kernel node */
+ulong sum_smtx = 0;
+int ncpus;
+
+/* Data for NFS node */
+double calls;
+int badcalls, retrans, badxids, timeouts, newcreds, badverfs,
+ timers, nomem, cantsend, interrupts;
+char callsStr[8];
+
+/* Data for CPU node */
+int runque, waiting, swapque;
+
+/* Data for RAM node */
+int handspread, scan;
+
+/*
+ * Data for KMEM node . Only alloc_fail and mem_free are published through
+ * the MIB
+ */
+int alloc, alloc_fail=0, buf_size, buf_avail, buf_total, buf_max;
+int mem_avail=0, mem_inuse=0, mem_free=0;
+
+/*
+ * Data for DNLC node . hits, misses, hitrate and refrate are published
+ * through the MIB. Rest of variables are temp data used for processing alarm
+ * conditions.
+ */
+
+int firsttime = 1;
+int lasthits = 0;
+int lastmisses = 0;
+int prevhits = 0;
+int prevmisses = 0;
+long prevtime = 0;
+
+long hits, misses;
+long hitrate, refrate;
+
+/*
+ * Data for diskGroup. We maintain the disk table in memory as a linked list
+ * of hmDiskTable objects "head" points to the first memeber of the linked
+ * list
+ */
+
+hmDiskTable *head;
+int diskCount;
+
+/*
+ * Following are the variables that hold threshold's used to determine alarm
+ * conditions. The variables are updated with threshold settings in
+ * health_monitor.conf file, when module is initialized.
+ */
+
+/* Thresholds and States for SWAP node */
+int threshold_swapavail_info = 500000, threshold_swapavail_warning = 100000,
+ threshold_swapavail_error = 40000;
+
+int prev_SWAP_state = OK;
+int new_SWAP_state = OK;
+int SWAP_rule_state = NOTINIT;
+
+/* Thresholds for Kernel node */
+ulong threshold_mutex_info = 200, threshold_mutex_warning = 500;
+
+int prev_mutex_state = OK;
+int new_mutex_state = OK;
+int Kernel_rule_state = NOTINIT;
+
+/* Thresholds for NFS node */
+float threshold_mincalls = 0.1, threshold_badxids = 0.0, threshold_timeouts = 5.0;
+
+int prev_NFS_state = OK;
+int new_NFS_state = OK;
+int NFS_rule_state = NOTINIT;
+
+/* Thresholds for CPU node */
+float threshold_cpuload_info = 1.0, threshold_cpuload_warning = 2.0,
+ threshold_cpuload_error = 3.0;
+
+int prev_cpuload_state = OK;
+int new_cpuload_state = OK;
+int CPU_rule_state = NOTINIT;
+
+/* Thresholds for RAM node */
+int threshold_restime_long = 600, threshold_restime_ok = 40,
+ threshold_restime_error = 20;
+
+int prev_restime_state = OK;
+int new_restime_state = OK;
+int RAM_rule_state = NOTINIT;
+
+/* Thresholds for KMEM node */
+int threshold_freemem_low = 1;
+int firstkmemerrs = 0, lastkmemerrs = 0; /* These must be Global
+ * variables and
+ * preserved across
+ * invocation of
+ * check_state_KMEM()
+ * function */
+
+int prev_kmem_state = OK;
+int new_kmem_state = OK;
+int KMEM_rule_state = NOTINIT;
+
+/* Thresholds for DNLC node */
+
+float threshold_dnlc_active = 100.0, threshold_dnlc_warning = 80;
+
+int prev_dnlc_state = OK;
+int new_dnlc_state = OK;
+int DNLC_rule_state = NOTINIT;
+
+/* Thresholds for diskGroup */
+
+long disk_busy_warning = 10.0, disk_busy_problem = 30.0, disk_svc_t_warning = 20.0,
+ disk_svc_t_problem = 30.0;
+
+
+/* COMMON data variables */
+
+u_char hostName[MAXHOSTNAMELEN], moduleName[15], statusOIDContext[5];
+int hm_refresh_interval=60;
+time_t hm_prev_ref_time=1;
+time_t hm_prev_disk_ref=1;
+
+
+/** Initializes the healthMonitor module */
+void
+init_healthMonitor(void)
+{
+
+ int retCode;
+
+ static oid hmSpinsOnMutexes_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 2, 1, 1, 0};
+ static oid hmTotProcInRunQueue_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 4, 1, 1, 0};
+ static oid hmTotRPCCalls_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 3, 1, 1, 0};
+ static oid hmUsedSwapSpace_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 1, 1, 4, 0};
+ static oid hmDNLCMisses_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 8, 1, 2, 0};
+ static oid hmReservedSwapSpace_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 1, 1, 2, 0};
+ static oid hmTotMemAllocFails_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 3, 1, 9, 0};
+ static oid hmAvailableSwapSpace_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 1, 1, 1, 0};
+ static oid hmDNLCHitRate_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 8, 1, 3, 0};
+ static oid hmDNLCHits_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 8, 1, 1, 0};
+ static oid hmAllocatedSwapSpace_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 1, 1, 3, 0};
+ static oid hmTotNumOfCPUs_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 2, 1, 2, 0};
+ static oid hmPageScanRate_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 6, 1, 2, 0};
+ static oid hmTimers_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 3, 1, 8, 0};
+ static oid hmTotBadRPCCalls_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 3, 1, 2, 0};
+ static oid hmDNLCRefRate_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 8, 1, 4, 0};
+ static oid hmTotSendFails_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 3, 1, 10, 0};
+ static oid hmTotFailedCallsBV_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 3, 1, 7, 0};
+ static oid hmTotNumOfAuthRefresh_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 3, 1, 6, 0};
+ static oid hmHandspread_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 6, 1, 1, 0};
+ static oid hmTotRPCRetransmissions_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 3, 1, 3, 0};
+ static oid hmKmemFreeMem_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 7, 1, 2, 0};
+ static oid hmTotBadRPCReplies_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 3, 1, 4, 0};
+ static oid hmKmemErrors_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 7, 1, 1, 0};
+ static oid hmTotProcReadyInSwap_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 4, 1, 3, 0};
+ static oid hmTotProcBlocked_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 4, 1, 2, 0};
+ static oid hmTotRPCCallsTimedOut_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 3, 1, 5, 0};
+
+ DEBUGMSGTL(("healthMonitor", "Initializing\n"));
+
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmSpinsOnMutexes",
+ get_hmSpinsOnMutexes,
+ hmSpinsOnMutexes_oid,
+ OID_LENGTH(hmSpinsOnMutexes_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotProcInRunQueue",
+ get_hmTotProcInRunQueue,
+ hmTotProcInRunQueue_oid,
+ OID_LENGTH(hmTotProcInRunQueue_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotRPCCalls",
+ get_hmTotRPCCalls,
+ hmTotRPCCalls_oid,
+ OID_LENGTH(hmTotRPCCalls_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmUsedSwapSpace",
+ get_hmUsedSwapSpace,
+ hmUsedSwapSpace_oid,
+ OID_LENGTH(hmUsedSwapSpace_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmDNLCMisses",
+ get_hmDNLCMisses,
+ hmDNLCMisses_oid,
+ OID_LENGTH(hmDNLCMisses_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmReservedSwapSpace",
+ get_hmReservedSwapSpace,
+ hmReservedSwapSpace_oid,
+ OID_LENGTH(hmReservedSwapSpace_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotMemAllocFails",
+ get_hmTotMemAllocFails,
+ hmTotMemAllocFails_oid,
+ OID_LENGTH(hmTotMemAllocFails_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmAvailableSwapSpace",
+ get_hmAvailableSwapSpace,
+ hmAvailableSwapSpace_oid,
+ OID_LENGTH(hmAvailableSwapSpace_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmDNLCHitRate",
+ get_hmDNLCHitRate,
+ hmDNLCHitRate_oid,
+ OID_LENGTH(hmDNLCHitRate_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmDNLCHits",
+ get_hmDNLCHits,
+ hmDNLCHits_oid,
+ OID_LENGTH(hmDNLCHits_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmAllocatedSwapSpace",
+ get_hmAllocatedSwapSpace,
+ hmAllocatedSwapSpace_oid,
+ OID_LENGTH(hmAllocatedSwapSpace_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotNumOfCPUs",
+ get_hmTotNumOfCPUs,
+ hmTotNumOfCPUs_oid,
+ OID_LENGTH(hmTotNumOfCPUs_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmPageScanRate",
+ get_hmPageScanRate,
+ hmPageScanRate_oid,
+ OID_LENGTH(hmPageScanRate_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTimers",
+ get_hmTimers,
+ hmTimers_oid,
+ OID_LENGTH(hmTimers_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotBadRPCCalls",
+ get_hmTotBadRPCCalls,
+ hmTotBadRPCCalls_oid,
+ OID_LENGTH(hmTotBadRPCCalls_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmDNLCRefRate",
+ get_hmDNLCRefRate,
+ hmDNLCRefRate_oid,
+ OID_LENGTH(hmDNLCRefRate_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotSendFails",
+ get_hmTotSendFails,
+ hmTotSendFails_oid,
+ OID_LENGTH(hmTotSendFails_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotFailedCallsBV",
+ get_hmTotFailedCallsBV,
+ hmTotFailedCallsBV_oid,
+ OID_LENGTH(hmTotFailedCallsBV_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotNumOfAuthRefresh",
+ get_hmTotNumOfAuthRefresh,
+ hmTotNumOfAuthRefresh_oid,
+ OID_LENGTH(hmTotNumOfAuthRefresh_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmHandspread",
+ get_hmHandspread,
+ hmHandspread_oid,
+ OID_LENGTH(hmHandspread_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotRPCRetransmissions",
+ get_hmTotRPCRetransmissions,
+ hmTotRPCRetransmissions_oid,
+ OID_LENGTH(hmTotRPCRetransmissions_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmKmemFreeMem",
+ get_hmKmemFreeMem,
+ hmKmemFreeMem_oid,
+ OID_LENGTH(hmKmemFreeMem_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotBadRPCReplies",
+ get_hmTotBadRPCReplies,
+ hmTotBadRPCReplies_oid,
+ OID_LENGTH(hmTotBadRPCReplies_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmKmemErrors",
+ get_hmKmemErrors,
+ hmKmemErrors_oid,
+ OID_LENGTH(hmKmemErrors_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotProcReadyInSwap",
+ get_hmTotProcReadyInSwap,
+ hmTotProcReadyInSwap_oid,
+ OID_LENGTH(hmTotProcReadyInSwap_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotProcBlocked",
+ get_hmTotProcBlocked,
+ hmTotProcBlocked_oid,
+ OID_LENGTH(hmTotProcBlocked_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hmTotRPCCallsTimedOut",
+ get_hmTotRPCCallsTimedOut,
+ hmTotRPCCallsTimedOut_oid,
+ OID_LENGTH(hmTotRPCCallsTimedOut_oid),
+ HANDLER_CAN_RONLY));
+
+
+ /* Initialize Disk stuff */
+
+ /* here we initialize all the tables we're planning on supporting */
+
+ initialize_table_hmDiskTable();
+
+
+ /*
+ * Additions to init function to register callbacks for tokens. Whenever
+ * a token is encountered in health_monitor.conf file, the function
+ * read_health_monitor_thresholds is called by the agent
+ */
+
+ register_config_handler("health_monitor", "hm_refresh_interval",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_swapavail_info",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_swapavail_warning",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_swapavail_error",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_mutex_info",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_mutex_warning",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_mincalls",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_badxids",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_timeouts",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_cpuload_info",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_cpuload_warning",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_cpuload_error",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_restime_long",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_restime_ok",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_restime_error",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_freemem_low",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_dnlc_active",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "threshold_dnlc_warning",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "disk_busy_warning",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "disk_busy_problem",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "disk_svc_t_warning",
+ read_health_monitor_thresholds, NULL, NULL);
+
+ register_config_handler("health_monitor", "disk_svc_t_problem",
+ read_health_monitor_thresholds, NULL, NULL);
+
+
+
+ /*
+ * Initialize data that's required in the trap - The hostname,
+ * modulenaem, statusOIDContext
+ */
+
+ retCode = gethostname((char *) hostName, MAXHOSTNAMELEN);
+ if (retCode != 0)
+ strcpy((char *) hostName, "null\0");
+
+ strcpy((char *) moduleName, "Health-Monitor\0");
+
+ strcpy((char *) statusOIDContext, "null\0");
+
+
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_POST_READ_CONFIG,
+ hm_post_read_config, NULL);
+
+
+}
+
+/** Initialize the hmDiskTable table by defining its contents and how it's structured */
+void
+initialize_table_hmDiskTable(void)
+{
+ static oid hmDiskTable_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 5, 1};
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /* create the table structure itself */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /*
+ * if your table is read only, it's easiest to change the
+ * HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY
+ */
+ my_handler = netsnmp_create_handler_registration("hmDiskTable",
+ hmDiskTable_handler,
+ hmDiskTable_oid,
+ OID_LENGTH(hmDiskTable_oid),
+ HANDLER_CAN_RONLY);
+
+ if (!my_handler || !table_info || !iinfo)
+ return; /* mallocs failed */
+
+ /***************************************************
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* index: hmDiskName */
+ 0);
+
+ table_info->min_column = 1;
+ table_info->max_column = 5;
+
+ /* iterator access routines */
+ iinfo->get_first_data_point = hmDiskTable_get_first_data_point;
+ iinfo->get_next_data_point = hmDiskTable_get_next_data_point;
+
+ iinfo->table_reginfo = table_info;
+
+ /***************************************************
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_hmDiskTable",
+ "Registering table hmDiskTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+int
+get_hmSpinsOnMutexes(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & sum_smtx, sizeof(sum_smtx));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTotProcInRunQueue(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long runque_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ runque_long = (long) runque;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & runque_long, sizeof(runque_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTotRPCCalls(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) callsStr, strlen(callsStr) );
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmUsedSwapSpace(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long swapused_data_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ swapused_data_long = (long)swapused_data;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & swapused_data_long, sizeof(swapused_data_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmDNLCMisses(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED, (u_char *) & misses, sizeof(misses));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmReservedSwapSpace(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long swapresv_data_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ swapresv_data_long = (long) swapresv_data;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & swapresv_data_long, sizeof(swapresv_data_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTotMemAllocFails(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long nomem_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ nomem_long = (long) nomem;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & nomem_long, sizeof(nomem_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmAvailableSwapSpace(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ long swapavail_data_long;
+
+ case MODE_GET:
+
+ swapavail_data_long = (long) swapavail_data;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & swapavail_data_long, sizeof(swapavail_data_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmDNLCHitRate(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED, (u_char *) & hitrate, sizeof(hitrate));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmDNLCHits(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED, (u_char *) & hits, sizeof(hits));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+get_hmAllocatedSwapSpace(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long swapalloc_data_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ swapalloc_data_long = (long) swapalloc_data;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & swapalloc_data_long, sizeof(swapalloc_data_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTotNumOfCPUs(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long ncpus_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ ncpus_long = (long)ncpus;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & ncpus_long, sizeof(ncpus_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmPageScanRate(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long scan_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ scan_long = (long) scan;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & scan_long, sizeof(scan_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTimers(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long timers_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ timers_long = (long) timers;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & timers_long, sizeof(timers_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTotBadRPCCalls(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long badcalls_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ badcalls_long = (long) badcalls ;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & badcalls_long, sizeof(badcalls_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmDNLCRefRate(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED, (u_char *) & refrate, sizeof(refrate));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+get_hmTotSendFails(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long cantsend_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ cantsend_long = (long) cantsend;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & cantsend_long, sizeof(cantsend_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTotFailedCallsBV(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long badxids_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ badxids_long = (long) badxids;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & badxids_long, sizeof(badxids_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTotNumOfAuthRefresh(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long newcreds_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ newcreds_long = (long) newcreds;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & newcreds_long, sizeof(newcreds_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmHandspread(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long handspread_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ handspread_long = (long) handspread;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & handspread_long, sizeof(handspread_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTotRPCRetransmissions(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long interrupts_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ interrupts_long = (long) interrupts;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & interrupts_long, sizeof(interrupts_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmKmemFreeMem(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long mem_free_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ mem_free_long = (long) mem_free;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & mem_free_long, sizeof(mem_free_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTotBadRPCReplies(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long badverfs_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ badverfs_long = (long) badverfs;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & badverfs_long, sizeof(badverfs_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmKmemErrors(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long alloc_fail_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ alloc_fail_long = (long) alloc_fail;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & alloc_fail_long, sizeof(alloc_fail_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTotProcReadyInSwap(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long swapque_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ swapque_long = (long) swapque;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & swapque_long, sizeof(swapque_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTotProcBlocked(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long waiting_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ waiting_long = (long) waiting;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & waiting_long, sizeof(waiting_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+get_hmTotRPCCallsTimedOut(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ long timeouts_long;
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ timeouts_long = (long) timeouts;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, (u_char *) & timeouts_long, sizeof(timeouts_long));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+int hm_post_read_config(int a, int b, void *c, void *d)
+{
+
+ /*
+ * Refresh the HealthMonitor module data every 60 seconds. Every 60
+ * seconds, the function refresh_all_HM_data is called automatically by
+ * the agent. Also, load data into nodes now by calling the refresh
+ * function once
+ */
+
+ construct_DISK_table();
+ refresh_all_HM_data(0, NULL);
+
+ snmp_alarm_register(hm_refresh_interval, SA_REPEAT, refresh_DISK_table, NULL);
+ snmp_alarm_register(hm_refresh_interval, SA_REPEAT, refresh_all_HM_data, NULL);
+
+}
+
+
+
+hmDiskTable *
+get_first_node()
+{
+ return head;
+}
+
+/** returns the first data point within the hmDiskTable table data.
+
+ Set the my_loop_context variable to the first data point structure
+ of your choice (from which you can find the next one). This could
+ be anything from the first node in a linked list, to an integer
+ pointer containing the beginning of an array variable.
+
+ Set the my_data_context variable to something to be returned to
+ you later that will provide you with the data to return in a given
+ row. This could be the same pointer as what my_loop_context is
+ set to, or something different.
+
+ The put_index_data variable contains a list of snmp variable
+ bindings, one for each index in your table. Set the values of
+ each appropriately according to the data matching the first row
+ and return the put_index_data variable at the end of the function.
+*/
+
+netsnmp_variable_list *
+hmDiskTable_get_first_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list * put_index_data,
+ netsnmp_iterator_info * mydata)
+{
+
+ netsnmp_variable_list *vptr;
+
+ hmDiskTable *firstNode = get_first_node();
+ if (!firstNode) {
+ return NULL;
+ }
+ *my_loop_context = firstNode;
+ *my_data_context = firstNode;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) firstNode->hmDiskName, strlen(firstNode->hmDiskName) /* XXX: length of
+ hmDiskName data */ );
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+/** functionally the same as hmDiskTable_get_first_data_point, but
+ my_loop_context has already been set to a previous value and should
+ be updated to the next in the list. For example, if it was a
+ linked list, you might want to cast it and the return
+ my_loop_context->next. The my_data_context pointer should be set
+ to something you need later and the indexes in put_index_data
+ updated again. */
+
+netsnmp_variable_list *
+hmDiskTable_get_next_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list * put_index_data,
+ netsnmp_iterator_info * mydata)
+{
+
+ netsnmp_variable_list *vptr;
+
+ hmDiskTable *nextNode = (hmDiskTable *) * my_loop_context;
+
+ /* This check is not really required */
+ if(!nextNode) {
+ snmp_log(LOG_DEBUG,"No data returned in get_next\n");
+ return NULL;
+ }
+
+ nextNode = nextNode->pNext;
+
+ if (!nextNode) {
+ snmp_log(LOG_DEBUG,"No data returned in get_next\n");
+ return NULL;
+ }
+ *my_loop_context = nextNode;
+ *my_data_context = nextNode;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) nextNode->hmDiskName /* XXX: hmDiskName data */ , strlen(nextNode->hmDiskName) /* XXX: length of
+ hmDiskName data */ );
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+/** handles requests for the hmDiskTable table, if anything else needs to be done */
+int
+hmDiskTable_handler(
+ netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+
+ hmDiskTable *data;
+
+ for (request = requests; request; request = request->next) {
+ var = request->requestvb;
+ if (request->processed != 0)
+ continue;
+
+ /*
+ * perform anything here that you need to do before each request is
+ * processed.
+ */
+
+ /*
+ * the following extracts the my_data_context pointer set in the loop
+ * functions above. You can then use the results to help return data
+ * for the columns of the hmDiskTable table in question
+ */
+ data = (hmDiskTable *) netsnmp_extract_iterator_context(request);
+ if (data == NULL) {
+ if (reqinfo->mode == MODE_GET) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ /*
+ * XXX: no row existed, if you support creation and this is a
+ * set, start dealing with it here, else continue
+ */
+ }
+ /* extracts the information about the table from the request */
+ table_info = netsnmp_extract_table_info(request);
+ /* table_info->colnum contains the column number requested */
+ /*
+ * table_info->indexes contains a linked list of snmp variable
+ * bindings for the indexes of the table. Values in the list have
+ * been set corresponding to the indexes of the request
+ */
+ if (table_info == NULL) {
+ continue;
+ }
+ switch (reqinfo->mode) {
+ /*
+ * the table_iterator helper should change all GETNEXTs into GETs
+ * for you automatically, so you don't have to worry about the
+ * GETNEXT case. Only GETs and SETs need to be dealt with here
+ */
+ case MODE_GET:
+ switch (table_info->colnum) {
+ case COLUMN_HMDISKNAME:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) data->hmDiskName, strlen(data->hmDiskName));
+ break;
+
+ case COLUMN_HMDISKALIASNAME:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) data->hmDiskAliasName, strlen(data->hmDiskAliasName));
+ break;
+
+ case COLUMN_HMAVGWAITTRANSACTIONS:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) data->hmAvgWaitTransactions, strlen(data->hmAvgWaitTransactions));
+ break;
+
+ case COLUMN_HMDISKBUSYPCNT:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) data->hmDiskBusyPcnt, strlen(data->hmDiskBusyPcnt));
+ break;
+
+ case COLUMN_HMAVGDISKSVCTIME:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) data->hmAvgDiskSvcTime, strlen(data->hmAvgDiskSvcTime));
+ break;
+
+ default:
+ /* We shouldn't get here */
+ snmp_log(LOG_ERR, "problem encountered in hmDiskTable_handler: unknown column\n");
+ }
+ break;
+
+ case MODE_SET_RESERVE1:
+ /* set handling... */
+
+ default:
+ snmp_log(LOG_ERR, "problem encountered in hmDiskTable_handler: unsupported mode\n");
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+/*
+ * *****
+ * New Functions that are added to the template generated by mib2c
+ * *****
+ */
+
+
+/*
+ * The following refresh functions are called every 60 seconds. The data
+ * nodes are updated with latest data
+ */
+
+void
+refresh_SWAP_data()
+{
+
+ int code = 0;
+
+ code = krgetswapusage(&swapavail_data, &swapresv_data, &swapalloc_data, &swapused_data, &swaptotal_data);
+
+ /*
+ * code == -1 : Error in swapctl code == 0 : Success Can be verified
+ * using "swap -s" on shell
+ */
+
+ if (code != 0) {
+ snmp_log(LOG_ERR,"Health Monitor Module: errror getting SWAP info\n");
+ swapavail_data = 0;
+ swapresv_data = 0;
+ swapalloc_data = 0;
+ swapused_data = 0;
+ }
+}
+
+void
+refresh_Kernel_data()
+{
+
+ int code = 0;
+
+ code = krgetsmtx(&sum_smtx, &ncpus);
+
+ if (code != 0) {
+ snmp_log(LOG_ERR,"Health Monitor Module: errror getting Kernel info\n");
+ sum_smtx = 0;
+ ncpus = 0;
+ }
+}
+
+void
+refresh_NFS_data()
+{
+
+ int code = 0;
+
+ code = krgetclientrpcdetail(&calls, &badcalls, &retrans, &badxids, &timeouts, &newcreds, &badverfs, &timers, &nomem, &cantsend);
+
+ if (code != 0) {
+ snmp_log(LOG_ERR,"Health Monitor Module: errror getting NFS info\n");
+ calls = 0;
+ badcalls = 0;
+ retrans = 0;
+ badxids = 0;
+ timeouts = 0;
+ newcreds = 0;
+ badverfs = 0;
+ timers = 0;
+ nomem = 0;
+ cantsend = 0;
+ }
+
+ /* "calls" is defined as a "DisplayString" in the MIB. So, converting
+ * it to String
+ */
+
+ sprintf(callsStr, "%3.1f\0", calls);
+}
+
+void
+refresh_CPU_data()
+{
+
+ int code = 0;
+
+ code = krgetprocdetail(&runque, &waiting, &swapque);
+
+ if (code != 0) {
+
+ snmp_log(LOG_ERR,"Health Monitor Module: errror getting CPU info\n");
+ runque = 0;
+ waiting = 0;
+ swapque = 0;
+ }
+}
+
+void
+refresh_RAM_data()
+{
+
+ int code = 0;
+
+ code = krgetramdetail(&handspread, &scan);
+
+ if (code != 0) {
+
+ snmp_log(LOG_ERR,"Health Monitor Module: errror getting RAM info\n");
+ handspread = 0;
+ scan = 0;
+
+ }
+}
+
+void
+refresh_KMEM_data()
+{
+
+ int code = 0;
+ char char_name[2] = "*\n";
+
+ /* char char_name='*'; */
+
+ /* The first argument of "*" requests sum of statistics of all caches */
+
+ code = krgetkmemdetail(char_name, &alloc, &alloc_fail, &buf_size, &buf_avail, &buf_total, &buf_max);
+
+ if (code >= 0)
+ code = krgetmemusage(&mem_avail, &mem_inuse, &mem_free);
+
+ if (code != 0) {
+
+ snmp_log(LOG_ERR,"Health Monitor Module: errror getting KMEM info\n");
+ alloc_fail = 0;
+ mem_free = 0;
+
+ }
+}
+
+void
+refresh_DNLC_data()
+{
+
+ int code = 0;
+ long curtime;
+
+ curtime = time(&curtime);
+ if (prevtime != curtime) {
+
+ code = krgetncstatdetail(&hits, &misses);
+
+ if (code != 0) {
+
+ snmp_log(LOG_ERR,"Health Monitor Module: errror getting DNLC info\n");
+ hits = 0;
+ misses = 0;
+
+ } /* NOTE : Should we do below even if
+ * hits=0,misses=0 ? Yes, according to SunMC
+ * rule */
+ if (firsttime == 1) {
+ firsttime = 0;
+ lasthits = hits;
+ lastmisses = misses;
+ } else {
+ lasthits = prevhits;
+ lastmisses = prevmisses;
+ }
+
+ prevhits = hits;
+ prevmisses = misses;
+
+ refrate = (hits - lasthits) + (misses - lastmisses);
+ if (refrate == 0) {
+ hitrate = 100;
+ } else {
+ hitrate = 100 * (hits - lasthits) / refrate;
+ refrate = refrate / (curtime - prevtime);
+ }
+
+ prevtime = curtime;
+ }
+}
+
+void
+construct_DISK_table()
+{
+
+ hmDiskTable *prevPtr = NULL;
+
+ char name[MAXNAMELEN];
+ char alias[MAXNAMELEN];
+ double rps, wps, tps, krps, kwps, kps, avw, avr;
+ double w_pct, r_pct, wserv, rserv, serv;
+ int code = 0;
+
+
+ /* set to 0 so that we can block any other refresh's */
+ hm_prev_disk_ref = 0;
+
+ /* Keeps track of number of disks */
+ diskCount = 0;
+
+ do {
+
+ hmDiskTable *ptr = (hmDiskTable *) malloc(sizeof(hmDiskTable));
+
+ if ( ptr == NULL) {
+ snmp_log(LOG_DEBUG,"malloc failed when constructing DISK table in health monitor module \n");
+ return;
+ }
+
+ code = krgetdiskdetail(name, alias, &rps, &wps, &tps, &krps, &kwps, &kps, &avw, &avr);
+
+ if (code < 0) {
+ /* Error occured during kstat read */
+ snmp_log(LOG_ERR,"Health Monitor Module: errror getting disk info\n");
+ return;
+ }
+ code = krgetdisksrv(name, alias, &w_pct, &r_pct, &wserv, &rserv, &serv);
+
+ if (code < 0) {
+ /* Error occured during kstat read */
+ snmp_log(LOG_ERR,"Health Monitor Module: errror getting disk info\n");
+ return;
+ }
+ /* Allocate required memory to hold each disk data. */
+
+ ptr->hmDiskName = (char *) malloc(strlen(name) + 1);
+ ptr->hmDiskAliasName = (char *) malloc(strlen(alias) + 1);
+ ptr->hmAvgWaitTransactions = (char *) malloc(DISK_DATA_LEN);
+ ptr->hmDiskBusyPcnt = (char *) malloc(DISK_DATA_LEN);
+ ptr->hmAvgDiskSvcTime = (char *) malloc(DISK_DATA_LEN);
+
+ if ( ptr->hmAvgDiskSvcTime == NULL) {
+ snmp_log(LOG_DEBUG,"malloc failed when constructing DISK table in health monitor module \n");
+ return;
+ }
+
+ strcpy(ptr->hmDiskName,name);
+
+ strcpy(ptr->hmDiskAliasName,alias);
+
+ sprintf(ptr->hmAvgWaitTransactions, "%3.1f\0", w_pct);
+
+ sprintf(ptr->hmDiskBusyPcnt, "%3.1f\0", r_pct);
+
+ sprintf(ptr->hmAvgDiskSvcTime, "%3.1f\0", serv);
+
+ /* Set the state of Disk to OK. */
+
+ ptr->hmDiskState = OK;
+
+ diskCount++;
+ ptr->pNext = NULL;
+ if (prevPtr == NULL) {
+ head = prevPtr = ptr;
+ } else {
+
+ prevPtr->pNext = ptr;
+ prevPtr = ptr;
+ }
+ /* code is set to value 0 if there is more disk information */
+ } while (code == 0);
+
+ check_state_DISK();
+
+ /* set the time of first refresh */
+
+ time(&hm_prev_disk_ref);
+
+}
+
+
+void
+refresh_DISK_table(unsigned int clientreg, void *clientarg)
+{
+
+ char name[MAXNAMELEN];
+ char alias[MAXNAMELEN];
+ double rps, wps, tps, krps, kwps, kps, avw, avr;
+ double w_pct, r_pct, wserv, rserv, serv;
+ int code = 0;
+ hmDiskTable *headPtr;
+ hmDiskTable *ptr;
+ hmDiskTable *tailPtr, *p1, *p2;
+
+
+ time_t hm_current_time;
+
+ /* Did the previous refresh really finish ??
+ * This means that previous refresh is still in progress */
+ if (hm_prev_disk_ref == 0) return;
+
+ time(&hm_current_time);
+
+ /* Did the previous refresh finish too close to start another refresh ???
+ * This means that the previous refresh finished relatively closer to current time
+ * so, another refresh is not necessary. hm_prev_disk_ref is initialized to 1
+ * during variable declaration. so, the first time refresh is called, it will always
+ * proceed.
+ */
+
+ if ( (hm_current_time - hm_prev_disk_ref) < (hm_refresh_interval / 4) ) return;
+
+ /* set to 0 so that we can block any other refresh's */
+ hm_prev_disk_ref = 0;
+
+ diskCount=0;
+
+ /* Set tailPtr to the last structure
+ * set "hmTraversed" to 0 for all disks
+ */
+
+ tailPtr = head;
+ while (tailPtr->pNext != NULL) {
+ tailPtr->hmTraversed=0;
+ tailPtr = tailPtr->pNext;
+ }
+ if(tailPtr != NULL) tailPtr->hmTraversed=0;
+
+ do {
+
+ int hit = 0;
+ code = krgetdiskdetail(name, alias, &rps, &wps, &tps, &krps, &kwps, &kps, &avw, &avr);
+
+ if (code < 0) {
+ /* Error occured during kstat read */
+ snmp_log(LOG_ERR,"Health Monitor Module: errror getting disk info\n");
+ return;
+ }
+ code = krgetdisksrv(name, alias, &w_pct, &r_pct, &wserv, &rserv, &serv);
+
+ if (code < 0) {
+ /* Error occured during kstat read */
+ snmp_log(LOG_ERR,"Health Monitor Module: errror getting disk info\n");
+ return;
+ }
+
+ /* For each row in the table, refresh the data */
+
+ headPtr = head;
+ while ((headPtr != NULL) && (hit == 0)) {
+
+ if (strncmp(headPtr->hmDiskName, name, strlen(name)) == 0) {
+
+ /*
+ * This Disk is already part of the list. Just update the
+ * data
+ */
+
+ hit = 1;
+
+ strcpy(headPtr->hmDiskAliasName,alias);
+ sprintf(headPtr->hmAvgWaitTransactions, "%3.1f\0", w_pct);
+ sprintf(headPtr->hmDiskBusyPcnt, "%3.1f\0", r_pct);
+ sprintf(headPtr->hmAvgDiskSvcTime, "%3.1f\0", serv);
+
+ /*
+ * Don't change the hmDiskState here because existing
+ * diskState should be maintained
+ */
+
+ headPtr->hmTraversed=1;
+
+ }
+ headPtr = headPtr->pNext;
+
+ } /* End of while loop around each row */
+
+ if (hit != 1) {
+
+
+ /* A new Disk is found in this refresh cycle . How likely ? */
+
+ ptr = (hmDiskTable *) malloc(sizeof(hmDiskTable));
+
+ ptr->hmDiskName = (char *) malloc(strlen(name) + 1);
+ ptr->hmDiskAliasName = (char *) malloc(strlen(alias) + 1);
+ ptr->hmAvgWaitTransactions = (char *) malloc(DISK_DATA_LEN);
+ ptr->hmDiskBusyPcnt = (char *) malloc(DISK_DATA_LEN);
+ ptr->hmAvgDiskSvcTime = (char *) malloc(DISK_DATA_LEN);
+
+ if ( ptr->hmAvgDiskSvcTime == NULL) {
+ snmp_log(LOG_DEBUG,"malloc failed when refreshing DISK table in health monitor module \n");
+ return;
+ }
+
+ strcpy(ptr->hmDiskName,name);
+
+ strcpy(ptr->hmDiskAliasName,alias);
+
+ sprintf(ptr->hmAvgWaitTransactions, "%3.1f\0", w_pct);
+
+ sprintf(ptr->hmDiskBusyPcnt, "%3.1f\0", r_pct);
+
+ sprintf(ptr->hmAvgDiskSvcTime, "%3.1f\0", serv);
+
+ /* Set the state of Disk to OK. */
+
+ ptr->hmDiskState = OK;
+
+ /* Set Traversed to 1 */
+
+ ptr->hmTraversed=1;
+
+
+ ptr->pNext = NULL;
+
+ if (tailPtr == NULL) {
+ head = tailPtr = ptr;
+ } else {
+
+ tailPtr->pNext = ptr;
+ tailPtr = ptr;
+ }
+
+ }
+ diskCount++;
+
+ } while (code == 0);
+
+ /* Any disk that is not "touched" previously (i.e, has
+ * hmTraversal value of 0, means that it's a removed disk.
+ * Traverse through the whole list again and remove those
+ * entries from the list.
+ */
+
+ p1=head;
+ p2=head;
+
+ while( p2 != NULL) {
+
+ if (p2->hmTraversed == 0) {
+
+ /* Take care of removing this disk */
+
+ if(p2->pNext != NULL) {
+ p1->pNext = p2->pNext;
+ free(p2);
+ p2=p1->pNext;
+ } else {
+ p1->pNext=NULL;
+ free(p2);
+ p2=NULL;
+ }
+ } else {
+
+ /* Extend pointers by 1 step */
+
+ if(p2->pNext != NULL) {
+
+ p1=p2;
+ p2=p2->pNext;
+ } else {
+
+ p2=p2->pNext;
+ }
+ }
+ }
+
+
+ check_state_DISK();
+
+ time(&hm_prev_disk_ref);
+
+}
+
+/*
+ * Function: refresh_all_HM_data. This function collects the data for all
+ * nodes in the module and stores the data in the data variables. The
+ * function is called every "refresh-interval" automatically. After the data
+ * is refreshed, the alarm condition is checked and a trap is sent if the
+ * conditions are met.
+ */
+
+void
+refresh_all_HM_data(unsigned int clientreg, void *clientarg)
+{
+
+ time_t hm_current_time;
+
+ /* Did the previous refresh really finish ??
+ * This means that previous refresh is still in progress */
+ if (hm_prev_ref_time == 0) return;
+
+ time(&hm_current_time);
+
+ /* Did the previous refresh finish too close to start another refresh ???
+ * This means that the previous refresh finished relatively closer to current time
+ * so, another refresh is not necessary. hm_prev_ref_time is initialized to 1
+ * during variable declaration. so, the first time refresh is called, it will always
+ * proceed.
+ */
+
+ /* printf("%u %u %u\n",hm_current_time, hm_prev_ref_time, hm_refresh_interval/4);*/
+ if ( (hm_current_time - hm_prev_ref_time) < (hm_refresh_interval / 4) ) return;
+
+ /* set to 0 so that we can block any other refresh's */
+ hm_prev_ref_time = 0;
+
+ /* refresh data for SWAP nodes and check alarm condition */
+
+ refresh_SWAP_data();
+ hm_handle_rule(&SWAP_rule_state, &SWAP_rule);
+
+ /* Acquire data for Kernel nodes */
+
+ refresh_Kernel_data();
+ hm_handle_rule(&Kernel_rule_state, &Kernel_rule);
+
+ /* Acquire data for NFS nodes */
+
+ refresh_NFS_data();
+ hm_handle_rule(&NFS_rule_state, &NFS_rule);
+
+ /* Acquire data for CPU nodes */
+
+ refresh_CPU_data();
+ hm_handle_rule(&CPU_rule_state, &CPU_rule);
+
+ /* Acquire data for RAM nodes */
+
+ refresh_RAM_data();
+ hm_handle_rule(&RAM_rule_state, &RAM_rule);
+
+ /* Acquire data for KMEM nodes */
+
+ refresh_KMEM_data();
+ hm_handle_rule(&KMEM_rule_state, &KMEM_rule);
+
+ /* Acquire data for DNLC nodes */
+
+ refresh_DNLC_data();
+ hm_handle_rule(&DNLC_rule_state, &DNLC_rule);
+
+ /* End of Data acquisition for HM module */
+
+ time(&hm_prev_ref_time);
+
+ return;
+
+}
+
+/*
+ * Function: read_health_monitor_thresholds: This function is called whenever
+ * a registered token is encountered in health_monitor.conf file. The
+ * function simply stores the token's value in the appropriate threshold
+ * variable.
+ */
+
+void
+read_health_monitor_thresholds(const char *token, char *cptr)
+{
+
+ if (strcmp(token, "hm_refresh_interval") == 0) {
+ hm_refresh_interval = atoi(cptr);
+ } else if (strcmp(token, "threshold_swapavail_info") == 0) {
+ threshold_swapavail_info = atoi(cptr);
+ } else if (strcmp(token, "threshold_swapavail_warning") == 0) {
+ threshold_swapavail_warning = atoi(cptr);
+ } else if (strcmp(token, "threshold_swapavail_error") == 0) {
+ threshold_swapavail_error = atoi(cptr);
+ } else if (strcmp(token, "threshold_mutex_info") == 0) {
+ threshold_mutex_info = atol(cptr);
+ } else if (strcmp(token, "threshold_mutex_warning") == 0) {
+ threshold_mutex_warning = atol(cptr);
+ } else if (strcmp(token, "threshold_mincalls") == 0) {
+ threshold_mincalls = atof(cptr);
+ } else if (strcmp(token, "threshold_badxids") == 0) {
+ threshold_badxids = atof(cptr);
+ } else if (strcmp(token, "threshold_timeouts") == 0) {
+ threshold_timeouts = atof(cptr);
+ } else if (strcmp(token, "threshold_cpuload_info") == 0) {
+ threshold_cpuload_info = atof(cptr);
+ } else if (strcmp(token, "threshold_cpuload_warning") == 0) {
+ threshold_cpuload_warning = atof(cptr);
+ } else if (strcmp(token, "threshold_cpuload_error") == 0) {
+ threshold_cpuload_error = atof(cptr);
+ } else if (strcmp(token, "threshold_restime_long") == 0) {
+ threshold_restime_long = atoi(cptr);
+ } else if (strcmp(token, "threshold_restime_ok") == 0) {
+ threshold_restime_ok = atoi(cptr);
+ } else if (strcmp(token, "threshold_restime_error") == 0) {
+ threshold_restime_error = atoi(cptr);
+ } else if (strcmp(token, "threshold_freemem_low") == 0) {
+ threshold_freemem_low = atoi(cptr);
+ } else if (strcmp(token, "threshold_dnlc_active") == 0) {
+ threshold_dnlc_active = atof(cptr);
+ } else if (strcmp(token, "threshold_dnlc_warning") == 0) {
+ threshold_dnlc_warning = atof(cptr);
+ } else if (strcmp(token, "disk_busy_warning") == 0) {
+ disk_busy_warning = atol(cptr);
+ } else if (strcmp(token, "disk_busy_problem") == 0) {
+ disk_busy_problem = atol(cptr);
+ } else if (strcmp(token, "disk_svc_t_warning") == 0) {
+ disk_svc_t_warning = atol(cptr);
+ } else if (strcmp(token, "disk_svc_t_problem") == 0) {
+ disk_svc_t_problem = atol(cptr);
+ } else {
+ /* Do nothing */
+ }
+
+
+ return;
+}
+
+/*
+ * hm_handle_rule:
+ *
+ * arguments: rule_state = previous state of the rule rule = Function
+ * pointer to the actual rule
+ *
+ * This function first determines the new state of the rule by calling
+ * rule(CONDITION).
+ *
+ * In the switch loop, depending on the previous rule state (the rule_state) and
+ * new state, the rule function is again called appropriately. For example,
+ * if the previous state is INIT and the new state is > OK, then rule(OPEN)
+ * is called.
+ *
+ */
+
+
+void
+hm_handle_rule(int *rule_state, int (*rule) (int))
+{
+
+ int new_alarm_state;
+
+ if (*rule_state == NOTINIT) {
+ *rule_state = INIT;
+ rule(INIT);
+ }
+ new_alarm_state = rule(CONDITION);
+
+ switch (*rule_state) {
+
+ case INIT:
+ if (new_alarm_state > OK) {
+ *rule_state = OPEN;
+ rule(OPEN);
+ }
+ return;
+ case OPEN:
+ if (new_alarm_state == OK) {
+ *rule_state = CLOSE;
+ rule(CLOSE);
+ } else {
+ *rule_state = CONTINUE;
+ rule(CONTINUE);
+ }
+ return;
+ case CONTINUE:
+ if (new_alarm_state == OK) {
+ *rule_state = CLOSE;
+ rule(CLOSE);
+ } else {
+ *rule_state = CONTINUE;
+ rule(CONTINUE);
+ }
+ return;
+ case CLOSE:
+ if (new_alarm_state > OK) {
+ *rule_state = OPEN;
+ rule(OPEN);
+ }
+ return;
+ }
+
+}
+
+
+/*
+ * Function: send_trap : This function sends a *statusChange* trap with
+ * appropriate varbind's see SMA trap mib for detailed trap notification
+ * definition.
+ *
+ * hostname - Name of host on which alarm occured ; modulename - Name of the
+ * module generating the trap ; moduleContext - The context of the module, if
+ * any; statusOID - The trapoid; size - The size of trapoid (not included in
+ * the trap); status - status of the node; description - description of the
+ * trap; dvalue - value of the node on which trap occured; dtype - data type of
+ * the value
+ */
+
+void
+send_trap(u_char * hostname, u_char * modulename, u_char * moduleContext, oid * trapoid, int size, u_char * status, u_char * description, u_char * dvalue, int dtype)
+{
+
+ /* This is the notification type itself. This is statusChange trap */
+
+ oid notification_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 3, 0, 1};
+
+ size_t notification_oid_len = OID_LENGTH(notification_oid);
+
+ /*
+ * In the notification, we have to assign our notification OID to the
+ * snmpTrapOID.0 object. Here is it's definition.
+ */
+
+ oid objid_snmptrap[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};
+ size_t objid_snmptrap_len = OID_LENGTH(objid_snmptrap);
+
+ /*
+ * here is where we store the variables to be sent in the trap
+ */
+
+ netsnmp_variable_list *notification_vars = NULL;
+
+ oid hostname_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 3, 1, 1, 0};
+
+ size_t hostname_oid_len = OID_LENGTH(hostname_oid);
+
+
+ oid modulename_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 3, 1, 2, 0};
+
+ size_t modulename_oid_len = OID_LENGTH(modulename_oid);
+
+
+ oid nodeoid_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 3, 1, 3, 0};
+
+ size_t nodeoid_oid_len = OID_LENGTH(nodeoid_oid);
+
+
+ oid moduleContext_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 3, 1, 4, 0};
+
+ size_t moduleContext_oid_len = OID_LENGTH(moduleContext_oid);
+
+
+ oid status_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 3, 1, 5, 0};
+
+ size_t status_oid_len = OID_LENGTH(status_oid);
+
+
+ oid description_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 3, 1, 6, 0};
+
+ size_t description_oid_len = OID_LENGTH(description_oid);
+
+ oid dvalue_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 3, 1, 7, 0};
+
+ size_t dvalue_oid_len = OID_LENGTH(dvalue_oid);
+
+ oid dtype_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 3, 1, 8, 0};
+
+ size_t dtype_oid_len = OID_LENGTH(dtype_oid);
+
+
+ /*
+ * add in the trap definition object
+ */
+
+ snmp_varlist_add_variable(¬ification_vars,
+ /*
+ * the snmpTrapOID.0 variable
+ */
+ objid_snmptrap, objid_snmptrap_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OBJECT_ID,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) notification_oid,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ notification_oid_len * sizeof(oid));
+
+
+ /*
+ * if we wanted to insert additional objects, we'd do it here
+ */
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ hostname_oid, hostname_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OCTET_STR,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) hostname,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ strlen((char *) hostname));
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ modulename_oid, modulename_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OCTET_STR,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) modulename,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ strlen((char *) modulename));
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ nodeoid_oid, nodeoid_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OBJECT_ID,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) trapoid,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ size * sizeof(oid));
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ moduleContext_oid, moduleContext_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OCTET_STR,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) moduleContext,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ strlen((char *) moduleContext));
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ status_oid, status_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OCTET_STR,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) status,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ strlen((char *) status));
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ description_oid, description_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OCTET_STR,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) description,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ strlen((char *) description));
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ dvalue_oid, dvalue_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OCTET_STR,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) dvalue,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ strlen((char *) dvalue));
+
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ dtype_oid, dtype_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_INTEGER,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) & dtype,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ sizeof(dtype));
+
+
+ /* SEND THE TRAP !!!! */
+
+ send_v2trap(notification_vars);
+
+ /*
+ * free the created notification variable list
+ */
+
+ DEBUGMSGTL(("example_notification", "cleaning up\n"));
+ snmp_free_varbind(notification_vars);
+
+ return;
+
+}
+
+/*
+ * Function: conv_alarm_state : This function returns appropriate charecter
+ * string for each integer alarm type
+ */
+
+char *
+conv_alarm_state(int state)
+{
+ switch (state) {
+ case OK:
+ return "OK\0";
+ case INFO:
+ return "INFO\0";
+ case WARNING:
+ return "WARNING\0";
+ case ERROR:
+ return "ERROR\0";
+ default:
+ return "INVALID\0";
+ }
+}
+
+
+
+/*
+ * Function: SWAP_rule : This function checks the state of SWAP nodes and
+ * issues trap if necessary
+ */
+
+int
+SWAP_rule(int action)
+{
+
+ /* This is the OID of hmAvailableSwapSpace */
+ oid trapoid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 1, 1, 1, 0};
+ u_char status[8];
+ u_char description[] = "Available Swap space on the system is low";
+ int size;
+ u_char dvalue[15];
+ /* The value of dtype is 1 here becuase swapavail_data is of "int" type */
+ int dtype = 1;
+
+ sprintf((char *) dvalue, "%d\0", swapavail_data);
+ size = sizeof(trapoid) / sizeof(oid);
+
+ switch (action) {
+
+ case CONDITION:
+
+ /*
+ * Quite straightforward. Depending on the threshold that is crossed,
+ * assign the new state
+ */
+
+ if ((swapavail_data <= threshold_swapavail_info) && (swapavail_data > threshold_swapavail_warning)) {
+ new_SWAP_state = INFO;
+ return INFO;
+ } else if ((swapavail_data <= threshold_swapavail_warning) && (swapavail_data > threshold_swapavail_error)) {
+ new_SWAP_state = WARNING;
+ return WARNING;
+ } else if (swapavail_data <= threshold_swapavail_error) {
+ new_SWAP_state = ERROR;
+ return ERROR;
+ }
+ new_SWAP_state = OK;
+ return OK;
+
+ case OPEN:
+
+ strcpy((char *) status, conv_alarm_state(new_SWAP_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ case INIT:
+
+ return 0;
+
+ case CONTINUE:
+
+ strcpy((char *) status, conv_alarm_state(new_SWAP_state));
+ if (new_SWAP_state > prev_SWAP_state) {
+
+ /* Send trap */
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ prev_SWAP_state = new_SWAP_state;
+
+ }
+ return 0;
+
+ case CLOSE:
+
+ strcpy((char *) status, conv_alarm_state(new_SWAP_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ default:
+
+ return 0;
+ }
+
+}
+
+/*
+ * Function: Kernel_rule : This function checks the state of Kernel nodes and
+ * issues trap if necessary
+ */
+
+int
+Kernel_rule(int action)
+{
+
+ int mutexrate;
+
+ /* This is the OID of hmSpinsOnMutexes */
+ oid trapoid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 2, 1, 1, 0};
+ u_char status[8];
+ u_char description[] = "Mutex contention rate is high , kernel overload \0";
+ int size;
+ u_char dvalue[15];
+ /*
+ * dtype is set to 1 because the hmSpinsOnMutexes node is defined as
+ * Integer32 in the mib
+ */
+ int dtype = 1;
+
+ sprintf((char *) dvalue, "%lu\0", sum_smtx);
+ size = sizeof(trapoid) / sizeof(oid);
+
+ switch (action) {
+
+ case CONDITION:
+
+ if (ncpus == 0) {
+ /* this happens only during initialization */
+ new_mutex_state = OK;
+ return OK;
+ }
+ mutexrate = sum_smtx / ncpus;
+
+ /* Determine if there is a new Alarm state */
+
+ if (mutexrate < threshold_mutex_info) {
+ if (mutexrate == 0) {
+
+ /*
+ * This is a change from existing rule. It makes more sense
+ * that if mutexrate is 0, then the state should be OK. i.e,
+ * no problems
+ */
+
+ new_mutex_state = OK;
+ return OK;
+
+ } else {
+ new_mutex_state = INFO;
+ return INFO;
+ }
+ } else if (mutexrate < threshold_mutex_warning) {
+ new_mutex_state = WARNING;
+ return WARNING;
+ } else {
+ new_mutex_state = ERROR;
+ return WARNING;
+ }
+
+ case OPEN:
+
+ strcpy((char *) status, conv_alarm_state(new_mutex_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ case INIT:
+
+ return 0;
+
+ case CONTINUE:
+
+ strcpy((char *) status, conv_alarm_state(new_mutex_state));
+
+ if (new_mutex_state > prev_mutex_state) {
+
+ /* Send trap */
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ prev_mutex_state = new_mutex_state;
+
+ }
+ return 0;
+
+ case CLOSE:
+
+ strcpy((char *) status, conv_alarm_state(new_mutex_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ default:
+
+ return 0;
+ }
+
+}
+
+/*
+ * Function: NFS_rule : This function checks the state of NFS nodes and
+ * issues trap if necessary
+ */
+
+int
+NFS_rule(int action)
+{
+
+ float maxtimeout, maxbadxid;
+
+ /*
+ * This is the OID of hmNFSClientRPCGroup. Note that this rule uses data
+ * from more than one node to determine the alarm state
+ */
+ oid trapoid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 3, 1};
+ u_char status[8];
+ u_char description[] = "Bad Network or Server is slow. May need to increase timeout \0 ";
+ int size;
+ u_char dvalue[15];
+ int dtype = 1;
+
+ /*
+ * It's tricky which "value" should be put in dvalue field. More than one
+ * node's data is looked at to determine alarm state.
+ */
+ sprintf((char *) dvalue, "%d\0", timeouts);
+ size = sizeof(trapoid) / sizeof(oid);
+
+ switch (action) {
+
+ case CONDITION:
+
+ if (calls <= threshold_mincalls) {
+ /*
+ * This is a change from existing rule (which has INFO). It makes
+ * sense that no trap is sent when calls is < threshold_mincalls.
+ */
+
+ new_NFS_state = OK;
+ return OK;
+ } else {
+ maxtimeout = threshold_timeouts * calls / 100.0;
+
+ if (timeouts < maxtimeout) {
+
+ /*
+ * This is a change from existing rule (which has INFO). It
+ * makes sense that no trap is sent when timeouts is <
+ * maxtimeout
+ */
+
+ new_NFS_state = OK;
+ return OK;
+
+ } else {
+ maxbadxid = threshold_badxids * timeouts / 100.0;
+ if ((maxtimeout <= timeouts) && (badxids <= maxbadxid)) {
+ new_NFS_state = WARNING;
+ return WARNING;
+ } else {
+ /*
+ * This will be the case when timeout >= maxtimeout AND
+ * badxids > maxbadxid
+ */
+ new_NFS_state = ERROR;
+ return ERROR;
+ }
+ }
+ }
+
+ case OPEN:
+
+ strcpy((char *) status, conv_alarm_state(new_NFS_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ case INIT:
+
+ return 0;
+
+ case CONTINUE:
+
+ strcpy((char *) status, conv_alarm_state(new_NFS_state));
+ if (new_NFS_state > prev_NFS_state) {
+
+ /* Send trap */
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ prev_NFS_state = new_NFS_state;
+
+ }
+ return 0;
+
+ case CLOSE:
+
+ strcpy((char *) status, conv_alarm_state(new_NFS_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ default:
+
+ return 0;
+ }
+
+}
+
+/*
+ * Function: CPU_rule : This function checks the state of CPU nodes and
+ * issues trap if necessary
+ */
+
+int
+CPU_rule(int action)
+{
+
+ /* This is the OID for hmTotProcInRunQueue */
+ oid trapoid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 4, 1, 1, 0};
+ u_char status[8];
+ u_char description[] = "CPU overloaded \0";
+ int size;
+ u_char dvalue[15];
+ /* dtype is given a value of 1 because runque is of "int" type */
+ int dtype = 1;
+
+ float cpuload;
+
+ sprintf((char *) dvalue, "%d\0", runque);
+ size = sizeof(trapoid) / sizeof(oid);
+
+ switch (action) {
+
+ case CONDITION:
+
+ /*
+ * Added this If statement to existing rule. From Kernel_rule, it
+ * looks like ncpus may be 0 during initialization
+ */
+ if (ncpus == 0) {
+ /* this happens only during initialization */
+ new_cpuload_state = OK;
+ return OK;
+ }
+ cpuload = runque / ncpus;
+
+ /*
+ * Quite straightforward. If the threshold is crossed, set the state
+ * accordingly
+ */
+
+ if (cpuload < threshold_cpuload_info) {
+ new_cpuload_state = OK;
+ return OK;
+ } else if (cpuload < threshold_cpuload_warning) {
+ new_cpuload_state = INFO;
+ return INFO;
+ } else if (cpuload < threshold_cpuload_error) {
+ new_cpuload_state = WARNING;
+ return WARNING;
+ } else {
+ new_cpuload_state = ERROR;
+ return ERROR;
+ }
+
+ case OPEN:
+
+ strcpy((char *) status, conv_alarm_state(new_cpuload_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ case INIT:
+
+ return 0;
+
+ case CONTINUE:
+
+ strcpy((char *) status, conv_alarm_state(new_cpuload_state));
+ if (new_cpuload_state > prev_cpuload_state) {
+
+ /* Send trap */
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ prev_cpuload_state = new_cpuload_state;
+
+ }
+ return 0;
+
+ case CLOSE:
+
+ strcpy((char *) status, conv_alarm_state(new_cpuload_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ default:
+
+ return 0;
+ }
+
+}
+
+/*
+ * Function: RAM_rule : This function checks the state of RAM nodes and
+ * issues trap if necessary
+ */
+
+int
+RAM_rule(int action)
+{
+
+ /*
+ * This is the OID of hmRamMemoryPagingGroup. Note that this rule uses
+ * data from more than one node to determine the alarm state
+ */
+ oid trapoid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 6, 1};
+ u_char status[8];
+ u_char description[] = "RAM shortage \0";
+ int size;
+ u_char dvalue[15];
+
+ /* dtype is given a value of 1 because scan is of "int" type */
+ int dtype = 1;
+
+ float restime;
+
+ /*
+ * It's tricky which "value" should be put in dvalue field. More than one
+ * node's data is looked at to determine alarm state.
+ */
+ sprintf((char *) dvalue, "%d\0", scan);
+
+ size = sizeof(trapoid) / sizeof(oid);
+
+ switch (action) {
+
+ case CONDITION:
+
+ if (scan == 0) {
+ restime = threshold_restime_long;
+ } else {
+ restime = handspread / scan;
+ }
+
+ if (restime > threshold_restime_long) {
+ restime = threshold_restime_long;
+ }
+ if (restime >= threshold_restime_long) {
+ /* This is a change from existing rule (which has INFO). */
+
+ new_restime_state = OK;
+ return OK;
+ } else {
+ if (restime > threshold_restime_ok) {
+ new_restime_state = INFO;
+ return INFO;
+ } else {
+ if (restime > threshold_restime_error) {
+ new_restime_state = WARNING;
+ return WARNING;
+ } else {
+ new_restime_state = ERROR;
+ return ERROR;
+ }
+ }
+ }
+
+ case OPEN:
+
+ strcpy((char *) status, conv_alarm_state(new_restime_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ case INIT:
+
+ return 0;
+
+ case CONTINUE:
+
+ strcpy((char *) status, conv_alarm_state(new_restime_state));
+ if (new_restime_state > prev_restime_state) {
+
+ /* Send trap */
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ prev_restime_state = new_restime_state;
+
+ }
+ return 0;
+
+ case CLOSE:
+
+ strcpy((char *) status, conv_alarm_state(new_restime_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ default:
+
+ return 0;
+ }
+
+}
+
+/*
+ * Function: KMEM_rule : This function checks the state of KMEM nodes and
+ * issues trap if necessary
+ */
+
+int
+KMEM_rule(int action)
+{
+
+ /*
+ * This is the OID of hmKmemStatisticsGroup. Note that this rule uses
+ * data from more than one node to determine the alarm state
+ */
+ oid trapoid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 7, 1};
+ u_char status[8];
+ u_char description[] = "Kernel Memory allocation errors \0";
+ int size;
+ u_char dvalue[15];
+ /* dtype is given a value of 1 because alloc_fail is of "int" type */
+ int dtype = 1;
+
+ int firsterrs, lasterrs;
+
+ /*
+ * It's tricky which "value" should be put in dvalue field. More than one
+ * node's data is looked at to determine alarm state.
+ */
+ sprintf((char *) dvalue, "%d\0", alloc_fail);
+
+ size = sizeof(trapoid) / sizeof(oid);
+
+ switch (action) {
+
+ case CONDITION:
+
+ /* This is a slightly confusing rule */
+
+ firsterrs = firstkmemerrs;
+ lasterrs = lastkmemerrs;
+
+ if (alloc_fail == firsterrs) {
+ if (alloc_fail == 0) {
+ /*
+ * This is a change from existing rule (which has INFO). It
+ * makes sense that an OK state should be returned when
+ * alloc_fail is 0
+ */
+ new_kmem_state = OK;
+ return OK;
+ } else {
+ new_kmem_state = INFO;
+ return INFO;
+ }
+ } else {
+ if (alloc_fail == lasterrs) {
+ new_kmem_state = WARNING;
+ return WARNING;
+ } else {
+ new_kmem_state = ERROR;
+ lastkmemerrs = alloc_fail;
+ if (mem_free > threshold_freemem_low) {
+ /*
+ * Kernel memory allocation problem. The state is already
+ * set to ERROR.
+ */
+ } else {
+ /*
+ * Kernel memory allocation problem. The state is already
+ * set to ERROR.
+ */
+ }
+ return ERROR;
+ }
+ }
+
+ case OPEN:
+
+ firstkmemerrs = alloc_fail;
+ lastkmemerrs = alloc_fail;
+ strcpy((char *) status, conv_alarm_state(new_kmem_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ case INIT:
+
+ firstkmemerrs = 0;
+ lastkmemerrs = 0;
+ return 0;
+
+ case CONTINUE:
+
+ strcpy((char *) status, conv_alarm_state(new_kmem_state));
+ if (new_kmem_state > prev_kmem_state) {
+
+ /* Send trap */
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ prev_kmem_state = new_kmem_state;
+
+ }
+ return 0;
+
+ case CLOSE:
+
+ strcpy((char *) status, conv_alarm_state(new_kmem_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ default:
+
+ return 0;
+ }
+
+}
+
+/*
+ * Function: DNLC_rule : This function checks the state of DNLC nodes and
+ * issues trap if necessary
+ */
+
+int
+DNLC_rule(int action)
+{
+
+ /* This is the OID for hmDNLCStatGroup */
+ oid trapoid[] = {1, 3, 6, 1, 4, 1, 42, 2, 12, 2, 2, 11, 8, 1};
+ u_char status[8];
+ u_char description[] = "Poor DNLC Hit rate \0";
+ int size;
+ u_char dvalue[15];
+ /* dtype is given a value of 1 because hitrate is of "int" type */
+ int dtype = 1;
+
+ /*
+ * It's tricky which "value" should be put in dvalue field. More than one
+ * node's data is looked at to determine alarm state.
+ */
+ sprintf((char *) dvalue, "%d\0", hitrate);
+
+ size = sizeof(trapoid) / sizeof(oid);
+
+ switch (action) {
+
+ case CONDITION:
+
+ /*
+ * Changed the rule from existing rule. Used OK instead of INFO when
+ * there is no problem
+ */
+
+ if (refrate < threshold_dnlc_active) {
+ new_dnlc_state = OK;
+ return OK;
+ } else {
+ if (hitrate > threshold_dnlc_warning) {
+ new_dnlc_state = OK;
+ return OK;
+ } else {
+ new_dnlc_state = WARNING;
+ return WARNING;
+ }
+ }
+
+
+ case OPEN:
+
+ strcpy((char *) status, conv_alarm_state(new_dnlc_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ case INIT:
+
+ return 0;
+
+ case CONTINUE:
+
+ strcpy((char *) status, conv_alarm_state(new_dnlc_state));
+ if (new_dnlc_state > prev_dnlc_state) {
+
+ /* Send trap */
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ prev_dnlc_state = new_dnlc_state;
+
+ }
+ return 0;
+
+ case CLOSE:
+
+ strcpy((char *) status, conv_alarm_state(new_dnlc_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, size, status, description, dvalue, dtype);
+ return 0;
+
+ default:
+
+ return 0;
+ }
+
+}
+
+void
+check_state_DISK()
+{
+
+ /* TRAP STUFF */
+
+ oid *trapoid;
+ u_char status[8];
+ u_char description[] = "Disk Loaded \0";
+
+ /*
+ * A value of 12 is given to dtype because the diskName is of
+ * "DisplayString" type. Disk Name is used for dvalue because multiple
+ * values are used to determine trap state. No single value can be used
+ */
+
+ int dtype = 12;
+
+ /* Maintain a pointer to diskTable called headPtr */
+
+ hmDiskTable *headPtr;
+ int nameSize;
+ headPtr = head;
+
+ /* For each row in the table, determine if there is a new Alarm Condition */
+
+ while (headPtr != NULL) {
+
+ /* For each disk, set the new state back to OK again */
+ int new_disk_state = OK;
+ int i;
+
+ long wait = atol(headPtr->hmAvgWaitTransactions);
+ long svcTime = atol(headPtr->hmAvgDiskSvcTime);
+ long busyTime = atol(headPtr->hmDiskBusyPcnt);
+
+ /* For cases where busyTime < disk_busy_warning, svcTime < disk_svc_t_warning,
+ state is set to OK instead of INFO (as in existing rule);
+ */
+
+ if (busyTime < disk_busy_warning) {
+ new_disk_state = OK;
+ } else {
+ if (svcTime < disk_svc_t_warning) {
+ new_disk_state = OK;
+ } else {
+ if (disk_busy_problem <= busyTime) {
+ if ((disk_svc_t_warning <= svcTime) && (svcTime < disk_svc_t_problem)) {
+ new_disk_state = WARNING;
+ } else {
+ if (disk_svc_t_problem <= svcTime) {
+ new_disk_state = ERROR;
+ }
+ }
+ } else {
+ new_disk_state = WARNING;
+ }
+ }
+
+ }
+
+ nameSize = strlen(headPtr->hmDiskName);
+
+ /*
+ * Compose the trap OID here. It is:
+ * 1.3.6.1.4.1.42.2.12.2.2.11.5.1.1.1.<size-of-index>.index
+ */
+
+ trapoid = malloc((16 * sizeof(oid)) + sizeof(oid) + (nameSize * sizeof(oid)));
+
+ if ( trapoid == NULL) {
+ snmp_log(LOG_DEBUG,"malloc failed when constructing trapoid in health monitor module \n");
+ return;
+ }
+
+ trapoid[0] = 1;
+ trapoid[1] = 3;
+ trapoid[2] = 6;
+ trapoid[3] = 1;
+ trapoid[4] = 4;
+ trapoid[5] = 1;
+ trapoid[6] = 42;
+ trapoid[7] = 2;
+ trapoid[8] = 12;
+ trapoid[9] = 2;
+ trapoid[10] = 2;
+ trapoid[11] = 11;
+ trapoid[12] = 5;
+ trapoid[13] = 1;
+ trapoid[14] = 1;
+ trapoid[15] = 1;
+
+ trapoid[16] = nameSize;
+
+ for (i = 1; i <= nameSize; i++) {
+ trapoid[16 + i] = headPtr->hmDiskName[i - 1];
+ }
+
+ /* Depending on the new state, send trap if necessary */
+
+ if (new_disk_state > headPtr->hmDiskState) {
+
+ /* Send trap */
+ strcpy((char *) status, conv_alarm_state(new_disk_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, 17 + nameSize, status, description, (u_char *) headPtr->hmDiskName, dtype);
+ headPtr->hmDiskState = new_disk_state;
+
+ } else if (new_disk_state == headPtr->hmDiskState) {
+
+ /* No Change in state .. Do nothing */
+
+ } else if (new_disk_state < headPtr->hmDiskState) {
+
+ if (new_disk_state == OK) {
+
+ /* Send OK trap */
+ strcpy((char *) status, conv_alarm_state(new_disk_state));
+ send_trap(hostName, moduleName, statusOIDContext, trapoid, 17 + nameSize, status, description, (u_char *) headPtr->hmDiskName, dtype);
+ headPtr->hmDiskState = OK;
+
+ }
+ }
+
+ headPtr = headPtr->pNext;
+
+ } /* End of while loop that traverses each row */
+
+
+ return;
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/healthMonitor/healthMonitor.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+
+
+#ifndef HEALTHMONITOR_H
+#define HEALTHMONITOR_H
+
+/* function declarations */
+void init_healthMonitor(void);
+Netsnmp_Node_Handler get_hmSpinsOnMutexes;
+Netsnmp_Node_Handler get_hmTotProcInRunQueue;
+Netsnmp_Node_Handler get_hmTotRPCCalls;
+Netsnmp_Node_Handler get_hmUsedSwapSpace;
+Netsnmp_Node_Handler get_hmDNLCMisses;
+Netsnmp_Node_Handler get_hmReservedSwapSpace;
+Netsnmp_Node_Handler get_hmTotMemAllocFails;
+Netsnmp_Node_Handler get_hmAvailableSwapSpace;
+Netsnmp_Node_Handler get_hmDNLCHitRate;
+Netsnmp_Node_Handler get_hmDNLCHits;
+Netsnmp_Node_Handler get_hmAllocatedSwapSpace;
+Netsnmp_Node_Handler get_hmTotNumOfCPUs;
+Netsnmp_Node_Handler get_hmPageScanRate;
+Netsnmp_Node_Handler get_hmTimers;
+Netsnmp_Node_Handler get_hmTotBadRPCCalls;
+Netsnmp_Node_Handler get_hmDNLCRefRate;
+Netsnmp_Node_Handler get_hmTotSendFails;
+Netsnmp_Node_Handler get_hmTotFailedCallsBV;
+Netsnmp_Node_Handler get_hmTotNumOfAuthRefresh;
+Netsnmp_Node_Handler get_hmHandspread;
+Netsnmp_Node_Handler get_hmTotRPCRetransmissions;
+Netsnmp_Node_Handler get_hmKmemFreeMem;
+Netsnmp_Node_Handler get_hmTotBadRPCReplies;
+Netsnmp_Node_Handler get_hmKmemErrors;
+Netsnmp_Node_Handler get_hmTotProcReadyInSwap;
+Netsnmp_Node_Handler get_hmTotProcBlocked;
+Netsnmp_Node_Handler get_hmTotRPCCallsTimedOut;
+
+
+/* Additions to the template generated by mib2c */
+
+/* Define node alarm states */
+
+#define OK 0
+#define INFO 1
+#define WARNING 2
+#define ERROR 3
+
+/* Defile various rule states */
+
+#define NOTINIT 0
+#define INIT 1
+#define OPEN 2
+#define CONTINUE 3
+#define CLOSE 4
+#define CONDITION 5
+
+/* Forward Function declarations */
+
+int hm_post_read_config(int a, int b, void *c, void *d);
+void read_health_monitor_thresholds(const char *token, char *cptr);
+void send_trap(u_char *host , u_char *mod , u_char* con, oid *asdf, int size, u_char *stat , u_char *desc , u_char* dvalue, int dtype);
+void hm_handle_rule(int* rule_state, int (*rule) (int action));
+
+int SWAP_rule(int action);
+int Kernel_rule(int action);
+int NFS_rule(int action);
+int CPU_rule(int action);
+int RAM_rule(int action);
+int KMEM_rule(int action);
+int DNLC_rule(int action);
+
+void refresh_all_HM_data(unsigned int clientreg, void *clientarg);
+void refresh_SWAP_data();
+void refresh_Kernel_data();
+void refresh_NFS_data();
+void refresh_CPU_data();
+void refresh_RAM_data();
+void refresh_KMEM_data();
+void refresh_DNLC_data();
+
+char* conv_alarm_state(int);
+
+/*
+ * Additions from hmDiskGroup.h required for implementing hmDiskGroup
+ *
+ */
+
+/* function declarations */
+void initialize_table_hmDiskTable(void);
+Netsnmp_Node_Handler hmDiskTable_handler;
+
+Netsnmp_First_Data_Point hmDiskTable_get_first_data_point;
+Netsnmp_Next_Data_Point hmDiskTable_get_next_data_point;
+
+/* column number definitions for table hmDiskTable */
+ #define COLUMN_HMDISKNAME 1
+ #define COLUMN_HMDISKALIASNAME 2
+ #define COLUMN_HMAVGWAITTRANSACTIONS 3
+ #define COLUMN_HMDISKBUSYPCNT 4
+ #define COLUMN_HMAVGDISKSVCTIME 5
+
+typedef struct HmDiskEntry {
+ char *hmDiskName;
+ char *hmDiskAliasName;
+ char *hmAvgWaitTransactions;
+ char *hmDiskBusyPcnt;
+ char *hmAvgDiskSvcTime;
+ int hmDiskState;
+ int hmTraversed;
+
+ struct HmDiskEntry* pNext;
+} hmDiskTable;
+
+#define DISK_DATA_LEN 8
+
+/* Function prototypes */
+
+void construct_DISK_table();
+void refresh_DISK_table(unsigned int clientreg, void *clientarg);
+hmDiskTable* get_first_node();
+void check_state_DISK();
+
+#endif /* HEALTHMONITOR_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/healthMonitor/health_monitor.conf Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,67 @@
+
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+# health-monitor.conf:
+# This file contains thresholds to determine alarm conditions of nodes
+# in "health monitor" module.
+#
+
+# Thresholds for SWAP nodes
+
+threshold_swapavail_info 500000
+threshold_swapavail_warning 100000
+threshold_swapavail_error 40000
+
+# Thresholds for Kernel nodes
+
+threshold_mutex_info 200
+threshold_mutex_warning 500
+
+# Thresholds for NFS nodes
+
+threshold_mincalls 0.1
+threshold_badxids 0.0
+threshold_timeouts 5.0
+
+# Thresholds for CPU nodes
+
+threshold_cpuload_info 1.0
+threshold_cpuload_warning 2.0
+threshold_cpuload_error 3.0
+
+# Thresholds for RAM nodes
+
+threshold_restime_long 600
+threshold_restime_ok 40
+threshold_restime_error 20
+
+# Thresholds for KMEM nodes
+
+threshold_freemem_low 1
+
+# Thresholds for DNLC nodes
+
+threshold_dnlc_active 100.0
+threshold_dnlc_warning 80.0
+
+# Thresholds for Disk nodes
+
+disk_busy_warning 10.0
+disk_busy_problem 30.0
+disk_svc_t_warning 20.0
+disk_svc_t_problem 30.0
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/healthMonitor/kr_iostat.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,805 @@
+/*
+* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+*
+* U.S. Government Rights - Commercial software. Government users are subject
+* to the Sun Microsystems, Inc. standard license agreement and applicable
+* provisions of the FAR and its supplements.
+*
+*
+* This distribution may include materials developed by third parties. Sun,
+* Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+* trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+*
+*/
+
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <memory.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#include <kstat.h>
+#include <stropts.h>
+#include <poll.h>
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/sysinfo.h>
+#include <sys/stat.h>
+
+kstat_ctl_t *kc; /* libkstat cookie */
+static int ncpus = -1;
+typedef struct cpuinfo {
+ kstat_t *cs_kstat;
+ cpu_stat_t cs_old;
+ cpu_stat_t cs_new;
+} cpuinfo_t;
+
+static cpuinfo_t *cpulist = NULL;
+
+#define DELTA(i, x) (cpulist[i].cs_new.x - cpulist[i].cs_old.x)
+
+static kstat_t **cpu_stat_list = NULL;
+static cpu_stat_t *cpu_stat_data = NULL;
+
+#define DISK_OLD 0x0001
+#define DISK_NEW 0x0002
+#define DISK_EXTENDED 0x0004
+#define DISK_ERRORS 0x0008
+#define DISK_EXTENDED_ERRORS 0x0010
+#define DISK_NORMAL (DISK_OLD | DISK_NEW)
+
+#define DISK_IO_MASK (DISK_OLD | DISK_NEW | DISK_EXTENDED)
+#define DISK_ERROR_MASK (DISK_ERRORS | DISK_EXTENDED_ERRORS)
+#define PRINT_VERTICAL (DISK_ERROR_MASK | DISK_EXTENDED)
+
+#define REPRINT 19
+
+/*
+ * Name and print priority of each supported ks_class.
+ */
+#define IO_CLASS_DISK 0
+#define IO_CLASS_PARTITION 0
+#define IO_CLASS_TAPE 1
+#define IO_CLASS_NFS 2
+
+struct io_class {
+ char *class_name;
+ int class_priority;
+};
+
+
+#undef printf
+#undef putchar
+/*ARGSUSED*/
+int printf(const char *bar, ...) { return 1; }
+/*ARGSUSED*/
+int putchar(int bar){return 1;}
+
+static int reentrant = 0;
+
+/*
+ * I've had some strange behavior with "refreshMode = async".
+ */
+#define REENTRANT_BEGIN() { \
+ if (reentrant != 0) \
+ reentrant++; \
+ }
+
+#define REENTRANT_END() { \
+ reentrant--; \
+ }
+
+static struct io_class io_class[] = {
+ { "disk", IO_CLASS_DISK},
+ { "partition", IO_CLASS_PARTITION},
+ { NULL, 0}
+};
+
+struct diskinfo {
+ struct diskinfo *next;
+ kstat_t *ks;
+ kstat_io_t new_kios, old_kios;
+ int selected;
+ int class;
+ char *device_name;
+ kstat_t *disk_errs; /* pointer to the disk's error kstats */
+};
+
+#define DISK_GIGABYTE 1000000000.0
+
+static void *dl = 0; /* for device name lookup */
+extern void *build_disk_list(void *);
+extern char *lookup_ks_name(char *, void *);
+
+#define NULLDISK (struct diskinfo *)0
+static struct diskinfo zerodisk;
+static struct diskinfo *firstdisk = NULLDISK;
+static struct diskinfo *lastdisk = NULLDISK;
+static struct diskinfo *snip = NULLDISK;
+static int refreshDiskdetail=0;
+static int refreshDisksrv=0;
+
+static cpu_stat_t old_cpu_stat, new_cpu_stat;
+
+#define DISK_DELTA(x) (disk->new_kios.x - disk->old_kios.x)
+
+#define CPU_DELTA(x) (new_cpu_stat.x - old_cpu_stat.x)
+
+
+#define PRINT_TTY_DATA(sys, time) \
+ (void) printf(" %3.0f %4.0f",\
+ (float)CPU_DELTA(sys.rawch) / time, \
+ (float)CPU_DELTA(sys.outch) / time);
+
+#define PRINT_CPU_DATA(sys, pcnt) \
+ (void) printf(" %2.0f %2.0f %2.0f %2.0f", \
+ CPU_DELTA(sys.cpu[CPU_USER]) * pcnt, \
+ CPU_DELTA(sys.cpu[CPU_KERNEL]) * pcnt, \
+ CPU_DELTA(sys.cpu[CPU_WAIT]) * pcnt, \
+ CPU_DELTA(sys.cpu[CPU_IDLE]) * pcnt);
+
+#define PRINT_CPU_HDR1 (void) printf("%12s", "cpu");
+#define PRINT_CPU_HDR2 (void) printf(" us sy wt id");
+#define PRINT_TTY_HDR1 (void) printf("%9s", "tty");
+#define PRINT_TTY_HDR2 (void) printf(" tin tout");
+#define PRINT_ERR_HDR (void) printf(" ---- errors --- ");
+
+static char *cmdname = "iostat";
+
+static int do_disk = 0;
+static int do_cpu = 0;
+static int do_interval = 0;
+static int do_partitions = 0; /* collect per-partition stats */
+static int do_partitions_only = 0; /* collect per-partition stats only */
+ /* no per-device stats for disks */
+static int do_conversions = 0; /* display disks as cXtYdZ */
+static int do_megabytes = 0; /* display data in MB/sec */
+#define DEFAULT_LIMIT 4
+static int limit = 0; /* limit for drive display */
+static int ndrives = 0;
+
+struct disk_selection {
+ struct disk_selection *next;
+ char ks_name[KSTAT_STRLEN];
+};
+
+static struct disk_selection *disk_selections = (struct disk_selection *)NULL;
+
+static void show_disk(struct diskinfo *disk, double *rps, double *wps, double *tps, double *krps, double *kwps, double *kps, double *avw, double *avr, double *w_pct, double *r_pct, double *wserv, double *rserv, double *serv);
+static void cpu_stat_init(void);
+
+static int cpu_stat_load(int);
+
+static void fail(int, char *, ...);
+static void safe_zalloc(void **, int, int);
+static void init_disks(void);
+static void select_disks(void);
+static int diskinfo_load(void);
+static void init_disk_errors(void);
+static void find_disk(kstat_t *);
+
+/* static struct diskinfo *disk; */
+int first_time = 1;
+
+void
+initialize_everything()
+{
+ if ((kc = kstat_open()) == NULL)
+ return;
+ do_disk |= DISK_EXTENDED /* | DISK_OLD */;
+ do_conversions = 1;
+ do_cpu = 1;
+ {
+ /*
+ * Choose drives to be displayed. Priority
+ * goes to (in order) drives supplied as arguments,
+ * then any other active drives that fit.
+ */
+ struct disk_selection **dsp = &disk_selections;
+ *dsp = (struct disk_selection *)NULL;
+ }
+ cpu_stat_init();
+ init_disks();
+#if 0
+ for (disk = firstdisk; disk; disk->next) {
+ number_of_disks++;
+ }
+#endif
+ /* disk = firstdisk; */
+ first_time = 0;
+}
+
+int update_kstat_chain(int cpu_save_old_flag)
+{
+ int ret;
+
+ ret=kstat_chain_update(kc);
+ if (ret == 0) { /* no change */
+ cpu_stat_load(cpu_save_old_flag);
+ diskinfo_load();
+ return 0;
+ } else if (ret > 0) { /* changed */
+ cpu_stat_init();
+ init_disks();
+ if (cpu_stat_load(cpu_save_old_flag)) {
+ return -1;
+ };
+ if (diskinfo_load()) {
+ return -1;
+ };
+ return 0;
+ } else { /* error */
+ return -1;
+ }
+}
+
+/* Get Adaptive mutex summary and number of cpus for the system */
+int
+krgetsmtx(ulong *smtx, int *num_cpus)
+{
+ int i, c, hz, ticks;
+ ulong mutex;
+ double etime, percent;
+ etime = 0;
+ mutex = 0;
+
+ if ((first_time) || (!kc))
+ initialize_everything();
+
+ while (update_kstat_chain(1) == -1);
+
+/* while (kstat_chain_update(kc) || cpu_stat_load(1)) {
+ (void) cpu_stat_init();
+ }
+*/
+
+
+ hz = sysconf(_SC_CLK_TCK);
+ for (c = 0; c < ncpus; c++) {
+ ticks = 0;
+ for (i = 0; i < CPU_STATES; i++)
+ ticks += DELTA(c, cpu_sysinfo.cpu[i]);
+ etime = (double)ticks / hz;
+ if (etime == 0.0)
+ etime = 1.0;
+ percent = 100.0 / etime / hz;
+ mutex += (int) (DELTA(c, cpu_sysinfo.mutex_adenters) / etime);
+ }
+ *num_cpus = ncpus;
+ *smtx = mutex;
+
+ return 0;
+}
+
+int
+krgetcpudetail (cpu_stat_t **cpus, int *num_cpus)
+{
+ REENTRANT_BEGIN();
+ if ((first_time) || (!kc))
+ initialize_everything();
+
+ while (update_kstat_chain(0) == -1) {
+ /* DPRINTF("ERROR: kstat_chain_update \n");
+ DFFLUSH(stdout);*/
+ }
+
+ *cpus = cpu_stat_data;
+ *num_cpus = ncpus;
+ REENTRANT_END();
+ return 0;
+}
+
+/* returns 0 if more disks remain, 1 if the last disk, < 0 on error */
+int
+krgetdiskdetail(char *name, char *alias, double *rps, double *wps, double *tps, double *krps, double *kwps, double *kps, double *avw, double *avr)
+{
+ double w_pct, r_pct, wserv, rserv, serv;
+ static struct diskinfo *disk = NULL;
+
+ REENTRANT_BEGIN();
+
+
+ if (disk==NULL) disk=firstdisk;
+ if ((first_time) || (!kc)) {
+ initialize_everything();
+ disk=firstdisk;
+
+ }
+
+ if (refreshDiskdetail) {
+ disk=firstdisk;
+ refreshDiskdetail=0;
+ }
+
+ if (disk == firstdisk) {
+ while (update_kstat_chain(0) == -1) {
+ /* DPRINTF("ERROR: diskdetail - kstat_chain_update \n");
+ DFFLUSH(stdout);*/
+ }
+ }
+
+ if (disk) {
+ if (disk->selected) {
+ show_disk(disk, rps, wps, tps, krps, kwps, kps, avw, avr, &w_pct, &r_pct, &wserv, &rserv, &serv);
+ strcpy(name, disk->ks->ks_name);
+ if (disk->device_name != NULL)
+ strcpy(alias, disk->device_name);
+ else
+ strcpy(alias, disk->ks->ks_name);
+ }
+ else {
+ }
+ disk = disk->next;
+ }
+ REENTRANT_END();
+ if (disk == NULL) {
+ disk = firstdisk;
+ return 1;
+ }
+ return(0);
+}
+
+/* returns 0 if more disks remain, 1 if the last disk, < 0 on error */
+int
+krgetdisksrv(char *name, char *alias, double *w_pct, double *r_pct, double *wserv, double *rserv, double *serv)
+{
+ static struct diskinfo *disk = NULL;
+ double rps, wps, tps, krps, kwps, kps, avw, avr;
+
+
+
+ if (disk==NULL) disk=firstdisk;
+
+ if (refreshDisksrv) {
+ disk=firstdisk;
+ refreshDisksrv=0;
+ }
+ if (disk) {
+ if (disk->selected) {
+ show_disk(disk, &rps, &wps, &tps, &krps, &kwps, &kps, &avw, &avr, w_pct, r_pct, wserv, rserv, serv);
+ strcpy(name, disk->ks->ks_name);
+ if (disk->device_name != NULL)
+ strcpy(alias, disk->device_name);
+ else
+ strcpy(alias, disk->ks->ks_name);
+ }
+ else {
+ /*ddlPrintf(DDL_ERROR, "krgetdisksrv - skipping %s\n", disk->device_name ? disk->device_name : disk->ks->ks_name);*/
+ }
+ disk = disk->next;
+ }
+ if (disk == NULL) {
+ disk = firstdisk;
+ return 1;
+ }
+
+ return(0);
+}
+
+static void
+show_disk(struct diskinfo *disk, double *Rps, double *Wps, double *Tps, double *Krps, double *Kwps, double *Kps, double *Avw, double *Avr, double *W_pct, double *R_pct, double *Wserv, double *Rserv, double *Serv)
+{
+ double rps, wps, tps, krps, kwps, kps, avw, avr, w_pct, r_pct;
+ double wserv, rserv, serv;
+ double iosize; /* kb/sec or MB/sec */
+ double etime, hr_etime;
+
+ hr_etime = (double)DISK_DELTA(wlastupdate);
+ if (hr_etime == 0.0)
+ hr_etime = (double)NANOSEC;
+ etime = hr_etime / (double)NANOSEC;
+
+ rps = (double)DISK_DELTA(reads) / etime;
+ /* reads per second */
+
+ wps = (double)DISK_DELTA(writes) / etime;
+ /* writes per second */
+
+ tps = rps + wps;
+ /* transactions per second */
+
+ /*
+ * report throughput as either kb/sec or MB/sec
+ */
+ if (!do_megabytes) {
+ iosize = 1024.0;
+ } else {
+ iosize = 1048576.0;
+ }
+ krps = (double)DISK_DELTA(nread) / etime / iosize;
+ /* block reads per second */
+
+ kwps = (double)DISK_DELTA(nwritten) / etime / iosize;
+ /* blocks written per second */
+
+ kps = krps + kwps;
+ /* blocks transferred per second */
+
+ avw = (double)DISK_DELTA(wlentime) / hr_etime;
+ /* average number of transactions waiting */
+
+ avr = (double)DISK_DELTA(rlentime) / hr_etime;
+ /* average number of transactions running */
+
+ wserv = tps > 0 ? (avw / tps) * 1000.0 : 0.0;
+ /* average wait service time in milliseconds */
+
+ rserv = tps > 0 ? (avr / tps) * 1000.0 : 0.0;
+ /* average run service time in milliseconds */
+
+ serv = tps > 0 ? ((avw + avr) / tps) * 1000.0 : 0.0;
+ /* average service time in milliseconds */
+
+ w_pct = (double)DISK_DELTA(wtime) / hr_etime * 100.0;
+ /* % of time there is a transaction waiting for service */
+
+ r_pct = (double)DISK_DELTA(rtime) / hr_etime * 100.0;
+ /* % of time there is a transaction running */
+
+ if (do_interval) {
+ rps *= etime;
+ wps *= etime;
+ tps *= etime;
+ krps *= etime;
+ kwps *= etime;
+ kps *= etime;
+ }
+
+ *Rps = rps;
+ *Wps = wps;
+ *Tps = tps;
+ *Krps = krps;
+ *Kwps = kwps;
+ *Kps = kps;
+ *Avw = avw;
+ *Avr = avr;
+ *W_pct = w_pct;
+ *R_pct = r_pct;
+ *Wserv = wserv;
+ *Rserv = rserv;
+ *Serv = serv;
+}
+
+/*
+ * Get list of cpu_stat KIDs for subsequent cpu_stat_load operations.
+ */
+
+static void
+cpu_stat_init(void)
+{
+ kstat_t *ksp;
+ int tmp_ncpus;
+ int i;
+ int nb_cpus;
+
+ tmp_ncpus = 0;
+ for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) {
+ if (strncmp(ksp->ks_name, "cpu_stat", 8) == 0) {
+ tmp_ncpus++;
+ if (kstat_read(kc, ksp, NULL) == -1) {
+ /* ddlPrintf(DDL_ERROR, "cpu_stat_init - kstat_read() failed for cpu:%s\n", ksp->ks_name);*/
+
+ }
+ }
+ }
+
+ safe_zalloc((void **) &cpulist, tmp_ncpus * sizeof (cpuinfo_t), 1);
+ safe_zalloc((void **)&cpu_stat_list, tmp_ncpus * sizeof (kstat_t *), 1);
+ safe_zalloc((void *)&cpu_stat_data, tmp_ncpus * sizeof (cpu_stat_t), 1);
+
+ ncpus = 0;
+ nb_cpus = 0;
+ for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) {
+ if (strncmp(ksp->ks_name, "cpu_stat", 8) == 0) {
+ if (kstat_read(kc, ksp, NULL) != -1) {
+ cpu_stat_list[ncpus++] = ksp;
+ } else {
+ /* ddlPrintf(DDL_ERROR, "cpu_stat_init - kstat_read() failed for cpu:%s\n", ksp->ks_name); */
+ }
+ }
+
+ if (strcmp(ksp->ks_module, "cpu_stat") != 0)
+ continue;
+ /*
+ * insertion sort by CPU id
+ */
+ for (i = nb_cpus - 1; i >= 0; i--) {
+ if (cpulist[i].cs_kstat->ks_instance < ksp->ks_instance)
+ break;
+ cpulist[i + 1].cs_kstat = cpulist[i].cs_kstat;
+ }
+ cpulist[i + 1].cs_kstat = ksp;
+ nb_cpus++;
+ }
+
+
+ (void) memset(&new_cpu_stat, 0, sizeof (cpu_stat_t));
+
+ if ( ncpus != tmp_ncpus ) {
+ /* ddlPrintf(DDL_ERROR, "cpu_stat_init - kstat_read() for some cpu failed, Passed :ncpus=%d Total :tmp_ncpus=%d\n", ncpus, tmp_ncpus); */
+ }
+}
+
+
+static int
+cpu_stat_load(int save_old_flag)
+{
+ int i, j;
+ uint *np, *tp;
+
+ if (save_old_flag)
+ old_cpu_stat = new_cpu_stat;
+ (void) memset(&new_cpu_stat, 0, sizeof (cpu_stat_t));
+
+ /* Sum across all cpus */
+ for (i = 0; i < ncpus; i++) {
+ cpulist[i].cs_old = cpulist[i].cs_new;
+ if (kstat_read(kc, cpulist[i].cs_kstat,
+ (void *) &cpulist[i].cs_new) == -1)
+ return (1);
+
+ if (kstat_read(kc, cpu_stat_list[i], (void *)&cpu_stat_data[i]) == -1) {
+ /* ddlPrintf(DDL_ERROR, "cpu_stat_load - kstat_read() failed for cpu:%s\n", cpu_stat_list[i]->ks_name); */
+ return (1);
+ }
+ np = (uint *)&new_cpu_stat.cpu_sysinfo;
+ tp = (uint *)&(cpu_stat_data[i].cpu_sysinfo);
+ for (j = 0; j < sizeof (cpu_sysinfo_t); j += sizeof (uint_t))
+ *np++ += *tp++;
+ np = (uint *)&new_cpu_stat.cpu_vminfo;
+ tp = (uint *)&(cpu_stat_data[i].cpu_vminfo);
+ for (j = 0; j < sizeof (cpu_vminfo_t); j += sizeof (uint_t))
+ *np++ += *tp++;
+ }
+ return (0);
+}
+
+static void
+fail(int do_perror, char *message, ...)
+{
+ va_list args;
+
+ va_start(args, message);
+ (void) fprintf(stderr, "%s: ", cmdname);
+ (void) vfprintf(stderr, message, args);
+ va_end(args);
+ if (do_perror)
+ (void) fprintf(stderr, ": %s", strerror(errno));
+ (void) fprintf(stderr, "\n");
+ exit(2);
+}
+
+static void
+safe_zalloc(void **ptr, int size, int free_first)
+{
+ if (free_first && *ptr != NULL)
+ free(*ptr);
+ if ((*ptr = (void *)malloc(size)) == NULL)
+ fail(1, "malloc failed");
+ (void) memset(*ptr, 0, size);
+}
+
+
+/*
+ * Sort based on ks_class, ks_module, ks_instance, ks_name
+ */
+static int
+kscmp(struct diskinfo *ks1, struct diskinfo *ks2)
+{
+ int cmp;
+
+ cmp = ks1->class - ks2->class;
+ if (cmp != 0)
+ return (cmp);
+
+ cmp = strcmp(ks1->ks->ks_module, ks2->ks->ks_module);
+ if (cmp != 0)
+ return (cmp);
+ cmp = ks1->ks->ks_instance - ks2->ks->ks_instance;
+ if (cmp != 0)
+ return (cmp);
+
+ if (ks1->device_name && ks2->device_name)
+ return (strcmp(ks1->device_name, ks2->device_name));
+ else
+ return (strcmp(ks1->ks->ks_name, ks2->ks->ks_name));
+}
+
+static void
+init_disks(void)
+{
+ struct diskinfo *disk, *prevdisk, *comp;
+ kstat_t *ksp;
+ static int first = 1;
+
+ refreshDiskdetail=1;
+ refreshDisksrv=1;
+
+ if (do_conversions)
+ dl = (void *)build_disk_list(dl);
+
+ if(first) {
+ zerodisk.next = NULLDISK;
+ first = 0;
+ }
+
+ disk = &zerodisk;
+
+ /*
+ * Patch the snip in the diskinfo list (see below)
+ */
+ if (snip)
+ lastdisk->next = snip;
+
+ for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) {
+ int i;
+
+ if (ksp->ks_type != KSTAT_TYPE_IO)
+ continue;
+
+ for (i = 0; io_class[i].class_name != NULL; i++) {
+ if (strcmp(ksp->ks_class, io_class[i].class_name) == 0)
+ break;
+ }
+ if (io_class[i].class_name == NULL)
+ continue;
+
+ if (do_partitions_only &&
+ (strcmp(ksp->ks_class, "disk") == 0))
+ continue;
+
+ if (!do_partitions && !do_partitions_only &&
+ (strcmp(ksp->ks_class, "partition") == 0))
+ continue;
+ if (!strcmp(ksp->ks_name, "fd0"))
+ continue;
+
+ prevdisk = disk;
+ if (disk->next)
+ disk = disk->next;
+ else {
+ safe_zalloc((void **)&disk->next,
+ sizeof (struct diskinfo), 0);
+ disk = disk->next;
+ disk->next = NULLDISK;
+ }
+ disk->ks = ksp;
+ (void) memset((void *)&disk->new_kios, 0, sizeof (kstat_io_t));
+ disk->new_kios.wlastupdate = disk->ks->ks_crtime;
+ disk->new_kios.rlastupdate = disk->ks->ks_crtime;
+
+ if (do_conversions && dl) {
+ if (!strcmp(ksp->ks_class, "nfs") == 0)
+ disk->device_name =
+ lookup_ks_name(ksp->ks_name, dl);
+ } else {
+ disk->device_name = (char *)0;
+ }
+
+ disk->disk_errs = (kstat_t *)NULL;
+ disk->class = io_class[i].class_priority;
+
+ /*
+ * Insertion sort on (ks_class, ks_module, ks_instance, ks_name)
+ */
+ comp = &zerodisk;
+ while (kscmp(disk, comp->next) > 0)
+ comp = comp->next;
+ if (prevdisk != comp) {
+ prevdisk->next = disk->next;
+ disk->next = comp->next;
+ comp->next = disk;
+ disk = prevdisk;
+ }
+ }
+ /*
+ * Put a snip in the linked list of diskinfos. The idea:
+ * If there was a state change such that now there are fewer
+ * disks, we snip the list and retain the tail, rather than
+ * freeing it. At the next state change, we clip the tail back on.
+ * This prevents a lot of malloc/free activity, and it's simpler.
+ */
+ lastdisk = disk;
+ snip = disk->next;
+ disk->next = NULLDISK;
+
+ firstdisk = zerodisk.next;
+ select_disks();
+
+ if (do_disk & DISK_ERROR_MASK)
+ init_disk_errors();
+}
+
+static void
+select_disks(void)
+{
+ struct diskinfo *disk;
+ struct disk_selection *ds;
+
+ ndrives = 0;
+ for (disk = firstdisk; disk; disk = disk->next) {
+ disk->selected = 0;
+ for (ds = disk_selections; ds; ds = ds->next) {
+ if (strcmp(disk->ks->ks_name, ds->ks_name) == 0) {
+ disk->selected = 1;
+ ndrives++;
+ break;
+ }
+ }
+ }
+ for (disk = firstdisk; disk; disk = disk->next) {
+ if (disk->selected)
+ continue;
+ if (limit && ndrives >= limit)
+ break;
+ disk->selected = 1;
+ ndrives++;
+ }
+}
+
+static int
+diskinfo_load(void)
+{
+ struct diskinfo *disk;
+
+ for (disk = firstdisk; disk; disk = disk->next) {
+ if (disk->selected) {
+ disk->old_kios = disk->new_kios;
+ if (kstat_read(kc, disk->ks,
+ (void *)&disk->new_kios) == -1)
+ return (1);
+ if (disk->disk_errs) {
+ if (kstat_read(kc, disk->disk_errs, NULL) == -1) {
+ return (1);
+ }
+ }
+ }
+ }
+ return (0);
+}
+static void
+init_disk_errors()
+{
+ kstat_t *ksp;
+
+ for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) {
+ if ((ksp->ks_type == KSTAT_TYPE_NAMED) &&
+ (strncmp(ksp->ks_class, "device_error", 12) == 0)) {
+ find_disk(ksp);
+ }
+ }
+}
+static void
+find_disk(ksp)
+kstat_t *ksp;
+{
+ struct diskinfo *disk;
+ char kstat_name[KSTAT_STRLEN];
+ char *dname = kstat_name;
+ char *ename = ksp->ks_name;
+
+ while (*ename != ',') {
+ *dname = *ename;
+ dname++;
+ ename++;
+ }
+ *dname = '\0';
+
+ for (disk = firstdisk; disk; disk = disk->next) {
+ if (disk->selected) {
+ if (strcmp(disk->ks->ks_name, kstat_name) == 0) {
+ disk->disk_errs = ksp;
+ return;
+ }
+ }
+ }
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/healthMonitor/kr_memory.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+*
+* U.S. Government Rights - Commercial software. Government users are subject
+* to the Sun Microsystems, Inc. standard license agreement and applicable
+* provisions of the FAR and its supplements.
+*
+*
+* This distribution may include materials developed by third parties. Sun,
+* Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+* trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+*
+*/
+
+
+#if 0
+#include <stdio.h>
+#endif
+#include <kstat.h>
+#include <sys/types.h>
+#include <sys/swap.h>
+#include <vm/anon.h>
+#include <unistd.h>
+#include <string.h>
+
+#define ONEMB 1048576
+
+extern int first_time;
+extern kstat_ctl_t *kc;
+extern void initialize_everything();
+
+static ulong_t page_size = 0;
+
+/*
+ * Return value of named statistic for given kstat_named kstat.
+ * Return 0 if named statistic is not in list.
+ */
+static u_longlong_t
+kstat_named_value(kstat_t *ksp, char *name)
+{
+ kstat_named_t *knp;
+
+ if (ksp == NULL)
+ return (0);
+
+ knp = kstat_data_lookup(ksp, name);
+ if (knp != NULL) {
+ switch (knp->data_type) {
+ case KSTAT_DATA_UINT64:
+ return (knp->value.ull);
+ case KSTAT_DATA_UINT32:
+ default:
+ return (knp->value.ul);
+ }
+ } else {
+ return (0);
+ }
+}
+
+int
+krgetmemusage (int *mem_avail, int *mem_inuse, int *mem_free)
+{
+ int intfactor;
+
+ if ((first_time) || (!kc))
+ initialize_everything();
+
+ if (page_size == 0)
+ page_size = sysconf(_SC_PAGESIZE);
+
+ /* do ops differently dependent on pagesize to avoid overflow
+ * note that: pagesize & ONEMB will both be powers of 2 therefore
+ * the bigger one will be exactly divisible by the smaller
+ */
+ if(page_size < ONEMB){
+ intfactor = ONEMB/page_size;
+
+/* The following line is commented out because the value returned is less
+than the actual number of pages in the machine. More research has got be
+done about what is the value that kstat returns
+ *mem_avail = kstat_named_value(ksp, "physmem") / intfactor; */
+
+ *mem_avail = sysconf(_SC_PHYS_PAGES) / intfactor;
+ *mem_free = sysconf(_SC_AVPHYS_PAGES) / intfactor;
+ *mem_inuse = *mem_avail - *mem_free;
+ }
+ else{ /* page_size >= ONEMB */
+ intfactor = page_size/ONEMB;
+/* *mem_avail = kstat_named_value(ksp, "physmem") * intfactor; */
+ *mem_avail = sysconf(_SC_PHYS_PAGES) * intfactor;
+ *mem_free = sysconf(_SC_AVPHYS_PAGES) * intfactor;
+ *mem_inuse = *mem_avail - *mem_free;
+ }
+ return 0;
+}
+
+
+u_int convert_ticks_to_bytes(u_int input) {
+
+ static float factor = -1;
+
+ if (factor == -1)
+ factor = (float)(sysconf(_SC_PAGESIZE))/1024;/* in KB */
+ return (input*(u_int)factor);
+}
+
+
+int
+krgetswapusage (int *swap_avail, int *swap_resv, int *swap_alloc, int *swap_used, int *swap_total)
+{
+
+ struct anoninfo ai;
+
+ if (swapctl(SC_AINFO, &ai) == -1) {
+ /* perror("Error in swapctl ..............."); */
+ return (-1);
+ }
+ *swap_avail = convert_ticks_to_bytes(ai.ani_max - ai.ani_resv);
+ *swap_resv = convert_ticks_to_bytes(ai.ani_resv - ai.ani_max + ai.ani_free);
+ *swap_alloc = convert_ticks_to_bytes(ai.ani_max - ai.ani_free);
+ *swap_used = convert_ticks_to_bytes(ai.ani_resv);
+ *swap_total = (*swap_used) + (*swap_avail);
+ return 0;
+}
+
+/*
+ * returns information about the "kmem_cache" buffer of name
+ * "cache_name". If the last character is an asterisk, it
+ * returns the sum of the statistics over all caches that
+ * match.
+ */
+int
+krgetkmemdetail (const char *cache_name, int *alloc, int *alloc_fail, int *buf_size, int *buf_avail, int *buf_total, int *buf_max)
+{
+ kstat_t *ksp;
+ int length = 0;
+
+ if ((first_time) || (!kc))
+ initialize_everything();
+
+ if (cache_name[strlen(cache_name) - 1] == '*')
+ length = strlen(cache_name) - 1;
+ else
+ length = 256;
+
+ *alloc = 0;
+ *alloc_fail = 0;
+ *buf_size = 0;
+ *buf_avail = 0;
+ *buf_total = 0;
+ *buf_max = 0;
+
+ for (ksp = kc->kc_chain; ksp != NULL; ksp = ksp->ks_next) {
+ if (strcmp(ksp->ks_class, "kmem_cache") != 0)
+ continue;
+ if (strncmp(ksp->ks_name, cache_name, length) != 0)
+ continue;
+ if (kstat_read(kc, ksp, NULL) == -1)
+ return -1;
+ *alloc += kstat_named_value(ksp, "alloc");
+ *alloc_fail += kstat_named_value(ksp, "alloc_fail");
+ *buf_size += kstat_named_value(ksp, "buf_size");
+ *buf_avail += kstat_named_value(ksp, "buf_avail");
+ *buf_total += kstat_named_value(ksp, "buf_total");
+ *buf_max += kstat_named_value(ksp, "buf_max");
+ }
+ return 0;
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/healthMonitor/kr_nfsstat.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,230 @@
+/*
+* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+*
+* U.S. Government Rights - Commercial software. Government users are subject
+* to the Sun Microsystems, Inc. standard license agreement and applicable
+* provisions of the FAR and its supplements.
+*
+*
+* This distribution may include materials developed by third parties. Sun,
+* Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+* trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+*
+*/
+
+
+
+/*
+ * nfsstat: Network File System statistics for client RPC
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <kvm.h>
+#include <kstat.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/t_lock.h>
+#include <sys/tiuser.h>
+#include <sys/statvfs.h>
+#include <sys/mntent.h>
+#include <sys/mnttab.h>
+#include <sys/sysmacros.h>
+#include <sys/mkdev.h>
+#include <rpc/types.h>
+#include <rpc/xdr.h>
+#include <rpc/auth.h>
+#include <rpc/clnt.h>
+#include <nfs/nfs.h>
+#include <nfs/nfs_clnt.h>
+
+static kstat_ctl_t *kc = NULL; /* libkstat cookie */
+static kstat_t *rpc_clts_client_kstat;
+static kstat_t *rpc_cots_client_kstat;
+
+static void getstats(void);
+static void setup();
+static void clear_setup_data();
+static void fail(int, char *, ...);
+
+static kid_t safe_kstat_read(kstat_ctl_t *, kstat_t *, void *);
+
+#define MAX_COLUMNS 80
+
+static int field_width = 0;
+static int ncolumns;
+
+int cflag = 0; /* client stats */
+int rflag = 0; /* rpc stats */
+int zflag = 0; /* zero stats after printing */
+
+static void stat_width(kstat_t *);
+
+static void
+getstats(void)
+{
+
+ if (rpc_clts_client_kstat != NULL) {
+ safe_kstat_read(kc, rpc_clts_client_kstat, NULL);
+ stat_width(rpc_clts_client_kstat);
+ }
+ if (rpc_cots_client_kstat != NULL) {
+ safe_kstat_read(kc, rpc_cots_client_kstat, NULL);
+ stat_width(rpc_cots_client_kstat);
+ }
+}
+
+
+
+static void
+clear_setup_data()
+{
+ /*
+ * Verify and close the kstat control structure
+ */
+ if (kc)
+ kstat_close(kc);
+
+ /*
+ * Set all the related variables to null
+ */
+ kc = (kstat_ctl_t *)NULL;
+ rpc_clts_client_kstat = (kstat_t *)NULL;
+ rpc_cots_client_kstat = (kstat_t *)NULL;
+}
+
+
+static void
+setup()
+{
+ /* Initialize kstat control structures */
+ if ((kc = kstat_open()) == NULL)
+ fail(1, "kstat_open(): can't open /dev/kstat");
+
+ /* Find a kstat by name */
+ rpc_clts_client_kstat = kstat_lookup(kc, "unix", 0, "rpc_clts_client");
+ rpc_cots_client_kstat = kstat_lookup(kc, "unix", 0, "rpc_cots_client");
+}
+
+static void
+stat_width(kstat_t *req)
+{
+ int i, nreq, len;
+ char fixlen[128];
+ kstat_named_t *knp;
+
+ knp = KSTAT_NAMED_PTR(req);
+ nreq = req->ks_ndata;
+
+ for (i = 0; i < nreq; i++) {
+ len = strlen(knp[i].name) + 1;
+ if (field_width < len)
+ field_width = len;
+ (void) sprintf(fixlen, "%lu", knp[i].value.ul);
+ len = strlen(fixlen) + 1;
+ if (field_width < len)
+ field_width = len;
+ }
+}
+
+/*
+ * Get Client RPC data
+ * This function is called by Health Monitoring Module
+ */
+krgetclientrpcdetail(double *calls, int *badcalls, int *retrans, int *badxids, int *timeouts, int *newcreds, int *badverfs, int *timers, int *nomem, int *cantsend)
+{
+ int i, j, nreq;
+ char fixlen[128];
+ char buf[1024];
+ kstat_named_t *knp;
+ cflag++;
+ rflag++;
+
+ buf[0]= '\0';
+
+ setup();
+
+ getstats();
+
+ ncolumns = (MAX_COLUMNS - 1) / field_width;
+
+ /* Kstat lookup client rpc info */
+ if (rpc_clts_client_kstat != NULL) {
+
+ knp = KSTAT_NAMED_PTR(rpc_clts_client_kstat);
+ nreq = rpc_clts_client_kstat->ks_ndata;
+
+ for (i = 0; i < nreq; i += ncolumns) {
+ /* Don't print heading */
+ /*
+ for (j = i; j < MIN(i + ncolumns, nreq); j++) {
+ printf("%-*s", field_width, knp[j].name);
+ }
+ printf("\n");
+ */
+ for (j = i; j < MIN(i + ncolumns, nreq); j++) {
+#if (defined SOLARIS2_5 || defined SOLARIS2_6)
+ (void) sprintf(fixlen, "%lu ", knp[j].value.ul);
+#else
+ (void) sprintf(fixlen, "%llu ", knp[j].value.ui64);
+#endif
+
+ strcat(buf, fixlen);
+ }
+ }
+
+ }
+ *calls = atof(strtok(buf, " "));
+ *badcalls = atoi (strtok(NULL, " "));
+ *retrans = atoi (strtok(NULL, " "));
+ *badxids = atoi (strtok(NULL, " "));
+ *timeouts = atoi (strtok(NULL, " "));
+ *newcreds = atoi (strtok(NULL, " "));
+ *badverfs = atoi (strtok(NULL, " "));
+ *timers = atoi (strtok(NULL, " "));
+ *nomem = atoi (strtok(NULL, " "));
+ *cantsend = atoi (strtok(NULL, " "));
+
+ /*
+ * The following function closes the kstat control structure
+ * and sets the related variables to NULL.
+ */
+ clear_setup_data();
+
+ return (0);
+}
+
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+static void
+fail(int do_perror, char *message, ...)
+{
+ va_list args;
+
+ va_start(args, message);
+ fprintf(stderr, "nfsstat: ");
+ vfprintf(stderr, message, args);
+ va_end(args);
+ if (do_perror)
+ fprintf(stderr, ": %s", strerror(errno));
+ fprintf(stderr, "\n");
+ exit(1);
+}
+
+kid_t
+safe_kstat_read(kstat_ctl_t *kc, kstat_t *ksp, void *data)
+{
+ kid_t kstat_chain_id = kstat_read(kc, ksp, data);
+
+ if (kstat_chain_id == -1)
+ fail(1, "kstat_read(%x, '%s') failed", kc, ksp->ks_name);
+ return (kstat_chain_id);
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/healthMonitor/kr_vmstat.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,339 @@
+/*
+* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+*
+* U.S. Government Rights - Commercial software. Government users are subject
+* to the Sun Microsystems, Inc. standard license agreement and applicable
+* provisions of the FAR and its supplements.
+*
+*
+* This distribution may include materials developed by third parties. Sun,
+* Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+* trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+*
+*/
+
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <memory.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#include <kstat.h>
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/sysinfo.h>
+#include <sys/vfs.h>
+#include <sys/dnlc.h>
+#include <sys/vmmeter.h>
+
+static kstat_ctl_t *kc; /* libkstat cookie */
+static int ncpus;
+static kstat_t **cpu_stat_list = NULL;
+static kstat_t *sysinfo_ksp, *vminfo_ksp, *system_misc_ksp;
+static kstat_named_t *deficit_knp, *lbolt_knp, *clk_intr_knp;
+
+static void fail(int, char *, ...);
+static void safe_zalloc(void **, int, int);
+
+typedef struct {
+ cpu_sysinfo_t cpu_sysinfo;
+ cpu_vminfo_t cpu_vminfo;
+ sysinfo_t sysinfo;
+ vminfo_t vminfo;
+ long deficit;
+} all_stat_t;
+
+static all_stat_t s_new, s_old;
+
+#define denom(x) ((x) ? (x) : 1)
+#define DELTA(x) (s_new.x - s_old.x)
+
+static int hz;
+static int pagesize;
+static int etime;
+
+static void all_stat_init(void);
+static int all_stat_load(void);
+static void safe_kstat_read(kstat_ctl_t *, kstat_t *, void *);
+static kstat_t *safe_kstat_lookup(kstat_ctl_t *, char *, int, char *);
+static void *safe_kstat_data_lookup(kstat_t *, char *);
+
+static int fr_time = 0;
+/* Get CPU Process details from kstats-
+ * Number of processes in runqueue,
+ * waiting and swapqueue
+ */
+int
+krgetprocdetail(int *runque, int *waiting, int *swapque)
+{
+ ulong_t updates;
+
+ if(!fr_time) {
+ /* Initialize a kstat control structure */
+ if ((kc = kstat_open()) == NULL)
+ fail(1, "kstat_open(): can't open /dev/kstat");
+ all_stat_init();
+ fr_time = 1;
+ }
+
+ /* update the kstat header chain or load all_stat structure */
+ while (kstat_chain_update(kc) || all_stat_load()) {
+ all_stat_init();
+ }
+
+ updates = denom(DELTA(sysinfo.updates));
+
+#define ADJ(n) ((adj <= 0) ? n : (adj >= n) ? 1 : n - adj)
+#define adjprintf(fmt, n, val) adj -= (n + 1) - printf(fmt, ADJ(n), val)
+
+ *runque = DELTA(sysinfo.runque) / updates;
+ *waiting = DELTA(sysinfo.waiting) / updates;
+ *swapque = DELTA(sysinfo.swpque) / updates;
+
+ /*
+ * Close the kstat control structure and set it to null.
+ */
+/* kstat_close(kc);
+ kc = (kstat_ctl_t *)NULL;*/
+
+ return(0);
+
+}
+
+/* Get RAm details from kstats */
+int
+krgetramdetail(int *handspread, int *scan)
+{
+ int i;
+ int pages, handspreadpages;
+
+ pagesize = sysconf(_SC_PAGESIZE);
+ hz = sysconf(_SC_CLK_TCK);
+
+ /* default max handspread is 64MB worth of pages */
+ handspreadpages = (64 * 1048576)/sysconf(_SC_PAGESIZE);
+ pages = sysconf(_SC_PHYS_PAGES);
+
+ if(!fr_time) {
+ if ((kc = kstat_open()) == NULL) {
+ fail(1, "kstat_open(): can't open /dev/kstat");
+ }
+
+ /* Initialize the all_stat structure */
+ all_stat_init();
+ fr_time = 1;
+ }
+
+ if (handspreadpages > (pages/4)) {
+ handspreadpages = (int)(pages/4);
+
+ /* update the kstat header chain or load all_stat structure */
+ while (kstat_chain_update(kc) || all_stat_load())
+ /* (void) printf("<<State change>>\n"); */
+ all_stat_init();
+ }
+
+ etime = 0;
+ for (i = 0; i < CPU_STATES; i++)
+ etime += DELTA(cpu_sysinfo.cpu[i]);
+
+ etime = denom(((etime / ncpus) + (hz >> 1)) / hz);
+
+ *handspread = handspreadpages;
+ *scan = DELTA(cpu_vminfo.scan) / etime;
+
+ /*
+ * Close the kstat control structure and set it to null.
+ */
+/* kstat_close(kc);
+ kc = (kstat_ctl_t *)NULL;
+*/
+ return(0);
+}
+
+/* Get ncstat data */
+int
+krgetncstatdetail(unsigned long *hits, unsigned long *misses)
+{
+ struct ncstats ncstats;
+
+ if(!fr_time) {
+ /* Initialize the all_stat structure */
+ if ((kc = kstat_open()) == NULL) {
+ fail(1, "kstat_open(): can't open /dev/kstat");
+ }
+
+ /* Initialize the all_stat structure */
+ all_stat_init();
+ fr_time =1 ;
+ }
+
+ if (all_stat_load() != 0)
+ fail(1, "all_stat_load() failed");
+
+ safe_kstat_read(kc, safe_kstat_lookup(kc, "unix", 0, "ncstats"), (void *) &ncstats);
+
+ *hits = (unsigned long)ncstats.hits;
+ *misses = (unsigned long)ncstats.misses;
+
+ /*
+ * Close the kstat control structure and set it to null.
+ */
+/* kstat_close(kc);
+ kc = (kstat_ctl_t *)NULL;
+*/
+ return(0);
+}
+
+/* Initialize the all_stat structure */
+static void
+all_stat_init(void)
+{
+ kstat_t *ksp;
+
+ /*
+ * Global statistics
+ */
+
+ sysinfo_ksp = safe_kstat_lookup(kc, "unix", 0, "sysinfo");
+ vminfo_ksp = safe_kstat_lookup(kc, "unix", 0, "vminfo");
+ system_misc_ksp = safe_kstat_lookup(kc, "unix", 0, "system_misc");
+
+ safe_kstat_read(kc, system_misc_ksp, NULL);
+ deficit_knp = safe_kstat_data_lookup(system_misc_ksp, "deficit");
+ lbolt_knp = safe_kstat_data_lookup(system_misc_ksp, "lbolt");
+ clk_intr_knp = safe_kstat_data_lookup(system_misc_ksp, "clk_intr");
+
+ /*
+ * Per-CPU statistics
+ */
+
+ ncpus = 0;
+ for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next)
+ if (strncmp(ksp->ks_name, "cpu_stat", 8) == 0)
+ ncpus++;
+
+ safe_zalloc((void **) &cpu_stat_list, ncpus * sizeof (kstat_t *), 1);
+
+ ncpus = 0;
+ for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next)
+ if (strncmp(ksp->ks_name, "cpu_stat", 8) == 0 &&
+ kstat_read(kc, ksp, NULL) != -1)
+ cpu_stat_list[ncpus++] = ksp;
+
+ if (ncpus == 0)
+ fail(0, "can't find any cpu statistics");
+
+ (void) memset(&s_new, 0, sizeof (all_stat_t));
+}
+
+/*
+ * load statistics, summing across CPUs where needed
+ */
+
+static int
+all_stat_load(void)
+{
+ int i, j;
+ cpu_stat_t cs;
+ uint *np, *tp;
+
+ s_old = s_new;
+ (void) memset(&s_new, 0, sizeof (all_stat_t));
+
+ /*
+ * Global statistics
+ */
+
+ safe_kstat_read(kc, sysinfo_ksp, (void *) &s_new.sysinfo);
+ safe_kstat_read(kc, vminfo_ksp, (void *) &s_new.vminfo);
+ safe_kstat_read(kc, system_misc_ksp, NULL);
+ s_new.deficit = deficit_knp->value.l;
+
+ /*
+ * Per-CPU statistics.
+ * For now, we just sum across all CPUs. In the future,
+ * we should add options to vmstat for per-CPU data.
+ */
+
+ for (i = 0; i < ncpus; i++) {
+ if (kstat_read(kc, cpu_stat_list[i], (void *) &cs) == -1)
+ return (1);
+ np = (uint *) &s_new.cpu_sysinfo;
+ tp = (uint *) &cs.cpu_sysinfo;
+ for (j = 0; j < sizeof (cpu_sysinfo_t); j += sizeof (uint_t))
+ *np++ += *tp++;
+ np = (uint *) &s_new.cpu_vminfo;
+ tp = (uint *) &cs.cpu_vminfo;
+ for (j = 0; j < sizeof (cpu_vminfo_t); j += sizeof (uint_t))
+ *np++ += *tp++;
+ }
+ return (0);
+}
+
+static void
+fail(int do_perror, char *message, ...)
+{
+ va_list args;
+ int save_errno = errno;
+
+ va_start(args, message);
+ (void) vfprintf(stderr, message, args);
+ va_end(args);
+ if (do_perror)
+ (void) fprintf(stderr, ": %s", strerror(save_errno));
+ (void) fprintf(stderr, "\n");
+ exit(2);
+}
+
+static void
+safe_zalloc(void **ptr, int size, int free_first)
+{
+ if (free_first && *ptr != NULL)
+ free(*ptr);
+ if ((*ptr = (void *) malloc(size)) == NULL)
+ fail(1, "malloc failed");
+ (void) memset(*ptr, 0, size);
+}
+
+
+void
+safe_kstat_read(kstat_ctl_t *kc, kstat_t *ksp, void *data)
+{
+ kid_t kstat_chain_id = kstat_read(kc, ksp, data);
+
+ if (kstat_chain_id == -1)
+ fail(1, "kstat_read(%x, '%s') failed", kc, ksp->ks_name);
+}
+
+kstat_t *
+safe_kstat_lookup(kstat_ctl_t *kc, char *ks_module, int ks_instance,
+ char *ks_name)
+{
+ kstat_t *ksp = kstat_lookup(kc, ks_module, ks_instance, ks_name);
+
+ if (ksp == NULL)
+ fail(0, "kstat_lookup('%s', %d, '%s') failed",
+ ks_module == NULL ? "" : ks_module,
+ ks_instance,
+ ks_name == NULL ? "" : ks_name);
+ return (ksp);
+}
+
+void *
+safe_kstat_data_lookup(kstat_t *ksp, char *name)
+{
+ void *fp = kstat_data_lookup(ksp, name);
+
+ if (fp == NULL)
+ fail(0, "kstat_data_lookup('%s', '%s') failed",
+ ksp->ks_name, name);
+ return (fp);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/seaExtensions/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,64 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate libseaExtensions.so
+#
+# usage:
+# "make" : generate library for 64bit / sparc
+# "make ARCH=32" : generate library for 32bit / sparc
+# "make ARCH=32 MACH=x86" : generate library for 32bit / x86
+# "make ARCH=amd64" : generate 64bit AMD64 libraries
+# "make clean" : remove *.o , *.so
+#
+
+
+MARCH=$(ARCH)
+LDFLAGS_sparcv9=-m64 -I$(ROOT)$(CFGPREFIX)/include -I.
+LDFLAGS_32=-I$(ROOT)$(CFGPREFIX)/include -I.
+LDFLAGS_amd64=-Kpic -m64 -I$(ROOT)$(CFGPREFIX)/include -I.
+LDFLAGS=$(LDFLAGS_$(MARCH))
+
+CFLAGS_32=-Kpic
+CFLAGS_sparcv9=-Kpic
+CFLAGS_amd64=-Kpic
+CFLAGS=$(CFLAGS_$(MARCH))
+
+LDLIBS_sparcv9= -L/usr/lib/sparcv9 -lrpcsvc
+LDLIBS_32= -lrpcsvc
+LDLIBS_amd64 = -L/usr/lib/amd64 -lrpcsvc
+LDLIBS=$(LDLIBS_$(MARCH))
+
+
+PROG= libseaExtensions.so
+SRCS= sunHostPerf.c sunProcesses.c sunSystem.c seaExtensions.c
+OBJS = $(SRCS:.c=.o)
+
+all:$(PROG)
+$(PROG): $(OBJS)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -G -o $@ $(OBJS)
+.c.o:
+ $(CC) $(CFLAGS) $(LDFLAGS) -g -o $@ -c $<
+
+clean:
+ rm -f *.o *.so
+
+install:
+ if test "$(ARCH)" = "sparcv9" ; then \
+ cp $(PROG) $(ROOT)/$(CFGLIB64); \
+ elif test "$(ARCH)" = "32" ; then \
+ cp $(PROG) $(ROOT)/$(CFGLIB); \
+ elif test "$(ARCH)" = "amd64" ; then \
+ cp $(PROG) $(ROOT)/$(CFGLIB64); \
+ fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/seaExtensions/agent.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+#if !defined(lint) && !defined(NOID)
+#pragma ident "@(#)agent.h 2.26 00/05/01 SMI"
+#endif
+
+/****************************************************************************
+ * Copyright (c) 1989, 1990 Epilogue Technology Corporation
+ * All rights reserved.
+ *
+ * This is unpublished proprietary source code of Epilogue Technology
+ * Corporation.
+ *
+ * The copyright notice above does not evidence any actual or intended
+ * publication of such source code.
+ ****************************************************************************/
+
+/* $Header $ */
+
+/*
+ * $Log $
+ *
+*/
+
+#if (!defined(agent_inc))
+#define agent_inc
+
+#define AGENT_UDP_PORT 161
+
+#define CONFIG_FILE "/etc/snmp/conf/snmpd.conf"
+#define MAX_CONFIG_FILE 128
+extern char config_file[];
+
+#if 0
+/* Say how many minutes the agent can go without a packet before */
+/* killing itself. Zero means forever. */
+extern int refresh_minutes;
+#endif /* 0 */
+
+extern int trace_level;
+extern int read_only; /* Set != 0 if writes are to be blocked */
+extern int sun_os_ver; /* Set to 40, 41, ??? */
+extern FILE * diagfh;
+
+extern time_t cache_now; /* Time of each query. */
+
+#define PERROR(M) perror(M);
+#define PRNTF0(M) {printf(M);fflush(stdout);}
+#define PRNTF1(M,A) {printf(M,A);fflush(stdout);}
+#define PRNTF2(M,A,B) {printf(M,A,B);fflush(stdout);}
+#define TRC_PRT0(L,M) {if(trace_level>(L)){fprintf(diagfh,M);fflush(diagfh);}}
+#define TRC_PRT1(L,M,A) {if(trace_level>(L)){fprintf(diagfh,M,A);fflush(diagfh);}}
+#define TRC_PRT2(L,M,A,B) {if(trace_level>(L)){fprintf(diagfh,M,A,B);fflush(diagfh);}}
+#define SYSLOG0(M) syslog(LOG_ERR, M)
+#define SYSLOG1(M,A) syslog(LOG_ERR, M, A)
+#define SYSLOG2(M,A,B) syslog(LOG_ERR, M, A, B)
+
+#if defined(__STDC__)
+extern int agent_init(int, char *);
+extern void agent_body(int, char *);
+#else /* __STDC__ */
+extern int agent_init();
+extern void agent_body();
+#endif /* __STDC__ */
+
+#endif /* defined(agent_inc) */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/seaExtensions/asn1.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+#if !defined(lint) && !defined(NOID)
+#pragma ident "@(#)asn1.h 2.17 00/07/17 SMI"
+#endif
+
+/*
+** Sun considers its source code as an unpublished, proprietary trade
+** secret, and it is available only under strict license provisions.
+** This copyright notice is placed here only to protect Sun in the event
+** the source is deemed a published work. Disassembly, decompilation,
+** or other means of reducing the object code to human readable form is
+** prohibited by the license agreement under which this code is provided
+** to the user or company in possession of this copy.
+**
+** RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the
+** Government is subject to restrictions as set forth in subparagraph
+** (c)(1)(ii) of the Rights in Technical Data and Computer Software
+** clause at DFARS 52.227-7013 and in similar clauses in the FAR and
+** NASA FAR Supplement.
+*/
+/****************************************************************************
+ * Copyright (c) 1986, 1988 Epilogue Technology Corporation
+ * All rights reserved.
+ *
+ * This is unpublished proprietary source code of Epilogue Technology
+ * Corporation.
+ *
+ * The copyright notice above does not evidence any actual or intended
+ * publication of such source code.
+ ****************************************************************************/
+
+/* $Header: /net/bigblock.east/files5/SMA_CVS/sun/agent/modules/seaExtensions/asn1.h,v 1.3 2003/08/12 21:14:53 rr144420 Exp $ */
+/*
+ * $Log: asn1.h,v $
+ * Revision 1.3 2003/08/12 21:14:53 rr144420
+ * 4895376 - correct Sun copyright statements. Cannot use (c), and must use Copyright Copyright in makefiles
+ *
+ * Revision 1.2 2003/08/08 15:39:52 pcarroll
+ * 4895376 - The copyright statement in the demo* codes do not look right
+ *
+ * Revision 1.1 2003/07/28 17:59:15 dporter
+ * 4892877 - Need SMA Agent to implement sun extensions found in SEA sun.mib
+ *
+ *
+ * Rev 2.0 31 Mar 1990 15:11:26
+ * Release 2.00
+ *
+ * Rev 1.1 14 Dec 1989 16:01:16
+ * Added support for Borland Turbo C compiler
+ *
+ * Rev 1.0 12 Sep 1988 10:46:12
+ * Initial revision.
+*/
+
+#if (!defined(asn1_inc))
+#define asn1_inc
+
+/**********************************************************************
+ If necessary adjust the following to match the compiler being used.
+ **********************************************************************/
+typedef long INT_32_T;
+typedef unsigned long UINT_32_T;
+typedef short int INT_16_T;
+typedef unsigned short UINT_16_T;
+typedef unsigned char UINT_8_T;
+typedef unsigned char OCTET_T ;
+ /* SNMP ASN.1 tags and lengths can always fit into 16 bits... */
+typedef unsigned short ATVALUE_T; /* ASN.1 type values */
+typedef unsigned short ALENGTH_T; /* ASN.1 contents field lengths */
+#define OCTETS_PER_INT32 (sizeof(INT_32_T)/sizeof(OCTET_T))
+#define OCTETS_PER_INT16 (sizeof(INT_16_T)/sizeof(OCTET_T))
+
+/* Allow the components of an object identifer to be either 16 or 32-bits */
+/* 16-bit is default, define OIDC_32 to switch to 32-bits. */
+#if defined(OIDC_32)
+typedef unsigned long OIDC_T;
+#else
+typedef unsigned short OIDC_T;
+#endif /* OIDC_32 */
+
+/* ASN.1 FLAGS (form and class), adjusted for position within an octet */
+#define A_IDCF_MASK 0xE0 /* Mask for ID CLASS and FORM bits */
+#define A_IDC_MASK 0xC0 /* Mask for ID CLASS bits */
+#define A_IDF_MASK 0x20 /* Mask for ID FORM bit */
+#define A_FLAG_MASK 0xE0
+#define A_UNIVERSAL 0x00
+#define A_APPLICATION 0x40
+#define A_CONTEXT 0x80
+#define A_PRIVATE 0xC0
+#define A_PRIMITIVE 0x00
+#define A_CONSTRUCTOR 0x20
+
+#define A_DEFAULT_SCOPE A_CONTEXT
+
+/* ASN.1 basic types, all in UNIVERSAL scope */
+#define A_NO_ID 0x00
+#define A_BOOLEAN 0x01
+#define A_INTEGER 0x02
+#define A_BITSTRING 0x03
+#define A_OCTETSTRING 0x04
+#define A_NULL 0x05
+#define A_OBJECTID 0x06
+#define A_SEQUENCE 0x10
+#define A_SET 0x11
+
+/* ASN.1 defined types, all based on OCTETSTRING */
+#define A_NUMERICSTRING 0x12
+#define A_PRINTABLESTRING 0x13
+#define A_T61STRING 0x14
+#define A_TELETEXSTRING A_T61STRING
+#define A_VIDEOTEXSTRING 0x15
+#define A_IA5STRING 0x16
+#define A_GRAPHICSTRING 0x19
+#define A_VISIBLESTRING 0x1A
+#define A_GENERALSTRING 0x1B
+
+/* Other ASN.1 defined universal types */
+#define A_GENERALIZEDTIME 0x18
+#define A_UTCTIME 0x17
+#define A_OBJECTDESCRIPTOR 0x07
+
+/****************************************************************************
+
+NAME: A_SizeOfLength
+
+PURPOSE: Compute the number of octets needed to hold an ASN.1 length field.
+
+PARAMETERS:
+ ALENGTH_T The proposed length
+
+RETURNS: ALENGTH_T The number of octets needed
+
+RESTRICTIONS:
+
+BUGS:
+****************************************************************************/
+#define A_SizeOfLength(S) ((ALENGTH_T)((S) <= 127 ? 1 : ((S) <= 255 ? 2 : 3)))
+
+/****************************************************************************
+
+NAME: A_SizeOfType
+
+PURPOSE: Compute the number of octets needed to hold an ASN.1 type field
+
+PARAMETERS:
+ ATVALUE_T The proposed type (without CLASS & FORM bits)
+
+RETURNS: unsigned int The number of octets needed
+
+RESTRICTIONS:
+
+BUGS:
+****************************************************************************/
+#define A_SizeOfType(V) ((unsigned int) ((V) <= 30 ? 1 : \
+ ((V) <= 127 ? 2 : ((V) <= 16383 ? 3 : 4))))
+
+
+/****************************************************************************
+A_SizeOfOctetString -- Return total size that an octet string would
+ occupy when ASN.1 encoded (tag and length fields
+ are NOT included)
+
+Parameters:
+ ALENGTH_T The size of the string
+
+Returns: ALENGTH_T Number of octets the octet string would occupy if
+ in ASN.1 encoding, NOT including the type/length fields
+ of the outermost wrapper. Since these routines only
+ generate non-constructor encodings, the length is
+ exactly that given.
+****************************************************************************/
+#define A_SizeOfOctetString(L) ((ALENGTH_T)(L))
+
+
+/****************************************************************************
+OBJECT IDENTIFIER
+****************************************************************************/
+
+/* The following structure is used to internally hold an object identifier */
+/* Each component is limited in range from 0 to 64K-1. */
+
+typedef struct OBJ_ID_S
+ {
+ int num_components; /* # of object id components */
+ /* Note: this is the number of */
+ /* components in the object id, */
+ /* which is one more than the # */
+ /* of subidentifiers in an */
+ /* encoded object id. */
+ OIDC_T *component_list;
+ } OBJ_ID_T;
+
+#endif /* asn1_inc */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/seaExtensions/seaExtensions.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.5 2002/12/16 22:50:18 hardaker Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "sunHostPerf.h"
+#include "sunProcesses.h"
+#include "sunSystem.h"
+#include "seaExtensions.h"
+
+void
+init_seaExtensions(void)
+{
+ init_sunHostPerf();
+ init_sunProcesses();
+ init_sunSystem();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/seaExtensions/seaExtensions.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+#ifndef SEAEXTENSIONS_H
+#define SEAEXTENSIONS_H
+
+/* function declarations */
+void init_seaExtensions(void);
+
+#endif /* SEAEXTENSIONS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/seaExtensions/snmpvars.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+#if !defined(lint) && !defined(NOID)
+#pragma ident "@(#)snmpvars.h 2.19 01/07/06 SMI"
+#endif
+
+/****************************************************************************
+ * Copyright (c) 1988 Epilogue Technology Corporation
+ * All rights reserved.
+ *
+ * This is unpublished proprietary source code of Epilogue Technology
+ * Corporation.
+ *
+ * The copyright notice above does not evidence any actual or intended
+ * publication of such source code.
+ ****************************************************************************/
+
+/* $Header: /net/bigblock.east/files5/SMA_CVS/sun/agent/modules/seaExtensions/snmpvars.h,v 1.3 2003/08/12 21:14:54 rr144420 Exp $ */
+/*
+ * $Log: snmpvars.h,v $
+ * Revision 1.3 2003/08/12 21:14:54 rr144420
+ * 4895376 - correct Sun copyright statements. Cannot use (c), and must use Copyright Copyright in makefiles
+ *
+ * Revision 1.2 2003/08/08 15:39:54 pcarroll
+ * 4895376 - The copyright statement in the demo* codes do not look right
+ *
+ * Revision 1.1 2003/07/28 17:59:23 dporter
+ * 4892877 - Need SMA Agent to implement sun extensions found in SEA sun.mib
+ *
+ *
+ * Rev 2.0 31 Mar 1990 15:34:28
+ * Initial revision.
+ *
+ * Rev 1.1 26 Aug 1989 16:50:34
+ * Moved ipForwarding into the ip_stats structure.
+ *
+ * Rev 1.0 14 Nov 1988 10:27:16
+ * Initial revision.
+*/
+
+#if (!defined(snmpvars_inc))
+#define snmpvars_inc
+
+#if (!defined(asn1_inc))
+#include <asn1.h>
+#endif
+
+/**********************************************************************
+ *
+ * Define the various SNMP management variables used in this system.
+ *
+ * This file should closely match snmpvars.c
+ *
+ **********************************************************************/
+
+#define SNMP_COMM_MAX 32
+#define MAX_SYSDESCR 256
+#define MAX_SYSCONTACT 256
+#define MAX_SYSNAME 256
+#define MAX_SYSLOCATION 256
+#define MAX_SYSNAME 256
+#define MAX_KERN_FILE 256
+#define MAX_NEW_DEVICE 10
+
+/* If you change the following definition, you also need to */
+/* change the sscanf format in setup.c accordingly. */
+#define MAX_HOST_NAME_SZ 64
+
+/* If you redefine MAX_TRAPS_TO the scanf in read_con.c needs to */
+/* be changed accordingly. */
+#define MAX_TRAPS_TO 5
+extern int trap_2_cnt; /* How many entries follow */
+extern u_long traplist[MAX_TRAPS_TO]; /* IP addresses where to send traps */
+
+/* If you redefine MAX_MGR_SCANF the scanf in read_con.c needs to */
+/* be changed accordingly. */
+#define MAX_MGR_SCANF 5
+#define MAX_MGR 32
+extern int mgr_cnt; /* How many entries follow */
+extern u_long mgr_list[MAX_MGR]; /* IP addresses for valid managers */
+
+#if 0
+extern int if_number; /* ifNumber */
+#endif
+
+extern char snmp_sysgrp_read_community[];
+extern char snmp_sysgrp_write_community[];
+extern char snmp_fullmib_read_community[];
+extern char snmp_fullmib_write_community[];
+extern char snmp_trap_community[];
+extern char snmp_auth_traps;
+extern OIDC_T snmp_product_id[];
+extern int snmp_product_id_count;
+extern OBJ_ID_T snmp_sysObjectID;
+extern unsigned char snmp_local_ip_address[];
+extern char snmp_sysDescr[];
+extern char snmp_sysContact[];
+extern char snmp_sysName[];
+extern char snmp_sysLocation[];
+extern struct timeval boot_at;
+extern char kernel_file[];
+extern int trap_sd;
+extern int cache_lifetime;
+extern int snmp_socket; /* Socket used to send traps and */
+ /* send/receive SNMP queries, */
+ /* usually UDP port 161 */
+
+struct new_devicess {
+ char name[32];
+ int type;
+ long speed;
+} new_devices[MAX_NEW_DEVICE];
+
+int new_device_pointer;
+
+#endif /* snmpvars_inc */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/seaExtensions/sunHostPerf.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,836 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <rpcsvc/rstat.h>
+
+#include "sunHostPerf.h"
+
+int hp_cache_lifetime = 45;
+time_t rs_cache_time = 0;
+time_t hp_cache_now = 0;
+static struct statstime sts;
+static char hostName[10];
+
+void
+get_rstats()
+{
+ (void) time(&hp_cache_now);
+
+ if ((hp_cache_now - rs_cache_time) <= hp_cache_lifetime)
+ return;
+
+ rs_cache_time = hp_cache_now;
+
+ (void) rstat(hostName, &sts);
+}
+
+/* Initializes the sunHostPerf module */
+void
+init_sunHostPerf(void)
+{
+ static oid rsNiceModeTime_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 2, 0 };
+ static oid rsIdleModeTime_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 4, 0 };
+ static oid rsVSwapIn_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 11, 0 };
+ static oid rsDiskXfer1_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 5, 0 };
+ static oid rsDiskXfer2_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 6, 0 };
+ static oid rsIfInErrors_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 16, 0 };
+ static oid rsDiskXfer3_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 7, 0 };
+ static oid rsVSwapOut_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 12, 0 };
+ static oid rsVPagesOut_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 10, 0 };
+ static oid rsDiskXfer4_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 8, 0 };
+ static oid rsSystemProcessTime_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 3, 0 };
+ static oid rsIfInPackets_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 14, 0 };
+ static oid rsVPagesIn_oid[] = { 1, 3, 6, 1, 4, 1, 42, 3, 13, 9, 0 };
+ static oid rsIfOutErrors_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 17, 0 };
+ static oid rsUserProcessTime_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 1, 0 };
+ static oid rsIfOutPackets_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 15, 0 };
+ static oid rsVIntr_oid[] = { 1, 3, 6, 1, 4, 1, 42, 3, 13, 13, 0 };
+ static oid rsIfCollisions_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 3, 13, 18, 0 };
+
+ DEBUGMSGTL(("sunHostPerf", "Initializing\n"));
+
+ /* Initialize host, current time */
+ strcpy(hostName, "localhost");
+ (void) time(&hp_cache_now);
+
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsNiceModeTime",
+ get_rsNiceModeTime,
+ rsNiceModeTime_oid,
+ OID_LENGTH(rsNiceModeTime_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsIdleModeTime",
+ get_rsIdleModeTime,
+ rsIdleModeTime_oid,
+ OID_LENGTH(rsIdleModeTime_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsVSwapIn",
+ get_rsVSwapIn,
+ rsVSwapIn_oid,
+ OID_LENGTH(rsVSwapIn_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsDiskXfer1",
+ get_rsDiskXfer1,
+ rsDiskXfer1_oid,
+ OID_LENGTH(rsDiskXfer1_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsDiskXfer2",
+ get_rsDiskXfer2,
+ rsDiskXfer2_oid,
+ OID_LENGTH(rsDiskXfer2_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsIfInErrors",
+ get_rsIfInErrors,
+ rsIfInErrors_oid,
+ OID_LENGTH(rsIfInErrors_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsDiskXfer3",
+ get_rsDiskXfer3,
+ rsDiskXfer3_oid,
+ OID_LENGTH(rsDiskXfer3_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsVSwapOut",
+ get_rsVSwapOut,
+ rsVSwapOut_oid,
+ OID_LENGTH(rsVSwapOut_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsVPagesOut",
+ get_rsVPagesOut,
+ rsVPagesOut_oid,
+ OID_LENGTH(rsVPagesOut_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsDiskXfer4",
+ get_rsDiskXfer4,
+ rsDiskXfer4_oid,
+ OID_LENGTH(rsDiskXfer4_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsSystemProcessTime",
+ get_rsSystemProcessTime,
+ rsSystemProcessTime_oid,
+ OID_LENGTH(rsSystemProcessTime_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsIfInPackets",
+ get_rsIfInPackets,
+ rsIfInPackets_oid,
+ OID_LENGTH(rsIfInPackets_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsVPagesIn",
+ get_rsVPagesIn,
+ rsVPagesIn_oid,
+ OID_LENGTH(rsVPagesIn_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsIfOutErrors",
+ get_rsIfOutErrors,
+ rsIfOutErrors_oid,
+ OID_LENGTH(rsIfOutErrors_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsUserProcessTime",
+ get_rsUserProcessTime,
+ rsUserProcessTime_oid,
+ OID_LENGTH(rsUserProcessTime_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsIfOutPackets",
+ get_rsIfOutPackets,
+ rsIfOutPackets_oid,
+ OID_LENGTH(rsIfOutPackets_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsVIntr",
+ get_rsVIntr,
+ rsVIntr_oid,
+ OID_LENGTH(rsVIntr_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("rsIfCollisions",
+ get_rsIfCollisions,
+ rsIfCollisions_oid,
+ OID_LENGTH(rsIfCollisions_oid),
+ HANDLER_CAN_RONLY));
+}
+
+int
+get_rsNiceModeTime(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long cp_time;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ cp_time = (long)sts.cp_time[RSTAT_CPU_NICE];
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &cp_time, sizeof (cp_time));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsIdleModeTime(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long cp_time;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ cp_time = (long)sts.cp_time[RSTAT_CPU_IDLE];
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &cp_time, sizeof (cp_time));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsVSwapIn(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ u_long v_pswpin;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ v_pswpin = (u_long)sts.v_pswpin;
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &v_pswpin, sizeof (v_pswpin));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsDiskXfer1(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long dk_xfer;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ dk_xfer = (long)sts.dk_xfer[0];
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &dk_xfer, sizeof (dk_xfer));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsDiskXfer2(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long dk_xfer;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ dk_xfer = sts.dk_xfer[1];
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &dk_xfer, sizeof (dk_xfer));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsIfInErrors(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long if_ierrors;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ if_ierrors = (long)sts.if_ierrors;
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &if_ierrors, sizeof (if_ierrors));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsDiskXfer3(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long dk_xfer;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ dk_xfer = (long)sts.dk_xfer[2];
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &dk_xfer, sizeof (dk_xfer));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsVSwapOut(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ u_long v_pswpout;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ v_pswpout = (u_long)sts.v_pswpout;
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &v_pswpout, sizeof (v_pswpout));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsVPagesOut(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ u_long v_pgpgout;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ v_pgpgout = (u_long)sts.v_pgpgout;
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &v_pgpgout, sizeof (v_pgpgout));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsDiskXfer4(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long dk_xfer;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ dk_xfer = (long)sts.dk_xfer[3];
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &dk_xfer, sizeof (dk_xfer));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsSystemProcessTime(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long cp_time;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ cp_time = (long)sts.cp_time[RSTAT_CPU_SYS];
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &cp_time, sizeof (cp_time));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsIfInPackets(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long if_ipackets;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ if_ipackets = (long)sts.if_ipackets;
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &if_ipackets, sizeof (if_ipackets));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsVPagesIn(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ u_long v_pgpgin;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ v_pgpgin = (u_long)sts.v_pgpgin;
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &v_pgpgin, sizeof (v_pgpgin));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsIfOutErrors(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long if_oerrors;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ if_oerrors = (long)sts.if_oerrors;
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &if_oerrors, sizeof (if_oerrors));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsUserProcessTime(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long cp_time;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ cp_time = sts.cp_time[RSTAT_CPU_USER];
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &cp_time, sizeof (cp_time));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsIfOutPackets(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long if_opackets;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ if_opackets = (long)sts.if_opackets;
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &if_opackets, sizeof (if_opackets));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsVIntr(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ u_long v_intr;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ v_intr = (u_long)sts.v_intr;
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &v_intr, sizeof (v_intr));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_rsIfCollisions(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long if_collisions;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ get_rstats();
+ if_collisions = (long)sts.if_collisions;
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &if_collisions,
+ sizeof (if_collisions));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/seaExtensions/sunHostPerf.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+#ifndef SUNHOSTPERF_H
+#define SUNHOSTPERF_H
+
+/* function declarations */
+void init_sunHostPerf(void);
+Netsnmp_Node_Handler get_rsNiceModeTime;
+Netsnmp_Node_Handler get_rsIdleModeTime;
+Netsnmp_Node_Handler get_rsVSwapIn;
+Netsnmp_Node_Handler get_rsDiskXfer1;
+Netsnmp_Node_Handler get_rsDiskXfer2;
+Netsnmp_Node_Handler get_rsIfInErrors;
+Netsnmp_Node_Handler get_rsDiskXfer3;
+Netsnmp_Node_Handler get_rsVSwapOut;
+Netsnmp_Node_Handler get_rsVPagesOut;
+Netsnmp_Node_Handler get_rsDiskXfer4;
+Netsnmp_Node_Handler get_rsSystemProcessTime;
+Netsnmp_Node_Handler get_rsIfInPackets;
+Netsnmp_Node_Handler get_rsVPagesIn;
+Netsnmp_Node_Handler get_rsIfOutErrors;
+Netsnmp_Node_Handler get_rsUserProcessTime;
+Netsnmp_Node_Handler get_rsIfOutPackets;
+Netsnmp_Node_Handler get_rsVIntr;
+Netsnmp_Node_Handler get_rsIfCollisions;
+
+#endif /* SUNHOSTPERF_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/seaExtensions/sunProcesses.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,961 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.5 2002/12/16 22:50:18 hardaker Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "sunProcesses.h"
+
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/procfs.h>
+#include <sys/fcntl.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/mntent.h>
+#include <sys/mnttab.h>
+#include <ftw.h>
+#include <stdlib.h>
+#include <dirent.h>
+#include <string.h>
+#include <memory.h>
+#include <pwd.h>
+#include <syslog.h>
+
+#include "snmpvars.h"
+#include "agent.h"
+#include "asn1.h"
+
+/* The following code is borrowed from ps.c */
+#define NUID 64
+#define TRUE 1
+#define FALSE 0
+
+#define NTTYS 20 /* max ttys that can be specified with the -t option */
+#define SIZ 30 /* max processes that can be specified with -p and -g */
+#define ARGSIZ 30 /* size of buffer holding args for -t, -p, -u options */
+
+#define FSTYPE_MAX 8
+
+#ifndef MAXLOGIN
+#define MAXLOGIN 8 /* max number of chars in login that will be printed */
+#endif
+
+#define UDQ 50
+
+
+static struct prpsinfo info; /* process information structure from /proc */
+
+char *ttyname();
+static char *psfile = "/tmp/mibiisa_ps_data";
+
+
+static int ndev; /* number of devices */
+static int maxdev; /* number of devl structures allocated */
+
+#define DNSIZE 14
+static struct devl { /* device list */
+ char dname[DNSIZE]; /* device name */
+ dev_t dev; /* device number */
+} *devl = NULL;
+
+static char *procdir = "/proc"; /* standard /proc directory */
+static int rd_only = 0; /* flag for remote filesystem read-only */
+void usage(); /* print usage message and quit */
+
+static time_t ps_cache_time = 0;
+time_t cache_now = 0;
+int cache_lifetime = 45;
+
+static void call_ftw_for_dev(void);
+static void wrdata();
+static void write_tmp_file();
+static int isprocdir();
+static void get_ps_data(void);
+static void clean_ps(ps_ldata_t *);
+static char *get_usr_name(uid_t);
+static ps_data_t *find_ps_data(pid_t pid);
+static void pr_ps(void);
+
+ps_data_t *pstable = PS_NULL;
+int pstable_lines = 0; /* # of items in memory block pointed */
+ /* to by pstable. */
+
+static void
+clean_ps(ps_ldata_t *head)
+{
+ if (head != PS_LNULL) {
+ ps_ldata_t *pdp;
+ ps_ldata_t *nxt;
+ for (pdp = head; pdp != PS_LNULL; pdp = nxt) {
+ nxt = pdp->link;
+ free(pdp);
+ }
+ }
+}
+
+static int
+pscomp(ps_data_t *i, ps_data_t *j)
+{
+ return (i->pid - j->pid);
+}
+
+static struct ncache {
+ uid_t uid;
+ char name[USRNM_SZ+1];
+} nc[NUID];
+
+/*
+ * This function assumes that the password file is hashed
+ * (or some such) to allow fast access based on a uid key.
+ */
+static char *
+get_usr_name(uid_t uid)
+{
+ struct passwd *pw;
+ int cp;
+
+#if (((NUID) & ((NUID) - 1)) != 0)
+cp = uid % (NUID);
+#else
+cp = uid & ((NUID) - 1);
+#endif
+ if (uid >= 0 && nc[cp].uid == uid && nc[cp].name[0])
+ return (nc[cp].name);
+ pw = getpwuid(uid);
+ if (!pw)
+ return ((char *)0);
+ nc[cp].uid = uid;
+ strncpy(nc[cp].name, pw->pw_name, USRNM_SZ);
+
+ return (nc[cp].name);
+}
+
+void
+pr_ps(void)
+{
+ ps_data_t *psp;
+ int lines;
+
+ printf("%d entries\n", pstable_lines);
+ printf("UID PID PPID SZ USR WCHAN TTY CPU CMD \n\n");
+
+ for (psp = pstable, lines = 0; lines < pstable_lines; psp++, lines++) {
+ printf("%d %u %u %d %s %s %s %d %s\n",
+ psp->uid,
+ psp->pid,
+ psp->ppid,
+ psp->sz,
+ psp->usrname,
+ psp->wchan,
+ psp->tty,
+ psp->cpu,
+ psp->cmd);
+ }
+}
+
+/*
+ * Locate a particular PID.
+ * Return a pointer to the entry or NULL if not found.
+ */
+static ps_data_t * find_ps_data(pid_t pid)
+{
+ ps_data_t *psp;
+ ps_data_t key;
+
+ key.pid = pid;
+
+ /* Should add a cache here */
+
+ psp = (ps_data_t *)bsearch((char *)&key, (char *)pstable,
+ pstable_lines, sizeof (ps_data_t),
+ (int (*)())pscomp);
+ return (psp);
+}
+
+
+void
+get_ps_data(void)
+{
+ ps_ldata_t *ps_last = PS_LNULL;
+ ps_ldata_t *ps_head = PS_LNULL;
+ ps_ldata_t *psp;
+ ps_data_t *pstp;
+ static char *usrname;
+ int i = 0;
+ DIR *dirp;
+ struct dirent *dentp;
+ char pname[MAXNAMELEN];
+ int pdlen;
+ char *gettty();
+
+ if (pstable != PS_NULL) { /* Don't run ps unless we need to */
+ if ((cache_now - ps_cache_time) <= cache_lifetime)
+ return;
+ free(pstable);
+ }
+
+ pstable_lines = 0;
+ ps_cache_time = cache_now;
+ /*
+ * Determine root path for remote machine.
+ */
+ if (!readata()) { /* get data from psfile */
+ call_ftw_for_dev();
+ wrdata();
+ }
+
+ /*
+ * Determine which processes to print info about by searching
+ * the /proc directory and looking at each process.
+ */
+ if ((dirp = opendir(procdir)) == NULL) {
+ (void) SYSLOG0("Cannot open PROC directory\n");
+ return;
+ }
+
+ (void) strcpy(pname, procdir);
+ pdlen = strlen(pname);
+ pname[pdlen++] = '/';
+
+ /* for each active process --- */
+ while (dentp = readdir(dirp)) {
+ int procfd;
+
+ if (dentp->d_name[0] == '.') /* skip . and .. */
+ continue;
+ (void) strcpy(pname + pdlen, dentp->d_name);
+retry:
+ if ((procfd = open(pname, O_RDONLY)) == -1)
+ continue;
+
+ /*
+ * Get the info structure for the process and close quickly.
+ */
+ if (ioctl(procfd, PIOCPSINFO, (char *)&info) == -1) {
+ int saverr = errno;
+
+ (void) close(procfd);
+ if (saverr == EAGAIN)
+ goto retry;
+ if (saverr != ENOENT)
+ (void) SYSLOG2("PIOCPSINFO on %s: %s\n",
+ pname, strerror(saverr));
+ continue;
+ }
+ (void) close(procfd);
+ if ((psp = (ps_ldata_t *)malloc(sizeof (ps_ldata_t))) == PS_LNULL)
+ break;
+ memset((char *)psp, 0, sizeof (ps_ldata_t));
+ psp->pdata.uid = info.pr_uid;
+ psp->pdata.pid = info.pr_pid;
+ psp->pdata.ppid = info.pr_ppid;
+ psp->pdata.sz = info.pr_size;
+ if (info.pr_wchan)
+ sprintf(psp->pdata.wchan, "%9x", info.pr_wchan);
+ else
+ strcpy(psp->pdata.wchan, " ");
+ memset(&psp->pdata.stat[0], 0, STAT_SZ+1);
+ if (info.pr_sname)
+ psp->pdata.stat[0] = info.pr_sname;
+ i = 0;
+ strcpy(psp->pdata.tty, (char *)gettty(&i));
+ psp->pdata.cpu = info.pr_time.tv_sec;
+ strcpy(psp->pdata.cmd, info.pr_fname);
+
+ if ((usrname = (get_usr_name(psp->pdata.uid))) != NULL)
+ strncpy(psp->pdata.usrname, usrname, USRNM_SZ);
+ else {
+ free(psp);
+ continue;
+ }
+
+ psp->pdata.usrname[USRNM_SZ] = '\0';
+ pstable_lines++;
+ if (ps_last == PS_LNULL)
+ ps_head = psp;
+ else
+ ps_last->link = psp;
+ ps_last = psp;
+ }
+
+ (void) closedir(dirp);
+ if ((pstable = (ps_data_t *)malloc(pstable_lines
+ * sizeof (ps_data_t))) == PS_NULL) {
+ clean_ps(ps_head);
+ return;
+ }
+ for (pstp = pstable, psp = ps_head; psp != PS_LNULL;
+ pstp++, psp = psp->link) {
+ memcpy((char *)pstp, (char *)&(psp->pdata), sizeof (ps_data_t));
+ }
+ clean_ps(ps_head);
+ qsort(pstable, pstable_lines, sizeof (ps_data_t), (int (*)())pscomp);
+}
+
+int
+readata()
+{
+ struct stat sbuf1, sbuf2;
+ int fd;
+
+ if ((fd = open(psfile, O_RDONLY)) == -1)
+ return (0);
+
+ if (fstat(fd, &sbuf1) < 0 || sbuf1.st_size == 0 ||
+ stat("/dev", &sbuf2) == -1 || sbuf1.st_mtime <= sbuf2.st_mtime ||
+ sbuf1.st_mtime <= sbuf2.st_ctime) {
+
+ if (!rd_only) { /* if read-only, believe old data */
+ (void) close(fd);
+ return (0);
+ }
+ }
+
+ /* Read /dev data from psfile. */
+ if (read_tmp_file(fd, (char *) &ndev, sizeof (ndev)) == 0) {
+ (void) close(fd);
+ return (0);
+ }
+
+ if (devl)
+ free(devl);
+
+ if ((devl = (struct devl *)malloc(ndev * sizeof (*devl))) == NULL) {
+ SYSLOG1("malloc() for device table failed, %s\n", strerror(errno));
+ exit(1);
+ }
+ if (read_tmp_file(fd, (char *)devl, ndev * sizeof (*devl)) == 0) {
+ (void) close(fd);
+ return (0);
+ }
+
+ (void) close(fd);
+ return (1);
+}
+
+/*
+ * call_ftw_for_dev() uses ftw() to pass pathnames under /dev to gdev()
+ * along with a status buffer.
+ */
+static void
+call_ftw_for_dev(void)
+{
+ int gdev();
+ int rcode;
+
+ ndev = 0;
+ rcode = ftw("/dev", gdev, 17);
+
+ switch (rcode) {
+ case 0:
+ return; /* successful return, devl populated */
+ case 1:
+ SYSLOG0(" ftw() encountered problem\n");
+ break;
+ case -1:
+ SYSLOG1(" ftw() failed, %s\n", strerror(errno));
+ break;
+ default:
+ SYSLOG1(" ftw() unexpected return, rcode=%d\n", rcode);
+ break;
+ }
+ exit(1);
+}
+
+/*
+ * gdev() puts device names and ID into the devl structure for character
+ * special files in /dev. The "/dev/" string is stripped from the name
+ * and if the resulting pathname exceeds DNSIZE in length then the highest
+ * level directory names are stripped until the pathname is DNSIZE or less.
+ */
+int
+gdev(objptr, statp, numb)
+ char *objptr;
+ struct stat *statp;
+ int numb;
+{
+ int i;
+ int leng, start;
+ static struct devl ldevl[2];
+ static int lndev, consflg;
+
+ switch (numb) {
+
+ case FTW_F:
+ if ((statp->st_mode & S_IFMT) == S_IFCHR) {
+ /* Get more and be ready for syscon & systty. */
+ while (ndev + lndev >= maxdev) {
+ maxdev += UDQ;
+ devl = (struct devl *) ((devl == NULL) ?
+ malloc(sizeof (struct devl) * maxdev) :
+ realloc(devl, sizeof (struct devl) * maxdev));
+ if (devl == NULL) {
+ SYSLOG1(" not enough memory for %d devices\n", maxdev);
+ exit(1);
+ }
+ }
+ /*
+ * Save systty & syscon entries if the console
+ * entry hasn't been seen.
+ */
+ if (!consflg && (strcmp("/dev/systty", objptr) == 0 ||
+ strcmp("/dev/syscon", objptr) == 0)) {
+ (void) strncpy(ldevl[lndev].dname, &objptr[5], DNSIZE);
+ ldevl[lndev].dev = statp->st_rdev;
+ lndev++;
+ return (0);
+ }
+
+ leng = strlen(objptr);
+ /* Strip off /dev/ */
+ if (leng < DNSIZE + 4)
+ (void) strcpy(devl[ndev].dname, &objptr[5]);
+ else {
+ start = leng - DNSIZE - 1;
+
+ for (i = start; i < leng && (objptr[i] != '/'); i++)
+ ;
+ if (i == leng)
+ (void) strncpy(devl[ndev].dname,
+ &objptr[start], DNSIZE);
+ else
+ (void) strncpy(devl[ndev].dname,
+ &objptr[i+1], DNSIZE);
+ }
+ devl[ndev].dev = statp->st_rdev;
+ ndev++;
+ /*
+ * Put systty & syscon entries in devl when console
+ * is found.
+ */
+ if (strcmp("/dev/console", objptr) == 0) {
+ consflg++;
+ for (i = 0; i < lndev; i++) {
+ (void) strncpy(devl[ndev].dname,
+ ldevl[i].dname, DNSIZE);
+ devl[ndev].dev = ldevl[i].dev;
+ ndev++;
+ }
+ lndev = 0;
+ }
+ }
+ return (0);
+
+ case FTW_D:
+ case FTW_DNR:
+ case FTW_NS:
+ return (0);
+
+ default:
+ SYSLOG1(" gdev() error, %d, encountered\n", numb);
+ return (1);
+ }
+}
+
+
+void
+wrdata()
+{
+ char tmpname[MAXNAMELEN];
+ char *tfname;
+ int fd;
+
+ (void) umask(02);
+ (void) strcpy(tmpname, "/tmp/mibiisa_ps.XXXXXX");
+ if ((tfname = mktemp(tmpname)) == NULL || *tfname == '\0') {
+ SYSLOG1(" mktemp(\"/tmp/mibiisa_ps.XXXXXX\") failed, %s\n",
+ strerror(errno));
+ return;
+ }
+
+ if ((fd = open(tfname, O_WRONLY|O_CREAT|O_EXCL, 0664)) < 0) {
+ SYSLOG2(" open(\"%s\") for write failed, %s\n",
+ tfname, strerror(errno));
+ return;
+ }
+
+ /*
+ * Make owner root, group sys.
+ */
+ (void) chown(tfname, (uid_t)0, (gid_t)3);
+
+ /* write /dev data */
+ write_tmp_file(fd, (char *) &ndev, sizeof (ndev));
+ write_tmp_file(fd, (char *)devl, ndev * sizeof (*devl));
+
+ (void) close(fd);
+
+ if (rename(tfname, psfile) != 0) {
+ SYSLOG2(" rename(\"%s\",\"%s\") failed\n", tfname, psfile);
+ return;
+ }
+}
+
+/*
+ * gettty returns the user's tty number or ? if none.
+ */
+char *
+gettty(ip)
+int *ip; /* where the search left off last time */
+{
+ int i;
+
+ if (info.pr_ttydev != PRNODEV && *ip >= 0) {
+ for (i = *ip; i < ndev; i++) {
+ if (devl[i].dev == info.pr_ttydev) {
+ *ip = i + 1;
+ return (devl[i].dname);
+ }
+ }
+ }
+ *ip = -1;
+ return ("?");
+}
+
+/*
+ * Special read; unlinks psfile on read error.
+ */
+int
+read_tmp_file(fd, bp, bs)
+ int fd;
+ char *bp;
+ unsigned int bs;
+{
+ int rbs;
+
+ if ((rbs = read(fd, bp, bs)) != bs) {
+ SYSLOG2("read_tmp_file() error on read, rbs=%d, bs=%d\n",
+ rbs, bs);
+ (void) unlink(psfile);
+ return (0);
+ }
+ return (1);
+}
+
+/*
+ * Special write; unlinks psfile on write error.
+ */
+void
+write_tmp_file(fd, bp, bs)
+int fd;
+char *bp;
+unsigned bs;
+{
+ int wbs;
+
+ if ((wbs = write(fd, bp, bs)) != bs) {
+ SYSLOG2("write_tmp_file() error on write, wbs=%d, bs=%d\n",
+ wbs, bs);
+ (void) unlink(psfile);
+ }
+}
+
+
+/*
+ * Return true iff dir is a /proc directory.
+ *
+ * This works because of the fact that "/proc/0" and "/proc/00" are the
+ * same file, namely process 0, and are not linked to each other. Ugly.
+ */
+static int
+isprocdir(dir) /* return TRUE iff dir is a PROC directory */
+ char *dir;
+{
+ struct stat stat1; /* dir/0 */
+ struct stat stat2; /* dir/00 */
+ char path[200];
+ char *p;
+
+ /*
+ * Make a copy of the directory name without trailing '/'s
+ */
+ if (dir == NULL)
+ (void) strcpy(path, ".");
+ else {
+ (void) strncpy(path, dir, (int) sizeof (path) - 4);
+ path[sizeof (path)-4] = '\0';
+ p = path + strlen(path);
+ while (p > path && *--p == '/')
+ *p = '\0';
+ if (*path == '\0')
+ (void) strcpy(path, ".");
+ }
+
+ /*
+ * Append "/0" to the directory path and stat() the file.
+ */
+ p = path + strlen(path);
+ *p++ = '/';
+ *p++ = '0';
+ *p = '\0';
+ if (stat(path, &stat1) != 0)
+ return (FALSE);
+
+ /*
+ * Append "/00" to the directory path and stat() the file.
+ */
+ *p++ = '0';
+ *p = '\0';
+ if (stat(path, &stat2) != 0)
+ return (FALSE);
+
+ /*
+ * See if we ended up with the same file.
+ */
+ if (stat1.st_dev != stat2.st_dev || stat1.st_ino != stat2.st_ino ||
+ stat1.st_mode != stat2.st_mode ||
+ stat1.st_nlink != stat2.st_nlink ||
+ stat1.st_uid != stat2.st_uid || stat1.st_gid != stat2.st_gid ||
+ stat1.st_size != stat2.st_size)
+ return (FALSE);
+
+ /*
+ * Return TRUE iff we have a regular file with a single link.
+ */
+ return ((stat1.st_mode & S_IFMT) == S_IFREG && stat1.st_nlink == 1);
+}
+
+
+/*
+ * Initialize the sunProcessTable table by defining its contents and how
+ * it's structured
+ */
+void initialize_table_sunProcessTable(void) {
+
+ static oid sunProcessTable_oid[] = {1, 3, 6, 1, 4, 1, 42, 3, 12};
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /* create the table structure itself */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /*
+ * if your table is read only, it's easiest to change the
+ * HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY
+ */
+ my_handler = netsnmp_create_handler_registration("sunProcessTable",
+ sunProcessTable_handler,
+ sunProcessTable_oid,
+ OID_LENGTH(sunProcessTable_oid),
+ HANDLER_CAN_RWRITE);
+
+ if (!my_handler || !table_info || !iinfo)
+ return; /* mallocs failed */
+
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER, 0);
+
+ table_info->min_column = 1;
+ table_info->max_column = 11;
+
+ /* iterator access routines */
+ iinfo->get_first_data_point = sunProcessTable_get_first_data_point;
+ iinfo->get_next_data_point = sunProcessTable_get_next_data_point;
+
+ iinfo->table_reginfo = table_info;
+
+ /*
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_sunProcessTable",
+ "Registering table sunProcessTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/* Initializes the sunProcesses module */
+void init_sunProcesses(void) {
+
+ (void) time(&cache_now);
+
+ /* here we initialize all the tables we're planning on supporting */
+ initialize_table_sunProcessTable();
+}
+
+/*
+ * returns the first data point within the sunProcessTable table data.
+ *
+ * Set the my_loop_context variable to the first data point structure
+ * of your choice (from which you can find the next one). This could
+ * be anything from the first node in a linked list, to an integer
+ * pointer containing the beginning of an array variable.
+ *
+ * Set the my_data_context variable to something to be returned to
+ * you later that will provide you with the data to return in a given
+ * row. * This could be the same pointer as what my_loop_context is
+ * set to, or something different.
+ *
+ * The put_index_data variable contains a list of snmp variable
+ * bindings, one for each index in your table. * Set the values of
+ * each appropriately according to the data matching the first row
+ * and return the put_index_data variable at the end of the function.
+ */
+netsnmp_variable_list *
+sunProcessTable_get_first_data_point(void **my_loop_context,
+ void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata) {
+ long long_type;
+ netsnmp_variable_list *vptr;
+ ps_data_t *ps_ptr;
+
+ get_ps_data();
+
+ ps_ptr = pstable;
+ if (ps_ptr == NULL) {
+ return (NULL);
+ }
+
+ *my_loop_context = ps_ptr;
+ *my_data_context = ps_ptr;
+
+ vptr = put_index_data;
+
+ long_type = (long)ps_ptr[0].pid;
+ snmp_set_var_value(vptr, (u_char *) &long_type, sizeof(long_type));
+
+ /* vptr = vptr->next_variable; */
+/*
+pr_ps();
+*/
+ return (put_index_data);
+}
+
+/*
+ * functionally the same as sunProcessTable_get_first_data_point, but
+ * my_loop_context has already been set to a previous value and should
+ * be updated to the next in the list. For example, if it was a
+ * linked list, you might want to cast it and the return
+ * my_loop_context->next. The my_data_context pointer should be set
+ * to something you need later and the indexes in put_index_data
+ * updated again.
+ */
+
+netsnmp_variable_list *
+sunProcessTable_get_next_data_point(void **my_loop_context,
+ void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+ long long_type;
+ netsnmp_variable_list *vptr;
+ ps_data_t *ps_ptr;
+
+ get_ps_data();
+
+ ps_ptr = (ps_data_t *) (*my_loop_context);
+ ps_ptr++;
+
+ if (ps_ptr > &(pstable[pstable_lines - 1])) {
+ return (NULL);
+ }
+
+ *my_loop_context = ps_ptr;
+ *my_data_context = ps_ptr;
+
+ vptr = put_index_data;
+
+ long_type = (long)ps_ptr[0].pid;
+ snmp_set_var_value(vptr, (u_char *) &long_type, sizeof(long_type));
+
+ /* vptr = vptr->next_variable; */
+
+ return (put_index_data);
+}
+
+/*
+ * handles requests for the sunProcessTable table,
+ * if anything else needs to be done
+ */
+int sunProcessTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests) {
+
+ long long_type;
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+ ps_data_t *psp;
+
+ /* For caching purposes, find out what the time is now */
+ (void) time(&cache_now);
+
+ for (request = requests; request; request = request->next) {
+ var = request->requestvb;
+ if (request->processed != 0)
+ continue;
+
+ /* perform anything here that you need to do before each */
+ /* request is processed. */
+
+ /* the following extracts the my_data_context pointer set in */
+ /* the loop functions above. You can then use the results to */
+ /* help return data for the columns of the sunProcessTable */
+ /* table in question */
+ psp = (ps_data_t *) netsnmp_extract_iterator_context(request);
+ if (psp == NULL) {
+ if (reqinfo->mode == MODE_GET ||
+ reqinfo->mode == MODE_SET_RESERVE1) {
+
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ /*
+ * XXX: no row existed, if you support creation and this is a
+ * set, start dealing with it here, else continue
+ */
+ }
+
+ /* extracts the information about the table from the request */
+ table_info = netsnmp_extract_table_info(request);
+
+ /* table_info->colnum contains the column number requested */
+ /* table_info->indexes contains a linked list of snmp variable */
+ /* bindings for the indexes of the table. Values in the list */
+ /* have been set corresponding to the indexes of the request */
+ if (table_info == NULL) {
+ continue;
+ }
+
+ switch (reqinfo->mode) {
+ /*
+ * the table_iterator helper should change all GETNEXTs
+ * into GETs for you automatically, so you don't have to
+ * worry about the GETNEXT case. Only GETs and SETs need
+ * to be dealt with here
+ */
+ case MODE_GET:
+ switch (table_info->colnum) {
+ case COLUMN_PSPROCESSID:
+ long_type = (long)psp->pid;
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (u_char *) &long_type,
+ sizeof (long_type));
+ break;
+
+ case COLUMN_PSPARENTPROCESSID:
+ long_type = (long)psp->ppid;
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (u_char *) &long_type,
+ sizeof (long_type));
+ break;
+
+ case COLUMN_PSPROCESSSIZE:
+ long_type = (long)psp->sz;
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (u_char *) &long_type,
+ sizeof (long_type));
+ break;
+
+ case COLUMN_PSPROCESSCPUTIME:
+ long_type = (long)psp->cpu;
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (u_char *) &long_type,
+ sizeof (long_type));
+ break;
+
+ case COLUMN_PSPROCESSSTATE:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR,
+ (u_char *) &psp->stat,
+ strlen(psp->stat));
+ break;
+
+ case COLUMN_PSPROCESSWAITCHANNEL:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR,
+ (u_char *) &psp->wchan,
+ strlen(psp->wchan));
+ break;
+
+ case COLUMN_PSPROCESSTTY:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR,
+ (u_char *) &psp->tty,
+ strlen(psp->tty));
+ break;
+
+ case COLUMN_PSPROCESSUSERNAME:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR,
+ (u_char *) &psp->usrname,
+ strlen(psp->usrname));
+ break;
+
+ case COLUMN_PSPROCESSUSERID:
+ long_type = (long)psp->uid;
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (u_char *) &long_type,
+ sizeof (long_type));
+ break;
+
+ case COLUMN_PSPROCESSNAME:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR,
+ (u_char *) &psp->cmd,
+ strlen(psp->cmd));
+ break;
+
+ case COLUMN_PSPROCESSSTATUS:
+ long_type = (long)psp->sz;
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (u_char *) &long_type,
+ sizeof (long_type));
+ break;
+
+ default:
+ /* We shouldn't get here */
+ snmp_log(LOG_ERR,
+"problem encountered in sunProcessTable_handler: unknown column\n");
+ }
+ break;
+
+ case MODE_SET_RESERVE1:
+ break;
+
+ case MODE_SET_RESERVE2:
+ break;
+
+ case MODE_SET_FREE:
+ break;
+
+ case MODE_SET_ACTION:
+ /* set handling... */
+/* XXX don't know about 64 bit */
+ if ((int) *(requests->requestvb->val.integer) != 0) {
+ (void) kill(psp->pid,
+ (int)*(requests->requestvb->val.integer));
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ break;
+
+ case MODE_SET_UNDO:
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "problem encountered in sunProcessTable_handler: unsupported mode\n");
+ }
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/seaExtensions/sunProcesses.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.5 2002/12/16 22:50:18 hardaker Exp $
+ */
+#ifndef SUNPROCESSES_H
+#define SUNPROCESSES_H
+
+
+/* function declarations */
+void init_sunProcesses(void);
+void initialize_table_sunProcessTable(void);
+Netsnmp_Node_Handler sunProcessTable_handler;
+
+Netsnmp_First_Data_Point sunProcessTable_get_first_data_point;
+Netsnmp_Next_Data_Point sunProcessTable_get_next_data_point;
+
+/* column number definitions for table sunProcessTable */
+#define COLUMN_PSPROCESSID 1
+#define COLUMN_PSPARENTPROCESSID 2
+#define COLUMN_PSPROCESSSIZE 3
+#define COLUMN_PSPROCESSCPUTIME 4
+#define COLUMN_PSPROCESSSTATE 5
+#define COLUMN_PSPROCESSWAITCHANNEL 6
+#define COLUMN_PSPROCESSTTY 7
+#define COLUMN_PSPROCESSUSERNAME 8
+#define COLUMN_PSPROCESSUSERID 9
+#define COLUMN_PSPROCESSNAME 10
+#define COLUMN_PSPROCESSSTATUS 11
+
+#define USRNM_SZ 16
+#define WCHAN_SZ 16
+#define TTYNM_SZ 16
+#define STAT_SZ 4
+#define CMD_SZ 64
+
+typedef struct ps_data_s
+ {
+ uid_t uid;
+ pid_t pid;
+ pid_t ppid;
+ int sz;
+ time_t cpu;
+ char stat[STAT_SZ+1];
+ char wchan[WCHAN_SZ+1];
+ char tty[TTYNM_SZ+1];
+ char usrname[USRNM_SZ+1];
+ char cmd[CMD_SZ+1];
+ } ps_data_t;
+#define PS_NULL (ps_data_t *)0
+
+typedef struct ps_ldata_s
+ {
+ struct ps_ldata_s *link;
+ ps_data_t pdata;
+ } ps_ldata_t;
+#define PS_LNULL (ps_ldata_t *)0
+
+extern time_t cache_now;
+extern ps_data_t *pstable;
+extern int pstable_lines;
+
+#endif /* SUNPROCESSES_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/seaExtensions/sunSystem.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+#include <sys/systeminfo.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "sunSystem.h"
+
+/* Initializes the sunSystem module */
+void
+init_sunSystem(void)
+{
+ static oid motd_oid[] = { 1, 3, 6, 1, 4, 1, 42, 3, 1, 3, 0 };
+ static oid hostID_oid[] = { 1, 3, 6, 1, 4, 1, 42, 3, 1, 2, 0 };
+ static oid agentDescr_oid[] = { 1, 3, 6, 1, 4, 1, 42, 3, 1, 1, 0 };
+ static oid unixTime_oid[] = { 1, 3, 6, 1, 4, 1, 42, 3, 1, 4, 0 };
+
+ DEBUGMSGTL(("sunSystem", "Initializing\n"));
+
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("motd",
+ get_motd,
+ motd_oid,
+ OID_LENGTH(motd_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("hostID",
+ get_hostID,
+ hostID_oid,
+ OID_LENGTH(hostID_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("agentDescr",
+ get_agentDescr,
+ agentDescr_oid,
+ OID_LENGTH(agentDescr_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("unixTime",
+ get_unixTime,
+ unixTime_oid,
+ OID_LENGTH(unixTime_oid),
+ HANDLER_CAN_RONLY));
+}
+
+int
+get_motd(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ static char motd[256];
+ FILE *fd;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ motd[0] = '\0';
+ fd = fopen("/etc/motd", "r");
+ fgets(motd, sizeof (motd), fd);
+ fclose(fd);
+
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
+ (u_char *) motd, strlen(motd));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_hostID(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ static unsigned int int_my_host_id;
+ static unsigned long int my_host_id;
+ char sibuf[16];
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ (void) sysinfo(SI_HW_SERIAL, sibuf, (long) sizeof (sibuf));
+ my_host_id = atol(sibuf);
+
+ if (sizeof(my_host_id) == sizeof(int)) {
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
+ (u_char *) &my_host_id,
+ sizeof (my_host_id));
+ } else {
+ int_my_host_id = (u_int)my_host_id;
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
+ (u_char *) &int_my_host_id,
+ sizeof (int_my_host_id));
+ }
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_agentDescr(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
+ (u_char *) AGENT_DESCR, strlen(AGENT_DESCR));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_unixTime(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ struct timeval now_is;
+ long now_is_tv_sec;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ (void) gettimeofday(&now_is, (struct timezone *)0);
+ now_is_tv_sec = (long)now_is.tv_sec;
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) &now_is_tv_sec,
+ sizeof (now_is_tv_sec));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/agent/modules/seaExtensions/sunSystem.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+#ifndef SUNSYSTEM_H
+#define SUNSYSTEM_H
+
+/* function declarations */
+void init_sunSystem(void);
+Netsnmp_Node_Handler get_motd;
+Netsnmp_Node_Handler get_hostID;
+Netsnmp_Node_Handler get_agentDescr;
+Netsnmp_Node_Handler get_unixTime;
+
+#define AGENT_DESCR "Sun Microsystems SNMP Agent"
+
+#endif /* SUNSYSTEM_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/masfcnv Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,3388 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# ident "@(#)migration.pl 1.5 03/06/26 SMI"
+#
+# $Id: masfcnv,v 1.3 2004/01/09 14:04:14 rr144420 Exp $
+
+=head1 NAME
+
+masfcnv - SNMP configuration migration script
+
+=head1 SYNOPSIS
+
+masfcnv S<[ -cimnrs ]> S<[ -l agent|master ]> S<[ -p enable|disable|error ]>
+S<[ -t none|add ]> S<[ -u agent|master|error ]> S<[ -y agent|master|error ]>
+
+masfcnv [ -V ]
+
+masfcnv [ -? ]
+
+=head1 DESCRIPTION
+
+The masfcnv script is used to assist the system administrator in migrating an
+existing set of configuration files for the Sun SNMP Management Agent for Sun
+Fire and Netra Systems (MASF) to the Systems Management Agent (SMA).
+
+The script accepts as input the currently installed set of MASF and SMA
+configuration files and outputs a new set of SMA configuration files. Existing
+SMA configuration files are backed up by appending ".bak" to the filename. The
+administrator may choose to output the new configuration to the standard output
+instead of replacing the current configuration by specifying the -n option.
+
+The migration script must be run as the superuser and failure to do so will
+cause the script to exit with an error message. Before running the script the
+administrator should ensure that both the SMA and MASF agents are not running.
+If the agents are running they will be shut down by the script.
+
+The migration script will install a new startup script for the MASF agent in
+/etc/init.d and backup the old script. During migration, MASF will be
+configured as an AgentX subagent of SMA. All migration settings will be
+migrated to the SMA configuration file.
+
+The migration script will abort if any unrecognised directives are found in
+either the MASF configuration files or the SMA configuration files. This may
+be overridden with the -i option. If this option is selected, the behaviour is
+to retain unrecognised directives which were present in the SMA configuration,
+but remove those present in the MASF configuration.
+
+The migration script will then proceed to migrate access control and trap
+configuration. As a side-effect of running the migration script, the following
+directives may be expanded by the script into multiple directives with
+an equivalent interpretation:
+
+=over
+
+=item rwcommunity
+
+=item rocommunity
+
+=item rwuser
+
+=item rouser
+
+=item trapcommunity
+
+=item trapsink
+
+=item trap2sink
+
+=item informsink
+
+=back
+
+=head2 Access Control Migration
+
+Access control directives will be expanded into the equivalent com2sec, group,
+access and view directives. Existing group names will be renamed by prepending
+a prefix to avoid conflict with any which may already be defined in SMA.
+
+When migrating SNMPv1 or v2c access control, a conflict may occur if both MASF
+and SMA configuration files have defined access permissions for the same
+community and source address. The default behaviour is to abort with a
+message, unless the -y option specifies otherwise. If "-y agent" was specified
+then the MASF configuration will take precedence. If "-y master" was specified
+then the SMA configuration will be retained.
+
+When migrating USM configuration (SNMPv3), a conflict may occur if both SMA
+and MASF configurations define a user with the same securityName. If this
+occurs then the behaviour of the script is determined by the -u option.
+If "-u agent" has been selected then the configuration of the user defined in
+the MASF configuration files will be the one that is retained. Otherwise, if
+the "-u master" option has been selected, the one defined in the SMA
+configuration files will be retained.
+
+The migration script will by default attempt to migrate USM users from MASF to
+SMA. The script will determine whether there are any existing SNMPv3 users
+present in the SMA configuration and whether or not the default engineID has
+been overridden in the SMA configuration files. If neither of these are found to
+be the case then the any usmUser statements containing localised
+authentication keys can be migrated to SMA, along with the MASF engineID. This
+will result in the engineID of SMA master agent changing.
+
+If the script determines that there are existing SNMPv3 users or a manually
+configured engineID present in the SMA configuration, then only those users
+defined in createUser statements will be transferred. Those users which were
+defined in usmUser statements will be transferred but will have their
+passwords reset to a random value. The administrator is advised to notify
+their users of their new password and/or reset the password themselves by
+editing the newly-generated configuration file themselves.
+
+=head2 Trap/Inform Migration
+
+The migration script will perform a check to determine whether a trap
+destination defined for MASF is already specified in an existing SMA trapsink,
+trap2sink or informsink directive. If this is the case then the directive in
+the MASF configuration will be discarded to avoid duplicate traps/informs being
+received.
+
+trapsink, trap2sink and informsink directives specified in the existing SMA
+configuration are considered valid destinations for MASF traps/informs and will
+receive them from the MASF subagent after migration.
+
+If the "-t none" option was specified on the command line, then the migration
+script will carry over any remaining MASF trap/inform directives without
+modification.
+
+If the "-t add" option was specified (the default), then the migration script
+will expand any trapsink, trap2sink or informsink directives to use the
+TARGET-MIB and NOTIFICATION-MIB. The TARGET-MIB specifies targets using IP
+addresses, so it may be desirable to use the "-t none" option if, for example,
+the network allocates IP addresses to hostnames dynamically via DHCP.
+
+The expanded directives will define filters specific to the MASF agent so that
+traps from other subagents will not be received by migrated trap destinations.
+Existing filters present in the SMA configuration will by default not be
+modified and may or may not receive MASF traps depending upon the filters
+which were originally defined for them.
+
+If the -l option is specified, then any filters already defined in the
+TARGET-MIB and the NOTIFICATION-MIB for SMA will be extended to include traps
+from MASF. In the event that a trap destination is already configured in the
+TARGET-MIB with the same target address and community as an existing MASF
+trap/inform sink, a conflict will arise.
+
+If "-l agent" was specified and a conflict arises, then the migration script
+will use the target SNMP parameters (i.e. SNMP version and choise of
+trap/inform) defined by the MASF trap/informsink directive to send traps to
+this destination. Otherwise if the "-l master" option was specified, then the
+conflict will be resolved using the target SNMP parameters specified in the
+SMA configuration.
+
+=head2 Miscellaneous
+
+If the migration script encounters any of the following directives in the MASF
+configuration file and they are either not present or differ in the SMA
+configuration, the script will log a warning message:
+
+=over
+
+=item syslocation
+
+=item syscontact
+
+=item sysname
+
+=item sysservices
+
+=item agentgroup
+
+=item agentuser
+
+=item authtrapenable
+
+=back
+
+=head1 OPTIONS
+
+=over
+
+=item B<-?>
+
+=item B<--help>
+
+Displays usage information.
+
+=item B<-c>
+
+=item B<--no-community>
+
+Do not transfer v1/v2c communities
+
+=item B<-i>
+
+=item B<--ignore-unrecognized-directives>
+
+Continue processing if unrecognised directives are present.
+
+=item B<-l> I<agent|master>
+
+=item B<--master-trap-target>=I<agent|master>
+
+If 'agent' is specified then the existing SMA trap targets will be configured
+to receive traps that were previously sent to destinations for the Sun Fire
+SNMP agent. If 'master' is specified then the targets will be configured to
+receive Sun Fire SNMP traps but existing SNMP target parameters will be used.
+
+=item B<-m>
+
+=item B<--no-usmuser>
+
+Do not transfer usm (v3) users
+
+=item B<-n>
+
+=item B<--dry-run>
+
+Run the migration without modifying any files. If any error arises then
+continue processing. This can be used to determine the likely migration issues.
+
+=item B<-p> I<enable|disable|error>
+
+=item B<--use-agent-port>=I<enable|disable|error>
+
+Indicates whether the port originally used by the Sun Fire SNMP agent should be
+used by the SMA agent after migration (if the two agents are using different
+ports). If 'enable' is specified then the port used by the Sun Fire SNMP agent
+will also be used by the SMA agent after migration. If 'disable' is specified
+then the ports used by SMA will not be updated by the migration tool. If
+the 'error' option is specified and the SMA agent is not already using the same
+ports as those used by the original Sun Fire SNMP agent then an error will be
+reported and the migration process will be terminated. If no option is
+specified the default behaviour is equivalent to the 'error' flag.
+
+=item B<-r>
+
+=item B<--no-trap>
+
+Do not transfer trap destinations
+
+=item B<-s>
+
+=item B<--skip-user>
+
+If a user is found in the MASF configuration file that cannot be created in the
+new configuration due to a change in the engine ID, then output a message
+indicating that the user could not be migrated (needs to be manually recreated)
+and continue processing. If this option is not present then the migration tool
+will consider such a situation as an error and abort.
+
+=item B<-t> I<none|add>
+
+=item B<--trap-filter>=I<none|add>
+
+If 'none' is specified then the script will copy trap directives directly. The
+administrator may need to manually update the configuration file to ensure
+traps are only delivered to their intended destinations. If 'add' is specifed
+then trap filters will be constructed so that traps originating from the
+original Sun Fire SNMP agent are only delivered to the destinations that
+originally received them. 'add' is the default behaviour.
+
+=item B<-u> I<agent|master|error>
+
+=item B<--select-user>=I<agent|master|error>
+
+Specifies that if a user with the same name is found in both configuration
+files that the conflict is to be resolved using the specified configuration
+file as input. Selecting a user from a particular will also cause the group
+declaration for that user to be taken from the same file. If 'agent' is
+specified then the user will be taken from the configuration file for the Sun
+Fire SNMP Agent. If 'master' is specified then the user will be taken from the
+SMA configuration. Otherwise if 'error' is given, the script will terminate.
+If this option is not present then the default behaviour is equivalent to
+the 'error' flag.
+
+=item B<-V>
+
+=item B<--version>
+
+Display the version of this script.
+
+=item B<-y> I<agent|master|error>
+
+=item B<--select-community>=I<agent|master|error>
+
+Specifies that if a community and source (hostname, IP addr or range of IP
+addresses) is found to be conflicting in the two configurations, which
+combination should be selected when mapping to a security name. If 'agent' is
+specified then the community and source information will be taken from the
+configuration for the Sun Fire SNMP agent. If 'master' is specified it will be
+taken from the SMA agent. Otherwise if 'error' is specified an error will be
+reported and the migration will terminate. If this option is not present then
+the default behaviour is equivalent to the 'error' flag.
+
+=back
+
+=head1 EXIT STATUS
+
+The script will exit with 0 if migration was successful, non-zero if a problem
+occurred during migration.
+
+=head1 EXAMPLES
+
+For a simple migration which will fail if there are any potential conflicts:
+
+masfcnv
+
+To migrate the MASF configuration such that it will always succeed, MASF
+settings will override in the event of a conflict with SMA and access will
+still be provided on the original MASF port:
+
+masfcnv -is -l agent -p enable -u agent -y agent
+
+To attempt a dry run and migrate the configuration such that any conflicts
+will be resolved by retaining existing SMA settings:
+
+masfcnv -l master -u master -y master
+
+=head1 FILES
+
+=over
+
+=item /etc/sma/snmp/snmpd.conf
+
+=item /var/sma_snmp/snmpd.conf
+
+SMA configuration files
+
+=back
+
+=over
+
+=item /etc/opt/SUNWmasf/conf/snmpd.conf
+
+=item /var/opt/SUNWmasf/snmpd.dat
+
+MASF configuration files
+
+=back
+
+=over
+
+=item /tmp/sma_migration.log
+
+masfcnv log file
+
+=back
+
+=cut
+
+use strict;
+
+# Text::ParseWords requires 5.005
+require 5.005;
+
+use Getopt::Long 2.17;
+use Text::ParseWords;
+use Net::hostent;
+use Socket;
+use Data::Dumper;
+use File::Copy;
+use Text::Wrap;
+
+##############################################################################
+# global defaults
+
+# storage for new lines
+%::ADDED_CONFIGS = ('prepend'=>[],
+ 'append'=>[]);
+
+use vars qw ($INTERNET_OID
+ $LOG_FILE
+ $DATA_DIR
+ $FILTER_TYPE_INCLUDED
+ $FILTER_TYPE_EXCLUDED
+ $ENTITY_MIB_OID
+ $SUNPLAT_MIB_OID
+ $SNMP_UDP_DOMAIN
+ $DEFAULT_ROW_STATUS
+ $DEFAULT_STORAGE_TYPE
+ $MPMODEL_SNMPV1
+ $MPMODEL_SNMPV2C
+ $MPMODEL_SNMPV2U
+ $MPMODEL_SNMPV3
+ $SECURITY_MODEL_ANY
+ $SECURITY_MODEL_SNMPV1
+ $SECURITY_MODEL_SNMPV2C
+ $SECURITY_MODEL_USM
+ $SECURITY_LEVEL_NOAUTHNOPRIV
+ $SECURITY_LEVEL_AUTHNOPRIV
+ $SECURITY_LEVEL_AUTHPRIV
+ $NOTIFY_TYPE_TRAP
+ $NOTIFY_TYPE_INFORM);
+# location where template files, etc. are stored.
+*LOG_FILE = \"/tmp/sma_migration.log";
+*INTERNET_OID = \".1.3.6.1";
+*DATA_DIR = \"/usr/lib/net_snmp";
+*FILTER_TYPE_INCLUDED = \1;
+*FILTER_TYPE_EXCLUDED = \2;
+*ENTITY_MIB_OID = \".1.3.6.1.2.1.47";
+*SUNPLAT_MIB_OID = \".1.3.6.1.4.1.42.2.70.101";
+*SNMP_UDP_DOMAIN = \".1.3.6.1.6.1.1";
+*DEFAULT_ROW_STATUS = \1;
+*DEFAULT_STORAGE_TYPE = \3;
+*MPMODEL_SNMPV1 = \0;
+*MPMODEL_SNMPV2C = \1;
+*MPMODEL_SNMPV2U = \2;
+*MPMODEL_SNMPV3 = \3;
+*SECURITY_MODEL_ANY = \0;
+*SECURITY_MODEL_SNMPV1 = \1;
+*SECURITY_MODEL_SNMPV2C = \2;
+*SECURITY_MODEL_USM = \3;
+*SECURITY_LEVEL_NOAUTHNOPRIV = \1;
+*SECURITY_LEVEL_AUTHNOPRIV = \2;
+*SECURITY_LEVEL_AUTHPRIV = \3;
+*NOTIFY_TYPE_TRAP = \1;
+*NOTIFY_TYPE_INFORM = \2;
+
+
+##############################################################################
+# misc functions
+
+sub log_message
+{
+ my ($msg, $line) = @_;
+ if (defined $line && exists $line->{'file'} && exists
+ $line->{'lineno'}) {
+ $msg = $line->{'file'}.', line '.($line->{'lineno'} + 1).
+ ': '.$msg;
+ }
+ $msg = wrap('', '', $msg);
+ if ($::AUTOMATED) {
+ open (LOG, ">> $LOG_FILE") ||
+ die "Couldn't open log file $LOG_FILE\n";
+ print LOG $msg;
+ print STDERR $msg;
+ close LOG;
+ } else {
+ print STDERR $msg;
+ }
+}
+
+sub get_backup_filename
+{
+ my ($fname) = @_;
+ if ( -e $fname.'.bak') {
+ my ($i) = 0;
+ while ( -e $fname.".bak.$i" ) {
+ $i++;
+ }
+ return $fname.".bak.$i";
+ }
+ return $fname.".bak";
+}
+
+sub backup_files
+{
+ log_message "Backing up original files\n";
+ my ($f, $newf);
+ for $f (@::MASF_CONFIG_FILES, $::MASF_PERSISTENT_FILE, @::SMA_CONFIG_FILES,
+ $::SMA_PERSISTENT_FILE) {
+ if (! -e $f) {
+ next;
+ }
+ $newf = get_backup_filename($f);
+ log_message "Backing up $f to $newf\n";
+ if (0 == copy $f, $newf) {
+ log_message "Couldn't backup $f - aborting\n";
+ exit 1;
+ }
+ }
+}
+
+sub remove_masf_persistent_file
+{
+ if (! -e $::MASF_PERSISTENT_FILE) {
+ return;
+ }
+ log_message "Removing $::MASF_PERSISTENT_FILE\n";
+ if (0 == unlink $::MASF_PERSISTENT_FILE) {
+ log_message "Couldn't remove MASF persistent storage file\n".
+ "$::MASF_PERSISTENT_FILE - Aborting\n";
+ exit 1;
+ }
+}
+
+sub version
+{
+ my ($rev) = '$Revision: 1.3 $';
+ $rev=~s/^\$Revision: //;
+ $rev=~s/ \$$//;
+ print STDERR "$0 $rev\n".
+ "Copyright 2003 Sun Microsystems, Inc.\n".
+ "All rights reserved.\n".
+ "Use is subject to license terms.\n";
+ exit 0;
+}
+
+sub stop_sma_running
+{
+ `/etc/init.d/init.sma stop`;
+}
+
+sub stop_masf_running
+{
+ `/etc/init.d/masfd stop`;
+ if (($? >> 8) > 0) {
+ log_message "Couldn't stop the MASF agent\n";
+ exit 1;
+ }
+}
+
+sub set_umask
+{
+ # only root should be able to read the config file
+ umask 0077;
+}
+
+sub install_new_wrapper_script
+{
+ log_message "Installing new MASF startup script\n";
+
+ my $pkgInstance='SUNWmasfr';
+ my @commands=("/usr/sbin/installf $pkgInstance /etc/init.d/masfd f 744 root sys",
+ "/usr/sbin/installf $pkgInstance /etc/rc0.d/K40masfd=/etc/init.d/masfd l",
+ "/usr/sbin/installf $pkgInstance /etc/rc1.d/K40masfd=/etc/init.d/masfd l",
+ "/usr/sbin/installf $pkgInstance /etc/rc2.d/K40masfd=/etc/init.d/masfd l",
+ "/usr/sbin/installf $pkgInstance /etc/rc3.d/S90masfd=/etc/init.d/masfd l",
+ "/usr/sbin/installf $pkgInstance /etc/rcS.d/K40masfd=/etc/init.d/masfd l",
+ "/usr/sbin/install -f /etc/init.d -m 0744 -u root -g sys $DATA_DIR/masfd",
+ "/usr/sbin/installf -f $pkgInstance",
+ "/usr/sbin/removef $pkgInstance /etc/rc3.d/S80masfd",
+ "/usr/bin/rm /etc/rc3.d/S80masfd",
+ "/usr/sbin/removef -f $pkgInstance"
+ );
+ my $command;
+ for $command (@commands) {
+ `$command`;
+ if ($? >> 8) {
+ log_message "A problem occurred whilst installing the MASF startup ".
+ "script\n";
+ exit 1;
+ }
+ }
+}
+
+sub install_template_config_file
+{
+ if (copy($DATA_DIR.'/snmpd.conf', $::MASF_CONFIG_FILES[0]) == 0) {
+ log_message "Couldn't copy template configuration file to ".
+ $::MASF_CONFIG_FILES[0]."\n";
+ exit 1;
+ }
+}
+
+sub are_we_root
+{
+ if ($> != 0) {
+ log_message "You are not running this as root.\n";
+ exit 1;
+ }
+}
+
+sub sma_config_sanity_check
+{
+ my ($files, $i);
+ # check we can read the main config file
+ if ( ! -r $::SMA_CONFIG_FILES[0] ) {
+ log_message "Couldn't read SMA config file ".
+ $::SMA_CONFIG_FILES[0]."\n";
+ exit 1;
+ }
+ for ($i = 0; $i < @::SMA_CONFIG_FILES; $i++) {
+ if (! -r $::SMA_CONFIG_FILES[$i]) {
+ splice @::SMA_CONFIG_FILES, $i--, 1;
+ }
+ }
+ # check that if the persistent storage file isn't present, that there
+ # aren't any stale backups indicating it failed to update it properly
+ if ( ! -e $::SMA_PERSISTENT_FILE ) {
+ $files = `/bin/ls $::SMA_PERSISTENT_DIR/sma.*.dat 2>/dev/null`;
+ if ($files ne '') {
+ log_message "Stale SMA agent config files found. The ".
+ "SMA agent may not have been shut down cleanly.\n";
+ exit 1;
+ } else {
+ # Assume this is because the agent was never run
+ log_message "WARNING: no SMA persistent storage file found\n";
+ }
+ }
+}
+
+sub masf_config_sanity_check
+{
+ my ($files, $i);
+ # check we can read the main config file
+ if ( ! -r $::MASF_CONFIG_FILES[0] ) {
+ log_message "Couldn't read MASF config file ".
+ $::MASF_CONFIG_FILES[0]."\n";
+ exit 1;
+ }
+ for ($i = 0; $i < @::MASF_CONFIG_FILES; $i++) {
+ if (! -r $::MASF_CONFIG_FILES[$i]) {
+ splice @::MASF_CONFIG_FILES, $i--, 1;
+ }
+ }
+ # check that if the persistent storage file isn't present, that there
+ # aren't any stale backups indicating it failed to update it properly
+ if ( ! -e $::MASF_PERSISTENT_FILE ) {
+ $files = `/bin/ls $::MASF_PERSISTENT_DIR/snmpd.*.dat 2>/dev/null`;
+ if ($files ne '') {
+ log_message "Stale MASF agent config files found. The MASF agent ".
+ "may not have been shut down cleanly.\n";
+ exit 1;
+ } else {
+ # Assume this is because the agent was never run
+ log_message "WARNING: no MASF persistent storage file found\n";
+ }
+ }
+}
+
+sub hostnameToUDPDomain
+{
+ my ($target) = @_;
+ my ($hostname, $port, $hostent);
+ my @dotted_decimal;
+ ($hostname, $port) = ($target=~/^([^:]+):(\d+)$/);
+ if ($port eq "") {
+ $port = 162;
+ }
+ ($hostent) = gethostbyname($hostname);
+ @dotted_decimal = unpack ('C4', $hostent->addr_list->[0]);
+ return sprintf "0x%02x%02x%02x%02x%04x", @dotted_decimal, $port;
+
+}
+
+sub help
+{
+ my ($name) = ($0=~/([^\/]*)$/);
+ print STDERR "Usage:
+$name [ -cimnrs ] [ -l agent|master ] [ -p enable|disable|error ]
+ [ -t none|add ] [ -u agent|master|error ] [ -y agent|master|error ]
+
+$name [ -V ]
+
+$name [ -? ]
+
+ Migrates the configuration of the SNMP Agent for
+ Sun Fire Servers to the SMA SNMP Agent
+
+Option Interpretation
+
+-?
+--help
+ Display this help message.
+
+-c
+--no-community
+ Do not transfer v1/v2c communities
+
+-i
+--ignore-unrecognized-directives
+ Continue processing if unrecognised directives are present.
+
+-l agent|master
+--master-trap-target=agent|master
+ If 'agent' is specified then the existing SMA trap targets will
+ be configured to receive traps that were previously sent to
+ destinations for the Sun Fire SNMP agent. If 'master' is
+ specified then the targets will be configured to receive Sun
+ Fire SNMP traps but existing SNMP target parameters will be used. This
+ option may not be used with the \"-t none\" option.
+
+-m
+--no-usmuser
+ Do not transfer usm (v3) users
+
+-n
+--dry-run
+ Run the migration without modifying any files. If any error
+ arises then continue processing. This can be used to determine the
+ likely migration issues.
+
+-p enable|disable|error
+--use-agent-port=enable|disable|error
+ Indicates whether the port originally used by the Sun Fire SNMP
+ agent should be used by the SMA agent after migration (if the
+ two agents are using different ports). If 'enable' is specified
+ then the port used by the Sun Fire SNMP agent will also be used
+ by the SMA agent after migration. If 'disable' is specified then
+ the ports used by SMA will not be updated by the migration tool.
+ If the 'error' option is specified and the SMA agent is not
+ already using the same ports as those used by the original Sun
+ Fire SNMP agent then an error will be reported and the migration
+ process will be terminated. If no option is specified the default
+ behaviour is equivalent to the 'error' flag.
+
+-r
+--no-trap
+ Do not transfer trap destinations
+
+-s
+--skip-user
+ If a user is found in the MASF configuration file that
+ cannot be created in the new configuration due to a change
+ in the engine ID, then output a message indicating that
+ the user could not be migrated (needs to be manually
+ recreated) and continue processing. If this option is not
+ present then the migration tool will consider such a
+ situation as an error and abort.
+
+-t none|add
+--trap-filter=none|add
+ If 'none' is specified then the script will copy trap directives
+ directly. The administrator may need to manually update the
+ configuration file to ensure traps are only delivered to their
+ intended destinations. If 'add' is specifed then trap filters
+ will be constructed so that traps originating from the original
+ Sun Fire SNMP agent are only delivered to the destinations that
+ originally received them. 'add' is the default behaviour.
+
+-u agent|master|error
+--select-user=agent|master|error
+ Specifies that if a user with the same name is found in both
+ configuration files that the conflict is to be resolved using
+ the specified configuration file as input. Selecting a user
+ from a particular will also cause the group declaration for
+ that user to be taken from the same file. If 'agent' is
+ specified then the user will be taken from the configuration
+ file for the Sun Fire SNMP Agent. If 'master' is specified then
+ the user will be taken from the SMA configuration. Otherwise
+ if 'error' is given, the script will terminate. If this option
+ is not present then the default behaviour is equivalent to the
+ 'error' flag.
+
+-V
+--version
+ Display the version of this script.
+
+-y agent|master|error
+--select-community=agent|master|error
+ Specifies that if a community and source (hostname, IP addr
+ or range of IP addresses) is found to be conflicting in the
+ two configurations, which combination should be selected when
+ mapping to a security name. If 'agent' is specified then the
+ community and source information will be taken from the
+ configuration for the Sun Fire SNMP agent. If 'master' is
+ specified it will be taken from the SMA agent. Otherwise if
+ 'error' is specified an error will be reported and the
+ migration will terminate. If this option is not present then
+ the default behaviour is equivalent to the 'error' flag.
+
+";
+ exit 1;
+}
+
+%::SMA_CONFIGS = ();
+%::MASF_CONFIGS = ();
+sub strip_cr_nl
+{
+ # remove \r and \n
+ my ($lines, $i);
+ for $lines (values %::SMA_CONFIGS) {
+ for ($i = 0; $i < @$lines; $i++) {
+ chomp $lines->[$i];
+ }
+ }
+ for $lines (values %::MASF_CONFIGS) {
+ for ($i = 0; $i < @$lines; $i++) {
+ chomp $lines->[$i];
+ }
+ }
+}
+
+sub read_config_files
+{
+ my ($i, @lines);
+ for ($i = 0; $i < @::SMA_CONFIG_FILES; $i++) {
+ open (FH, '< '.$::SMA_CONFIG_FILES[$i]) || do {
+ log_message("Couldn't read config file ".
+ $::SMA_CONFIG_FILES[$i]."\n");
+ exit 1;
+ };
+ @lines=<FH>;
+ close FH;
+ $::SMA_CONFIGS{$::SMA_CONFIG_FILES[$i]} = [@lines];
+ }
+ if (-e $::SMA_PERSISTENT_FILE) {
+ open (FH, '< '.$::SMA_PERSISTENT_FILE) || do {
+ log_message("Couldn't read config file ".$::SMA_PERSISTENT_FILE."\n");
+ exit 1;
+ };
+ @lines=<FH>;
+ close FH;
+ $::SMA_CONFIGS{$::SMA_PERSISTENT_FILE} = [@lines];
+ }
+ for ($i = 0; $i < @::MASF_CONFIG_FILES; $i++) {
+ open (FH, '< '.$::MASF_CONFIG_FILES[$i]) || do {
+ log_message("Couldn't read config file ".
+ $::MASF_CONFIG_FILES[$i]."\n");
+ exit 1;
+ };
+ @lines=<FH>;
+ close FH;
+ $::MASF_CONFIGS{$::MASF_CONFIG_FILES[$i]} = [@lines];
+ }
+ if (-e $::MASF_PERSISTENT_FILE) {
+ open (FH, '< '.$::MASF_PERSISTENT_FILE) || do {
+ log_message("Couldn't read config file ".
+ $::MASF_PERSISTENT_FILE."\n");
+ exit 1;
+ };
+ @lines=<FH>;
+ close FH;
+ $::MASF_CONFIGS{$::MASF_PERSISTENT_FILE} = [@lines];
+ }
+ strip_cr_nl();
+}
+
+sub prompt_yes_no
+{
+ my ($prompt, $default) = @_;
+ my $response = '';
+ print STDOUT $prompt," [".$default."]:";
+ $response = <STDIN>;
+ chomp $response;
+ if ($response eq '') {
+ $response = $default;
+ }
+ while (uc($response)!~/^Y|N/) {
+ print STDERR "Response must be (y)es or (n)o:";
+ $response = <STDIN>;
+ chomp $response;
+ }
+ return $response=~/^[yY]/ ? 'yes' : 'no';
+}
+
+sub prompt
+{
+ my ($prompt, $default, $options) = @_;
+ my $response = '';
+ print STDOUT $prompt," [".$default."]:";
+ $response = <STDIN>;
+ chomp $response;
+ if ($response eq '') {
+ $response = $default;
+ }
+ while (scalar (grep $response eq $_, @$options) != 1) {
+ print STDERR "Invalid response:";
+ $response = <STDIN>;
+ chomp $response;
+ }
+ return $response;
+}
+
+sub parse_agentaddress
+{
+ my ($line)=@_;
+ my ($directive, $addresses)=($line=~/^\s*(agentaddress)\s+(.*\S)\s*$/);
+ my ($addr, $spec, @addrs, $has_transport_specifier);
+ @addrs=split /,/,$addresses;
+ foreach $addr (@addrs) {
+ $has_transport_specifier=($addr=~/:/);
+ if (! $has_transport_specifier) {
+ if ($addr=~/^\//) {
+ $spec = "unix";
+ } else {
+ $spec = "udp";
+ }
+ $addr = $spec.':'.$addr;
+ }
+ }
+ return @addrs;
+}
+
+sub parse_config_line
+{
+ my ($line)=@_;
+ my @words;
+ # strip whitespace
+ $line=~s/^\s*//;
+ $line=~s/\s*$//;
+ # check to see if comment
+ if ((substr $line, 0, 1) eq '#') {
+ return ('', ());
+ }
+ @words = &parse_line('\s+', 0, $line);
+ if (! defined $words[0]) {
+ $words[0] = '';
+ }
+ return @words;
+}
+
+sub sanity_check_config_files
+{
+ my @smaTokens = (
+ 'master',
+ 'agentxTimeout',
+ 'agentxRetries',
+ 'agentxPingInterval',
+ 'targetParams',
+ 'targetAddr',
+ 'snmpNotifyFilterProfileTable',
+ 'snmpNotifyTable',
+ 'snmpNotifyFilterTable'
+ );
+ my @commonTokens = (
+ 'rocommunity',
+ 'rwcommunity',
+ 'rouser',
+ 'rwuser',
+ 'agentaddress',
+ 'trapsink',
+ 'trap2sink',
+ 'informsink',
+ 'trapcommunity',
+ 'com2sec',
+ 'group',
+ 'access',
+ 'view',
+ 'engineID',
+ 'createUser',
+ 'agentgroup',
+ 'agentuser',
+ 'authtrapenable',
+ 'syslocation',
+ 'syscontact',
+ 'sysname',
+ 'sysservices',
+ 'engineBoots',
+ 'oldEngineID',
+ 'usmUser'
+ );
+ my ($file, $i, $j, $directive, @tokens, $found, $warned, $answer);
+ # check sma config files
+ $warned = 0;
+ for $file (keys %::SMA_CONFIGS) {
+ for ($i = 0; $i < @{$::SMA_CONFIGS{$file}}; $i++) {
+ $found = 0;
+ ($directive, @tokens) = parse_config_line($::SMA_CONFIGS{$file}->[$i]);
+ if ($directive eq '') {
+ next;
+ }
+
+ for ($j = 0; $j < @smaTokens; $j++) {
+ if ($directive eq $smaTokens[$j]) {
+ $found = 1;
+ last;
+ }
+ }
+ if ($found) {
+ next;
+ }
+ for ($j = 0; $j < @commonTokens; $j++) {
+ if ($directive eq $commonTokens[$j]) {
+ $found = 1;
+ last;
+ }
+ }
+ if ($found) {
+ next;
+ }
+ # token was not recognised
+ log_message("WARNING: Unrecognised token ".$directive.
+ " found in file ".$file." at line ".($i + 1)."\n");
+ $warned = 1;
+ }
+ }
+ for $file (keys %::MASF_CONFIGS) {
+ for ($i = 0; $i < @{$::MASF_CONFIGS{$file}}; $i++) {
+ $found = 0;
+ ($directive, @tokens) = parse_config_line($::MASF_CONFIGS{$file}->[$i]);
+ if ($directive eq '') {
+ next;
+ }
+
+ for ($j = 0; $j < @commonTokens; $j++) {
+ if ($directive eq $commonTokens[$j]) {
+ $found = 1;
+ last;
+ }
+ }
+ if ($found) {
+ next;
+ }
+ # token was not recognised
+ log_message("WARNING: Unrecognised token ".$directive.
+ " found in file ".$file." at line ".($i + 1)."\n");
+ $warned = 1;
+ # remove the unrecognised token
+ splice @{$::MASF_CONFIGS{$file}}, $i--, 1;
+ }
+ }
+ if ($warned && ! $::IGNORE_UNRECOGNIZED_DIRECTIVES) {
+ if ($::AUTOMATED) {
+ log_message("Unrecognised tokens found in configuration ".
+ "file(s) - aborting\n");
+ exit 1;
+ } else {
+ $answer = prompt_yes_no("Unrecognised tokens were found. Continue?", 'n');
+ if ($answer eq 'no') {
+ exit 1;
+ }
+ }
+ }
+}
+
+sub print_line
+{
+ my ($fh, $line) = @_;
+ if (exists $line->{'orig'} && exists $line->{'new'}) {
+ if ($line->{'orig'} ne $line->{'new'}) {
+ print $fh "# ### CHANGED BY $0 ###\n";
+ print $fh '# ',$line->{'orig'},"\n";
+ if (exists $line->{'comment'}) {
+ print $fh $line->{'comment'},"\n";
+ }
+ print $fh $line->{'new'},"\n";
+ } else {
+ print $fh $line->{'orig'},"\n";
+ }
+ } elsif (exists $line->{'new'}) {
+ if (exists $line->{'comment'}) {
+ print $fh $line->{'comment'},"\n";
+ }
+ print $fh $line->{'new'},"\n";
+ }
+
+}
+
+@::SMA_PERSISTENT_FILE_TOKENS = (
+ 'targetParams', 'targetAddr',
+ 'snmpNotifyFilterProfileTable', 'snmpNotifyTable',
+ 'snmpNotifyFilterTable', 'engineBoots', 'usmUser', 'oldEngineID',
+ 'createUser');
+
+# extract those directives destined for persistent storage
+sub dump_persistent_storage
+{
+ my ($file, $persistent_file, $config) = @_;
+ #list of tokens which should be in persistent storage
+ my ($f, $l, $lines);
+ for $f (keys %$config) {
+ print $file "# ### IMPORTED FROM $f ###\n\n";
+ for $l (@{$config->{$f}}) {
+ if (! exists $l->{'new'}) {
+ next;
+ }
+ my ($directive, @toks) = parse_config_line($l->{'new'});
+ if ($directive) {
+ my (@match) = grep ($_ eq $directive, @::SMA_PERSISTENT_FILE_TOKENS);
+ if (@match == 0) {
+ # skip this line
+ next;
+ }
+ } elsif ($f ne $persistent_file) {
+ # skip all comments/blank lines which are not in the persistent
+ # storage file
+ next;
+ }
+ print_line($file, $l);
+ }
+ }
+}
+
+sub dump_config
+{
+ my ($file, $persistent_file, $config) = @_;
+ #list of tokens which should be in persistent storage
+ my ($f, $l, $lines);
+ for $f (keys %$config) {
+ print $file "# ### IMPORTED FROM $f ###\n\n";
+ for $l (@{$config->{$f}}) {
+ if (! exists $l->{'new'}) {
+ next;
+ }
+ my ($directive, @toks) = parse_config_line($l->{'new'});
+ if ($directive) {
+ my (@match) = grep ($_ eq $directive, @::SMA_PERSISTENT_FILE_TOKENS);
+ if (@match > 0) {
+ if ($f ne $persistent_file && exists $l->{'orig'}) {
+ print $file "# moved to $::SMA_PERSISTENT_FILE >>> ".
+ $l->{'orig'}."\n";
+ }
+ # skip this line
+ next;
+ }
+ } elsif ($f eq $persistent_file) {
+ # skip all comments/blank lines which are not in the persistent
+ # storage file
+ next;
+ }
+ print_line($file, $l);
+ }
+ }
+}
+
+sub set_union {
+ my ($seta, $setb) = @_;
+ my ($i, $j, $found, @out);
+ for $i (@$seta, @$setb) {
+ $found = 0;
+ for $j (@out) {
+ if ($j eq $i) {
+ $found = 1;
+ }
+ }
+ if (! $found) {
+ push @out, $i;
+ }
+ }
+ return @out;
+}
+
+sub in_addr_to_number
+{
+ my ($in_addr) = @_;
+ my ($i, $N) = (0, 0);
+ my (@n) = (unpack 'C4', $in_addr);
+ for ($i = 0; $i < @n; $i++) {
+ $N = $N << 8;
+ $N += $n[$i];
+ }
+ return $N;
+}
+
+sub splice_line
+{
+ my ($config, $line, $length, $offset, @lines) = @_;
+ my ($i, $f);
+ for $i (@lines) {
+ # mark all the lines as changed
+ $i->{'changed'} = undef;
+ }
+ for $f (values %$config) {
+ for ($i = 0; $i < @$f; $i++) {
+ if ($f->[$i] eq $line) {
+ if (@lines) {
+ splice @$f, $i + $offset, $length, @lines;
+ } else {
+ splice @$f, $i + $offset, $length;
+ }
+ return;
+ }
+ }
+ }
+}
+
+sub prepend_line {
+ my ($line) = @_;
+ $line->{'changed'} = undef;
+ push @{$::ADDED_CONFIGS{'prepend'}}, $line;
+}
+
+sub append_line {
+ my ($line) = @_;
+ $line->{'changed'} = undef;
+ push @{$::ADDED_CONFIGS{'append'}}, $line;
+}
+
+sub replace_line {
+ my ($config, $line, @lines) = @_;
+ $line->{'meta'} = $lines[0]->{'meta'};
+ if (exists $lines[0]->{'new'}) {
+ $line->{'new'} = $lines[0]->{'new'};
+ } else {
+ delete $line->{'new'};
+ }
+ $lines[0] = $line;
+ splice_line($config, $line, 1, 0, @lines);
+}
+
+sub insert_lines {
+ my ($config, $line, $after, @lines) = @_;
+ my ($offset) = ($after ? 1 : 0);
+ splice_line($config, $line, 0, $offset, @lines);
+}
+
+sub get_lines
+{
+ my ($directive, $config)=@_;
+ my ($line, $lines, @matches);
+ for $lines (values %$config) {
+ for $line (@$lines) {
+ if (exists $line->{'meta'}->{'directive'} &&
+ $line->{'meta'}->{'directive'} eq $directive) {
+ push @matches, $line;
+ }
+ }
+ }
+ return @matches;
+}
+
+##############################################################################
+# Traps
+
+sub remove_trap_destinations
+{
+ my (@sinkLines) = (get_lines('trapsink', \%::MASF_CONFIGS),
+ get_lines('trap2sink', \%::MASF_CONFIGS),
+ get_lines('informsink', \%::MASF_CONFIGS));
+ my ($line);
+ for $line (@sinkLines) {
+ replace_line(\%::MASF_CONFIGS, $line, {'meta'=>{}});
+ }
+}
+
+sub get_filters
+{
+ my ($keys, $configs)=@_;
+ my ($f, $l, @filters);
+ for $f (values %$configs) {
+ for $l (@$f) {
+ if (! exists $l->{'meta'}->{'directive'} ||
+ ($l->{'meta'}->{'directive'} ne 'snmpNotifyFilterTable')) {
+ next;
+ }
+ if (exists $keys->{'profileName'} &&
+ $l->{'meta'}->{'profileName'} ne $keys->{'profileName'})
+ {
+ next;
+ }
+ push @filters, $l;
+ }
+ }
+ return @filters;
+}
+
+sub get_filterProfiles
+{
+ my ($keys, $configs)=@_;
+ my ($f, $l, @targetAddrs);
+ for $f (values %$configs) {
+ for $l (@$f) {
+ if (! exists $l->{'meta'}->{'directive'} ||
+ ($l->{'meta'}->{'directive'} ne 'snmpNotifyFilterProfileTable')) {
+ next;
+ }
+ if (exists $keys->{'paramName'} &&
+ $l->{'meta'}->{'paramName'} ne $keys->{'paramName'}) {
+ next;
+ }
+ if (exists $keys->{'profileName'} &&
+ $l->{'meta'}->{'profileName'} ne $keys->{'profileName'})
+ {
+ next;
+ }
+ push @targetAddrs, $l;
+ }
+ }
+ return @targetAddrs;
+}
+
+sub tag_in_taglist
+{
+ my ($tag, $taglist) = @_;
+ my (@tags) = split /[ \t\r\n]/,$taglist;
+ my ($t);
+ for $t (@tags) {
+ if ($t eq $tag) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+sub notifyName_exists
+{
+ my ($name) = @_;
+ my ($file, $line, $meta);
+ for $file (values %::MASF_CONFIGS, values %::SMA_CONFIGS) {
+ for $line (@$file) {
+ $meta=$line->{'meta'};
+ if (exists $meta->{'notifyName'} &&
+ $meta->{'notifyName'} eq $name) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+sub tag_exists
+{
+ my ($tag) = @_;
+ my ($file, $line, $meta);
+ for $file (values %::MASF_CONFIGS, values %::SMA_CONFIGS) {
+ for $line (@$file) {
+ $meta = $line->{'meta'};
+ if (exists $meta->{'tagList'} &&
+ tag_in_taglist ($tag, $meta->{'tagList'})) {
+ return 1;
+ }
+ if (exists $meta->{'notifyTag'} &&
+ $tag eq $meta->{'notifyTag'}) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+sub get_new_profileName
+{
+ my ($i) = (0);
+ my ($try) = ('masfProfile'.$i);
+ while (profileName_exists($try)) {
+ $i++;
+ $try = 'masfProfile'.$i;
+ }
+ if (length $try > 32) {
+ log_message "Unable to generate unique profileName\n";
+ exit 1;
+ }
+ return $try;
+}
+
+sub generate_notify_tags
+{
+ my ($prefix) = @_;
+ my ($i) = (0);
+ while (tag_exists ($prefix.$i) ||
+ notifyName_exists ($prefix.$i)) {
+ $i++;
+ }
+ if (length ($prefix.$i) > 255) {
+ log_message "Unable to generate valid tag for prefix ".$prefix."\n";
+ exit 1;
+ }
+ return $prefix.$i;
+}
+
+sub get_new_paramName
+{
+ my ($i) = (0);
+ while (paramName_exists('masfParam'.$i)) {
+ $i++;
+ }
+ if (length 'masfParam'.$i > 32) {
+ log_message "Unable to generate unique paramName.\n";
+ exit 1;
+ }
+ return 'masfParam'.$i;
+}
+
+sub get_new_targetName
+{
+ my ($host)=@_;
+ my ($i)=(0);
+ my ($try)=('masfTarget'.$i.$host);
+ while (targetName_exists($try) || length $try > 32) {
+ if (length $try > 32) {
+ chop $host;
+ if (length $host == 0) {
+ log_message "Unable to generate unique targetName\n";
+ exit 1;
+ }
+ } else {
+ $i++;
+ }
+ $try = 'masfTarget'.$i.$host;
+ }
+ return $try;
+}
+
+sub paramName_exists
+{
+ my ($paramName) = @_;
+ my ($keys) = ({'paramName'=>$paramName});
+ my (@lines) = (get_targetParams($keys, \%::SMA_CONFIGS),
+ get_targetParams($keys, \%::MASF_CONFIGS),
+ get_targetAddrs($keys, \%::SMA_CONFIGS),
+ get_targetAddrs($keys, \%::MASF_CONFIGS));
+ if (@lines) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub profileName_exists
+{
+ my ($name) = @_;
+ my ($file, $line, $meta);
+ for $file (values %::MASF_CONFIGS, values %::SMA_CONFIGS) {
+ for $line (@$file) {
+ $meta=$line->{'meta'};
+ if (exists $meta->{'profileName'} &&
+ $meta->{'profileName'} eq $name) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+sub targetName_exists
+{
+ my ($targetName) = @_;
+ my ($keys) = ({'targetName'=>$targetName});
+ my (@lines) = (get_targetAddrs($keys, \%::SMA_CONFIGS),
+ get_targetAddrs($keys, \%::MASF_CONFIGS));
+ if (@lines) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+# get all target addresses with the specified keys
+sub get_targetAddrs
+{
+ my ($keys, $configs)=@_;
+ my ($f, $l, @targetAddrs);
+ for $f (values %$configs) {
+ for $l (@$f) {
+ if (! exists $l->{'meta'}->{'directive'} ||
+ ($l->{'meta'}->{'directive'} ne 'targetAddr')) {
+ next;
+ }
+ if (exists $keys->{'paramName'} &&
+ $l->{'meta'}->{'paramName'} ne $keys->{'paramName'}) {
+ next;
+ }
+ if (exists $keys->{'TDomain'} &&
+ $l->{'meta'}->{'TDomain'} ne $keys->{'TDomain'})
+ {
+ next;
+ }
+ if (exists $keys->{'TAddress'} &&
+ $l->{'meta'}->{'TAddress'} ne $keys->{'TAddress'})
+ {
+ next;
+ }
+ if (exists $keys->{'targetName'} &&
+ $l->{'meta'}->{'targetName'} ne $keys->{'targetName'})
+ {
+ next;
+ }
+ push @targetAddrs, $l;
+ }
+ }
+ return @targetAddrs;
+}
+
+# get all target parameters with the specified keys
+sub get_targetParams
+{
+ my ($keys, $configs)=@_;
+ my ($f, $l, @targetParams);
+ for $f (values %$configs) {
+ for $l (@$f) {
+ if (! exists $l->{'meta'}->{'directive'} ||
+ ($l->{'meta'}->{'directive'} ne 'targetParams')) {
+ next;
+ }
+ if (exists $keys->{'paramName'} &&
+ $l->{'meta'}->{'paramName'} ne $keys->{'paramName'}) {
+ next;
+ }
+ if (exists $keys->{'securityModel'} &&
+ $l->{'meta'}->{'securityModel'} ne $keys->{'securityModel'})
+ {
+ next;
+ }
+ if (exists $keys->{'securityLevel'} &&
+ $l->{'meta'}->{'securityLevel'} ne $keys->{'securityLevel'})
+ {
+ next;
+ }
+ if (exists $keys->{'securityName'} &&
+ $l->{'meta'}->{'securityName'} ne $keys->{'securityName'})
+ {
+ next;
+ }
+ push @targetParams, $l;
+ }
+ }
+ return @targetParams;
+}
+
+sub process_trapsink
+{
+ my ($sinkLine, $informTag, $trapTag) = @_;
+ my ($paramName, @paramLines, $community, @result, $secModel,
+ $MPModel, $notifyType, %profiles, $foundParams);
+ log_message "Migrating trapsink: ".$sinkLine->{'new'}."\n";
+ if ($sinkLine->{'meta'}->{'directive'} eq 'trapsink') {
+ $secModel = $SECURITY_MODEL_SNMPV1;
+ $MPModel = $MPMODEL_SNMPV1;
+ } elsif ($sinkLine->{'meta'}->{'directive'} eq 'trap2sink' ||
+ $sinkLine->{'meta'}->{'directive'} eq 'informsink') {
+ $secModel = $SECURITY_MODEL_SNMPV2C;
+ $MPModel = $MPMODEL_SNMPV2C;
+ }
+ if ($sinkLine->{'meta'}->{'directive'} eq 'informsink') {
+ $notifyType = $NOTIFY_TYPE_INFORM;
+ } else {
+ $notifyType = $NOTIFY_TYPE_TRAP;
+ }
+ $community = $sinkLine->{'meta'}->{'community'};
+
+ # try to find an existing target param in SMA config but don't bother if we
+ # don't care about overlap
+ if ($::EXTEND_SMA_FILTERS) {
+ @paramLines = (get_targetParams({'securityName'=>$community,
+ 'securityModel'=>$SECURITY_MODEL_SNMPV2C}, \%::SMA_CONFIGS),
+ get_targetParams({'securityName'=>$community,
+ 'securityModel'=>$SECURITY_MODEL_SNMPV1}, \%::SMA_CONFIGS));
+ }
+
+ my ($smaParamLine, $smaTargetLine);
+ my ($targetName, @targetAddrs);
+ my ($host) = $sinkLine->{'meta'}->{'host'};
+ my ($port) = $sinkLine->{'meta'}->{'port'};
+
+ if (@paramLines) {
+ my ($paramLine);
+ for $paramLine (@paramLines) {
+ $paramName = $paramLine->{'meta'}->{'paramName'};
+ push @targetAddrs, get_targetAddrs({'TDomain'=>$SNMP_UDP_DOMAIN,
+ 'TAddress'=>hostnameToUDPDomain($host.':'.$port),
+ 'paramName'=>$paramName}, \%::SMA_CONFIGS)
+ }
+
+ # try to use an existing targetAddr if it was defined
+ if (@targetAddrs > 0) {
+ $smaTargetLine = $targetAddrs[0];
+ ($smaParamLine) = get_targetParams({'paramName'=>$smaTargetLine->{'meta'}->{'paramName'}}, \%::SMA_CONFIGS);
+ $foundParams = 1;
+ }
+ }
+
+ if (! $foundParams || ! $::KEEP_SNMP_TARGET_PARAMS) {
+ # we need to generate a new set of params
+ $paramName = get_new_paramName();
+ push @result, {'meta'=>{'directive'=>'targetParams',
+ 'paramName'=>$paramName,
+ 'MPModel'=>$MPModel,
+ 'securityModel'=>$secModel,
+ 'securityName'=>$community,
+ 'securityLevel'=>$SECURITY_LEVEL_AUTHNOPRIV,
+ 'storageType'=>$DEFAULT_STORAGE_TYPE,
+ 'rowStatus'=>$DEFAULT_ROW_STATUS}
+ };
+ }
+
+ my (@profiles, $profileName);
+
+ if (! $foundParams) {
+ # no equivalent SMA target found - only MASF traps to be delivered
+ # generate our own targetAddr
+ my ($i) = (0);
+ $targetName = get_new_targetName($host);
+ push @result, {'meta'=>{'directive'=>'targetAddr',
+ 'targetName'=>$targetName,
+ 'TDomain'=>$SNMP_UDP_DOMAIN,
+ 'TAddress'=>hostnameToUDPDomain($host.':'.$port),
+ 'timeout'=>1500,
+ 'retryCount'=>3,
+ 'tagList'=>$notifyType == $NOTIFY_TYPE_INFORM ? $informTag :
+ $trapTag,
+ 'paramName'=>$paramName,
+ 'storageType'=>$DEFAULT_STORAGE_TYPE,
+ 'rowStatus'=>$DEFAULT_ROW_STATUS}};
+ # need to add a filter profile
+ $profileName = get_new_profileName();
+ } elsif (! $::KEEP_SNMP_TARGET_PARAMS) {
+ # we need to change the targetAddr to refer to the new set of params
+ $targetName = $smaTargetLine->{'meta'}->{'targetName'};
+ $smaTargetLine->{'meta'}->{'paramName'} = $paramName;
+ $smaTargetLine->{'meta'}->{'tagList'} =
+ ($notifyType == $NOTIFY_TYPE_INFORM ? $informTag : $trapTag);
+ replace_line(\%::SMA_CONFIGS, $smaTargetLine, $smaTargetLine);
+
+ # set our params to use the new set of filter profiles
+ @profiles = get_filterProfiles(
+ {'paramName'=>$smaParamLine->{'meta'}->{'paramName'}},
+ \%::SMA_CONFIGS);
+ if (@profiles > 0) {
+ $profileName = $profiles[0]->{'meta'}->{'profileName'};
+ } else {
+ # no filter profiles defined
+ return @result;
+ }
+ } else {
+ # don't change existing target specification
+ # SMA profiles already have MASF added.
+ return @result;
+ }
+
+ push @result, {'meta'=>{'directive'=>'snmpNotifyFilterProfileTable',
+ 'paramName'=>$paramName,
+ 'profileName'=>$profileName,
+ 'storageType'=>$DEFAULT_STORAGE_TYPE,
+ 'rowStatus'=>$DEFAULT_ROW_STATUS}
+ };
+
+ if ($foundParams) {
+ return @result;
+ }
+
+ # add some filters
+ push @result,
+ {'comment'=>'# Include ENTITY-MIB and SUN-PLATFORM-MIB in profile',
+ 'meta'=>{'directive'=>'snmpNotifyFilterTable',
+ 'profileName'=>$profileName,
+ 'subtree'=>$ENTITY_MIB_OID,
+ 'mask'=>'',
+ 'filterType'=>$FILTER_TYPE_INCLUDED,
+ 'storageType'=>$DEFAULT_STORAGE_TYPE,
+ 'rowStatus'=>$DEFAULT_ROW_STATUS
+ }},
+ {'meta'=>{'directive'=>'snmpNotifyFilterTable',
+ 'profileName'=>$profileName,
+ 'subtree'=>$SUNPLAT_MIB_OID,
+ 'mask'=>'',
+ 'filterType'=>$FILTER_TYPE_INCLUDED,
+ 'storageType'=>$DEFAULT_STORAGE_TYPE,
+ 'rowStatus'=>$DEFAULT_ROW_STATUS
+ }};
+ return @result;
+}
+
+sub process_trapsinks
+{
+ # grab all the trapsink, trap2sink and informsink lines in MASF
+ my (@sinkLines) = (get_lines('trapsink', \%::MASF_CONFIGS),
+ get_lines('trap2sink', \%::MASF_CONFIGS),
+ get_lines('informsink', \%::MASF_CONFIGS));
+ my ($sinkLine, $paramName, @paramLines, $community, @result, $secModel,
+ $MPModel, $notifyType, $informTag, $trapTag, %profiles, $foundParams);
+ %profiles=();
+ foreach $sinkLine (@sinkLines) {
+ $paramName = undef;
+ @result = ();
+ $foundParams = 0;
+ log_message "Processing trapsink: ".$sinkLine->{'new'}."\n";
+ if (!defined $informTag) {
+ $informTag = generate_notify_tags('masfInformTag');
+ log_message "Using tag ".$informTag." for informs\n";
+ $trapTag = generate_notify_tags('masfTrapTag');
+ log_message "Using tag ".$trapTag." for traps\n";
+ push @result, {'meta'=>{'directive'=>'snmpNotifyTable',
+ 'notifyName'=>$informTag,
+ 'notifyTag'=>$informTag,
+ 'notifyType'=>$NOTIFY_TYPE_INFORM,
+ 'storageType'=>$DEFAULT_STORAGE_TYPE,
+ 'rowStatus'=>$DEFAULT_ROW_STATUS
+ }},
+ {'meta'=>{'directive'=>'snmpNotifyTable',
+ 'notifyName'=>$trapTag,
+ 'notifyTag'=>$trapTag,
+ 'notifyType'=>$NOTIFY_TYPE_TRAP,
+ 'storageType'=>$DEFAULT_STORAGE_TYPE,
+ 'rowStatus'=>$DEFAULT_ROW_STATUS
+ }};
+ }
+ push @result, process_trapsink($sinkLine, $informTag, $trapTag);
+ replace_line(\%::MASF_CONFIGS, $sinkLine, @result);
+ }
+}
+
+sub extend_sma_trap_filters
+{
+ my (@lines, $line);
+ @lines = get_lines('snmpNotifyFilterTable', \%::SMA_CONFIGS);
+ my (%hash);
+ foreach $line (@lines) {
+ if (!exists $hash{$line->{'meta'}->{'profileName'}}) {
+ log_message "Adding ENTITY-MIB and SUN-PLATFORM-MIB traps to ".
+ "trap filter profile ".$line->{'meta'}->{'profileName'}."\n";
+ $hash{$line->{'meta'}->{'profileName'}}=undef;
+ insert_lines(\%::SMA_CONFIGS, $line, 0,
+ {'comment'=>'# Include ENTITY-MIB and SUN-PLATFORM-MIB in profile',
+ 'meta'=>{'directive'=>'snmpNotifyFilterTable',
+ 'profileName'=>$line->{'meta'}->{'profileName'},
+ 'subtree'=>$ENTITY_MIB_OID,
+ 'mask'=>'',
+ 'filterType'=>$FILTER_TYPE_INCLUDED,
+ 'storageType'=>$DEFAULT_STORAGE_TYPE,
+ 'rowStatus'=>$DEFAULT_ROW_STATUS}},
+ {'meta'=>{'directive'=>'snmpNotifyFilterTable',
+ 'profileName'=>$line->{'meta'}->{'profileName'},
+ 'subtree'=>$SUNPLAT_MIB_OID,
+ 'mask'=>'',
+ 'filterType'=>$FILTER_TYPE_INCLUDED,
+ 'storageType'=>$DEFAULT_STORAGE_TYPE,
+ 'rowStatus'=>$DEFAULT_ROW_STATUS}});
+ }
+ }
+}
+
+sub process_trapcommunity
+{
+ my ($configs)=@_;
+ my ($i, $file, $trapcommunity, $meta);
+ $trapcommunity = 'public';
+ foreach $file (values %$configs) {
+ for ($i = 0; $i < @$file; $i++) {
+ $meta = $file->[$i]->{'meta'};
+ if (! exists $file->[$i]->{'meta'}->{'directive'}) {
+ next;
+ }
+ if ($meta->{'directive'} eq 'trapcommunity') {
+ $trapcommunity = $meta->{'community'};
+ replace_line($configs, $file->[$i], {'meta'=>{}});
+ next;
+ }
+ if ($meta->{'directive'} eq 'trapsink' ||
+ $meta->{'directive'} eq 'trap2sink' ||
+ $meta->{'directive'} eq 'informsink') {
+ if (! exists $meta->{'community'}) {
+ $meta->{'community'} = $trapcommunity;
+ replace_line($configs, $file->[$i], $file->[$i]);
+ }
+ if (! exists $meta->{'port'}) {
+ $meta->{'port'} = 162;
+ replace_line($configs, $file->[$i], $file->[$i]);
+ }
+ }
+ }
+ }
+}
+
+sub check_duplicate_trap_destinations
+{
+ my (@smaTraps) = (get_lines('informsink', \%::SMA_CONFIGS),
+ get_lines('trapsink', \%::SMA_CONFIGS),
+ get_lines('trap2sink', \%::SMA_CONFIGS));
+ my (@masfTraps) = (get_lines('informsink', \%::MASF_CONFIGS),
+ get_lines('trapsink', \%::MASF_CONFIGS),
+ get_lines('trap2sink', \%::MASF_CONFIGS));
+ my ($trap, @matches, $match);
+ for $trap (@masfTraps) {
+ @matches = grep (
+ ($_->{'meta'}->{'community'} eq $trap->{'meta'}->{'community'} &&
+ $_->{'meta'}->{'host'} eq $trap->{'meta'}->{'host'} &&
+ $_->{'meta'}->{'port'} eq $trap->{'meta'}->{'port'}), @smaTraps);
+ if (@matches) {
+ # remove this duplicate
+ log_message "Removing duplicate ".$trap->{'meta'}->{'directive'}." directive\n", $trap;
+ replace_line(\%::MASF_CONFIGS, $trap, {'meta'=>{}});
+ }
+ }
+}
+
+##############################################################################
+# Access control, groups and users
+
+$::SEEDED = 0;
+
+sub remove_v3_users
+{
+ my (@users) = get_securityNames({'securityModel'=>'usm'}, \%::MASF_CONFIGS);
+ my ($user, @groups, $group);
+ for $user (@users) {
+ replace_line(\%::MASF_CONFIGS, $user, {'meta'=>{}});
+ @groups = get_groups($user->{'meta'}, \%::MASF_CONFIGS);
+ for $group (@groups) {
+ replace_line(\%::MASF_CONFIGS, $group, {'meta'=>{}});
+ }
+ }
+}
+
+sub remove_v1v2c_users
+{
+ my (@users) = get_securityNames({'securityModel'=>'v1'}, \%::MASF_CONFIGS);
+ my ($user, @groups, $group);
+ for $user (@users) {
+ replace_line(\%::MASF_CONFIGS, $user, {'meta'=>{}});
+ @groups = get_groups($user->{'meta'}, \%::MASF_CONFIGS);
+ for $group (@groups) {
+ replace_line(\%::MASF_CONFIGS, $group, {'meta'=>{}});
+ }
+ }
+}
+
+sub generate_password
+{
+ my ($i, $r, $pwd);
+ if (! $::SEEDED) {
+ srand;
+ $::SEEDED=1;
+ }
+
+ for ($i = 0; $i < 8; $i++) {
+ do {
+ $r = chr (int (rand 127));
+ } while ($r!~/^[a-zA-Z0-9]$/);
+ $pwd.=$r;
+ }
+ return $pwd;
+}
+
+# check to see whether MASF UsmUser directives can be transferred without
+# alteration, if not then convert to a template createUser statement
+sub process_engineIDs
+{
+ log_message "\n";
+ log_message "Checking to see if USM users defined in usmUser directives can be migrated without modification:\n";
+ my ($lines, $line, $can_migrate);
+ $can_migrate = 1;
+ # check that no v3 users have been specified in SMA
+ my (@v3_sma_users) = (get_securityNames({'securityModel'=>'usm'}, \%::SMA_CONFIGS));
+ if (@v3_sma_users > 0) {
+ log_message "V3 users were specified in SMA config - cannot migrate without modification.\n";
+ $can_migrate = 0;
+ }
+ # If the engineID was specified in MASF then we cannot migrate. Remove it
+ # from the migrated configuration
+ for $line (get_lines('engineID', \%::MASF_CONFIGS)) {
+ $can_migrate = 0;
+ log_message "engineID specified in configuration file - cannot migrate without modification.\n", $line;
+ replace_line(\%::MASF_CONFIGS, $line, {'meta'=>{}});
+ }
+ # check that engineID isn't specified anywhere in SMA config
+ for $line (get_lines('engineID', \%::SMA_CONFIGS)) {
+ log_message "engineID specified in configuration file - cannot migrate without modification.\n", $line;
+ $can_migrate = 0;
+ }
+
+ if (! $can_migrate) {
+ for $line (get_lines('usmUser', \%::MASF_CONFIGS)) {
+ if (! $::IGNORE_ENGINEID) {
+ log_message "User with securityName ".
+ $line->{'meta'}->{'securityName'}." cannot be migrated ".
+ "because the engineID has changed - aborting.\n", $line;
+ exit 1;
+ }
+ log_message "\n";
+ log_message "***************************************************************************\n";
+ log_message 'User with securityName '.
+ $line->{'meta'}->{'securityName'}." has had their password reset.\n";
+ log_message "You will need to edit the configuration file after ".
+ "this script has finished\n".
+ "in order to enable their account\n";
+ log_message "***************************************************************************\n";
+ replace_line(\%::MASF_CONFIGS, $line,
+ {'comment'=>'# XXX Change the password if necessary',
+ 'meta'=>{'directive'=>'createUser',
+ 'securityModel'=>'usm',
+ 'securityName'=>$line->{'meta'}->{'securityName'},
+ 'authPassword'=>generate_password(),
+ 'authProtocol'=>'MD5'}});
+ }
+ # if we can't migrate the engineID, then remove any oldEngineID
+ # statements and engineBoots statements
+ for $line (get_lines('oldEngineID', \%::MASF_CONFIGS),
+ get_lines('engineBoots', \%::MASF_CONFIGS)) {
+ replace_line(\%::MASF_CONFIGS, $line, {'meta'=>{}});
+ }
+ return;
+ } else {
+ log_message "OK to migrate usm users\n";
+ }
+
+ # check to see if oldEngineID or engineBoots is defined in SMA config - if
+ # so then squash it in favour of new one from MASF
+ for $line (get_lines('oldEngineID', \%::SMA_CONFIGS),
+ get_lines('engineBoots', \%::SMA_CONFIGS)) {
+ replace_line(\%::SMA_CONFIGS, $line, {'meta'=>{}});
+ }
+}
+
+# ensure that if a createUser and usmUser directive is present for the same
+# securityName then the createUser directive takes precedence
+sub check_usm_securityNames
+{
+ my (@masfUserLines)=(get_securityNames({'securityModel'=>'usm'},
+ \%::MASF_CONFIGS));
+ my (@smaUserLines)=(get_securityNames({'securityModel'=>'usm'},
+ \%::SMA_CONFIGS));
+ my ($usmUser, $user, $config);
+ for $config (\%::MASF_CONFIGS, \%::SMA_CONFIGS) {
+ my (@userLines) = (get_securityNames({'securityModel'=>'usm'},
+ $config));
+ my (@createUsers) = (grep 'createUser' eq $_->{'meta'}->{'directive'}, @userLines);
+ for $user (@createUsers) {
+ my (@usmUsers) = (grep (('usmUser' eq $_->{'meta'}->{'directive'}
+ && $user->{'meta'}->{'securityName'} eq
+ $_->{'meta'}->{'securityName'}), @userLines));
+ for $usmUser (@usmUsers) {
+ replace_line($config, $usmUser, {'meta'=>{}});
+ }
+ }
+ }
+}
+
+sub choose_group_membership
+{
+ my ($smaSecurityName, $masfSecurityName) = @_;
+ # interactive mode
+ convert_metadata();
+ log_message "\nThis user is defined in SMA with the following configuration:\n";
+ # get the config:
+ my ($o, $n) = get_old_new_config($smaSecurityName,
+ \%::SMA_CONFIGS);
+
+ log_message "Original configuration:\n".join ("\n",@$o);
+ log_message "\n\nProposed configuration 1:\n".join ("\n",@$n);
+ ($o, $n) = get_old_new_config($masfSecurityName, \%::MASF_CONFIGS);
+ log_message "\n\nIt conflicts with the following MASF configuration:\nOriginal configuration:\n".join ("\n", @$o);
+ log_message "\n\nProposed configuration 2:\n".join ("\n",@$n)."\n";
+ my ($response) = (prompt ("Please choose one of the".
+ " proposed configurations", 1, [1,2]));
+ if ($response == 1) {
+ remove_com2sec_user ({'securityName'=>$masfSecurityName}, \%::MASF_CONFIGS);
+ } else {
+ remove_com2sec_user ({'securityName'=>$smaSecurityName}, \%::SMA_CONFIGS);
+ }
+}
+
+sub process_usm_securityNames
+{
+ my ($file, $line, $fileb, $lineb, $snameLine, $sname, $conflicted);
+ for $snameLine (get_securityNames({'securityModel'=>'usm'}, \%::MASF_CONFIGS)) {
+ $sname = $snameLine->{'meta'}->{'securityName'};
+ $conflicted = undef;
+ for $file (values %::SMA_CONFIGS) {
+ for $line (@$file) {
+ if (exists $line->{'meta'}->{'securityName'} &&
+ $line->{'meta'}->{'securityName'} eq $sname) {
+ $conflicted=$line;
+ last;
+ }
+ }
+ }
+ if (defined $conflicted) {
+ # there is a clash
+ log_message "MASF securityName ".$sname." conflicts with one already defined in SMA\n", $snameLine;
+ if ($::KEEP_SMA_USM_USERS) {
+ remove_com2sec_user($snameLine->{'meta'}, \%::MASF_CONFIGS);
+ } elsif ($::KEEP_MASF_USM_USERS) {
+ remove_com2sec_user($conflicted->{'meta'}, \%::SMA_CONFIGS);
+ } elsif ($::AUTOMATED) {
+ log_message "Conflicting securityNames found - aborting. Please resolve these conflicts\n".
+ "manually.\n";
+ exit 1;
+ } else {
+ choose_group_membership($conflicted->{'meta'}->{'securityName'}, $sname);
+ }
+ }
+ }
+}
+
+sub remove_com2sec_user
+{
+ my ($keys, $config)=@_;
+ my ($securityName)=($keys->{'securityName'});
+ my ($f, $l);
+ for $l (get_securityNames($keys, $config)) {
+ replace_line ($config, $l, {'meta'=>{}});
+ }
+ for $f (values %$config) {
+ for $l (@$f) {
+ if (exists $l->{'meta'}->{'directive'} &&
+ $l->{'meta'}->{'directive'} eq 'group' &&
+ $l->{'meta'}->{'securityName'} eq $securityName) {
+ replace_line($config, $l, {'meta'=>{}});
+ }
+ }
+ }
+}
+
+# get all lines which define a security name i.e. com2sec, createUser or
+# usmUser, according to specified keys
+sub get_securityNames
+{
+ my ($keys, $configs)=@_;
+ my ($f, $l, @securityNames);
+ for $f (values %$configs) {
+ for $l (@$f) {
+ if (! exists $l->{'meta'}->{'directive'} ||
+ ($l->{'meta'}->{'directive'} ne 'createUser' &&
+ $l->{'meta'}->{'directive'} ne 'usmUser' &&
+ $l->{'meta'}->{'directive'} ne 'com2sec')) {
+ next;
+ }
+ if (exists $keys->{'securityName'} &&
+ $l->{'meta'}->{'securityName'} ne $keys->{'securityName'}) {
+ next;
+ }
+ if (exists $keys->{'securityModel'}) {
+ my ($sm) = ('usm');
+ if ($keys->{'securityModel'} eq 'v2c' ||
+ $keys->{'securityModel'} eq 'v1') {
+ $sm = 'v1';
+ }
+ if (($sm eq 'v1' &&
+ $l->{'meta'}->{'directive'} ne 'com2sec') ||
+ ($sm eq 'usm' &&
+ ($l->{'meta'}->{'directive'} ne 'createUser' &&
+ $l->{'meta'}->{'directive'} ne 'usmUser'))) {
+ next;
+ }
+ }
+ push @securityNames, $l;
+ }
+ }
+ return @securityNames;
+}
+
+sub get_groups
+{
+ my ($keys, $configs)=@_;
+ my ($f, $l, @groups);
+ for $f (values %$configs) {
+ for $l (@$f) {
+ if (! exists $l->{'meta'}->{'directive'} ||
+ $l->{'meta'}->{'directive'} ne 'group') {
+ next;
+ }
+ if (exists $keys->{'securityName'} &&
+ $l->{'meta'}->{'securityName'} ne $keys->{'securityName'}) {
+ next;
+ }
+ if (exists $keys->{'securityModel'} &&
+ $l->{'meta'}->{'securityModel'} ne $keys->{'securityModel'}) {
+ next;
+ }
+ if (exists $keys->{'groupName'} &&
+ $l->{'meta'}->{'groupName'} ne $keys->{'groupName'}) {
+ next;
+ }
+ push @groups, $l
+ }
+ }
+ return @groups;
+}
+
+sub get_access {
+ my ($keys, $configs)=@_;
+ my ($f, $l, @access);
+ for $f (values %$configs) {
+ for $l (@$f) {
+ if (! exists $l->{'meta'}->{'directive'} ||
+ $l->{'meta'}->{'directive'} ne 'access') {
+ next;
+ }
+ if (exists $keys->{'groupName'} &&
+ $l->{'meta'}->{'groupName'} ne $keys->{'groupName'}) {
+ next;
+ }
+ if (exists $keys->{'viewName'} &&
+ ($l->{'meta'}->{'readView'} ne $keys->{'viewName'} &&
+ $l->{'meta'}->{'writeView'} ne $keys->{'viewName'} &&
+ $l->{'meta'}->{'notifyView'} ne $keys->{'viewName'})) {
+ next;
+ }
+ push @access, $l
+ }
+ }
+ return @access;
+}
+
+sub get_views {
+ my ($keys, $configs)=@_;
+ my ($f, $l, @views);
+ if (exists $keys->{'viewName'} &&
+ $keys->{'viewName'} eq '') {
+ return ();
+ }
+ for $f (values %$configs) {
+ for $l (@$f) {
+ if (! exists $l->{'meta'}->{'directive'} ||
+ $l->{'meta'}->{'directive'} ne 'view') {
+ next;
+ }
+ if (exists $keys->{'viewName'} &&
+ $l->{'meta'}->{'viewName'} ne $keys->{'viewName'}) {
+ next;
+ }
+ push @views, $l
+ }
+ }
+ return @views;
+}
+
+sub get_old_new_config
+{
+ my ($securityName, $configs) = @_;
+ my ($line, @secNames, @groups, $group, $access, @accesses, @views, @old, @new);
+ my (@a, $keys);
+ $keys = {'securityName'=>$securityName};
+ @secNames = get_securityNames($keys, $configs);
+ @groups = get_groups ({'securityName'=>$securityName}, $configs);
+ # get other members of this group
+ if (@groups > 0) {
+ @groups = set_union([get_groups({'groupName'=>$groups[0]->{'meta'}->{'groupName'}}, $configs)], \@groups);
+ }
+ for $group (@groups) {
+ (@accesses) = (set_union(\@accesses, [get_access($group->{'meta'}, $configs)]));
+ }
+ for $access (@accesses) {
+ $keys = {'viewName'=>$access->{'meta'}->{'readView'}};
+ (@views) = (set_union(\@views, [get_views($keys, $configs)]));
+ $keys->{'viewName'}=$access->{'meta'}->{'writeView'};
+ (@views) = (set_union(\@views, [get_views($keys, $configs)]));
+ $keys->{'viewName'}=$access->{'meta'}->{'notifyView'};
+ (@views) = (set_union(\@views, [get_views($keys, $configs)]));
+ }
+ for $line (@secNames, @groups, @accesses, @views) {
+ if (exists $line->{'orig'}) {
+ push @old, $line->{'orig'};
+ }
+ if (exists $line->{'new'}) {
+ push @new, $line->{'new'};
+ }
+ }
+ return [@old], [@new];
+}
+
+sub parse_source
+{
+ my ($line) = @_;
+ my ($source) = $line->{'meta'}->{'source'};
+ my ($hostIP, $mask, $ipSegment);
+ # was it 'default'
+ if ($source eq 'default' || $source eq '0.0.0.0') {
+ return (inet_aton('0.0.0.0'), inet_aton('0.0.0.0'));
+ }
+ # try to resolve as a plain IP address or a hostname
+ $ipSegment=$source;
+ ($ipSegment, $mask) = split /\//, $source;
+ # try to resolve hostname as an IP address
+ my ($hostent) = gethostbyname($ipSegment);
+ if (defined $hostent) {
+ if ($hostent->addrtype ne AF_INET) {
+ log_message "Unsupported address family in source $source\n", $line;
+ exit 1;
+ }
+ my (@hostIPs) = @{$hostent->addr_list};
+ log_message "resolved $source to ".inet_ntoa($hostIPs[0])."\n", $line;
+ $hostIP = $hostIPs[0];
+ } else {
+ log_message "Couldn't resolve $ipSegment as a hostname or IP address\n", $line;
+ exit 1;
+ }
+ # try to resolve as subnet/mask
+ if (defined $mask && $mask ne '') {
+ my $netmask;
+ $netmask = inet_aton($mask);
+ if (! defined $netmask) {
+
+ # try to interpret as number between 0 and 32
+ my ($bit) = (0x80000000);
+ $netmask = 0;
+ if ($mask < 0 || $mask > 32) {
+ log_message "$source did not contain a valid netmask.\n", $line;
+ exit 1;
+ }
+ while ($mask > 0) {
+ $netmask |= $bit;
+ $bit = $bit >> 1;
+ }
+ }
+ my ($N, $H) = (in_addr_to_number ($netmask), in_addr_to_number
+ ($hostIP));
+ if ($H & ~$N) {
+ log_message("source/mask mismatch - ".inet_ntoa($hostIP).'/'.inet_ntoa($netmask)."\n", $line);
+ exit 1;
+ }
+ return ($hostIP, $netmask);
+ } else {
+ # no netmask specified - exact match
+ return ($hostIP, inet_aton('255.255.255.255'));
+ }
+}
+
+sub source_overlap
+{
+ my ($linea, $lineb) = @_;
+ my ($ipa, $maska) = parse_source($linea);
+ my ($ipb, $maskb) = parse_source($lineb);
+ my $mask_overlap;
+ $ipa = in_addr_to_number($ipa);
+ $ipb = in_addr_to_number($ipb);
+ $mask_overlap = in_addr_to_number($maska) & in_addr_to_number($maskb);
+ my $complement = 0xffffffff & (~$mask_overlap);
+ if (($ipa & $mask_overlap | $complement) == ($ipb & $mask_overlap | $complement)) {
+ return 1;
+ }
+ return 0;
+}
+
+sub community_conflicts
+{
+ my ($linea)=@_;
+ my ($community, $source) = ($linea->{'meta'}->{'community'}, $linea->{'meta'}->{'source'});
+ my ($lines, $line);
+ for $lines (values %::SMA_CONFIGS) {
+ for $line (@$lines) {
+ if (! exists $line->{'meta'}->{'community'} ||
+ $line->{'meta'}->{'community'} ne $community) {
+ next;
+ }
+ if (! exists $line->{'meta'}->{'source'}) {
+ next;
+ }
+ if (source_overlap ($line, $linea)) {
+ return ($line);
+ }
+ }
+ }
+ return undef;
+}
+
+sub process_com2sec
+{
+ my ($lines, $line);
+ my $conflict;
+ for $lines (values %::MASF_CONFIGS) {
+ for $line (@$lines) {
+ if (! exists $line->{'meta'}->{'directive'} ||
+ $line->{'meta'}->{'directive'} ne 'com2sec') {
+ next;
+ }
+
+ $conflict = community_conflicts($line);
+ if (defined $conflict) {
+ log_message "MASF source ".$line->{'meta'}->{'source'}.
+ " conflicts with SMA source ".$conflict->{'meta'}->{'source'}.
+ " defined for community ".$line->{'meta'}->{'community'}."\n", $line;
+ if ($::KEEP_SMA_GROUPS) {
+ # remove user from MASF config
+ remove_com2sec_user ($line->{'meta'}, \%::MASF_CONFIGS);
+ } elsif ($::KEEP_MASF_GROUPS) {
+ # remove user from SMA config
+ remove_com2sec_user ($line->{'meta'}, \%::SMA_CONFIGS);
+ } elsif ($::AUTOMATED) {
+ # didn't define what to do so stop!
+ log_message "Conflicting source/communities found - ".
+ "aborting. Please resolve these conflicts manually.\n";
+ exit 1;
+ } else {
+ choose_group_membership($conflict->{'meta'}->{'securityName'}, $line->{'meta'}->{'securityName'});
+ }
+ }
+ }
+ }
+}
+
+sub uniquify_viewNames
+{
+ my ($prefix) = @_;
+ my %mappings=();
+ my ($lines, $line, $securityName, $i, @keys, $key, $from);
+ @keys = ('viewName', 'readView', 'writeView', 'notifyView');
+ for $lines (values %::MASF_CONFIGS) {
+ foreach $line (@$lines) {
+ for $key (@keys) {
+ if (exists $line->{'meta'}->{$key} &&
+ $line->{'meta'}->{$key} ne '') {
+ $from = $line->{'meta'}->{$key};
+ } else {
+ next;
+ }
+
+ # is there already a mapping for this securityName ?
+ if (exists $mappings{$from}) {
+ $line->{'meta'}->{$key} = $mappings{$from};
+ replace_line(\%::MASF_CONFIGS, $line, $line);
+ next;
+ }
+
+ # generate a new securityName
+ $i = 0;
+ while (viewName_exists($prefix.$i.$from))
+ {
+ $i++;
+ }
+ if (length $prefix.$i.$from > 32) {
+ log_message ("Couldn't render viewName $from unique\n", $line);
+ exit 1;
+ }
+ $mappings{$from}=$prefix.$i.$from;
+ $line->{'meta'}->{$key} = $prefix.$i.$from;
+ replace_line(\%::MASF_CONFIGS, $line, $line);
+ }
+ }
+ }
+ # remove redundant view names
+ my (@viewLines, @accessLines, $view, $config);
+ for $config (\%::MASF_CONFIGS, \%::SMA_CONFIGS) {
+ @viewLines = get_views({}, $config);
+ for $view (@viewLines) {
+ @accessLines = (get_access($view->{'meta'}, \%::MASF_CONFIGS), get_access($view->{'meta'}, \%::SMA_CONFIGS));
+ if (@accessLines == 0) {
+ replace_line($config, $view, {'meta'=>{}});
+ }
+ }
+ }
+}
+
+sub uniquify_groupNames
+{
+ my ($prefix) = @_;
+ my %mappings=();
+ my ($lines, $line, $securityName, $i, $from);
+ for $lines (values %::MASF_CONFIGS) {
+ foreach $line (@$lines) {
+ if (exists $line->{'meta'}->{'groupName'}) {
+ $from = $line->{'meta'}->{'groupName'};
+ } else {
+ next;
+ }
+
+ # is there already a mapping for this securityName ?
+ if (exists $mappings{$from}) {
+ $line->{'meta'}->{'groupName'} = $mappings{$from};
+ replace_line(\%::MASF_CONFIGS, $line, $line);
+ next;
+ }
+
+ # generate a new securityName
+ $i = 0;
+ while (groupName_exists($prefix.$i.$from))
+ {
+ $i++;
+ }
+ if (length $prefix.$i.$from > 32) {
+ log_message ("Couldn't render groupName $from unique\n", $line);
+ exit 1;
+ }
+ $mappings{$from}=$prefix.$i.$from;
+ $line->{'meta'}->{'groupName'} = $prefix.$i.$from;
+ replace_line(\%::MASF_CONFIGS, $line, $line);
+ }
+ }
+}
+
+# remove group directives referring to undefined users
+sub clean_group_membership
+{
+ my ($config);
+ for $config (\%::MASF_CONFIGS, \%::SMA_CONFIGS) {
+ my (@groups) = get_lines('group', $config);
+ my ($group);
+ for $group (@groups) {
+ my (@securityNames) = get_securityNames($group->{'meta'}, $config);
+ if (@securityNames == 0) {
+ # no securityName was defined for this directive - remove the
+ # directive
+ log_message "Removing undefined user ".
+ $group->{'meta'}->{'securityName'}." from group ".
+ $group->{'meta'}->{'groupName'}."\n", $group;
+ replace_line($config, $group, {'meta'=>{}});
+ }
+ }
+ }
+}
+
+sub uniquify_securityNames
+{
+ my ($prefix) = @_;
+ my ($to);
+ my ($lines, $line, $securityName, $i, $from, $fromLine);
+ for $fromLine (get_securityNames({'securityModel'=>'v1'},
+ \%::MASF_CONFIGS)) {
+ # generate a new securityName
+ $from = $fromLine->{'meta'}->{'securityName'};
+ $to = get_new_securityName($prefix.$from);
+ for $lines (values %::MASF_CONFIGS) {
+ foreach $line (@$lines) {
+ if (! exists $line->{'meta'}->{'securityName'} ||
+ $line->{'meta'}->{'securityName'} ne $from) {
+ next;
+ }
+
+ $line->{'meta'}->{'securityName'} = $to;
+ replace_line(\%::MASF_CONFIGS, $line, $line);
+ }
+ }
+ }
+}
+
+sub check_tokens
+{
+ my ($line, $minTokens, $maxTokens, @tokens) = @_;
+ my ($directive) = $line->{'meta'}->{'directive'};
+ if (@tokens < $minTokens || @tokens > $maxTokens) {
+ log_message "Invalid number of parameters for $directive directive ".
+ "- Aborting\n", $line;
+ exit 1;
+ }
+}
+
+# convert simple array of lines into hash containing data which is what we
+# subsequently modify
+sub add_metadata
+{
+ my ($lines, $file, $line, $i, $s, $directive, @tokens);
+ my ($key, $j);
+ for $key (keys %::SMA_CONFIGS) {
+ for ($i = 0; $i < @{$::SMA_CONFIGS{$key}}; $i++) {
+ $line = $::SMA_CONFIGS{$key}->[$i];
+ $::SMA_CONFIGS{$key}->[$i] = {'orig'=>$line,
+ 'new'=>$line,
+ # NB the 'meta' hash doesn't contain metadata, only real data...
+ 'meta'=>{},
+ 'lineno'=>$i,
+ 'file'=>$key};
+ }
+ }
+ for $key (keys %::MASF_CONFIGS) {
+ for ($i = 0; $i < @{$::MASF_CONFIGS{$key}}; $i++) {
+ $line = $::MASF_CONFIGS{$key}->[$i];
+ $::MASF_CONFIGS{$key}->[$i] = {'orig'=>$line,
+ 'new'=>$line,
+ 'meta'=>{},
+ 'lineno'=>$i,
+ 'file'=>$key};
+ }
+ }
+ for $lines (values %::SMA_CONFIGS, values %::MASF_CONFIGS) {
+ for $line (@$lines) {
+ ($directive, @tokens) = parse_config_line($line->{'new'});
+ if ($directive ne '') {
+ $line->{'meta'}->{'directive'} = $directive;
+ }
+ if ($directive eq 'com2sec') {
+ check_tokens($line, 3, 3, @tokens);
+ $line->{'meta'}->{'securityName'} = $tokens[0];
+ $line->{'meta'}->{'source'} = $tokens[1];
+ $line->{'meta'}->{'community'} = $tokens[2];
+ } elsif ($directive eq 'group') {
+ check_tokens($line, 3, 3, @tokens);
+ $line->{'meta'}->{'groupName'} = $tokens[0];
+ $line->{'meta'}->{'securityModel'} = $tokens[1];
+ $line->{'meta'}->{'securityName'} = $tokens[2];
+ } elsif ($directive eq 'rouser' || $directive eq 'rwuser') {
+ check_tokens($line, 1, 3, @tokens);
+ $line->{'meta'}->{'securityName'} = $tokens[0];
+ if (defined $tokens[1]) {
+ $line->{'meta'}->{'securityLevel'} = $tokens[1];
+ }
+ if (defined $tokens[2]) {
+ $line->{'meta'}->{'oid'} = $tokens[2];
+ }
+ } elsif ($directive eq 'createUser') {
+ check_tokens($line, 3, 5, @tokens);
+ $line->{'meta'}->{'securityName'} = $tokens[0];
+ $line->{'meta'}->{'authProtocol'} = $tokens[1];
+ $line->{'meta'}->{'authPassword'} = $tokens[2];
+ $line->{'meta'}->{'securityModel'} = 'usm';
+ if (defined $tokens[3]) {
+ $line->{'meta'}->{'privProtocol'} = $tokens[3];
+ }
+ if (defined $tokens[4]) {
+ $line->{'meta'}->{'privPassword'} = $tokens[4];
+ }
+ } elsif ($directive eq 'usmUser') {
+ check_tokens($line, 11, 11, @tokens);
+ $line->{'meta'}->{'securityName'} = securityName_from_usmUser($directive, @tokens);
+ $line->{'meta'}->{'securityModel'} = 'usm';
+ } elsif ($directive eq 'access') {
+ check_tokens($line, 8, 8, @tokens);
+ $line->{'meta'}->{'groupName'} = $tokens[0];
+ $line->{'meta'}->{'contextPrefix'} = $tokens[1];
+ $line->{'meta'}->{'securityModel'} = $tokens[2];
+ $line->{'meta'}->{'securityLevel'} = $tokens[3];
+ $line->{'meta'}->{'contextMatch'} = $tokens[4];
+ $line->{'meta'}->{'readView'} = $tokens[5];
+ $line->{'meta'}->{'writeView'} = $tokens[6];
+ $line->{'meta'}->{'notifyView'} = $tokens[7];
+ } elsif ($directive eq 'view') {
+ check_tokens($line, 3, 4, @tokens);
+ $line->{'meta'}->{'viewName'} = $tokens[0];
+ $line->{'meta'}->{'viewType'} = $tokens[1];
+ $line->{'meta'}->{'oid'} = $tokens[2];
+ if (defined $tokens[3]) {
+ $line->{'meta'}->{'mask'} = $tokens[3];
+ }
+ } elsif ($directive eq 'rocommunity' || $directive eq 'rwcommunity') {
+ check_tokens($line, 1, 3, @tokens);
+ $line->{'meta'}->{'community'} = $tokens[0];
+ if (defined $tokens[1]) {
+ $line->{'meta'}->{'source'} = $tokens[1];
+ } else {
+ $line->{'meta'}->{'source'} = "0.0.0.0/0.0.0.0";
+ }
+ if (defined $tokens[2]) {
+ $line->{'meta'}->{'oid'} = $tokens[2];
+ }
+ } elsif ($directive eq 'trapcommunity') {
+ check_tokens($line, 1, 1, @tokens);
+ $line->{'meta'}->{'community'} = $tokens[0];
+ } elsif ($directive eq 'trapsink' ||
+ $directive eq 'trap2sink' ||
+ $directive eq 'informsink') {
+ check_tokens($line, 1, 3, @tokens);
+ $line->{'meta'}->{'host'} = $tokens[0];
+ if (defined $tokens[1]) {
+ $line->{'meta'}->{'community'} = $tokens[1];
+ }
+ if (defined $tokens[2]) {
+ $line->{'meta'}->{'port'} = $tokens[2];
+ }
+ } elsif ($directive eq 'snmpNotifyFilterTable') {
+ check_tokens($line, 6, 6, @tokens);
+ $line->{'meta'}->{'profileName'} = $tokens[0];
+ $line->{'meta'}->{'subtree'} = $tokens[1];
+ $line->{'meta'}->{'mask'} = $tokens[2];
+ $line->{'meta'}->{'filterType'} = $tokens[3];
+ $line->{'meta'}->{'storageType'} = $tokens[4];
+ $line->{'meta'}->{'rowStatus'} = $tokens[5];
+ } elsif ($directive eq 'targetParams') {
+ check_tokens($line, 7, 7, @tokens);
+ $line->{'meta'}->{'paramName'} = $tokens[0];
+ $line->{'meta'}->{'MPModel'} = $tokens[1];
+ $line->{'meta'}->{'securityModel'} = $tokens[2];
+ $line->{'meta'}->{'securityName'} = $tokens[3];
+ $line->{'meta'}->{'securityLevel'} = $tokens[4];
+ $line->{'meta'}->{'storageType'} = $tokens[5];
+ $line->{'meta'}->{'rowStatus'} = $tokens[6];
+ } elsif ($directive eq 'targetAddr') {
+ check_tokens($line, 9, 9, @tokens);
+ $line->{'meta'}->{'targetName'} = $tokens[0];
+ $line->{'meta'}->{'TDomain'} = $tokens[1];
+ $line->{'meta'}->{'TAddress'} = $tokens[2];
+ $line->{'meta'}->{'timeout'} = $tokens[3];
+ $line->{'meta'}->{'retryCount'} = $tokens[4];
+ $line->{'meta'}->{'tagList'} = $tokens[5];
+ $line->{'meta'}->{'paramName'} = $tokens[6];
+ $line->{'meta'}->{'storageType'} = $tokens[7];
+ $line->{'meta'}->{'rowStatus'} = $tokens[8];
+ } elsif ($directive eq 'snmpNotifyTable') {
+ check_tokens($line, 5, 5, @tokens);
+ $line->{'meta'}->{'notifyName'} = $tokens[0];
+ $line->{'meta'}->{'notifyTag'} = $tokens[1];
+ $line->{'meta'}->{'notifyType'} = $tokens[2];
+ $line->{'meta'}->{'storageType'} = $tokens[3];
+ $line->{'meta'}->{'rowStatus'} = $tokens[4];
+ } elsif ($directive eq 'snmpNotifyFilterProfileTable') {
+ check_tokens($line, 4, 4, @tokens);
+ $line->{'meta'}->{'paramName'} = $tokens[0];
+ $line->{'meta'}->{'profileName'} = $tokens[1];
+ $line->{'meta'}->{'storageType'} = $tokens[2];
+ $line->{'meta'}->{'rowStatus'} = $tokens[3];
+ } elsif ($directive eq 'master') {
+ check_tokens($line, 1, 1, @tokens);
+ $line->{'meta'}->{'masterMode'} = $tokens[0];
+ } elsif ($directive eq 'agentxTimeout') {
+ check_tokens($line, 1, 1, @tokens);
+ $line->{'meta'}->{'agentxTimeout'} = $tokens[0];
+ } elsif ($directive eq 'agentxRetries') {
+ check_tokens($line, 1, 1, @tokens);
+ $line->{'meta'}->{'agentxRetries'} = $tokens[0];
+ }
+ }
+ }
+}
+
+sub convert_metadata
+{
+ my ($line, $file, $meta, $directive);
+ my %mps = ($MPMODEL_SNMPV1=>'v1',
+ $MPMODEL_SNMPV2C=>'v2c',
+ $MPMODEL_SNMPV2U=>'v2u',
+ $MPMODEL_SNMPV3=>'v3');
+ my %sms = ($SECURITY_MODEL_ANY=>'any',
+ $SECURITY_MODEL_SNMPV1=>'v1',
+ $SECURITY_MODEL_SNMPV2C=>'v2c',
+ $SECURITY_MODEL_USM=>'usm');
+ my %sls = ($SECURITY_LEVEL_NOAUTHNOPRIV=>'noAuthNoPriv',
+ $SECURITY_LEVEL_AUTHNOPRIV=>'authNoPriv',
+ $SECURITY_LEVEL_AUTHPRIV=>'authPriv');
+ my %nts = ($NOTIFY_TYPE_TRAP=>'trap',
+ $NOTIFY_TYPE_INFORM=>'inform');
+ for $file (values %::ADDED_CONFIGS, values %::MASF_CONFIGS, values
+ %::SMA_CONFIGS) {
+ for $line (@$file) {
+ $meta = $line->{'meta'};
+ if (exists $meta->{'directive'} &&
+ exists $line->{'changed'}) {
+ delete $line->{'changed'};
+ $directive = $meta->{'directive'};
+ if ($directive eq 'com2sec') {
+ # don't quote securityName or community
+ $line->{'new'} = "com2sec ".$meta->{'securityName'}.
+ ' '.$meta->{'source'}.' '.$meta->{'community'};
+ } elsif ($directive eq 'group') {
+ # don't quote groupName
+ $line->{'new'} = 'group '.$meta->{'groupName'}.
+ ' '.$meta->{'securityModel'}.' '.
+ # don't quote securityName
+ $meta->{'securityName'}.'';
+ } elsif ($directive eq 'access') {
+ my ($readView, $writeView, $notifyView) =
+ map { $_ eq '' ? 'none' : $_ }
+ ($meta->{'readView'}, $meta->{'writeView'},
+ $meta->{'notifyView'});
+ # don't quote groupName, or viewNames
+ $line->{'new'} = 'access '.$meta->{'groupName'}.
+ ' "'.$meta->{'contextPrefix'}.'" '.
+ $meta->{'securityModel'}.' '.$meta->{'securityLevel'}.
+ ' '.$meta->{'contextMatch'}.' '.$readView.
+ ' '.$writeView.' '.$notifyView;
+ } elsif ($directive eq 'view') {
+ # don't quote viewName
+ $line->{'new'} = 'view '.$meta->{'viewName'}.' '.
+ $meta->{'viewType'}.' '.$meta->{'oid'};
+ if (exists $meta->{'mask'}) {
+ $line->{'new'}.=' '.$meta->{'mask'};
+ }
+ } elsif ($directive eq 'createUser') {
+ $line->{'new'} = 'createUser "'.$meta->{'securityName'}.
+ '" '.$meta->{'authProtocol'}.' "'.$meta->{'authPassword'}.
+ '"';
+ if (exists $meta->{'privProtocol'}) {
+ $line->{'new'}.=' '.$meta->{'privProtocol'};
+ }
+ if (exists $meta->{'privPassword'}) {
+ $line->{'new'}.=' "'.$meta->{'privPassword'}.'" ';
+ }
+ } elsif ($directive eq 'trap2sink' ||
+ $directive eq 'trapsink' ||
+ $directive eq 'informsink') {
+ $line->{'new'} = $directive.' '.$meta->{'host'};
+ if (exists $meta->{'community'}) {
+ # don't quote community
+ $line->{'new'}.=' '.$meta->{'community'}.'';
+ }
+ if (exists $meta->{'port'}) {
+ $line->{'new'}.=' '.$meta->{'port'};
+ }
+ } elsif ($directive eq 'snmpNotifyFilterTable') {
+ $line->{'new'} = 'snmpNotifyFilterTable "'.
+ $meta->{'profileName'}.'" '.$meta->{'subtree'}.' "'.
+ $meta->{'mask'}.'" '.$meta->{'filterType'}.' '.
+ $meta->{'storageType'}.' '.$meta->{'rowStatus'};
+ } elsif ($directive eq 'targetParams') {
+ $line->{'comment'} = '# targetParams '.$meta->{'paramName'}.
+ ' '.$mps{$meta->{'MPModel'}}.' '.
+ $sms{$meta->{'securityModel'}}.' '.$meta->{'securityName'}.
+ ' '.$sls{$meta->{'securityLevel'}};
+ $line->{'new'} = 'targetParams "'.$meta->{'paramName'}.'" '.
+ $meta->{'MPModel'}.' '.$meta->{'securityModel'}.' "'.
+ $meta->{'securityName'}.'" '.$meta->{'securityLevel'}.' '.
+ $meta->{'storageType'}.' '.$meta->{'rowStatus'};
+ } elsif ($directive eq 'targetAddr') {
+ $line->{'new'} = 'targetAddr "'.$meta->{'targetName'}.
+ '" '.$meta->{'TDomain'}.' '.$meta->{'TAddress'}.
+ ' '.$meta->{'timeout'}.' '.$meta->{'retryCount'}.
+ ' "'.$meta->{'tagList'}.'" "'.$meta->{'paramName'}.
+ '" '.$meta->{'storageType'}.' '.$meta->{'rowStatus'};
+ } elsif ($directive eq 'snmpNotifyTable') {
+ $line->{'comment'} = '# snmpNotifyTable '.$meta->{'notifyName'}.
+ ' '.$meta->{'notifyTag'}.' '.$nts{$meta->{'notifyType'}};
+ $line->{'new'} = 'snmpNotifyTable "'.$meta->{'notifyName'}.
+ '" "'.$meta->{'notifyTag'}.'" '.$meta->{'notifyType'}.
+ ' '.$meta->{'storageType'}.' '.$meta->{'rowStatus'};
+ } elsif ($directive eq 'snmpNotifyFilterProfileTable') {
+ $line->{'new'} = 'snmpNotifyFilterProfileTable "'.
+ $meta->{'paramName'}.'" "'.$meta->{'profileName'}.
+ '" '.$meta->{'storageType'}.' '.$meta->{'rowStatus'};
+ } elsif ($directive eq 'master') {
+ $line->{'new'} = 'master '.$meta->{'masterMode'};
+ } elsif ($directive eq 'agentxTimeout') {
+ $line->{'new'} = 'agentxTimeout '.$meta->{'agentxTimeout'};
+ } elsif ($directive eq 'agentxRetries') {
+ $line->{'new'} = 'agentxRetries '.$meta->{'agentxRetries'};
+ }
+ }
+ }
+ }
+}
+
+
+# convert all rwuser directives to rouser
+sub convert_rwusers
+{
+ my ($line, $file);
+ my ($directive, @tokens);
+ for $line (get_lines('rwuser', \%::MASF_CONFIGS)) {
+ $line->{'meta'}->{'directive'} = 'rouser';
+ replace_line(\%::MASF_CONFIGS, $line, $line);
+ }
+}
+
+# convert all rwcommunity directives to rocommunity
+sub convert_rwcommunities
+{
+ my ($line);
+ for $line (get_lines('rwcommunity', \%::MASF_CONFIGS)) {
+ $line->{'meta'}->{'directive'} = 'rocommunity';
+ replace_line(\%::MASF_CONFIGS, $line, $line);
+ }
+}
+
+sub securityName_from_usmUser
+{
+ my ($directive, @tokens) = @_;
+ my ($string);
+ $tokens[3]=~s/^0x//;
+ $string = pack 'H*', $tokens[3];
+ return unpack 'Z*', $string;
+}
+
+sub viewName_exists
+{
+ my ($viewName) = @_;
+ my ($file, $line, $meta);
+ for $file (values %::MASF_CONFIGS, values %::SMA_CONFIGS) {
+ for $line (@$file) {
+ $meta=$line->{'meta'};
+ if ((exists $meta->{'readView'} &&
+ $meta->{'readView'} eq $viewName) ||
+ (exists $meta->{'writeView'} &&
+ $meta->{'writeView'} eq $viewName) ||
+ (exists $meta->{'notifyView'} &&
+ $meta->{'notifyView'} eq $viewName) ||
+ (exists $meta->{'viewName'} &&
+ $meta->{'viewName'} eq $viewName)) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+sub get_new_viewName
+{
+ my ($prefix)=@_;
+ my ($viewName, $i);
+ $i = 0;
+
+ do {
+ $viewName = $prefix.$i;
+ if (length $viewName > 32) {
+ log_message("viewName $viewName was longer than 32 characters\n");
+ exit 1;
+ }
+ $i++;
+ } while (viewName_exists($viewName));
+ return $viewName;
+}
+
+sub groupName_exists
+{
+ my ($groupName) = @_;
+ my ($file, $line, $meta);
+ for $file (values %::MASF_CONFIGS, values %::SMA_CONFIGS) {
+ for $line (@$file) {
+ $meta=$line->{'meta'};
+ if (exists $meta->{'groupName'} &&
+ $meta->{'groupName'} eq $groupName) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+sub get_new_groupName
+{
+ my ($prefix)=@_;
+ my ($groupName, $i);
+ $i = 0;
+
+ do {
+ $groupName = $prefix.$i;
+ if (length $groupName > 32) {
+ log_message("groupName $groupName was longer than 32 characters\n");
+ exit 1;
+ }
+ $i++;
+ } while (groupName_exists($groupName));
+ return $groupName;
+}
+
+sub securityName_exists
+{
+ my ($securityName) = @_;
+ my ($file, $line, $meta);
+ for $file (values %::MASF_CONFIGS, values %::SMA_CONFIGS) {
+ for $line (@$file) {
+ $meta=$line->{'meta'};
+
+ if (exists $meta->{'securityName'} &&
+ $meta->{'securityName'} eq $securityName) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+sub get_new_securityName
+{
+ my ($prefix)=@_;
+ my ($securityName, $i);
+ $i = 0;
+
+ do {
+ $securityName = $prefix.$i;
+ # check to see if length is more than 32 characters permitted
+ # by VACM
+ if (length $securityName > 32) {
+ log_message("securityName $securityName was longer".
+ " than 32 characters\n");
+ exit 1;
+ }
+
+ $i++;
+ } while (securityName_exists($securityName));
+ return $securityName;
+}
+
+sub expand_rouser
+{
+ my ($line, $default_oids) = @_;
+ my ($securityName, $groupName, $viewName, $secLevel, $oid);
+ my (@output, $readView, $writeView, $i);
+ @output = ($line);
+ $securityName = $line->{'meta'}->{'securityName'};
+ if (! defined $line->{'meta'}->{'securityLevel'}) {
+ $secLevel = "auth";
+ } else {
+ $secLevel = $line->{'meta'}->{'securityLevel'};
+ }
+ if (! defined $line->{'meta'}->{'oid'}) {
+ $oid = '';
+ } else {
+ $oid = $line->{'meta'}->{'oid'};
+ }
+
+ $groupName = get_new_groupName("Group");
+ $viewName = get_new_viewName("View");
+
+ if ($line->{'meta'}->{'directive'} eq 'rouser') {
+ $readView = $viewName;
+ $writeView = '';
+ } else {
+ $readView = $viewName;
+ $writeView = $viewName;
+ }
+
+ $output[0]->{'meta'} = {'directive'=>'group',
+ 'groupName'=>$groupName,
+ 'securityModel'=>'usm',
+ 'securityName'=>$securityName};
+ push @output, {'meta'=>{'directive'=>'access',
+ 'groupName'=>$groupName,
+ 'contextPrefix'=>'',
+ 'securityModel'=>'usm',
+ 'securityLevel'=>$secLevel,
+ 'contextMatch'=>'exact',
+ 'readView'=>$readView,
+ 'writeView'=>$writeView,
+ 'notifyView'=>''}
+ };
+ if ($oid ne '') {
+ push @output, {'meta'=>{'directive'=>'view',
+ 'viewName'=>$viewName,
+ 'viewType'=>'included',
+ 'oid'=>$oid}};
+ } else {
+ for ($i = 0; $i < @$default_oids; $i++) {
+ push @output,{'meta'=>{'directive'=>'view',
+ 'viewName'=>$viewName,
+ 'viewType'=>'included',
+ 'oid'=>$default_oids->[$i]}};
+ }
+ }
+ return @output;
+}
+
+sub expand_rocommunity
+{
+ my ($line, $default_oids) = @_;
+ my ($securityName, $groupName, $viewName, $community, $source, $oid);
+ my (@output, $readView, $writeView, $i);
+ @output = ($line);
+ $community = $line->{'meta'}->{'community'};
+ $source = $line->{'meta'}->{'source'};
+ if (defined $line->{'meta'}->{'oid'}) {
+ $oid = $line->{'meta'}->{'oid'};
+ } else {
+ $oid = '';
+ }
+
+ $securityName = get_new_securityName("User");
+ $groupName = get_new_groupName("Group");
+ $viewName = get_new_viewName("View");
+
+ if ($line->{'meta'}->{'directive'} eq 'rocommunity') {
+ $readView = $viewName;
+ $writeView = '';
+ } else {
+ $readView = $viewName;
+ $writeView = $viewName;
+ }
+
+ $output[0]->{'meta'} = {'directive'=>"com2sec",
+ 'securityName'=>$securityName,
+ 'source'=>$source,
+ 'community'=>$community
+ };
+ push @output, {'meta'=>{'directive'=>'group',
+ 'groupName'=>$groupName,
+ 'securityModel'=>'v1',
+ 'securityName'=>$securityName}
+ },
+ {'meta'=>{'directive'=>'group',
+ 'groupName'=>$groupName,
+ 'securityModel'=>'v2c',
+ 'securityName'=>$securityName}
+ },
+ {'meta'=>{'directive'=>'access',
+ 'groupName'=>$groupName,
+ 'contextPrefix'=>'',
+ 'securityModel'=>'v1',
+ 'securityLevel'=>'noauth',
+ 'contextMatch'=>'exact',
+ 'readView'=>$readView,
+ 'writeView'=>$writeView,
+ 'notifyView'=>''}
+ },
+ {'meta'=>{'directive'=>'access',
+ 'groupName'=>$groupName,
+ 'contextPrefix'=>'',
+ 'securityModel'=>'v2c',
+ 'securityLevel'=>'noauth',
+ 'contextMatch'=>'exact',
+ 'readView'=>$readView,
+ 'writeView'=>$writeView,
+ 'notifyView'=>''}
+ };
+ if ($oid ne '') {
+ push @output, {'meta'=>{'directive'=>'view',
+ 'viewName'=>$viewName,
+ 'viewType'=>'included',
+ 'oid'=>$oid}};
+ } else {
+ for ($i = 0; $i < @$default_oids; $i++) {
+ push @output, {'meta'=>{'directive'=>'view',
+ 'viewName'=>$viewName,
+ 'viewType'=>'included',
+ 'oid'=>$default_oids->[$i]}};
+ }
+ }
+ return @output;
+}
+
+sub expand_rousers
+{
+ my ($configs, $default_oids) = @_;
+ my ($file, $lines, $i, $output, $line, $directive, @tokens);
+ my (@expanded);
+ for $file (keys %$configs) {
+ $lines = $configs->{$file};
+ $output=[];
+ for ($i = 0; $i < @$lines; $i++) {
+ $line = $lines->[$i];
+ if (! exists $line->{'meta'}->{'directive'}) {
+ next;
+ }
+ $directive = $line->{'meta'}->{'directive'};
+ if ($directive eq 'rouser' || $directive eq 'rwuser') {
+ # expand rocommunity directive
+ @expanded = expand_rouser($line, $default_oids);
+ splice @$lines, $i, 1, @expanded;
+ $i += $#expanded;
+ }
+ }
+ }
+}
+
+sub expand_rocommunities
+{
+ my ($configs, $default_oids)= @_;
+ my ($file, $lines, $i, $output, $line, $directive, @tokens);
+ my (@expanded);
+ for $file (keys %$configs) {
+ $lines = $configs->{$file};
+ $output=[];
+ for ($i = 0; $i < @$lines; $i++) {
+ $line = $lines->[$i];
+ if (! exists $line->{'meta'}->{'directive'}) {
+ next;
+ }
+
+ if ($line->{'meta'}->{'directive'} eq 'rocommunity' ||
+ $line->{'meta'}->{'directive'} eq 'rwcommunity') {
+ # expand rocommunity directive
+ @expanded = expand_rocommunity($line, $default_oids);
+ splice @$lines, $i, 1, @expanded;
+ $i += $#expanded;
+ }
+ }
+ }
+}
+
+##############################################################################
+# General configuration
+
+sub install_agentx_config
+{
+ my (@lines) = get_lines('master', \%::SMA_CONFIGS);
+ if (@lines) {
+ if (grep (($lines[0]->{'meta'}->{'masterMode'} eq $_),
+ ('agentx', 'all', 'yes', 'on'))) {
+ # master mode is enabled anyway
+ } else {
+ # master mode was disabled!
+ log_message "AgentX mastering capability has been explicitly ".
+ "disabled in the SMA config - Aborting.\n", $lines[0];
+ exit 1;
+ }
+ } else {
+ # master mode has not been specified, add it.
+ log_message "Enabling agentX mastering for SMA.\n";
+ prepend_line({'meta'=>{'directive'=>'master', 'masterMode'=>'agentx'}});
+ }
+ @lines = get_lines('agentxTimeout', \%::SMA_CONFIGS);
+ if (@lines) {
+ if ($lines[0]->{'agentxTimeout'} < 2) {
+ $lines[0]->{'agentxTimeout'} = 2;
+ replace_line(\%::SMA_CONFIGS, $lines[0], $lines[0]);
+ }
+ } else {
+ prepend_line({'meta'=>{'directive'=>'agentxTimeout', 'agentxTimeout'=>2}});
+ }
+ @lines = get_lines('agentxRetries', \%::SMA_CONFIGS);
+ if (@lines) {
+ if ($lines[0]->{'agentxRetries'} < 4) {
+ $lines[0]->{'agentxRetries'} = 4;
+ replace_line(\%::SMA_CONFIGS, $lines[0], $lines[0]);
+ }
+ } else {
+ prepend_line({'meta'=>{'directive'=>'agentxRetries', 'agentxRetries'=>4}});
+ }
+}
+
+sub check_agent_configs
+{
+ my ($directive, $line);
+ for $directive ('agentgroup', 'agentuser', 'authtrapenable') {
+ my (@masf) = get_lines($directive, \%::MASF_CONFIGS);
+ my (@sma) = get_lines($directive, \%::SMA_CONFIGS);
+ if (@masf > 0 && @sma == 0) {
+ log_message "The following $directive directive was found in ".
+ "the MASF configuration but is not configured for SMA:\n";
+ log_message $masf[0]->{'new'}."\n";
+
+ } elsif (@masf > 0 && @sma > 0 && $sma[0] ne $masf[0]) {
+ log_message "The following $directive directive was found in ".
+ "the MASF configuration but differs in the SMA configuration:\n";
+ log_message $masf[0]->{'new'}."\n";
+ }
+ for $line (@masf) {
+ # delete the line
+ replace_line(\%::MASF_CONFIGS, $line, {'meta'=>{}});
+ }
+ }
+}
+
+sub check_system_configs
+{
+ my ($directive, $line);
+ for $directive ('syslocation', 'syscontact', 'sysname', 'sysservices') {
+ my (@masf) = get_lines($directive, \%::MASF_CONFIGS);
+ my (@sma) = get_lines($directive, \%::SMA_CONFIGS);
+ if (@masf > 0 && @sma == 0) {
+ log_message "The following $directive directive was found in ".
+ "the MASF configuration but is not configured for SMA:\n";
+ log_message $masf[0]->{'new'}."\n";
+ log_message "You may wish to set this parameter in the SMA ".
+ "configuration file after this script completes migration.\n";
+
+ } elsif (@masf > 0 && @sma > 0 && $sma[0]->{'new'} ne $masf[0]->{'new'}) {
+ log_message "The following $directive directive was found in ".
+ "the MASF configuration but differs in the SMA configuration:\n";
+ log_message $masf[0]->{'new'}."\n";
+ log_message "You may wish to set this parameter in the SMA ".
+ "configuration file after this script completes migration.\n";
+ }
+ for $line (@masf) {
+ # delete the line
+ replace_line(\%::MASF_CONFIGS, $line, {'meta'=>{}});
+ }
+ }
+}
+
+sub process_agentaddress
+{
+ my ($line, $lines, @masfAgentAddress, $smaAgentAddress, $config);
+ (@masfAgentAddress) = get_lines ('agentaddress', \%::MASF_CONFIGS);
+ if (@masfAgentAddress == 0) {
+ log_message "No agentaddress directive found for MASF\n";
+ return;
+ }
+
+ # if more than one MASF agentaddress line was specified then all but the
+ # last are ignored so we should delete them
+ while (@masfAgentAddress > 1) {
+ $line = shift @masfAgentAddress;
+ replace_line (\%::MASF_CONFIGS, $line, {'meta'=>{}});
+ }
+
+ my (@smaTokens, @masfTokens);
+ ($smaAgentAddress) = get_lines ('agentaddress', \%::SMA_CONFIGS);
+ if (! defined $smaAgentAddress) {
+ log_message "SMA uses default 161 port\n";
+ @smaTokens = ('udp:161');
+ } else {
+ @smaTokens = parse_agentaddress ($smaAgentAddress->{'new'});
+ }
+
+ if (defined $smaAgentAddress) {
+ $line = $smaAgentAddress;
+ $config = \%::SMA_CONFIGS;
+ } else {
+ $line = $masfAgentAddress[0];
+ $config = \%::MASF_CONFIGS;
+ }
+
+ if ($::DISABLE_MASF_PORT && @masfAgentAddress) {
+ log_message "Disabling access via old MASF port\n";
+ delete $masfAgentAddress[0]->{'new'};
+ return;
+ }
+
+ @masfTokens = parse_agentaddress ($masfAgentAddress[0]->{'new'});
+
+ # MASF addresses must be a subset of SMA
+ my ($i, $j, $okToMigrate);
+ $okToMigrate = 1;
+ for $i (@masfTokens) {
+ if (grep(($i eq $_), @smaTokens) == 0) {
+ log_message "MASF port configuration for port $i conflicts with SMA\n";
+ $okToMigrate = 0;
+ }
+ }
+
+ if (! $okToMigrate && ! $::USE_MASF_PORT && ! $::DISABLE_MASF_PORT) {
+ log_message "Unable to resolve conflict - aborting\n";
+ exit 1;
+ }
+
+ if ($::USE_MASF_PORT) {
+ push @smaTokens, @masfTokens;
+ }
+ $line->{'new'} = 'agentaddress '.(join ',',@smaTokens);
+ replace_line($config, $line, $line);
+ return;
+}
+
+##############################################################################
+# Main section starts here
+
+# configure Getopt for CLIP compliance
+Getopt::Long::Configure('bundling', 'require_order',
+ 'no_getopt_compat', 'no_auto_abbrev', 'no_ignore_case');
+
+my ($selectCommunity, $selectUser, $useAgentPort, $trapFilter,
+ $masterTrapTarget, $version, $help);
+$selectCommunity = 'error';
+$selectUser = 'error';
+$useAgentPort = 'error';
+$trapFilter = 'add';
+
+my $result = GetOptions(
+ 'i|ignore-unrecognized-directives'=>\$::IGNORE_UNRECOGNIZED_DIRECTIVES,
+ 's|skip-user'=>\$::IGNORE_ENGINEID,
+ 'y|select-community=s'=>\$selectCommunity,
+ 'u|select-user=s'=>\$selectUser,
+ 'p|use-agent-port=s'=>\$useAgentPort,
+ 't|trap-filter=s'=>\$trapFilter,
+ 'l|master-trap-target=s'=>\$masterTrapTarget,
+ 'c|no-community'=>\$::DONT_KEEP_V1V2C_USERS,
+ 'r|no-trap'=>\$::DONT_KEEP_TRAP_DESTS,
+ 'm|no-usmuser'=>\$::DONT_KEEP_V3_USERS,
+ 'n|dry-run'=>\$::DRY_RUN,
+ 'V|version'=>\$version,
+ 'help|?'=>\$help);
+
+if (! $result) {
+ print STDERR "An unrecognized option was present.\n";
+ help();
+}
+
+if ($version) {
+ version();
+}
+
+# no interactive mode
+$::AUTOMATED = 1;
+
+$::KEEP_MASF_GROUPS = 0;
+$::KEEP_SMA_GROUPS = 0;
+if ($selectCommunity eq 'agent') {
+ $::KEEP_MASF_GROUPS = 1;
+} elsif ($selectCommunity eq 'master') {
+ $::KEEP_SMA_GROUPS = 1;
+} elsif ($selectCommunity ne 'error') {
+ print STDERR "Invalid --select-community option $selectCommunity".
+ " specified.\n";
+ help();
+}
+
+$::KEEP_MASF_USM_USERS = 0;
+$::KEEP_SMA_USM_USERS = 0;
+if ($selectUser eq 'agent') {
+ $::KEEP_MASF_USM_USERS = 1;
+} elsif ($selectUser eq 'master') {
+ $::KEEP_SMA_USM_USERS = 1;
+} elsif ($selectUser ne 'error') {
+ print STDERR "Invalid --select-user option $selectUser".
+ " specified.\n";
+ help();
+}
+
+$::USE_MASF_PORT = 0;
+$::DISABLE_MASF_PORT = 0;
+if ($useAgentPort eq 'enable') {
+ $::USE_MASF_PORT = 1;
+} elsif ($useAgentPort eq 'disable') {
+ $::DISABLE_MASF_PORT = 1;
+} elsif ($useAgentPort ne 'error') {
+ print STDERR "Invalid --use-agent-port option $useAgentPort specified\n";
+ help();
+}
+
+if ($trapFilter eq 'none') {
+ $::NO_TRAP_FILTERS = 1;
+} elsif ($trapFilter eq 'add') {
+ $::NO_TRAP_FILTERS = 0;
+} else {
+ print STDERR "Invalid --trap-filter option $trapFilter\n";
+ help();
+}
+
+$::EXTEND_SMA_FILTERS = 0;
+$::KEEP_SNMP_TARGET_PARAMS = 0;
+if (defined $masterTrapTarget) {
+ if ($trapFilter eq 'none') {
+ print STDERR "--master-trap-target cannot be used with --trap-filter=none\n";
+ help();
+ }
+ if ($masterTrapTarget eq 'agent') {
+ $::EXTEND_SMA_FILTERS = 1;
+ } elsif ($masterTrapTarget eq 'master') {
+ $::KEEP_SNMP_TARGET_PARAMS = 1;
+ $::EXTEND_SMA_FILTERS = 1;
+ } else {
+ print STDERR "Invalid --master-trap-target option $masterTrapTarget specified.\n";
+ help();
+ }
+}
+
+if ($help) {
+ help();
+}
+
+# set the umask before writing to the log file
+set_umask();
+log_message "masfcnv ".localtime()."\n\n";
+are_we_root();
+stop_sma_running();
+stop_masf_running();
+
+@::MASF_CONFIG_FILES = ("/etc/opt/SUNWmasf/conf/snmpd.conf");
+$::MASF_PERSISTENT_FILE = "/var/opt/SUNWmasf/snmpd.dat";
+$::MASF_PERSISTENT_DIR = "/var/opt/SUNWmasf";
+
+@::SMA_CONFIG_FILES = ("/usr/lib/net-snmp/snmpd.conf");
+$::SMA_PERSISTENT_FILE = "/var/net-snmp/snmpd.conf";
+$::SMA_PERSISTENT_DIR = "/var/net-snmp";
+sma_config_sanity_check();
+masf_config_sanity_check();
+read_config_files();
+sanity_check_config_files();
+add_metadata();
+install_agentx_config();
+process_agentaddress();
+convert_rwcommunities();
+expand_rocommunities(\%::MASF_CONFIGS, [$ENTITY_MIB_OID, $SUNPLAT_MIB_OID]);
+expand_rocommunities(\%::SMA_CONFIGS, [$INTERNET_OID]);
+convert_rwusers();
+expand_rousers(\%::MASF_CONFIGS, [$ENTITY_MIB_OID, $SUNPLAT_MIB_OID]);
+expand_rousers(\%::SMA_CONFIGS, [$INTERNET_OID]);
+clean_group_membership();
+if (! $::DONT_KEEP_V1V2C_USERS) {
+ uniquify_securityNames('masf');
+ process_com2sec();
+} else {
+ remove_v1v2c_users();
+}
+uniquify_groupNames('masf');
+check_usm_securityNames();
+process_engineIDs();
+if (! $::DONT_KEEP_V3_USERS) {
+ process_usm_securityNames();
+} else {
+ remove_v3_users();
+}
+uniquify_viewNames('masf');
+
+process_trapcommunity(\%::MASF_CONFIGS);
+process_trapcommunity(\%::SMA_CONFIGS);
+if ($::DONT_KEEP_TRAP_DESTS) {
+ remove_trap_destinations();
+}
+check_duplicate_trap_destinations();
+if ($::NO_TRAP_FILTERS) {
+ # simplistic trap processing
+ # no further filtering
+} else {
+
+ if ($::EXTEND_SMA_FILTERS) {
+ # "master"
+ # if the administrator selects EXTEND_SMA_FILTERS and
+ # KEEP_SNMP_TARGET_PARAMS is selected then: MASF trap destinations are
+ # migrated using existing SMA targetParams, targetAddrs, filterProfiles
+ # if possible. SMA trap destinations keep existing targetParams and
+ # have filterProfiles updated to INCLUDE MASF traps. Targets present in
+ # both SMA and MASF configs end up receiving all traps with SMA params.
+ # 1. Update SMA filterProfiles to include MASF traps
+ # 2. Expand existing MASF trapsinks to targetAddrs, params, and profiles
+ # identifying overlapping trap destinations and using them where
+ # appropriate
+
+ # "agent"
+ # if the administrator selects EXTEND_SMA_FILTERS and
+ # KEEP_SNMP_TARGET_PARAMS is not selected then: MASF trap destinations
+ # are migrated using MASF targetParams, targetAddrs, filterProfiles.
+ # All SMA trap destinations not in MASF use SMA params and have MASF
+ # traps INCLUDED. New params are created for targets present in both
+ # SMA and MASF which use tag specifically for MASF. Targets present in
+ # both SMA and MASF configs end up receiving all traps with MASF params.
+ # 1. Update SMA filterProfiles to include MASF traps
+ # 2. Expand existing MASF trapsinks to new targetAddrs, params,
+ # profiles, identifying overlapping trap destinations and profiles,
+ # transferring them to new SMA params and retain original profiles.
+
+ # selecting KEEP_SNMP_TARGET_PARAMS without EXTEND_SMA_FILTERS is not an
+ # option
+ extend_sma_trap_filters();
+ }
+ # "add"
+ # if the administrator selects neither option then: All MASF trap
+ # configurations are translated to new params, targetAddrs, filters which
+ # have ONLY MASF traps included in the profile. Targets present in both
+ # MASF and SMA may receive duplicate traps, depending upon the SMA filter
+ # profile.
+ # 1. Expand existing MASF trapsinks to new targetAddrs, params, profiles.
+ process_trapsinks();
+}
+check_system_configs();
+check_agent_configs();
+convert_metadata();
+if (! $::DRY_RUN) {
+ backup_files();
+ remove_masf_persistent_file();
+}
+if ($::DRY_RUN) {
+ print "Contents of ".$::SMA_CONFIG_FILES[0]."\n";
+ print "\n";
+ *FH = *STDOUT;
+} else {
+ open (FH, "> ".$::SMA_CONFIG_FILES[0]) || die "Couldn't open file ".$::SMA_CONFIG_FILES[0]." for writing.\n";
+}
+my ($l);
+for $l (@{$::ADDED_CONFIGS{'prepend'}}) {
+ print_line (\*FH, $l);
+}
+dump_config(\*FH, $::SMA_PERSISTENT_FILE, \%::SMA_CONFIGS);
+dump_config(\*FH, $::MASF_PERSISTENT_FILE, \%::MASF_CONFIGS);
+for $l (@{$::ADDED_CONFIGS{'append'}}) {
+ print_line (\*FH, $l);
+}
+if ($::DRY_RUN) {
+ print "=======================\n";
+ print "Contents of ".$::SMA_PERSISTENT_FILE."\n";
+ print "=======================\n";
+} else {
+ close FH;
+ open (FH, "> ".$::SMA_PERSISTENT_FILE) || die "Couldn't open file ".$::SMA_PERSISTENT_FILE." for writing.\n";
+}
+dump_persistent_storage(\*FH, $::SMA_PERSISTENT_FILE, \%::SMA_CONFIGS);
+dump_persistent_storage(\*FH, $::MASF_PERSISTENT_FILE, \%::MASF_CONFIGS);
+if (! $::DRY_RUN) {
+ close FH;
+ install_template_config_file();
+ install_new_wrapper_script();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/masfd Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,53 @@
+#
+# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# ident "@(#)masfd 1.5 03/06/25 SMI"
+
+SUNWMASF_PKGLIB=`pkgparam SUNWmasf BASEDIR`
+SNMPD=$SUNWMASF_PKGLIB/SUNWmasf/sbin/snmpd
+SUNWMASF_PKGLIB=$SUNWMASF_PKGLIB/SUNWmasf/lib
+CONF_FILE=/etc/opt/SUNWmasf/conf/snmpd.conf
+TIMEOUT=5
+
+if [ ! -f ${CONF_FILE} ]; then
+ exit 0
+fi
+
+export SUNWMASF_PKGLIB
+
+PATTERN=`echo $SNMPD | sed 's/\\//\\\\\\//g'`
+
+is_running() {
+ /usr/bin/pgrep -x -f "$PATTERN -X"> /dev/null 2>&1
+}
+
+case "$1" in
+start)
+ if is_running ; then
+ echo "Agent already running" >&2
+ exit 1
+ else
+ {
+ # allow time for agentX master agent to open socket
+ sleep 30
+ $SNMPD -X > /dev/null 2>&1
+ } &
+ fi
+ ;;
+stop)
+ TIME=0
+ /usr/bin/pkill -x -f "$PATTERN -X"
+ # Allow time for final poll to complete, before relinquishing control
+ # and allowing picld to be stopped
+ while is_running && [ $TIME -lt $TIMEOUT ] ; do
+ sleep 1
+ TIME=`/usr/bin/expr $TIME + 1`
+ done
+ ;;
+*)
+ echo "Usage: $0 {start|stop}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_1/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,52 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# Use is subject to license terms.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate demo_module_1.so
+#
+# usage:
+# setenv CC /usr/bin/cc (or correct path)
+# "make" : generate library for 64bit
+# "make ARCH=32" : generate library for 32bit
+# "make clean" : remove *.o , *.so
+#
+
+ARCH=64
+LDFLAGS_64=-g -m64 -I.
+LDFLAGS_32=-g -I.
+LDFLAGS=$(LDFLAGS_$(ARCH))
+
+LDLIBS=
+
+PROG= demo_module_1.so
+SRCS= demo_module_1.c
+OBJS = $(SRCS:.c=.o)
+
+all:$(PROG)
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) $(LDLIBS) -G -o $@ $(OBJS)
+.c.o:
+ @if test "$(CC)" = "" ; then \
+ echo "Environment variable CC must be set with compiler path" ; \
+ exit 1 ; \
+ fi
+ $(CC) $(LDFLAGS) -g -o $@ -c $<
+
+clean:
+ rm -f demo_module_1.o demo_module_1.so
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_1/README_demo_module_1 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ */
+
+README for demo_module_1
+********************************************************************
+
+This code example shows you how to modify the code generated by
+"mib2c -c mib2c.scalar.conf" command to perform a scalar
+data retrieval. See the System Management Agent Developer's Guide
+for more information about scalar data retrieval.
+
+
+Introduction
+------------
+This example shows you how to generate templates with mib2c from a sample
+MIB. You can then compare these templates with the source code and header
+files provided with the example. The source files were created by modifying
+the templates that you create in this example.
+
+The example also shows you how to build a module from the modified source files.
+
+The demo_module_1 code example includes the following files, by default
+located in the directory /usr/demo/sma_snmp/demo_module_1.
+
+Files:
+
+o Makefile - Compiles the module source code
+o demo_module_1.c - Source code for the module, returns load averages
+o demo_module_1.h - Header file for the module
+o SDK-DEMO1-MIB.txt - MIB file used in the module
+
+
+
+
+How to Use the demo_module_1 Code Example
+==========================================
+
+
+To set up your environment for the demo:
+
+1. Copy the demo code to a directory for which you have write permission.
+ For example:
+ % cp -R /usr/demo/sma_snmp/demo_module_1 /home/username/demo
+
+
+2. Create a lib directory that you can use to store shared object libraries
+
+ that you generate from demo code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/lib
+
+
+3. Create a mibs directory that you can use to store MIB files for the
+ demo code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/mibs
+
+
+4. Set the CC environment variable to the location of the C compiler to be used.
+ For example, if you are using Sun ONE Studio:
+ % setenv CC /opt/SUNWspro/bin/cc
+
+
+5. Set your PATH environment variable to include the appropriate paths, so that
+ needed binaries can be found during the compilation process.
+ For example, in the csh:
+
+ % setenv PATH .:/usr/bin:$PATH
+
+
+
+
+To generate code templates from the sample MIB:
+
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_1
+
+
+2. Copy the SDK-DEMO1-MIB.txt file to the mibs directory you created
+ for the demos.
+ For example:
+
+ % cp SDK-DEMO1-MIB.txt /home/username/demo/mibs
+
+
+3. Set your MIBS and MIBDIRS environment variables to
+ include the appropriate paths.
+ For example, in the csh:
+
+ % setenv MIBDIRS .:/home/username/demo/mibs:/etc/sma/snmp/mibs
+ % setenv MIBS +SDK-DEMO1-MIB
+
+
+4. Run mib2c on the me1LoadGroup group in the SDK-DEMO1-MIB.
+ For example:
+
+ % mib2c -c mib2c.scalar.conf me1LoadGroup
+
+ The mib2c utility generates the following template files:
+ me1LoadGroup.c
+ me1LoadGroup.h
+
+
+5. Compare the template files with the demo_module_1.c and the
+ demo_module_1.h files.
+
+ The demo_module_1 files were created by modifying the templates.
+
+ See the System Management Agent Developer's Guide for more information
+ about modifying templates.
+
+
+
+
+To build the example:
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_1
+
+
+2. Use the make command to generate object files.
+
+ If you are running the 64-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make
+
+ If you are running the 32-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+ If you are running the Solaris x86 kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+
+3. Copy the module shared library object to the lib directory you created.
+ For example:
+
+ % cp demo_module_1.so /home/username/demo/lib
+
+
+
+
+
+
+Setting Up Agent to Run demo_module_1
+=============================================
+
+1. As root, edit the agent's configuration file /etc/sma/snmp/snmpd.conf,
+ and insert a dlmod statement for the module. This statement enables
+ the agent to load the module.
+ For example:
+
+ dlmod demo_module_1 /home/username/demo/lib/demo_module_1.so
+
+
+2. As root, start the SMA snmp agent. If the agent is already running, stop
+ and restart it in debug mode.
+ For example:
+
+ # /etc/init.d/init.sma stop
+ # /usr/sbin/snmpd -Ddemo_module_1
+
+ The optional -Ddemo_module_1 argument sends debugging statements
+ from demo_module_1 to the /var/log/snmpd.log file.
+ You can also use the -L and -f options to send debugging statements to
+ the screen instead.
+
+
+
+Testing the Module
+==================
+
+1. As a non-root user, issue snmpget commands to retrieve scalar data from the module.
+ For example:
+
+ % snmpget -v1 -c public localhost SDK-DEMO1-MIB::me1SystemLoadAvg1min.0
+ % snmpget -v1 -c public localhost SDK-DEMO1-MIB::me1SystemLoadAvg5min.0
+ % snmpget -v1 -c public localhost SDK-DEMO1-MIB::me1SystemLoadAvg15min.0
+
+ Or
+
+ % snmpget -v1 -c public localhost .1.3.6.1.4.1.42.2.2.4.4.1.1.1.0
+ % snmpget -v1 -c public localhost .1.3.6.1.4.1.42.2.2.4.4.1.1.2.0
+ % snmpget -v1 -c public localhost .1.3.6.1.4.1.42.2.2.4.4.1.1.3.0
+
+
+ These commands should produce output similar to the following:
+
+ SDK-DEMO1-MIB::me1SystemLoadAvg1min.0 = STRING: 3.906250e-02 Jobs
+ SDK-DEMO1-MIB::me1SystemLoadAvg5min.0 = STRING: 2.734375e-02 Jobs
+ SDK-DEMO1-MIB::me1SystemLoadAvg15min.0 = STRING: 3.906250e-02 Jobs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_1/SDK-DEMO1-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,241 @@
+--
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are
+-- subject
+-- to the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun,
+-- Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+
+
+----------------------------------------------------------
+-- Systems Management Agent (SMA) SDK module DEMO-1 MIB
+----------------------------------------------------------
+
+SDK-DEMO1-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+ enterprises, MODULE-IDENTITY, OBJECT-TYPE, Counter64, Integer32, Unsigned32
+ FROM SNMPv2-SMI
+ OBJECT-GROUP
+ FROM SNMPv2-CONF
+ DisplayString
+ FROM SNMPv2-TC;
+
+sdkDemo1MIB MODULE-IDENTITY
+ LAST-UPDATED "0009181435Z"
+ ORGANIZATION "Sun Microsystems Inc."
+ CONTACT-INFO
+ " Sun Microsystems Inc
+ 4150 Network Circle
+ Santa Clara, CA 95054
+ e-mail: [email protected]"
+ DESCRIPTION
+ " SMA SDK MIB DEMO-1. This MIB will be used to demonstrate the
+ implementation of modules and various module features in SMA agent."
+ ::= { demo 1 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+management OBJECT IDENTIFIER ::= { products 2 }
+sma OBJECT IDENTIFIER ::= { management 4 }
+demo OBJECT IDENTIFIER ::= { sma 4 }
+
+--
+-- There are currently 2 Groups in the example.
+-- The "Load" group contains information about system load
+-- The "File" group contains information about some files on the system
+--
+
+me1LoadGroup OBJECT-GROUP
+ OBJECTS { me1SystemLoadAvg1min, me1SystemLoadAvg5min,
+ me1SystemLoadAvg15min }
+ STATUS current
+ DESCRIPTION
+ "Load related statistics."
+ ::= { sdkDemo1MIB 1 }
+
+me1FileGroup OBJECT-GROUP
+ OBJECTS { me1FileIndex, me1FileName, me1FileSize, me1FilePerm
+ }
+ STATUS current
+ DESCRIPTION
+ "File related statistics."
+ ::= { sdkDemo1MIB 2 }
+
+--
+-- Properties in the "Load" group
+--
+
+me1SystemLoadAvg1min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 1 minute."
+ ::= { me1LoadGroup 1 }
+
+me1SystemLoadAvg5min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 5 minutes."
+ ::= { me1LoadGroup 2 }
+
+me1SystemLoadAvg15min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 15 minutes."
+ ::= { me1LoadGroup 3 }
+
+--
+-- Objects in the "File" group
+--
+
+me1FileTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF Me1FileEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Table containing information of some files on the system."
+ ::= { me1FileGroup 1 }
+
+me1FileEntry OBJECT-TYPE
+ SYNTAX Me1FileEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Information about one file on the system."
+ INDEX { me1FileIndex }
+ ::= { me1FileTable 1 }
+
+Me1FileEntry ::=
+ SEQUENCE {
+ me1FileIndex
+ Unsigned32,
+ me1FileName
+ DisplayString,
+ me1FileSize
+ Unsigned32,
+ me1FilePerm
+ DisplayString
+ }
+
+me1FileIndex OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Index of the file."
+ ::= { me1FileEntry 1 }
+
+me1FileName OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "Name of the file"
+ ::= { me1FileEntry 2 }
+
+me1FileSize OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Size of the file in kb"
+ ::= { me1FileEntry 3 }
+
+me1FilePerm OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Permissions on this file. example, 0755 "
+ ::= { me1FileEntry 4 }
+
+
+-- General table:
+
+
+me1ContactInfoTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF Me1ContactInfoEntry
+ MAX-ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "The contact information table."
+ ::= { sdkDemo1MIB 3 }
+
+
+
+me1ContactInfoEntry OBJECT-TYPE
+ SYNTAX Me1ContactInfoEntry
+ MAX-ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "An entry in the contact info table."
+ INDEX { me1FloorNumber, me1RoomNumber }
+ ::= { me1ContactInfoTable 1 }
+
+
+
+Me1ContactInfoEntry ::=
+ SEQUENCE {
+ me1FloorNumber
+ INTEGER,
+ me1RoomNumber
+ INTEGER,
+ me1Name
+ DisplayString,
+ me1Extension
+ INTEGER
+ }
+
+me1FloorNumber OBJECT-TYPE
+ SYNTAX INTEGER (1..3)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "This object combines with me1RoomNumber are
+ the identifier of the table."
+ ::= { me1ContactInfoEntry 1 }
+
+
+me1RoomNumber OBJECT-TYPE
+ SYNTAX INTEGER (1..100)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "This object combines with me1FloorNumber are
+ the identifier of the table."
+ ::= { me1ContactInfoEntry 2 }
+
+me1Name OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " The person loacted in the room."
+ ::= { me1ContactInfoEntry 3 }
+
+me1Extension OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The phone number of the office."
+ ::= { me1ContactInfoEntry 4 }
+
+
+END
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_1/demo_module_1.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,157 @@
+/*
+ *
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are
+ * subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.1.1.1 2003/03/26 18:12:30 pcarroll Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "demo_module_1.h"
+#include <sys/loadavg.h>
+
+char* getLoadAvg(int timeAverage){
+ double loadavg[3];
+ char *data = malloc(30 * sizeof(char));
+ int numOfSamples = getloadavg(loadavg, 3);
+ if (numOfSamples == -1)
+ sprintf(data, "%s", "Not valid");
+ else
+ sprintf(data, "%e", loadavg[timeAverage]);
+ return data;
+}
+
+/** Initializes the demo_module_1 module */
+void
+init_demo_module_1(void)
+{
+ static oid me1SystemLoadAvg5min_oid[] = { 1,3,6,1,4,1,42,2,2,4,4,1,1,2, 0 };
+ static oid me1SystemLoadAvg1min_oid[] = { 1,3,6,1,4,1,42,2,2,4,4,1,1,1, 0 };
+ static oid me1SystemLoadAvg15min_oid[] = { 1,3,6,1,4,1,42,2,2,4,4,1,1,3, 0 };
+
+
+ DEBUGMSGTL(("demo_module_1", "Initializing\n"));
+
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("me1SystemLoadAvg15min",
+ get_me1SystemLoadAvg15min,
+ me1SystemLoadAvg15min_oid,
+ OID_LENGTH(me1SystemLoadAvg15min_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("me1SystemLoadAvg1min",
+ get_me1SystemLoadAvg1min,
+ me1SystemLoadAvg1min_oid,
+ OID_LENGTH(me1SystemLoadAvg1min_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("me1SystemLoadAvg5min",
+ get_me1SystemLoadAvg5min,
+ me1SystemLoadAvg5min_oid,
+ OID_LENGTH(me1SystemLoadAvg5min_oid),
+ HANDLER_CAN_RONLY));
+}
+
+int
+get_me1SystemLoadAvg15min(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /* We are never called for a GETNEXT if it's registered as a
+ "instance", as it's "magically" handled for us. */
+
+ /* a instance handler also only hands us one request at a time, so
+ we don't need to loop over a list of requests; we'll only get one. */
+ char* data;
+ switch(reqinfo->mode) {
+
+ case MODE_GET:
+ data = getLoadAvg(LOADAVG_15MIN);
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) data , strlen(data));
+ free(data);
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+int
+get_me1SystemLoadAvg1min(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /* We are never called for a GETNEXT if it's registered as a
+ "instance", as it's "magically" handled for us. */
+
+ /* a instance handler also only hands us one request at a time, so
+ we don't need to loop over a list of requests; we'll only get one. */
+
+ char* data;
+ switch(reqinfo->mode) {
+
+ case MODE_GET:
+ data = getLoadAvg(LOADAVG_1MIN);
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) data , strlen(data));
+ free(data);
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+int
+get_me1SystemLoadAvg5min(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /* We are never called for a GETNEXT if it's registered as a
+ "instance", as it's "magically" handled for us. */
+
+ /* a instance handler also only hands us one request at a time, so
+ we don't need to loop over a list of requests; we'll only get one. */
+
+ char* data;
+ switch(reqinfo->mode) {
+
+ case MODE_GET:
+ data = getLoadAvg(LOADAVG_5MIN);
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) data , strlen(data));
+ free(data);
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_1/demo_module_1.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ */
+
+
+
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.1.1.1 2003/03/26 18:12:30 pcarroll Exp $
+ */
+#ifndef DEMO_MODULE_1_H
+#define DEMO_MODULE_1_H
+
+/* function declarations */
+void init_demo_module_1(void);
+Netsnmp_Node_Handler get_me1SystemLoadAvg5min;
+Netsnmp_Node_Handler get_me1SystemLoadAvg1min;
+Netsnmp_Node_Handler get_me1SystemLoadAvg15min;
+
+#endif /* DEMO_MODULE_1_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_10/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# Use is subject to license terms.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate demo_module_9.so
+#
+# usage:
+# "make" : generate library for 64bit / sparc
+# "make ARCH=32" : generate library for 32bit / sparc
+# "make ARCH=32 MACH=x86" : generate library for 32bit / x86
+# "make clean" : remove *.o , *.so
+#
+
+
+ARCH=64
+LDFLAGS_64=-g -m64 -I.
+LDFLAGS_32=-g -I.
+LDFLAGS=$(LDFLAGS_$(ARCH))
+
+LDLIBS=
+
+PROG= demo_module_10.so
+SRCS= demo_module_10.c
+OBJS = $(SRCS:.c=.o)
+
+all:$(PROG)
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) $(LDLIBS) -G -o $@ $(OBJS)
+.c.o:
+ $(CC) $(LDFLAGS) -g -o $@ -c $<
+
+clean:
+ rm -f *.o *.so
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_10/README_demo_module_10 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,247 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+README for demo_module_10
+***********************************************************************
+
+This example demonstrates a module design that handles long running
+data collections so that their values can be polled by an SNMP manager.
+The example also shows how to implement objects that normally would block
+the agent as it waits for external events in such a way that the agent can
+continue responding to other requests while this implementation waits.
+
+This example uses the following features of SMA:
+
+- Setting the delegated member of the requests structure to 1 to indicate to
+ the agent that this request should be delayed. The agent queues this request
+ to be handled later and then is available to handle other requests. The
+ agent is not blocked by this request.
+
+- Registering an SNMP alarm to update the results at a later time.
+
+- Use of a status variable to communicate the status of a data collection to
+ the polling SNMP manager.
+
+- Use of a refreshTime variable to return the date and time that the data
+ collection completed.
+
+
+How to Build the demo_module_10 Code Example
+============================================
+
+The demo_module_10 code example includes the following files, by default
+located in the directory /usr/demo/sma_snmp/demo_module_10.
+
+Files:
+
+Makefile - makefile to build the demo_module_10.so shared library file
+demo_module_10.c - module source code
+demo_module_10.h - module header file
+SDK-DEMO10-MIB.txt - MIB file
+get_status - Script that gets the value of the status variable
+get_refreshtime - Script that gets the date and time of the current data
+collection get_data - Script that gets the data returned by the data collection
+set_data - Script sets the value of the status variable to 0, which starts a
+new data collection
+
+To set up your build environment for the demo:
+
+1. Copy the demo code to a directory for which you have write permission.
+ For example:
+
+ % cp -R /usr/demo/sma_snmp/demo_module_10 /home/username/demo
+
+
+2. Create a lib directory that you can use to store shared object libraries
+ that you generate from demo code examples, if you have not already done so.
+ For example:
+
+ % mkdir /home/username/demo/lib
+
+
+3. Create a mibs directory that you can use to store MIB files for the demo
+ code examples, if you have not already done so.
+ For example:
+
+ % mkdir /home/username/demo/mibs
+
+
+4. Set the CC environment variable to the location of the C compiler to be
+ used.
+ For example, if you are using Sun ONE Studio:
+
+ % setenv CC /opt/SUNWspro/bin/cc
+
+
+5. Set your PATH environment variable to include the appropriate paths, so that
+ needed binaries can be found during the compilation process.
+ For example, in the csh:
+
+ % setenv PATH .:/usr/bin:$PATH
+
+
+To build the example:
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_10
+
+
+2. Use the make command to generate object files.
+
+ If you are running the 64-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make
+
+ If you are running the 32-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+ If you are running the Solaris x86 kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+
+3. Copy the module shared library object to the lib directory you created.
+ For example:
+
+ % cp demo_module_10.so /home/username/demo/lib
+
+
+4. Copy SDK-DEMO10-MIB.txt to the mibs directory you created for the demos.
+ For example:
+
+ % cp SDK-DEMO10-MIB.txt /home/username/demo/mibs
+
+
+
+
+Setting Up Agent to Run the demo_module_10 Module
+=================================================
+
+1. As root, edit the agent's configuration file /etc/sma/snmp/snmpd.conf,
+ and insert a dlmod statement for the module. This statement enables the
+ agent to load the module.
+ For example:
+
+ dlmod demo_module_10 /home/username/demo/lib/demo_module_10.so
+
+
+2. As root, start the SMA snmp agent. If the agent is already running,
+ stop and restart it in debug mode.
+ For example:
+
+ # /etc/init.d/init.sma stop
+ # /usr/sbin/snmpd -Ddemo_module_10
+
+ The optional -Ddemo_module_10 argument sends debugging statements from
+ demo_module_10 to the /var/log/snmpd.log file. You can also use the -L
+ and -f options to send debugging statements to the screen instead.
+
+
+
+Testing the Code Example
+========================
+
+1. Set your MIBS and MIBDIRS environment variables to
+ include the appropriate paths.
+ For example, in the csh:
+
+ % setenv MIBDIRS .:/home/username/demo/mibs:/etc/sma/snmp/mibs
+ % setenv MIBS +SDK-DEMO10-MIB
+
+ Note that step 1 is not required, but it enables snmpget to access the MIB
+ to provide variable names instead of OIDs in its output.
+
+
+2. Run the get_status script to get the default value of
+ the status variable.
+
+ % get_status
+ SDK-DEMO10-MIB::status.0 = INTEGER: 2
+
+ An SNMP manager would typically poll the status variable
+ of devices that generate long running data collections, until
+ a value 2 is returned, which indicates that the collection is
+ complete and the data is ready to get.
+
+ status has a default value of 0, which means no data collection
+ has been started, so the module starts a new collection.
+ When the collection completes, status is set to 2.
+
+
+3. Run the get_refreshtime script to get the date and time
+ of the data collection.
+
+ % get_refreshtime
+ SDK-DEMO10-MIB::refreshTime.0 = STRING: Fri Jul 18 12:36:56 2003
+
+ After retrieving the date and time, the SNMP manager can decide whether the
+ date of the data collection is acceptable. If the manager needs more recent
+ data, it can set the status variable to 0 to start a new collection. In this
+ example, the manager wants more recent data.
+
+
+4. Set the status variable to 0 to start a new collection, as follows:
+
+ % set_status
+ SDK-DEMO10-MIB::status.0 = INTEGER: 0
+
+ Note that SET requests through this object will take longer,
+ since the delay is applied to each internal transaction phase,
+ which could result in delays of up to 4 times the value of this object.
+
+ For example, initially, the default value is
+ 1 second. Therefore, specify a 3 second timeout value on the
+ snmpset command line.
+
+
+5. Run the get_status script again to get the status value.
+
+ % get_status
+ SDK-DEMO10-MIB::status.0 = INTEGER: 2
+
+6. Run the get_data script to get the data resulting from
+ the data collection, for example:
+
+ % get_data
+ SDK-DEMO10-MIB::longRunScalar.0 = INTEGER: 325
+
+
+7. Open two terminal windows so you can run two scripts at the same time, as
+ follows:
+
+ In the first window, run the get_status script:
+
+ % get_status
+ SDK-DEMO10-MIB::status.0 = INTEGER: 2
+
+
+ In the second window, run the walk_demo_module_10 script:
+
+ % walk_demo_module_10
+
+ SNMPv2-MIB::sysDescr.0 = STRING: SunOS myhost 5.10 s10_35 sun4u
+ SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-TC::solaris
+ DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (497128) 1:22:51.28
+ SNMPv2-MIB::sysContact.0 = STRING: "Administrator's Name"
+ SNMPv2-MIB::sysName.0 = STRING: myhost
+ SNMPv2-MIB::sysLocation.0 = STRING: My Town
+ SNMPv2-MIB::sysORLastChange.0 = Timeticks: (8) 0:00:00.08
+ SNMPv2-MIB::sysORID.1 = OID: IF-MIB::ifMIB
+ ...
+
+ This example demonstrates that the agent is not blocked and does respond to
+ the snmpwalk request, while the snmpget request executed in the first
+ window is still pending.
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_10/SDK-DEMO10-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,97 @@
+
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are subject to
+-- the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun, Sun
+-- Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+--
+--
+
+----------------------------------------------------------
+-- Systems Management Agent (SMA) SDK module DEMO-10 MIB
+----------------------------------------------------------
+
+SDK-DEMO10-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+ enterprises, MODULE-IDENTITY, OBJECT-TYPE, Counter64, Integer32, Unsigned32
+ FROM SNMPv2-SMI
+ OBJECT-GROUP
+ FROM SNMPv2-CONF
+ DisplayString
+ FROM SNMPv2-TC;
+
+sdkDemo10MIB MODULE-IDENTITY
+ LAST-UPDATED "0009181435Z"
+ ORGANIZATION "Sun Microsystems Inc."
+ CONTACT-INFO
+ " Sun Microsystems Inc
+ 4150 Network Circle
+ Santa Clara, CA 95054
+ e-mail: [email protected]"
+ DESCRIPTION
+ " SMA SDK MIB DEMO-10. This MIB will be used to demonstrate
+ a long running data collection."
+ ::= { demo 10 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+management OBJECT IDENTIFIER ::= { products 2 }
+sma OBJECT IDENTIFIER ::= { management 4 }
+demo OBJECT IDENTIFIER ::= { sma 4 }
+
+--
+-- The "LongRun" group contains scalars to be used in getting
+-- data from long running data collections.
+--
+
+LongRunGroup OBJECT-GROUP
+ OBJECTS { longRunScalar, status, refreshTime }
+ STATUS current
+ DESCRIPTION
+ "Ojbects to get data from long-running data collections."
+ ::= { sdkDemo10MIB 1 }
+
+--
+-- Properties in the "LongRun" group
+--
+
+longRunScalar OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Simple integer value returned by demo_module_10."
+ ::= { LongRunGroup 1 }
+
+status OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Status of long running data collection. The value 0
+ indicates no collection running, the agent will start one.
+ The value 1 indicates the collection is running. The value
+ 2 indicates that the collection is complete and the data
+ data is ready to GET. Set status to 0 to start a new data
+ collection. Zero is the only valid valueto which you can set
+ the status variabel."
+ DEFVAL { 0 }
+
+ ::= { LongRunGroup 2 }
+
+refreshTime OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Time stamp of data collection."
+ ::= { LongRunGroup 3 }
+
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_10/demo_module_10.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,469 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using :
+ * mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <time.h>
+#include "demo_module_10.h"
+
+// Default scalar data value
+static long exampleData = 0;
+
+// Status of data collection
+static u_long status = 0;
+
+// Default delay time
+static u_long delay_time = 2;
+
+// Default alarm interval
+static u_long alarm_time = 5;
+
+// Data collection timestamp
+char refreshTime[256];
+
+// System date/time
+time_t mytime;
+
+
+/*
+ The following code example demonstrates a module design that handles
+ long running data collections so that their values can be polled by
+ an SNMP manager. The example also shows how to implement objects that
+ normally would block the agent as it waits for external events in such
+ a way that the agent can continue responding to other requests while
+ this implementation waits.
+
+ This example uses the following features of SMA:
+
+ - Setting the delegated member of the requests structure to 1 to indicate to the
+ agent that this request should be delayed. The agent queues this request
+ to be handled later and then is available to handle other requests. The
+ agent is not blocked by this request.
+
+ - Registering an SNMP alarm to update the results at a later time.
+
+ - Use of a status variable to communicate the status of a data collection to
+ the polling SNMP manager.
+
+ - Use of a refreshTime variable to return the date and time that the data collection
+ completed.
+*/
+
+/* Initialialization routine that is automatically called by the agent.
+ The function name must match init_FILENAME() */
+
+void
+init_demo_module_10(void)
+{
+ /*
+ * the OID at which to register the exampleData variable.
+ */
+ static oid longRunScalar_oid[] =
+ {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 10, 1, 1, 0};
+
+ /*
+ * the OID at which to register the status variable.
+ */
+ static oid status_oid[] =
+ {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 10, 1, 2, 0};
+
+ /*
+ * the OID at which to register the refreshTime variable.
+ */
+ static oid refreshTime_oid[] =
+ {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 10, 1, 3, 0};
+
+
+
+ netsnmp_handler_registration *myreg;
+
+ /*
+ * A debugging statement. Run the agent with -Ddemo_module_10 to see
+ * the output of this debugging statement in /var/log/snmpd.log, by
+ * default. Use the -L option to write debugging output to the
+ * screen.
+ */
+ DEBUGMSGTL(("demo_module_10", "Initializing\n"));
+ /*
+ * Creates a read-only registration handler named longRunScalar,
+ * which calls the get_longRunScalar function to service snmp
+ * requests for the longRunScalar_oid object. The OID_LENGTH
+ * argument calculates the length of the longRunScalar_oid.
+ */
+ myreg = netsnmp_create_handler_registration
+ ("longRunScalar",
+ get_longRunScalar,
+ longRunScalar_oid,
+ OID_LENGTH(longRunScalar_oid),
+ HANDLER_CAN_RONLY);
+ /*
+ * Register the instance and handler.
+ *
+ */
+ netsnmp_register_read_only_instance(myreg);
+
+ /*
+ * Creates a read/write registration handler named getStatus,
+ * which calls the get_status function to service snmp
+ * requests for the status_oid object. The OID_LENGTH
+ * argument calculates the length of the status_oid.
+ */
+
+ myreg = netsnmp_create_handler_registration
+ ("delayed_instance_handler",
+ delayed_instance_handler,
+ status_oid,
+ OID_LENGTH(status_oid),
+ HANDLER_CAN_RWRITE);
+ /*
+ * Register the instance and handler.
+ *
+ */
+ netsnmp_register_instance(myreg);
+
+
+ /*
+ * Creates a read-only registration handler named getTimestamp,
+ * which calls the get_timestamp function to service snmp
+ * get requests for the timestamp_oid object. The OID_LENGTH
+ * argument calculates the length of the timestamp_oid.
+ */
+
+ myreg = netsnmp_create_handler_registration
+ ("getTimestamp",
+ get_timestamp,
+ refreshTime_oid,
+ OID_LENGTH(refreshTime_oid),
+ HANDLER_CAN_RONLY);
+ /*
+ * Register the instance and handler.
+ *
+ */
+ netsnmp_register_instance(myreg);
+
+}
+
+#define DELAYED_INSTANCE_SET_NAME "test_delayed"
+
+int
+delayed_instance_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /*
+ This handler is called to handle SNMP GET and SNMP SET
+ requests for the my_delayed_oid object. If it is called to
+ handle SNMP GET requests, the handler does not need to
+ handle a GETNEXT if it is registered as an instance handler.
+ Instance handlers only deliver one request at a time, so we
+ do not need to loop over a list of requests. */
+
+ DEBUGMSGTL(("demo_module_10", "Handler got request, mode = %d:\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * here we merely mention that we'll answer this request
+ * later. we don't actually care about the mode type in this
+ * example, but for certain cases you may, so I'll leave in the
+ * otherwise useless switch and case statements
+ */
+
+ default:
+ /*
+ * Mark this variable as something that cannot be handled now
+ * by setting the delegated member of the requests structure
+ * to 1. The agent queues the request to be handled at a later
+ * time and continues responding to other client requests.
+ *
+ */
+ requests->delegated = 1;
+ DEBUGMSGTL(("demo_module_10", "Delegated is %d\n",
+ requests->delegated));
+ /*
+ * Register an alarm to update the results at a later
+ * time. Normally, we might have to query something else
+ * (like an external request sent to a different network
+ * or system socket, etc), but for this example we'll do
+ * something really simply and just insert an alarm for a
+ * certain period of time.
+ */
+ snmp_alarm_register(alarm_time, /* seconds */
+ 0, /* dont repeat. */
+ get_status, /* the function */
+ /* to call */
+ /*
+ * Create a "cache" of useful
+ * information that can be retrieved
+ * at a later time. This argument is
+ * passed back to the module in the callback
+ * function for an alarm.
+ */
+ (void *)
+ netsnmp_create_delegated_cache(handler,
+ reginfo,
+ reqinfo,
+ requests,
+ NULL));
+ break;
+
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+get_longRunScalar(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * This handler returns the data from the data collection, if the
+ * collection has finished. If the collection has not finished.
+ * it returns an SNMP_ERR_NOACCESS error.
+ *
+ * This handler is never called for a getnext if it is registered as
+ * an instance. An instance handler only delivers one request at a
+ * time, so we do not need to loop over a list of requests.
+ */
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ // if collection done, return data; else return snmp error
+ if (status == 2)
+ snmp_set_var_typed_value(requests->requestvb,
+ ASN_INTEGER, (u_char *) & exampleData,
+ sizeof (exampleData) /* length in bytes */);
+ else
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_NOACCESS);
+ break;
+ default:
+ /*
+ * We should never get here, so this is a really bad error.
+ */
+ return (SNMP_ERR_GENERR);
+ }
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_timestamp(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * This handler returns the date and time of the current data
+ * collection. If the collection has not completed, it returns
+ * an SNMP_ERR_NOACCESS error.
+ *
+ * This handler is never called for a getnext if it is registered as
+ * an instance. An instance handler only delivers one request at a
+ * time, so we do not need to loop over a list of requests.
+ */
+ DEBUGMSGTL(("demo_module_10", "get_timestamp CALLED\n"));
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ // A data collection is ready. Return its timestamp.
+ if (status == 2)
+ snmp_set_var_typed_value(requests->requestvb,
+ ASN_OCTET_STR, (u_char *)refreshTime,
+ sizeof (refreshTime));
+ else
+ // no data collection, so no timestamp available.
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_NOACCESS);
+ break;
+ default:
+ /*
+ * We should never get here, so this is a really bad error.
+ */
+ return (SNMP_ERR_GENERR);
+ }
+ return (SNMP_ERR_NOERROR);
+}
+
+void
+get_status(unsigned int clientreg, void *clientarg)
+{
+ /*
+ * This function returns the value of the status variable.
+ * If the value of status is 0 (no collection is running), it
+ * calles collect_data to start one.
+ *
+ */
+
+ /*
+ * Extract the cache from the passed argument.
+ */
+ netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) clientarg;
+ netsnmp_request_info *requests;
+ netsnmp_agent_request_info *reqinfo;
+ u_long *delay_time_cache = NULL;
+
+ /*
+ * Make sure the cache created earlier is still
+ * valid. If not, the request timed out for some reason and we
+ * do not need to keep processing things. Should never happen, but
+ * this double checks.
+ */
+ cache = netsnmp_handler_check_cache(cache);
+
+ if (!cache) {
+ snmp_log(LOG_ERR, "illegal call to return delayed response\n");
+ return;
+ }
+
+ /*
+ * Re-establish the previous pointers,
+ */
+ reqinfo = cache->reqinfo;
+ requests = cache->requests;
+
+ DEBUGMSGTL(("demo_module_10",
+ "continuing delayed request, mode = %d\n",
+ cache->reqinfo->mode));
+
+ /*
+ * Set delegated to zero to indicate that the request is no longer
+ * delegated and answer the query.
+ */
+ requests->delegated = 0;
+
+ switch (cache->reqinfo->mode) {
+ /*
+ * Registering as an instance means we do not need to deal with
+ * GETNEXT processing, so we do not handle it here at all.
+ *
+ * However, since the instance handler already reset the mode
+ * back to GETNEXT from the GET mode, we need to do the
+ * same thing in both cases.
+ *
+ */
+ case MODE_GET:
+ // no collection running, start one.
+ if (status == 0)
+ collect_data();
+ snmp_set_var_typed_value(requests->requestvb,
+ ASN_INTEGER, (u_char *) & status,
+ sizeof (status) /* length in bytes */);
+ break;
+ case MODE_SET_RESERVE1:
+ /*
+ * check type
+ */
+ if (requests->requestvb->type != ASN_INTEGER) {
+ /*
+ * If not an integer, return SNMP error.
+ */
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_WRONGTYPE);
+ /*
+ * Free cache. It is no longer needed.
+ */
+ netsnmp_free_delegated_cache(cache);
+ return;
+ }
+ break;
+ case MODE_SET_RESERVE2:
+ /*
+ * Store old value for UNDO support in the future.
+ */
+ memdup((u_char **) & delay_time_cache,
+ (u_char *) & delay_time, sizeof(delay_time));
+
+ /*
+ * malloc failed
+ */
+ if (delay_time_cache == NULL) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ netsnmp_free_delegated_cache(cache);
+ return;
+ }
+
+ /*
+ * Add our temporary information to the request itself.
+ * This is then retrivable later. The free function
+ * passed auto-frees it when the request is later
+ * deleted.
+ */
+ netsnmp_request_add_list_data(requests,
+ netsnmp_create_data_list
+ (DELAYED_INSTANCE_SET_NAME,
+ delay_time_cache, free));
+ break;
+ case MODE_SET_ACTION:
+ // get status integer from request
+ // if status == 0, start data collection, else return error
+ if (*(requests->requestvb->val.integer) == 0) {
+ status = *(requests->requestvb->val.integer);
+ collect_data();
+ } else
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_WRONGTYPE);
+ break;
+ case MODE_SET_UNDO:
+ /*
+ * A failure occurred. Reset to the
+ * previously value by extracting the previosuly
+ * stored information from the request.
+ */
+ delay_time =
+ *((u_long *) netsnmp_request_get_list_data(requests,
+ DELAYED_INSTANCE_SET_NAME));
+ break;
+ case MODE_SET_COMMIT:
+ break;
+ case MODE_SET_FREE:
+ /*
+ * The only thing to do here is free the old memdup'ed
+ * value, but it's auto-freed by the datalist recovery, so
+ * we don't have anything to actually do here
+ */
+ break;
+ }
+
+ /*
+ * free the information cache
+ */
+ netsnmp_free_delegated_cache(cache);
+
+}
+
+void collect_data()
+{
+ /*
+ * This function starts a data collection.
+ */
+ status = 1; // set collection pending flag
+ sleep(delay_time); // simulate long-running collection
+ // get timestamp for this data collection
+ mytime = time(NULL);
+ strftime (refreshTime, sizeof(refreshTime), "%c", localtime(&mytime));
+ exampleData = 325;
+ status = 2; // set collection complete flag
+ return;
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_10/demo_module_10.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+
+#ifndef demo_module_10_H
+#define demo_module_10_H
+
+/* function declarations */
+void init_demo_module_10(void);
+
+void collect_data(void);
+extern int sleep(int);
+
+Netsnmp_Node_Handler get_longRunScalar;
+Netsnmp_Node_Handler delayed_instance_handler;
+Netsnmp_Node_Handler get_timestamp;
+SNMPAlarmCallback get_status;
+
+
+#endif /* demo_module_10_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_10/get_data Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,16 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+/usr/bin/snmpget -m+SDK-DEMO10-MIB -v 1 -c public localhost .1.3.6.1.4.1.42.2.2.4.4.10.1.1.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_10/get_refreshtime Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,16 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+/usr/bin/snmpget -m+SDK-DEMO10-MIB -v 1 -c public localhost .1.3.6.1.4.1.42.2.2.4.4.10.1.3.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_10/get_status Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,16 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+/usr/bin/snmpget -m+SDK-DEMO10-MIB -t 10 -v 1 -c public localhost .1.3.6.1.4.1.42.2.2.4.4.10.1.2.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_10/set_status Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,17 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+/usr/bin/snmpset -m+SDK-DEMO10-MIB -t 20 -v 1 -c private localhost .1.3.6.1.4.1.42.2.2.4.4.10.1.2.0 i 0
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_10/walk_demo_module_10 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,18 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+#command to walk to SYSTEM table
+
+/usr/bin/snmpwalk -mALL -v 1 -c public localhost system
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_11/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,50 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# Use is subject to license terms.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate demo_module_11.so
+#
+# usage:
+# To point to a particular compiler, set CC.
+# Example: setenv CC /usr/dist/share/forte_dev/bin/cc
+# "make" : generate library for 64bit
+# "make ARCH=32" : generate library for 32bit
+# "make clean" : remove *.o , *.so
+#
+
+ARCH=64
+CFLAGS_64=-g -m64 -I/usr/include/sma_snmp -I.
+CFLAGS_32=-g -I/usr/include/sma_snmp -I.
+CFLAGS=$(CFLAGS_$(ARCH))
+
+LDLIBS_64= -B dynamic -L /usr/lib/sparcv9 -l entity
+LDLIBS_32= -B dynamic -l entity
+LDLIBS=$(LDLIBS_$(ARCH))
+
+PROG= demo_module_11.so
+SRCS= MyTable.c
+OBJS = $(SRCS:.c=.o)
+
+all:$(PROG)
+$(PROG): $(OBJS)
+ $(CC) $(CFLAGS) $(LDLIBS) -G -o $@ $(OBJS)
+.c.o:
+ $(CC) $(CFLAGS) -g -o $@ -c $<
+
+clean:
+ rm -f MyTable.o demo_module_11.so
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_11/MyTable.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,363 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "stdhdr.h"
+#include "entPhysicalTable.h"
+#include "entLogicalTable.h"
+#include "entPhysicalContainsTable.h"
+#include "entAliasMappingTable.h"
+#include "entLPMappingTable.h"
+#include "MyTable.h"
+
+/*
+ These are global arrays that manage the physical indexes
+ and logical indexes within the scope of this program.
+ Similar index management scheme will be
+ developed within the program that uses the entity MIB
+ skeleton. The array is statically allocated here
+ for convience in the example
+*/
+int i=0, j=0;
+int physicalIndex[25], logicalIndex[25];
+
+
+/*
+This is the initialisation function for the library.
+This function is always named as init_<library name>. This function is called during
+when this library gets loaded in the agent. Make sure that the libentity.so
+library is already loaded before this library is loaded.
+
+*/
+
+void init_demo_module_11(void) {
+
+ entPhysicalEntry_t zEntry;
+ entLogicalEntry_t zLogEntry;
+
+/*
+ All these are ficitious OIDs created for this example. Do not
+ rely on these OID numbers, these are used just for demonstration
+ purposes
+*/
+ oid chassis_oid[] = { 1, 3, 6, 1, 4, 1, 42, 200, 1 };
+ oid slot_oid[] = { 1, 3, 6, 1, 4, 1, 42, 201, 1 };
+ oid cpu_oid1[] = { 1, 3, 6, 1, 4, 1, 42, 202, 14 };
+ oid cpu_oid2[] = { 1, 3, 6, 1, 4, 1, 42, 202, 15 };
+ oid cpu_oid3[] = { 1, 3, 6, 1, 4, 1, 42, 202, 25 };
+
+ oid module_oid1[] = { 1, 3, 6, 1, 4, 1, 42, 203, 2 };
+ oid module_oid2[] = { 1, 3, 6, 1, 4, 1, 42, 203, 5 };
+
+ oid port_oid[] = { 1, 3, 6, 1, 4, 1, 42, 204, 5 };
+
+ oid solaris_oid[] = { 1, 3, 6, 1, 4, 1, 42, 2, 1 };
+ oid SunExample_oid[] = { 1, 3, 6, 1, 4, 1, 42, 1005 };
+
+ oid ifIndex_oid1[] = { 1,3,6,1,2,1,2,2,1,1,1 };
+ oid ifIndex_oid2[] = { 1,3,6,1,2,1,2,2,1,1,2 };
+ oid ifIndex_oid3[] = { 1,3,6,1,2,1,2,2,1,1,3 };
+
+
+/*
+ Assuming that the entity MIB skeleton is already loaded, the
+ following lines adds all the Physical objects that will
+ be present in the modelled system
+*/
+
+ FillentPhysicalEntry(&zEntry, "Sun Chassis Model b1000", chassis_oid, sizeof(chassis_oid),
+ 0, 3, -1, "b1000", "A(1.00.02)", "", "", "C100076544",
+ "Sun Microsystems", "CHS-1000", "cl-SJ17-3-006:rack1:rtr-U3",
+ "0007372293", MIB_TRUE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+ FillentPhysicalEntry(&zEntry, "Sun Chassis Slot Type AA", slot_oid,
+ sizeof(slot_oid), 1, 5, 1, "S1", "B(1.00.01)", "", "", "",
+ "Sun Microsystems", "SLT-AA97", "", "", MIB_FALSE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+ FillentPhysicalEntry(&zEntry, "Sun Chassis Slot Type AA", slot_oid,
+ sizeof(slot_oid), 1, 5, 2, "S2", "1.00.07", "", "", "",
+ "Sun Microsystems", "SLT-AA97", "", "", MIB_FALSE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+ FillentPhysicalEntry(&zEntry, "Sun Chassis Slot Type AA", slot_oid,
+ sizeof(slot_oid), 1, 5, 3, "S3", "1.00.07", "", "", "",
+ "Sun Microsystems", "SLT-AA97", "", "", MIB_FALSE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+ FillentPhysicalEntry(&zEntry, "Sun CPU-100", cpu_oid1,
+ sizeof(cpu_oid1), 2, 9, 1, "M1", "1.00.07", "1.5.1", "A(1.1)",
+ "C100087363", "Sun Microsystems", "R10-FE00",
+ "rtr-U3:m1:SJ17-3-eng", "0007372562", MIB_TRUE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+
+ FillentPhysicalEntry(&zEntry, "Sun Ultrasparc-III 400MHz", module_oid1,
+ sizeof(module_oid1), 5, 1, 1, "P1", "G(1.02)", "", "1.1", "",
+ "Sun Microsystems", "SFE-400M", "", "", MIB_FALSE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+ FillentPhysicalEntry(&zEntry, "Sun Ultrasparc-III 400MHz", module_oid1,
+ sizeof(module_oid1), 5, 1, 2, "P2", "G(1.02)", "", "1.1", "",
+ "Sun Microsystems", "SFE-400M", "", "", MIB_FALSE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+ FillentPhysicalEntry(&zEntry, "Sun CPU-200", cpu_oid2,
+ sizeof(cpu_oid2), 3, 9, 1, "M2", "2.01.00", "3.0.7", "A(1.2)",
+ "C100098732", "Sun Microsystems", "R10-FE0C",
+ "rtr-U3:m2:SJ17-2-eng", "0007373982", MIB_TRUE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+ FillentPhysicalEntry(&zEntry, "Sun Ultrasparc-III 400MHz", module_oid2,
+ sizeof(module_oid2), 8, 1, 1, "P3", "CC(1.07)", "2.0.34", "1.1", "",
+ "Sun Microsystems", "SFE-400M", "", "", MIB_FALSE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+ FillentPhysicalEntry(&zEntry, "Sun Ultrasparc-III 400MHz", module_oid1,
+ sizeof(module_oid1), 8, 1, 2, "P4", "G(1.04)", "", "1.3", "",
+ "Sun Microsystems", "SFE-400M", "", "", MIB_FALSE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+ FillentPhysicalEntry(&zEntry, "Sun port-200", cpu_oid3,
+ sizeof(cpu_oid3), 4, 9, 1, "M2", "2.01.00", "3.0.7", "A(1.2)",
+ "C100098732", "Sun Microsystems", "R11-C100",
+ "rtr-U3:m2:SJ17-2-eng", "0007373982", MIB_TRUE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+
+ FillentPhysicalEntry(&zEntry, "Sun Ethernet-100 Port", port_oid,
+ sizeof(port_oid), 11, 10, 1, "P3", "CC(1.07)", "2.0.34", "1.1",
+ "", "Sun Microsystems", "SFE-P100", "", "", MIB_FALSE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+ FillentPhysicalEntry(&zEntry, "Sun Ethernet-100 Port", port_oid,
+ sizeof(port_oid), 11, 10, 2, "Ethernet B", "G(1.04)", "", "1.3",
+ "", "Sun Microsystems", "SFE-P100", "", "", MIB_FALSE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+ FillentPhysicalEntry(&zEntry, "Sun Ethernet-100 Port", port_oid,
+ sizeof(port_oid), 11, 10, 3, "Ethernet B", "G(1.04)", "", "1.3",
+ "", "Sun Microsystems", "SFE-P100", "", "", MIB_FALSE);
+ physicalIndex[i++] = allocPhysicalEntry(0, &zEntry);
+
+/*
+ The following lines adds all the logical instances that will
+ be present in the modelled system. Here first parameter to
+ allocLogicalEntry is ignored for now, it may be used in the
+ future to request a particular index in the table
+*/
+
+ FillentLogicalEntry(&zLogEntry, "Domain A", solaris_oid,
+ sizeof(solaris_oid), "public-dom1", "124.125.126.127:161",
+ SunExample_oid, sizeof(SunExample_oid), "", "");
+ logicalIndex[j++] = allocLogicalEntry(0, &zLogEntry);
+
+ FillentLogicalEntry(&zLogEntry, "Domain B", solaris_oid,
+ sizeof(solaris_oid), "public-dom2", "124.125.126.128:161",
+ SunExample_oid, sizeof(SunExample_oid), "", "");
+ logicalIndex[j++] = allocLogicalEntry(0, &zLogEntry);
+
+ FillentLogicalEntry(&zLogEntry, "Sun Firewall v2.1.1", solaris_oid,
+ sizeof(solaris_oid), "public-firewall1", "124.125.126.129:161",
+ SunExample_oid, sizeof(SunExample_oid), "", "");
+ logicalIndex[j++] = allocLogicalEntry(0, &zLogEntry);
+
+ FillentLogicalEntry(&zLogEntry, "Sun Firewall v2.1.1", solaris_oid,
+ sizeof(solaris_oid), "public-firewall2", "124.125.126.130:161",
+ SunExample_oid, sizeof(SunExample_oid), "", "");
+ logicalIndex[j++] = allocLogicalEntry(0, &zLogEntry);
+
+
+/*
+
+ Now we add all the relationships into the entity MIB. The
+ physical and logical indexes must be present to create
+ any relationships, and so the relationship table is
+ filled after the physical and logical tables are
+ populated
+
+*/
+
+ if (addLPMappingTableEntry(1, 5))
+ snmp_log(LOG_ERR, "LPMappingTable Addition failed");
+
+ if (addLPMappingTableEntry(1, 12))
+ snmp_log(LOG_ERR, "LPMappingTable Addition failed");
+
+ if (addLPMappingTableEntry(2, 8))
+ snmp_log(LOG_ERR, "LPMappingTable Addition failed");
+
+ if (addLPMappingTableEntry(2, 13))
+ snmp_log(LOG_ERR, "LPMappingTable Addition failed");
+
+ if (addLPMappingTableEntry(2, 14))
+ snmp_log(LOG_ERR, "LPMappingTable Addition failed");
+
+ if (addLPMappingTableEntry(3, 6))
+ snmp_log(LOG_ERR, "LPMappingTable Addition failed");
+
+ if (addLPMappingTableEntry(3, 12))
+ snmp_log(LOG_ERR, "LPMappingTable Addition failed");
+
+ if (addLPMappingTableEntry(4, 9))
+ snmp_log(LOG_ERR, "LPMappingTable Addition failed");
+
+ if (addLPMappingTableEntry(4, 13))
+ snmp_log(LOG_ERR, "LPMappingTable Addition failed");
+
+ if (addLPMappingTableEntry(4, 14))
+ snmp_log(LOG_ERR, "LPMappingTable Addition failed");
+
+/*
+
+ Any error in addition to the relationship table will
+ be logged in the agent's log file
+
+*/
+
+ if (addAliasMappingTableEntry(12, 0, ifIndex_oid1, sizeof(ifIndex_oid1)))
+ snmp_log(LOG_ERR, "AliasMappingTable Addition failed");
+
+ if (addAliasMappingTableEntry(13, 0, ifIndex_oid2, sizeof(ifIndex_oid2)))
+ snmp_log(LOG_ERR, "AliasMappingTable Addition failed");
+
+ if (addAliasMappingTableEntry(14, 0, ifIndex_oid3, sizeof(ifIndex_oid3)))
+ snmp_log(LOG_ERR, "AliasMappingTable Addition failed");
+
+/*
+ The physical child table must not contains any recursive relationships
+ Care must be taken to avoid them. The entity MIB infrastructure should
+ be able to check this in the future
+*/
+
+ if (addPhysicalContainsTableEntry(1, 2))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+ if (addPhysicalContainsTableEntry(1, 3))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+ if (addPhysicalContainsTableEntry(1, 4))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+ if (addPhysicalContainsTableEntry(2, 5))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+ if (addPhysicalContainsTableEntry(3, 8))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+ if (addPhysicalContainsTableEntry(4, 11))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+ if (addPhysicalContainsTableEntry(4, 6))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+ if (addPhysicalContainsTableEntry(4, 7))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+ if (addPhysicalContainsTableEntry(8, 9))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+ if (addPhysicalContainsTableEntry(8, 10))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+ if (addPhysicalContainsTableEntry(11, 12))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+ if (addPhysicalContainsTableEntry(11, 13))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+ if (addPhysicalContainsTableEntry(11, 14))
+ snmp_log(LOG_ERR, "PhysicalChild Table Addition failed");
+
+/*
+ printTableIndex();
+*/
+
+
+}
+
+
+/*
+ This function is just a conveience function to add many physical table
+ entries
+*/
+
+void FillentPhysicalEntry(entPhysicalEntry_t *phyStatic,
+ char *entPhysicalDescr,
+ oid *entPhysicalVendorType,
+ int entPhysicalVendorTypeSize,
+ int entPhysicalContainedIn,
+ int entPhysicalClass,
+ int entPhysicalParentRelPos,
+ char *entPhysicalName,
+ char *entPhysicalHardwareRev,
+ char *entPhysicalFirmwareRev,
+ char *entPhysicalSoftwareRev,
+ char *entPhysicalSerialNum,
+ char *entPhysicalMfgName,
+ char *entPhysicalModelName,
+ char *entPhysicalAlias,
+ char *entPhysicalAssetID,
+ int entPhysicalIsFRU)
+{
+ phyStatic->entPhysicalDescr = entPhysicalDescr;
+ phyStatic->entPhysicalVendorType = entPhysicalVendorType;
+ phyStatic->entPhysicalVendorTypeSize = entPhysicalVendorTypeSize;
+ phyStatic->entPhysicalContainedIn = entPhysicalContainedIn;
+ phyStatic->entPhysicalClass = entPhysicalClass;
+ phyStatic->entPhysicalParentRelPos = entPhysicalParentRelPos;
+ phyStatic->entPhysicalName = entPhysicalName;
+ phyStatic->entPhysicalHardwareRev = entPhysicalHardwareRev;
+ phyStatic->entPhysicalFirmwareRev = entPhysicalFirmwareRev;
+ phyStatic->entPhysicalSoftwareRev = entPhysicalSoftwareRev;
+ phyStatic->entPhysicalSerialNum = entPhysicalSerialNum;
+ phyStatic->entPhysicalMfgName = entPhysicalMfgName;
+ phyStatic->entPhysicalModelName = entPhysicalModelName;
+ phyStatic->entPhysicalAlias = entPhysicalAlias;
+ phyStatic->entPhysicalAssetID = entPhysicalAssetID;
+ phyStatic->entPhysicalIsFRU = entPhysicalIsFRU;
+}
+
+/*
+ This function is just a convenience function to add many logical table
+ entries
+*/
+
+void FillentLogicalEntry(entLogicalEntry_t *xLogicalStatic,
+ char *entLogicalDescr,
+ oid *entLogicalType,
+ int entLogicalTypeSize,
+ char *entLogicalCommunity,
+ char *entLogicalTAddress,
+ oid *entLogicalTDomain,
+ int entLogicalTDomainSize,
+ char *entLogicalContextEngineId,
+ char *entLogicalContextName)
+{
+ xLogicalStatic->entLogicalDescr = entLogicalDescr;
+ xLogicalStatic->entLogicalType = entLogicalType;
+ xLogicalStatic->entLogicalTypeSize = entLogicalTypeSize;
+ xLogicalStatic->entLogicalCommunity = entLogicalCommunity;
+ xLogicalStatic->entLogicalTAddress = entLogicalTAddress;
+ xLogicalStatic->entLogicalTDomain = entLogicalTDomain;
+ xLogicalStatic->entLogicalTDomainSize = entLogicalTDomainSize;
+ xLogicalStatic->entLogicalContextEngineId = entLogicalContextEngineId;
+ xLogicalStatic->entLogicalContextName = entLogicalContextName;
+}
+
+
+void printTableIndex()
+{
+ int k=0, m=0;
+ printf("\n The physical indexes allocated are, \n");
+ for (k=0; k<i; k++)
+ printf("%d,", physicalIndex[k]);
+
+ printf("\n The logical indexes allocated are, \n");
+ for (m=0; m<j; m++)
+ printf("%d,", logicalIndex[m]);
+ printf("\n");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_11/MyTable.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+
+#ifndef MYTABLE_H
+#define MYTABLE_H
+
+void FillentPhysicalEntry(entPhysicalEntry_t *phyStatic,
+ char *entPhysicalDescr,
+ oid *entPhysicalVendorType,
+ int entPhysicalVendorTypeSize,
+ int entPhysicalContainedIn,
+ int entPhysicalClass,
+ int entPhysicalParentRelPos,
+ char *entPhysicalName,
+ char *entPhysicalHardwareRev,
+ char *entPhysicalFirmwareRev,
+ char *entPhysicalSoftwareRev,
+ char *entPhysicalSerialNum,
+ char *entPhysicalMfgName,
+ char *entPhysicalModelName,
+ char *entPhysicalAlias,
+ char *entPhysicalAssetID,
+ int entPhysicalIsFRU);
+
+void FillentLogicalEntry(entLogicalEntry_t *xLogicalStatic,
+ char *entLogicalDescr,
+ oid *entLogicalType,
+ int entLogicalTypeSize,
+ char *entLogicalCommunity,
+ char *entLogicalTAddress,
+ oid *entLogicalTDomain,
+ int entLogicalTDomainSize,
+ char *entLogicalContextEngineId,
+ char *entLogicalContextName);
+
+void printTableIndex();
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_11/README_demo_module_11 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,773 @@
+
+/*
+* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+*
+* U.S. Government Rights - Commercial software. Government users are subject
+* to the Sun Microsystems, Inc. standard license agreement and applicable
+* provisions of the FAR and its supplements.
+*
+*
+* This distribution may include materials developed by third parties. Sun,
+* Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+* trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+*
+*/
+
+
+README for demo_module_11
+********************************************************************
+
+This code example shows how the libentity.so API functions might be used.
+The libentity.so supports the Entity MIB. The API is documented in
+the Solaris System Management Agent Developer's Guide.
+
+This example assumes that you are familiar with the Entity MIB
+RFC number 2737, available at http://www.ietf.org/rfc/rfc2737.txt.
+
+Instructions for building and running demo_module_11 are included later in
+this README.
+
+
+Scenario
+--------
+ This example features a system containing three boards.
+ Two boards contain 2 CPU modules, and 1 board contains 3 ports.
+ There are two logical domains running and two firewall instances.
+
+ The following shows an example of how the entity MIB should be populated.
+
+ Physical entities -- entPhysicalTable:
+ 1 Field-replaceable physical chassis:
+
+ entPhysicalDescr.1 == 'Sun Chassis Model b1000'
+ entPhysicalVendorType.1 == sun.chassisTypes.1
+ entPhysicalContainedIn.1 == 0
+ entPhysicalClass.1 == chassis(3)
+ entPhysicalParentRelPos.1 == -1
+ entPhysicalName.1 == 'b1000'
+ entPhysicalHardwareRev.1 == 'A(1.00.02)'
+ entPhysicalSoftwareRev.1 == ''
+ entPhysicalFirmwareRev.1 == ''
+ entPhysicalSerialNum.1 == 'C100076544'
+ entPhysicalMfgName.1 == 'Sun Microsystems'
+ entPhysicalModelName.1 == 'CHS-1000'
+ entPhysicalAlias.1 == 'cl-SJ17-3-006:rack1:rtr-U3'
+ entPhysicalAssetID.1 == '0007372293'
+ entPhysicalIsFRU.1 == true(1)
+
+The entPhysicalSerialNum, entPhysicalAlias and entPhysicalAssetID have
+a max access as read-write. So, it is possible to set these values using
+SNMP set operations.
+
+ 3 slots within the chassis:
+ entPhysicalDescr.2 == 'Sun Chassis Slot Type AA'
+ entPhysicalVendorType.2 == sun.slotTypes.1
+ entPhysicalContainedIn.2 == 1
+ entPhysicalClass.2 == container(5)
+ entPhysicalParentRelPos.2 == 1
+ entPhysicalName.2 == 'S1'
+ entPhysicalHardwareRev.2 == 'B(1.00.01)'
+ entPhysicalSoftwareRev.2 == ''
+ entPhysicalFirmwareRev.2 == ''
+ entPhysicalSerialNum.2 == ''
+ entPhysicalMfgName.2 == 'Sun Microsystems'
+ entPhysicalModelName.2 == 'SLT-AA97'
+ entPhysicalAlias.2 == ''
+ entPhysicalAssetID.2 == ''
+ entPhysicalIsFRU.2 == false(2)
+
+ entPhysicalDescr.3 == 'Sun Chassis Slot Type AA'
+ entPhysicalVendorType.3 = sun.slotTypes.1
+ entPhysicalContainedIn.3 == 1
+ entPhysicalClass.3 == container(5)
+ entPhysicalParentRelPos.3 == 2
+ entPhysicalName.3 == 'S2'
+ entPhysicalHardwareRev.3 == '1.00.07'
+ entPhysicalSoftwareRev.3 == ''
+ entPhysicalFirmwareRev.3 == ''
+ entPhysicalSerialNum.3 == ''
+ entPhysicalMfgName.3 == 'Sun Microsystems'
+ entPhysicalModelName.3 == 'SLT-AA97'
+ entPhysicalAlias.3 == ''
+ entPhysicalAssetID.3 == ''
+ entPhysicalIsFRU.3 == false(2)
+
+ entPhysicalDescr.4 == 'Sun Chassis Slot Type AA'
+ entPhysicalVendorType.4 = sun.slotTypes.1
+ entPhysicalContainedIn.4 == 1
+ entPhysicalClass.4 == container(5)
+ entPhysicalParentRelPos.4 == 3
+ entPhysicalName.4 == 'S3'
+ entPhysicalHardwareRev.4 == '1.00.07'
+ entPhysicalSoftwareRev.4 == ''
+ entPhysicalFirmwareRev.4 == ''
+ entPhysicalSerialNum.4 == ''
+ entPhysicalMfgName.4 == 'Sun Microsystems'
+ entPhysicalModelName.4 == 'SLT-AA97'
+ entPhysicalAlias.4 == ''
+ entPhysicalAssetID.4 == ''
+ entPhysicalIsFRU.4 == false(2)
+
+
+ 3 Field-replaceable boards:
+ Slot 1 contains a board with 2 CPUs:
+ entPhysicalDescr.5 == 'Sun CPU-100'
+ entPhysicalVendorType.5 == sun.moduleTypes.14
+ entPhysicalContainedIn.5 == 2
+ entPhysicalClass.5 == module(9)
+ entPhysicalParentRelPos.5 == 1
+ entPhysicalName.5 == 'M1'
+ entPhysicalHardwareRev.5 == '1.00.07'
+ entPhysicalSoftwareRev.5 == '1.5.1'
+ entPhysicalFirmwareRev.5 == 'A(1.1)'
+ entPhysicalSerialNum.5 == 'C100087363'
+ entPhysicalMfgName.5 == 'Sun Microsystems'
+ entPhysicalModelName.5 == 'R10-FE00'
+ entPhysicalAlias.5 == 'rtr-U3:m1:SJ17-3-eng'
+ entPhysicalAssetID.5 == '0007372562'
+ entPhysicalIsFRU.5 == true(1)
+
+ entPhysicalDescr.6 == 'Sun Ultrasparc-III 400MHz'
+ entPhysicalVendorType.6 == sun.cpuTypes.2
+ entPhysicalContainedIn.6 == 5
+ entPhysicalClass.6 == other(1)
+ entPhysicalParentRelPos.6 == 1
+ entPhysicalName.6 == 'P1'
+ entPhysicalHardwareRev.6 == 'G(1.02)'
+ entPhysicalSoftwareRev.6 == ''
+ entPhysicalFirmwareRev.6 == '1.1'
+ entPhysicalSerialNum.6 == ''
+ entPhysicalMfgName.6 == 'Sun Microsystems'
+ entPhysicalModelName.6 == 'SFE-400M'
+ entPhysicalAlias.6 == ''
+ entPhysicalAssetID.6 == ''
+ entPhysicalIsFRU.6 == false(2)
+
+ entPhysicalDescr.7 == 'Sun Ultrasparc-III 400MHz'
+ entPhysicalVendorType.7 == sun.cpuTypes.2
+ entPhysicalContainedIn.7 == 5
+ entPhysicalClass.7 == other(1)
+ entPhysicalParentRelPos.7 == 2
+ entPhysicalName.7 == 'P2'
+ entPhysicalHardwareRev.7 == 'G(1.02)'
+ entPhysicalSoftwareRev.7 == ''
+ entPhysicalFirmwareRev.7 == '1.1'
+ entPhysicalSerialNum.7 == ''
+ entPhysicalMfgName.7 == 'Sun Microsystems'
+ entPhysicalModelName.7 == 'SFE-400M'
+ entPhysicalAlias.7 == ''
+ entPhysicalAssetID.7 == ''
+ entPhysicalIsFRU.7 == false(2)
+
+ Slot 2 contains another 2-cpu board:
+ entPhysicalDescr.8 == 'Sun CPU-200'
+ entPhysicalVendorType.8 == sun.moduleTypes.15
+ entPhysicalContainedIn.8 == 3
+ entPhysicalClass.8 == module(9)
+ entPhysicalParentRelPos.8 == 1
+ entPhysicalName.8 == 'M2'
+ entPhysicalHardwareRev.8 == '2.01.00'
+ entPhysicalSoftwareRev.8 == '3.0.7'
+ entPhysicalFirmwareRev.8 == 'A(1.2)'
+ entPhysicalSerialNum.8 == 'C100098732'
+ entPhysicalMfgName.8 == 'Sun Microsystems'
+ entPhysicalModelName.8 == 'R10-FE0C'
+ entPhysicalAlias.8 == 'rtr-U3:m2:SJ17-2-eng'
+ entPhysicalAssetID.8 == '0007373982'
+ entPhysicalIsFRU.8 == true(1)
+
+ entPhysicalDescr.9 == 'Sun Ultrasparc-III 400MHz'
+ entPhysicalVendorType.9 == sun.cpuTypes.5
+ entPhysicalContainedIn.9 == 8
+ entPhysicalClass.9 == other(1)
+ entPhysicalParentRelPos.9 == 1
+ entPhysicalName.9 == 'P3'
+ entPhysicalHardwareRev.9 == 'CC(1.07)'
+ entPhysicalSoftwareRev.9 == '2.0.34'
+ entPhysicalFirmwareRev.9 == '1.1'
+ entPhysicalSerialNum.9 == ''
+ entPhysicalMfgName.9 == 'Sun Microsystems'
+ entPhysicalModelName.9 == 'SFE-400M'
+ entPhysicalAlias.9 == ''
+ entPhysicalAssetID.9 == ''
+ entPhysicalIsFRU.9 == false(2)
+
+ entPhysicalDescr.10 == 'Sun Ultrasparc-III 400MHz'
+ entPhysicalVendorType.10 == sun.cpuTypes.2
+ entPhysicalContainedIn.10 == 8
+ entPhysicalClass.10 == other(1)
+ entPhysicalParentRelPos.10 == 2
+ entPhysicalName.10 == 'P4'
+ entPhysicalHardwareRev.10 == 'G(1.04)'
+ entPhysicalSoftwareRev.10 == ''
+ entPhysicalFirmwareRev.10 == '1.3'
+ entPhysicalSerialNum.10 == ''
+ entPhysicalMfgName.10 == 'Sun Microsystems'
+ entPhysicalModelName.10 == 'SFE-400M'
+ entPhysicalAlias.10 == ''
+ entPhysicalAssetID.10 == ''
+ entPhysicalIsFRU.10 == false(2)
+
+ Slot 3 contains board with 3 ports:
+ entPhysicalDescr.11 == 'Sun port-200'
+ entPhysicalVendorType.11 == sun.moduleTypes.25
+ entPhysicalContainedIn.11 == 4
+ entPhysicalClass.11 == module(9)
+ entPhysicalParentRelPos.11 == 1
+ entPhysicalName.11 == 'M2'
+ entPhysicalHardwareRev.11 == '2.01.00'
+ entPhysicalSoftwareRev.11 == '3.0.7'
+ entPhysicalFirmwareRev.11 == 'A(1.2)'
+ entPhysicalSerialNum.11 == 'C100098732'
+ entPhysicalMfgName.11 == 'Sun Microsystems'
+ entPhysicalModelName.11 == 'R11-C100'
+ entPhysicalAlias.11 == 'rtr-U3:m2:SJ17-2-eng'
+ entPhysicalAssetID.11 == '0007373982'
+ entPhysicalIsFRU.11 == true(1)
+
+ entPhysicalDescr.12 == 'Sun Ethernet-100 Port'
+ entPhysicalVendorType.12 == sun.portTypes.5
+ entPhysicalContainedIn.12 == 11
+ entPhysicalClass.12 == port(10)
+ entPhysicalParentRelPos.12 == 1
+ entPhysicalName.12 == 'P3'
+ entPhysicalHardwareRev.12 == 'CC(1.07)'
+ entPhysicalSoftwareRev.12 == '2.0.34'
+ entPhysicalFirmwareRev.12 == '1.1'
+ entPhysicalSerialNum.12 == ''
+ entPhysicalMfgName.12 == 'Sun Microsystems'
+ entPhysicalModelName.12 == 'SFE-P100'
+ entPhysicalAlias.12 == ''
+ entPhysicalAssetID.12 == ''
+ entPhysicalIsFRU.12 == false(2)
+
+
+ entPhysicalDescr.13 == 'Sun Ethernet-100 Port'
+ entPhysicalVendorType.13 == sun.portTypes.5
+ entPhysicalContainedIn.13 == 11
+ entPhysicalClass.13 == port(10)
+ entPhysicalParentRelPos.13 == 2
+ entPhysicalName.13 == 'Ethernet B'
+ entPhysicalHardwareRev.13 == 'G(1.04)'
+ entPhysicalSoftwareRev.13 == ''
+ entPhysicalFirmwareRev.13 == '1.3'
+ entPhysicalSerialNum.13 == ''
+ entPhysicalMfgName.13 == 'Sun Microsystems'
+ entPhysicalModelName.13 == 'SFE-P100'
+ entPhysicalAlias.13 == ''
+ entPhysicalAssetID.13 == ''
+ entPhysicalIsFRU.13 == false(2)
+
+ entPhysicalDescr.14 == 'Sun Ethernet-100 Port'
+ entPhysicalVendorType.14 == sun.portTypes.5
+ entPhysicalContainedIn.14 == 11
+ entPhysicalClass.14 == port(10)
+ entPhysicalParentRelPos.14 == 3
+ entPhysicalName.14 == 'Ethernet B'
+ entPhysicalHardwareRev.14 == 'G(1.04)'
+ entPhysicalSoftwareRev.14 == ''
+ entPhysicalFirmwareRev.14 == '1.3'
+ entPhysicalSerialNum.14 == ''
+ entPhysicalMfgName.14 == 'Sun Microsystems'
+ entPhysicalModelName.14 == 'SFE-P100'
+ entPhysicalAlias.14 == ''
+ entPhysicalAssetID.14 == ''
+ entPhysicalIsFRU.14 == false(2)
+
+ Logical entities -- entLogicalTable; no SNMPv3 support
+ 2 Logical Domains:
+ entLogicalDescr.1 == 'Domain A'
+ entLogicalType.1 == solaris
+ entLogicalCommunity.1 == 'public-dom1'
+ entLogicalTAddress.1 == 124.125.126.127:161
+ entLogicalTDomain.1 == SunExampleDomain
+ entLogicalContextEngineID.1 == ''
+ entLogicalContextName.1 == ''
+
+ entLogicalDescr.2 == 'Domain B'
+ entLogicalType.2 == solaris
+ entLogicalCommunity.2 == 'public-dom2'
+ entLogicalTAddress.2 == 124.125.126.128:161
+ entLogicalTDomain.2 == SunExampleDomain
+ entLogicalContextEngineID.2 == ''
+ entLogicalContextName.2 == ''
+
+ 2 Firewalls:
+ entLogicalDescr.3 == 'Sun Firewall v2.1.1'
+ entLogicalType.3 == dot1dFirewall
+ entLogicalCommunity.3 == 'public-firewall1'
+ entLogicalTAddress.3 == 124.125.126.129:161
+ entLogicalTDomain.3 == SunExampleDomain
+ entLogicalContextEngineID.3 == ''
+ entLogicalContextName.3 == ''
+
+ entLogicalDescr.4 == 'Sun Firewall v2.1.1'
+ entLogicalType.4 == dot1dFirewall
+ entLogicalCommunity.4 == 'public-firewall2'
+ entLogicalTAddress.4 == 124.125.126.130:161
+ entLogicalTDomain.4 == SunExampleDomain
+ entLogicalContextEngineID.4 == ''
+ entLogicalContextName.4 == ''
+
+ Logical to Physical Mappings:
+ Domain A: uses CPU board 1 and Port 1
+ entLPPhysicalIndex.1.5 == 5
+ entLPPhysicalIndex.1.12 == 12
+
+ Domain B: uses CPU board 2, Port 2 and 3
+ entLPPhysicalIndex.2.8 == 8
+ entLPPhysicalIndex.2.13 == 13
+ entLPPhysicalIndex.2.14 == 14
+
+ 1st Firewall: uses CPU 1 of CPU board 1 and Port 1
+
+ entLPPhysicalIndex.3.6 == 6
+ entLPPhysicalIndex.3.12 == 12
+
+ 2nd Firewall: uses CPU 1 of CPU board 2, Port 2 and 3
+
+ [ Note that these mappings are included in the table since
+ firewall entity (1nd Firewall) utilizes one of the
+ ports in the board. If this were not the case, then a single mapping
+ to the board (e.g., entLPPhysicalIndex.4.11) would be
+ present instead. ]
+
+ entLPPhysicalIndex.4.9 == 9
+ entLPPhysicalIndex.4.13 == 13
+ entLPPhysicalIndex.4.14 == 14
+
+ Physical to Logical to MIB Alias Mappings -- entAliasMappingTable:
+ Example 1: ifIndex values are global to all logical entities
+ entAliasMappingIdentifier.12.0 == ifIndex.1
+ entAliasMappingIdentifier.13.0 == ifIndex.2
+ entAliasMappingIdentifier.14.0 == ifIndex.3
+
+ Example 2: ifIndex values are not shared by all logical entities
+ entAliasMappingIdentifier.12.0 == ifIndex.1
+ entAliasMappingIdentifier.12.3 == ifIndex.101
+ entAliasMappingIdentifier.13.0 == ifIndex.2
+ entAliasMappingIdentifier.13.3 == ifIndex.102
+ entAliasMappingIdentifier.14.0 == ifIndex.3
+ entAliasMappingIdentifier.14.3 == ifIndex.103
+
+ Physical Containment Tree -- entPhysicalContainsTable
+ chassis has three slots:
+ entPhysicalChildIndex.1.2 == 2
+ entPhysicalChildIndex.1.3 == 3
+ entPhysicalChildIndex.1.4 == 4
+
+ slot 1 has a board:
+ entPhysicalChildIndex.2.5 == 5
+
+ slot 2 has a board:
+ entPhysicalChildIndex.3.8 == 8
+
+ slot 3 has a board:
+ entPhysicalChildIndex.4.11 == 11
+
+ board 1 has 2 cpus:
+ entPhysicalChildIndex.4.6 == 6
+ entPhysicalChildIndex.4.7 == 7
+
+ board 2 has 2 cpus:
+ entPhysicalChildIndex.8.9 == 9
+ entPhysicalChildIndex.8.10 == 10
+
+ board 3 has 3 ports:
+ entPhysicalChildIndex.11.12 == 12
+ entPhysicalChildIndex.11.13 == 13
+ entPhysicalChildIndex.11.14 == 14
+
+
+
+
+How to Build the demo_module_11 Code Example
+===========================================
+
+The demo_module_11 code example includes the following files, by default
+located in the directory /usr/demo/sma_snmp/demo_module_11.
+
+Files:
+
+o Makefile - Compiles the MyTable source code
+o MyTable.c - Source code for module
+o MyTable.h - Header file for module
+
+
+To set up your build environment for the demo:
+
+1. Copy the demo code to a directory for which you have write permission.
+ For example:
+ % cp -R /usr/demo/sma_snmp/demo_module_11 /home/username/demo
+
+
+2. Create a lib directory that you can use to store shared object libraries
+ that you generate from demo code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/lib
+
+
+3. Create a mibs directory that you can use to store MIB files for the demo
+ code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/mibs
+
+
+4. Set the CC environment variable to the location of the C compiler to be
+ used.
+ For example, if you are using Sun ONE Studio:
+ % setenv CC /opt/SUNWspro/bin/cc
+
+
+5. Set your PATH environment variable to include the appropriate paths, so that
+ needed binaries can be found during the compilation process.
+ For example, in the csh:
+
+ % setenv PATH .:/usr/bin:$PATH
+
+
+
+
+To build the example:
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_11
+
+
+2. Use the make command to generate object files.
+
+ If you are running the 64-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make
+
+ If you are running the 32-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+ If you are running the Solaris x86 kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+
+3. Copy the module shared library object to the lib directory you created.
+ For example:
+
+ % cp demo_module_11.so /home/username/demo/lib
+
+
+
+Setting Up Agent to Run the demo_module_11 Module
+=================================================
+
+1. As root, edit the agent's configuration file /etc/sma/snmp/snmpd.conf.
+ Look for a line similar to the following:
+
+ dlmod entity /usr/lib/sparcv9/libentity.so
+
+ This line causes the agent to load the API library that you need to use
+ the Entity MIB functions.
+
+ If the line is missing, insert it. Note that if you are using a 32-bit
+ module, you should load the 32-bit library, located in
+ /usr/lib/libentity.so.
+
+
+2. After the dlmod line for the libentity.so, insert a dlmod statement for
+ the module. This statement enables the agent to load the module.
+ For example:
+
+ dlmod demo_module_11 /home/username/demo/lib/demo_module_11.so
+
+
+3. As root, start the SMA snmp agent. If the agent is already running,
+ stop and restart it in debug mode.
+ For example:
+
+ # /etc/init.d/init.sma stop
+ # /usr/sbin/snmpd -Ddemo_module_11
+
+ The optional -Ddemo_module_11 argument sends debugging statements from
+ demo_module_11 to the /var/log/snmpd.log file. You can also use the -L
+ and -f options to send debugging statements to the screen instead.
+
+
+Testing the Code Example
+========================
+
+1. As a non-root user, issue an snmpwalk command to retrieve data from
+ the module.
+ For example:
+
+ % snmpwalk -v 1 -c public localhost mib-2.47
+
+ The output should be similar to the following:
+
+
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.1 = STRING: "Sun Chassis Model b1000"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.2 = STRING: "Sun Chassis Slot Type AA"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.3 = STRING: "Sun Chassis Slot Type AA"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.4 = STRING: "Sun Chassis Slot Type AA"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.5 = STRING: "Sun CPU-100"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.6 = STRING: "Sun Ultrasparc-III 400MHz"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.7 = STRING: "Sun Ultrasparc-III 400MHz"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.8 = STRING: "Sun CPU-200"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.9 = STRING: "Sun Ultrasparc-III 400MHz"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.10 = STRING: "Sun Ultrasparc-III 400MHz"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.11 = STRING: "Sun port-200"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.12 = STRING: "Sun Ethernet-100 Port"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.13 = STRING: "Sun Ethernet-100 Port"
+SNMPv2-SMI::mib-2.47.1.1.1.1.2.14 = STRING: "Sun Ethernet-100 Port"
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.1 = OID: SNMPv2-SMI::enterprises.42.200.1
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.2 = OID: SNMPv2-SMI::enterprises.42.201.1
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.3 = OID: SNMPv2-SMI::enterprises.42.201.1
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.4 = OID: SNMPv2-SMI::enterprises.42.201.1
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.5 = OID: SNMPv2-SMI::enterprises.42.202.14
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.6 = OID: SNMPv2-SMI::enterprises.42.203.2
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.7 = OID: SNMPv2-SMI::enterprises.42.203.2
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.8 = OID: SNMPv2-SMI::enterprises.42.202.15
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.9 = OID: SNMPv2-SMI::enterprises.42.203.5
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.10 = OID: SNMPv2-SMI::enterprises.42.203.2
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.11 = OID: SNMPv2-SMI::enterprises.42.202.25
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.12 = OID: SNMPv2-SMI::enterprises.42.204.5
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.13 = OID: SNMPv2-SMI::enterprises.42.204.5
+SNMPv2-SMI::mib-2.47.1.1.1.1.3.14 = OID: SNMPv2-SMI::enterprises.42.204.5
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.1 = INTEGER: 0
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.2 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.3 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.4 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.5 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.6 = INTEGER: 4
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.7 = INTEGER: 4
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.8 = INTEGER: 3
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.9 = INTEGER: 8
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.10 = INTEGER: 8
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.11 = INTEGER: 4
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.12 = INTEGER: 11
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.13 = INTEGER: 11
+SNMPv2-SMI::mib-2.47.1.1.1.1.4.14 = INTEGER: 11
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.1 = INTEGER: 3
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.2 = INTEGER: 5
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.3 = INTEGER: 5
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.4 = INTEGER: 5
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.5 = INTEGER: 9
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.6 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.7 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.8 = INTEGER: 9
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.9 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.10 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.11 = INTEGER: 9
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.12 = INTEGER: 10
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.13 = INTEGER: 10
+SNMPv2-SMI::mib-2.47.1.1.1.1.5.14 = INTEGER: 10
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.1 = INTEGER: -1
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.2 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.3 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.4 = INTEGER: 3
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.5 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.6 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.7 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.8 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.9 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.10 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.11 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.12 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.13 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.6.14 = INTEGER: 3
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.1 = STRING: "b1000"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.2 = STRING: "S1"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.3 = STRING: "S2"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.4 = STRING: "S3"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.5 = STRING: "M1"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.6 = STRING: "P1"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.7 = STRING: "P2"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.8 = STRING: "M2"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.9 = STRING: "P3"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.10 = STRING: "P4"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.11 = STRING: "M2"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.12 = STRING: "P3"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.13 = STRING: "Ethernet B"
+SNMPv2-SMI::mib-2.47.1.1.1.1.7.14 = STRING: "Ethernet B"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.1 = STRING: "A(1.00.02)"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.2 = STRING: "B(1.00.01)"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.3 = STRING: "1.00.07"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.4 = STRING: "1.00.07"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.5 = STRING: "1.00.07"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.6 = STRING: "G(1.02)"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.7 = STRING: "G(1.02)"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.8 = STRING: "2.01.00"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.9 = STRING: "CC(1.07)"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.10 = STRING: "G(1.04)"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.11 = STRING: "2.01.00"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.12 = STRING: "CC(1.07)"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.13 = STRING: "G(1.04)"
+SNMPv2-SMI::mib-2.47.1.1.1.1.8.14 = STRING: "G(1.04)"
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.1 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.2 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.3 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.4 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.5 = STRING: "1.5.1"
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.6 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.7 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.8 = STRING: "3.0.7"
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.9 = STRING: "2.0.34"
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.10 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.11 = STRING: "3.0.7"
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.12 = STRING: "2.0.34"
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.13 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.9.14 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.1 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.2 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.3 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.4 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.5 = STRING: "A(1.1)"
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.6 = STRING: "1.1"
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.7 = STRING: "1.1"
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.8 = STRING: "A(1.2)"
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.9 = STRING: "1.1"
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.10 = STRING: "1.3"
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.11 = STRING: "A(1.2)"
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.12 = STRING: "1.1"
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.13 = STRING: "1.3"
+SNMPv2-SMI::mib-2.47.1.1.1.1.10.14 = STRING: "1.3"
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.1 = STRING: "C100076544"
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.2 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.3 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.4 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.5 = STRING: "C100087363"
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.6 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.7 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.8 = STRING: "C100098732"
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.9 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.10 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.11 = STRING: "C100098732"
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.12 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.13 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.11.14 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.1 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.2 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.3 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.4 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.5 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.6 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.7 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.8 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.9 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.10 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.11 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.12 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.13 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.12.14 = STRING: "Sun Microsystems"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.1 = STRING: "CHS-1000"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.2 = STRING: "SLT-AA97"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.3 = STRING: "SLT-AA97"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.4 = STRING: "SLT-AA97"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.5 = STRING: "R10-FE00"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.6 = STRING: "SFE-400M"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.7 = STRING: "SFE-400M"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.8 = STRING: "R10-FE0C"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.9 = STRING: "SFE-400M"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.10 = STRING: "SFE-400M"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.11 = STRING: "R11-C100"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.12 = STRING: "SFE-P100"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.13 = STRING: "SFE-P100"
+SNMPv2-SMI::mib-2.47.1.1.1.1.13.14 = STRING: "SFE-P100"
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.1 = STRING: "cl-SJ17-3-006:rack1:rtr-U3"
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.2 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.3 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.4 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.5 = STRING: "rtr-U3:m1:SJ17-3-eng"
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.6 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.7 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.8 = STRING: "rtr-U3:m2:SJ17-2-eng"
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.9 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.10 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.11 = STRING: "rtr-U3:m2:SJ17-2-eng"
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.12 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.13 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.14.14 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.1 = STRING: "0007372293"
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.2 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.3 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.4 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.5 = STRING: "0007372562"
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.6 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.7 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.8 = STRING: "0007373982"
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.9 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.10 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.11 = STRING: "0007373982"
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.12 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.13 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.15.14 = ""
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.1 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.2 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.3 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.4 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.5 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.6 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.7 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.8 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.9 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.10 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.11 = INTEGER: 1
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.12 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.13 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.1.1.1.16.14 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.2.1.1.2.1 = STRING: "Domain A"
+SNMPv2-SMI::mib-2.47.1.2.1.1.2.2 = STRING: "Domain B"
+SNMPv2-SMI::mib-2.47.1.2.1.1.2.3 = STRING: "Sun Firewall v2.1.1"
+SNMPv2-SMI::mib-2.47.1.2.1.1.2.4 = STRING: "Sun Firewall v2.1.1"
+SNMPv2-SMI::mib-2.47.1.2.1.1.3.1 = OID: SNMPv2-SMI::enterprises.42.2.1
+SNMPv2-SMI::mib-2.47.1.2.1.1.3.2 = OID: SNMPv2-SMI::enterprises.42.2.1
+SNMPv2-SMI::mib-2.47.1.2.1.1.3.3 = OID: SNMPv2-SMI::enterprises.42.2.1
+SNMPv2-SMI::mib-2.47.1.2.1.1.3.4 = OID: SNMPv2-SMI::enterprises.42.2.1
+SNMPv2-SMI::mib-2.47.1.2.1.1.4.1 = STRING: "public-dom1"
+SNMPv2-SMI::mib-2.47.1.2.1.1.4.2 = STRING: "public-dom2"
+SNMPv2-SMI::mib-2.47.1.2.1.1.4.3 = STRING: "public-firewall1"
+SNMPv2-SMI::mib-2.47.1.2.1.1.4.4 = STRING: "public-firewall2"
+SNMPv2-SMI::mib-2.47.1.2.1.1.5.1 = STRING: "124.125.126.127:161"
+SNMPv2-SMI::mib-2.47.1.2.1.1.5.2 = STRING: "124.125.126.128:161"
+SNMPv2-SMI::mib-2.47.1.2.1.1.5.3 = STRING: "124.125.126.129:161"
+SNMPv2-SMI::mib-2.47.1.2.1.1.5.4 = STRING: "124.125.126.130:161"
+SNMPv2-SMI::mib-2.47.1.2.1.1.6.1 = OID: SNMPv2-SMI::enterprises.42.1005
+SNMPv2-SMI::mib-2.47.1.2.1.1.6.2 = OID: SNMPv2-SMI::enterprises.42.1005
+SNMPv2-SMI::mib-2.47.1.2.1.1.6.3 = OID: SNMPv2-SMI::enterprises.42.1005
+SNMPv2-SMI::mib-2.47.1.2.1.1.6.4 = OID: SNMPv2-SMI::enterprises.42.1005
+SNMPv2-SMI::mib-2.47.1.2.1.1.7.1 = ""
+SNMPv2-SMI::mib-2.47.1.2.1.1.7.2 = ""
+SNMPv2-SMI::mib-2.47.1.2.1.1.7.3 = ""
+SNMPv2-SMI::mib-2.47.1.2.1.1.7.4 = ""
+SNMPv2-SMI::mib-2.47.1.2.1.1.8.1 = ""
+SNMPv2-SMI::mib-2.47.1.2.1.1.8.2 = ""
+SNMPv2-SMI::mib-2.47.1.2.1.1.8.3 = ""
+SNMPv2-SMI::mib-2.47.1.2.1.1.8.4 = ""
+SNMPv2-SMI::mib-2.47.1.3.1.1.1.1.5 = INTEGER: 5
+SNMPv2-SMI::mib-2.47.1.3.1.1.1.1.12 = INTEGER: 12
+SNMPv2-SMI::mib-2.47.1.3.1.1.1.2.8 = INTEGER: 8
+SNMPv2-SMI::mib-2.47.1.3.1.1.1.2.13 = INTEGER: 13
+SNMPv2-SMI::mib-2.47.1.3.1.1.1.2.14 = INTEGER: 14
+SNMPv2-SMI::mib-2.47.1.3.1.1.1.3.6 = INTEGER: 6
+SNMPv2-SMI::mib-2.47.1.3.1.1.1.3.12 = INTEGER: 12
+SNMPv2-SMI::mib-2.47.1.3.1.1.1.4.9 = INTEGER: 9
+SNMPv2-SMI::mib-2.47.1.3.1.1.1.4.13 = INTEGER: 13
+SNMPv2-SMI::mib-2.47.1.3.1.1.1.4.14 = INTEGER: 14
+SNMPv2-SMI::mib-2.47.1.3.2.1.2.12.0 = OID: IF-MIB::ifIndex.1
+SNMPv2-SMI::mib-2.47.1.3.2.1.2.13.0 = OID: IF-MIB::ifIndex.2
+SNMPv2-SMI::mib-2.47.1.3.2.1.2.14.0 = OID: IF-MIB::ifIndex.3
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.1.2 = INTEGER: 2
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.1.3 = INTEGER: 3
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.1.4 = INTEGER: 4
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.2.5 = INTEGER: 5
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.3.8 = INTEGER: 8
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.4.6 = INTEGER: 6
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.4.7 = INTEGER: 7
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.4.11 = INTEGER: 11
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.8.9 = INTEGER: 9
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.8.10 = INTEGER: 10
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.11.12 = INTEGER: 12
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.11.13 = INTEGER: 13
+SNMPv2-SMI::mib-2.47.1.3.3.1.1.11.14 = INTEGER: 14
+SNMPv2-SMI::mib-2.47.1.4.1.0 = Timeticks: (29) 0:00:00.29
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_12/EXAMPLE-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,117 @@
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are subject to
+-- the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun, Sun
+-- Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+--
+--
+
+----------------------------------------------------------
+-- Systems Management Agent (SMA) SDK module example-12 MIB
+----------------------------------------------------------
+
+EXAMPLE-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
+ TimeTicks, Counter32, experimental, IpAddress,
+ Integer32, Gauge32, Counter64, Opaque
+ FROM SNMPv2-SMI
+ DisplayString, TimeStamp
+ FROM SNMPv2-TC
+ MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP
+ FROM SNMPv2-CONF;
+
+exampleMIB MODULE-IDENTITY
+ LAST-UPDATED "200303110000Z"
+ ORGANIZATION "Sun Microsystems, Inc."
+ CONTACT-INFO "None"
+ DESCRIPTION
+ "An example MIB used for source code-generating tools.
+ "
+ ::= { experimental 3000 }
+
+scalarTypes OBJECT IDENTIFIER ::= { exampleMIB 1 }
+tableType OBJECT IDENTIFIER ::= { exampleMIB 2 }
+
+scalarOpaque OBJECT-TYPE
+ SYNTAX Opaque
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Scalar datatype"
+ ::= { scalarTypes 1 }
+
+scalarIpAddr OBJECT-TYPE
+ SYNTAX IpAddress
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "IP Address datatype"
+ ::= { scalarTypes 2 }
+
+
+
+rwTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF rwTableEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A conceptual row"
+ ::= { tableType 1 }
+
+rwTableEntry OBJECT-TYPE
+ SYNTAX rwTableEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "An entry (conceptual row) in the exampleTable."
+ INDEX { rwTableIndex }
+ ::= { rwTable 1 }
+
+rwTableEntry ::= SEQUENCE {
+ rwTableIndex INTEGER,
+ rwTableOID OBJECT IDENTIFIER,
+ rwTableDisplayString DisplayString,
+ rwTableCounter32 Counter32
+}
+
+rwTableIndex OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Integer"
+ ::= { rwTableEntry 1 }
+
+rwTableOID OBJECT-TYPE
+ SYNTAX OBJECT IDENTIFIER
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "OID"
+ ::= { rwTableEntry 2 }
+
+rwTableDisplayString OBJECT-TYPE
+ SYNTAX DisplayString (SIZE (0..255))
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "DisplayString"
+ ::= { rwTableEntry 3 }
+
+rwTableCounter32 OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Counter32"
+ ::= { rwTableEntry 4 }
+
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_12/README_demo_module_12 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,149 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+README for demo_module_12
+********************************************************************
+
+This code example shows how to generate code templates from a MIB for
+the System Management Agent, and how to generate code templates from
+a MIB in Solstice Enterprise Agents (SEA). This information should be
+helpful if you are migrating a SEA subagent to use as a module with the
+System Management Agent.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+NOTE: You must have installed the SEA Software Developer's Kit to use
+this demo. The SEA SDK includes the mibcodegen utility used to generate
+templates from MIBs for SEA.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+See the Solaris System Management Agent Developer's Guide for more
+information about migrating SEA subagents. The guide explains how to
+use the templates produced in this example.
+
+
+
+How to Use the demo_module_12 Code Example
+===========================================
+
+The demo_module_12 code example includes the following files, by default
+located in the directory /usr/demo/sma_snmp/demo_module_12.
+
+Files:
+
+o EXAMPLE-MIB.txt - Sample MIB used in this demo
+o runmib2c - Script that runs mib2c on the MIB
+o runmibcodegen - Script that runs the SEA mibcodegen utility
+
+
+To set up your environment for the demo:
+
+1. Copy the demo code to a directory for which you have write permission.
+ For example:
+ % cp -R /usr/demo/sma_snmp/demo_module_12 /home/username/demo
+
+
+2. Create a mibs directory that you can use to store MIB files for the
+ demo code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/mibs
+
+
+3. Set your PATH environment variable to include the appropriate paths, so that
+ needed binaries can be found during the compilation process.
+ For example, in the csh:
+
+ % setenv PATH .:/usr/bin:$PATH
+
+
+4. Change to the directory where you copied the demo_module_12 files.
+ For example:
+
+ % cd /home/username/demo/demo_module_12
+
+
+5. Copy the EXAMPLE-MIB.txt file to the mibs directory you created for the
+ demos.
+ For example:
+
+ % cp EXAMPLE-MIB.txt /home/username/demo/mibs
+
+
+6. Set your MIBS and MIBDIRS environment variables to
+ include the appropriate paths.
+ For example, in the csh:
+
+ % setenv MIBDIRS .:/home/username/demo/mibs:/etc/sma/snmp/mibs
+ % setenv MIBS +EXAMPLE-MIB
+
+
+
+
+
+To generate SMA template code from the EXAMPLE-MIB:
+
+
+1. Use the runmib2c script to run mib2c on groups in the MIB.
+ For example:
+
+ % ./runmib2c
+
+ writing to scalarTypes.h
+ writing to scalarTypes.c
+ running indent on scalarTypes.h
+ indent: Command line: unknown parameter "-orig"
+ running indent on scalarTypes.c
+ indent: Command line: unknown parameter "-orig"
+ writing to tableType.h
+ writing to tableType.c
+ running indent on tableType.h
+ indent: Command line: unknown parameter "-orig"
+ running indent on tableType.c
+ indent: Command line: unknown parameter "-orig"
+
+
+ NOTE: Ignore the messages about the unknown parameter "-orig".
+
+ The script runs mib2c twice, with the appropriate configuration options,
+ to produce the following files:
+
+ scalarTypes.c
+ scalarTypes.h
+ tableType.c
+ tableType.h
+
+
+
+To generate SEA template code from the EXAMPLE-MIB:
+
+
+1. Use the runmibcodegen script to run mibcodegen on the MIB.
+ For example:
+
+ % ./runmibcodegen
+
+
+ Creating example_tree.c ...
+ Creating example_stub.h ...
+ Creating example_stub.c ...
+ Creating example_rwTableEntry.c ...
+ Creating example_appl.c ...
+ Creating example_trap.c ...
+
+
+ The mibcodegen utility creates the template files listed above.
+
+
+ The System Management Agent Developer's Guide describes the template
+ files produced in this demo, and how you can use them to determine how
+ to modify the SMA templates to create your module.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_12/runmib2c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,1 @@
+/usr/bin/mib2c -c mib2c.iterate.conf tableType
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_2/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# Use is subject to license terms.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate demo_module_2.so
+#
+# usage:
+# setenv CC /usr/bin/cc (or correct path)
+# "make" : generate library for 64bit
+# "make ARCH=32" : generate library for 32bit
+# "make clean" : remove *.o , *.so
+#
+
+ARCH=64
+LDFLAGS_64=-g -m64 -I.
+LDFLAGS_32=-g -I.
+LDFLAGS=$(LDFLAGS_$(ARCH))
+
+LDLIBS=
+
+PROG= demo_module_2.so
+SRCS= demo_module_2.c
+OBJS = $(SRCS:.c=.o)
+
+all:$(PROG)
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) $(LDLIBS) -G -o $@ $(OBJS)
+.c.o:
+ @if test "$(CC)" = "" ; then \
+ echo "Environment variable CC must be set with compiler path" ; \
+ exit 1 ; \
+ fi
+ $(CC) $(LDFLAGS) -g -o $@ -c $<
+
+clean:
+ rm -f demo_module_2.o demo_module_2.so
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_2/README_demo_module_2 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,211 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+README for demo_module_2
+***********************************************************************
+
+This example performs data retrieval and data setting for a simple
+table that provides file monitoring.
+
+
+Introduction
+------------
+
+The demo_module_2.c code was generated by using "mib2c -c mib2c.iterate.conf"
+against the me1FileTable group in the SDK-DEMO1-MIB. Some functions have been
+added to the generated code to implement a link list to provide the test data.
+
+mib2c created templates called me1FileTable.c and me1FileTable.h.
+These were renamed demo_module_2.c and demo_module_2.h for this demo.
+Within me1FileTable.c, mib2c generated init_me1FileTable, and this was renamed
+to init_demo_module_2.
+
+Note that even though the SDK-DEMO1-MIB.txt MIB file contains the
+specification of table and scalar, running mib2c with mib2c.iterate.conf
+generates template code only for the simple table in the MIB.
+
+
+
+How to Build the demo_module_2 Code Example
+===========================================
+
+The demo_module_2 code example includes the following files, by default
+located in the directory /usr/demo/sma_snmp/demo_module_2.
+
+
+Files:
+
+Makefile - makefile to build demo_module_2.so shared library file
+demo_module_2.c - module source code
+demo_module_2.h - module header file
+SDK-DEMO1-MIB.txt - MIB file
+
+
+To set up your build environment for the demo:
+
+1. Copy the demo code to a directory for which you have write permission.
+ For example:
+ % cp -R /usr/demo/sma_snmp/demo_module_2 /home/username/demo
+
+
+2. Create a lib directory that you can use to store shared object libraries
+ that you generate from demo code examples, if you have not already done so.
+
+ For example:
+ % mkdir /home/username/demo/lib
+
+
+3. Create a mibs directory that you can use to store MIB files for the demo
+ code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/mibs
+
+
+4. Set the CC environment variable to the location of the C compiler to be
+ used. For example, if you are using Sun ONE Studio:
+ % setenv CC /opt/SUNWspro/bin/cc
+
+
+5. Set your PATH environment variable to include the appropriate paths, so that
+ needed binaries can be found during the compilation process.
+ For example, in the csh:
+
+ % setenv PATH .:/usr/bin:$PATH
+
+
+
+To generate code templates from the sample MIB:
+
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_2
+
+
+2. Copy the SDK-DEMO1-MIB.txt file to the mibs directory you created for the
+ demos, if you have not already done so.
+ For example:
+
+ % cp SDK-DEMO1-MIB.txt /home/username/demo/mibs
+
+
+3. Set your MIBS and MIBDIRS environment variables to
+ include the appropriate paths.
+ For example, in the csh:
+
+ % setenv MIBDIRS .:/home/username/demo/mibs:/etc/sma/snmp/mibs
+ % setenv MIBS +SDK-DEMO1-MIB
+
+
+4. Run mib2c on the me1ContactInfoTable group in the SDK-DEMO1-MIB.
+ For example:
+
+ % mib2c -c mib2c.iterate.conf me1FileTable
+
+ The mib2c utility generates the following template files:
+ me1FileTable.c
+ me1FileTable.h
+
+
+5. Compare the template files with the demo_module_2.c and the
+ demo_module_2.h files.
+
+
+
+To build the example:
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_2
+
+
+2. Use the make command to generate object files.
+
+ If you are running the 64-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make
+
+ If you are running the 32-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+ If you are running the Solaris x86 kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+
+3. Copy the module shared library object to the lib directory you created.
+ For example:
+
+ % cp demo_module_2.so /home/username/demo/lib
+
+
+4. Copy the SDK-DEMO1-MIB.tx file to the mibs directory you created
+ for the demos, if you have not already done so.
+ For example:
+
+ % cp SDK-DEMO1-MIB.txt /home/username/demo/mibs
+
+
+
+Setting Up Agent to Run demo_module_2
+=====================================
+
+1. As root, edit the agent's configuration file /etc/sma/snmp/snmpd.conf,
+ and insert a dlmod statement for the module. This statement enables
+ the agent to load the module.
+ For example:
+
+ dlmod demo_module_2 /home/username/demo/lib/demo_module_2.so
+
+
+2. As root, start the SMA snmp agent. If the agent is already running,
+ stop and restart it in debug mode.
+ For example:
+
+ # /etc/init.d/init.sma stop
+ # /usr/sbin/snmpd -Ddemo_module_2
+
+ The optional -Ddemo_module_2 argument sends debugging statements from
+ demo_module_2 to the /var/log/snmpd.log file. You can also use
+ the -L and -f options to send debugging statements to the screen instead.
+
+
+
+Testing the Module
+==================
+
+1. Set your MIBS and MIBDIRS environment variables to
+ include the appropriate paths.
+ For example, in the csh:
+
+ % setenv MIBDIRS .:/home/username/demo/mibs:/etc/sma/snmp/mibs
+ % setenv MIBS +SDK-DEMO1-MIB
+
+
+2. As a non-root user, issue snmptable commands to retrieve table data
+ from the module.
+ For example:
+
+ % snmptable -v1 -c public localhost SDK-DEMO1-MIB::me1FileTable
+
+ me1FileIndex me1FileName me1FileSize me1FilePerm
+ 1 /etc/hosts 78 444
+ 2 /etc/passwd 595 644
+ 3 /etc/cron 56616 555
+ 4 /etc/system 1883 644
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_2/SDK-DEMO1-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,241 @@
+--
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are
+-- subject
+-- to the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun,
+-- Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+
+
+----------------------------------------------------------
+-- Systems Management Agent (SMA) SDK module DEMO-1 MIB
+----------------------------------------------------------
+
+SDK-DEMO1-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+ enterprises, MODULE-IDENTITY, OBJECT-TYPE, Counter64, Integer32, Unsigned32
+ FROM SNMPv2-SMI
+ OBJECT-GROUP
+ FROM SNMPv2-CONF
+ DisplayString
+ FROM SNMPv2-TC;
+
+sdkDemo1MIB MODULE-IDENTITY
+ LAST-UPDATED "0009181435Z"
+ ORGANIZATION "Sun Microsystems Inc."
+ CONTACT-INFO
+ " Sun Microsystems Inc
+ 4150 Network Circle
+ Santa Clara, CA 95054
+ e-mail: [email protected]"
+ DESCRIPTION
+ " SMA SDK MIB DEMO-1. This MIB will be used to demonstrate the
+ implementation of modules and various module features in SMA agent."
+ ::= { demo 1 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+management OBJECT IDENTIFIER ::= { products 2 }
+sma OBJECT IDENTIFIER ::= { management 4 }
+demo OBJECT IDENTIFIER ::= { sma 4 }
+
+--
+-- There are currently 2 Groups in the example.
+-- The "Load" group contains information about system load
+-- The "File" group contains information about some files on the system
+--
+
+me1LoadGroup OBJECT-GROUP
+ OBJECTS { me1SystemLoadAvg1min, me1SystemLoadAvg5min,
+ me1SystemLoadAvg15min }
+ STATUS current
+ DESCRIPTION
+ "Load related statistics."
+ ::= { sdkDemo1MIB 1 }
+
+me1FileGroup OBJECT-GROUP
+ OBJECTS { me1FileIndex, me1FileName, me1FileSize, me1FilePerm
+ }
+ STATUS current
+ DESCRIPTION
+ "File related statistics."
+ ::= { sdkDemo1MIB 2 }
+
+--
+-- Properties in the "Load" group
+--
+
+me1SystemLoadAvg1min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 1 minute."
+ ::= { me1LoadGroup 1 }
+
+me1SystemLoadAvg5min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 5 minutes."
+ ::= { me1LoadGroup 2 }
+
+me1SystemLoadAvg15min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 15 minutes."
+ ::= { me1LoadGroup 3 }
+
+--
+-- Objects in the "File" group
+--
+
+me1FileTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF Me1FileEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Table containing information of some files on the system."
+ ::= { me1FileGroup 1 }
+
+me1FileEntry OBJECT-TYPE
+ SYNTAX Me1FileEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Information about one file on the system."
+ INDEX { me1FileIndex }
+ ::= { me1FileTable 1 }
+
+Me1FileEntry ::=
+ SEQUENCE {
+ me1FileIndex
+ Unsigned32,
+ me1FileName
+ DisplayString,
+ me1FileSize
+ Unsigned32,
+ me1FilePerm
+ DisplayString
+ }
+
+me1FileIndex OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Index of the file."
+ ::= { me1FileEntry 1 }
+
+me1FileName OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "Name of the file"
+ ::= { me1FileEntry 2 }
+
+me1FileSize OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Size of the file in kb"
+ ::= { me1FileEntry 3 }
+
+me1FilePerm OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Permissions on this file. example, 0755 "
+ ::= { me1FileEntry 4 }
+
+
+-- General table:
+
+
+me1ContactInfoTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF Me1ContactInfoEntry
+ MAX-ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "The contact information table."
+ ::= { sdkDemo1MIB 3 }
+
+
+
+me1ContactInfoEntry OBJECT-TYPE
+ SYNTAX Me1ContactInfoEntry
+ MAX-ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "An entry in the contact info table."
+ INDEX { me1FloorNumber, me1RoomNumber }
+ ::= { me1ContactInfoTable 1 }
+
+
+
+Me1ContactInfoEntry ::=
+ SEQUENCE {
+ me1FloorNumber
+ INTEGER,
+ me1RoomNumber
+ INTEGER,
+ me1Name
+ DisplayString,
+ me1Extension
+ INTEGER
+ }
+
+me1FloorNumber OBJECT-TYPE
+ SYNTAX INTEGER (1..3)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "This object combines with me1RoomNumber are
+ the identifier of the table."
+ ::= { me1ContactInfoEntry 1 }
+
+
+me1RoomNumber OBJECT-TYPE
+ SYNTAX INTEGER (1..100)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "This object combines with me1FloorNumber are
+ the identifier of the table."
+ ::= { me1ContactInfoEntry 2 }
+
+me1Name OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " The person loacted in the room."
+ ::= { me1ContactInfoEntry 3 }
+
+me1Extension OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The phone number of the office."
+ ::= { me1ContactInfoEntry 4 }
+
+
+END
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_2/demo_module_2.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,441 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ */
+
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 1.1.1.1 2003/03/26 18:12:29 pcarroll Exp $
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "demo_module_2.h"
+/********************************************************************/
+/* Implemented simple link list for demo purpose */
+/********************************************************************/
+
+fileEntry* fileList = 0;
+
+
+
+
+int AddItem (char* fileName) {
+
+ fileEntry *fprt = fileList;
+ struct stat fAttrib; /* Need to check if memory is valid */
+ if (!fileName || !strlen(fileName)) {
+ return FALSE;
+ }
+ if (stat(fileName, &fAttrib) == -1) {
+ /* Unable to get the file information, it could be more than file not exists
+ if (errno == ENOENT) {
+ return FALSE;
+ }
+ return FALSE;
+ */
+ DEBUGMSGTL(("demo_module_2", "Can't access the file %s", fileName));
+ }
+
+ if (fprt != NULL) {
+ while (fprt->next != NULL){
+ fprt = fprt->next;
+ }
+ fprt->next = (fileEntry *) malloc (sizeof(fileEntry));
+ fprt->next->findex = fprt->findex + 1;
+ fprt = fprt->next;
+ fprt->next = NULL;
+ strcpy(fprt->fileName, fileName);
+ fprt->fileSize = fAttrib.st_size;
+ sprintf(fprt->filePerm, "%d" , fAttrib.st_mode);
+ }
+ else {
+ fprt = (fileEntry *) malloc (sizeof(fileEntry));
+ fprt->next = NULL;
+ fprt->findex = 1;
+ strcpy(fprt->fileName, fileName);
+ fprt->fileSize = fAttrib.st_size;
+ sprintf(fprt->filePerm, "%d" , fAttrib.st_mode);
+ fileList = fprt;
+ }
+ return TRUE;
+}
+
+int ChangeItem (int fileIndex, char* fileName) {
+
+ fileEntry * tempp = fileList, *prev = fileList;
+ if (!fileName || !strlen(fileName)) {
+ return FALSE;
+ }
+ while (tempp != NULL) {
+ if (tempp->findex == fileIndex) {
+ strcpy(tempp->fileName, fileName);
+ return TRUE;
+ }
+ prev = tempp;
+ tempp = tempp->next;
+ }
+
+ return FALSE;
+}
+
+char* GetFileName( int fIndex){
+ fileEntry *fprt = fileList;
+ while (fprt != NULL){
+ if (fprt->findex == fIndex) {
+ return fprt->fileName;
+ }
+ fprt = fprt->next;
+ }
+ return NULL;
+
+}
+
+/********************************************************************/
+
+/** Initialize the me1FileTable table by defining its contents and how it's structured */
+void
+initialize_table_me1FileTable(void)
+{
+ static oid me1FileTable_oid[] = {1,3,6,1,4,1,42,2,2,4,4,1,2,1};
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /* create the table structure itself */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /* if your table is read only, it's easiest to change the
+ HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
+ my_handler = netsnmp_create_handler_registration("me1FileTable",
+ me1FileTable_handler,
+ me1FileTable_oid,
+ OID_LENGTH(me1FileTable_oid),
+ HANDLER_CAN_RWRITE);
+
+ if (!my_handler || !table_info || !iinfo){
+ return; /* mallocs failed */
+ }
+
+ /***************************************************
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_UNSIGNED, /* index: me1FileIndex */
+ 0);
+
+ table_info->min_column = 1;
+ table_info->max_column = 4;
+
+ /* iterator access routines */
+ iinfo->get_first_data_point = me1FileTable_get_first_data_point;
+ iinfo->get_next_data_point = me1FileTable_get_next_data_point;
+
+ iinfo->table_reginfo = table_info;
+
+ /***************************************************
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_me1FileTable",
+ "Registering table me1FileTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initializes the demo_module_2 module */
+void
+init_demo_module_2(void)
+{
+
+ /* here we initialize all the tables we're planning on supporting */
+ initialize_table_me1FileTable();
+ if (!AddItem("/etc/hosts"))
+ snmp_log(LOG_ERR, "Failed to add instance in init_demo_module_2\n");
+ if (!AddItem("/etc/passwd"))
+ snmp_log(LOG_ERR, "Failed to add instance in init_demo_module_2\n");
+ if (!AddItem("/etc/cron"))
+ snmp_log(LOG_ERR, "Failed to add instance in init_demo_module_2\n");
+ if (!AddItem("/etc/system"))
+ snmp_log(LOG_ERR, "Failed to add instance in init_demo_module_2\n");
+}
+
+/** returns the first data point within the me1FileTable table data.
+
+ Set the my_loop_context variable to the first data point structure
+ of your choice (from which you can find the next one). This could
+ be anything from the first node in a linked list, to an integer
+ pointer containing the beginning of an array variable.
+
+ Set the my_data_context variable to something to be returned to
+ you later that will provide you with the data to return in a given
+ row. This could be the same pointer as what my_loop_context is
+ set to, or something different.
+
+ The put_index_data variable contains a list of snmp variable
+ bindings, one for each index in your table. Set the values of
+ each appropriately according to the data matching the first row
+ and return the put_index_data variable at the end of the function.
+*/
+netsnmp_variable_list *
+me1FileTable_get_first_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ netsnmp_variable_list *vptr;
+
+ fileEntry* firstFile = fileList;
+ if (!firstFile) {
+ return NULL;
+ }
+
+ *my_loop_context = firstFile;
+ *my_data_context = firstFile;
+
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) &fileList->findex, sizeof(fileList->findex));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+/** functionally the same as me1FileTable_get_first_data_point, but
+ my_loop_context has already been set to a previous value and should
+ be updated to the next in the list. For example, if it was a
+ linked list, you might want to cast it and the return
+ my_loop_context->next. The my_data_context pointer should be set
+ to something you need later and the indexes in put_index_data
+ updated again. */
+
+netsnmp_variable_list *
+me1FileTable_get_next_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ netsnmp_variable_list *vptr;
+ fileEntry *nextNode = (fileEntry *) *my_loop_context;
+ nextNode = nextNode->next;
+
+ if (!nextNode) {
+ return NULL;
+ }
+ *my_loop_context = nextNode;
+ *my_data_context = nextNode;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) &nextNode->findex, sizeof(nextNode->findex));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+/** handles requests for the me1FileTable table, if anything else needs to be done */
+int
+me1FileTable_handler(
+ netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests) {
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+ fileEntry *data;
+ char* fileName = NULL;
+ char* undofn;
+
+ for(request = requests; request; request = request->next) {
+ var = request->requestvb;
+ if (request->processed != 0)
+ continue;
+
+ /* perform anything here that you need to do before each
+ request is processed. */
+
+ /* the following extracts the my_data_context pointer set in
+ the loop functions above. You can then use the results to
+ help return data for the columns of the me1FileTable table in question */
+ data = (fileEntry *) netsnmp_extract_iterator_context(request);
+ if ( data == NULL) {
+ if (reqinfo->mode == MODE_GET) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ } else {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ }
+ continue;
+ } else {
+ struct stat fAttrib;
+ if (stat(GetFileName(data->findex), &fAttrib) != -1) {
+ data->fileSize = fAttrib.st_size;
+ sprintf(data->filePerm, "%o" , fAttrib.st_mode & 0777);
+ } else {
+ data->fileSize = 0;
+ sprintf(data->filePerm, "%d" , -1);
+ }
+
+ }
+
+ /* extracts the information about the table from the request */
+ table_info = netsnmp_extract_table_info(request);
+ /* table_info->colnum contains the column number requested */
+ /* table_info->indexes contains a linked list of snmp variable
+ bindings for the indexes of the table. Values in the list
+ have been set corresponding to the indexes of the
+ request */
+ if (table_info==NULL) {
+ continue;
+ }
+
+ switch(reqinfo->mode) {
+ /* the table_iterator helper should change all GETNEXTs
+ into GETs for you automatically, so you don't have to
+ worry about the GETNEXT case. Only GETs and SETs need
+ to be dealt with here */
+ case MODE_GET:
+ switch(table_info->colnum) {
+ case COLUMN_ME1FILEINDEX:
+/* ASN_UNSIGNED */
+ snmp_set_var_typed_value(var, ASN_UNSIGNED, (u_char *) &data->findex, sizeof(data->findex));
+ break;
+
+ case COLUMN_ME1FILENAME:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) data->fileName, strlen(data->fileName));
+ break;
+
+ case COLUMN_ME1FILESIZE:
+ snmp_set_var_typed_value(var, ASN_UNSIGNED, (u_char *) &data->fileSize, sizeof(data->fileSize));
+ break;
+
+ case COLUMN_ME1FILEPERM:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) data->filePerm, strlen(data->filePerm));
+ break;
+
+ default:
+ /* We shouldn't get here */
+ snmp_log(LOG_ERR, "problem encountered in me1FileTable_handler: unknown column\n");
+ }
+ break;
+
+ case MODE_SET_RESERVE1:
+ /* set handling... */
+ switch(table_info->colnum) {
+/*
+ * Check that the value being set is acceptable
+ */
+ case COLUMN_ME1FILENAME:
+ if (var->type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("me1FileTable", "%x not octet string type", var->type));
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (!var->val.string) {
+ DEBUGMSGTL(("me2FileTable", "Empty file name"));
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+ default:
+ /* We shouldn't get here */
+ snmp_log(LOG_ERR, "problem encountered in me1FileTable_handler: unknown column\n");
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_READONLY);
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+ case MODE_SET_RESERVE2:
+/*
+ * This is conventially where any necesary
+ * resources are allocated (e.g. calls to malloc)
+ */
+
+/* Store old info for undo later */
+
+ undofn = GetFileName(data->findex);
+ if (undofn) {
+ if (!(fileName = strdup(undofn))){
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ } else
+ netsnmp_request_add_list_data(request,
+ netsnmp_create_data_list
+ (ME1FILE_SET_FILENAME, fileName,
+ free));
+
+ }
+ break;
+ case MODE_SET_FREE:
+/*
+ * This is where any of the above resources
+ * are freed again (because one of the other
+ * values being SET failed for some reason).
+ */
+ /*The netsnmp_free_list_data should take care of the
+ alocated resources */
+ break;
+ case MODE_SET_ACTION:
+/*
+ * Set the variable as requested.
+ * Note that this may need to be reversed,
+ * so save any information needed to do this.
+ */
+ if (!ChangeItem(data->findex, (char *)var->val.string)){
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_COMMITFAILED);
+ }
+
+ break;
+
+ case MODE_SET_COMMIT:
+/*
+ * Everything worked, so we can discard any
+ * saved information, and make the change
+ * permanent (e.g. write to the config file).
+ * We also free any allocated resources.
+ *
+ */
+ /*The netsnmp_free_list_data should take care of the
+ alocated resources */
+ break;
+ case MODE_SET_UNDO:
+/*
+ * Something failed, so re-set the
+ * variable to its previous value
+ * (and free any allocated resources).
+ */
+
+ if(GetFileName(data->findex)){
+ /******* Get the saved value ************/
+ undofn = (char *) netsnmp_request_get_list_data(request,
+ ME1FILE_SET_FILENAME);
+ if (!ChangeItem(data->findex, undofn)){
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+
+ default:
+ snmp_log(LOG_ERR, "problem encountered in me1FileTable_handler: unsupported mode\n");
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_2/demo_module_2.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 1.1.1.1 2003/03/26 18:12:29 pcarroll Exp $
+ */
+#ifndef DEMO_MODULE_2_H
+#define DEMO_MODULE_2_H
+
+
+
+/* function declarations */
+void init_demo_module_2(void);
+void initialize_table_me1FileTable(void);
+Netsnmp_Node_Handler me1FileTable_handler;
+
+Netsnmp_First_Data_Point me1FileTable_get_first_data_point;
+Netsnmp_Next_Data_Point me1FileTable_get_next_data_point;
+
+/* column number definitions for table me1FileTable */
+ #define COLUMN_ME1FILEINDEX 1
+ #define COLUMN_ME1FILENAME 2
+ #define COLUMN_ME1FILESIZE 3
+ #define COLUMN_ME1FILEPERM 4
+
+typedef struct fileTable{
+ unsigned long findex;
+ char fileName[255];
+ unsigned long fileSize;
+ char filePerm[255];
+ struct fileTable* next;
+} fileEntry;
+
+#define ADDFILE 1
+#define RMFILE 2
+#define GETFILE 3
+#define ME1FILE_SET_FILENAME "me1FileName"
+
+#endif /* DEMO_MODULE_2_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_3/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# Use is subject to license terms.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate demo_module_3.so
+#
+# usage:
+# setenv CC /usr/bin/cc (or correct path)
+# "make" : generate library for 64bit
+# "make ARCH=32" : generate library for 32bit
+# "make clean" : remove *.o , *.so
+#
+
+ARCH=64
+LDFLAGS_64=-g -m64 -I.
+LDFLAGS_32=-g -I.
+LDFLAGS=$(LDFLAGS_$(ARCH))
+
+LDLIBS=
+
+PROG= demo_module_3.so
+SRCS= demo_module_3.c
+OBJS = $(SRCS:.c=.o)
+
+all:$(PROG)
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) $(LDLIBS) -G -o $@ $(OBJS)
+.c.o:
+ @if test "$(CC)" = "" ; then \
+ echo "Environment variable CC must be set with compiler path" ; \
+ exit 1 ; \
+ fi
+ $(CC) $(LDFLAGS) -g -o $@ -c $<
+
+clean:
+ rm -f demo_module_3.o demo_module_3.so
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_3/README_demo_module_3 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ */
+
+
+README for demo_module_3
+********************************************************************
+
+This code example shows you how to modify the code generated by
+"mib2c -c mib2c.iterate.conf" command to perform data retrieval for
+a general table.
+
+
+Introduction
+------------
+
+General tables are different from simple tables in one of the following
+ways:
+ - index is not a single integer
+ - maximum index is not easily determinable
+ - not all indexes are valid
+ - table data is not directly accessible, such as the interfaces table
+
+See the System Management Agent Developer's Guide
+for more information about general tables data retrieval.
+
+
+This example uses some dummy data to perform data retrieval for a
+two-index table. It was generated by using "mib2c -c mib2c.iterate.conf"
+against the me1ContactInfoTable group in the SDK-DEMO1-MIB.
+Some functions have been added to the generated code to implement a
+link list to provide the test data.
+
+mib2c created templates called me1ContactInfoTable.c and me1ContactInfoTable.h.
+
+These were renamed demo_module_3.c and demo_module_3.h for this demo.
+Within me1ContactInfoTable.c, mib2c generated init_me1ContactInfoTable, and
+this was renamed to init_demo_module_3.
+
+Note that even though the SDK-DEMO1-MIB file contains the specification of
+tables and scalar, running mib2c with mib2c.iterate.conf
+generates template code only for the general table in the MIB.
+
+
+
+How to Use the demo_module_3 Code Example
+==========================================
+
+The demo_module_3 code example includes the following files, by default
+located in the directory /usr/demo/sma_snmp/demo_module_3.
+
+Files:
+
+o Makefile - Compiles the module source code
+o demo_module_3.c - Source code for the module
+o demo_module_3.h - Header file for the module
+o SDK-DEMO1-MIB.txt - MIB file used in the module
+
+
+To set up your environment for the demo:
+
+1. Copy the demo code to a directory for which you have write permission.
+ For example:
+
+ % cp -R /usr/demo/sma_snmp/demo_module_3 /home/username/demo
+
+
+2. Create a lib directory that you can use to store shared object libraries
+ that you generate from demo code examples, if you have not already done so.
+ For example:
+
+ % mkdir /home/username/demo/lib
+
+
+3. Create a mibs directory that you can use to store MIB files for the demo
+ code examples, if you have not already done so.
+ For example:
+
+ % mkdir /home/username/demo/mibs
+
+
+4. Set the CC environment variable to the location of the C compiler to
+ be used.
+ For example, if you are using Sun ONE Studio:
+
+ % setenv CC /opt/SUNWspro/bin/cc
+
+
+5. Set your PATH environment variable to include the appropriate paths, so that
+ needed binaries can be found during the compilation process.
+ For example, in the csh:
+
+ % setenv PATH .:/usr/bin:$PATH
+
+
+
+
+To generate code templates from the sample MIB:
+
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_3
+
+
+2. Copy the SDK-DEMO1-MIB.txt file to the mibs directory you created for the
+ demos, if you have not already done so.
+ For example:
+
+ % cp SDK-DEMO1-MIB.txt /home/username/demo/mibs
+
+
+3. Set your MIBS and MIBDIRS environment variables to
+ include the appropriate paths.
+ For example, in the csh:
+
+ % setenv MIBDIRS .:/home/username/demo/mibs:/etc/sma/snmp/mibs
+ % setenv MIBS +SDK-DEMO1-MIB
+
+
+4. Run mib2c on the me1ContactInfoTable group in the SDK-DEMO1-MIB.
+ For example:
+
+ % mib2c -c mib2c.iterate.conf me1ContactInfoTable
+
+ The mib2c utility generates the following template files:
+ me1ContactInfoTable.c
+ me1ContactInfoTable.h
+
+
+5. Compare the template files with the demo_module_3.c and the
+ demo_module_3.h files.
+
+ The demo_module_3 files were created by modifying the templates.
+
+ The following code is to set up the table with two indexes:
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_INTEGER, /* index: me1FloorNumber */
+ ASN_INTEGER, /* index: me1RoomNumber */
+ 0);
+
+ Care must be taken in returning the "NEXT" data when function
+ me1ContactInfoTable_get_next_data_point() is called.
+
+ For instance, in the example code:
+ me1ContactEntry* nextNode = (me1ContactEntry*) *my_loop_context;
+ nextNode = nextNode->pNext;
+
+ The table data is pre-sorted so the next data is conveniently pointed by
+ the pNext pointer. If your implementation is more complicated you should
+ make sure the OIDs increase with the immediate next OID. (xxx.1.1, xxx.1.2,
+ etc).
+
+
+
+To build the example:
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_3
+
+
+2. Use the make command to generate object files.
+
+ If you are running the 64-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make
+
+ If you are running the 32-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+ If you are running the Solaris x86 kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+
+3. Copy the module shared library object to the lib directory you created.
+ For example:
+
+ % cp demo_module_3.so /home/username/demo/lib
+
+
+
+Setting Up Agent to Run demo_module_3
+=====================================
+
+1. As root, edit the agent's configuration file /etc/sma/snmp/snmpd.conf,
+ and insert a dlmod statement for the module. This statement enables
+ the agent to load the module.
+ For example:
+
+ dlmod demo_module_3 /home/username/demo/lib/demo_module_3.so
+
+
+2. As root, start the SMA snmp agent. If the agent is already running,
+ stop and restart it in debug mode.
+ For example:
+
+ # /etc/init.d/init.sma stop
+ # /usr/sbin/snmpd -Ddemo_module_3
+
+ The optional -Ddemo_module_3 argument sends debugging statements from
+ demo_module_3 to the /var/log/snmpd.log file. You can also use
+ the -L and -f options to send debugging statements to the screen instead.
+
+
+
+Testing the Module
+==================
+
+1. As a non-root user, issue snmptable commands to retrieve table data from
+ the module.
+ For example:
+
+
+ % snmptable -v1 -c public localhost SDK-DEMO1-MIB::me1ContactInfoTable
+
+ SNMP table: SDK-DEMO1-MIB::me1ContactInfoTable
+
+ me1FloorNumber me1RoomNumber me1Name me1Extension
+ 1 1004 John Doe 8004
+ 1 1007 John Doe 8007
+ 1 1010 John Doe 8000
+ 2 2003 John Doe 8003
+ 2 2006 John Doe 8006
+ 2 2009 John Doe 8009
+ 2 2012 John Doe 8002
+ 3 3005 John Doe 8005
+ 3 3008 John Doe 8008
+ 3 3011 John Doe 8001
+
+ or
+
+ % snmptable -v1 -c public localhost .1.3.6.1.4.1.42.2.2.4.4.1.3.1
+
+
+
+ SNMP table: SDK-DEMO1-MIB::me1ContactInfoTable
+
+ me1Extension me1Name me1RoomNumber me1FloorNumber
+ 8004 John Doe 1004 1
+ 8007 John Doe 1007 1
+ 8000 John Doe 1010 1
+ 8003 John Doe 2003 2
+ 8006 John Doe 2006 2
+ 8009 John Doe 2009 2
+ 8002 John Doe 2012 2
+ 8005 John Doe 3005 3
+ 8008 John Doe 3008 3
+ 8001 John Doe 3011 3
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_3/SDK-DEMO1-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,241 @@
+--
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are
+-- subject
+-- to the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun,
+-- Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+
+
+----------------------------------------------------------
+-- Systems Management Agent (SMA) SDK module DEMO-1 MIB
+----------------------------------------------------------
+
+SDK-DEMO1-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+ enterprises, MODULE-IDENTITY, OBJECT-TYPE, Counter64, Integer32, Unsigned32
+ FROM SNMPv2-SMI
+ OBJECT-GROUP
+ FROM SNMPv2-CONF
+ DisplayString
+ FROM SNMPv2-TC;
+
+sdkDemo1MIB MODULE-IDENTITY
+ LAST-UPDATED "0009181435Z"
+ ORGANIZATION "Sun Microsystems Inc."
+ CONTACT-INFO
+ " Sun Microsystems Inc
+ 4150 Network Circle
+ Santa Clara, CA 95054
+ e-mail: [email protected]"
+ DESCRIPTION
+ " SMA SDK MIB DEMO-1. This MIB will be used to demonstrate the
+ implementation of modules and various module features in SMA agent."
+ ::= { demo 1 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+management OBJECT IDENTIFIER ::= { products 2 }
+sma OBJECT IDENTIFIER ::= { management 4 }
+demo OBJECT IDENTIFIER ::= { sma 4 }
+
+--
+-- There are currently 2 Groups in the example.
+-- The "Load" group contains information about system load
+-- The "File" group contains information about some files on the system
+--
+
+me1LoadGroup OBJECT-GROUP
+ OBJECTS { me1SystemLoadAvg1min, me1SystemLoadAvg5min,
+ me1SystemLoadAvg15min }
+ STATUS current
+ DESCRIPTION
+ "Load related statistics."
+ ::= { sdkDemo1MIB 1 }
+
+me1FileGroup OBJECT-GROUP
+ OBJECTS { me1FileIndex, me1FileName, me1FileSize, me1FilePerm
+ }
+ STATUS current
+ DESCRIPTION
+ "File related statistics."
+ ::= { sdkDemo1MIB 2 }
+
+--
+-- Properties in the "Load" group
+--
+
+me1SystemLoadAvg1min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 1 minute."
+ ::= { me1LoadGroup 1 }
+
+me1SystemLoadAvg5min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 5 minutes."
+ ::= { me1LoadGroup 2 }
+
+me1SystemLoadAvg15min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 15 minutes."
+ ::= { me1LoadGroup 3 }
+
+--
+-- Objects in the "File" group
+--
+
+me1FileTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF Me1FileEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Table containing information of some files on the system."
+ ::= { me1FileGroup 1 }
+
+me1FileEntry OBJECT-TYPE
+ SYNTAX Me1FileEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Information about one file on the system."
+ INDEX { me1FileIndex }
+ ::= { me1FileTable 1 }
+
+Me1FileEntry ::=
+ SEQUENCE {
+ me1FileIndex
+ Unsigned32,
+ me1FileName
+ DisplayString,
+ me1FileSize
+ Unsigned32,
+ me1FilePerm
+ DisplayString
+ }
+
+me1FileIndex OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Index of the file."
+ ::= { me1FileEntry 1 }
+
+me1FileName OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "Name of the file"
+ ::= { me1FileEntry 2 }
+
+me1FileSize OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Size of the file in kb"
+ ::= { me1FileEntry 3 }
+
+me1FilePerm OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Permissions on this file. example, 0755 "
+ ::= { me1FileEntry 4 }
+
+
+-- General table:
+
+
+me1ContactInfoTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF Me1ContactInfoEntry
+ MAX-ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "The contact information table."
+ ::= { sdkDemo1MIB 3 }
+
+
+
+me1ContactInfoEntry OBJECT-TYPE
+ SYNTAX Me1ContactInfoEntry
+ MAX-ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "An entry in the contact info table."
+ INDEX { me1FloorNumber, me1RoomNumber }
+ ::= { me1ContactInfoTable 1 }
+
+
+
+Me1ContactInfoEntry ::=
+ SEQUENCE {
+ me1FloorNumber
+ INTEGER,
+ me1RoomNumber
+ INTEGER,
+ me1Name
+ DisplayString,
+ me1Extension
+ INTEGER
+ }
+
+me1FloorNumber OBJECT-TYPE
+ SYNTAX INTEGER (1..3)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "This object combines with me1RoomNumber are
+ the identifier of the table."
+ ::= { me1ContactInfoEntry 1 }
+
+
+me1RoomNumber OBJECT-TYPE
+ SYNTAX INTEGER (1..100)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "This object combines with me1FloorNumber are
+ the identifier of the table."
+ ::= { me1ContactInfoEntry 2 }
+
+me1Name OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " The person loacted in the room."
+ ::= { me1ContactInfoEntry 3 }
+
+me1Extension OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The phone number of the office."
+ ::= { me1ContactInfoEntry 4 }
+
+
+END
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_3/demo_module_3.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ */
+
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 1.1.1.1 2003/03/26 18:12:29 pcarroll Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "demo_module_3.h"
+
+
+me1ContactEntry* testhead ;
+void construct_table(){
+ int total = 10, i;
+ me1ContactEntry* prevPtr = 0;
+ /* Too lazy, so I make an ordered list */
+ for (i=1; i<=total; i++) {
+ me1ContactEntry* ptr = (me1ContactEntry *) malloc(sizeof(me1ContactEntry));
+ ptr->me1FloorNumber = i % 3 + 1;
+ ptr->me1RoomNumber = ptr->me1FloorNumber + i + ptr->me1FloorNumber*1000;
+ strcpy(ptr->me1Name, "John Doe ");
+ ptr->me1Extension = ptr->me1RoomNumber % 10 + 8000;
+ ptr->pNext = NULL;
+ if (prevPtr == NULL) {
+ testhead = prevPtr = ptr;
+ }
+ prevPtr->pNext = ptr;
+ prevPtr = ptr;
+
+
+ }
+}
+/** Initialize the me1ContactInfoTable table by defining its contents and how it's structured */
+void
+initialize_table_me1ContactInfoTable(void)
+{
+ static oid me1ContactInfoTable_oid[] = {1,3,6,1,4,1,42,2,2,4,4,1,3};
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /* create the table structure itself */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /* if your table is read only, it's easiest to change the
+ HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
+ my_handler = netsnmp_create_handler_registration("me1ContactInfoTable",
+ me1ContactInfoTable_handler,
+ me1ContactInfoTable_oid,
+ OID_LENGTH(me1ContactInfoTable_oid),
+ HANDLER_CAN_RWRITE);
+
+ if (!my_handler || !table_info || !iinfo)
+ return; /* mallocs failed */
+
+ /***************************************************
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_INTEGER, /* index: me1FloorNumber */
+ ASN_INTEGER, /* index: me1RoomNumber */
+ 0);
+
+ table_info->min_column = 1;
+ table_info->max_column = 4;
+
+ /* iterator access routines */
+ iinfo->get_first_data_point = me1ContactInfoTable_get_first_data_point;
+ iinfo->get_next_data_point = me1ContactInfoTable_get_next_data_point;
+
+ iinfo->table_reginfo = table_info;
+
+ /***************************************************
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_me1ContactInfoTable",
+ "Registering table me1ContactInfoTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initializes the demo_module_3 module */
+void
+init_demo_module_3(void)
+{
+
+ /* here we initialize all the tables we're planning on supporting */
+ initialize_table_me1ContactInfoTable();
+ construct_table();
+}
+
+/** returns the first data point within the me1ContactInfoTable table data.
+
+ Set the my_loop_context variable to the first data point structure
+ of your choice (from which you can find the next one). This could
+ be anything from the first node in a linked list, to an integer
+ pointer containing the beginning of an array variable.
+
+ Set the my_data_context variable to something to be returned to
+ you later that will provide you with the data to return in a given
+ row. This could be the same pointer as what my_loop_context is
+ set to, or something different.
+
+ The put_index_data variable contains a list of snmp variable
+ bindings, one for each index in your table. Set the values of
+ each appropriately according to the data matching the first row
+ and return the put_index_data variable at the end of the function.
+*/
+netsnmp_variable_list *
+me1ContactInfoTable_get_first_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ netsnmp_variable_list *vptr;
+
+ me1ContactEntry* firstNode = testhead;
+ if (!firstNode) {
+ printf("The head is NULL ***********\n");
+ return NULL;
+ }
+ *my_loop_context = firstNode;
+ *my_data_context = firstNode;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) &firstNode->me1FloorNumber, sizeof(firstNode->me1FloorNumber));
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) &firstNode->me1RoomNumber, sizeof(firstNode->me1RoomNumber));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+/** functionally the same as me1ContactInfoTable_get_first_data_point, but
+ my_loop_context has already been set to a previous value and should
+ be updated to the next in the list. For example, if it was a
+ linked list, you might want to cast it and the return
+ my_loop_context->next. The my_data_context pointer should be set
+ to something you need later and the indexes in put_index_data
+ updated again. */
+
+netsnmp_variable_list *
+me1ContactInfoTable_get_next_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ netsnmp_variable_list *vptr;
+
+ me1ContactEntry* nextNode = (me1ContactEntry*) *my_loop_context;
+ nextNode = nextNode->pNext;
+
+ if (!nextNode) {
+ /* printf("No data returned in get_next\n"); */
+ return NULL;
+ }
+ *my_loop_context = nextNode;
+ *my_data_context = nextNode;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) &nextNode->me1FloorNumber, sizeof(nextNode->me1FloorNumber));
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) &nextNode->me1RoomNumber, sizeof(nextNode->me1RoomNumber));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+/** handles requests for the me1ContactInfoTable table, if anything else needs to be done */
+int
+me1ContactInfoTable_handler(
+ netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests) {
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+ me1ContactEntry* data;
+
+ for(request = requests; request; request = request->next) {
+ var = request->requestvb;
+ if (request->processed != 0)
+ continue;
+
+ /* perform anything here that you need to do before each
+ request is processed. */
+
+ /* the following extracts the my_data_context pointer set in
+ the loop functions above. You can then use the results to
+ help return data for the columns of the me1ContactInfoTable table in question */
+ data = (me1ContactEntry *) netsnmp_extract_iterator_context(request);
+ if ( data == NULL) {
+ if (reqinfo->mode == MODE_GET) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ /* XXX: no row existed, if you support creation and this is a
+ set, start dealing with it here, else continue */
+ }
+
+ /* extracts the information about the table from the request */
+ table_info = netsnmp_extract_table_info(request);
+ /* table_info->colnum contains the column number requested */
+ /* table_info->indexes contains a linked list of snmp variable
+ bindings for the indexes of the table. Values in the list
+ have been set corresponding to the indexes of the
+ request */
+ if (table_info==NULL) {
+ continue;
+ }
+
+ switch(reqinfo->mode) {
+ /* the table_iterator helper should change all GETNEXTs
+ into GETs for you automatically, so you don't have to
+ worry about the GETNEXT case. Only GETs and SETs need
+ to be dealt with here */
+ case MODE_GET:
+ switch(table_info->colnum) {
+ case COLUMN_ME1FLOORNUMBER:
+ snmp_set_var_typed_value(var, ASN_INTEGER, (u_char *) &data->me1FloorNumber,sizeof(data->me1FloorNumber));
+ break;
+
+ case COLUMN_ME1ROOMNUMBER:
+ snmp_set_var_typed_value(var, ASN_INTEGER, (u_char *) &data->me1RoomNumber, sizeof(data->me1RoomNumber));
+ break;
+
+ case COLUMN_ME1NAME:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) data->me1Name, strlen(data->me1Name));
+ break;
+
+ case COLUMN_ME1EXTENSION:
+ snmp_set_var_typed_value(var, ASN_INTEGER, (u_char *) &data->me1Extension, sizeof(data->me1Extension));
+ break;
+
+ default:
+ /* We shouldn't get here */
+ snmp_log(LOG_ERR, "problem encountered in me1ContactInfoTable_handler: unknown column\n");
+ }
+ break;
+
+ case MODE_SET_RESERVE1:
+ /* set handling... */
+
+ default:
+ snmp_log(LOG_ERR, "problem encountered in me1ContactInfoTable_handler: unsupported mode\n");
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_3/demo_module_3.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 1.1.1.1 2003/03/26 18:12:29 pcarroll Exp $
+ */
+#ifndef DEMO_MODULE_3_H
+#define DEMO_MODULE_3_H
+
+/* function declarations */
+void init_init_demo_module_3(void);
+void initialize_table_me1ContactInfoTable(void);
+Netsnmp_Node_Handler me1ContactInfoTable_handler;
+
+Netsnmp_First_Data_Point me1ContactInfoTable_get_first_data_point;
+Netsnmp_Next_Data_Point me1ContactInfoTable_get_next_data_point;
+
+/* column number definitions for table me1ContactInfoTable */
+ #define COLUMN_ME1FLOORNUMBER 1
+ #define COLUMN_ME1ROOMNUMBER 2
+ #define COLUMN_ME1NAME 3
+ #define COLUMN_ME1EXTENSION 4
+
+
+typedef struct me1ContactEntry_s {
+ long me1FloorNumber;
+ long me1RoomNumber;
+ char me1Name[255];
+ long me1Extension;
+ struct me1ContactEntry_s* pNext;
+} me1ContactEntry;
+
+#endif /* DEMO_MODULE_3_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_4/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# Use is subject to license terms.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate demo_module_4.so
+#
+# usage:
+# To point to a particular compiler, set CC.
+# Example: setenv CC /usr/dist/share/forte_dev/bin/cc
+# "make" : generate library for 64bit
+# "make ARCH=32" : generate library for 32bit
+# "make clean" : remove *.o , *.so
+#
+
+ARCH=64
+CFLAGS_64=-g -m64 -I.
+CFLAGS_32=-g -I.
+CFLAGS=$(CFLAGS_$(ARCH))
+
+LDLIBS=
+
+PROG= demo_module_4.so
+SRCS= me4LoadGroup.c
+OBJS = $(SRCS:.c=.o)
+
+all:$(PROG)
+$(PROG): $(OBJS)
+ $(CC) $(CFLAGS) $(LDLIBS) -G -o $@ $(OBJS)
+.c.o:
+ $(CC) $(CFLAGS) -g -o $@ -c $<
+
+clean:
+ rm -f me4LoadGroup.o demo_module_4.so
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_4/README_demo_module_4 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,231 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+
+README for demo_module_4
+***********************************************************************
+
+This example module demonstrates the following features:
+ - Automatic Refresh of data at regular intervals
+ - Check for alarm condition at regular intervals and generate trap if
+ needed.
+ - Read threshold values from configuration file demo_module_4.conf
+ - use of SNMP_CALLBACK_POST_READ_CONFIG
+
+See the System Management Agent Developer's Guide for more information
+about traps, and demo_module_4.
+
+
+
+How to Use the demo_module_4 Code Example
+==========================================
+
+The demo_module_4 code example includes the following files, by default
+located in the directory /usr/demo/sma_snmp/demo_module_4.
+
+Files:
+
+o Makefile - Compiles the module source code
+o me4LoadGroup.c - Source code for the module
+o me4LoadGroup.h - Header file for the module
+o SDK-DEMO4-MIB.txt - MIB file used in the module
+o demo_module_4.conf - configuration file used by the module
+
+
+
+To set up your environment for the demo:
+
+1. Copy the demo code to a directory for which you have write permission.
+ For example:
+
+ % cp -R /usr/demo/sma_snmp/demo_module_4 /home/username/demo
+
+
+2. Create a lib directory that you can use to store shared object libraries
+ that you generate from demo code examples, if you have not already done so.
+ For example:
+
+ % mkdir /home/username/demo/lib
+
+
+3. Create a mibs directory that you can use to store MIB files for the
+ demo code examples, if you have not already done so.
+ For example:
+
+ % mkdir /home/username/demo/mibs
+
+
+4. Set the CC environment variable to the location of the C compiler to be
+ used. For example, if you are using Sun ONE Studio:
+
+ % setenv CC /opt/SUNWspro/bin/cc
+
+
+5. Set your PATH environment variable to include the appropriate paths, so that
+ needed binaries can be found during the compilation process.
+ For example, in the csh:
+
+ % setenv PATH .:/usr/bin:$PATH
+
+
+
+To build the example:
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_4
+
+
+2. Use the make command to generate object files.
+
+ If you are running the 64-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make
+
+ If you are running the 32-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+ If you are running the Solaris x86 kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+
+3. Copy the module shared library object to the lib directory you created.
+ For example:
+
+ % cp demo_module_4.so /home/username/demo/lib
+
+
+4. Copy the SDK-DEMO4-MIB.txt file to the mibs directory you created for
+ the demos.
+ For example:
+
+ % cp SDK-DEMO4-MIB.txt /home/username/demo/mibs
+
+
+5. Copy the demo_module_4.conf file to a .snmp directory in your home
+ directory.
+ For example:
+
+ % mkdir /home/username/.snmp
+ % cp demo_module_4.conf /home/username/.snmp
+
+
+
+
+Setting Up Agent to Run demo_module_4
+=====================================
+
+1. As root, edit the agent's configuration file /etc/sma/snmp/snmpd.conf,
+ and insert a dlmod statement for the module. This statement enables the
+ agent to load the module.
+ For example:
+
+ dlmod demo_module_4 /home/username/demo/lib/demo_module_4.so
+
+
+2. As root, start the SMA snmp agent. If the agent is already running,
+ stop and restart it in debug mode.
+ For example:
+
+ # /etc/init.d/init.sma stop
+ # /usr/sbin/snmpd -Ddemo_module_4
+
+ The optional -Ddemo_module_4 argument sends debugging statements from
+ demo_module_4 to the /var/log/snmpd.log file. You can also use
+ the -L and -f options to send debugging statements to the screen instead.
+
+
+
+Testing the Module
+==================
+
+1. Set your MIBS and MIBDIRS environment variables to
+ include the appropriate paths.
+ For example, in the csh:
+
+ % setenv MIBDIRS .:/home/username/demo/mibs:/etc/sma/snmp/mibs
+ % setenv MIBS +SDK-DEMO4-MIB
+
+
+2. To get data from the module, issue an snmpwalk request.
+ For example:
+
+ % snmpwalk -v1 -c public localhost 1.3.6.1.4.1.42.2.2.4.4.4
+ .1.3.6.1.4.1.42.2.2.4.4.4.1.1.0 = STRING: "0.043"
+ .1.3.6.1.4.1.42.2.2.4.4.4.1.2.0 = STRING: "0.031"
+ .1.3.6.1.4.1.42.2.2.4.4.4.1.3.0 = STRING: "0.027"
+
+
+
+To catch traps generated by the module:
+
+
+1. Edit the /home/username/.snmp/demo_module_4.conf file and set the
+ thresholds to values that are less than the current load values that
+ were returned in the snmpwalk command.
+
+2. As root, edit the /etc/sma/snmp/snmpd.conf file and add
+ the following lines to configure the snmp agent to send traps.
+
+ trapcommunity public
+ trapsink localhost
+
+
+3. Open a second terminal window and, as root, start snmptrapd in that window.
+ For example, this command starts snmpdtrapd and specifies the format
+ of the output to stderr:
+
+ # /usr/sbin/snmptrapd -P -F "TRAP from %B on %m/%l/%y at %h:%j:%k \
+ Enterprise=%N Type=%w SubType=%q \nwith Varbinds: %v \n\n" localhost:162
+
+ 2003-06-20 12:37:53 NET-SNMP version 5.0.8 Started.
+
+
+4. In the first window, as root, restart the agent.
+ For example:
+
+ # /etc/init.d/init.sma restart
+
+
+5. In the terminal where snmptrapd is running you should see traps that are
+ generated by the agent.
+
+ Trap output should be similar to the following:
+
+ TRAP from sqa-blade-2 on 6/20/2003 at 12:37:57 Enterprise=. Type=0 SubType=0
+ with Varbinds: .1.3.6.1.2.1.1.3.0 = Timeticks: (13) 0:00:00.13 .1.3.6.1.6.3.1.1.4.1.0 = OID:
+ .1.3.6.1.4.1.42.2.2.4.4.4.2.1 .1.3.6.1.4.1.42.2.2.4.4.4.3.1.0 = STRING: sqa-blade-2
+ .1.3.6.1.4.1.42.2.2.4.4.4.3.2.0 = STRING: demo_module_4 .1.3.6.1.4.1.42.2.2.4.4.4.3.3.0 = OID:
+ .1.3.6.1.4.1.42.2.2.4.4.4.1.1.0 .1.3.6.1.4.1.42.2.2.4.4.4.3.4.0 = STRING: ERROR
+ .1.3.6.1.4.1.42.2.2.4.4.4.3.5.0 = STRING: Load Average over last 1 minute crossed the threshold
+
+ TRAP from sqa-blade-2 on 6/20/2003 at 12:37:57 Enterprise=. Type=0 SubType=0
+ with Varbinds: .1.3.6.1.2.1.1.3.0 = Timeticks: (13) 0:00:00.13 .1.3.6.1.6.3.1.1.4.1.0 = OID:
+ .1.3.6.1.4.1.42.2.2.4.4.4.2.1 .1.3.6.1.4.1.42.2.2.4.4.4.3.1.0 = STRING: sqa-blade-2
+ .1.3.6.1.4.1.42.2.2.4.4.4.3.2.0 = STRING: demo_module_4 .1.3.6.1.4.1.42.2.2.4.4.4.3.3.0 = OID:
+ .1.3.6.1.4.1.42.2.2.4.4.4.1.2.0 .1.3.6.1.4.1.42.2.2.4.4.4.3.4.0 = STRING: ERROR
+ .1.3.6.1.4.1.42.2.2.4.4.4.3.5.0 = STRING: Load Average over last 5 minute crossed the threshold
+
+ TRAP from sqa-blade-2 on 6/20/2003 at 12:37:57 Enterprise=. Type=0 SubType=0
+ with Varbinds: .1.3.6.1.2.1.1.3.0 = Timeticks: (13) 0:00:00.13 .1.3.6.1.6.3.1.1.4.1.0 = OID:
+ .1.3.6.1.4.1.42.2.2.4.4.4.2.1 .1.3.6.1.4.1.42.2.2.4.4.4.3.1.0 = STRING: sqa-blade-2
+ .1.3.6.1.4.1.42.2.2.4.4.4.3.2.0 = STRING: demo_module_4 .1.3.6.1.4.1.42.2.2.4.4.4.3.3.0 = OID:
+ .1.3.6.1.4.1.42.2.2.4.4.4.1.3.0 .1.3.6.1.4.1.42.2.2.4.4.4.3.4.0 = STRING: ERROR
+ .1.3.6.1.4.1.42.2.2.4.4.4.3.5.0 = STRING: Load Average over last 15 minute crossed the threshold
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_4/SDK-DEMO4-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,143 @@
+
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are subject to
+-- the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun, Sun
+-- Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+--
+--
+
+----------------------------------------------------------
+-- Systems Management Agent (SMA) SDK module DEMO-4 MIB
+----------------------------------------------------------
+
+SDK-DEMO4-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+ enterprises, MODULE-IDENTITY, OBJECT-TYPE, Counter64, Integer32, Unsigned32
+ FROM SNMPv2-SMI
+ OBJECT-GROUP
+ FROM SNMPv2-CONF
+ DisplayString
+ FROM SNMPv2-TC;
+
+sdkDemo4MIB MODULE-IDENTITY
+ LAST-UPDATED "0009181435Z"
+ ORGANIZATION "Sun Microsystems Inc."
+ CONTACT-INFO
+ " Sun Microsystems Inc
+ 4150 Network Circle
+ Santa Clara, CA 95054
+ e-mail: [email protected]"
+ DESCRIPTION
+ " SMA SDK MIB DEMO-4. This MIB will be used to demonstrate the
+ implementation of modules and various module features in SMA agent."
+ ::= { demo 4 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+management OBJECT IDENTIFIER ::= { products 2 }
+sma OBJECT IDENTIFIER ::= { management 4 }
+demo OBJECT IDENTIFIER ::= { sma 4 }
+
+--
+-- There is currently 1 Groups in the example.
+-- The "Load" group contains information about system load
+--
+
+me4LoadGroup OBJECT-GROUP
+ OBJECTS { me4SystemLoadAvg1min, me4SystemLoadAvg5min,
+ me4SystemLoadAvg15min }
+ STATUS current
+ DESCRIPTION
+ "Load related statistics."
+ ::= { sdkDemo4MIB 1 }
+
+me4traps OBJECT IDENTIFIER ::= { sdkDemo4MIB 2 }
+me4trapInfo OBJECT IDENTIFIER ::= { sdkDemo4MIB 3 }
+
+
+--
+-- Properties in the "Load" group
+--
+
+me4SystemLoadAvg1min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 1 minute."
+ ::= { me4LoadGroup 1 }
+
+me4SystemLoadAvg5min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 5 minutes."
+ ::= { me4LoadGroup 2 }
+
+me4SystemLoadAvg15min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 15 minutes."
+ ::= { me4LoadGroup 3 }
+
+
+--
+-- Trap Definitions for this MIB begin
+--
+
+statusChange NOTIFICATION-TYPE
+OBJECTS { hostName, moduleName, statusOID, objectStatus, eventDescription }
+STATUS current
+DESCRIPTION "A statusChange trap signifies that the status of an object has changed." ::= { me4traps 1 }
+
+hostName OBJECT-TYPE
+SYNTAX DisplayString (SIZE (0..255))
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The name of the host on which the event occurred."
+::= { me4trapInfo 1 }
+
+moduleName OBJECT-TYPE
+SYNTAX DisplayString (SIZE (0..255))
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The name of the module on which the event has occured."
+::= { me4trapInfo 2 }
+
+statusOID OBJECT-TYPE
+SYNTAX OBJECT IDENTIFIER
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The identification of the object for which the status changed."
+::= { me4trapInfo 3 }
+
+objectStatus OBJECT-TYPE
+SYNTAX DisplayString (SIZE (0..255))
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The current status of the object. One of OK, ERROR."
+::= { me4trapInfo 4 }
+
+eventDescription OBJECT-TYPE
+SYNTAX DisplayString (SIZE (0..255))
+MAX-ACCESS accessible-for-notify
+STATUS current
+DESCRIPTION "The detailed description of the event."
+::= { me4trapInfo 5 }
+
+END
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_4/demo_module_4.conf Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+# Following are the thresholds for demo_module_4
+
+threshold_loadavg1 1.0
+threshold_loadavg5 2.0
+threshold_loadavg15 3.0
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_4/me4LoadGroup.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,664 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject to
+ * the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun, Sun
+ * Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+
+/*
+ * demo_module_4:
+ *
+ * This module is based on the SDK-DEMO4-MIB.txt MIB. It implements the
+ * me4LoadGroup objects.
+ *
+ * This example module demonstrates following features: - Automatic Refresh of
+ * data in regular intervals - Check for alarm condition in regular intervals
+ * and generate trap if necessary. - Read threshold values from an external
+ * configuration file called demo_module_4.conf
+ */
+
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "me4LoadGroup.h"
+#include <sys/loadavg.h>
+#include <netdb.h>
+
+
+/*
+ * Data for demo_module_4: loadavg1 stores data for me4SystemLoadAvg1min
+ * loadavg5 stores data for me4SystemLoadAvg5min loadavg15 stores data for
+ * me4SystemLoadAvg15min
+ */
+
+char *loadavg1, *loadavg5, *loadavg15;
+
+/* Alarm thresholds for demo_module_4 */
+
+float threshold_loadavg1 = 1.0, threshold_loadavg5 = 2.0, threshold_loadavg15 = 3.0;
+
+/* Maintain previous alarm states for comparison */
+
+int prev_loadavg1_state = OK;
+int prev_loadavg5_state = OK;
+int prev_loadavg15_state = OK;
+
+/* Common variables for information to be included in traps */
+
+u_char hostName[MAXHOSTNAMELEN], moduleName[15];
+
+
+/** Initializes the demo_module_4 module
+ * This is the Init function which is called when the module is loaded by the agent.
+ *
+ * Note: The name of this function has been changed from "init_me4LoadGroup" to
+ * "init_demo_module_4" to give unique names to example modules across the SMA
+ * SDK.
+ */
+
+
+void
+init_demo_module_4(void)
+{
+
+ int retCode;
+
+ static oid me4SystemLoadAvg15min_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 4, 1, 3, 0};
+ static oid me4SystemLoadAvg1min_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 4, 1, 1, 0};
+ static oid me4SystemLoadAvg5min_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 4, 1, 2, 0};
+
+ DEBUGMSGTL(("me4LoadGroup", "Initializing\n"));
+
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("me4SystemLoadAvg15min",
+ get_me4SystemLoadAvg15min,
+ me4SystemLoadAvg15min_oid,
+ OID_LENGTH(me4SystemLoadAvg15min_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("me4SystemLoadAvg1min",
+ get_me4SystemLoadAvg1min,
+ me4SystemLoadAvg1min_oid,
+ OID_LENGTH(me4SystemLoadAvg1min_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("me4SystemLoadAvg5min",
+ get_me4SystemLoadAvg5min,
+ me4SystemLoadAvg5min_oid,
+ OID_LENGTH(me4SystemLoadAvg5min_oid),
+ HANDLER_CAN_RONLY));
+
+ /* Initialize some common data */
+
+ retCode = gethostname((char *) hostName, MAXHOSTNAMELEN);
+ if (retCode != 0)
+ strcpy((char *) hostName, "null\0");
+
+ strcpy((char *) moduleName, "demo_module_4\0");
+
+
+ /* Allocate memory once. These variables will hold load data */
+
+ loadavg1 = malloc(10 * sizeof(char));
+ loadavg5 = malloc(10 * sizeof(char));
+ loadavg15 = malloc(10 * sizeof(char));
+
+ /*
+ * Register for thresholds. When a token (say threshold_loadavg1) is
+ * found in demo_module_4.conf file, the read_load_thresholds function is
+ * called by the agent
+ */
+
+ register_config_handler("demo_module_4", "threshold_loadavg1",
+ read_load_thresholds, NULL, NULL);
+
+ register_config_handler("demo_module_4", "threshold_loadavg5",
+ read_load_thresholds, NULL, NULL);
+
+ register_config_handler("demo_module_4", "threshold_loadavg15",
+ read_load_thresholds, NULL, NULL);
+
+
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_POST_READ_CONFIG,
+ demo_4_post_read_config, NULL);
+
+
+}
+
+/**
+ * The callback function that is called after the configuration files are
+ * read by the agent ( the thresholds are loaded into the module )
+ */
+
+int
+demo_4_post_read_config(int a, int b, void *c, void *d)
+{
+
+ /* Refresh the load data every 60 seconds */
+ snmp_alarm_register(60, SA_REPEAT, refreshLoadAvg, NULL);
+
+ /* Acquire the data first time */
+ refreshLoadAvg(0, NULL);
+
+ return 1;
+
+}
+
+
+/*
+ * This function is generated by mib2c. It is called when an SNMP "get"
+ * request arrives for the node me4SystemLoadAvg15min
+ *
+ */
+
+int
+get_me4SystemLoadAvg15min(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ /* Refresh the load data by calling the refresh function */
+ refreshLoadAvg(0, NULL);
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ refreshLoadAvg(0, NULL);
+
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) loadavg15, strlen(loadavg15));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+/*
+ * This function is generated by mib2c. It is called when an SNMP "get"
+ * request arrives for the node me4SystemLoadAvg1min
+ *
+ */
+
+
+int
+get_me4SystemLoadAvg1min(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ refreshLoadAvg(0, NULL);
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) loadavg1, strlen(loadavg1));
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+/*
+ * This function is generated by mib2c. It is called when an SNMP "get"
+ * request arrives for the node me4SystemLoadAvg5min
+ *
+ */
+
+
+int
+get_me4SystemLoadAvg5min(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a "instance",
+ * as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ refreshLoadAvg(0, NULL);
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ refreshLoadAvg(0, NULL);
+
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) loadavg5, strlen(loadavg5));
+ break;
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+/*
+ * refreshLoadAvg: This is the function which "refreshes" the load data using
+ * the system call "getloadavg". The data is stored in the 3 variables
+ * loadavg1, loadavg5, loadavg15. Once the data is refreshed, the "check"
+ * functions are called to check for alarm conditions
+ */
+
+void
+refreshLoadAvg(unsigned int clientreg, void *clientarg)
+{
+
+ double loadavg[3];
+ int numOfSamples = getloadavg(loadavg, 3);
+ sprintf(loadavg1, "%.3f\0", loadavg[LOADAVG_1MIN]);
+ sprintf(loadavg5, "%.3f\0", loadavg[LOADAVG_5MIN]);
+ sprintf(loadavg15, "%.3f\0", loadavg[LOADAVG_15MIN]);
+
+ check_loadavg1_state();
+ check_loadavg5_state();
+ check_loadavg15_state();
+
+}
+
+
+/*
+ * Function: conv_alarm_state : This function returns appropriate charecter
+ * string for each integer alarm type
+ */
+
+char *
+conv_alarm_state(int state)
+{
+ switch (state) {
+ case 0:
+ return "OK\0";
+ case 1:
+ return "ERROR\0";
+ default:
+ return "NULL\0";
+ }
+}
+
+
+
+/*
+ * read_load_thresholds: This function is called when a registered token (see
+ * Init_demo_module_4 function) is found in the appropriate configuration
+ * file. The token's values (thresholds) are then stored in some variables.
+ */
+
+void
+read_load_thresholds(const char *token, char *cptr)
+{
+
+ if (strcmp(token, "threshold_loadavg1") == 0) {
+ threshold_loadavg1 = atof(cptr);
+ } else if (strcmp(token, "threshold_loadavg5") == 0) {
+ threshold_loadavg5 = atof(cptr);
+ } else if (strcmp(token, "threshold_loadavg15") == 0) {
+ threshold_loadavg15 = atof(cptr);
+ } else {
+ /* Do nothing */
+ }
+
+ return;
+
+}
+
+
+
+/* send_trap: This function generates an snmpv2 trap */
+
+void
+send_trap(u_char * hostname, u_char * modulename, oid * trapoid, int size, u_char * status, u_char * description)
+{
+
+ /* This is the notification type itself. This is statusChange trap */
+
+ oid notification_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 4, 2, 1};
+
+ size_t notification_oid_len = OID_LENGTH(notification_oid);
+
+ /*
+ * In the notification, we have to assign our notification OID to the
+ * snmpTrapOID.0 object. Here is it's definition.
+ */
+
+ oid objid_snmptrap[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};
+ size_t objid_snmptrap_len = OID_LENGTH(objid_snmptrap);
+
+ /*
+ * here is where we store the variables to be sent in the trap
+ */
+
+ netsnmp_variable_list *notification_vars = NULL;
+
+ oid hostname_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 4, 3, 1, 0};
+
+ size_t hostname_oid_len = OID_LENGTH(hostname_oid);
+
+
+ oid modulename_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 4, 3, 2, 0};
+
+ size_t modulename_oid_len = OID_LENGTH(modulename_oid);
+
+
+ oid nodeoid_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 4, 3, 3, 0};
+
+ size_t nodeoid_oid_len = OID_LENGTH(nodeoid_oid);
+
+
+ oid status_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 4, 3, 4, 0};
+
+ size_t status_oid_len = OID_LENGTH(status_oid);
+
+
+ oid description_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 4, 3, 5, 0};
+
+ size_t description_oid_len = OID_LENGTH(description_oid);
+
+
+ /*
+ * add in the trap definition object
+ */
+
+ snmp_varlist_add_variable(¬ification_vars,
+ /*
+ * the snmpTrapOID.0 variable
+ */
+ objid_snmptrap, objid_snmptrap_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OBJECT_ID,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) notification_oid,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ notification_oid_len * sizeof(oid));
+
+
+ /*
+ * if we wanted to insert additional objects, we'd do it here
+ */
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ hostname_oid, hostname_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OCTET_STR,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) hostname,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ strlen((char *) hostname));
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ modulename_oid, modulename_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OCTET_STR,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) modulename,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ strlen((char *) modulename));
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ nodeoid_oid, nodeoid_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OBJECT_ID,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) trapoid,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ size * sizeof(oid));
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ status_oid, status_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OCTET_STR,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) status,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ strlen((char *) status));
+
+
+ snmp_varlist_add_variable(¬ification_vars,
+ description_oid, description_oid_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OCTET_STR,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) description,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ strlen((char *) description));
+
+
+ /* SEND THE TRAP !!!! */
+
+ send_v2trap(notification_vars);
+
+ /*
+ * free the created notification variable list
+ */
+
+ DEBUGMSGTL(("example_notification", "cleaning up\n"));
+ snmp_free_varbind(notification_vars);
+
+ return;
+
+}
+
+
+
+/*
+ * check_loadavg1_state: This function does 2 things: step-1) Determine the
+ * current alarm state of the node by comparing it's value with threshold.
+ * step-2) Depending on the new state of the node, generate a trap
+ */
+
+void
+check_loadavg1_state()
+{
+
+ /* Trap stuff */
+
+ oid trapoid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 4, 1, 1, 0};
+ u_char status[8];
+ u_char description[] = "Load Average over last 1 minute crossed the threshold \0";
+ int size;
+ int new_loadavg1_state = OK;
+ float currentLoad = atof(loadavg1);
+
+ /* Step-1 */
+
+ /* If threshold is crossed, set state to ERROR */
+ if (currentLoad > threshold_loadavg1) {
+ new_loadavg1_state = ERROR;
+ }
+ /* Step-2 */
+
+ /* Depending on the new state, send trap if necessary */
+
+ size = sizeof(trapoid) / sizeof(oid);
+ strcpy((char *) status, conv_alarm_state(new_loadavg1_state));
+
+ if (new_loadavg1_state > prev_loadavg1_state) {
+ /* Send trap */
+ send_trap(hostName, moduleName, trapoid, size, status, description);
+ prev_loadavg1_state = new_loadavg1_state;
+ } else if (new_loadavg1_state == prev_loadavg1_state) {
+ /* No Change in state .. Do nothing */
+ } else if (new_loadavg1_state < prev_loadavg1_state) {
+ if (new_loadavg1_state == OK) {
+ /* Send OK trap */
+ prev_loadavg1_state = OK;
+ send_trap(hostName, moduleName, trapoid, size, status, description);
+ }
+ }
+}
+
+/*
+ * check_loadavg5_state: This function does 2 things: step-1) Determine the
+ * current alarm state of the node by comparing it's value with threshold.
+ * step-2) Depending on the new state of the node, generate a trap
+ */
+
+
+void
+check_loadavg5_state()
+{
+
+ /* Trap stuff */
+
+ oid trapoid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 4, 1, 2, 0};
+ u_char status[8];
+ u_char description[] = "Load Average over last 5 minute crossed the threshold \0";
+ int size;
+
+ int new_loadavg5_state = OK;
+ double currentLoad = atof(loadavg5);
+
+ /* If threshold is crossed, set state to ERROR */
+ if (currentLoad > threshold_loadavg5)
+ new_loadavg5_state = ERROR;
+
+ /* Depending on the new state, send trap if necessary */
+
+ size = sizeof(trapoid) / sizeof(oid);
+ strcpy((char *) status, conv_alarm_state(new_loadavg5_state));
+
+ if (new_loadavg5_state > prev_loadavg5_state) {
+ /* Send trap */
+ send_trap(hostName, moduleName, trapoid, size, status, description);
+ prev_loadavg5_state = new_loadavg5_state;
+ } else if (new_loadavg5_state == prev_loadavg5_state) {
+ /* No Change in state .. Do nothing */
+ } else if (new_loadavg5_state < prev_loadavg5_state) {
+ if (new_loadavg5_state == OK) {
+ /* Send OK trap */
+ prev_loadavg5_state = OK;
+ send_trap(hostName, moduleName, trapoid, size, status, description);
+ }
+ }
+}
+
+/*
+ * check_loadavg15_state: This function does 2 things: step-1) Determine the
+ * current alarm state of the node by comparing it's value with threshold.
+ * step-2) Depending on the new state of the node, generate a trap
+ */
+
+
+void
+check_loadavg15_state()
+{
+
+ /* Trap stuff */
+
+ oid trapoid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 4, 1, 3, 0};
+ u_char status[8];
+ u_char description[] = "Load Average over last 15 minute crossed the threshold \0";
+ int size;
+
+ int new_loadavg15_state = OK;
+ double currentLoad = atof(loadavg15);
+
+ /* If threshold is crossed, set state to ERROR */
+ if (currentLoad > threshold_loadavg15)
+ new_loadavg15_state = ERROR;
+
+ /* Depending on the new state, send trap if necessary */
+
+ size = sizeof(trapoid) / sizeof(oid);
+ strcpy((char *) status, conv_alarm_state(new_loadavg15_state));
+
+ if (new_loadavg15_state > prev_loadavg15_state) {
+ /* Send trap */
+ prev_loadavg15_state = new_loadavg15_state;
+ send_trap(hostName, moduleName, trapoid, size, status, description);
+ } else if (new_loadavg15_state == prev_loadavg15_state) {
+ /* No Change in state .. Do nothing */
+ } else if (new_loadavg15_state < prev_loadavg15_state) {
+ if (new_loadavg15_state == OK) {
+ /* Send OK trap */
+ prev_loadavg15_state = OK;
+ send_trap(hostName, moduleName, trapoid, size, status, description);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_4/me4LoadGroup.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject to
+ * the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun, Sun
+ * Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.1.1.1 2003/03/26 18:12:30 pcarroll Exp $
+ */
+
+#ifndef ME1LOADGROUP_H
+#define ME1LOADGROUP_H
+
+/* function declarations */
+void init_demo_module_4(void);
+Netsnmp_Node_Handler get_me4SystemLoadAvg15min;
+Netsnmp_Node_Handler get_me4SystemLoadAvg1min;
+Netsnmp_Node_Handler get_me4SystemLoadAvg5min;
+
+#define OK 0
+#define ERROR 1
+
+int demo_4_post_read_config(int a, int b, void *c, void *d);
+void refreshLoadAvg(unsigned int clientreg, void *clientarg);
+void check_loadavg1_state();
+void check_loadavg5_state();
+void check_loadavg15_state();
+char* conv_alarm_state(int state);
+void read_load_thresholds(const char *token, char *cptr);
+
+#endif /* ME1LOADGROUP_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_5/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# Use is subject to license terms.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate demo_module_5.so
+#
+# usage:
+# To point to a particular compiler, set CC.
+# Example: setenv CC /usr/dist/share/forte_dev/bin/cc
+# "make" : generate library for 64bit
+# "make ARCH=32" : generate library for 32bit
+# "make clean" : remove *.o , *.so
+#
+
+ARCH=64
+CFLAGS_64=-g -m64 -I.
+CFLAGS_32=-g -I.
+CFLAGS=$(CFLAGS_$(ARCH))
+
+LDLIBS=
+
+PROG= demo_module_5.so
+SRCS= demo_module_5.c
+OBJS = $(SRCS:.c=.o)
+
+all:$(PROG)
+$(PROG): $(OBJS)
+ $(CC) $(CFLAGS) $(LDLIBS) -G -o $@ $(OBJS)
+.c.o:
+ $(CC) $(CFLAGS) -g -o $@ -c $<
+
+clean:
+ rm -f demo_module_5.o demo_module_5.so
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_5/README_demo_module_5 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,248 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+
+README for demo_module_5
+***********************************************************************
+
+This code example demonstrates how to implement data persistence
+for a module, across agent restarts. See the System Management
+Agent Developer's Guide for more information about storing persistent
+data.
+
+
+Introduction
+------------
+
+The demo_module_5 is based on the SDK-DEMO5-MIB.txt MIB, which implements
+the me5FileGroup objects. me5FileTable monitors a set of files. File size
+and file permissions are monitored for each file. By default, the
+following files are monitored:
+
+/etc/hosts
+/etc/group
+/etc/passwd
+/etc/system
+
+The module user can specify different files to be monitored by using
+snmp SET requests. Any changes to the list of monitored files are persistent
+across agent restarts. In other words, when the agent is restarted, the
+list of files being monitored is the same as before restart.
+
+
+Files
+-----
+
+The demo_module_5 code example includes the following files, by default located
+in the directory /usr/demo/sma_snmp/demo_module_5.
+
+Makefile - makefile to build demo_module_5.so shared library file
+demo_module_5.c - module source code
+demo_module_5.h - module header file
+SDK-DEMO5-MIB.txt - MIB file for this module
+
+
+How to Build the demo_module_5 Code Example
+===========================================
+
+To set up your build environment for the demo:
+
+1. Copy the demo code to a directory for which you have write permission.
+ For example:
+ % cp -R /usr/demo/sma_snmp/demo_module_5 /home/username/demo
+
+
+2. Create a lib directory that you can use to store shared object libraries
+ that you generate from demo code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/lib
+
+
+3. Create a mibs directory that you can use to store MIB files for the
+ demo code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/mibs
+
+
+4. Set the CC environment variable to the location of the C compiler to
+ be used.
+ For example, if you are using Sun ONE Studio:
+ % setenv CC /opt/SUNWspro/bin/cc
+
+
+5. Set your PATH environment variable to include the appropriate paths, so that
+ needed binaries can be found during the compilation process.
+ For example, in the csh:
+
+ % setenv PATH .:/usr/bin:$PATH
+
+
+To build the example:
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_5
+
+
+2. Use the make command to generate object files.
+
+ If you are running the 64-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make
+
+ If you are running the 32-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+ If you are running the Solaris x86 kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+
+3. Copy the module shared library object to the lib directory you created.
+ For example:
+
+ % cp demo_module_5.so /home/username/demo/lib
+
+
+4. Copy the SDK-DEMO5-MIB.txt file to the mibs directory you created for
+ the demos.
+ For example:
+
+ % cp SDK-DEMO5-MIB.txt /home/username/demo/mibs
+
+
+
+Setting Up Agent to Run the demo_module_5 Module
+=================================================
+
+1. As root, edit the agent's configuration file /etc/sma/snmp/snmpd.conf,
+ and insert a dlmod statement for the module. This statement enables
+ the agent to load the module.
+ For example:
+
+ dlmod demo_module_5 /home/username/demo/lib/demo_module_5.so
+
+
+2. As root, start the SMA snmp agent. If the agent is already running,
+ stop and restart it in debug mode.
+ For example:
+
+ # /etc/init.d/init.sma stop
+ # /usr/sbin/snmpd -Ddemo_module_5
+
+ The optional -Ddemo_module_5 argument sends debugging statements from
+ demo_module_5 to the /var/log/snmpd.log file. You can also use the -L
+ and -f options to send debugging statements to the screen instead.
+
+ When the module is started, the file /var/sma_snmp/demo_module_5.conf
+ is read and then the latest token values are appended to the file.
+ The demo_module_5.conf file is created if it doesn't exist. When you
+ later use snmpset to specify new token values, the new values are
+ appended to the file.
+
+
+
+Testing the demo_module_5 Module
+================================
+
+1. Set your MIBS and MIBDIRS environment variables to
+ include the appropriate paths.
+ For example, in the csh:
+
+ % setenv MIBDIRS .:/home/username/demo/mibs:/etc/sma/snmp/mibs
+ % setenv MIBS +SDK-DEMO5-MIB
+
+ Note that step 1 is not required, but it enables snmp commands to access
+ the MIB to provide variable names instead of OIDs in its output.
+
+
+2. Issue an snmpget or snmpwalk request to test the module.
+ For example:
+
+ % snmpwalk -v1 -c public localhost 1.3.6.1.4.1.42.2.2.4.4.5
+
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.1.1 = Gauge32: 1
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.1.2 = Gauge32: 2
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.1.3 = Gauge32: 3
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.1.4 = Gauge32: 4
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.1 = STRING: "/usr/sbin/snmpd"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.2 = STRING: "/tmp/asdf"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.3 = STRING: "/etc/hosts"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.4 = STRING: "/etc/sma/snmp/snmp.conf"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.3.1 = Gauge32: 229376
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.3.2 = Gauge32: 17
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.3.3 = Gauge32: 74
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.3.4 = Gauge32: 2904
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.4.1 = STRING: "755"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.4.2 = STRING: "644"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.4.3 = STRING: "444"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.4.4 = STRING: "755"
+
+
+3. Issue an snmpset command to specify a different file name.
+ For example, to monitor file /var/sma_snmp/snmpd.conf:
+
+ % snmpset -v2c -c private localhost .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.1 \
+ s "/var/sma_snmp/snmpd.conf" .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.1 = STRING: \
+ "/var/sma_snmp/snmpd.conf"
+
+
+4. Verify the results of the set request by using the snmpwalk command.
+ For example:
+
+ % snmpwalk -v1 -c public localhost 1.3.6.1.4.1.42.2.2.4.4.5
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.1.1 = Gauge32: 1
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.1.2 = Gauge32: 2
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.1.3 = Gauge32: 3
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.1.4 = Gauge32: 4
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.1 = STRING: "/var/sma_snmp/snmpd.conf"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.2 = STRING: "/tmp/asdf"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.3 = STRING: "/etc/hosts"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.4 = STRING: "/etc/sma/snmp/snmp.conf"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.3.1 = Gauge32: 489
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.3.2 = Gauge32: 17
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.3.3 = Gauge32: 74
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.3.4 = Gauge32: 2904
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.4.1 = STRING: "600"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.4.2 = STRING: "644"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.4.3 = STRING: "444"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.4.4 = STRING: "755"
+
+
+5. Verify that the file information that you changed is saved across
+ agent restarts by restarting the agent (as root) and repeating the snmpwalk
+ in step 4.
+
+ For example:
+
+ # /etc/init.d/init.sma restart
+ # /usr/bin/snmpwalk -v1 -c public localhost 1.3.6.1.4.1.42.2.2.4.4.5
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.1.1 = Gauge32: 1
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.1.2 = Gauge32: 2
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.1.3 = Gauge32: 3
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.1.4 = Gauge32: 4
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.1 = STRING: "/var/sma_snmp/snmpd.conf"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.2 = STRING: "/tmp/asdf"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.3 = STRING: "/etc/hosts"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.2.4 = STRING: "/etc/sma/snmp/snmp.conf"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.3.1 = Gauge32: 489
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.3.2 = Gauge32: 17
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.3.3 = Gauge32: 74
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.3.4 = Gauge32: 2904
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.4.1 = STRING: "600"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.4.2 = STRING: "644"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.4.3 = STRING: "444"
+ .1.3.6.1.4.1.42.2.2.4.4.5.2.1.1.4.4 = STRING: "755"
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_5/SDK-DEMO5-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,126 @@
+-------------------------------------------------------
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are
+-- subject
+-- to the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun,
+-- Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+--
+----------------------------------------------------------
+-- Systems Management Agent (SMA) SDK module example-5 MIB
+----------------------------------------------------------
+
+SDK-DEMO5-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+ enterprises, MODULE-IDENTITY, OBJECT-TYPE, Counter64, Integer32, Unsigned32
+ FROM SNMPv2-SMI
+ OBJECT-GROUP
+ FROM SNMPv2-CONF
+ DisplayString
+ FROM SNMPv2-TC;
+
+sdkDemo5MIB MODULE-IDENTITY
+ LAST-UPDATED "0009181435Z"
+ ORGANIZATION "Sun Microsystems Inc."
+ CONTACT-INFO
+ " Sun Microsystems Inc
+ 4150 Network Circle
+ Santa Clara, CA 95054
+ e-mail: [email protected]"
+ DESCRIPTION
+ " SMA SDK MIB example-5. This MIB will be used to demonstrate the
+ implementation of modules and various module features in SMA agent."
+ ::= { demo 5 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+management OBJECT IDENTIFIER ::= { products 2 }
+sma OBJECT IDENTIFIER ::= { management 4 }
+demo OBJECT IDENTIFIER ::= { sma 4 }
+
+--
+-- There are currently 1 Groups in the example.
+-- The "File" group contains information about some files on the system
+--
+
+me5FileGroup OBJECT-GROUP
+ OBJECTS { me5FileIndex, me5FileName, me5FileSize, me5FilePerm
+ }
+ STATUS current
+ DESCRIPTION
+ "File related statistics."
+ ::= { sdkDemo5MIB 2 }
+
+--
+-- Objects in the "File" group
+--
+
+me5FileTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF Me1FileEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Table containing information of some files on the system."
+ ::= { me5FileGroup 1 }
+
+me5FileEntry OBJECT-TYPE
+ SYNTAX Me1FileEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Information about one file on the system."
+ INDEX { me5FileIndex }
+ ::= { me5FileTable 1 }
+
+Me1FileEntry ::=
+ SEQUENCE {
+ me5FileIndex
+ Unsigned32,
+ me5FileName
+ DisplayString,
+ me5FileSize
+ Unsigned32,
+ me5FilePerm
+ DisplayString
+ }
+
+me5FileIndex OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Index of the file."
+ ::= { me5FileEntry 1 }
+
+me5FileName OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "Name of the file"
+ ::= { me5FileEntry 2 }
+
+me5FileSize OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Size of the file in kb"
+ ::= { me5FileEntry 3 }
+
+me5FilePerm OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Permissions on this file. example, 0755 "
+ ::= { me5FileEntry 4 }
+
+END
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_5/demo_module_5.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,646 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject to
+ * the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun, Sun
+ * Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ */
+
+
+/*
+ * Note: this file originally auto-generated by mib2c using :
+ * mib2c.iterate.conf,v 1.1.1.1 2003/03/26 18:12:29 pcarroll Exp $
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "demo_module_5.h"
+#include <net-snmp/agent/agent_trap.h>
+
+/*
+ * MAXNAMELEN is the maximum permissible file name defined in param.h
+ */
+
+fileEntry *fileList = 0;
+char file1[MAXNAMELEN], file2[MAXNAMELEN], file3[MAXNAMELEN],
+ file4[MAXNAMELEN];
+
+
+
+/** Initialize the me5FileTable table by defining its contents and how it's structured */
+
+void
+initialize_table_me5FileTable(void)
+{
+ static oid me5FileTable_oid[] = {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 5, 2, 1};
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /* create the table structure itself */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /*
+ * if your table is read only, it's easiest to change the
+ * HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY
+ */
+ my_handler = netsnmp_create_handler_registration("me5FileTable",
+ me5FileTable_handler,
+ me5FileTable_oid,
+ OID_LENGTH(me5FileTable_oid),
+ HANDLER_CAN_RWRITE);
+
+ if (!my_handler || !table_info || !iinfo) {
+ return; /* mallocs failed */
+ }
+
+ /***************************************************
+ * Setting up the table's definition
+ */
+
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_UNSIGNED, /* index: me5FileIndex */
+ 0);
+
+ table_info->min_column = 1;
+ table_info->max_column = 4;
+
+ /* iterator access routines */
+ iinfo->get_first_data_point = me5FileTable_get_first_data_point;
+ iinfo->get_next_data_point = me5FileTable_get_next_data_point;
+
+ iinfo->table_reginfo = table_info;
+
+ /***************************************************
+ * registering the table with the master agent
+ */
+
+ DEBUGMSGTL(("initialize_table_me5FileTable",
+ "Registering table me5FileTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+
+/** Initializes the demo_module_5 module */
+
+
+void
+init_demo_module_5(void)
+{
+
+ /* here we initialize all the tables we're planning on supporting */
+
+
+ initialize_table_me5FileTable();
+
+
+ /*
+ * These are the default files that are monitored by the module if there
+ * is no persistent data (file names to be monitored). This is likely
+ * during the first running on the module, when the .conf file does not
+ * have any file related information.
+ */
+
+ strcpy(file1, "/etc/hosts");
+ strcpy(file2, "/etc/group");
+ strcpy(file3, "/etc/passwd");
+ strcpy(file4, "/etc/system");
+
+
+ /*
+ * Register for tokens from demo_module_5.conf file. The names of the
+ * tokens are demo5_file1,demo5_file2,demo5_file3,demo5_file4. The function
+ * demo5_load_tokens is called whenever these 4 tokens are encountered in
+ * demo_module_5.conf file.
+ */
+
+ register_config_handler(DEMO5_CONF_FILE, "demo5_file1",
+ demo5_load_tokens, NULL, NULL);
+
+ register_config_handler(DEMO5_CONF_FILE, "demo5_file2",
+ demo5_load_tokens, NULL, NULL);
+
+ register_config_handler(DEMO5_CONF_FILE, "demo5_file3",
+ demo5_load_tokens, NULL, NULL);
+
+ register_config_handler(DEMO5_CONF_FILE, "demo5_file4",
+ demo5_load_tokens, NULL, NULL);
+
+
+
+ /*
+ * Register for a callback when all the configuration files are read. The
+ * callback function here is demo5_post_read_config
+ */
+
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_POST_READ_CONFIG,
+ demo5_post_read_config, NULL);
+
+
+}
+
+
+/** returns the first data point within the me5FileTable table data.
+
+ Set the my_loop_context variable to the first data point structure
+ of your choice (from which you can find the next one). This could
+ be anything from the first node in a linked list, to an integer
+ pointer containing the beginning of an array variable.
+
+ Set the my_data_context variable to something to be returned to
+ you later that will provide you with the data to return in a given
+ row. This could be the same pointer as what my_loop_context is
+ set to, or something different.
+
+ The put_index_data variable contains a list of snmp variable
+ bindings, one for each index in your table. Set the values of
+ each appropriately according to the data matching the first row
+ and return the put_index_data variable at the end of the function.
+*/
+
+
+netsnmp_variable_list *
+me5FileTable_get_first_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list * put_index_data,
+ netsnmp_iterator_info * mydata)
+{
+
+ netsnmp_variable_list *vptr;
+
+ fileEntry *firstFile = fileList;
+ if (!firstFile) {
+ return NULL;
+ }
+ *my_loop_context = firstFile;
+ *my_data_context = firstFile;
+
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) & fileList->findex, sizeof(fileList->findex));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+
+/** functionally the same as me5FileTable_get_first_data_point, but
+ my_loop_context has already been set to a previous value and should
+ be updated to the next in the list. For example, if it was a
+ linked list, you might want to cast it and the return
+ my_loop_context->next. The my_data_context pointer should be set
+ to something you need later and the indexes in put_index_data
+ updated again. */
+
+
+
+netsnmp_variable_list *
+me5FileTable_get_next_data_point(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list * put_index_data,
+ netsnmp_iterator_info * mydata)
+{
+
+ netsnmp_variable_list *vptr;
+ fileEntry *nextNode = (fileEntry *) * my_loop_context;
+ nextNode = nextNode->next;
+
+ if (!nextNode) {
+ return NULL;
+ }
+ *my_loop_context = nextNode;
+ *my_data_context = nextNode;
+
+ vptr = put_index_data;
+
+
+
+ snmp_set_var_value(vptr, (u_char *) & nextNode->findex,
+ sizeof(nextNode->findex));
+ vptr = vptr->next_variable;
+
+ return put_index_data;
+}
+
+
+/** handles requests for the me5FileTable table, if anything else needs to be done */
+
+int
+me5FileTable_handler(
+ netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+ fileEntry *data;
+ char *fileName = NULL;
+ char *undofn;
+ int len;
+
+ char filebuf[255];
+
+ for (request = requests; request; request = request->next) {
+
+ var = request->requestvb;
+ if (request->processed != 0)
+ continue;
+
+ /*
+ * the following extracts the my_data_context pointer set in the loop
+ * functions above. You can then use the results to help return data
+ * for the columns of the me5FileTable table in question
+ */
+
+ data = (fileEntry *) netsnmp_extract_iterator_context(request);
+ if (data == NULL) {
+ if (reqinfo->mode == MODE_GET) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ } else {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ }
+ continue;
+ } else {
+ struct stat fAttrib;
+ if (stat(GetFileName(data->findex), &fAttrib) != -1) {
+ data->fileSize = fAttrib.st_size;
+ sprintf(data->filePerm, "%o", fAttrib.st_mode & 0777);
+ } else {
+ data->fileSize = 0;
+ sprintf(data->filePerm, "%d", -1);
+ }
+
+ }
+
+ /* extracts the information about the table from the request */
+ table_info = netsnmp_extract_table_info(request);
+ /* table_info->colnum contains the column number requested */
+ /*
+ * table_info->indexes contains a linked list of snmp variable
+ * bindings for the indexes of the table. Values in the list have
+ * been set corresponding to the indexes of the request
+ */
+
+ if (table_info == NULL) {
+ continue;
+ }
+ switch (reqinfo->mode) {
+ /*
+ * the table_iterator helper should change all GETNEXTs into GETs
+ * for you automatically, so you don't have to worry about the
+ * GETNEXT case. Only GETs and SETs need to be dealt with here
+ */
+ case MODE_GET:
+ switch (table_info->colnum) {
+ case COLUMN_ME5FILEINDEX:
+ snmp_set_var_typed_value(var, ASN_UNSIGNED,
+ (u_char *) & data->findex,
+ sizeof(data->findex));
+ break;
+
+ case COLUMN_ME5FILENAME:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR,
+ (u_char *) data->fileName,
+ strlen(data->fileName));
+ break;
+
+ case COLUMN_ME5FILESIZE:
+ snmp_set_var_typed_value(var, ASN_UNSIGNED,
+ (u_char *) & data->fileSize,
+ sizeof(data->fileSize));
+ break;
+
+ case COLUMN_ME5FILEPERM:
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) data->filePerm,
+ strlen(data->filePerm));
+ break;
+
+ default:
+ /* We shouldn't get here */
+ snmp_log(LOG_ERR,
+ "problem encountered in me5FileTable_handler: unknown column\n");
+ }
+ break;
+
+ case MODE_SET_RESERVE1:
+ /* set handling... */
+ switch (table_info->colnum) {
+ /*
+ * Check that the value being set is acceptable
+ */
+ case COLUMN_ME5FILENAME:
+ if (var->type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("me5FileTable", "COLUMN NAME\n"));
+ DEBUGMSGTL(("me5FileTable", "%x not octet string type", var->type));
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (!var->val.string) {
+ DEBUGMSGTL(("me2FileTable", "Empty file name"));
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+ default:
+ /* We shouldn't get here */
+ snmp_log(LOG_ERR,
+ "problem encountered in me5FileTable_handler: unknown column\n");
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_READONLY);
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+ case MODE_SET_RESERVE2:
+ /*
+ * This is conventially where any necesary resources are
+ * allocated (e.g. calls to malloc)
+ */
+
+ /* Store old info for undo later */
+
+ undofn = GetFileName(data->findex);
+ if (undofn) {
+ if (!(fileName = strdup(undofn))) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ } else
+ netsnmp_request_add_list_data(request,
+ netsnmp_create_data_list
+ (ME5FILE_SET_FILENAME, fileName,
+ free));
+
+ }
+ break;
+ case MODE_SET_FREE:
+
+ /*
+ * This is where any of the above resources are freed again
+ * (because one of the other values being SET failed for some
+ * reason).
+ */
+
+ /*
+ * The netsnmp_free_list_data should take care of the alocated
+ * resources
+ */
+
+ break;
+ case MODE_SET_ACTION:
+ /*
+ * Set the variable as requested. Note that this may need to be
+ * reversed, so save any information needed to do this.
+ */
+ len = var->val_len;
+ var->val.string[len] = '\0';
+ if (!ChangeItem(data->findex, (char *) var->val.string )) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_COMMITFAILED);
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * Everything worked, so we can discard any saved information,
+ * and make the change permanent (e.g. write to the config file).
+ * We also free any allocated resources.
+ *
+ */
+
+ /* Persist the file information */
+
+ snprintf(&filebuf[0], MAXNAMELEN, "demo5_file%d %s",
+ data->findex, data->fileName);
+
+
+
+ read_config_store(DEMO5_CONF_FILE, &filebuf[0]);
+
+ /*
+ * The netsnmp_free_list_data should take care of the alocated
+ * resources
+ */
+
+
+ break;
+ case MODE_SET_UNDO:
+ /*
+ * Something failed, so re-set the variable to its previous value
+ * (and free any allocated resources).
+ */
+
+ if (GetFileName(data->findex)) {
+ /******* Get the saved value ************/
+ undofn = (char *) netsnmp_request_get_list_data(request,
+ ME5FILE_SET_FILENAME);
+ if (!ChangeItem(data->findex, undofn)) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "problem encountered in me5FileTable_handler: unsupported mode\n");
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+/* Function to add a fileName to the linked list of files */
+
+int
+AddItem(char *fileName)
+{
+
+ fileEntry *fprt = fileList;
+ struct stat fAttrib; /* Need to check if memory is valid */
+ if (!fileName || !strlen(fileName)) {
+ return FALSE;
+ }
+ if (stat(fileName, &fAttrib) == -1) {
+ /*
+ * Unable to get the file information, it could be more than file not
+ * exists if (errno == ENOENT) { return FALSE; } return FALSE;
+ */
+ DEBUGMSGTL(("demo_module_5", "Can't access the file %s", fileName));
+ }
+ if (fprt != NULL) {
+ while (fprt->next != NULL) {
+ fprt = fprt->next;
+ }
+ fprt->next = (fileEntry *) malloc(sizeof(fileEntry));
+ fprt->next->findex = fprt->findex + 1;
+ fprt = fprt->next;
+ fprt->next = NULL;
+ strcpy(fprt->fileName, fileName);
+ fprt->fileSize = fAttrib.st_size;
+ sprintf(fprt->filePerm, "%d", fAttrib.st_mode);
+ } else {
+ fprt = (fileEntry *) malloc(sizeof(fileEntry));
+ fprt->next = NULL;
+ fprt->findex = 1;
+ strcpy(fprt->fileName, fileName);
+ fprt->fileSize = fAttrib.st_size;
+ sprintf(fprt->filePerm, "%d", fAttrib.st_mode);
+ fileList = fprt;
+ }
+
+ return TRUE;
+}
+
+/*
+ * Function to change the file for a particular index. This function is
+ * called when a snmp set request arrives to change the list of files being
+ * monitored.
+ */
+
+int
+ChangeItem(int fileIndex, char *fileName)
+{
+
+ fileEntry *tempp = fileList;
+
+ if (!fileName || !strlen(fileName)) {
+ return FALSE;
+ }
+
+ while (tempp != NULL) {
+ if (tempp->findex == fileIndex) {
+ strcpy(tempp->fileName, fileName);
+ switch(fileIndex) {
+ case 1:
+ strcpy(file1, fileName);
+ case 2:
+ strcpy(file2, fileName);
+ case 3:
+ strcpy(file3, fileName);
+ case 4:
+ strcpy(file4, fileName);
+ }
+ return TRUE;
+
+ }
+ tempp = tempp->next;
+ }
+
+ return FALSE;
+}
+
+/* Function to return the filename corresponding to an index */
+
+char *
+GetFileName(int fIndex)
+{
+ fileEntry *fprt = fileList;
+ while (fprt != NULL) {
+ if (fprt->findex == fIndex) {
+ return fprt->fileName;
+ }
+ fprt = fprt->next;
+ }
+ return NULL;
+
+}
+
+/*
+ * Function that is called whenever interested tokens are encountered in
+ * demo_module_5.conf file. The token values represent the persistent filename
+ * information.
+ */
+
+void
+demo5_load_tokens(const char *token, char *cptr)
+{
+
+ if (strcmp(token, "demo5_file1") == 0) {
+ strcpy(file1, cptr);
+ } else if (strcmp(token, "demo5_file2") == 0) {
+ strcpy(file2, cptr);
+ } else if (strcmp(token, "demo5_file3") == 0) {
+ strcpy(file3, cptr);
+ } else if (strcmp(token, "demo5_file4") == 0) {
+ strcpy(file4, cptr);
+ } else {
+ /* Do Nothing */
+ }
+
+ return;
+
+}
+
+/*
+ * Function that persists file information. This is called by the agent
+ * whenever data needs to be persisted.
+ */
+
+int
+demo5_persist_data(int a, int b, void *c, void *d)
+{
+
+ char filebuf[300];
+
+
+ sprintf(filebuf, "demo5_file1 %s", file1);
+ read_config_store(DEMO5_CONF_FILE, filebuf);
+
+
+ sprintf(filebuf, "demo5_file2 %s", file2);
+ read_config_store(DEMO5_CONF_FILE, filebuf);
+
+
+ sprintf(filebuf, "demo5_file3 %s", file3);
+ read_config_store(DEMO5_CONF_FILE, filebuf);
+
+
+ sprintf(filebuf, "demo5_file4 %s", file4);
+ read_config_store(DEMO5_CONF_FILE, filebuf);
+
+}
+
+/*
+ * Callback function that is called after all the configuration files are
+ * read by the agent. See init_demo_module_5 function to see how this
+ * callback is specified.
+ *
+ * When this function is called, any persistent file information would have been
+ * read into the module. These files are added to the file list.
+ *
+ * The callback function to persist data (demo5_persist_data) is registered.
+ */
+
+int
+demo5_post_read_config(int a, int b, void *c, void *d)
+{
+
+ if (!AddItem(file1))
+ snmp_log(LOG_ERR, "Failed to add instance in init_demo_module_5\n");
+ if (!AddItem(file2))
+ snmp_log(LOG_ERR, "Failed to add instance in init_demo_module_5\n");
+ if (!AddItem(file3))
+ snmp_log(LOG_ERR, "Failed to add instance in init_demo_module_5\n");
+ if (!AddItem(file4))
+ snmp_log(LOG_ERR, "Failed to add instance in init_demo_module_5\n");
+
+
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ demo5_persist_data, NULL);
+
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_5/demo_module_5.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 1.1.1.1 2003/03/26 18:12:29 pcarroll Exp $
+ */
+#ifndef DEMO_MODULE_5_H
+#define DEMO_MODULE_5_H
+
+
+/* function declarations */
+void init_demo_module_5(void);
+void initialize_table_me5FileTable(void);
+Netsnmp_Node_Handler me5FileTable_handler;
+
+Netsnmp_First_Data_Point me5FileTable_get_first_data_point;
+Netsnmp_Next_Data_Point me5FileTable_get_next_data_point;
+
+int AddItem (char* fileName);
+int ChangeItem (int fileIndex, char* fileName);
+char* GetFileName( int fIndex);
+void demo5_load_tokens(const char *token, char *cptr);
+int demo5_persist_data(int a, int b, void *c, void *d);
+int demo5_post_read_config(int a, int b, void *c, void *d);
+
+/* column number definitions for table me5FileTable */
+ #define COLUMN_ME5FILEINDEX 1
+ #define COLUMN_ME5FILENAME 2
+ #define COLUMN_ME5FILESIZE 3
+ #define COLUMN_ME5FILEPERM 4
+
+typedef struct fileTable{
+ unsigned long findex;
+ char fileName[MAXNAMELEN];
+ unsigned long fileSize;
+ char filePerm[MAXNAMELEN];
+ struct fileTable* next;
+} fileEntry;
+
+#define ADDFILE 1
+#define RMFILE 2
+#define GETFILE 3
+#define ME5FILE_SET_FILENAME "me5FileName"
+
+#define DEMO5_CONF_FILE "demo_module_5"
+
+#endif /* DEMO_MODULE_5_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_6/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,63 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# Use is subject to license terms.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate demo_module_6.so
+#
+# usage:
+# "make" : generate library for 64bit / sparc
+# "make ARCH=32" : generate library for 32bit / sparc
+# "make ARCH=32 MACH=x86" : generate library for 32bit / x86
+# "make clean" : remove *.o , *.so
+#
+
+ARCH=64
+LIB32=/usr/lib
+LIB64=/usr/lib/sparcv9
+LD=/usr/ccs/bin/ld
+
+OBJS1=demo_module_6.so
+TARGETS=demo_module_6.so
+
+#CFLAGS_64=-g -I. -Dsolaris_2 -m64
+CFLAGS_64=-I. -Dsolaris_2 -m64
+#CFLAGS_32=-g -I. -Dsolaris_2
+CFLAGS_32=-I. -Dsolaris_2
+CFLAGS=$(CFLAGS_$(ARCH))
+
+BUILDAGENTLIBS_64=-R../lib -L$(LIB64) -lnetsnmpagent -lnetsnmpmibs -l netsnmphelpers -lnetsnmp -ldl -lkvm -lz -lpkcs11 -lkstat -lelf -lm -ldl -lnsl -lsocket -ladm
+BUILDAGENTLIBS_32=-R../lib -L$(LIB32) -lnetsnmpagent -lnetsnmpmibs -l netsnmphelpers -lnetsnmp -ldl -lkvm -lz -lpkcs11 -lkstat -lelf -lm -ldl -lnsl -lsocket -ladm
+BUILDAGENTLIBS=$(BUILDAGENTLIBS_$(ARCH))
+
+
+
+# shared library flags (assumes gcc)
+#DLFLAGS=-fPIC -shared
+# shared library flags (assumes cc)
+DLFLAGS=-dy -G
+
+all: $(TARGETS)
+
+#example-demon-testTypesA32: $(OBJS1)
+#$(CC) $(CFLAGS) -o example-demon-testTypesA32 $(OBJS1) $(BUILDAGENTLIBS)
+
+clean:
+ rm $(OBJS1) $(TARGETS)
+
+demo_module_6.so: demo_module_6.o Makefile
+ $(CC) $(CFLAGS) -c -o demo_module_6.o demo_module_6.c
+ $(LD) $(DLFLAGS) $(LIBS1) -o demo_module_6.so demo_module_6.o
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_6/README_demo_module_6 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,202 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+README for demo_module_6
+***********************************************************************
+
+This code example demonstrates how to implement a module in such a way that
+more than one instance of the module can run simultaneously on a single host.
+See the System Management Agent Developer's Guide for more information about
+implementing multi-instance modules.
+
+
+Introduction
+============
+
+The demo_module_6.c file shows how to write a module that registers an object
+in two different contexts. It also shows how to check for the contextName in
+a request and return a different value depending on the value of the
+contextName.
+
+The code example registers one object, filesize, in two different contexts,
+fileX and fileY. This example registers the OIDs using a read-only instance
+handler helper. The OIDs do not need to be read-only. You could also register
+the OIDs using any of the SMA instance handler helper APIs.
+
+The function get_filesize is registered to handle get requests for instances
+of the filesize object. This function checks the contextName in the reginfo
+structure that is passed to the function by the SMA agent. If the value of
+contextName is fileX, the function returns fileX_data, which has been set to
+the integer 111. If the value of contextName is fileY, the function returns
+fileY_data, which has been set to the integer 999.
+
+
+How to Build the demo_module_6 Code Example
+===========================================
+
+The demo_module_6 code example includes the following files, by default located
+in the directory /usr/demo/sma_snmp/demo_module_6.
+
+
+Files:
+
+Makefile - makefile to build demo_module_6.so shared library file
+demo_module_6.c - module source code
+demo_module_6.h - module header file
+SDK-DEMO6-MIB.txt - MIB file
+get_demo_module_6 - Script that executes snmpget against the OID defined
+ in the module.
+
+
+To set up your build environment for the demo:
+
+1. Copy the demo code to a directory for which you have write permission.
+ For example:
+ % cp -R /usr/demo/sma_snmp/demo_module_6 /home/username/demo
+
+
+2. Create a lib directory that you can use to store shared object libraries
+ that you generate from demo code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/lib
+
+
+3. Create a mibs directory that you can use to store MIB files for the demo
+ code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/mibs
+
+
+4. Set the CC environment variable to the location of the C compiler to be
+ used. For example, if you are using Sun ONE Studio:
+ % setenv CC /opt/SUNWspro/bin/cc
+
+
+5. Set your PATH environment variable to include the appropriate paths, so that
+ needed binaries can be found during the compilation process.
+ For example, in the csh:
+
+ % setenv PATH .:/usr/bin:$PATH
+
+
+To build the example:
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_6
+
+
+2. Use the make command to generate object files.
+
+ If you are running the 64-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make
+
+ If you are running the 32-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+ If you are running the Solaris x86 kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+
+3. Copy the module shared library object to the lib directory you created.
+ For example:
+
+ % cp demo_module_6.so /home/username/demo/lib
+
+
+4. Copy the SDK-DEMO6-MIB.tx file to the mibs directory you created for the
+ demos.
+ For example:
+
+ % cp SDK-DEMO6-MIB.txt /home/username/demo/mibs
+
+
+
+Setting Up Agent to Run the Multi-Instance Module
+=================================================
+
+To run this module, the agent must be configured for SNMPv3.
+
+
+ 1. As root, stop the SNMP agent if it is running.
+ For example:
+
+ # /etc/init.d/init.sma stop
+
+
+ 2. Set up an SNMP v3 user as follows, if you have not already done so.
+ Note that you should use "myuser" and "mypassword" -- do not replace with
+ other values because the test script expects these values.
+
+ # /usr/bin/net-snmp-config --create-snmpv3-user myuser
+
+ Enter authentication pass-phrase:
+ mypassword
+
+ Enter encryption pass-phrase:
+ [press return to reuse the authentication pass-phrase]
+ <Return>
+
+
+ 3. Edit the agent's configuration file /etc/sma/snmp/snmpd.conf,
+ and insert a dlmod statement for the module. This statement enables
+ the agent to load the module.
+ For example:
+
+ dlmod demo_module_6 /home/username/demo/lib/demo_module_6.so
+
+
+ 4. Start the SMA snmp agent in debug mode.
+ For example:
+
+ # /usr/sbin/snmpd -Ddemo_module_6
+
+ The optional -Ddemo_module_6 argument sends debugging statements from
+ demo_module_6 to the /var/log/snmpd.log file. You can also use the -L
+ and -f options to send debugging statements to the screen instead.
+
+
+
+
+
+Testing the demo_module_6 Module
+================================
+
+1. Set your MIBS and MIBDIRS environment variables to
+ include the appropriate paths.
+ For example, in the csh:
+
+ % setenv MIBDIRS .:/home/username/demo/mibs:/etc/sma/snmp/mibs
+ % setenv MIBS +SDK-DEMO6-MIB
+
+ Note that step 1 is not required, but it enables snmpget to access the MIB
+ to provide variable names instead of OIDs in its output.
+
+
+2. Run the get_demo_module_6 script to access the agent:
+
+ % get_demo_module_6
+
+ SMA-SDK-MODULE-EXAMPLE1-MIB::me1FileSize.0 = INTEGER: 111
+ SMA-SDK-MODULE-EXAMPLE1-MIB::me1FileSize.0 = INTEGER: 999
+
+
+ The first snmpget in the script accesses the module whose contextName is
+ fileX, and the second snmpget accesses the module whose contextName is
+ fileY.
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_6/SDK-DEMO6-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,88 @@
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are subject to
+-- the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun, Sun
+-- Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+--
+--
+
+------------------------------------------------------------------------
+-- Systems Management Agent (SMA) SDK module DEMO-6 MIB
+------------------------------------------------------------------------
+SDK-DEMO6-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+ enterprises, MODULE-IDENTITY, OBJECT-TYPE, Counter64, Integer32, Unsigned32
+ FROM SNMPv2-SMI
+ OBJECT-GROUP
+ FROM SNMPv2-CONF
+ DisplayString
+ FROM SNMPv2-TC;
+
+sdkDemo6MIB MODULE-IDENTITY
+ LAST-UPDATED "0009181435Z"
+ ORGANIZATION "Sun Microsystems Inc."
+ CONTACT-INFO
+ " Sun Microsystems Inc
+ 4150 Network Circle
+ Santa Clara, CA 95054
+ e-mail: [email protected]"
+ DESCRIPTION
+ " SMA SDK MIB DEMO-6. This MIB will be used to demonstrate the
+ implementation of modules and various module features in SMA agent."
+ ::= { demo 6 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+management OBJECT IDENTIFIER ::= { products 2 }
+sma OBJECT IDENTIFIER ::= { management 4 }
+demo OBJECT IDENTIFIER ::= { sma 4 }
+
+--
+-- The "File" group contains information about some files on the system
+-- The "Multi-instance" group contains information about filesize for
+-- using SNMPv3 context strings.
+--
+
+me1MultiGroup OBJECT-GROUP
+ OBJECTS { me1FileSize, me1createContext, me1removeContext }
+ STATUS current
+ DESCRIPTION
+ "Multi-instance file related statistics."
+ ::= { sdkDemo6MIB 1 }
+
+--
+-- Properties in the "Multi" group
+--
+
+me1FileSize OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Size of file in Kb."
+ ::= { me1MultiGroup 1 }
+
+me1createContext OBJECT-TYPE
+ SYNTAX OCTET STRING (SIZE(0..1024))
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "String which when set, registers a context."
+ ::= { me1MultiGroup 2 }
+
+me1removeContext OBJECT-TYPE
+ SYNTAX OCTET STRING (SIZE(0..1024))
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "String which when set, unregisters a context."
+ ::= { me1MultiGroup 3 }
+
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_6/demo_module_6.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using :
+ * mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "demo_module_6.h"
+
+//Hardcoded size of fileX context name string
+static long fileX_data = 111;
+
+//Hardcoded size of fileY context name string
+static long fileY_data = 999;
+
+
+
+/*
+ The following code example shows how to write a module that registers
+ an object in two different contexts. It also shows how to check for
+ the contextName in a request and return a different value depending
+ on the value of the contextName.
+
+ The code example registers one object, filesize, in two different
+ contexts, fileX, and fileY. This example registers the OIDs using a
+ read-only instance handler helper. The OIDs do not need to be read-only.
+ You could also register the OIDs using any of the SMA instance handler
+ helper APIs.
+
+ The function get_filesize is registered to handle get requests for
+ instances of the filesize object. This function checks the contextName
+ in the reginfo structure that is passed to the function by the SMA
+ agent. If the value of contextName is fileX, the function returns
+ fileX_data, which has been set to the integer 111. If the value of
+ contextName is fileY, the function returns fileY_data, which has been
+ set to the integer 999. */
+
+/* Initialialization routine, which is automatically called by the agent.
+ The function name must match init_FILENAME() */
+
+void
+init_demo_module_6(void)
+{
+ /*
+ * the OID at which to register the demo_module_6 integer.
+ */
+ static oid filesize_oid[] =
+ {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 6, 1, 1, 0};
+
+ netsnmp_handler_registration *myreg1;
+ //Registration handler
+ char *filexcon = "fileX";
+ //Name of fileX context
+ char *fileycon = "fileY";
+ //Name of fileY context
+
+ /*
+ * A debugging statement. Run the agent with -Ddemo_module_6 to see
+ * the output of this debugging statement in /var/log/snmpd.log, by
+ * default. Use the -L option to write debugging output to the
+ * screen.
+ */
+ DEBUGMSGTL(("demo_module_6", "Initializing\n"));
+ /*
+ * Creates a read-only registration handler named demo_module_6,
+ * which calls the get_demo_module_6 function to service snmp
+ * requests for the demo_module_6_oid object. The OID_LENGTH
+ * argument calculates the length of the demo_module_6_oid.
+ */
+ myreg1 = netsnmp_create_handler_registration
+ ("filesize",
+ get_filesize,
+ filesize_oid,
+ OID_LENGTH(filesize_oid),
+ HANDLER_CAN_RONLY);
+ /*
+ * Assigns new filename as a context string in the contextName member
+ * of the netsnmp_registration_handler struct for the filesize_oid.
+ */
+ myreg1->contextName = filexcon;
+ /*
+ * Registers the OID and contextName.
+ *
+ */
+ netsnmp_register_read_only_instance(myreg1);
+ /*
+ * Creates a read-only registration handler named filesize, which
+ * calls the get_filesize function to service snmp requests for the
+ * filesize_oid object. The OID_LENGTH argument calculates the
+ * length of the filesize_oid.
+ */
+ myreg1 = netsnmp_create_handler_registration
+ ("filesize",
+ get_filesize,
+ filesize_oid,
+ OID_LENGTH(filesize_oid),
+ HANDLER_CAN_RONLY);
+ /*
+ * Assigns new filename as a context string in the contextName member
+ * of the netsnmp_registration_handler struct for the filesize_oid.
+ */
+ myreg1->contextName = fileycon;
+ /*
+ * Creates a read-only registration handler named filesize, which
+ * calls the get_filesize function to service snmp requests for the
+ * filesize_oid object. The OID_LENGTH argument calculates the
+ * length of the filesize_oid.
+ */
+ netsnmp_register_read_only_instance(myreg1);
+
+}
+
+
+int
+get_filesize(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * This handler is never called for a getnext if it is registered as
+ * an instance. An instance handler only delivers one request at a
+ * time, so we do not need to loop over a list of requests.
+ */
+ DEBUGMSGTL(("demo_module_6", "get_filesize CALLED\n"));
+ DEBUGMSGTL(("demo_module_6", "INCOMING CONTEXT NAME = %s:\n",
+ reginfo->contextName));
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ if (strcmp(reginfo->contextName, "fileX") == 0)
+ snmp_set_var_typed_value(requests->requestvb,
+ ASN_INTEGER, (u_char *) & fileX_data,
+ sizeof (fileX_data) /* length in bytes */);
+ else if (strcmp(reginfo->contextName, "fileY") == 0)
+ snmp_set_var_typed_value(requests->requestvb,
+ ASN_INTEGER, (u_char *)
+ & fileY_data,
+ sizeof (fileY_data));
+ break;
+ default:
+ /*
+ * We should never get here, so this is a really bad error.
+ */
+ return (SNMP_ERR_GENERR);
+ }
+ return (SNMP_ERR_NOERROR);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_6/demo_module_6.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+
+#ifndef demo_module_6_H
+#define demo_module_6_H
+
+/* function declarations */
+void init_demo_module_6(void);
+
+Netsnmp_Node_Handler get_filesize;
+
+#endif /* demo_module_6_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_6/get_demo_module_6 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,17 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+/usr/bin/snmpget -mALL -v 3 -u myuser -n "fileX" -l authNoPriv -A "mypassword" localhost .1.3.6.1.4.1.42.2.2.4.4.6.1.1.0
+/usr/bin/snmpget -mALL -v 3 -u myuser -n "fileY" -l authNoPriv -A "mypassword" localhost .1.3.6.1.4.1.42.2.2.4.4.6.1.1.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_7/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,46 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# Use is subject to license terms.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate demo_module_7.so
+#
+# usage:
+# "make" : generate library for 64bit / sparc
+# "make ARCH=32" : generate library for 32bit / sparc
+# "make ARCH=32 MACH=x86" : generate library for 32bit / x86
+# "make clean" : remove *.o , *.so
+#
+
+
+ARCH=64
+LDFLAGS_64=-g -m64 -I.
+LDFLAGS_32=-g -I.
+LDFLAGS=$(LDFLAGS_$(ARCH))
+
+LDLIBS=
+
+PROG= demo_module_7.so
+SRCS= demo_module_7.c
+OBJS = $(SRCS:.c=.o)
+
+all:$(PROG)
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) $(LDLIBS) -G -o $@ $(OBJS)
+.c.o:
+ $(CC) $(LDFLAGS) -g -o $@ -c $<
+
+clean:
+ rm -f *.o *.so
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_7/README_demo_module_7 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,235 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+README for demo_module_7
+***********************************************************************
+
+This code example demonstrates how to dynamically update multi-instance
+modules. See the System Management Agent Developer's Guide for
+more information about dynamically updating multi-instance modules.
+
+You can follow these guidelines when you need to add new instances after
+a module has been registered with the agent.
+
+
+Introduction
+============
+
+The demo_module_7 code example module registers context name strings that
+represent files. Get requests to these contexts will retrieve the size of
+the file.
+
+The module can be dynamically updated to register new file names, by issuing
+an snmpset command. You do not need to edit the module. An application passes
+the file name to the module by issuing an snmpset command, such as the
+following:
+
+ /usr/bin/snmpset -v 3 -u < user_name >
+ -l authNoPriv -A " <password >" < agent_host_name >
+ < createContext OID > s <file_name>
+
+The module registers the set_createContext handler to handle incoming snmpset
+requests for this OID. The set_createContext handler registers the new filename
+as a context string in the contextName member of the
+netsnmp_registration_handler struct for the me1filesize_oid.
+
+Subsequent snmpget requests for the size of the file will return its size in
+blocks: For example:
+
+ /usr/bin/snmpget -v 3 -u < user_name > -n < context_name>
+ -l authNoPriv -A "< password >" < agent_host_name > < filesize_oid >
+
+Note that you can use -m MIB[:...] to load given list of MIBs
+(ALL loads everything).
+For more information on loading MIBs refer to the snmpcmd man page.
+
+
+
+How to Build the demo_module_7 Code Example
+===========================================
+
+The demo_module_7 code example includes the following files, by default located
+in the directory /usr/demo/sma_snmp/demo_module_7.
+
+Files:
+
+Makefile - makefile to build the demo_module_7.so shared library file
+demo_module_7.c - module source code
+demo_module_7.h - module header file
+get_filesize - Script that executes snmpget on a file.
+register_file - Script that executes snmpset on the createContext OID
+unregister_file - Script that executes snmpset on the removeContext OID
+SDK-DEMO6-MIB.txt - MIB file from demo_module_6, also used in demo_module_7
+
+
+To set up your build environment for the demo:
+
+1. Copy the demo code to a directory for which you have write permission.
+ For example:
+ % cp -R /usr/demo/sma_snmp/demo_module_7 /home/username/demo
+
+
+2. Create a lib directory that you can use to store shared object libraries
+ that you generate from demo code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/lib
+
+
+3. Create a mibs directory that you can use to store MIB files for the demo
+ code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/mibs
+
+
+4. Set the CC environment variable to the location of the C compiler to be
+ used.
+ For example, if you are using Sun ONE Studio:
+ % setenv CC /opt/SUNWspro/bin/cc
+
+
+5. Set your PATH environment variable to include the appropriate paths, so that
+ needed binaries can be found during the compilation process.
+ For example, in the csh:
+
+ % setenv PATH .:/usr/bin:$PATH
+
+
+To build the example:
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_7
+
+
+2. Use the make command to generate object files.
+
+ If you are running the 64-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make
+
+ If you are running the 32-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+ If you are running the Solaris x86 kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+
+3. Copy the module shared library object to the lib directory you created.
+ For example:
+
+ % cp demo_module_7.so /home/username/demo/lib
+
+
+4. This module uses the SDK-DEMO6-MIB.txt file from demo_module_6. If you have
+ not already done so, copy this file to the mibs directory you created for
+ the demos.
+ For example:
+
+ % cp SDK-DEMO6-MIB.txt /home/username/demo/mibs
+
+
+Setting Up Agent to Run the Multi-Instance Module
+=================================================
+
+To run this module, the agent must be configured for SNMPv3.
+
+
+ 1. As root, stop the SNMP agent if it is running.
+ For example:
+
+ # /etc/init.d/init.sma stop
+
+
+ 2. Set up an SNMP v3 user as follows, if you have not already done so.
+ Note that you should use "myuser" and "mypassword" -- do not replace with
+ other values because the test script expects these values.
+
+ # /usr/bin/net-snmp-config --create-snmpv3-user myuser
+
+ Enter authentication pass-phrase:
+ mypassword
+
+ Enter encryption pass-phrase:
+ [press return to reuse the authentication pass-phrase]
+ <Return>
+
+
+ 3. Edit the agent's configuration file /etc/sma/snmp/snmpd.conf,
+ and insert a dlmod statement for the module. This statement enables the
+ agent to load the module.
+ For example:
+
+ dlmod demo_module_7 /home/username/demo/lib/demo_module_7.so
+
+
+ 4. Start the SMA snmp agent. If the agent is already running, stop and
+ restart it in debug mode.
+ For example:
+
+ # /usr/sbin/snmpd -Ddemo_module_7
+
+ The optional -Ddemo_module_7 argument sends debugging statements from
+ demo_module_7 to the /var/log/snmpd.log file. You can also use the -L
+ and -f options to send debugging statements to the screen instead.
+
+
+
+
+Testing the demo_module_7 Module
+================================
+
+1. Set your MIBS and MIBDIRS environment variables to
+ include the appropriate paths.
+ For example, in the csh:
+
+ % setenv MIBDIRS .:/home/username/demo/mibs:/etc/sma/snmp/mibs
+ % setenv MIBS +SDK-DEMO6-MIB
+
+ Note that step 1 is not required, but it enables snmpget to access the MIB
+ to provide variable names instead of OIDs in its output.
+
+
+2. Run the get_filesize script to get the filesize of the file
+ /home/username/demo/lib/demo_module_7.so. For example:
+
+ % get_filesize
+
+ This file has not yet been registered so the agent will timeout.
+
+ Timeout: No Response from localhost.
+
+
+3. Run the register_file script to register the file
+ /home/username/demo/lib/demo_module_7.so with the module:
+
+ % register_file
+
+ SDK-DEMO6-MIB::me1createContext.0 = STRING: "/home/username/demo/lib/demo_module_7.so"
+
+
+4. Run the get_filesize script again to query for the filesize.
+
+ % get_filesize
+
+ SDK-DEMO6-MIB::me1FileSize.0 = INTEGER: 28144
+
+
+5. Run the unregister_file script to unregister the file.
+
+ % unregister_file
+
+ SDK-DEMO6-MIB::me1removeContext.0 = STRING: "/home/username/demo/lib/demo_module_7.so"
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_7/SDK-DEMO6-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,88 @@
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are subject to
+-- the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun, Sun
+-- Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+--
+--
+
+------------------------------------------------------------------------
+-- Systems Management Agent (SMA) SDK module DEMO-6 MIB
+------------------------------------------------------------------------
+SDK-DEMO6-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+ enterprises, MODULE-IDENTITY, OBJECT-TYPE, Counter64, Integer32, Unsigned32
+ FROM SNMPv2-SMI
+ OBJECT-GROUP
+ FROM SNMPv2-CONF
+ DisplayString
+ FROM SNMPv2-TC;
+
+sdkDemo6MIB MODULE-IDENTITY
+ LAST-UPDATED "0009181435Z"
+ ORGANIZATION "Sun Microsystems Inc."
+ CONTACT-INFO
+ " Sun Microsystems Inc
+ 4150 Network Circle
+ Santa Clara, CA 95054
+ e-mail: [email protected]"
+ DESCRIPTION
+ " SMA SDK MIB DEMO-6. This MIB will be used to demonstrate the
+ implementation of modules and various module features in SMA agent."
+ ::= { demo 6 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+management OBJECT IDENTIFIER ::= { products 2 }
+sma OBJECT IDENTIFIER ::= { management 4 }
+demo OBJECT IDENTIFIER ::= { sma 4 }
+
+--
+-- The "File" group contains information about some files on the system
+-- The "Multi-instance" group contains information about filesize for
+-- using SNMPv3 context strings.
+--
+
+me1MultiGroup OBJECT-GROUP
+ OBJECTS { me1FileSize, me1createContext, me1removeContext }
+ STATUS current
+ DESCRIPTION
+ "Multi-instance file related statistics."
+ ::= { sdkDemo6MIB 1 }
+
+--
+-- Properties in the "Multi" group
+--
+
+me1FileSize OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Size of file in Kb."
+ ::= { me1MultiGroup 1 }
+
+me1createContext OBJECT-TYPE
+ SYNTAX OCTET STRING (SIZE(0..1024))
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "String which when set, registers a context."
+ ::= { me1MultiGroup 2 }
+
+me1removeContext OBJECT-TYPE
+ SYNTAX OCTET STRING (SIZE(0..1024))
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "String which when set, unregisters a context."
+ ::= { me1MultiGroup 3 }
+
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_7/demo_module_7.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,385 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "demo_module_7.h"
+
+static long fileX_data = 111; // Hardcoded size of fileX context name string
+static long fileY_data = 999; // Hardcoded size of fileY context name string
+
+static long PRIORITY = 0;
+static long SUB_ID = 0;
+static long RANGE_UBOUND = 0;
+
+// Gets size of file
+static oid me1filesize_oid[] = { 1,3,6,1,4,1,42,2,2,4,4,6,1,1,0 };
+
+// Registers a context
+static oid me1createContext_oid[] = { 1,3,6,1,4,1,42,2,2,4,4,6,1,2,0 };
+
+// Unregisters a context
+static oid me1removeContext_oid[] = { 1,3,6,1,4,1,42,2,2,4,4,6,1,3,0 };
+
+// Name of file whose size should be returned
+char *filename;
+
+/*
+ This example module registers context name strings that represent files.
+ Get requests to these contexts will retrieve the size of the file.
+
+ The module can be dynamically updated to register new file names, by
+ issuing an snmpset command. You do not need to edit the module in
+ application passes the file name to the module by issuing an snmpset
+ command, such as the following:
+
+ snmpset -v 3 -u < user_name > -n "< file_name >"
+ -l authNoPriv -A " <password >" < agent_host_name >
+ < createContext OID > .
+
+ The module registers the set_createContext handler to handle incoming
+ snmp set requests for this OID. The set_createContext handler registers
+ the new filename as a context string in the contextName member of the
+ netsnmp_registration_handler struct for the filesize_oid.
+
+ Subsequent snmpget requests for the size of the file will
+ return its size in blocks: For example:
+
+ snmpget -v 3 -u < user_name > -n "< file_name >"
+ -l authNoPriv -A "< password >" < agent_host_name >
+ < filesize_oid > */
+
+
+/* Initializes the filesize module */
+
+void
+init_demo_module_7(void)
+{
+
+ char *filexcon = "fileX";
+ char *fileycon = "fileY";
+
+
+ netsnmp_handler_registration *myreg1;
+ int status;
+
+ /*
+ Create a read-only registration handler named filesize,
+ which calls the get_filesize function to service snmp requests
+ for the me1filesize_oid object. The OID_LENGTH argument
+ calculates the length of the me1filesize_oid. */
+ DEBUGMSGTL(("demo_module_7", "Initializing\n"));
+ myreg1 = netsnmp_create_handler_registration
+ ("filesize",
+ get_filesize,
+ me1filesize_oid,
+ OID_LENGTH(me1filesize_oid),
+ HANDLER_CAN_RONLY);
+
+ myreg1->contextName = filexcon;
+ status = netsnmp_register_read_only_instance(myreg1);
+ DEBUGMSGTL(("demo_module_7", "init reg1 status %d:\n", status));
+
+
+ myreg1 = netsnmp_create_handler_registration
+ ("filesize",
+ get_filesize,
+ me1filesize_oid,
+ OID_LENGTH(me1filesize_oid),
+ HANDLER_CAN_RONLY);
+
+ myreg1->contextName = fileycon;
+ status = netsnmp_register_read_only_instance(myreg1);
+ DEBUGMSGTL(("demo_module_7", "init reg2 status %d:\n", status));
+
+
+ /*
+ Create a read-write registration handler named filesize,
+ which calls the set_createContext function to service snmp requests
+ for the me1createContext_oid object. The OID_LENGTH argument
+ calculates the length of the me1createContext_oid. */
+ myreg1 = netsnmp_create_handler_registration
+ ("filesize",
+ set_createContext,
+ me1createContext_oid,
+ OID_LENGTH(me1createContext_oid),
+ HANDLER_CAN_RWRITE);
+
+ status = netsnmp_register_instance(myreg1);
+ DEBUGMSGTL(("filesize", "init reg3 status %d:\n", status));
+
+ /*
+ Create a read-write registration handler named filesize,
+ which calls the set_removeContext function to service snmp requests
+ for the me1removeContext_oid object. The OID_LENGTH argument
+ calculates the length of the me1removeContext_oid. */
+ myreg1 = netsnmp_create_handler_registration
+ ("filesize",
+ set_removeContext,
+ me1removeContext_oid,
+ OID_LENGTH(me1removeContext_oid),
+ HANDLER_CAN_RWRITE);
+
+ status = netsnmp_register_instance(myreg1);
+ DEBUGMSGTL(("demo_module_7", "init reg4 status %d:\n", status));
+}
+
+ /*
+ This handler handles set requests on the m1createContext_oid
+ by registering a context. The handler extracts the string from
+ the snmp set request and uses it to register a new context for
+ the mefilesize_oid.
+
+ This handler handles get requests by returning the last context
+ name that was registered.
+
+ For detailed info. on net-snmp set processing,
+ see "http://www.net-snmp.org/tutorial-5/toolkit/mib_module/index.html"
+ net-snmp call each SNMP mode in sequence. The case statement
+ transfers control to the default: case when no other condition
+ is satisfied. */
+
+int
+set_createContext(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_handler_registration *myreg;
+ char *context_names[256];
+ int status;
+ DEBUGMSGTL(("demo_module_7", "set_createContext CALLED\n"));
+ DEBUGMSGTL(("demo_module_7", "reqinfo->mode = %d\n", reqinfo->mode));
+ switch (reqinfo -> mode) {
+
+ case MODE_SET_RESERVE1:
+ break;
+
+ case MODE_SET_RESERVE2:
+ break;
+
+ case MODE_SET_FREE:
+ break;
+
+ case MODE_SET_ACTION:
+
+ DEBUGMSGTL(("demo_module_7", "MODE_SET_ACTION CALLED\n"));
+ DEBUGMSGTL(("demo_module_7", "requests->requestvb->val = %s\n",
+ (u_char *) requests->requestvb->val.string));
+
+ // You must allocate memory for this variable because
+ // the unregister_mib function frees it.
+ filename = malloc(requests->requestvb->val_len + 1);
+ snprintf(filename, requests->requestvb->val_len + 1, "%s",
+ (u_char *) requests->requestvb->val.string);
+ filename[requests->requestvb->val_len + 1] = '\0';
+
+ DEBUGMSGTL(("demo_module_7", "filename = %s\n", filename));
+
+ /*
+ Create a registration handler for the me1filesize_oid
+ object in the new context name specified by
+ the snmp set on the me1createContext OID. */
+ myreg = netsnmp_create_handler_registration
+ ("test", get_test, me1filesize_oid,
+ OID_LENGTH(me1filesize_oid),
+ HANDLER_CAN_RONLY);
+ myreg->contextName = filename;
+ status = netsnmp_register_read_only_instance(myreg);
+ DEBUGMSGTL(("demo_module_7", "status %d:\n", status));
+ break;
+
+ case MODE_SET_COMMIT:
+ break;
+
+ case MODE_SET_UNDO:
+ /*
+ Not handling the undo case because we don't care about
+ multi-phase sets for this example. */
+ break;
+
+ case MODE_GET:
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
+ (u_char *)filename, sizeof (filename));
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ DEBUGMSGTL(("demo_module_7", "default CALLED\n"));
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+
+ /*
+ This handler handles set requests on the m1removeContext_oid
+ for detailed info. on net-snmp set processing,
+ see "http://www.net-snmp.org/tutorial-5/toolkit/mib_module/index.html"
+ net-snmp call each SNMP mode in sequence. The case statement
+ transfers control to the default: case when no other condition
+ is satisfied. */
+
+int
+set_removeContext(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ DEBUGMSGTL(("demo_module_7", "remove_filesize CALLED\n"));
+ switch (reqinfo->mode) {
+ case MODE_SET_RESERVE1:
+ break;
+ case MODE_SET_RESERVE2:
+ break;
+ case MODE_SET_ACTION:
+ DEBUGMSGTL(("demo_module_7",
+ "remove_filesize MODE_SET_ACTION CALLED\n"));
+ DEBUGMSGTL(("demo_module_7",
+ "remove_filesize MODE_SET_ACTION CALLED\n"));
+ snprintf(filename, requests->requestvb->val_len + 1,
+ "%s", (u_char *) requests->requestvb->val.string);
+ filename[requests->requestvb->val_len + 1] = '\0';
+ DEBUGMSGTL(("demo_module_7",
+ "filename after snmpset = %s:\n",
+ filename));
+ unregister_mib_context(me1filesize_oid,
+ OID_LENGTH(me1filesize_oid),
+ PRIORITY, SUB_ID, RANGE_UBOUND,
+ filename);
+ break;
+
+ case MODE_SET_COMMIT:
+ break;
+
+ case MODE_SET_FREE:
+ break;
+
+ case MODE_SET_UNDO:
+ /*
+ Not handling the undo case because we don't care about
+ multi-phase sets for this example. */
+ break;
+
+ default:
+ /*
+ we should never get here, so this
+ is a really bad error */
+ DEBUGMSGTL(("demo_module_7", "set_removeContext CALLED\n"));
+ }
+ return (SNMP_ERR_NOERROR);
+}
+
+
+
+int
+get_filesize(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /*
+ This handler is never called for a getnext
+ if it is registered as an instance. An instance
+ handler only delivers one request at a time, so
+ we do not need to loop over a list of requests. */
+
+ DEBUGMSGTL(("demo_module_7", "get_filesize CALLED\n"));
+ DEBUGMSGTL(("demo_module_7", "INCOMING CONTEXT NAME = %s:\n",
+ reginfo->contextName));
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+
+ if (strcmp(reginfo->contextName, "fileX") == 0)
+ snmp_set_var_typed_value(requests->requestvb,
+ ASN_INTEGER, (u_char *) &fileX_data
+ /* pointer to the scalar's data */,
+ sizeof (fileX_data)
+ /* the length of the data in bytes */);
+
+ else if (strcmp(reginfo->contextName, "fileY") == 0)
+ snmp_set_var_typed_value(requests->requestvb,
+ ASN_INTEGER, (u_char *) &fileY_data
+ /* Pointer to the scalar's data */,
+ sizeof (fileY_data)
+ /* Length of the data in bytes */);
+ break;
+
+ default:
+ /*
+ We should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+}
+
+ return (SNMP_ERR_NOERROR);
+}
+
+int
+get_test(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /*
+ This handler is called to handle snmpset requests for a new
+ context name in the me1filesize_oid. If it is called to
+ handle snmp get requests, the handler does not need to
+ handle a GETNEXT if it is registered as an
+ instance handler. Instance handlers only deliver one request
+ at a time, so we do not need to loop over a list of requests. */
+
+ struct stat buf;
+ static int fd = 0;
+ DEBUGMSGTL(("demo_module_7", "get_test CALLED\n"));
+ DEBUGMSGTL(("demo_module_7", "INCOMING CONTEXT NAME = %s:\n",
+ reginfo->contextName));
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ if (strcmp(reginfo->contextName, filename) == 0)
+ // An open() for reading only returns without delay.
+ if ((fd = open(filename, O_NONBLOCK |
+ O_RDONLY)) == -1)
+ DEBUGMSGTL(("demo_module_7", "ERROR\n"));
+
+ if (fstat(fd, &buf) == -1)
+ DEBUGMSGTL(("demo_module_7", "ERROR\n"));
+ else
+ DEBUGMSGTL(("demo_module_7",
+ "FILE SIZE IN BYTES = %d:\n",
+ buf.st_size));
+
+ snmp_set_var_typed_value(requests->requestvb,
+ ASN_INTEGER, (u_char *) &buf.st_size
+ /* Pointer to the scalar's data */,
+ sizeof (buf.st_size)
+ /* The length of the data in bytes*/);
+ break;
+
+ default:
+ /*
+ we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+ return (SNMP_ERR_NOERROR);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_7/demo_module_7.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
+ */
+#ifndef demo_module_7_H
+#define demo_module_7_H
+
+/* function declarations */
+void init_demo_module_7(void);
+
+Netsnmp_Node_Handler get_filesize;
+Netsnmp_Node_Handler set_createContext;
+Netsnmp_Node_Handler set_removeContext;
+Netsnmp_Node_Handler get_test;
+
+#endif /* demo_module_7_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_7/get_filesize Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,16 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+/usr/bin/snmpget -m+SDK-DEMO6-MIB -v 3 -u myuser -n "/usr/sbin/snmpd" -l authNoPriv -A "mypassword" localhost .1.3.6.1.4.1.42.2.2.4.4.6.1.1.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_7/register_file Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,16 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+/usr/bin/snmpset -m+SDK-DEMO6-MIB -v 3 -u myuser -l authNoPriv -A "mypassword" localhost .1.3.6.1.4.1.42.2.2.4.4.6.1.2.0 s "/usr/sbin/snmpd"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_7/unregister_file Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,16 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+/usr/bin/snmpset -mALL -v 3 -u myuser -l authNoPriv -A "mypassword" localhost .1.3.6.1.4.1.42.2.2.4.4.6.1.3.0 s "/usr/sbin/snmpd"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_8/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,63 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# Use is subject to license terms.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+#
+#
+#
+# Makefile to generate demo_module_8.so
+#
+# usage:
+# setenv CC /usr/bin/cc (or correct path)
+# "make" : generate library for 64bit
+# "make ARCH=32" : generate library for 32bit
+# "make clean" : remove *.o , *.so
+#
+
+INSTALL_PATH=/usr
+ARCH=64
+#LDFLAGS_64=-g -m64 -I$(INSTALL_PATH)/include -I.
+#LDFLAGS_32=-g -I$(INSTALL_PATH)/include -I.
+#LDFLAGS=$(LDFLAGS_$(ARCH))
+
+OBJS1=demo_module_8.o me1LoadGroup.so
+TARGETS=demo_module_8
+LD=/usr/ccs/bin/ld
+
+CFLAGS=-I. `$(INSTALL_PATH)/bin/net-snmp-config-$(ARCH) --cflags`
+BUILDLIBS=`$(INSTALL_PATH)/bin/net-snmp-config-$(ARCH) --libs`
+BUILDAGENTLIBS=`$(INSTALL_PATH)/bin/net-snmp-config-$(ARCH) --agent-libs`
+
+# shared library flags (assumes gcc)
+#DLFLAGS=-fPIC -shared
+# shared library flags (assumes cc)
+DLFLAGS=-dy -G
+
+# compile subagent
+all: $(TARGETS)
+
+# link subagent object, shared library module, and agent libs
+# and output demo_module_8, the subagent.
+demo_module_8: $(OBJS1)
+ $(CC) -o demo_module_8 $(OBJS1) $(BUILDLIBS) $(BUILDAGENTLIBS)
+
+clean:
+ rm $(OBJS1) $(TARGETS)
+
+# compile module source, producing module object file
+# produce (-G) and load module shared object from module object file,
+# using dynamic linking (-dy)
+me1LoadGroup.so: me1LoadGroup.o Makefile
+ $(CC) $(CFLAGS) -c -o me1LoadGroup.o me1LoadGroup.c
+ $(LD) $(DLFLAGS) -o me1LoadGroup.so me1LoadGroup.o
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_8/README_demo_module_8 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,180 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+README for demo_module_8
+********************************************************************
+
+This code example creates an agentX subagent that calls a module that returns
+load averages. See the System Management Agent Developer's Guide for
+more information about creating a subagent.
+
+
+How to Build the demo_module_8 Code Example
+===========================================
+
+The demo_module_8 code example includes the following files, by default located
+in the directory /usr/demo/sma_snmp/demo_module_8.
+
+Files:
+
+o Makefile - Compiles the subagent and module source code
+o demo_module_8.c - Source code for agentX subagent
+o me1LoadGroup.c - Source code for module that returns load averages
+o me1LoadGroup.h - Header file for module
+o getme1LoadGroup - Script that executes snmpget requests on the OIDs defined
+ in the module
+o SDK-DEMO1-MIB.txt - MIB file
+
+
+To set up your build environment for the demo:
+
+1. Copy the demo code to a directory for which you have write permission.
+ For example:
+ % cp -R /usr/demo/sma_snmp/demo_module_8 /home/username/demo
+
+
+2. Create a lib directory that you can use to store shared object libraries
+ that you generate from demo code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/lib
+
+
+3. Create a mibs directory that you can use to store MIB files for the demo
+ code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/mibs
+
+
+4. Set the CC environment variable to the location of the C compiler to be
+ used.
+ For example, if you are using Sun ONE Studio:
+ % setenv CC /opt/SUNWspro/bin/cc
+
+
+5. Set your PATH environment variable to include the appropriate paths, so that
+ needed binaries can be found during the compilation process.
+ For example, in the csh:
+
+ % setenv PATH .:/usr/bin:$PATH
+
+
+
+
+To build the example:
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_8
+
+
+2. Use the make command to generate object files.
+
+ If you are running the 64-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make
+
+ If you are running the 32-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+ If you are running the Solaris x86 kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+
+3. Copy the module shared library object to the lib directory you created.
+ For example:
+
+ % cp me1LoadGroup.so /home/username/demo/lib
+
+
+4. This example uses the SDK-DEMO1-MIB.txt file from demo_module_1. If you
+ have not already done so, copy this file to the mibs directory you created
+ for the demos.
+ For example:
+
+ % cp SDK-DEMO1-MIB.txt /home/username/demo/mibs
+
+
+5. As root, edit the /etc/sma/snmp/snmpd.conf file by adding the following
+ line to enable AgentX master agent support. This causes agentX to be
+ started when the SMA agent starts. Make sure that there are no dlmod
+ statements for the module:
+
+ master agentx
+
+
+6. As root, start the SMA snmp agent. If the agent is already running, stop
+ and restart it.
+ For example:
+
+ # /etc/init.d/init.sma stop
+ # /usr/sbin/snmpd -Dagentx
+
+ The optional -Dagentx argument sends debugging statements from agentX to
+ the /var/log/snmpd.log file. You can also use the -L and -f options to
+ send debugging statements to the screen instead.
+
+
+7. As root, set the LD_LIBRARY_PATH environment variable.
+ For example, if you are using the C shell:
+
+ In the 64-bit Solaris kernel:
+ # LD_LIBRARY_PATH=/home/username/demo/lib:/usr/lib/sparcv9:/usr/openwin/lib
+ # export LD_LIBRARY_PATH
+
+ In the 32-bit or x86 Solaris kernel:
+ # LD_LIBRARY_PATH=/home/username/demo/lib:/usr/lib:/usr/openwin/lib
+ # export LD_LIBRARY_PATH
+
+
+8. As root, change to the directory where the demo_module_8 subagent is
+ located and start the subagent in the background. For example:
+
+ # cd /home/username/demo/demo_module_8
+ # ./demo_module_8 &
+
+ The demon listens for agentX requests from the SMA agent.
+
+
+
+Testing the Example Subagent
+============================
+
+1. Set your MIBS and MIBDIRS environment variables to
+ include the appropriate paths.
+ For example, in the csh:
+
+ % setenv MIBDIRS .:/home/username/demo/mibs:/etc/sma/snmp/mibs
+ % setenv MIBS +SDK-DEMO1-MIB
+
+ Note that step 1 is not required, but it enables snmpget to access the MIB
+ to provide variable names instead of OIDs in its output in Step 2.
+
+
+2. Run the getme1LoadGroup script to execute snmpget commands against
+ the OIDs defined in the module:
+
+ % getme1LoadGroup
+
+ SDK-DEMO1-MIB::me1SystemLoadAvg1min.0 = STRING: 3.906250e-02 Jobs
+ SDK-DEMO1-MIB::me1SystemLoadAvg5min.0 = STRING: 2.734375e-02 Jobs
+ SDK-DEMO1-MIB::me1SystemLoadAvg15min.0 = STRING: 3.906250e-02 Jobs
+
+
+3. View the /var/log/snmpd.log file. Near the beginning of the log file,
+ you should see output similar to the following:
+
+ agentx/subagent: init_subagent sess 0012bfd8
+ Turning on AgentX master support.
+ agentx/master: initializing...
+ agentx/master: initializing... DONE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_8/SDK-DEMO1-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,241 @@
+--
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are
+-- subject
+-- to the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun,
+-- Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+
+
+----------------------------------------------------------
+-- Systems Management Agent (SMA) SDK module DEMO-1 MIB
+----------------------------------------------------------
+
+SDK-DEMO1-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+ enterprises, MODULE-IDENTITY, OBJECT-TYPE, Counter64, Integer32, Unsigned32
+ FROM SNMPv2-SMI
+ OBJECT-GROUP
+ FROM SNMPv2-CONF
+ DisplayString
+ FROM SNMPv2-TC;
+
+sdkDemo1MIB MODULE-IDENTITY
+ LAST-UPDATED "0009181435Z"
+ ORGANIZATION "Sun Microsystems Inc."
+ CONTACT-INFO
+ " Sun Microsystems Inc
+ 4150 Network Circle
+ Santa Clara, CA 95054
+ e-mail: [email protected]"
+ DESCRIPTION
+ " SMA SDK MIB DEMO-1. This MIB will be used to demonstrate the
+ implementation of modules and various module features in SMA agent."
+ ::= { demo 1 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+management OBJECT IDENTIFIER ::= { products 2 }
+sma OBJECT IDENTIFIER ::= { management 4 }
+demo OBJECT IDENTIFIER ::= { sma 4 }
+
+--
+-- There are currently 2 Groups in the example.
+-- The "Load" group contains information about system load
+-- The "File" group contains information about some files on the system
+--
+
+me1LoadGroup OBJECT-GROUP
+ OBJECTS { me1SystemLoadAvg1min, me1SystemLoadAvg5min,
+ me1SystemLoadAvg15min }
+ STATUS current
+ DESCRIPTION
+ "Load related statistics."
+ ::= { sdkDemo1MIB 1 }
+
+me1FileGroup OBJECT-GROUP
+ OBJECTS { me1FileIndex, me1FileName, me1FileSize, me1FilePerm
+ }
+ STATUS current
+ DESCRIPTION
+ "File related statistics."
+ ::= { sdkDemo1MIB 2 }
+
+--
+-- Properties in the "Load" group
+--
+
+me1SystemLoadAvg1min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 1 minute."
+ ::= { me1LoadGroup 1 }
+
+me1SystemLoadAvg5min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 5 minutes."
+ ::= { me1LoadGroup 2 }
+
+me1SystemLoadAvg15min OBJECT-TYPE
+ SYNTAX DisplayString
+ UNITS "Jobs"
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Load average of the system over the last 15 minutes."
+ ::= { me1LoadGroup 3 }
+
+--
+-- Objects in the "File" group
+--
+
+me1FileTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF Me1FileEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Table containing information of some files on the system."
+ ::= { me1FileGroup 1 }
+
+me1FileEntry OBJECT-TYPE
+ SYNTAX Me1FileEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Information about one file on the system."
+ INDEX { me1FileIndex }
+ ::= { me1FileTable 1 }
+
+Me1FileEntry ::=
+ SEQUENCE {
+ me1FileIndex
+ Unsigned32,
+ me1FileName
+ DisplayString,
+ me1FileSize
+ Unsigned32,
+ me1FilePerm
+ DisplayString
+ }
+
+me1FileIndex OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Index of the file."
+ ::= { me1FileEntry 1 }
+
+me1FileName OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-create
+ STATUS current
+ DESCRIPTION
+ "Name of the file"
+ ::= { me1FileEntry 2 }
+
+me1FileSize OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Size of the file in kb"
+ ::= { me1FileEntry 3 }
+
+me1FilePerm OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Permissions on this file. example, 0755 "
+ ::= { me1FileEntry 4 }
+
+
+-- General table:
+
+
+me1ContactInfoTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF Me1ContactInfoEntry
+ MAX-ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "The contact information table."
+ ::= { sdkDemo1MIB 3 }
+
+
+
+me1ContactInfoEntry OBJECT-TYPE
+ SYNTAX Me1ContactInfoEntry
+ MAX-ACCESS not-accessible
+ STATUS mandatory
+ DESCRIPTION
+ "An entry in the contact info table."
+ INDEX { me1FloorNumber, me1RoomNumber }
+ ::= { me1ContactInfoTable 1 }
+
+
+
+Me1ContactInfoEntry ::=
+ SEQUENCE {
+ me1FloorNumber
+ INTEGER,
+ me1RoomNumber
+ INTEGER,
+ me1Name
+ DisplayString,
+ me1Extension
+ INTEGER
+ }
+
+me1FloorNumber OBJECT-TYPE
+ SYNTAX INTEGER (1..3)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "This object combines with me1RoomNumber are
+ the identifier of the table."
+ ::= { me1ContactInfoEntry 1 }
+
+
+me1RoomNumber OBJECT-TYPE
+ SYNTAX INTEGER (1..100)
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "This object combines with me1FloorNumber are
+ the identifier of the table."
+ ::= { me1ContactInfoEntry 2 }
+
+me1Name OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " The person loacted in the room."
+ ::= { me1ContactInfoEntry 3 }
+
+me1Extension OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "The phone number of the office."
+ ::= { me1ContactInfoEntry 4 }
+
+
+END
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_8/demo_module_8.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <signal.h>
+
+#include <me1LoadGroup.h>
+
+static int keep_running;
+
+RETSIGTYPE
+stop_server(int a)
+{
+ keep_running = 0;
+}
+
+int
+main(int argc, char **argv)
+{
+ int agentx_subagent = 1;
+ //Change to make an SNMP master agent
+
+ /* print log errors to stderr */
+ snmp_enable_stderrlog();
+
+ /* we're an agentx subagent? */
+ if (agentx_subagent) {
+ /*
+ * This is an agentx client. Specify 0 for
+ * NETSNMP_DS_AGENT_ROLE if the agent is master agent.
+ * Specify 1 for NETSNMP_DS_AGENT_ROLE, if the agent is a
+ * client.
+ */
+ netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_ROLE, 1);
+ DEBUGMSGTL(("demo_module_8",
+ "NETSNMP_DS_APPLICATION_ID = %s:\n",
+ NETSNMP_DS_APPLICATION_ID));
+ DEBUGMSGTL(("demo_module_8", "NETSNMP_DS_AGENT_ROLE = %s:\n",
+ NETSNMP_DS_AGENT_ROLE));
+ }
+ /*
+ * Initializes the embedded agent. Call this function before the
+ * init_snmp() call. The string name specifies which .conf file to
+ * read when init_snmp() is called later.
+ */
+ init_agent("demo_module_8");
+ DEBUGMSGTL(("demo_module_8", "CALLING init_agent\n"));
+
+ /* initialize mib code here */
+
+ /* mib code: init_me1LoadGroup from me1LoadGroup.c */
+ init_me1LoadGroup();
+
+ /*
+ * Initializes the SNMP library, which causes the agent to read your
+ * application's configuration files. The agent first tries to read
+ * the configuration files named by the string passed as an argument.
+ * You might use this to configure access control, for example.
+ */
+ init_snmp("demo_module_8");
+
+ /*
+ * Initializes the master agent and causes it to listen for SNMP
+ * requests on its default UDP port of 161. Open the port to listen
+ * (defaults to udp: 161)
+ */
+ if (!agentx_subagent)
+ init_master_agent();
+
+ /* In case we get a request to stop (kill -TERM or kill -INT) */
+ keep_running = 1;
+ signal(SIGTERM, stop_server);
+ signal(SIGINT, stop_server);
+
+ /*
+ * The main loop. If you use select(), see snmp_select_info() in
+ * snmp_api(3). This checks for packets arriving on the SNMP port and
+ * processes them if some are found. If block is non zero, the
+ * function call blocks until a packet arrives or an alarm must be
+ * run (see snmp_alarm(3)).
+ *
+ * The return value from this function is a positive integer if packets
+ * were processed, zero if an alarm occurre, and -1 if an error
+ * occured.
+ */
+
+ while (keep_running) {
+ /* OR */
+ agent_check_and_process(1); /* 0 == don't block */
+ }
+ /*
+ * Shuts down the agent, saving any needed persistent storage.
+ */
+ snmp_shutdown("demo_module_8");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_8/getme1LoadGroup Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,19 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+/usr/bin/snmpget -m+SDK-DEMO1-MIB -v 2c -c public localhost .1.3.6.1.4.1.42.2.2.4.4.1.1.1.0
+/usr/bin/snmpget -m+SDK-DEMO1-MIB -v 2c -c public localhost .1.3.6.1.4.1.42.2.2.4.4.1.1.2.0
+/usr/bin/snmpget -m+SDK-DEMO1-MIB -v 2c -c public localhost .1.3.6.1.4.1.42.2.2.4.4.1.1.3.0
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_8/me1LoadGroup.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "me1LoadGroup.h"
+#include <sys/loadavg.h>
+
+char *
+getLoadAvg(int timeAverage)
+{
+ double loadavg[3];
+ char *data = malloc(30 * sizeof (char));
+ int numOfSamples = getloadavg(loadavg, 3);
+ sprintf(data, "%e", loadavg[timeAverage]);
+ return (data);
+}
+
+/* Initializes the me1LoadGroup module */
+void
+init_me1LoadGroup(void)
+{
+ static oid me1SystemLoadAvg15min_oid[] =
+ { 1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 1, 1, 3, 0 };
+ static oid me1SystemLoadAvg1min_oid[] =
+ {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 1, 1, 1, 0 };
+ static oid me1SystemLoadAvg5min_oid[] =
+ {1, 3, 6, 1, 4, 1, 42, 2, 2, 4, 4, 1, 1, 2, 0 };
+
+ DEBUGMSGTL(("me1LoadGroup", "Initializing\n"));
+
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("me1SystemLoadAvg15min",
+ get_me1SystemLoadAvg15min,
+ me1SystemLoadAvg15min_oid,
+ OID_LENGTH(me1SystemLoadAvg15min_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("me1SystemLoadAvg1min",
+ get_me1SystemLoadAvg1min,
+ me1SystemLoadAvg1min_oid,
+ OID_LENGTH(me1SystemLoadAvg1min_oid),
+ HANDLER_CAN_RONLY));
+ netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+ ("me1SystemLoadAvg5min",
+ get_me1SystemLoadAvg5min,
+ me1SystemLoadAvg5min_oid,
+ OID_LENGTH(me1SystemLoadAvg5min_oid),
+ HANDLER_CAN_RONLY));
+}
+
+int
+get_me1SystemLoadAvg15min(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+ char *data = getLoadAvg(LOADAVG_15MIN);
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ /*
+ * Get data from data collection routine, Hardcoded here for
+ * testing purpose
+ */
+ snmp_set_var_typed_value(requests->requestvb,
+ ASN_OCTET_STR, (u_char *) data, strlen(data));
+ free(data);
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+int
+get_me1SystemLoadAvg1min(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ char *data = getLoadAvg(LOADAVG_1MIN);
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ snmp_set_var_typed_value(requests->requestvb,
+ ASN_OCTET_STR, (u_char *) data, strlen(data));
+ free(data);
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
+int
+get_me1SystemLoadAvg5min(netsnmp_mib_handler * handler,
+ netsnmp_handler_registration * reginfo,
+ netsnmp_agent_request_info * reqinfo,
+ netsnmp_request_info * requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so we
+ * don't need to loop over a list of requests; we'll only get one.
+ */
+
+ char *data = getLoadAvg(LOADAVG_5MIN);
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ snmp_set_var_typed_value(requests->requestvb,
+ ASN_OCTET_STR, (u_char *) data, strlen(data));
+ free(data);
+ break;
+
+
+ default:
+ /* we should never get here, so this is a really bad error */
+ return (SNMP_ERR_GENERR);
+ }
+
+ return (SNMP_ERR_NOERROR);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_8/me1LoadGroup.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.1.1.1 2003/03/26 18:12:30 pcarroll Exp $
+ */
+
+#ifndef ME1LOADGROUP_H
+#define ME1LOADGROUP_H
+
+/* function declarations */
+void init_me1LoadGroup(void);
+Netsnmp_Node_Handler get_me1SystemLoadAvg15min;
+Netsnmp_Node_Handler get_me1SystemLoadAvg1min;
+Netsnmp_Node_Handler get_me1SystemLoadAvg5min;
+
+#endif /* ME1LOADGROUP_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_9/Makefile Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+# Use is subject to license terms.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+#
+#
+# Makefile to generate demo_module_9.so
+#
+# usage:
+# "make" : generate library for 64bit / sparc
+# "make ARCH=32" : generate library for 32bit / sparc
+# "make ARCH=32 MACH=x86" : generate library for 32bit / x86
+# "make clean" : remove *.o , *.so
+#
+
+
+ARCH=64
+LDFLAGS_64=-g -m64 -I.
+LDFLAGS_32=-g -I.
+LDFLAGS=$(LDFLAGS_$(ARCH))
+
+LDLIBS=
+
+PROG= demo_module_9.so
+SRCS= demo_module_9.c
+OBJS = $(SRCS:.c=.o)
+
+all:$(PROG)
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) $(LDLIBS) -G -o $@ $(OBJS)
+.c.o:
+ $(CC) $(LDFLAGS) -g -o $@ -c $<
+
+clean:
+ rm -f *.o *.so
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_9/README_demo_module_9 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,210 @@
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+
+README for demo_module_9
+***********************************************************************
+
+This code example demonstrates how to implement objects for long running
+data collection. These objects are implemented in a way that allows the
+agent to respond to other requests while external data collection occurs.
+When data collection is complete, the agent can reply to the request.
+
+This example uses the following features of SMA:
+
+- Setting the delegated member of the requests structure to 1 to indicate to
+ the agent that this request should be delayed. The agent queues this request
+ to be handled later and then is available to handle other requests. The
+ agent is not blocked by this request.
+
+- Registering an SNMP alarm to update the results at a later time.
+
+
+
+
+How to Build the demo_module_9 Code Example
+===========================================
+
+The demo_module_9 code example includes the following files, by default located
+in the directory /usr/demo/sma_snmp/demo_module_9.
+
+Files:
+
+demo_module_9.c - module source code
+demo_module_9.h - module header file
+Makefile - makefile to build the demo_module_9.so shared library file
+SDK-DEMO9-MIB.txt - MIB file
+get_demo_module_9 - Script that executes snmpget on the delayed OID
+set_demo_module_9 - Script that executes snmpset on the delayed OID
+walk_demo_module_9 - Script that executes snmpwalk on the SYSTEM table
+
+
+To set up your build environment for the demo:
+
+1. Copy the demo code to a directory for which you have write permission.
+ For example:
+ % cp -R /usr/demo/sma_snmp/demo_module_9 /home/username/demo
+
+
+2. Create a lib directory that you can use to store shared object libraries
+ that you generate from demo code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/lib
+
+
+3. Create a mibs directory that you can use to store MIB files for the demo
+ code examples, if you have not already done so.
+ For example:
+ % mkdir /home/username/demo/mibs
+
+
+4. Set the CC environment variable to the location of the C compiler to be
+ used. For example, if you are using Sun ONE Studio:
+ % setenv CC /opt/SUNWspro/bin/cc
+
+
+5. Set your PATH environment variable to include the appropriate paths, so that
+ needed binaries can be found during the compilation process.
+ For example, in the csh:
+
+ % setenv PATH .:/usr/bin:$PATH
+
+
+To build the example:
+
+1. Change to the directory where you copied the demo module files.
+ For example:
+
+ % cd /home/username/demo/demo_module_9
+
+
+2. Use the make command to generate object files.
+
+ If you are running the 64-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make
+
+ If you are running the 32-bit SPARC Solaris kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+ If you are running the Solaris x86 kernel, type:
+ % /usr/ccs/bin/make ARCH=32
+
+
+3. Copy the module shared library object to the lib directory you created.
+ For example:
+
+ % cp demo_module_9.so /home/username/demo/lib
+
+
+4. Copy SDK-DEMO9-MIB.txt to the mibs directory you created for the demos.
+ For example:
+
+ % cp SDK-DEMO9-MIB.txt /home/username/demo/mibs
+
+
+
+
+Setting Up Agent to Run the demo_module_9 Module
+=================================================
+
+1. As root, edit the agent's configuration file /etc/sma/snmp/snmpd.conf,
+ and insert a dlmod statement for the module. This statement enables the
+ agent to load the module.
+ For example:
+
+ dlmod demo_module_9 /home/username/demo/lib/demo_module_9.so
+
+
+2. As root, start the SMA snmp agent. If the agent is already running, stop
+ and restart it in debug mode.
+ For example:
+
+ # /etc/init.d/init.sma stop
+ # /usr/sbin/snmpd -Ddemo_module_9
+
+ The optional -Ddemo_module_9 argument sends debugging statements from
+ demo_module_9 to the /var/log/snmpd.log file. You can also use the -L
+ and -f options to send debugging statements to the screen instead.
+
+
+
+
+Testing the demo_module_9 Module
+================================
+
+1. Run the get_demo_module_9 script to get the default value of
+ the my_delayed_oid object, which is 1 second.
+ For example:
+
+ % get_demo_module_9
+ SDK-DEMO9-MIB::delayedInstanceOid.0 = INTEGER: 1
+
+
+2. Run the set_demo_module_9 script to set the value of the
+ my_delayed_oid object to 10 seconds.
+ For example:
+
+ % set_demo_module_9
+ SDK-DEMO9-MIB::delayedInstanceOid.0 = INTEGER: 10
+
+ The set_demo_module_9 script specifies a time-out value of three
+ seconds (-t 3). The module uses the my_delayed_oid value as the time
+ interval at which an SNMP alarm is sent to the module.
+
+ SET requests through this object take longer, since the delay is applied
+ to each internal transaction phase, which could result in delays of up to
+ 4 times the value of this object.
+
+ For example, initially, the default my_delayed_oid value is 1 second.
+ Therefore, the script uses a 3 second time-out value on the snmpset
+ command line.
+
+
+*******************************************************************************
+* NOTE: You must comment out the following line in the **
+* /etc/sma/snmp/snmpd.conf file **
+* rwcommunity private localhost .1.3.6.1.4.1.42.2.15 **
+* and UNCOMMENT the line **
+* rwcommunity private **
+* Otherwise write access would be restricted to the .1.3.6.1.4.1.42.2.15 OID **
+* **
+* When you are done with this demo you should revert your changes for **
+* security reasons **
+*******************************************************************************
+
+
+
+3 Open two terminal windows so you can run two scripts at the same time, as
+ follows:
+
+ In the first window, run the get_demo_module_9 script:
+ % get_demo_module_9
+
+
+ In the second window, run the walk_demo_module_9 script:
+ % walk_demo_module_9
+
+ SNMPv2-MIB::sysDescr.0 = STRING: SunOS myhost 5.10 s10_35 sun4u
+ SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-TC::solaris
+ DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (497128) 1:22:51.28
+ SNMPv2-MIB::sysContact.0 = STRING: "Administrator's Name"
+ SNMPv2-MIB::sysName.0 = STRING: myhost
+ SNMPv2-MIB::sysLocation.0 = STRING: My Town
+ SNMPv2-MIB::sysORLastChange.0 = Timeticks: (8) 0:00:00.08
+ SNMPv2-MIB::sysORID.1 = OID: IF-MIB::ifMIB
+
+
+ This example demonstrates that the agent is not blocked and does respond to
+ the snmpwalk request, while the snmpget request executed in the first window
+ is still pending.
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_9/SDK-DEMO9-MIB.txt Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,90 @@
+
+--
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- U.S. Government Rights - Commercial software. Government users are subject to
+-- the Sun Microsystems, Inc. standard license agreement and applicable
+-- provisions of the FAR and its supplements.
+--
+--
+-- This distribution may include materials developed by third parties. Sun, Sun
+-- Microsystems, the Sun logo and Solaris are trademarks or registered
+-- trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+--
+--
+
+------------------------------------------------------------------------
+-- Systems Management Agent (SMA) SDK module DEMO-9 MIB
+------------------------------------------------------------------------
+
+SDK-DEMO9-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+ enterprises, MODULE-IDENTITY, OBJECT-TYPE, Counter64, Integer32, Unsigned32
+ FROM SNMPv2-SMI
+ OBJECT-GROUP
+ FROM SNMPv2-CONF
+ DisplayString
+ FROM SNMPv2-TC;
+
+sdkDemo9MIB MODULE-IDENTITY
+ LAST-UPDATED "0009181435Z"
+ ORGANIZATION "Sun Microsystems Inc."
+ CONTACT-INFO
+ " Sun Microsystems Inc
+ 4150 Network Circle
+ Santa Clara, CA 95054
+ e-mail: [email protected]"
+ DESCRIPTION
+ " SMA SDK MIB DEMO-9. This MIB will be used to demonstrate the
+ implementation of modules and various module features in SMA agent."
+ ::= { demo 9 }
+
+sun OBJECT IDENTIFIER ::= { enterprises 42 }
+products OBJECT IDENTIFIER ::= { sun 2 }
+management OBJECT IDENTIFIER ::= { products 2 }
+sma OBJECT IDENTIFIER ::= { management 4 }
+demo OBJECT IDENTIFIER ::= { sma 4 }
+
+--
+-- The "Multi-instance" group contains information about filesize for
+-- using SNMPv3 context strings.
+--
+
+scalarExampleGroup OBJECT-GROUP
+ OBJECTS { delayedInstanceOid }
+ STATUS current
+ DESCRIPTION
+ "Simple scalar integer values for examples."
+ ::= { sdkDemo9MIB 1 }
+
+--
+-- Properties in the "scalarExampleGroup" group
+--
+
+
+delayedInstanceOid OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "This is a simple object which is a basic integer. It's value
+ indicates the number of seconds that the agent will take in
+ responding to requests of this object. This is implemented
+ in a way which will allow the agent to keep responding to
+ other requests while access to this object is blocked. It is
+ writable, and changing it's value will change the amount of
+ time the agent will effectively wait for before returning a
+ response when this object is manipulated. Note that SET
+ requests through this object will take longer, since the
+ delay is applied to each internal transaction phase, which
+ could result in delays of up to 4 times the value of this
+ object.
+
+ This example object is implemented in the
+ demo_module_9 example module."
+ DEFVAL { 1 }
+ ::= { scalarExampleGroup 1 }
+
+
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_9/demo_module_9.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+/* @example demo_module_9.c
+ *
+ *
+ * This example demonstrates how to implement objects that normally would
+ * block the agent as it waits for external events in such a way that the
+ * agent can continue responding to other requests while this implementation waits.
+ *
+ * This example uses the following features of SMA:
+ *
+ * - Use of the instance helper, which registers an exact OID such that GENEXT requests
+ * are handled entirely by the helper.
+ *
+ * - Setting the delegated member of the requests structure to 1 to indicate to the
+ * agent that this request should be delayed. The agent queues this request
+ * to be handled later and then is available to handle other requests. The
+ * agent is not blocked by this request.
+ *
+ * - Registering an SNMP alarm to update the results at a later time.
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "demo_module_9.h"
+
+// default delay time for SNMP alarm
+static u_long delay_time = 1;
+
+void
+init_demo_module_9(void)
+{
+ static oid my_delayed_oid[] =
+ { 1, 3, 6, 1, 4, 1,42, 2, 2, 4, 4, 9, 1, 1, 0 };
+
+ /*
+ * Creates a registration handler, my_test, and passes
+ * the pointer it returns to the netsnmp_register_instance
+ * helper function.
+ */
+ netsnmp_handler_registration *my_test;
+ DEBUGMSGTL(("demo_module_9", "Initializing\n"));
+ my_test =
+ netsnmp_create_handler_registration("delayed_instance_example",
+ delayed_instance_handler,
+ my_delayed_oid,
+ OID_LENGTH(my_delayed_oid),
+ HANDLER_CAN_RWRITE);
+
+ netsnmp_register_instance(my_test);
+}
+
+#define DELAYED_INSTANCE_SET_NAME "test_delayed"
+
+int
+delayed_instance_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /*
+ This handler is called to handle SNMP GET and SNMP SET
+ requests for the my_delayed_oid object. If it is called to
+ handle SNMP GET requests, the handler does not need to
+ handle a GETNEXT if it is registered as an instance handler.
+ Instance handlers only deliver one request at a time, so we
+ do not need to loop over a list of requests. */
+
+ DEBUGMSGTL(("demo_module_9", "Handler got request, mode = %d:\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * here we merely mention that we'll answer this request
+ * later. we don't actually care about the mode type in this
+ * example, but for certain cases you may, so I'll leave in the
+ * otherwise useless switch and case statements
+ */
+
+ default:
+ /*
+ * Mark this variable as something that cannot be handled now
+ * by setting the delegated member of the requests structure
+ * to 1. The agent queues the request to be handled at a later
+ * time and continues responding to other client requests.
+ *
+ */
+ requests->delegated = 1;
+ DEBUGMSGTL(("demo_module_9", "Delegated is %d\n",
+ requests->delegated));
+
+ /*
+ * Register an alarm to update the results at a later
+ * time. Normally, we might have to query something else
+ * (like an external request sent to a different network
+ * or system socket, etc), but for this example we'll do
+ * something really simply and just insert an alarm for a
+ * certain period of time.
+ */
+ DEBUGMSGTL(("demo_module_9", "Delay is %d\n",
+ delay_time));
+ snmp_alarm_register(delay_time, /* seconds */
+ 0, /* dont repeat. */
+ return_delayed_response, /* the function
+ * to call */
+ /*
+ * Create a "cache" of useful
+ * information that can be retrieved
+ * at a later time. This argument is
+ * passed back to the module in the callback
+ * function for an alarm.
+ */
+ (void *)
+ netsnmp_create_delegated_cache(handler,
+ reginfo,
+ reqinfo,
+ requests,
+ NULL));
+ break;
+
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+void
+return_delayed_response(unsigned int clientreg, void *clientarg)
+{
+ /*
+ * Extract the cache from the passed argument.
+ */
+ netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) clientarg;
+
+ netsnmp_request_info *requests;
+ netsnmp_agent_request_info *reqinfo;
+ u_long *delay_time_cache = NULL;
+
+ /*
+ * Make sure the cache created earlier is still
+ * valid. If not, the request timed out for some reason and we
+ * do not need to keep processing things. Should never happen, but
+ * this double checks.
+ */
+ cache = netsnmp_handler_check_cache(cache);
+
+ if (!cache) {
+ snmp_log(LOG_ERR, "illegal call to return delayed response\n");
+ return;
+ }
+
+ /*
+ * Re-establish the previous pointers,
+ */
+ reqinfo = cache->reqinfo;
+ requests = cache->requests;
+
+ DEBUGMSGTL(("demo_module_9",
+ "continuing delayed request, mode = %d\n",
+ cache->reqinfo->mode));
+
+
+ /*
+ * Set delegated to zero to indicate that the request is no longer
+ * delegated and answer the query.
+ */
+ requests->delegated = 0;
+
+ DEBUGMSGTL(("demo_module_9", "Set delegated to %d\n",
+ requests->delegated));
+
+
+ switch (cache->reqinfo->mode) {
+ /*
+ * Registering as an instance means we do not need to deal with
+ * GETNEXT processing, so we do not handle it here at all.
+ *
+ * However, since the instance handler already reset the mode
+ * back to GETNEXT from the GET mode, we need to do the
+ * same thing in both cases.
+ *
+ */
+
+ case MODE_GET:
+ case MODE_GETNEXT:
+ /*
+ * Return the current delay time
+ */
+ DEBUGMSGTL(("demo_module_9", "Got to MODE_GETNEXT\n"));
+
+ snmp_set_var_typed_value(cache->requests->requestvb,
+ ASN_INTEGER,
+ (u_char *) & delay_time,
+ sizeof(delay_time));
+ DEBUGMSGTL(("demo_module_9",
+ "Got delay time = %d\n",
+ delay_time));
+ break;
+
+ case MODE_SET_RESERVE1:
+ DEBUGMSGTL(("demo_module_9", "Got to MODE_SET_RESERVE1\n"));
+
+ /*
+ * check type
+ */
+ if (requests->requestvb->type != ASN_INTEGER) {
+ /*
+ * If not an integer, return SNMP error.
+ */
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_WRONGTYPE);
+ /*
+ * Free cache. It is no longer needed.
+ */
+ netsnmp_free_delegated_cache(cache);
+ return;
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ DEBUGMSGTL(("demo_module_9", "Got to MODE_SET_RESERVE2\n"));
+ /*
+ * Store old value for UNDO support in the future.
+ */
+ memdup((u_char **) & delay_time_cache,
+ (u_char *) & delay_time, sizeof(delay_time));
+
+ /*
+ * malloc failed
+ */
+ if (delay_time_cache == NULL) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ netsnmp_free_delegated_cache(cache);
+ return;
+ }
+
+ /*
+ * Add our temporary information to the request itself.
+ * This is then retrivable later. The free function
+ * passed auto-frees it when the request is later
+ * deleted.
+ */
+ netsnmp_request_add_list_data(requests,
+ netsnmp_create_data_list
+ (DELAYED_INSTANCE_SET_NAME,
+ delay_time_cache, free));
+ break;
+
+ case MODE_SET_ACTION:
+ DEBUGMSGTL(("demo_module_9", "Got to MODE_SET_ACTION\n"));
+ /*
+ * Update current value.
+ */
+ delay_time = *(requests->requestvb->val.integer);
+ DEBUGMSGTL(("demo_module_9", "updated delay_time -> %d\n",
+ delay_time));
+ break;
+
+ case MODE_SET_UNDO:
+ DEBUGMSGTL(("demo_module_9", "Got to MODE_SET_UNDO\n"));
+
+ /*
+ * A failure occurred. Reset to the
+ * previously value by extracting the previosuly
+ * stored information from the request.
+ */
+ delay_time =
+ *((u_long *) netsnmp_request_get_list_data(requests,
+ DELAYED_INSTANCE_SET_NAME));
+ break;
+
+ case MODE_SET_COMMIT:
+ case MODE_SET_FREE:
+ DEBUGMSGTL(("demo_module_9", "Got to MODE_SET_UNDO\n"));
+ /*
+ * The only thing to do here is free the old memdup'ed
+ * value, but it's auto-freed by the datalist recovery, so
+ * we don't have anything to actually do here
+ */
+ break;
+ }
+
+ /*
+ * free the information cache
+ */
+ netsnmp_free_delegated_cache(cache);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_9/demo_module_9.h Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ */
+
+Netsnmp_Node_Handler delayed_instance_handler;
+void init_demo_module_9(void);
+SNMPAlarmCallback return_delayed_response;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_9/get_demo_module_9 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,17 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+# command to "get" the delayed_oid value.
+
+/usr/bin/snmpget -m+SDK-DEMO9-MIB -v 1 -t 15 -c public localhost .1.3.6.1.4.1.42.2.2.4.4.9.1.1.0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_9/set_demo_module_9 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,17 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+# command to "set" the delayed_oid value to 10.
+
+/usr/bin/snmpset -m+SDK-DEMO9-MIB -v 1 -c private -t 3 localhost .1.3.6.1.4.1.42.2.2.4.4.9.1.1.0 i 10
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sdk/demo/demo_module_9/walk_demo_module_9 Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,18 @@
+#!/bin/csh
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# U.S. Government Rights - Commercial software. Government users are subject
+# to the Sun Microsystems, Inc. standard license agreement and applicable
+# provisions of the FAR and its supplements.
+#
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+#command to walk to SYSTEM table
+
+/usr/bin/snmpwalk -mALL -v 1 -c public localhost system
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/sma_buildrev.c Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,189 @@
+/* This program writes the SMA build version and build date to standard output.
+ *
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * U.S. Government Rights - Commercial software. Government users are subject
+ * to the Sun Microsystems, Inc. standard license agreement and applicable
+ * provisions of the FAR and its supplements.
+ *
+ *
+ * This distribution may include materials developed by third parties. Sun,
+ * Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ *
+ * $Log: sma_buildrev.c,v $
+ * Revision 1.49 2004/04/12 19:25:15 rr144420
+ * 9999999 - Build 51
+ *
+ * Revision 1.48 2004/03/11 12:47:45 rr144420
+ * 9999999 - Build 50
+ *
+ * Revision 1.47 2004/03/09 18:02:13 rr144420
+ * 9999999 - Build 49
+ *
+ * Revision 1.46 2004/03/02 12:31:51 rr144420
+ * 9999999 - Build 48
+ *
+ * Revision 1.45 2004/02/25 17:57:47 rr144420
+ * 9999999 - Build 47
+ *
+ * Revision 1.44 2004/02/17 13:20:31 rr144420
+ * 9999999 - Build 46
+ *
+ * Revision 1.43 2004/02/06 20:36:51 rr144420
+ * 9999999 - Build 45
+ *
+ * Revision 1.42 2004/01/29 14:23:31 rr144420
+ * 9999999 - Build 44
+ *
+ * Revision 1.41 2004/01/22 19:33:00 rr144420
+ * 9999999 - Build 43
+ *
+ * Revision 1.40 2004/01/15 18:18:10 rr144420
+ * 9999999 - Build 42
+ *
+ * Revision 1.39 2004/01/12 18:59:23 rr144420
+ * 9999999 - Build 41
+ *
+ * Revision 1.38 2004/01/09 14:46:22 rr144420
+ * 9999999 - Build 40
+ *
+ * Revision 1.37 2004/01/06 17:01:26 rr144420
+ * 9999999 - Build 39
+ *
+ * Revision 1.36 2004/01/05 18:09:03 rr144420
+ * 9999999 - Build 38
+ *
+ * Revision 1.35 2003/12/24 18:44:35 rr144420
+ * 9999999 - Build 37
+ *
+ * Revision 1.34 2003/12/23 16:38:14 rr144420
+ * 9999999 - Build 36
+ *
+ * Revision 1.33 2003/12/18 20:12:53 rr144420
+ * 9999999 - Build 35
+ *
+ * Revision 1.32 2003/12/15 14:59:29 rr144420
+ * 9999999 - Build 34
+ *
+ * Revision 1.31 2003/12/08 13:15:41 rr144420
+ * 9999999 - Build 33
+ *
+ * Revision 1.30 2003/12/01 13:54:58 rr144420
+ * 9999999 - Build 32
+ *
+ * Revision 1.29 2003/11/24 14:20:54 rr144420
+ * 9999999 - Build 31
+ *
+ * Revision 1.28 2003/11/17 13:40:43 rr144420
+ * 9999999 - Build 30
+ *
+ * Revision 1.27 2003/11/12 13:37:18 rr144420
+ * 9999999 - Build 29
+ *
+ * Revision 1.26 2003/11/10 14:10:57 rr144420
+ * 9999999 - Build 28
+ *
+ * Revision 1.25 2003/11/04 16:35:41 rr144420
+ * 9999999 - Build 27
+ *
+ * Revision 1.24 2003/10/27 13:41:17 rr144420
+ * 9999999 - Build 26
+ *
+ * Revision 1.23 2003/10/20 11:47:02 rr144420
+ * 9999999 - Build 25
+ *
+ * Revision 1.22 2003/09/29 12:07:53 rr144420
+ * 9999999 - Build 22
+ *
+ * Revision 1.21 2003/09/22 12:01:15 rr144420
+ * 9999999 - Build 21
+ *
+ * Revision 1.20 2003/09/19 17:08:41 rr144420
+ * 9999999 - Build 20
+ *
+ * Revision 1.19 2003/09/19 11:25:15 rr144420
+ * 9999999 - Build 19
+ *
+ * Revision 1.18 2003/09/18 11:59:46 rr144420
+ * 9999999 - Build 18
+ *
+ * Revision 1.17 2003/09/17 11:19:15 rr144420
+ * 9999999 - Build 17
+ *
+ * Revision 1.16 2003/09/15 12:09:08 rr144420
+ * 9999999 - Build 16
+ *
+ * Revision 1.15 2003/09/12 14:18:30 rr144420
+ * 9999999 - Build 15
+ *
+ * Revision 1.14 2003/09/10 12:04:22 rr144420
+ * 9999999 - Build 14
+ *
+ * Revision 1.13 2003/09/08 12:03:37 rr144420
+ * 9999999 - Build 13
+ *
+ * Revision 1.12 2003/09/03 16:12:42 rr144420
+ * 9999999 - Build 12
+ *
+ * Revision 1.11 2003/09/01 14:43:33 rr144420
+ * 9999999 - Build 11
+ *
+ * Revision 1.10 2003/08/25 12:34:24 rr144420
+ * 9999999 - Build 10
+ *
+ * Revision 1.9 2003/08/21 14:41:58 rr144420
+ * 4908816 - further makefile changes to install into correct lib
+ *
+ * Revision 1.8 2003/08/18 12:36:09 rr144420
+ * 9999999 - Build 09
+ *
+ * Revision 1.7 2003/08/11 20:06:33 rr144420
+ * Build 8
+ *
+ * Revision 1.6 2003/08/10 21:34:59 rr144420
+ * Build 7
+ *
+ * Revision 1.5 2003/08/06 14:46:40 rr144420
+ * Corrected build 6
+ *
+ * Revision 1.4 2003/08/05 20:18:46 rr144420
+ * Build 6
+ *
+ * Revision 1.3 2003/08/04 14:11:45 rr144420
+ * Build 5
+ *
+ * Revision 1.2 2003/07/28 20:16:06 rr144420
+ * Build 4
+ *
+ * Revision 1.1 2003/07/23 16:06:35 rr144420
+ * Build 3
+ *
+ * Revision 1.5 2003/07/15 14:06:09 rr144420
+ * Build 2
+ *
+ * Revision 1.4 2003/07/08 15:50:52 rr144420
+ * Tuesday 7/8 build - added --with-mib-modules to autobuild as requested by Hanwu
+ *
+ * Revision 1.3 2003/07/07 17:47:38 rr144420
+ * open source merge net-snmp_0307071133
+ *
+ * Revision 1.2 2003/06/24 11:24:56 rr144420
+ * SMA Build 1
+ *
+ * Revision 1.1 2003/06/20 16:25:59 rr144420
+ * initial version
+ *
+ */
+
+#include <stdio.h>
+#define SMA_BUILD "sma1.0_b52"
+/* Build 52 */
+
+int main () {
+ char rcs_date[] = "$Date: 2004/04/19 $";
+ char dummy[] = "xDate:";
+ char date[] = "yyyy/mm/dd";
+ sscanf(rcs_date, "%6s %10s", dummy, date);
+ printf ("SMA build %s, %s\n", SMA_BUILD, date);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/sun/snmpd.conf Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,113 @@
+#
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# This distribution may include materials developed by third parties. Sun,
+# Sun Microsystems, the Sun logo and Solaris are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+#
+#
+###########################################################################
+#
+# snmpd.conf
+#
+# - created by the snmpconf configuration program
+#
+###########################################################################
+###########################################################################
+# SECTION: Admins who want to disable the snmpd daemon from
+# starting at boot time.
+# Change DISABLE=NO to DISABLE=YES
+# DO NOT DELETE
+# DO NOT UNCOMMENT
+#DISABLE=NO
+#
+# end ADMIN
+###########################################################################
+#
+# SECTION: Access Control Setup
+#
+# This section defines who is allowed to talk to your running
+# snmp agent.
+
+# rocommunity: a SNMPv1/SNMPv2c read-only access community name
+# arguments: community [default|hostname|network/bits] [oid]
+
+rocommunity public
+
+##########################################################################
+# SEA subagents dynamically register with the master agent via port 161,
+# supplying a read-write community string on the request (e.g. 'private'
+# for DMI). If the community strings used are not defined in the
+# snmpd.conf file, the registration request will not be forwarded to
+# the SEA master agent.
+#
+# rwcommunity: a SNMPv1/SNMPv2c read-write access community name
+# arguments: community [default|hostname|network/bits] [oid]
+#
+# The following entry provides minimum access for successful
+# SEA subagent registration.
+#
+#rwcommunity private localhost .1.3.6.1.4.1.42.2.15
+
+#rwcommunity private
+
+
+###########################################################################
+# SECTION: System Information Setup
+#
+# This section defines some of the information reported in
+# the "system" mib group in the mibII tree.
+
+# syslocation: The [typically physical] location of the system.
+# Note that setting this value here means that when trying to
+# perform an snmp SET operation to the sysLocation.0 variable will make
+# the agent return the "notWritable" error code. IE, including
+# this token in the snmpd.conf file will disable write access to
+# the variable.
+# arguments: location_string
+
+syslocation "System administrators office"
+
+# syscontact: The contact information for the administrator
+# Note that setting this value here means that when trying to
+# perform an snmp SET operation to the sysContact.0 variable will make
+# the agent return the "notWritable" error code. IE, including
+# this token in the snmpd.conf file will disable write access to
+# the variable.
+# arguments: contact_string
+
+syscontact "System administrator"
+sysservices 72
+
+#
+# dlmods entries
+# for 32bit agent
+#
+#dlmod seaExtensions /usr/lib/libseaExtensions.so
+#
+# for 64bit agent
+#dlmod seaExtensions /usr/lib/amd64/libseaExtensions.so
+#dlmod seaExtensions /usr/lib/sparcv9/libseaExtensions.so
+
+#master agentx
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/svc-net-snmp Fri May 20 12:17:45 2011 +0530
@@ -0,0 +1,53 @@
+#!/bin/ksh
+#
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# ident "@(#)svc-net-snmp 1.2 10/10/24 SMI"
+#
+# Start method script for the net-snmp SNMP daemon
+#
+
+. /lib/svc/share/smf_include.sh
+
+SMF_FMRI=svc:/application/management/net-snmp
+SNMPD_FILE=/etc/net-snmp/snmp/snmpd.conf
+SNMPCONFPATH=/etc/net-snmp/snmp:/var/net-snmp
+MIBDIRS=/etc/net-snmp/snmp/mibs
+CPU_ARCH=`/usr/bin/arch`
+
+export SNMPCONFPATH
+export MIBDIRS
+
+
+if [ "$CPU_ARCH" == "i86pc" ]; then
+ arch_type=`/bin/svcprop -p general/arch_type $SMF_FMRI`
+ if [ "$arch_type" == "32" ]; then
+ /usr/sbin/i86/snmpd
+ elif [ "$arch_type" == "64" ]; then
+ /usr/sbin/amd64/snmpd
+ elif [ "$arch_type" == "0" ]; then
+ /usr/sbin/snmpd
+ fi
+elif [ "$CPU_ARCH" == "sun4" ]; then
+ /usr/sbin/snmpd
+fi
--- a/make-rules/shared-macros.mk Thu May 19 18:49:31 2011 -0600
+++ b/make-rules/shared-macros.mk Fri May 20 12:17:45 2011 +0530
@@ -237,6 +237,7 @@
PERL = /usr/perl5/bin/perl
+CCSMAKE = /usr/ccs/bin/make
GMAKE = /usr/gnu/bin/make
GPATCH = /usr/gnu/bin/patch
PATCH_LEVEL = 1