mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

fguigues
18.22.2008 fa8b7740ab74fa5f2104b0f44cc35a960cafb76d
* Fix for Issue 218 : Monitor Information Available via SNMP
* Update the nbproject to include the snmp source code
24 files added
10 files modified
10355 ■■■■■ changed files
opends/build.properties 2 ●●●●● patch | view | raw | blame | history
opends/build.xml 181 ●●●●● patch | view | raw | blame | history
opends/nbproject/ide-file-targets.xml 50 ●●●●● patch | view | raw | blame | history
opends/nbproject/project.xml 29 ●●●● patch | view | raw | blame | history
opends/resource/admin/abbreviations.xsl 2 ●●● patch | view | raw | blame | history
opends/resource/schema/02-config.ldif 98 ●●●●● patch | view | raw | blame | history
opends/src/admin/defn/org/opends/server/admin/std/SNMPConnectionHandlerConfiguration.xml 435 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/protocol.properties 25 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/config/JMXMBean.java 53 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/jmx/Credential.java 16 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/jmx/OpendsRMIJRMPServerImpl.java 5 ●●●●● patch | view | raw | blame | history
opends/src/snmp/resource/config/config.snmp.ldif 11 ●●●●● patch | view | raw | blame | history
opends/src/snmp/resource/mib/SNMPV2-SMI.txt 346 ●●●●● patch | view | raw | blame | history
opends/src/snmp/resource/mib/mib_core.txt 1375 ●●●●● patch | view | raw | blame | history
opends/src/snmp/resource/mib/rfc1213.txt 3059 ●●●●● patch | view | raw | blame | history
opends/src/snmp/resource/mib/rfc2021.txt 25 ●●●●● patch | view | raw | blame | history
opends/src/snmp/resource/mib/rfc2605.txt 792 ●●●●● patch | view | raw | blame | history
opends/src/snmp/resource/mib/rfc2788.txt 619 ●●●●● patch | view | raw | blame | history
opends/src/snmp/resource/security/opends-snmp.security 6 ●●●●● patch | view | raw | blame | history
opends/src/snmp/src/org/opends/server/snmp/DIRECTORY_SERVER_MIBImpl.java 138 ●●●●● patch | view | raw | blame | history
opends/src/snmp/src/org/opends/server/snmp/DsApplIfOpsEntryImpl.java 302 ●●●●● patch | view | raw | blame | history
opends/src/snmp/src/org/opends/server/snmp/DsEntry.java 43 ●●●●● patch | view | raw | blame | history
opends/src/snmp/src/org/opends/server/snmp/DsMIBImpl.java 355 ●●●●● patch | view | raw | blame | history
opends/src/snmp/src/org/opends/server/snmp/DsTableEntryImpl.java 190 ●●●●● patch | view | raw | blame | history
opends/src/snmp/src/org/opends/server/snmp/SNMPClassLoaderProvider.java 360 ●●●●● patch | view | raw | blame | history
opends/src/snmp/src/org/opends/server/snmp/SNMPConnectionHandler.java 296 ●●●●● patch | view | raw | blame | history
opends/src/snmp/src/org/opends/server/snmp/SNMPConnectionHandlerDefinitions.java 90 ●●●●● patch | view | raw | blame | history
opends/src/snmp/src/org/opends/server/snmp/SNMPInetAddressAcl.java 210 ●●●●● patch | view | raw | blame | history
opends/src/snmp/src/org/opends/server/snmp/SNMPMonitor.java 362 ●●●●● patch | view | raw | blame | history
opends/src/snmp/src/org/opends/server/snmp/SNMPUserAcl.java 158 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java 10 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPConnectionManager.java 251 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPSyncManagerV2AccessTest.java 312 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPTrapManagerTest.java 149 ●●●●● patch | view | raw | blame | history
opends/build.properties
New file
@@ -0,0 +1,2 @@
opendmk.lib.dir=
opends/build.xml
@@ -34,6 +34,9 @@
  <!-- Build JVM properties -->
  <property name="MEM" value="256M"/>
  <!-- Build OpenDMK properties -->
  <property file="build.properties"/>
  <!-- General server-wide properties                                 -->
  <property name="src.dir"          location="src/server"              />
  <property name="build.dir"        location="build"                   />
@@ -142,6 +145,15 @@
  <property name="msg.package.dir" location="${classes.dir}/messages" />
  <property name="msg.src.dir"     location="src/messages/src" />
  <!-- Properties for SNMP extension. -->
  <property name="snmp.mib.dir"      location="src/snmp/resource/mib" />
  <property name="snmp.security.dir" location="src/snmp/resource/security" />
  <property name="snmp.config.dir"   location="src/snmp/resource/config" />
  <property name="snmp.gen.dir"      location="src/snmp/generated" />
  <property name="snmp.src.dir"      location="src/snmp/src" />
  <property name="snmp.classes.dir"
            location="${classes.dir}/org/opends/server/snmp" />
  <!-- Create a package bundle containing the DSML library. -->
  <target name="dsml" depends="predsml,package"
@@ -261,7 +273,7 @@
  <!-- Remove all dynamically-generated build files. -->
  <target name="clean" depends="cleanadmin,cleanmessages"
  <target name="clean" depends="cleanadmin,cleanmessages,cleansnmp"
       description="Clean up any files generated during the build process">
    <delete dir="${build.dir}" />
@@ -356,6 +368,20 @@
        <isset property="JVM_VENDOR" />
      </not>
    </condition>
    <condition property="isopendmkpresent">
     <or>
     <and>
       <available file="${opendmk.lib.dir}/jdmkrt.jar"/>
       <available file="${opendmk.lib.dir}/jdmktk.jar"/>
     </and>
     <and>
       <available file="${ext.dir}/jdmkrt.jar"/>
       <available file="${ext.dir}/jdmktk.jar"/>
     </and>
     </or>
    </condition>
  </target>
@@ -822,6 +848,7 @@
    <mkdir dir="${pdir}/config/schema"                               />
    <mkdir dir="${pdir}/config/messages"                             />
    <mkdir dir="${pdir}/config/MakeLDIF"                             />
    <mkdir dir="${pdir}/config/snmp/security"                        />
    <mkdir dir="${pdir}/db"                                          />
    <mkdir dir="${pdir}/import-tmp"                                  />
    <mkdir dir="${pdir}/changelogDb"                                 />
@@ -857,8 +884,8 @@
    <jar jarfile="${pdir}/lib/${SHORT_NAME}.jar"
         basedir="${classes.dir}"
         excludes="${ads.classes.dir}, ${quicksetup.globalcompile.classes.dir}"
         compress="true" index="true" />
         excludes="${ads.classes.dir}, ${quicksetup.globalcompile.classes.dir},
         org/opends/server/snmp/**" compress="true" index="true" />
    <jar jarfile="${pdir}/lib/quicksetup.jar"
         basedir="${quicksetup.classes.dir}" compress="true" index="true" />
@@ -871,8 +898,6 @@
      <fileset file="${lib.dir}/*.exe" />
    </copy>
    <antcall target="example-plugin" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bin" excludes="*.bat,_client-script.sh,_server-script.sh,_mixed-script.sh,_script-util.sh" eol="lf" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/lib" includes="_client-script.sh,_server-script.sh,_mixed-script.sh,_script-util.sh" eol="lf" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bin" includes="README_WINDOWS.txt" eol="crlf" />
@@ -883,6 +908,8 @@
      <fileset file="${config.dir}/*" />
    </copy>
    <antcall target="package-snmp" />
    <copy file="${pdir}/config/config.ldif"
         tofile="${pdir}/config/upgrade/config.ldif.${REVISION_NUMBER}" />
@@ -1380,7 +1407,7 @@
    <javac srcdir="${unittest.testng.src.dir}" destdir="${unittest.classes.dir}"
           debug="on" debuglevel="${build.debuglevel}" source="1.5"
           target="1.5" deprecation="true" fork="true" memoryInitialSize="${MEM}"
           memoryMaximumSize="${MEM}">
           memoryMaximumSize="${MEM}" excludes="org/opends/server/snmp/**">
      <compilerarg value="-Xlint:all" />
      <classpath>
@@ -1402,6 +1429,9 @@
               includes="**/*.properties" />
    </copy>
    <!-- Compile SNMP Tests if needed -->
    <antcall target="testsnmpinit"/>
    <!-- Prep the TestNG XML file -->
    <condition property="test.groups" value="exclude=slow">
@@ -1871,6 +1901,11 @@
        <fileset dir="${testng.lib.dir}">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${opendmk.lib.dir}">
          <include name="*.jar"/>
        </fileset>
      </classpath>
      <jvmarg  value="-Demma.coverage.out.file=${coverage.data.dir}/unit.emma" />
      <jvmarg value="-Demma.coverage.out.merge=false" />
@@ -2187,4 +2222,138 @@
    </zip>
    <delete dir="${plugin.temp.dir}" />
  </target>
  <target name="snmpmessagebuild" if="isopendmkpresent">
      <echo message="SNMP extension will be built and included in the delivery."/>
      <echo message="OpenDMK jar file location is ${opendmk.lib.dir}/jdmkrt.jar"/>
  </target>
  <target name="snmpmessageNotbuild" unless="isopendmkpresent">
      <echo message="SNMP extension will NOT be built/included in the delivery."/>
      <echo message="You have to set the opendmk.lib.dir property in"/>
      <echo message="${basedir}/build.properties file to indicate"/>
      <echo message="the location of the OpenDMK jar files."/>
      <echo message="To get the OpenDMK jar files please, go under"/>
      <echo message="https://opendmk.dev.java.net/"/>
  </target>
  <target name="snmpecho" depends="snmpmessageNotbuild,snmpmessagebuild"/>
  <!-- SNMP targets -->
  <target name="cleansnmp" description="Clean up any SNMP generated source files">
    <delete includeemptydirs="true" failonerror="false">
      <fileset dir="${snmp.gen.dir}" includes="**/*" />
    </delete>
  </target>
  <target name="mibgeneration" if="isopendmkpresent" description="mibgen invocation">
    <property name="opendmktk.path" location="${opendmk.lib.dir}/jdmktk.jar"/>
    <mkdir dir="${snmp.gen.dir}/org/opends/server/snmp" />
    <exec dir="${snmp.mib.dir}" executable="java">
      <arg line="-classpath ${opendmktk.path}
        com.sun.jdmk.tools.MibGen -X:use-display-hint
        -d ${snmp.gen.dir}/org/opends/server/snmp -mc -desc
        -tp org.opends.server.snmp ${snmp.mib.dir}/rfc2605.txt
        ${snmp.mib.dir}/mib_core.txt
        ${snmp.mib.dir}/rfc2021.txt ${snmp.mib.dir}/rfc2788.txt"/>
    </exec>
  </target>
   <target name="compilesnmp"
       depends="init,checkjavaversion,dynamicconstants,generatemessages,compileadmin,mibgeneration"
       if="isopendmkpresent"
       description="Compile the SNMP Connection Handler extension source files.">
    <mkdir dir="${classes.dir}" />
    <javac srcdir="${snmp.gen.dir}"
         destdir="${classes.dir}" debug="on" debuglevel="${build.debuglevel}"
         source="1.4" target="1.4" deprecation="true" fork="true" nowarn="on"
         memoryInitialSize="${MEM}" memoryMaximumSize="${MEM}">
      <compilerarg value="-Xlint:all" />
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${opendmk.lib.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </javac>
     <javac srcdir="${snmp.src.dir}"
         destdir="${classes.dir}" debug="on" debuglevel="${build.debuglevel}"
         source="1.5" target="1.5" deprecation="true" fork="true"
         memoryInitialSize="${MEM}" memoryMaximumSize="${MEM}">
      <compilerarg value="-Xlint:all" />
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${opendmk.lib.dir}">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </javac>
  </target>
  <!-- Package the SNMP Directory Server extension for distribution. -->
  <target name="package-snmp" if="isopendmkpresent" depends="snmpecho,compilesnmp"
          description="Package the SNMP Directory Server extension for distribution.">
    <property name="pdir" location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"/>
    <mkdir dir="${pdir}/lib/extensions" />
    <mkdir dir="${pdir}/snmp/mib"/>
    <mkdir dir="${pdir}/config/snmp/security" />
    <!-- Copy security template files -->
    <copy todir="${pdir}/config/snmp/security">
      <fileset dir="${snmp.security.dir}"/>
    </copy>
    <!-- Copy the mib -->
    <copy todir="${pdir}/snmp/mib" file="${snmp.mib.dir}/rfc2605.txt"/>
    <!-- Update the config.ldif file with snmp config -->
    <concat destfile="${pdir}/config/config.ldif" append="true">
        <filelist dir="${snmp.config.dir}" files="config.snmp.ldif"/>
    </concat>
    <!-- Create the jar file -->
    <jar jarfile="${pdir}/lib/extensions/snmp-mib2605.jar"
         basedir="${classes.dir}"
         includes="org/opends/server/snmp/**"
         compress="true" index="true" />
    <echo message="SNMP Extension is built"/>
    <echo message="${pdir}/lib/extensions/snmp-mib2605.jar"/>
  </target>
  <target name="testsnmpinit" if="isopendmkpresent">
    <!-- Compile the SNMP test cases -->
    <mkdir dir="${unittest.classes.dir}" />
    <javac srcdir="${unittest.testng.src.dir}" destdir="${unittest.classes.dir}"
           debug="on" debuglevel="${build.debuglevel}" source="1.5"
           target="1.5" deprecation="true" fork="true" memoryInitialSize="${MEM}"
           memoryMaximumSize="${MEM}" includes="org/opends/server/snmp/**">
      <compilerarg value="-Xlint:all" />
      <classpath>
        <fileset dir="${lib.dir}">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${testng.lib.dir}">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${opendmk.lib.dir}">
          <include name="*.jar" />
        </fileset>
        <path refid="run.classpath" />
        <path refid="quickSetup.classpath" />
      </classpath>
    </javac>
  </target>
</project>
opends/nbproject/ide-file-targets.xml
@@ -11,6 +11,9 @@
        <pathelement location="build/quicksetup/classes"/>
        <pathelement location="build/unit-tests/classes"/>
        <pathelement location="build/dsml/classes"/>
        <fileset dir="${opendmk.lib.dir}">
            <include name="*.jar"/>
        </fileset>
    </path>
 
    <!-- Prepare testng unit tests environment -->
@@ -85,7 +88,7 @@
        <fail unless="files">Must set property 'files'</fail>
        <echo message="Compiling source (normal): ${files}"/>
        <!-- TODO decide on and define some value for ${build.classes.dir} -->
        <mkdir dir="{classes.dir}"/>
        <mkdir dir="${classes.dir}"/>
        <javac destdir="${classes.dir}" includes="${files}" source="1.5" srcdir="src/server">
            <classpath refid="opends.path"/>
        </javac>
@@ -109,7 +112,7 @@
    <!-- -->
    <target depends="dynamicconstants" name="run-selected-file-in-server">
        <fail unless="run.class">Must set property 'run.class'</fail>
        <property name="pdir" location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"/>
        <property location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" name="pdir"/>
        <ant antfile="build.xml" inheritall="false" target="dynamicconstants"/>
        <java classname="${run.class}" failonerror="true" fork="true">
            <classpath refid="opends.path"/>
@@ -127,7 +130,7 @@
    <!-- -->
    <target depends="dynamicconstants" name="debug-selected-file-in-server">
        <fail unless="debug.class">Must set property 'debug.class'</fail>
        <property name="pdir" location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"/>
        <property location="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" name="pdir"/>
        <ant antfile="build.xml" inheritall="false" target="dynamicconstants"/>
        <nbjpdastart addressproperty="jpda.address" name="Directory Server" transport="dt_socket">
            <classpath refid="opends.path"/>
@@ -152,8 +155,8 @@
    <target name="compile-selected-files-in-ads">
        <fail unless="files">Must set property 'files'</fail>
        <echo message="Compiling source (normal): ${files}"/>
        <mkdir dir="build/build-tools/classes"/>
        <javac destdir="build/build-tools/classes" includes="${files}" source="1.5" srcdir="src/ads">
        <mkdir dir="${classes.dir}"/>
        <javac debug="on" debuglevel="${build.debuglevel}" destdir="${classes.dir}" includes="${files}" source="1.5" srcdir="src/ads">
            <classpath refid="opends.path"/>
        </javac>
    </target>
@@ -164,8 +167,8 @@
    <target name="compile-selected-files-in-build-tools">
        <fail unless="files">Must set property 'files'</fail>
        <echo message="Compiling source (normal): ${files}"/>
        <mkdir dir="build/build-tools/classes"/>
        <javac destdir="build/build-tools/classes" includes="${files}" source="1.5" srcdir="src/build-tools">
        <mkdir dir="${buildtools.classes.dir}"/>
        <javac debug="on" debuglevel="${build.debuglevel}" destdir="${buildtools.classes.dir}" includes="${files}" source="1.5" srcdir="src/build-tools">
            <classpath refid="opends.path"/>
        </javac>
    </target>
@@ -176,8 +179,8 @@
    <target name="compile-selected-files-in-guitools">
        <fail unless="files">Must set property 'files'</fail>
        <echo message="Compiling source (normal): ${files}"/>
        <mkdir dir="build/build-tools/classes"/>
        <javac destdir="build/build-tools/classes" includes="${files}" source="1.5" srcdir="src/guitools">
        <mkdir dir="${classes.dir}"/>
        <javac debug="on" debuglevel="${build.debuglevel}" destdir="${classes.dir}" includes="${files}" source="1.5" srcdir="src/guitools">
            <classpath refid="opends.path"/>
        </javac>
    </target>
@@ -188,9 +191,9 @@
    <target name="compile-selected-files-in-messages-src">
        <fail unless="files">Must set property 'files'</fail>
        <echo message="Compiling source (normal): ${files}"/>
        <mkdir dir="build/build-tools/classes"/>
        <javac destdir="build/build-tools/classes" includes="${files}" source="1.5" srcdir="src/messages/src">
            <classpath path="build/classes:build/build-tools/classes:lib/activation.jar:lib/aspectjrt.jar:lib/je.jar:lib/mail.jar:build/quicksetup/classes:build/build-tools/build-tools.jar:build/unit-tests/classes:ext/testng/lib/testng-5.7b-jdk15.jar:ext/ant/lib/ant.jar:ext/svnkit/svnkit.jar:ext/emma/lib/emma.jar:build/dsml/classes:resource/dsml/lib/jaxb-api.jar:resource/dsml/lib/jaxb-impl.jar:resource/dsml/lib/jsr173_1.0_api.jar:resource/dsml/lib/saaj-1.3.jar:resource/dsml/lib/saaj-impl-1.3.jar:resource/dsml/lib/j2ee.jar"/>
        <mkdir dir="${classes.dir}"/>
        <javac debug="on" debuglevel="${build.debuglevel}" destdir="${classes.dir}" includes="${files}" source="1.5" srcdir="src/messages/src">
            <classpath refid="opends.path"/>
        </javac>
    </target>
    
@@ -199,9 +202,9 @@
    <!-- -->
    <target name="compile-selected-files-in-quicksetup">
        <fail unless="files">Must set property 'files'</fail>
        <mkdir dir="build/build-tools/classes"/>
        <javac destdir="build/build-tools/classes" includes="${files}" source="1.5" srcdir="src/quicksetup">
            <classpath path="build/classes:build/build-tools/classes:lib/activation.jar:lib/aspectjrt.jar:lib/je.jar:lib/mail.jar:build/quicksetup/classes:build/build-tools/build-tools.jar:build/unit-tests/classes:ext/testng/lib/testng-5.7b-jdk15.jar:ext/ant/lib/ant.jar:ext/svnkit/svnkit.jar:ext/emma/lib/emma.jar:build/dsml/classes:resource/dsml/lib/jaxb-api.jar:resource/dsml/lib/jaxb-impl.jar:resource/dsml/lib/jsr173_1.0_api.jar:resource/dsml/lib/saaj-1.3.jar:resource/dsml/lib/saaj-impl-1.3.jar:resource/dsml/lib/j2ee.jar"/>
        <mkdir dir="${quicksetup.classes.dir}"/>
        <javac debug="on" debuglevel="${build.debuglevel}" destdir="${quicksetup.classes.dir}" includes="${files}" source="1.5" srcdir="src/quicksetup">
            <classpath refid="opends.path"/>
        </javac>
    </target>
    
@@ -211,9 +214,20 @@
    <target name="compile-selected-files-in-dsml">
        <fail unless="files">Must set property 'files'</fail>
        <echo message="Compiling source (normal): ${files}"/>
        <mkdir dir="build/build-tools/classes"/>
        <javac destdir="build/build-tools/classes" includes="${files}" source="1.5" srcdir="src/dsml">
            <classpath path="build/classes:build/build-tools/classes:lib/activation.jar:lib/aspectjrt.jar:lib/je.jar:lib/mail.jar:build/quicksetup/classes:build/build-tools/build-tools.jar:build/unit-tests/classes:ext/testng/lib/testng-5.7b-jdk15.jar:ext/ant/lib/ant.jar:ext/svnkit/svnkit.jar:ext/emma/lib/emma.jar:build/dsml/classes:resource/dsml/lib/jaxb-api.jar:resource/dsml/lib/jaxb-impl.jar:resource/dsml/lib/jsr173_1.0_api.jar:resource/dsml/lib/saaj-1.3.jar:resource/dsml/lib/saaj-impl-1.3.jar:resource/dsml/lib/j2ee.jar"/>
        <mkdir dir="${dsml.classes.dir}"/>
        <javac debug="on" debuglevel="${build.debuglevel}" destdir="${dsml.classes.dir}" includes="${files}" source="1.5" srcdir="src/dsml">
            <classpath refid="opends.path"/>
        </javac>
    </target>
    <!-- -->
    <!-- Compile a selected file in src/snmp/src folder -->
    <!-- -->
    <target name="compile-selected-files-in-snmp">
        <fail unless="files">Must set property 'files'</fail>
        <mkdir dir="${classes.dir}"/>
        <javac debug="on" debuglevel="${build.debuglevel}" destdir="${classes.dir}" includes="${files}" source="1.5" srcdir="src/snmp/src">
            <classpath refid="opends.path"/>
        </javac>
    </target>
    
opends/nbproject/project.xml
@@ -127,7 +127,7 @@
                    <target>package</target>
                </action>
                <action name="debug">
                    <script>nbproject/ide-file-targets.xml</script>
                    <script>nbproject/ide-targets.xml</script>
                    <target>debug-nb</target>
                </action>
                <action name="run.single">
@@ -286,35 +286,48 @@
                        </arity>
                    </context>
                </action>
                <action name="compile.single">
                    <script>nbproject/ide-file-targets.xml</script>
                    <target>compile-selected-files-in-snmp</target>
                    <context>
                        <property>files</property>
                        <folder>src/snmp/src</folder>
                        <pattern>\.java$</pattern>
                        <format>relative-path</format>
                        <arity>
                            <separated-files>,</separated-files>
                        </arity>
                    </context>
                </action>
            </ide-actions>
            <export>
                <type>folder</type>
                <location>build/build-tools/classes</location>
                <script>nbproject/nbjdk.xml</script>
                <script>build.xml</script>
                <build-target>package</build-target>
            </export>
            <export>
                <type>folder</type>
                <location>build/classes</location>
                <script>nbproject/nbjdk.xml</script>
                <script>build.xml</script>
                <build-target>package</build-target>
            </export>
            <export>
                <type>folder</type>
                <location>build/quicksetup/classes</location>
                <script>nbproject/nbjdk.xml</script>
                <script>build.xml</script>
                <build-target>package</build-target>
            </export>
            <export>
                <type>folder</type>
                <location>build/unit-tests/classes</location>
                <script>nbproject/nbjdk.xml</script>
                <script>build.xml</script>
                <build-target>package</build-target>
            </export>
            <export>
                <type>folder</type>
                <location>build/dsml/classes</location>
                <script>nbproject/nbjdk.xml</script>
                <script>build.xml</script>
                <build-target>package</build-target>
            </export>
            <view>
@@ -389,7 +402,9 @@
                    <ide-action name="debug"/>
                </context-menu>
            </view>
            <subprojects/>
            <subprojects>
                <project>.</project>
            </subprojects>
        </general-data>
        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
            <compilation-unit>
opends/resource/admin/abbreviations.xsl
@@ -52,7 +52,7 @@
              or $value = 'md5' or $value = 'sha1' or $value = 'sha256'
              or $value = 'sha384' or $value = 'sha512' or $value = 'tls'
              or $value = 'des' or $value = 'aes' or $value = 'rc4'
              or $value = 'db'
              or $value = 'db' or $value = 'snmp'
             "/>
  </xsl:template>
</xsl:stylesheet>
opends/resource/schema/02-config.ldif
@@ -2176,6 +2176,82 @@
  NAME 'ds-cfg-num-update-replay-threads'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.448
  NAME 'ds-cfg-trap-port'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.449
  NAME 'ds-cfg-version'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.450
  NAME 'ds-cfg-community'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.451
  NAME 'ds-cfg-allowed-manager'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.452
  NAME 'ds-cfg-allowed-user'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.453
  NAME 'ds-cfg-security-level'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.454
  NAME 'ds-cfg-traps-community'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.455
  NAME 'ds-cfg-traps-destination'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.456
  NAME 'ds-cfg-security-agent-file'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.457
  NAME 'ds-cfg-registered-mbean'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.458
  NAME 'ds-cfg-template-username'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.459
  NAME 'ds-cfg-template-auth-algorithm'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.460
  NAME 'ds-cfg-template-authkey'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.461
  NAME 'ds-cfg-template-priv-algorithm'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.462
  NAME 'ds-cfg-template-privkey'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.463
  NAME 'ds-cfg-opendmk-jarfile'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.1
  NAME 'ds-cfg-access-control-handler'
  SUP top
@@ -3676,3 +3752,25 @@
  STRUCTURAL
  MUST ( ds-cfg-backend )
  X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.181
  NAME 'ds-cfg-snmp-connection-handler'
  SUP ds-cfg-connection-handler
  STRUCTURAL
  MUST ( ds-cfg-listen-port $
         ds-cfg-trap-port )
  MAY ( ds-cfg-version $
        ds-cfg-traps-destination $
        ds-cfg-registered-mbean $
        ds-cfg-community $
        ds-cfg-allowed-manager $
        ds-cfg-allowed-user $
        ds-cfg-security-level $
        ds-cfg-traps-community $
        ds-cfg-security-agent-file $
        ds-cfg-template-username $
        ds-cfg-template-auth-algorithm $
        ds-cfg-template-authkey $
        ds-cfg-template-priv-algorithm $
        ds-cfg-template-privkey $
        ds-cfg-opendmk-jarfile )
  X-ORIGIN 'OpenDS Directory Server' )
opends/src/admin/defn/org/opends/server/admin/std/SNMPConnectionHandlerConfiguration.xml
New file
@@ -0,0 +1,435 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! 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
  ! trunk/opends/resource/legal-notices/OpenDS.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
  !
  !
  !      Portions Copyright 2008 Sun Microsystems, Inc.
! -->
<adm:managed-object name="snmp-connection-handler"
                    plural-name="snmp-connection-handlers"
                    package="org.opends.server.admin.std"
                    extends="connection-handler"
                    xmlns:adm="http://www.opends.org/admin"
                    xmlns:ldap="http://www.opends.org/admin-ldap" >
    <adm:synopsis>
        The
        <adm:user-friendly-name />
        can be used to process SNMP requests to retrieve monitoring information
        described by the MIB 2605.
    </adm:synopsis>
    <adm:description>
        The SNMP connection handler will process SNMP requests sent by SNMP
        Managers to retrieve information described the MIB 2605. To enable
        the SNMP Connection Handler, the ds-cfg-opendmk-jarfile parameter
        has to be set to the OpenDMK jar files location.
    </adm:description>
    <!-- Connection Handler ldap profile -->
    <adm:profile name="ldap">
        <ldap:object-class>
            <ldap:name>ds-cfg-snmp-connection-handler</ldap:name>
            <ldap:superior>ds-cfg-connection-handler</ldap:superior>
        </ldap:object-class>
    </adm:profile>
    <!-- Class to instanciate -->
    <adm:property-override name="java-class" advanced="true">
        <adm:default-behavior>
            <adm:defined>
                <adm:value>
                    org.opends.server.snmp.SNMPConnectionHandler
                </adm:value>
            </adm:defined>
        </adm:default-behavior>
    </adm:property-override>
    <!-- SNMP Port -->
    <adm:property-reference name="listen-port" />
    <adm:property name="trap-port" mandatory="true">
        <adm:synopsis>
            Specifies the port to use to send SNMP Traps.
        </adm:synopsis>
        <adm:syntax>
            <adm:integer />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-trap-port</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- SNMP Version  -->
    <adm:property name="version">
        <adm:synopsis>
            Specifies Supported SNMP Version : v1, v2, v3.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:defined>
                <adm:value>v2</adm:value>
            </adm:defined>
        </adm:default-behavior>
        <adm:syntax>
            <adm:string />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-version</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- SNMP Community or Context Name  -->
    <adm:property name="community" multi-valued="true">
        <adm:synopsis>
            Specifies the v1,v2 community or the v3 context name allowed to
            access the MIB 2605 monitoring information or the USM MIB.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:defined>
                <adm:value>OpenDS</adm:value>
            </adm:defined>
        </adm:default-behavior>
        <adm:syntax>
            <adm:string />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-community</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- SNMP V1/V2 Allowed managers  -->
    <adm:property name="allowed-manager" multi-valued="true">
        <adm:synopsis>
            Specifies the hosts of the managers to be granted the access rights.
            This property is required for SNMP v1 and v2 security configuration.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:alias>
                <adm:synopsis>
                    If the list is empty, no access control is done.
                </adm:synopsis>
            </adm:alias>
        </adm:default-behavior>
        <adm:syntax>
            <adm:string />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-allowed-manager</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- SNMP V3 Allowed users  -->
    <adm:property name="allowed-user" multi-valued="true">
        <adm:synopsis>
            Specifies the users to be granted the access rights. This property
            is required for SNMP v3 security configuration.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:alias>
                <adm:synopsis>
                    An asterik (*) opens access to all users.
                </adm:synopsis>
            </adm:alias>
        </adm:default-behavior>
        <adm:syntax>
            <adm:string />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-allowed-user</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- SNMP V3 Security level  -->
    <adm:property name="security-level">
        <adm:synopsis>
            Specifies the type of security level : NoAuthNoPriv : No security
            mechanisms activated, AuthNoPriv : Authentication activated with no
            privacy, AuthPriv : Authentication with privacy activated.
            This property id required for SNMP V3 security configuration.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:defined>
                <adm:value>authnopriv</adm:value>
            </adm:defined>
        </adm:default-behavior>
        <adm:syntax>
            <adm:enumeration>
                <adm:value name="noauthnopriv">
                    <adm:synopsis>
                        No security mechanisms activated.
                    </adm:synopsis>
                </adm:value>
                <adm:value name="authnopriv">
                    <adm:synopsis>
                        Authentication activated with no privacy.
                    </adm:synopsis>
                </adm:value>
                <adm:value name="authpriv">
                    <adm:synopsis>
                        Authentication with privacy activated.
                    </adm:synopsis>
                </adm:value>
            </adm:enumeration>
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-security-level</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- Trap Community  -->
    <adm:property name="traps-community" >
        <adm:synopsis>
            Specifies the community string that must be include in the traps
            sent to define managers (trap-destinations).
            This property is used in the context of SNMP v1, v2 and v3.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:defined>
                <adm:value>OpenDS</adm:value>
            </adm:defined>
        </adm:default-behavior>
        <adm:syntax>
            <adm:string />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-traps-community</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- Traps destinations -->
    <adm:property name="traps-destination" multi-valued="true">
        <adm:synopsis>
            Specifies the hosts to which V1 traps will be sent. V1 Traps are
            sent to every host listed.
        </adm:synopsis>
        <adm:description>
            If this list is empty, V1 traps are sent to "localhost".
            Each host in the list must be identifed by its name or complete IP Addess.
        </adm:description>
        <adm:default-behavior>
            <adm:alias>
                <adm:synopsis>
                    If the list is empty, V1 traps are sent to "localhost".
                </adm:synopsis>
            </adm:alias>
        </adm:default-behavior>
        <adm:syntax>
            <adm:string />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-traps-destination</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- Agent Engine Security USM Configuration -->
    <adm:property name="security-agent-file">
        <adm:synopsis>
            Specifies the USM security configuration to receive authenticated
            only SNMP requests.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:defined>
                <adm:value>
                    config/snmp/security/opends-snmp.security
                </adm:value>
            </adm:defined>
        </adm:default-behavior>
        <adm:syntax>
            <adm:string />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-security-agent-file</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- SNMP Registration or not -->
    <adm:property name="registered-mbean">
        <adm:synopsis>
            Indicates whether the SNMP objects have to be registered in the
            Directory Server MBeanServer or not allowing to access SNMP Objects
            with RMI connector if enabled.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:defined>
                <adm:value>false</adm:value>
            </adm:defined>
        </adm:default-behavior>
        <adm:syntax>
            <adm:boolean />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-registered-mbean</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!--User Template definitions -->
    <!--User Name -->
    <adm:property name="template-username">
        <adm:synopsis>
            Indicates the user name for the template definitions.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:defined>
                <adm:value>defaultUser</adm:value>
            </adm:defined>
        </adm:default-behavior>
        <adm:syntax>
            <adm:string />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-template-username</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- Authentication Algoritm -->
    <adm:property name="template-auth-algorithm">
        <adm:synopsis>
            Specifies the type of Authentication algorithm that must be used for
            SNMP V3 request for the specified user.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:defined>
                <adm:value>usmhmacmd5authprotocol</adm:value>
            </adm:defined>
        </adm:default-behavior>
        <adm:syntax>
            <adm:enumeration>
                <adm:value name="usmhmacmd5authprotocol">
                    <adm:synopsis>
                        usmHMACMD5AuthProtocol Authentication algorithm.
                    </adm:synopsis>
                </adm:value>
                <adm:value name="usmhmacshaauthprotocol">
                    <adm:synopsis>
                        usmHMACSHAAuthProtocol Authentication algorithm.
                    </adm:synopsis>
                </adm:value>
                <adm:value name="usmnoauthprotocol">
                    <adm:synopsis>
                        usmNoAuthProtocol Authentication algorithm.
                    </adm:synopsis>
                </adm:value>
            </adm:enumeration>
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-template-auth-algorithm</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- Authentication key -->
    <adm:property name="template-authkey">
        <adm:synopsis>
            Any text password or any hexadecimal key starting with 0x; for
            example, 0x0098768905AB67EFAA855A453B665B12, of size: 0 to 32
            inclusive for HMACMD5 or 0 to 40 inclusive for HMACSHA.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:defined>
                <adm:value>password</adm:value>
            </adm:defined>
        </adm:default-behavior>
        <adm:syntax>
            <adm:string />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-template-authkey</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- Privacy Algorithm -->
    <adm:property name="template-priv-algorithm">
        <adm:synopsis>
            Specifies the type of Privacy algorithm that must be used for
            SNMP V3 request for the specified user.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:defined>
                <adm:value>usmdesprivprotocol</adm:value>
            </adm:defined>
        </adm:default-behavior>
        <adm:syntax>
            <adm:enumeration>
                <adm:value name="usmdesprivprotocol">
                    <adm:synopsis>
                        usmDESPrivProtocol Privacy algorithm.
                    </adm:synopsis>
                </adm:value>
                <adm:value name="usmnoprivprotocol">
                    <adm:synopsis>
                        usmNoPrivProtocol Privacy algorithm.
                    </adm:synopsis>
                </adm:value>
            </adm:enumeration>
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-template-priv-algorithm</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
    <!-- Privacy key -->
    <adm:property name="template-privkey">
        <adm:synopsis>
            Any text password or any hexadecimal key starting with 0x;
            for example, 0x0098768905AB67EFAA855A453B665B12, of size: 0 to 32
            inclusive for HMACMD5 or 0 to 40 inclusive for HMACSHA.
        </adm:synopsis>
        <adm:default-behavior>
            <adm:defined>
                <adm:value>password</adm:value>
            </adm:defined>
        </adm:default-behavior>
        <adm:syntax>
            <adm:string />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-template-privkey</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
      <adm:property name="opendmk-jarfile">
        <adm:synopsis>
            Indicates the OpenDMK runtime jar file location
        </adm:synopsis>
        <adm:default-behavior>
            <adm:undefined />
        </adm:default-behavior>
        <adm:syntax>
            <adm:string />
        </adm:syntax>
        <adm:profile name="ldap">
            <ldap:attribute>
                <ldap:name>ds-cfg-opendmk-jarfile</ldap:name>
            </ldap:attribute>
        </adm:profile>
    </adm:property>
</adm:managed-object>
opends/src/messages/messages/protocol.properties
@@ -1435,3 +1435,28 @@
SEVERE_ERR_LDIF_CONNHANDLER_CANNOT_DELETE_456=An error occurred while the \
 LDIF connection handler was attempting to delete processed file %s:  %s
SEVERE_ERR_CONNHANDLER_ADDRESS_INUSE_457=Address already in use
INFO_SNMP_CONNHANDLER_DESCRIPTION_LISTEN_PORT_1458=SNMP port on \
 which this connection handler accepts SNMP requests.  Changes \
 to this configuration attribute will not take effect until the connection \
 handler is disabled and re-enabled, or until the Directory Server is \
 restarted
SEVERE_ERR_SNMP_CONNHANDLER_NO_LISTEN_PORT_1459=No listen port was defined \
 using configuration ds-cfg-listen-port in configuration entry %s.  This is a \
 required attribute
SEVERE_ERR_SNMP_CONNHANDLER_CANNOT_DETERMINE_LISTEN_PORT_1460=An unexpected \
 error occurred while processing the ds-cfg-snmp-port attribute in \
 configuration entry %s, which is used to specify the port on which to listen \
 for client connections:  %s
SEVERE_ERR_SNMP_CONNHANDLER_CANNOT_BE_STARTED_1461=An unexpected \
 error occurred when this connection handler started
SEVERE_ERR_SNMP_CONNHANDLER_NO_CONFIGURATION_1462=No Configuration was defined \
 for this connection handler. The configuration parameters ds-cfg-listen-port \
 and ds-cfg-trap-port are required by the connection handler to start
SEVERE_ERR_SNMP_CONNHANDLER_TRAPS_DESTINATION_1463=Traps Destination %s is \
 an unknown host
SEVERE_ERR_SNMP_CONNHANDLER_NO_OPENDMK_JARFILES_1464=You do not have the \
 appropriated OpenDMK jar files to enable the SNMP Connection Handler. \
 Please go under http://opendmk.dev.java.net and set the \
 ds-cfg-opendmk-jarfile configuration parameter to set the full path \
 of the required jdmkrt.jar file. The SNMP connection Handler didn't started
opends/src/server/org/opends/server/config/JMXMBean.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.config;
import org.opends.messages.Message;
@@ -51,6 +51,7 @@
import org.opends.server.admin.std.server.MonitorProviderCfg;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.DirectoryServerMBean;
import org.opends.server.api.InvokableComponent;
import org.opends.server.api.MonitorProvider;
@@ -73,6 +74,7 @@
import static org.opends.server.util.StaticUtils.*;
import org.opends.server.protocols.jmx.JmxClientConnection;
import org.opends.server.protocols.asn1.ASN1OctetString;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.ldap.LDAPFilter;
import org.opends.server.protocols.internal.InternalSearchOperation ;
import org.opends.server.types.LDAPException;
@@ -488,8 +490,8 @@
  {
    //
    // Get the jmx Client connection
    JmxClientConnection jmxClientConnection = getClientConnection();
    if (jmxClientConnection == null)
    ClientConnection clientConnection = getClientConnection();
    if (clientConnection == null)
    {
      return null;
    }
@@ -519,14 +521,20 @@
    // Perform the Ldap operation for
    //  - ACI Check
    //  - Loggin purpose
    InternalSearchOperation op = jmxClientConnection.processSearch(
    InternalSearchOperation op=null;
    if (clientConnection instanceof JmxClientConnection) {
        op = ((JmxClientConnection)clientConnection).processSearch(
        new ASN1OctetString(configEntryDN.toString()),
        SearchScope.BASE_OBJECT, filter);
    }
    else if (clientConnection instanceof InternalClientConnection) {
        op = ((InternalClientConnection)clientConnection).processSearch(
             new ASN1OctetString(configEntryDN.toString()),
             SearchScope.BASE_OBJECT, filter);
    }
    ResultCode rc = op.getResultCode();
    if (rc != ResultCode.SUCCESS)
    {
      jmxClientConnection = null ;
    if (rc != ResultCode.SUCCESS) {
       clientConnection = null ;
      Message message = ERR_CONFIG_JMX_CANNOT_GET_ATTRIBUTE.
          get(String.valueOf(attributeName), String.valueOf(configEntryDN),
@@ -584,8 +592,8 @@
    //
    // Get the jmx Client connection
    JmxClientConnection jmxClientConnection = getClientConnection();
    if (jmxClientConnection == null)
    ClientConnection clientConnection = getClientConnection();
    if (clientConnection == null)
    {
      return null;
    }
@@ -606,14 +614,21 @@
    // Perform the Ldap operation for
    //  - ACI Check
    //  - Loggin purpose
    InternalSearchOperation op = jmxClientConnection.processSearch(
    InternalSearchOperation op=null;
    if (clientConnection instanceof JmxClientConnection) {
      op = ((JmxClientConnection)clientConnection).processSearch(
        new ASN1OctetString(configEntryDN.toString()),
        SearchScope.BASE_OBJECT, filter);
    }
    else if (clientConnection instanceof InternalClientConnection) {
      op = ((InternalClientConnection)clientConnection).processSearch(
        new ASN1OctetString(configEntryDN.toString()),
        SearchScope.BASE_OBJECT, filter);
    }
    ResultCode rc = op.getResultCode();
    if (rc != ResultCode.SUCCESS)
    {
      jmxClientConnection = null ;
      clientConnection = null ;
      return null;
    }
@@ -801,8 +816,8 @@
   */
  public MBeanInfo getMBeanInfo()
  {
    JmxClientConnection jmxClientConnection = getClientConnection();
    if (jmxClientConnection == null)
    ClientConnection clientConnection = getClientConnection();
    if (clientConnection == null)
    {
      return new MBeanInfo(CLASS_NAME, null, null, null, null, null);
    }
@@ -871,9 +886,9 @@
   *
   * @return The JmxClientConnection.
   */
  private JmxClientConnection getClientConnection()
  private ClientConnection getClientConnection()
  {
      JmxClientConnection jmxClientConnection=null;
      ClientConnection clientConnection=null;
      java.security.AccessControlContext acc = java.security.AccessController
      .getContext();
      try
@@ -882,12 +897,12 @@
          .getSubject(acc);
          if(subject != null) {
            Set privateCreds = subject.getPrivateCredentials(Credential.class);
            jmxClientConnection = ((Credential) privateCreds
            clientConnection = ((Credential) privateCreds
                    .iterator().next()).getClientConnection();
          }
      }
      catch (Exception e) {}
      return jmxClientConnection;
      return clientConnection;
  }
}
opends/src/server/org/opends/server/protocols/jmx/Credential.java
@@ -26,6 +26,8 @@
 */
package org.opends.server.protocols.jmx;
import org.opends.server.api.ClientConnection;
/**
 * Represents a Ldap credential used for JMX connection authentication.
@@ -41,28 +43,28 @@
  /**
   * The Client connection to be used.
   */
  private JmxClientConnection jmxClientConnection;
  private ClientConnection clientConnection;
  /**
   * Default Constructor.
   *
   * @param jmxClientConnection
   * @param clientConnection
   *           The  representation of this credential is a Jmx Client connection
   * that will handle incoming requests.
   */
  public Credential(JmxClientConnection jmxClientConnection)
  public Credential(ClientConnection clientConnection)
  {
    this.jmxClientConnection = jmxClientConnection;
    this.clientConnection = clientConnection;
  }
  /**
   * Returns the associated Client connection.
   *
   * @return the associated JmxClientConnection object. Can be null
   * @return the associated ClientConnection object. Can be null
   */
  public JmxClientConnection getClientConnection()
  public ClientConnection getClientConnection()
  {
    return jmxClientConnection;
    return clientConnection;
  }
}
opends/src/server/org/opends/server/protocols/jmx/OpendsRMIJRMPServerImpl.java
@@ -80,8 +80,9 @@
    {
      Set<Credential> privateCreds = subject
          .getPrivateCredentials(Credential.class);
      JmxClientConnection jmxClientConnection = privateCreds.iterator()
          .next().getClientConnection();
      JmxClientConnection jmxClientConnection =
       (JmxClientConnection)
       privateCreds.iterator().next().getClientConnection();
      jmxClientConnection.jmxConnectionID = connectionId;
    }
opends/src/snmp/resource/config/config.snmp.ldif
New file
@@ -0,0 +1,11 @@
dn: cn=SNMP Connection Handler,cn=Connection Handlers,cn=config
objectClass: top
objectClass: ds-cfg-connection-handler
objectClass: ds-cfg-snmp-connection-handler
cn: SNMP Connection Handler
ds-cfg-java-class: org.opends.server.snmp.SNMPConnectionHandler
ds-cfg-enabled: false
ds-cfg-trap-port: 162
ds-cfg-listen-port: 161
opends/src/snmp/resource/mib/SNMPV2-SMI.txt
New file
@@ -0,0 +1,346 @@
SNMPv2-SMI DEFINITIONS ::= BEGIN
-- the path to the root
org            OBJECT IDENTIFIER ::= { iso 3 }  --  "iso" = 1
dod            OBJECT IDENTIFIER ::= { org 6 }
internet       OBJECT IDENTIFIER ::= { dod 1 }
directory      OBJECT IDENTIFIER ::= { internet 1 }
mgmt           OBJECT IDENTIFIER ::= { internet 2 }
mib-2          OBJECT IDENTIFIER ::= { mgmt 1 }
transmission   OBJECT IDENTIFIER ::= { mib-2 10 }
experimental   OBJECT IDENTIFIER ::= { internet 3 }
private        OBJECT IDENTIFIER ::= { internet 4 }
enterprises    OBJECT IDENTIFIER ::= { private 1 }
security       OBJECT IDENTIFIER ::= { internet 5 }
snmpV2         OBJECT IDENTIFIER ::= { internet 6 }
-- transport domains
snmpDomains    OBJECT IDENTIFIER ::= { snmpV2 1 }
-- transport proxies
snmpProxys     OBJECT IDENTIFIER ::= { snmpV2 2 }
-- module identities
snmpModules    OBJECT IDENTIFIER ::= { snmpV2 3 }
-- Extended UTCTime, to allow dates with four-digit years
-- (Note that this definition of ExtUTCTime is not to be IMPORTed
--  by MIB modules.)
ExtUTCTime ::= OCTET STRING(SIZE(11 | 13))
    -- format is YYMMDDHHMMZ or YYYYMMDDHHMMZ
    --   where: YY   - last two digits of year (only years
    --                 between 1900-1999)
    --          YYYY - last four digits of the year (any year)
    --          MM   - month (01 through 12)
    --          DD   - day of month (01 through 31)
    --          HH   - hours (00 through 23)
    --          MM   - minutes (00 through 59)
    --          Z    - denotes GMT (the ASCII character Z)
    --
    -- For example, "9502192015Z" and "199502192015Z" represent
    -- 8:15pm GMT on 19 February 1995. Years after 1999 must use
    -- the four digit year format. Years 1900-1999 may use the
    -- two or four digit format.
-- definitions for information modules
MODULE-IDENTITY MACRO ::=
BEGIN
    TYPE NOTATION ::=
                  "LAST-UPDATED" value(Update ExtUTCTime)
                  "ORGANIZATION" Text
                  "CONTACT-INFO" Text
                  "DESCRIPTION" Text
                  RevisionPart
    VALUE NOTATION ::=
                  value(VALUE OBJECT IDENTIFIER)
    RevisionPart ::=
                  Revisions
                | empty
    Revisions ::=
                  Revision
                | Revisions Revision
    Revision ::=
                  "REVISION" value(Update ExtUTCTime)
                  "DESCRIPTION" Text
    -- a character string as defined in section 3.1.1
    Text ::= value(IA5String)
END
OBJECT-IDENTITY MACRO ::=
BEGIN
    TYPE NOTATION ::=
                  "STATUS" Status
                  "DESCRIPTION" Text
                  ReferPart
    VALUE NOTATION ::=
                  value(VALUE OBJECT IDENTIFIER)
    Status ::=
                  "current"
                | "deprecated"
                | "obsolete"
    ReferPart ::=
                  "REFERENCE" Text
                | empty
    -- a character string as defined in section 3.1.1
    Text ::= value(IA5String)
END
-- names of objects
-- (Note that these definitions of ObjectName and NotificationName
--  are not to be IMPORTed by MIB modules.)
ObjectName ::=
    OBJECT IDENTIFIER
NotificationName ::=
    OBJECT IDENTIFIER
-- syntax of objects
-- the "base types" defined here are:
--   3 built-in ASN.1 types: INTEGER, OCTET STRING, OBJECT IDENTIFIER
--   8 application-defined types: Integer32, IpAddress, Counter32,
--              Gauge32, Unsigned32, TimeTicks, Opaque, and Counter64
ObjectSyntax ::=
    CHOICE {
        simple
            SimpleSyntax,
          -- note that SEQUENCEs for conceptual tables and
          -- rows are not mentioned here...
        application-wide
            ApplicationSyntax
    }
-- built-in ASN.1 types
SimpleSyntax ::=
    CHOICE {
        -- INTEGERs with a more restrictive range
        -- may also be used
        integer-value               -- includes Integer32
            INTEGER (-2147483648..2147483647),
        -- OCTET STRINGs with a more restrictive size
        -- may also be used
        string-value
            OCTET STRING (SIZE (0..65535)),
        objectID-value
            OBJECT IDENTIFIER
    }
-- indistinguishable from INTEGER, but never needs more than
-- 32-bits for a two's complement representation
Integer32 ::=
        INTEGER (-2147483648..2147483647)
-- application-wide types
ApplicationSyntax ::=
    CHOICE {
        ipAddress-value
            IpAddress,
        counter-value
            Counter32,
        timeticks-value
            TimeTicks,
        arbitrary-value
            Opaque,
        big-counter-value
            Counter64,
        unsigned-integer-value  -- includes Gauge32
            Unsigned32
    }
-- in network-byte order
-- (this is a tagged type for historical reasons)
IpAddress ::=
    [APPLICATION 0]
        IMPLICIT OCTET STRING (SIZE (4))
-- this wraps
Counter32 ::=
    [APPLICATION 1]
        IMPLICIT INTEGER (0..4294967295)
-- this doesn't wrap
Gauge32 ::=
    [APPLICATION 2]
        IMPLICIT INTEGER (0..4294967295)
-- an unsigned 32-bit quantity
-- indistinguishable from Gauge32
Unsigned32 ::=
    [APPLICATION 2]
        IMPLICIT INTEGER (0..4294967295)
-- hundredths of seconds since an epoch
TimeTicks ::=
    [APPLICATION 3]
        IMPLICIT INTEGER (0..4294967295)
-- for backward-compatibility only
Opaque ::=
    [APPLICATION 4]
        IMPLICIT OCTET STRING
-- for counters that wrap in less than one hour with only 32 bits
Counter64 ::=
    [APPLICATION 6]
        IMPLICIT INTEGER (0..18446744073709551615)
-- definition for objects
OBJECT-TYPE MACRO ::=
BEGIN
    TYPE NOTATION ::=
                  "SYNTAX" Syntax
                  UnitsPart
                  "MAX-ACCESS" Access
                  "STATUS" Status
                  "DESCRIPTION" Text
                  ReferPart
                  IndexPart
                  DefValPart
    VALUE NOTATION ::=
                  value(VALUE ObjectName)
    Syntax ::=   -- Must be one of the following:
                       -- a base type (or its refinement),
                       -- a textual convention (or its refinement), or
                       -- a BITS pseudo-type
                   type
                | "BITS" "{" NamedBits "}"
    NamedBits ::= NamedBit
                | NamedBits "," NamedBit
    NamedBit ::=  identifier "(" number ")" -- number is nonnegative
    UnitsPart ::=
                  "UNITS" Text
                | empty
    Access ::=
                  "not-accessible"
                | "accessible-for-notify"
                | "read-only"
                | "read-write"
                | "read-create"
    Status ::=
                  "current"
                | "deprecated"
                | "obsolete"
    ReferPart ::=
                  "REFERENCE" Text
                | empty
    IndexPart ::=
                  "INDEX"    "{" IndexTypes "}"
                | "AUGMENTS" "{" Entry      "}"
                | empty
    IndexTypes ::=
                  IndexType
                | IndexTypes "," IndexType
    IndexType ::=
                  "IMPLIED" Index
                | Index
    Index ::=
                    -- use the SYNTAX value of the
                    -- correspondent OBJECT-TYPE invocation
                  value(ObjectName)
    Entry ::=
                    -- use the INDEX value of the
                    -- correspondent OBJECT-TYPE invocation
                  value(ObjectName)
    DefValPart ::= "DEFVAL" "{" Defvalue "}"
                | empty
    Defvalue ::=  -- must be valid for the type specified in
                  -- SYNTAX clause of same OBJECT-TYPE macro
                  value(ObjectSyntax)
                | "{" BitsValue "}"
    BitsValue ::= BitNames
                | empty
    BitNames ::=  BitName
                | BitNames "," BitName
    BitName ::= identifier
    -- a character string as defined in section 3.1.1
    Text ::= value(IA5String)
END
-- definitions for notifications
NOTIFICATION-TYPE MACRO ::=
BEGIN
    TYPE NOTATION ::=
                  ObjectsPart
                  "STATUS" Status
                  "DESCRIPTION" Text
                  ReferPart
    VALUE NOTATION ::=
                  value(VALUE NotificationName)
    ObjectsPart ::=
                  "OBJECTS" "{" Objects "}"
                | empty
    Objects ::=
                  Object
                | Objects "," Object
    Object ::=
                  value(ObjectName)
    Status ::=
                  "current"
                | "deprecated"
                | "obsolete"
    ReferPart ::=
                  "REFERENCE" Text
                | empty
    -- a character string as defined in section 3.1.1
    Text ::= value(IA5String)
END
-- definitions of administrative identifiers
zeroDotZero    OBJECT-IDENTITY
    STATUS     current
    DESCRIPTION
            "A value used for null identifiers."
    ::= { 0 0 }
END
opends/src/snmp/resource/mib/mib_core.txt
New file
@@ -0,0 +1,1375 @@
--
-- @(#)file      mib_core.txt
-- @(#)author    Sun Microsystems, Inc.
-- @(#)version   1.4
-- @(#)date      03/05/30
--
-- The file contains all the definitions scattered around many different
-- RFCs.
--
          CORE-MIB DEFINITIONS ::= BEGIN
          IMPORTS ;
--------------
-- from SMI --
--------------
          -- the path to the root
          internet       OBJECT IDENTIFIER ::= { iso(1) org(3) dod(6) 1 }
          directory      OBJECT IDENTIFIER ::= { internet 1 }
          mgmt           OBJECT IDENTIFIER ::= { internet 2 }
          experimental   OBJECT IDENTIFIER ::= { internet 3 }
          private        OBJECT IDENTIFIER ::= { internet 4 }
          enterprises    OBJECT IDENTIFIER ::= { private 1 }
          security       OBJECT IDENTIFIER ::= { internet 5 }
          snmpV2         OBJECT IDENTIFIER ::= { internet 6 }
          -- transport domains
          snmpDomains    OBJECT IDENTIFIER ::= { snmpV2 1 }
          -- transport proxies
          snmpProxys     OBJECT IDENTIFIER ::= { snmpV2 2 }
          -- module identities
          snmpModules    OBJECT IDENTIFIER ::= { snmpV2 3 }
-----------------
-- from MIB-II --
-----------------
          mib-2      OBJECT IDENTIFIER ::= { mgmt 1 }
-------------------
-- from RFC 1271 --
-------------------
              EntryStatus ::= INTEGER
                         { valid(1),
                           createRequest(2),
                           underCreation(3),
                           invalid(4)
                         }
              -- The status of a table entry.
              --
              -- Setting this object to the value invalid(4) has the
              -- effect of invalidating the corresponding entry.
              -- That is, it effectively disassociates the mapping
              -- identified with said entry.
              -- It is an implementation-specific matter as to whether
              -- the agent removes an invalidated entry from the table.
              -- Accordingly, management stations must be prepared to
              -- receive tabular information from agents that corresponds
              -- to entries currently not in use.  Proper
              -- interpretation of such entries requires examination
              -- of the relevant EntryStatus object.
              --
              -- An existing instance of this object cannot be set to
              -- createRequest(2).  This object may only be set to
              -- createRequest(2) when this instance is created.  When
              -- this object is created, the agent may wish to create
              -- supplemental object instances to complete a conceptual
              -- row in this table.  Immediately after completing the
              -- create operation, the agent must set this object to
              -- underCreation(3).
              --
              -- Entries shall exist in the underCreation(3) state until
              -- the management station is finished configuring the
              -- entry and sets this object to valid(1) or aborts,
              -- setting this object to invalid(4).  If the agent
              -- determines that an entry has been in the
              -- underCreation(3) state for an abnormally long time,
              -- it may decide that the management station has
              -- crashed.  If the agent makes this decision,
              -- it may set this object to invalid(4) to reclaim the
              -- entry.  A prudent agent will understand that the
              -- management station may need to wait for human input
              -- and will allow for that possibility in its
              -- determination of this abnormally long period.
-------------------
-- from RFC 1316 --
-------------------
-------------------
-- from RFC 1443 --
-------------------
------------------------
-- from RFC 1065/1442 --
------------------------
    Gauge32 ::= Gauge
    Counter32 ::= Counter
    Integer32 ::= INTEGER
     -- application-wide types
      NetworkAddress ::=
          CHOICE {
              internet
                  IpAddress
          }
      IpAddress ::=
          [APPLICATION 0]          -- in network-byte order
              IMPLICIT OCTET STRING (SIZE (4))
      Counter ::=
          [APPLICATION 1]
              IMPLICIT INTEGER (0..4294967295)
      Counter64 ::=
          [APPLICATION 1]
              IMPLICIT INTEGER (0..18446744073709551615)
      Gauge ::=
          [APPLICATION 2]
              IMPLICIT INTEGER (0..4294967295)
      Unsigned32 ::=
          [APPLICATION 2]
              IMPLICIT INTEGER (0..4294967295)
      TimeTicks ::=
          [APPLICATION 3]
              IMPLICIT INTEGER (0..4294967295)
      Opaque ::=
          [APPLICATION 4]          -- arbitrary ASN.1 value,
              IMPLICIT OCTET STRING   --   "double-wrapped"
---------------------------------------------------
-- from RFC 1903: Textual Conventions for SNMPv2 --
---------------------------------------------------
DisplayString ::= TEXTUAL-CONVENTION
    DISPLAY-HINT "255a"
    STATUS       current
    DESCRIPTION
            "Represents textual information taken from the NVT ASCII
            character set, as defined in pages 4, 10-11 of RFC 854.
            To summarize RFC 854, the NVT ASCII repertoire specifies:
              - the use of character codes 0-127 (decimal)
              - the graphics characters (32-126) are interpreted as
                US ASCII
              - NUL, LF, CR, BEL, BS, HT, VT and FF have the special
                meanings specified in RFC 854
              - the other 25 codes have no standard interpretation
              - the sequence 'CR LF' means newline
              - the sequence 'CR NUL' means carriage-return
              - an 'LF' not preceded by a 'CR' means moving to the
                same column on the next line.
              - the sequence 'CR x' for any x other than LF or NUL is
                illegal.  (Note that this also means that a string may
                end with either 'CR LF' or 'CR NUL', but not with CR.)
            Any object defined using this syntax may not exceed 255
            characters in length."
    SYNTAX       OCTET STRING (SIZE (0..255))
PhysAddress ::= TEXTUAL-CONVENTION
    DISPLAY-HINT "1x:"
    STATUS       current
    DESCRIPTION
            "Represents media- or physical-level addresses."
    SYNTAX       OCTET STRING
MacAddress ::= TEXTUAL-CONVENTION
    DISPLAY-HINT "1x:"
    STATUS       current
    DESCRIPTION
            "Represents an 802 MAC address represented in the
            `canonical' order defined by IEEE 802.1a, i.e., as if it
            were transmitted least significant bit first, even though
            802.5 (in contrast to other 802.x protocols) requires MAC
            addresses to be transmitted most significant bit first."
    SYNTAX       OCTET STRING (SIZE (6))
TruthValue ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION
            "Represents a boolean value."
    SYNTAX       INTEGER { true(1), false(2) }
TestAndIncr ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION
            "Represents integer-valued information used for atomic
            operations.  When the management protocol is used to specify
            that an object instance having this syntax is to be
            modified, the new value supplied via the management protocol
            must precisely match the value presently held by the
            instance.  If not, the management protocol set operation
            fails with an error of `inconsistentValue'.  Otherwise, if
            the current value is the maximum value of 2^31-1 (2147483647
            decimal), then the value held by the instance is wrapped to
            zero; otherwise, the value held by the instance is
            incremented by one.  (Note that regardless of whether the
            management protocol set operation succeeds, the variable-
            binding in the request and response PDUs are identical.)
            The value of the ACCESS clause for objects having this
            syntax is either `read-write' or `read-create'.  When an
            instance of a columnar object having this syntax is created,
            any value may be supplied via the management protocol.
            When the network management portion of the system is re-
            initialized, the value of every object instance having this
            syntax must either be incremented from its value prior to
            the re-initialization, or (if the value prior to the re-
            initialization is unknown) be set to a pseudo-randomly
            generated value."
    SYNTAX       INTEGER (0..2147483647)
AutonomousType ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION
            "Represents an independently extensible type identification
            value.  It may, for example, indicate a particular sub-tree
            with further MIB definitions, or define a particular type of
            protocol or hardware."
    SYNTAX       OBJECT IDENTIFIER
InstancePointer ::= TEXTUAL-CONVENTION
    STATUS       obsolete
    DESCRIPTION
            "A pointer to either a specific instance of a MIB object or
            a conceptual row of a MIB table in the managed device.  In
            the latter case, by convention, it is the name of the
            particular instance of the first accessible columnar object
            in the conceptual row.
            The two uses of this textual convention are replaced by
            VariablePointer and RowPointer, respectively."
    SYNTAX       OBJECT IDENTIFIER
VariablePointer ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION
            "A pointer to a specific object instance.  For example,
            sysContact.0 or ifInOctets.3."
    SYNTAX       OBJECT IDENTIFIER
RowPointer ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION
            "Represents a pointer to a conceptual row.  The value is the
            name of the instance of the first accessible columnar object
            in the conceptual row.
            For example, ifIndex.3 would point to the 3rd row in the
            ifTable (note that if ifIndex were not-accessible, then
            ifDescr.3 would be used instead)."
    SYNTAX       OBJECT IDENTIFIER
RowStatus ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION
            "The RowStatus textual convention is used to manage the
            creation and deletion of conceptual rows, and is used as the
            value of the SYNTAX clause for the status column of a
            conceptual row (as described in Section 7.7.1 of [2].)
            The status column has six defined values:
                 - `active', which indicates that the conceptual row is
                 available for use by the managed device;
                 - `notInService', which indicates that the conceptual
                 row exists in the agent, but is unavailable for use by
                 the managed device (see NOTE below);
                 - `notReady', which indicates that the conceptual row
                 exists in the agent, but is missing information
                 necessary in order to be available for use by the
                 managed device;
                 - `createAndGo', which is supplied by a management
                 station wishing to create a new instance of a
                 conceptual row and to have its status automatically set
                 to active, making it available for use by the managed
                 device;
                 - `createAndWait', which is supplied by a management
                 station wishing to create a new instance of a
                 conceptual row (but not make it available for use by
                 the managed device); and,
                 - `destroy', which is supplied by a management station
                 wishing to delete all of the instances associated with
                 an existing conceptual row.
            Whereas five of the six values (all except `notReady') may
            be specified in a management protocol set operation, only
            three values will be returned in response to a management
            protocol retrieval operation:  `notReady', `notInService' or
            `active'.  That is, when queried, an existing conceptual row
            has only three states:  it is either available for use by
            the managed device (the status column has value `active');
            it is not available for use by the managed device, though
            the agent has sufficient information to make it so (the
            status column has value `notInService'); or, it is not
            available for use by the managed device, and an attempt to
            make it so would fail because the agent has insufficient
            information (the state column has value `notReady').
                                     NOTE WELL
                 This textual convention may be used for a MIB table,
                 irrespective of whether the values of that table's
                 conceptual rows are able to be modified while it is
                 active, or whether its conceptual rows must be taken
                 out of service in order to be modified.  That is, it is
                 the responsibility of the DESCRIPTION clause of the
                 status column to specify whether the status column must
                 not be `active' in order for the value of some other
                 column of the same conceptual row to be modified.  If
                 such a specification is made, affected columns may be
                 changed by an SNMP set PDU if the RowStatus would not
                 be equal to `active' either immediately before or after
                 processing the PDU.  In other words, if the PDU also
                 contained a varbind that would change the RowStatus
                 value, the column in question may be changed if the
                 RowStatus was not equal to `active' as the PDU was
                 received, or if the varbind sets the status to a value
                 other than 'active'.
            Also note that whenever any elements of a row exist, the
            RowStatus column must also exist.
            To summarize the effect of having a conceptual row with a
            status column having a SYNTAX clause value of RowStatus,
            consider the following state diagram:
                                         STATE
              +--------------+-----------+-------------+-------------
              |      A       |     B     |      C      |      D
              |              |status col.|status column|
              |status column |    is     |      is     |status column
    ACTION    |does not exist|  notReady | notInService|  is active
--------------+--------------+-----------+-------------+-------------
set status    |noError    ->D|inconsist- |inconsistent-|inconsistent-
column to     |       or     |   entValue|        Value|        Value
createAndGo   |inconsistent- |           |             |
              |         Value|           |             |
--------------+--------------+-----------+-------------+-------------
set status    |noError  see 1|inconsist- |inconsistent-|inconsistent-
column to     |       or     |   entValue|        Value|        Value
createAndWait |wrongValue    |           |             |
--------------+--------------+-----------+-------------+-------------
set status    |inconsistent- |inconsist- |noError      |noError
column to     |         Value|   entValue|             |
active        |              |           |             |
              |              |     or    |             |
              |              |           |             |
              |              |see 2   ->D|          ->D|          ->D
--------------+--------------+-----------+-------------+-------------
set status    |inconsistent- |inconsist- |noError      |noError   ->C
column to     |         Value|   entValue|             |
notInService  |              |           |             |
              |              |     or    |             |      or
              |              |           |             |
              |              |see 3   ->C|          ->C|wrongValue
--------------+--------------+-----------+-------------+-------------
set status    |noError       |noError    |noError      |noError
column to     |              |           |             |
destroy       |           ->A|        ->A|          ->A|          ->A
--------------+--------------+-----------+-------------+-------------
set any other |see 4         |noError    |noError      |see 5
column to some|              |           |             |
value         |              |      see 1|          ->C|          ->D
--------------+--------------+-----------+-------------+-------------
            (1) goto B or C, depending on information available to the
            agent.
SNMPv2 Working Group        Standards Track                     [Page 9]
RFC 1903             Textual Conventions for SNMPv2         January 1996
            (2) if other variable bindings included in the same PDU,
            provide values for all columns which are missing but
            required, then return noError and goto D.
            (3) if other variable bindings included in the same PDU,
            provide values for all columns which are missing but
            required, then return noError and goto C.
            (4) at the discretion of the agent, the return value may be
            either:
                 inconsistentName:  because the agent does not choose to
                 create such an instance when the corresponding
                 RowStatus instance does not exist, or
                 inconsistentValue:  if the supplied value is
                 inconsistent with the state of some other MIB object's
                 value, or
                 noError: because the agent chooses to create the
                 instance.
            If noError is returned, then the instance of the status
            column must also be created, and the new state is B or C,
            depending on the information available to the agent.  If
            inconsistentName or inconsistentValue is returned, the row
            remains in state A.
            (5) depending on the MIB definition for the column/table,
            either noError or inconsistentValue may be returned.
            NOTE: Other processing of the set request may result in a
            response other than noError being returned, e.g.,
            wrongValue, noCreation, etc.
                              Conceptual Row Creation
            There are four potential interactions when creating a
            conceptual row:  selecting an instance-identifier which is
            not in use; creating the conceptual row; initializing any
            objects for which the agent does not supply a default; and,
            making the conceptual row available for use by the managed
            device.
            Interaction 1: Selecting an Instance-Identifier
            The algorithm used to select an instance-identifier varies
            for each conceptual row.  In some cases, the instance-
            identifier is semantically significant, e.g., the
            destination address of a route, and a management station
            selects the instance-identifier according to the semantics.
            In other cases, the instance-identifier is used solely to
            distinguish conceptual rows, and a management station
            without specific knowledge of the conceptual row might
            examine the instances present in order to determine an
            unused instance-identifier.  (This approach may be used, but
            it is often highly sub-optimal; however, it is also a
            questionable practice for a naive management station to
            attempt conceptual row creation.)
            Alternately, the MIB module which defines the conceptual row
            might provide one or more objects which provide assistance
            in determining an unused instance-identifier.  For example,
            if the conceptual row is indexed by an integer-value, then
            an object having an integer-valued SYNTAX clause might be
            defined for such a purpose, allowing a management station to
            issue a management protocol retrieval operation.  In order
            to avoid unnecessary collisions between competing management
            stations, `adjacent' retrievals of this object should be
            different.
            Finally, the management station could select a pseudo-random
            number to use as the index.  In the event that this index
            was already in use and an inconsistentValue was returned in
            response to the management protocol set operation, the
            management station should simply select a new pseudo-random
            number and retry the operation.
            A MIB designer should choose between the two latter
            algorithms based on the size of the table (and therefore the
            efficiency of each algorithm).  For tables in which a large
            number of entries are expected, it is recommended that a MIB
            object be defined that returns an acceptable index for
            creation.  For tables with small numbers of entries, it is
            recommended that the latter pseudo-random index mechanism be
            used.
            Interaction 2: Creating the Conceptual Row
            Once an unused instance-identifier has been selected, the
            management station determines if it wishes to create and
            activate the conceptual row in one transaction or in a
            negotiated set of interactions.
            Interaction 2a: Creating and Activating the Conceptual Row
            The management station must first determine the column
            requirements, i.e., it must determine those columns for
            which it must or must not provide values.  Depending on the
            complexity of the table and the management station's
            knowledge of the agent's capabilities, this determination
            can be made locally by the management station.  Alternately,
            the management station issues a management protocol get
            operation to examine all columns in the conceptual row that
            it wishes to create.  In response, for each column, there
            are three possible outcomes:
                 - a value is returned, indicating that some other
                 management station has already created this conceptual
                 row.  We return to interaction 1.
                 - the exception `noSuchInstance' is returned,
                 indicating that the agent implements the object-type
                 associated with this column, and that this column in at
                 least one conceptual row would be accessible in the MIB
                 view used by the retrieval were it to exist. For those
                 columns to which the agent provides read-create access,
                 the `noSuchInstance' exception tells the management
                 station that it should supply a value for this column
                 when the conceptual row is to be created.
                 - the exception `noSuchObject' is returned, indicating
                 that the agent does not implement the object-type
                 associated with this column or that there is no
                 conceptual row for which this column would be
                 accessible in the MIB view used by the retrieval.  As
                 such, the management station can not issue any
                 management protocol set operations to create an
                 instance of this column.
            Once the column requirements have been determined, a
            management protocol set operation is accordingly issued.
            This operation also sets the new instance of the status
            column to `createAndGo'.
            When the agent processes the set operation, it verifies that
            it has sufficient information to make the conceptual row
            available for use by the managed device.  The information
            available to the agent is provided by two sources:  the
            management protocol set operation which creates the
            conceptual row, and, implementation-specific defaults
            supplied by the agent (note that an agent must provide
            implementation-specific defaults for at least those objects
            which it implements as read-only).  If there is sufficient
            information available, then the conceptual row is created, a
            `noError' response is returned, the status column is set to
            `active', and no further interactions are necessary (i.e.,
            interactions 3 and 4 are skipped).  If there is insufficient
            information, then the conceptual row is not created, and the
            set operation fails with an error of `inconsistentValue'.
            On this error, the management station can issue a management
            protocol retrieval operation to determine if this was
            because it failed to specify a value for a required column,
            or, because the selected instance of the status column
            already existed.  In the latter case, we return to
            interaction 1.  In the former case, the management station
            can re-issue the set operation with the additional
            information, or begin interaction 2 again using
            `createAndWait' in order to negotiate creation of the
            conceptual row.
                                     NOTE WELL
                 Regardless of the method used to determine the column
                 requirements, it is possible that the management
                 station might deem a column necessary when, in fact,
                 the agent will not allow that particular columnar
                 instance to be created or written.  In this case, the
                 management protocol set operation will fail with an
                 error such as `noCreation' or `notWritable'.  In this
                 case, the management station decides whether it needs
                 to be able to set a value for that particular columnar
                 instance.  If not, the management station re-issues the
                 management protocol set operation, but without setting
                 a value for that particular columnar instance;
                 otherwise, the management station aborts the row
                 creation algorithm.
            Interaction 2b: Negotiating the Creation of the Conceptual
            Row
            The management station issues a management protocol set
            operation which sets the desired instance of the status
            column to `createAndWait'.  If the agent is unwilling to
            process a request of this sort, the set operation fails with
            an error of `wrongValue'.  (As a consequence, such an agent
            must be prepared to accept a single management protocol set
            operation, i.e., interaction 2a above, containing all of the
            columns indicated by its column requirements.)  Otherwise,
            the conceptual row is created, a `noError' response is
            returned, and the status column is immediately set to either
            `notInService' or `notReady', depending on whether it has
            sufficient information to make the conceptual row available
            for use by the managed device.  If there is sufficient
            information available, then the status column is set to
            `notInService'; otherwise, if there is insufficient
            information, then the status column is set to `notReady'.
            Regardless, we proceed to interaction 3.
            Interaction 3: Initializing non-defaulted Objects
            The management station must now determine the column
            requirements.  It issues a management protocol get operation
            to examine all columns in the created conceptual row.  In
            the response, for each column, there are three possible
            outcomes:
                 - a value is returned, indicating that the agent
                 implements the object-type associated with this column
                 and had sufficient information to provide a value.  For
                 those columns to which the agent provides read-create
                 access (and for which the agent allows their values to
                 be changed after their creation), a value return tells
                 the management station that it may issue additional
                 management protocol set operations, if it desires, in
                 order to change the value associated with this column.
                 - the exception `noSuchInstance' is returned,
                 indicating that the agent implements the object-type
                 associated with this column, and that this column in at
                 least one conceptual row would be accessible in the MIB
                 view used by the retrieval were it to exist. However,
                 the agent does not have sufficient information to
                 provide a value, and until a value is provided, the
                 conceptual row may not be made available for use by the
                 managed device.  For those columns to which the agent
                 provides read-create access, the `noSuchInstance'
                 exception tells the management station that it must
                 issue additional management protocol set operations, in
                 order to provide a value associated with this column.
                 - the exception `noSuchObject' is returned, indicating
                 that the agent does not implement the object-type
                 associated with this column or that there is no
                 conceptual row for which this column would be
                 accessible in the MIB view used by the retrieval.  As
                 such, the management station can not issue any
                 management protocol set operations to create an
                 instance of this column.
            If the value associated with the status column is
            `notReady', then the management station must first deal with
            all `noSuchInstance' columns, if any.  Having done so, the
            value of the status column becomes `notInService', and we
            proceed to interaction 4.
            Interaction 4: Making the Conceptual Row Available
            Once the management station is satisfied with the values
            associated with the columns of the conceptual row, it issues
            a management protocol set operation to set the status column
            to `active'.  If the agent has sufficient information to
            make the conceptual row available for use by the managed
            device, the management protocol set operation succeeds (a
            `noError' response is returned).  Otherwise, the management
            protocol set operation fails with an error of
            `inconsistentValue'.
                                     NOTE WELL
                 A conceptual row having a status column with value
                 `notInService' or `notReady' is unavailable to the
                 managed device.  As such, it is possible for the
                 managed device to create its own instances during the
                 time between the management protocol set operation
                 which sets the status column to `createAndWait' and the
                 management protocol set operation which sets the status
                 column to `active'.  In this case, when the management
                 protocol set operation is issued to set the status
                 column to `active', the values held in the agent
                 supersede those used by the managed device.
            If the management station is prevented from setting the
            status column to `active' (e.g., due to management station
            or network failure) the conceptual row will be left in the
            `notInService' or `notReady' state, consuming resources
            indefinitely.  The agent must detect conceptual rows that
            have been in either state for an abnormally long period of
            time and remove them.  It is the responsibility of the
            DESCRIPTION clause of the status column to indicate what an
            abnormally long period of time would be.  This period of
            time should be long enough to allow for human response time
            (including `think time') between the creation of the
            conceptual row and the setting of the status to `active'.
            In the absense of such information in the DESCRIPTION
            clause, it is suggested that this period be approximately 5
            minutes in length.  This removal action applies not only to
            newly-created rows, but also to previously active rows which
            are set to, and left in, the notInService state for a
            prolonged period exceeding that which is considered normal
            for such a conceptual row.
                             Conceptual Row Suspension
            When a conceptual row is `active', the management station
            may issue a management protocol set operation which sets the
            instance of the status column to `notInService'.  If the
            agent is unwilling to do so, the set operation fails with an
            error of `wrongValue'.  Otherwise, the conceptual row is
            taken out of service, and a `noError' response is returned.
            It is the responsibility of the DESCRIPTION clause of the
            status column to indicate under what circumstances the
            status column should be taken out of service (e.g., in order
            for the value of some other column of the same conceptual
            row to be modified).
                              Conceptual Row Deletion
            For deletion of conceptual rows, a management protocol set
            operation is issued which sets the instance of the status
            column to `destroy'.  This request may be made regardless of
            the current value of the status column (e.g., it is possible
            to delete conceptual rows which are either `notReady',
            `notInService' or `active'.)  If the operation succeeds,
            then all instances associated with the conceptual row are
            immediately removed."
    SYNTAX       INTEGER {
                     -- the following two values are states:
                     -- these values may be read or written
                     active(1),
                     notInService(2),
                     -- the following value is a state:
                     -- this value may be read, but not written
                     notReady(3),
                     -- the following three values are
                     -- actions: these values may be written,
                     --   but are never read
                     createAndGo(4),
                     createAndWait(5),
                     destroy(6)
                 }
TimeStamp ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION
            "The value of the sysUpTime object at which a specific
            occurrence happened.  The specific occurrence must be
            defined in the description of any object defined using this
            type."
    SYNTAX       TimeTicks
TimeInterval ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION
            "A period of time, measured in units of 0.01 seconds."
    SYNTAX       INTEGER (0..2147483647)
DateAndTime ::= TEXTUAL-CONVENTION
    DISPLAY-HINT "2d-1d-1d,1d:1d:1d.1d,1a1d:1d"
    STATUS       current
    DESCRIPTION
            "A date-time specification.
            field  octets  contents                  range
            -----  ------  --------                  -----
              1      1-2   year                      0..65536
              2       3    month                     1..12
              3       4    day                       1..31
              4       5    hour                      0..23
              5       6    minutes                   0..59
              6       7    seconds                   0..60
                           (use 60 for leap-second)
              7       8    deci-seconds              0..9
              8       9    direction from UTC        '+' / '-'
              9      10    hours from UTC            0..11
             10      11    minutes from UTC          0..59
            For example, Tuesday May 26, 1992 at 1:30:15 PM EDT would be
            displayed as:
                             1992-5-26,13:30:15.0,-4:0
            Note that if only local time is known, then timezone
            information (fields 8-10) is not present."
    SYNTAX       OCTET STRING (SIZE (8 | 11))
StorageType ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION
            "Describes the memory realization of a conceptual row.  A
            row which is volatile(2) is lost upon reboot.  A row which
            is either nonVolatile(3), permanent(4) or readOnly(5), is
            backed up by stable storage.  A row which is permanent(4)
            can be changed but not deleted.  A row which is readOnly(5)
            cannot be changed nor deleted.
            If the value of an object with this syntax is either
            permanent(4) or readOnly(5), it cannot be modified.
            Conversely, if the value is either other(1), volatile(2) or
            nonVolatile(3), it cannot be modified to be permanent(4) or
            readOnly(5).
            Every usage of this textual convention is required to
            specify the columnar objects which a permanent(4) row must
            at a minimum allow to be writable."
    SYNTAX       INTEGER {
                     other(1),       -- eh?
                     volatile(2),    -- e.g., in RAM
                     nonVolatile(3), -- e.g., in NVRAM
                     permanent(4),   -- e.g., partially in ROM
                     readOnly(5)     -- e.g., completely in ROM
                 }
TDomain ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION
          "Denotes a kind of transport service.
          Some possible values, such as snmpUDPDomain, are defined in
          'Transport Mappings for Version 2 of the Simple Network
          Management Protocol (SNMPv2)'."
    SYNTAX       OBJECT IDENTIFIER
TAddress ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION
          "Denotes a transport service address.
          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 (SNMPv2)' for further information on
          snmpUDPDomain."
    SYNTAX       OCTET STRING (SIZE (1..255))
---------------------------------------------------
-- from RFC 2571: Textual Conventions for SNMPv3 --
---------------------------------------------------
   SnmpEngineID ::= TEXTUAL-CONVENTION
       STATUS       current
       DESCRIPTION "An SNMP engine's administratively-unique identifier.
                    Objects of this type are for identification, not for
                    addressing, even though it is possible that an
                    address may have been used in the generation of
                    a specific value.
                    The value for this object may not be all zeros or
                    all 'ff'H or the empty (zero length) string.
                    The initial value for this object may be configured
                    via an operator console entry or via an algorithmic
                    function.  In the latter case, the following
                    example algorithm is recommended.
                    In cases where there are multiple engines on the
                    same system, the use of this algorithm is NOT
                    appropriate, as it would result in all of those
                    engines ending up with the same ID value.
                    1) The very first bit is used to indicate how the
                       rest of the data is composed.
                       0 - as defined by enterprise using former methods
                           that existed before SNMPv3. See item 2 below.
                       1 - as defined by this architecture, see item 3
                           below.
                       Note that this allows existing uses of the
                       engineID (also known as AgentID [RFC1910]) to
                       co-exist with any new uses.
                    2) The snmpEngineID has a length of 12 octets.
                       The first four octets are set to the binary
                       equivalent of the agent's SNMP management
                       private enterprise number as assigned by the
                       Internet Assigned Numbers Authority (IANA).
                       For example, if Acme Networks has been assigned
                       { enterprises 696 }, the first four octets would
                       be assigned '000002b8'H.
                       The remaining eight octets are determined via
                       one or more enterprise-specific methods. Such
                       methods must be designed so as to maximize the
                       possibility that the value of this object will
                       be unique in the agent's administrative domain.
                       For example, it may be the IP address of the SNMP
                       entity, or the MAC address of one of the
                       interfaces, with each address suitably padded
                       with random octets.  If multiple methods are
                       defined, then it is recommended that the first
                       octet indicate the method being used and the
                       remaining octets be a function of the method.
                    3) The length of the octet strings varies.
                       The first four octets are set to the binary
                       equivalent of the agent's SNMP management
                       private enterprise number as assigned by the
                       Internet Assigned Numbers Authority (IANA).
                       For example, if Acme Networks has been assigned
                       { enterprises 696 }, the first four octets would
                       be assigned '000002b8'H.
                       The very first bit is set to 1. For example, the
                       above value for Acme Networks now changes to be
                       '800002b8'H.
                       The fifth octet indicates how the rest (6th and
                       following octets) are formatted. The values for
                       the fifth octet are:
                         0     - reserved, unused.
                         1     - IPv4 address (4 octets)
                                 lowest non-special IP address
                         2     - IPv6 address (16 octets)
                                 lowest non-special IP address
                         3     - MAC address (6 octets)
                                 lowest IEEE MAC address, canonical
                                 order
                         4     - Text, administratively assigned
                                 Maximum remaining length 27
                         5     - Octets, administratively assigned
                                 Maximum remaining length 27
                         6-127 - reserved, unused
                       127-255 - as defined by the enterprise
                                 Maximum remaining length 27
                   "
       SYNTAX       OCTET STRING (SIZE(5..32))
   SnmpSecurityModel ::= TEXTUAL-CONVENTION
       STATUS       current
       DESCRIPTION "An identifier that uniquely identifies a
                    securityModel of the Security Subsystem within the
                    SNMP Management Architecture.
                    The values for securityModel are allocated as
                    follows:
                    - The zero value is reserved.
                    - Values between 1 and 255, inclusive, are reserved
                      for standards-track Security Models and are
                      managed by the Internet Assigned Numbers Authority
                      (IANA).
                    - Values greater than 255 are allocated to
                      enterprise-specific Security Models.  An
                      enterprise-specific securityModel value is defined
                      to be:
                      enterpriseID * 256 + security model within
                      enterprise
                      For example, the fourth Security Model defined by
                      the enterprise whose enterpriseID is 1 would be
                      260.
                    This scheme for allocation of securityModel
                    values allows for a maximum of 255 standards-
                    based Security Models, and for a maximum of
                    255 Security Models per enterprise.
                    It is believed that the assignment of new
                    securityModel values will be rare in practice
                    because the larger the number of simultaneously
                    utilized Security Models, the larger the
                    chance that interoperability will suffer.
                    Consequently, it is believed that such a range
                    will be sufficient.  In the unlikely event that
                    the standards committee finds this number to be
                    insufficient over time, an enterprise number
                    can be allocated to obtain an additional 255
                    possible values.
                    Note that the most significant bit must be zero;
                    hence, there are 23 bits allocated for various
                    organizations to design and define non-standard
                    securityModels.  This limits the ability to
                    define new proprietary implementations of Security
                    Models to the first 8,388,608 enterprises.
                    It is worthwhile to note that, in its encoded
                    form, the securityModel value will normally
                    require only a single byte since, in practice,
                    the leftmost bits will be zero for most messages
                    and sign extension is suppressed by the encoding
                    rules.
                    As of this writing, there are several values
                    of securityModel defined for use with SNMP or
                    reserved for use with supporting MIB objects.
                    They are as follows:
                        0  reserved for 'any'
                        1  reserved for SNMPv1
                        2  reserved for SNMPv2c
                        3  User-Based Security Model (USM)
                   "
       SYNTAX       INTEGER(0 .. 2147483647)
   SnmpMessageProcessingModel ::= TEXTUAL-CONVENTION
       STATUS       current
       DESCRIPTION "An identifier that uniquely identifies a Message
                    Processing Model of the Message Processing
                    Subsystem within a SNMP Management Architecture.
                    The values for messageProcessingModel are
                    allocated as follows:
                    - Values between 0 and 255, inclusive, are
                      reserved for standards-track Message Processing
                      Models and are managed by the Internet Assigned
                      Numbers Authority (IANA).
                    - Values greater than 255 are allocated to
                      enterprise-specific Message Processing Models.
                      An enterprise messageProcessingModel value is
                      defined to be:
                      enterpriseID * 256 +
                           messageProcessingModel within enterprise
                      For example, the fourth Message Processing Model
                      defined by the enterprise whose enterpriseID
                      is 1 would be 260.
                    This scheme for allocating messageProcessingModel
                    values allows for a maximum of 255 standards-
                    based Message Processing Models, and for a
                    maximum of 255 Message Processing Models per
                    enterprise.
                    It is believed that the assignment of new
                    messageProcessingModel values will be rare
                    in practice because the larger the number of
                    simultaneously utilized Message Processing Models,
                    the larger the chance that interoperability
                    will suffer. It is believed that such a range
                    will be sufficient.  In the unlikely event that
                    the standards committee finds this number to be
                    insufficient over time, an enterprise number
                    can be allocated to obtain an additional 256
                    possible values.
                    Note that the most significant bit must be zero;
                    hence, there are 23 bits allocated for various
                    organizations to design and define non-standard
                    messageProcessingModels.  This limits the ability
                    to define new proprietary implementations of
                    Message Processing Models to the first 8,388,608
                    enterprises.
                    It is worthwhile to note that, in its encoded
                    form, the messageProcessingModel value will
                    normally require only a single byte since, in
                    practice, the leftmost bits will be zero for
                    most messages and sign extension is suppressed
                    by the encoding rules.
                    As of this writing, there are several values of
                    messageProcessingModel defined for use with SNMP.
                    They are as follows:
                        0  reserved for SNMPv1
                        1  reserved for SNMPv2c
                        2  reserved for SNMPv2u and SNMPv2*
                        3  reserved for SNMPv3
                   "
       SYNTAX       INTEGER(0 .. 2147483647)
   SnmpSecurityLevel ::= TEXTUAL-CONVENTION
       STATUS       current
       DESCRIPTION "A Level of Security at which SNMP messages can be
                    sent or with which operations are being processed;
                    in particular, one of:
                      noAuthNoPriv - without authentication and
                                     without privacy,
                      authNoPriv   - with authentication but
                                     without privacy,
                      authPriv     - with authentication and
                                     with privacy.
                    These three values are ordered such that
                    noAuthNoPriv is less than authNoPriv and
                    authNoPriv is less than authPriv.
                   "
       SYNTAX       INTEGER { noAuthNoPriv(1),
                              authNoPriv(2),
                              authPriv(3)
                            }
   SnmpAdminString ::= TEXTUAL-CONVENTION
       DISPLAY-HINT "255a"
       STATUS       current
       DESCRIPTION "An octet string containing administrative
                    information, preferably in human-readable form.
                    To facilitate internationalization, this
                    information is represented using the ISO/IEC
                    IS 10646-1 character set, encoded as an octet
                    string using the UTF-8 transformation format
                    described in [RFC2279].
                    Since additional code points are added by
                    amendments to the 10646 standard from time
                    to time, implementations must be prepared to
                    encounter any code point from 0x00000000 to
                    0x7fffffff.  Byte sequences that do not
                    correspond to the valid UTF-8 encoding of a
                    code point or are outside this range are
                    prohibited.
                    The use of control codes should be avoided.
                    When it is necessary to represent a newline,
                    the control code sequence CR LF should be used.
                    The use of leading or trailing white space should
                    be avoided.
                    For code points not directly supported by user
                    interface hardware or software, an alternative
                    means of entry and display, such as hexadecimal,
                    may be provided.
                    For information encoded in 7-bit US-ASCII,
                    the UTF-8 encoding is identical to the
                    US-ASCII encoding.
                    UTF-8 may require multiple bytes to represent a
                    single character / code point; thus the length
                    of this object in octets may be different from
                    the number of characters encoded.  Similarly,
                    size constraints refer to the number of encoded
                    octets, not the number of characters represented
                    by an encoding.
                    Note that when this TC is used for an object that
                    is used or envisioned to be used as an index, then
                    a SIZE restriction MUST be specified so that the
                    number of sub-identifiers for any object instance
                    does not exceed the limit of 128, as defined by
                    [RFC1905].
                    Note that the size of an SnmpAdminString object is
                    measured in octets, not characters.
                   "
       SYNTAX       DisplayString (SIZE (0..255))
---------------------------------------------------
-- from RFC 2574: Textual Conventions for SNMPv3 --
---------------------------------------------------
KeyChange ::=     TEXTUAL-CONVENTION
   STATUS         current
   DESCRIPTION
         "Every definition of an object with this syntax must identify
          a protocol P, a secret key K, and a hash algorithm H
          that produces output of L octets.
          The object's value is a manager-generated, partially-random
          value which, when modified, causes the value of the secret
          key K, to be modified via a one-way function.
          The value of an instance of this object is the concatenation
          of two components: first a 'random' component and then a
          'delta' component.
          The lengths of the random and delta components
          are given by the corresponding value of the protocol P;
          if P requires K to be a fixed length, the length of both the
          random and delta components is that fixed length; if P
          allows the length of K to be variable up to a particular
          maximum length, the length of the random component is that
          maximum length and the length of the delta component is any
          length less than or equal to that maximum length.
          For example, usmHMACMD5AuthProtocol requires K to be a fixed
          length of 16 octets and L - of 16 octets.
          usmHMACSHAAuthProtocol requires K to be a fixed length of
          20 octets and L - of 20 octets. Other protocols may define
          other sizes, as deemed appropriate.
          When a requester wants to change the old key K to a new
          key keyNew on a remote entity, the 'random' component is
          obtained from either a true random generator, or from a
          pseudorandom generator, and the 'delta' component is
          computed as follows:
           - a temporary variable is initialized to the existing value
             of K;
           - if the length of the keyNew is greater than L octets,
             then:
              - the random component is appended to the value of the
                temporary variable, and the result is input to the
                the hash algorithm H to produce a digest value, and
                the temporary variable is set to this digest value;
              - the value of the temporary variable is XOR-ed with
                the first (next) L-octets (16 octets in case of MD5)
                of the keyNew to produce the first (next) L-octets
                (16 octets in case of MD5) of the 'delta' component.
              - the above two steps are repeated until the unused
                portion of the keyNew component is L octets or less,
           - the random component is appended to the value of the
             temporary variable, and the result is input to the
             hash algorithm H to produce a digest value;
           - this digest value, truncated if necessary to be the same
             length as the unused portion of the keyNew, is XOR-ed
             with the unused portion of the keyNew to produce the
             (final portion of the) 'delta' component.
           For example, using MD5 as the hash algorithm H:
              iterations = (lenOfDelta - 1)/16; /* integer division */
              temp = keyOld;
              for (i = 0; i < iterations; i++) {
                  temp = MD5 (temp || random);
                  delta[i*16 .. (i*16)+15] =
                         temp XOR keyNew[i*16 .. (i*16)+15];
              }
              temp = MD5 (temp || random);
              delta[i*16 .. lenOfDelta-1] =
                     temp XOR keyNew[i*16 .. lenOfDelta-1];
          The 'random' and 'delta' components are then concatenated as
          described above, and the resulting octet string is sent to
          the recipient as the new value of an instance of this object.
          At the receiver side, when an instance of this object is set
          to a new value, then a new value of K is computed as follows:
           - a temporary variable is initialized to the existing value
             of K;
           - if the length of the delta component is greater than L
             octets, then:
              - the random component is appended to the value of the
                temporary variable, and the result is input to the
                hash algorithm H to produce a digest value, and the
                temporary variable is set to this digest value;
              - the value of the temporary variable is XOR-ed with
                the first (next) L-octets (16 octets in case of MD5)
                of the delta component to produce the first (next)
                L-octets (16 octets in case of MD5) of the new value
                of K.
              - the above two steps are repeated until the unused
                portion of the delta component is L octets or less,
           - the random component is appended to the value of the
             temporary variable, and the result is input to the
             hash algorithm H to produce a digest value;
           - this digest value, truncated if necessary to be the same
             length as the unused portion of the delta component, is
             XOR-ed with the unused portion of the delta component to
             produce the (final portion of the) new value of K.
           For example, using MD5 as the hash algorithm H:
              iterations = (lenOfDelta - 1)/16; /* integer division */
              temp = keyOld;
              for (i = 0; i < iterations; i++) {
                  temp = MD5 (temp || random);
                  keyNew[i*16 .. (i*16)+15] =
                         temp XOR delta[i*16 .. (i*16)+15];
              }
              temp = MD5 (temp || random);
              keyNew[i*16 .. lenOfDelta-1] =
                     temp XOR delta[i*16 .. lenOfDelta-1];
          The value of an object with this syntax, whenever it is
          retrieved by the management protocol, is always the zero
          length string.
          Note that the keyOld and keyNew are the localized keys.
          Note that it is probably wise that when an SNMP entity sends
          a SetRequest to change a key, that it keeps a copy of the old
          key until it has confirmed that the key change actually
          succeeded.
         "
    SYNTAX       OCTET STRING
-----------------
-- entreprises --
-----------------
    sun     OBJECT IDENTIFIER ::= { enterprises 42 }
    messaging   OBJECT IDENTIFIER ::= { sun products(2) 8 }
    agents      OBJECT IDENTIFIER ::= { messaging 1 }
    private-mibs    OBJECT IDENTIFIER ::= { messaging 2 }
    snmpx400d   OBJECT IDENTIFIER ::= { agents 1 }
    snmpxapiad  OBJECT IDENTIFIER ::= { agents 2 }
    snmpx500d   OBJECT IDENTIFIER ::= { agents 3 }
    snmpimd     OBJECT IDENTIFIER ::= { agents 4 }
    snmpslapd   OBJECT IDENTIFIER ::= { agents 5 }
END
opends/src/snmp/resource/mib/rfc1213.txt
New file
@@ -0,0 +1,3059 @@
RFC1213-MIB DEFINITIONS ::= BEGIN
          IMPORTS
                  mgmt, NetworkAddress, IpAddress, Counter, Gauge,
                          TimeTicks
                      FROM RFC1155-SMI
                  OBJECT-TYPE
                          FROM RFC-1212;
          --  This MIB module uses the extended OBJECT-TYPE macro as
          --  defined in [14];
          --  MIB-II (same prefix as MIB-I)
          mib-2      OBJECT IDENTIFIER ::= { mgmt 1 }
          -- textual conventions
          DisplayString ::=
              OCTET STRING
          -- This data type is used to model textual information taken
          -- from the NVT ASCII character set.  By convention, objects
          -- with this syntax are declared as having
SNMP Working Group                                             [Page 12]
RFC 1213                         MIB-II                       March 1991
          --
          --      SIZE (0..255)
          PhysAddress ::=
              OCTET STRING
          -- This data type is used to model media addresses.  For many
          -- types of media, this will be in a binary representation.
          -- For example, an ethernet address would be represented as
          -- a string of 6 octets.
          -- groups in MIB-II
          system       OBJECT IDENTIFIER ::= { mib-2 1 }
          interfaces   OBJECT IDENTIFIER ::= { mib-2 2 }
          at           OBJECT IDENTIFIER ::= { mib-2 3 }
          ip           OBJECT IDENTIFIER ::= { mib-2 4 }
          icmp         OBJECT IDENTIFIER ::= { mib-2 5 }
          tcp          OBJECT IDENTIFIER ::= { mib-2 6 }
          udp          OBJECT IDENTIFIER ::= { mib-2 7 }
          egp          OBJECT IDENTIFIER ::= { mib-2 8 }
          -- historical (some say hysterical)
          -- cmot      OBJECT IDENTIFIER ::= { mib-2 9 }
          transmission OBJECT IDENTIFIER ::= { mib-2 10 }
          snmp         OBJECT IDENTIFIER ::= { mib-2 11 }
          -- the System group
          -- Implementation of the System group is mandatory for all
          -- systems.  If an agent is not configured to have a value
          -- for any of these variables, a string of length 0 is
          -- returned.
          sysDescr OBJECT-TYPE
              SYNTAX  DisplayString (SIZE (0..255))
              ACCESS  read-only
              STATUS  mandatory
SNMP Working Group                                             [Page 13]
RFC 1213                         MIB-II                       March 1991
              DESCRIPTION
                      "A textual description of the entity.  This value
                      should include the full name and version
                      identification of the system's hardware type,
                      software operating-system, and networking
                      software.  It is mandatory that this only contain
                      printable ASCII characters."
              ::= { system 1 }
          sysObjectID OBJECT-TYPE
              SYNTAX  OBJECT IDENTIFIER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The vendor's authoritative identification of the
                      network management subsystem contained in the
                      entity.  This value is allocated within the SMI
                      enterprises subtree (1.3.6.1.4.1) and provides an
                      easy and unambiguous means for determining `what
                      kind of box' is being managed.  For example, if
                      vendor `Flintstones, Inc.' was assigned the
                      subtree 1.3.6.1.4.1.4242, it could assign the
                      identifier 1.3.6.1.4.1.4242.1.1 to its `Fred
                      Router'."
              ::= { system 2 }
          sysUpTime OBJECT-TYPE
              SYNTAX  TimeTicks
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The time (in hundredths of a second) since the
                      network management portion of the system was last
                      re-initialized."
              ::= { system 3 }
          sysContact OBJECT-TYPE
              SYNTAX  DisplayString (SIZE (0..255))
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The textual identification of the contact person
                      for this managed node, together with information
                      on how to contact this person."
              ::= { system 4 }
          sysName OBJECT-TYPE
              SYNTAX  DisplayString (SIZE (0..255))
SNMP Working Group                                             [Page 14]
RFC 1213                         MIB-II                       March 1991
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "An administratively-assigned name for this
                      managed node.  By convention, this is the node's
                      fully-qualified domain name."
              ::= { system 5 }
          sysLocation OBJECT-TYPE
              SYNTAX  DisplayString (SIZE (0..255))
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The physical location of this node (e.g.,
                      `telephone closet, 3rd floor')."
              ::= { system 6 }
          sysServices OBJECT-TYPE
              SYNTAX  INTEGER (0..127)
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "A value which indicates the set of services that
                      this entity primarily offers.
                      The value is a sum.  This sum initially takes the
                      value zero, Then, for each layer, L, in the range
                      1 through 7, that this node performs transactions
                      for, 2 raised to (L - 1) is added to the sum.  For
                      example, a node which performs primarily routing
                      functions would have a value of 4 (2^(3-1)).  In
                      contrast, a node which is a host offering
                      application services would have a value of 72
                      (2^(4-1) + 2^(7-1)).  Note that in the context of
                      the Internet suite of protocols, values should be
                      calculated accordingly:
                           layer  functionality
                               1  physical (e.g., repeaters)
                               2  datalink/subnetwork (e.g., bridges)
                               3  internet (e.g., IP gateways)
                               4  end-to-end  (e.g., IP hosts)
                               7  applications (e.g., mail relays)
                      For systems including OSI protocols, layers 5 and
                      6 may also be counted."
              ::= { system 7 }
SNMP Working Group                                             [Page 15]
RFC 1213                         MIB-II                       March 1991
          -- the Interfaces group
          -- Implementation of the Interfaces group is mandatory for
          -- all systems.
          ifNumber OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of network interfaces (regardless of
                      their current state) present on this system."
              ::= { interfaces 1 }
          -- the Interfaces table
          -- The Interfaces table contains information on the entity's
          -- interfaces.  Each interface is thought of as being
          -- attached to a `subnetwork'.  Note that this term should
          -- not be confused with `subnet' which refers to an
          -- addressing partitioning scheme used in the Internet suite
          -- of protocols.
          ifTable OBJECT-TYPE
              SYNTAX  SEQUENCE OF IfEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "A list of interface entries.  The number of
                      entries is given by the value of ifNumber."
              ::= { interfaces 2 }
          ifEntry OBJECT-TYPE
              SYNTAX  IfEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "An interface entry containing objects at the
                      subnetwork layer and below for a particular
                      interface."
              INDEX   { ifIndex }
              ::= { ifTable 1 }
          IfEntry ::=
              SEQUENCE {
                  ifIndex
                      INTEGER,
SNMP Working Group                                             [Page 16]
RFC 1213                         MIB-II                       March 1991
                  ifDescr
                      DisplayString,
                  ifType
                      INTEGER,
                  ifMtu
                      INTEGER,
                  ifSpeed
                      Gauge,
                  ifPhysAddress
                      PhysAddress,
                  ifAdminStatus
                      INTEGER,
                  ifOperStatus
                      INTEGER,
                  ifLastChange
                      TimeTicks,
                  ifInOctets
                      Counter,
                  ifInUcastPkts
                      Counter,
                  ifInNUcastPkts
                      Counter,
                  ifInDiscards
                      Counter,
                  ifInErrors
                      Counter,
                  ifInUnknownProtos
                      Counter,
                  ifOutOctets
                      Counter,
                  ifOutUcastPkts
                      Counter,
                  ifOutNUcastPkts
                      Counter,
                  ifOutDiscards
                      Counter,
                  ifOutErrors
                      Counter,
                  ifOutQLen
                      Gauge,
                  ifSpecific
                      OBJECT IDENTIFIER
              }
          ifIndex OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
SNMP Working Group                                             [Page 17]
RFC 1213                         MIB-II                       March 1991
              DESCRIPTION
                      "A unique value for each interface.  Its value
                      ranges between 1 and the value of ifNumber.  The
                      value for each interface must remain constant at
                      least from one re-initialization of the entity's
                      network management system to the next re-
                      initialization."
              ::= { ifEntry 1 }
          ifDescr OBJECT-TYPE
              SYNTAX  DisplayString (SIZE (0..255))
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "A textual string containing information about the
                      interface.  This string should include the name of
                      the manufacturer, the product name and the version
                      of the hardware interface."
              ::= { ifEntry 2 }
          ifType OBJECT-TYPE
              SYNTAX  INTEGER {
                          other(1),          -- none of the following
                          regular1822(2),
                          hdh1822(3),
                          ddn-x25(4),
                          rfc877-x25(5),
                          ethernet-csmacd(6),
                          iso88023-csmacd(7),
                          iso88024-tokenBus(8),
                          iso88025-tokenRing(9),
                          iso88026-man(10),
                          starLan(11),
                          proteon-10Mbit(12),
                          proteon-80Mbit(13),
                          hyperchannel(14),
                          fddi(15),
                          lapb(16),
                          sdlc(17),
                          ds1(18),           -- T-1
                          e1(19),            -- european equiv. of T-1
                          basicISDN(20),
                          primaryISDN(21),   -- proprietary serial
                          propPointToPointSerial(22),
                          ppp(23),
                          softwareLoopback(24),
                          eon(25),            -- CLNP over IP [11]
                          ethernet-3Mbit(26),
SNMP Working Group                                             [Page 18]
RFC 1213                         MIB-II                       March 1991
                          nsip(27),           -- XNS over IP
                          slip(28),           -- generic SLIP
                          ultra(29),          -- ULTRA technologies
                          ds3(30),            -- T-3
                          sip(31),            -- SMDS
                          frame-relay(32)
                      }
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The type of interface, distinguished according to
                      the physical/link protocol(s) immediately `below'
                      the network layer in the protocol stack."
              ::= { ifEntry 3 }
          ifMtu OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The size of the largest datagram which can be
                      sent/received on the interface, specified in
                      octets.  For interfaces that are used for
                      transmitting network datagrams, this is the size
                      of the largest network datagram that can be sent
                      on the interface."
              ::= { ifEntry 4 }
          ifSpeed OBJECT-TYPE
              SYNTAX  Gauge
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "An estimate of the interface's current bandwidth
                      in bits per second.  For interfaces which do not
                      vary in bandwidth or for those where no accurate
                      estimation can be made, this object should contain
                      the nominal bandwidth."
              ::= { ifEntry 5 }
          ifPhysAddress OBJECT-TYPE
              SYNTAX  PhysAddress
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The interface's address at the protocol layer
                      immediately `below' the network layer in the
                      protocol stack.  For interfaces which do not have
SNMP Working Group                                             [Page 19]
RFC 1213                         MIB-II                       March 1991
                      such an address (e.g., a serial line), this object
                      should contain an octet string of zero length."
              ::= { ifEntry 6 }
          ifAdminStatus OBJECT-TYPE
              SYNTAX  INTEGER {
                          up(1),       -- ready to pass packets
                          down(2),
                          testing(3)   -- in some test mode
                      }
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The desired state of the interface.  The
                      testing(3) state indicates that no operational
                      packets can be passed."
              ::= { ifEntry 7 }
          ifOperStatus OBJECT-TYPE
              SYNTAX  INTEGER {
                          up(1),       -- ready to pass packets
                          down(2),
                          testing(3)   -- in some test mode
                      }
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The current operational state of the interface.
                      The testing(3) state indicates that no operational
                      packets can be passed."
              ::= { ifEntry 8 }
          ifLastChange OBJECT-TYPE
              SYNTAX  TimeTicks
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The value of sysUpTime at the time the interface
                      entered its current operational state.  If the
                      current state was entered prior to the last re-
                      initialization of the local network management
                      subsystem, then this object contains a zero
                      value."
              ::= { ifEntry 9 }
          ifInOctets OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
SNMP Working Group                                             [Page 20]
RFC 1213                         MIB-II                       March 1991
              STATUS  mandatory
              DESCRIPTION
                      "The total number of octets received on the
                      interface, including framing characters."
              ::= { ifEntry 10 }
          ifInUcastPkts OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of subnetwork-unicast packets
                      delivered to a higher-layer protocol."
              ::= { ifEntry 11 }
          ifInNUcastPkts OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of non-unicast (i.e., subnetwork-
                      broadcast or subnetwork-multicast) packets
                      delivered to a higher-layer protocol."
              ::= { ifEntry 12 }
          ifInDiscards OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of inbound packets which were chosen
                      to be discarded even though no errors had been
                      detected to prevent their being deliverable to a
                      higher-layer protocol.  One possible reason for
                      discarding such a packet could be to free up
                      buffer space."
              ::= { ifEntry 13 }
          ifInErrors OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of inbound packets that contained
                      errors preventing them from being deliverable to a
                      higher-layer protocol."
              ::= { ifEntry 14 }
SNMP Working Group                                             [Page 21]
RFC 1213                         MIB-II                       March 1991
          ifInUnknownProtos OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of packets received via the interface
                      which were discarded because of an unknown or
                      unsupported protocol."
              ::= { ifEntry 15 }
          ifOutOctets OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of octets transmitted out of the
                      interface, including framing characters."
              ::= { ifEntry 16 }
          ifOutUcastPkts OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of packets that higher-level
                      protocols requested be transmitted to a
                      subnetwork-unicast address, including those that
                      were discarded or not sent."
              ::= { ifEntry 17 }
          ifOutNUcastPkts OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of packets that higher-level
                      protocols requested be transmitted to a non-
                      unicast (i.e., a subnetwork-broadcast or
                      subnetwork-multicast) address, including those
                      that were discarded or not sent."
              ::= { ifEntry 18 }
          ifOutDiscards OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of outbound packets which were chosen
SNMP Working Group                                             [Page 22]
RFC 1213                         MIB-II                       March 1991
                      to be discarded even though no errors had been
                      detected to prevent their being transmitted.  One
                      possible reason for discarding such a packet could
                      be to free up buffer space."
              ::= { ifEntry 19 }
          ifOutErrors OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of outbound packets that could not be
                      transmitted because of errors."
              ::= { ifEntry 20 }
          ifOutQLen OBJECT-TYPE
              SYNTAX  Gauge
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The length of the output packet queue (in
                      packets)."
              ::= { ifEntry 21 }
          ifSpecific OBJECT-TYPE
              SYNTAX  OBJECT IDENTIFIER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "A reference to MIB definitions specific to the
                      particular media being used to realize the
                      interface.  For example, if the interface is
                      realized by an ethernet, then the value of this
                      object refers to a document defining objects
                      specific to ethernet.  If this information is not
                      present, its value should be set to the OBJECT
                      IDENTIFIER { 0 0 }, which is a syntatically valid
                      object identifier, and any conformant
                      implementation of ASN.1 and BER must be able to
                      generate and recognize this value."
              ::= { ifEntry 22 }
          -- the Address Translation group
          -- Implementation of the Address Translation group is
          -- mandatory for all systems.  Note however that this group
          -- is deprecated by MIB-II. That is, it is being included
SNMP Working Group                                             [Page 23]
RFC 1213                         MIB-II                       March 1991
          -- solely for compatibility with MIB-I nodes, and will most
          -- likely be excluded from MIB-III nodes.  From MIB-II and
          -- onwards, each network protocol group contains its own
          -- address translation tables.
          -- The Address Translation group contains one table which is
          -- the union across all interfaces of the translation tables
          -- for converting a NetworkAddress (e.g., an IP address) into
          -- a subnetwork-specific address.  For lack of a better term,
          -- this document refers to such a subnetwork-specific address
          -- as a `physical' address.
          -- Examples of such translation tables are: for broadcast
          -- media where ARP is in use, the translation table is
          -- equivalent to the ARP cache; or, on an X.25 network where
          -- non-algorithmic translation to X.121 addresses is
          -- required, the translation table contains the
          -- NetworkAddress to X.121 address equivalences.
          atTable OBJECT-TYPE
              SYNTAX  SEQUENCE OF AtEntry
              ACCESS  not-accessible
              STATUS  deprecated
              DESCRIPTION
                      "The Address Translation tables contain the
                      NetworkAddress to `physical' address equivalences.
                      Some interfaces do not use translation tables for
                      determining address equivalences (e.g., DDN-X.25
                      has an algorithmic method); if all interfaces are
                      of this type, then the Address Translation table
                      is empty, i.e., has zero entries."
              ::= { at 1 }
          atEntry OBJECT-TYPE
              SYNTAX  AtEntry
              ACCESS  not-accessible
              STATUS  deprecated
              DESCRIPTION
                      "Each entry contains one NetworkAddress to
                      `physical' address equivalence."
              INDEX   { atIfIndex,
                        atNetAddress }
              ::= { atTable 1 }
          AtEntry ::=
              SEQUENCE {
                  atIfIndex
                      INTEGER,
SNMP Working Group                                             [Page 24]
RFC 1213                         MIB-II                       March 1991
                  atPhysAddress
                      PhysAddress,
                  atNetAddress
                      NetworkAddress
              }
          atIfIndex OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-write
              STATUS  deprecated
              DESCRIPTION
                      "The interface on which this entry's equivalence
                      is effective.  The interface identified by a
                      particular value of this index is the same
                      interface as identified by the same value of
                      ifIndex."
              ::= { atEntry 1 }
          atPhysAddress OBJECT-TYPE
              SYNTAX  PhysAddress
              ACCESS  read-write
              STATUS  deprecated
              DESCRIPTION
                      "The media-dependent `physical' address.
                      Setting this object to a null string (one of zero
                      length) has the effect of invaliding the
                      corresponding entry in the atTable object.  That
                      is, it effectively dissasociates the interface
                      identified with said entry from the mapping
                      identified with said entry.  It is an
                      implementation-specific matter as to whether the
                      agent removes an invalidated entry from the table.
                      Accordingly, management stations must be prepared
                      to receive tabular information from agents that
                      corresponds to entries not currently in use.
                      Proper interpretation of such entries requires
                      examination of the relevant atPhysAddress object."
              ::= { atEntry 2 }
          atNetAddress OBJECT-TYPE
              SYNTAX  NetworkAddress
              ACCESS  read-write
              STATUS  deprecated
              DESCRIPTION
                      "The NetworkAddress (e.g., the IP address)
                      corresponding to the media-dependent `physical'
                      address."
SNMP Working Group                                             [Page 25]
RFC 1213                         MIB-II                       March 1991
              ::= { atEntry 3 }
          -- the IP group
          -- Implementation of the IP group is mandatory for all
          -- systems.
          ipForwarding OBJECT-TYPE
              SYNTAX  INTEGER {
                          forwarding(1),    -- acting as a gateway
                          not-forwarding(2) -- NOT acting as a gateway
                      }
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The indication of whether this entity is acting
                      as an IP gateway in respect to the forwarding of
                      datagrams received by, but not addressed to, this
                      entity.  IP gateways forward datagrams.  IP hosts
                      do not (except those source-routed via the host).
                      Note that for some managed nodes, this object may
                      take on only a subset of the values possible.
                      Accordingly, it is appropriate for an agent to
                      return a `badValue' response if a management
                      station attempts to change this object to an
                      inappropriate value."
              ::= { ip 1 }
          ipDefaultTTL OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The default value inserted into the Time-To-Live
                      field of the IP header of datagrams originated at
                      this entity, whenever a TTL value is not supplied
                      by the transport layer protocol."
              ::= { ip 2 }
          ipInReceives OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of input datagrams received from
                      interfaces, including those received in error."
SNMP Working Group                                             [Page 26]
RFC 1213                         MIB-II                       March 1991
              ::= { ip 3 }
          ipInHdrErrors OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of input datagrams discarded due to
                      errors in their IP headers, including bad
                      checksums, version number mismatch, other format
                      errors, time-to-live exceeded, errors discovered
                      in processing their IP options, etc."
              ::= { ip 4 }
          ipInAddrErrors OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of input datagrams discarded because
                      the IP address in their IP header's destination
                      field was not a valid address to be received at
                      this entity.  This count includes invalid
                      addresses (e.g., 0.0.0.0) and addresses of
                      unsupported Classes (e.g., Class E).  For entities
                      which are not IP Gateways and therefore do not
                      forward datagrams, this counter includes datagrams
                      discarded because the destination address was not
                      a local address."
              ::= { ip 5 }
          ipForwDatagrams OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of input datagrams for which this
                      entity was not their final IP destination, as a
                      result of which an attempt was made to find a
                      route to forward them to that final destination.
                      In entities which do not act as IP Gateways, this
                      counter will include only those packets which were
                      Source-Routed via this entity, and the Source-
                      Route option processing was successful."
              ::= { ip 6 }
          ipInUnknownProtos OBJECT-TYPE
              SYNTAX  Counter
SNMP Working Group                                             [Page 27]
RFC 1213                         MIB-II                       March 1991
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of locally-addressed datagrams
                      received successfully but discarded because of an
                      unknown or unsupported protocol."
              ::= { ip 7 }
          ipInDiscards OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of input IP datagrams for which no
                      problems were encountered to prevent their
                      continued processing, but which were discarded
                      (e.g., for lack of buffer space).  Note that this
                      counter does not include any datagrams discarded
                      while awaiting re-assembly."
              ::= { ip 8 }
          ipInDelivers OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of input datagrams successfully
                      delivered to IP user-protocols (including ICMP)."
              ::= { ip 9 }
          ipOutRequests OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of IP datagrams which local IP
                      user-protocols (including ICMP) supplied to IP in
                      requests for transmission.  Note that this counter
                      does not include any datagrams counted in
                      ipForwDatagrams."
              ::= { ip 10 }
          ipOutDiscards OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of output IP datagrams for which no
SNMP Working Group                                             [Page 28]
RFC 1213                         MIB-II                       March 1991
                      problem was encountered to prevent their
                      transmission to their destination, but which were
                      discarded (e.g., for lack of buffer space).  Note
                      that this counter would include datagrams counted
                      in ipForwDatagrams if any such packets met this
                      (discretionary) discard criterion."
              ::= { ip 11 }
          ipOutNoRoutes OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of IP datagrams discarded because no
                      route could be found to transmit them to their
                      destination.  Note that this counter includes any
                      packets counted in ipForwDatagrams which meet this
                      `no-route' criterion.  Note that this includes any
                      datagarms which a host cannot route because all of
                      its default gateways are down."
              ::= { ip 12 }
          ipReasmTimeout OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The maximum number of seconds which received
                      fragments are held while they are awaiting
                      reassembly at this entity."
              ::= { ip 13 }
          ipReasmReqds OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of IP fragments received which needed
                      to be reassembled at this entity."
              ::= { ip 14 }
          ipReasmOKs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of IP datagrams successfully re-
                      assembled."
SNMP Working Group                                             [Page 29]
RFC 1213                         MIB-II                       March 1991
              ::= { ip 15 }
          ipReasmFails OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of failures detected by the IP re-
                      assembly algorithm (for whatever reason: timed
                      out, errors, etc).  Note that this is not
                      necessarily a count of discarded IP fragments
                      since some algorithms (notably the algorithm in
                      RFC 815) can lose track of the number of fragments
                      by combining them as they are received."
              ::= { ip 16 }
          ipFragOKs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of IP datagrams that have been
                      successfully fragmented at this entity."
              ::= { ip 17 }
          ipFragFails OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of IP datagrams that have been
                      discarded because they needed to be fragmented at
                      this entity but could not be, e.g., because their
                      Don't Fragment flag was set."
              ::= { ip 18 }
          ipFragCreates OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of IP datagram fragments that have
                      been generated as a result of fragmentation at
                      this entity."
              ::= { ip 19 }
SNMP Working Group                                             [Page 30]
RFC 1213                         MIB-II                       March 1991
          -- the IP address table
          -- The IP address table contains this entity's IP addressing
          -- information.
          ipAddrTable OBJECT-TYPE
              SYNTAX  SEQUENCE OF IpAddrEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "The table of addressing information relevant to
                      this entity's IP addresses."
              ::= { ip 20 }
          ipAddrEntry OBJECT-TYPE
              SYNTAX  IpAddrEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "The addressing information for one of this
                      entity's IP addresses."
              INDEX   { ipAdEntAddr }
              ::= { ipAddrTable 1 }
          IpAddrEntry ::=
              SEQUENCE {
                  ipAdEntAddr
                      IpAddress,
                  ipAdEntIfIndex
                      INTEGER,
                  ipAdEntNetMask
                      IpAddress,
                  ipAdEntBcastAddr
                      INTEGER,
                  ipAdEntReasmMaxSize
                      INTEGER (0..65535)
              }
          ipAdEntAddr OBJECT-TYPE
              SYNTAX  IpAddress
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The IP address to which this entry's addressing
                      information pertains."
              ::= { ipAddrEntry 1 }
SNMP Working Group                                             [Page 31]
RFC 1213                         MIB-II                       March 1991
          ipAdEntIfIndex OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The index value which uniquely identifies the
                      interface to which this entry is applicable.  The
                      interface identified by a particular value of this
                      index is the same interface as identified by the
                      same value of ifIndex."
              ::= { ipAddrEntry 2 }
          ipAdEntNetMask OBJECT-TYPE
              SYNTAX  IpAddress
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The subnet mask associated with the IP address of
                      this entry.  The value of the mask is an IP
                      address with all the network bits set to 1 and all
                      the hosts bits set to 0."
              ::= { ipAddrEntry 3 }
          ipAdEntBcastAddr OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The value of the least-significant bit in the IP
                      broadcast address used for sending datagrams on
                      the (logical) interface associated with the IP
                      address of this entry.  For example, when the
                      Internet standard all-ones broadcast address is
                      used, the value will be 1.  This value applies to
                      both the subnet and network broadcasts addresses
                      used by the entity on this (logical) interface."
              ::= { ipAddrEntry 4 }
          ipAdEntReasmMaxSize OBJECT-TYPE
              SYNTAX  INTEGER (0..65535)
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The size of the largest IP datagram which this
                      entity can re-assemble from incoming IP fragmented
                      datagrams received on this interface."
              ::= { ipAddrEntry 5 }
SNMP Working Group                                             [Page 32]
RFC 1213                         MIB-II                       March 1991
          -- the IP routing table
          -- The IP routing table contains an entry for each route
          -- presently known to this entity.
          ipRouteTable OBJECT-TYPE
              SYNTAX  SEQUENCE OF IpRouteEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "This entity's IP Routing table."
              ::= { ip 21 }
          ipRouteEntry OBJECT-TYPE
              SYNTAX  IpRouteEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "A route to a particular destination."
              INDEX   { ipRouteDest }
              ::= { ipRouteTable 1 }
          IpRouteEntry ::=
              SEQUENCE {
                  ipRouteDest
                      IpAddress,
                  ipRouteIfIndex
                      INTEGER,
                  ipRouteMetric1
                      INTEGER,
                  ipRouteMetric2
                      INTEGER,
                  ipRouteMetric3
                      INTEGER,
                  ipRouteMetric4
                      INTEGER,
                  ipRouteNextHop
                      IpAddress,
                  ipRouteType
                      INTEGER,
                  ipRouteProto
                      INTEGER,
                  ipRouteAge
                      INTEGER,
                  ipRouteMask
                      IpAddress,
                  ipRouteMetric5
                      INTEGER,
SNMP Working Group                                             [Page 33]
RFC 1213                         MIB-II                       March 1991
                  ipRouteInfo
                      OBJECT IDENTIFIER
              }
          ipRouteDest OBJECT-TYPE
              SYNTAX  IpAddress
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The destination IP address of this route.  An
                      entry with a value of 0.0.0.0 is considered a
                      default route.  Multiple routes to a single
                      destination can appear in the table, but access to
                      such multiple entries is dependent on the table-
                      access mechanisms defined by the network
                      management protocol in use."
              ::= { ipRouteEntry 1 }
          ipRouteIfIndex OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The index value which uniquely identifies the
                      local interface through which the next hop of this
                      route should be reached.  The interface identified
                      by a particular value of this index is the same
                      interface as identified by the same value of
                      ifIndex."
              ::= { ipRouteEntry 2 }
          ipRouteMetric1 OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The primary routing metric for this route.  The
                      semantics of this metric are determined by the
                      routing-protocol specified in the route's
                      ipRouteProto value.  If this metric is not used,
                      its value should be set to -1."
              ::= { ipRouteEntry 3 }
          ipRouteMetric2 OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
SNMP Working Group                                             [Page 34]
RFC 1213                         MIB-II                       March 1991
                      "An alternate routing metric for this route.  The
                      semantics of this metric are determined by the
                      routing-protocol specified in the route's
                      ipRouteProto value.  If this metric is not used,
                      its value should be set to -1."
              ::= { ipRouteEntry 4 }
          ipRouteMetric3 OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "An alternate routing metric for this route.  The
                      semantics of this metric are determined by the
                      routing-protocol specified in the route's
                      ipRouteProto value.  If this metric is not used,
                      its value should be set to -1."
              ::= { ipRouteEntry 5 }
          ipRouteMetric4 OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "An alternate routing metric for this route.  The
                      semantics of this metric are determined by the
                      routing-protocol specified in the route's
                      ipRouteProto value.  If this metric is not used,
                      its value should be set to -1."
              ::= { ipRouteEntry 6 }
          ipRouteNextHop OBJECT-TYPE
              SYNTAX  IpAddress
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The IP address of the next hop of this route.
                      (In the case of a route bound to an interface
                      which is realized via a broadcast media, the value
                      of this field is the agent's IP address on that
                      interface.)"
              ::= { ipRouteEntry 7 }
          ipRouteType OBJECT-TYPE
              SYNTAX  INTEGER {
                          other(1),        -- none of the following
                          invalid(2),      -- an invalidated route
SNMP Working Group                                             [Page 35]
RFC 1213                         MIB-II                       March 1991
                                           -- route to directly
                          direct(3),       -- connected (sub-)network
                                           -- route to a non-local
                          indirect(4)      -- host/network/sub-network
                      }
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The type of route.  Note that the values
                      direct(3) and indirect(4) refer to the notion of
                      direct and indirect routing in the IP
                      architecture.
                      Setting this object to the value invalid(2) has
                      the effect of invalidating the corresponding entry
                      in the ipRouteTable object.  That is, it
                      effectively dissasociates the destination
                      identified with said entry from the route
                      identified with said entry.  It is an
                      implementation-specific matter as to whether the
                      agent removes an invalidated entry from the table.
                      Accordingly, management stations must be prepared
                      to receive tabular information from agents that
                      corresponds to entries not currently in use.
                      Proper interpretation of such entries requires
                      examination of the relevant ipRouteType object."
              ::= { ipRouteEntry 8 }
          ipRouteProto OBJECT-TYPE
              SYNTAX  INTEGER {
                          other(1),       -- none of the following
                                          -- non-protocol information,
                                          -- e.g., manually configured
                          local(2),       -- entries
                                          -- set via a network
                          netmgmt(3),     -- management protocol
                                          -- obtained via ICMP,
                          icmp(4),        -- e.g., Redirect
                                          -- the remaining values are
                                          -- all gateway routing
                                          -- protocols
                          egp(5),
                          ggp(6),
SNMP Working Group                                             [Page 36]
RFC 1213                         MIB-II                       March 1991
                          hello(7),
                          rip(8),
                          is-is(9),
                          es-is(10),
                          ciscoIgrp(11),
                          bbnSpfIgp(12),
                          ospf(13),
                          bgp(14)
                      }
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The routing mechanism via which this route was
                      learned.  Inclusion of values for gateway routing
                      protocols is not intended to imply that hosts
                      should support those protocols."
              ::= { ipRouteEntry 9 }
          ipRouteAge OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The number of seconds since this route was last
                      updated or otherwise determined to be correct.
                      Note that no semantics of `too old' can be implied
                      except through knowledge of the routing protocol
                      by which the route was learned."
              ::= { ipRouteEntry 10 }
          ipRouteMask OBJECT-TYPE
              SYNTAX  IpAddress
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "Indicate the mask to be logical-ANDed with the
                      destination address before being compared to the
                      value in the ipRouteDest field.  For those systems
                      that do not support arbitrary subnet masks, an
                      agent constructs the value of the ipRouteMask by
                      determining whether the value of the correspondent
                      ipRouteDest field belong to a class-A, B, or C
                      network, and then using one of:
                           mask           network
                           255.0.0.0      class-A
                           255.255.0.0    class-B
                           255.255.255.0  class-C
SNMP Working Group                                             [Page 37]
RFC 1213                         MIB-II                       March 1991
                      If the value of the ipRouteDest is 0.0.0.0 (a
                      default route), then the mask value is also
                      0.0.0.0.  It should be noted that all IP routing
                      subsystems implicitly use this mechanism."
              ::= { ipRouteEntry 11 }
          ipRouteMetric5 OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "An alternate routing metric for this route.  The
                      semantics of this metric are determined by the
                      routing-protocol specified in the route's
                      ipRouteProto value.  If this metric is not used,
                      its value should be set to -1."
              ::= { ipRouteEntry 12 }
          ipRouteInfo OBJECT-TYPE
              SYNTAX  OBJECT IDENTIFIER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "A reference to MIB definitions specific to the
                      particular routing protocol which is responsible
                      for this route, as determined by the value
                      specified in the route's ipRouteProto value.  If
                      this information is not present, its value should
                      be set to the OBJECT IDENTIFIER { 0 0 }, which is
                      a syntatically valid object identifier, and any
                      conformant implementation of ASN.1 and BER must be
                      able to generate and recognize this value."
              ::= { ipRouteEntry 13 }
          -- the IP Address Translation table
          -- The IP address translation table contain the IpAddress to
          -- `physical' address equivalences.  Some interfaces do not
          -- use translation tables for determining address
          -- equivalences (e.g., DDN-X.25 has an algorithmic method);
          -- if all interfaces are of this type, then the Address
          -- Translation table is empty, i.e., has zero entries.
          ipNetToMediaTable OBJECT-TYPE
              SYNTAX  SEQUENCE OF IpNetToMediaEntry
              ACCESS  not-accessible
              STATUS  mandatory
SNMP Working Group                                             [Page 38]
RFC 1213                         MIB-II                       March 1991
              DESCRIPTION
                      "The IP Address Translation table used for mapping
                      from IP addresses to physical addresses."
              ::= { ip 22 }
          ipNetToMediaEntry OBJECT-TYPE
              SYNTAX  IpNetToMediaEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "Each entry contains one IpAddress to `physical'
                      address equivalence."
              INDEX   { ipNetToMediaIfIndex,
                        ipNetToMediaNetAddress }
              ::= { ipNetToMediaTable 1 }
          IpNetToMediaEntry ::=
              SEQUENCE {
                  ipNetToMediaIfIndex
                      INTEGER,
                  ipNetToMediaPhysAddress
                      PhysAddress,
                  ipNetToMediaNetAddress
                      IpAddress,
                  ipNetToMediaType
                      INTEGER
              }
          ipNetToMediaIfIndex OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The interface on which this entry's equivalence
                      is effective.  The interface identified by a
                      particular value of this index is the same
                      interface as identified by the same value of
                      ifIndex."
              ::= { ipNetToMediaEntry 1 }
          ipNetToMediaPhysAddress OBJECT-TYPE
              SYNTAX  PhysAddress
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The media-dependent `physical' address."
              ::= { ipNetToMediaEntry 2 }
SNMP Working Group                                             [Page 39]
RFC 1213                         MIB-II                       March 1991
          ipNetToMediaNetAddress OBJECT-TYPE
              SYNTAX  IpAddress
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The IpAddress corresponding to the media-
                      dependent `physical' address."
              ::= { ipNetToMediaEntry 3 }
          ipNetToMediaType OBJECT-TYPE
              SYNTAX  INTEGER {
                          other(1),        -- none of the following
                          invalid(2),      -- an invalidated mapping
                          dynamic(3),
                          static(4)
                      }
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The type of mapping.
                      Setting this object to the value invalid(2) has
                      the effect of invalidating the corresponding entry
                      in the ipNetToMediaTable.  That is, it effectively
                      dissasociates the interface identified with said
                      entry from the mapping identified with said entry.
                      It is an implementation-specific matter as to
                      whether the agent removes an invalidated entry
                      from the table.  Accordingly, management stations
                      must be prepared to receive tabular information
                      from agents that corresponds to entries not
                      currently in use.  Proper interpretation of such
                      entries requires examination of the relevant
                      ipNetToMediaType object."
              ::= { ipNetToMediaEntry 4 }
          -- additional IP objects
          ipRoutingDiscards OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of routing entries which were chosen
                      to be discarded even though they are valid.  One
                      possible reason for discarding such an entry could
                      be to free-up buffer space for other routing
SNMP Working Group                                             [Page 40]
RFC 1213                         MIB-II                       March 1991
                      entries."
              ::= { ip 23 }
          -- the ICMP group
          -- Implementation of the ICMP group is mandatory for all
          -- systems.
          icmpInMsgs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of ICMP messages which the
                      entity received.  Note that this counter includes
                      all those counted by icmpInErrors."
              ::= { icmp 1 }
          icmpInErrors OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP messages which the entity
                      received but determined as having ICMP-specific
                      errors (bad ICMP checksums, bad length, etc.)."
              ::= { icmp 2 }
          icmpInDestUnreachs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Destination Unreachable
                      messages received."
              ::= { icmp 3 }
          icmpInTimeExcds OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Time Exceeded messages
                      received."
              ::= { icmp 4 }
SNMP Working Group                                             [Page 41]
RFC 1213                         MIB-II                       March 1991
          icmpInParmProbs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Parameter Problem messages
                      received."
              ::= { icmp 5 }
          icmpInSrcQuenchs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Source Quench messages
                      received."
              ::= { icmp 6 }
          icmpInRedirects OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Redirect messages received."
              ::= { icmp 7 }
          icmpInEchos OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Echo (request) messages
                      received."
              ::= { icmp 8 }
          icmpInEchoReps OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Echo Reply messages received."
              ::= { icmp 9 }
          icmpInTimestamps OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
SNMP Working Group                                             [Page 42]
RFC 1213                         MIB-II                       March 1991
                      "The number of ICMP Timestamp (request) messages
                      received."
              ::= { icmp 10 }
          icmpInTimestampReps OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Timestamp Reply messages
                      received."
              ::= { icmp 11 }
          icmpInAddrMasks OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Address Mask Request messages
                      received."
              ::= { icmp 12 }
          icmpInAddrMaskReps OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Address Mask Reply messages
                      received."
              ::= { icmp 13 }
          icmpOutMsgs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of ICMP messages which this
                      entity attempted to send.  Note that this counter
                      includes all those counted by icmpOutErrors."
              ::= { icmp 14 }
          icmpOutErrors OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP messages which this entity did
                      not send due to problems discovered within ICMP
SNMP Working Group                                             [Page 43]
RFC 1213                         MIB-II                       March 1991
                      such as a lack of buffers.  This value should not
                      include errors discovered outside the ICMP layer
                      such as the inability of IP to route the resultant
                      datagram.  In some implementations there may be no
                      types of error which contribute to this counter's
                      value."
              ::= { icmp 15 }
          icmpOutDestUnreachs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Destination Unreachable
                      messages sent."
              ::= { icmp 16 }
          icmpOutTimeExcds OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Time Exceeded messages sent."
              ::= { icmp 17 }
          icmpOutParmProbs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Parameter Problem messages
                      sent."
              ::= { icmp 18 }
          icmpOutSrcQuenchs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Source Quench messages sent."
              ::= { icmp 19 }
          icmpOutRedirects OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Redirect messages sent.  For a
SNMP Working Group                                             [Page 44]
RFC 1213                         MIB-II                       March 1991
                      host, this object will always be zero, since hosts
                      do not send redirects."
              ::= { icmp 20 }
          icmpOutEchos OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Echo (request) messages sent."
              ::= { icmp 21 }
          icmpOutEchoReps OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Echo Reply messages sent."
              ::= { icmp 22 }
          icmpOutTimestamps OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Timestamp (request) messages
                      sent."
              ::= { icmp 23 }
          icmpOutTimestampReps OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Timestamp Reply messages
                      sent."
              ::= { icmp 24 }
          icmpOutAddrMasks OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Address Mask Request messages
                      sent."
              ::= { icmp 25 }
SNMP Working Group                                             [Page 45]
RFC 1213                         MIB-II                       March 1991
          icmpOutAddrMaskReps OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of ICMP Address Mask Reply messages
                      sent."
              ::= { icmp 26 }
          -- the TCP group
          -- Implementation of the TCP group is mandatory for all
          -- systems that implement the TCP.
          -- Note that instances of object types that represent
          -- information about a particular TCP connection are
          -- transient; they persist only as long as the connection
          -- in question.
          tcpRtoAlgorithm OBJECT-TYPE
              SYNTAX  INTEGER {
                          other(1),    -- none of the following
                          constant(2), -- a constant rto
                          rsre(3),     -- MIL-STD-1778, Appendix B
                          vanj(4)      -- Van Jacobson's algorithm [10]
                      }
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The algorithm used to determine the timeout value
                      used for retransmitting unacknowledged octets."
              ::= { tcp 1 }
          tcpRtoMin OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The minimum value permitted by a TCP
                      implementation for the retransmission timeout,
                      measured in milliseconds.  More refined semantics
                      for objects of this type depend upon the algorithm
                      used to determine the retransmission timeout.  In
                      particular, when the timeout algorithm is rsre(3),
                      an object of this type has the semantics of the
                      LBOUND quantity described in RFC 793."
SNMP Working Group                                             [Page 46]
RFC 1213                         MIB-II                       March 1991
              ::= { tcp 2 }
          tcpRtoMax OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The maximum value permitted by a TCP
                      implementation for the retransmission timeout,
                      measured in milliseconds.  More refined semantics
                      for objects of this type depend upon the algorithm
                      used to determine the retransmission timeout.  In
                      particular, when the timeout algorithm is rsre(3),
                      an object of this type has the semantics of the
                      UBOUND quantity described in RFC 793."
              ::= { tcp 3 }
          tcpMaxConn OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The limit on the total number of TCP connections
                      the entity can support.  In entities where the
                      maximum number of connections is dynamic, this
                      object should contain the value -1."
              ::= { tcp 4 }
          tcpActiveOpens OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of times TCP connections have made a
                      direct transition to the SYN-SENT state from the
                      CLOSED state."
              ::= { tcp 5 }
          tcpPassiveOpens OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of times TCP connections have made a
                      direct transition to the SYN-RCVD state from the
                      LISTEN state."
              ::= { tcp 6 }
SNMP Working Group                                             [Page 47]
RFC 1213                         MIB-II                       March 1991
          tcpAttemptFails OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of times TCP connections have made a
                      direct transition to the CLOSED state from either
                      the SYN-SENT state or the SYN-RCVD state, plus the
                      number of times TCP connections have made a direct
                      transition to the LISTEN state from the SYN-RCVD
                      state."
              ::= { tcp 7 }
          tcpEstabResets OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of times TCP connections have made a
                      direct transition to the CLOSED state from either
                      the ESTABLISHED state or the CLOSE-WAIT state."
              ::= { tcp 8 }
          tcpCurrEstab OBJECT-TYPE
              SYNTAX  Gauge
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of TCP connections for which the
                      current state is either ESTABLISHED or CLOSE-
                      WAIT."
              ::= { tcp 9 }
          tcpInSegs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of segments received, including
                      those received in error.  This count includes
                      segments received on currently established
                      connections."
              ::= { tcp 10 }
          tcpOutSegs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
SNMP Working Group                                             [Page 48]
RFC 1213                         MIB-II                       March 1991
              DESCRIPTION
                      "The total number of segments sent, including
                      those on current connections but excluding those
                      containing only retransmitted octets."
              ::= { tcp 11 }
          tcpRetransSegs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of segments retransmitted - that
                      is, the number of TCP segments transmitted
                      containing one or more previously transmitted
                      octets."
              ::= { tcp 12 }
          -- the TCP Connection table
          -- The TCP connection table contains information about this
          -- entity's existing TCP connections.
          tcpConnTable OBJECT-TYPE
              SYNTAX  SEQUENCE OF TcpConnEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "A table containing TCP connection-specific
                      information."
              ::= { tcp 13 }
          tcpConnEntry OBJECT-TYPE
              SYNTAX  TcpConnEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "Information about a particular current TCP
                      connection.  An object of this type is transient,
                      in that it ceases to exist when (or soon after)
                      the connection makes the transition to the CLOSED
                      state."
              INDEX   { tcpConnLocalAddress,
                        tcpConnLocalPort,
                        tcpConnRemAddress,
                        tcpConnRemPort }
              ::= { tcpConnTable 1 }
SNMP Working Group                                             [Page 49]
RFC 1213                         MIB-II                       March 1991
          TcpConnEntry ::=
              SEQUENCE {
                  tcpConnState
                      INTEGER,
                  tcpConnLocalAddress
                      IpAddress,
                  tcpConnLocalPort
                      INTEGER (0..65535),
                  tcpConnRemAddress
                      IpAddress,
                  tcpConnRemPort
                      INTEGER (0..65535)
              }
          tcpConnState OBJECT-TYPE
              SYNTAX  INTEGER {
                          closed(1),
                          listen(2),
                          synSent(3),
                          synReceived(4),
                          established(5),
                          finWait1(6),
                          finWait2(7),
                          closeWait(8),
                          lastAck(9),
                          closing(10),
                          timeWait(11),
                          deleteTCB(12)
                      }
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The state of this TCP connection.
                      The only value which may be set by a management
                      station is deleteTCB(12).  Accordingly, it is
                      appropriate for an agent to return a `badValue'
                      response if a management station attempts to set
                      this object to any other value.
                      If a management station sets this object to the
                      value deleteTCB(12), then this has the effect of
                      deleting the TCB (as defined in RFC 793) of the
                      corresponding connection on the managed node,
                      resulting in immediate termination of the
                      connection.
                      As an implementation-specific option, a RST
SNMP Working Group                                             [Page 50]
RFC 1213                         MIB-II                       March 1991
                      segment may be sent from the managed node to the
                      other TCP endpoint (note however that RST segments
                      are not sent reliably)."
              ::= { tcpConnEntry 1 }
          tcpConnLocalAddress OBJECT-TYPE
              SYNTAX  IpAddress
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The local IP address for this TCP connection.  In
                      the case of a connection in the listen state which
                      is willing to accept connections for any IP
                      interface associated with the node, the value
                      0.0.0.0 is used."
              ::= { tcpConnEntry 2 }
          tcpConnLocalPort OBJECT-TYPE
              SYNTAX  INTEGER (0..65535)
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The local port number for this TCP connection."
              ::= { tcpConnEntry 3 }
          tcpConnRemAddress OBJECT-TYPE
              SYNTAX  IpAddress
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The remote IP address for this TCP connection."
              ::= { tcpConnEntry 4 }
          tcpConnRemPort OBJECT-TYPE
              SYNTAX  INTEGER (0..65535)
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The remote port number for this TCP connection."
              ::= { tcpConnEntry 5 }
          -- additional TCP objects
          tcpInErrs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
SNMP Working Group                                             [Page 51]
RFC 1213                         MIB-II                       March 1991
              DESCRIPTION
                      "The total number of segments received in error
                      (e.g., bad TCP checksums)."
              ::= { tcp 14 }
          tcpOutRsts OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of TCP segments sent containing the
                      RST flag."
              ::= { tcp 15 }
          -- the UDP group
          -- Implementation of the UDP group is mandatory for all
          -- systems which implement the UDP.
          udpInDatagrams OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of UDP datagrams delivered to
                      UDP users."
              ::= { udp 1 }
          udpNoPorts OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of received UDP datagrams for
                      which there was no application at the destination
                      port."
              ::= { udp 2 }
          udpInErrors OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of received UDP datagrams that could
                      not be delivered for reasons other than the lack
                      of an application at the destination port."
              ::= { udp 3 }
SNMP Working Group                                             [Page 52]
RFC 1213                         MIB-II                       March 1991
          udpOutDatagrams OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of UDP datagrams sent from this
                      entity."
              ::= { udp 4 }
          -- the UDP Listener table
          -- The UDP listener table contains information about this
          -- entity's UDP end-points on which a local application is
          -- currently accepting datagrams.
          udpTable OBJECT-TYPE
              SYNTAX  SEQUENCE OF UdpEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "A table containing UDP listener information."
              ::= { udp 5 }
          udpEntry OBJECT-TYPE
              SYNTAX  UdpEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "Information about a particular current UDP
                      listener."
              INDEX   { udpLocalAddress, udpLocalPort }
              ::= { udpTable 1 }
          UdpEntry ::=
              SEQUENCE {
                  udpLocalAddress
                      IpAddress,
                  udpLocalPort
                      INTEGER (0..65535)
              }
          udpLocalAddress OBJECT-TYPE
              SYNTAX  IpAddress
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The local IP address for this UDP listener.  In
SNMP Working Group                                             [Page 53]
RFC 1213                         MIB-II                       March 1991
                      the case of a UDP listener which is willing to
                      accept datagrams for any IP interface associated
                      with the node, the value 0.0.0.0 is used."
              ::= { udpEntry 1 }
          udpLocalPort OBJECT-TYPE
              SYNTAX  INTEGER (0..65535)
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The local port number for this UDP listener."
              ::= { udpEntry 2 }
          -- the EGP group
          -- Implementation of the EGP group is mandatory for all
          -- systems which implement the EGP.
          egpInMsgs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of EGP messages received without
                      error."
              ::= { egp 1 }
          egpInErrors OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of EGP messages received that proved
                      to be in error."
              ::= { egp 2 }
          egpOutMsgs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of locally generated EGP
                      messages."
              ::= { egp 3 }
          egpOutErrors OBJECT-TYPE
              SYNTAX  Counter
SNMP Working Group                                             [Page 54]
RFC 1213                         MIB-II                       March 1991
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of locally generated EGP messages not
                      sent due to resource limitations within an EGP
                      entity."
              ::= { egp 4 }
          -- the EGP Neighbor table
          -- The EGP neighbor table contains information about this
          -- entity's EGP neighbors.
          egpNeighTable OBJECT-TYPE
              SYNTAX  SEQUENCE OF EgpNeighEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "The EGP neighbor table."
              ::= { egp 5 }
          egpNeighEntry OBJECT-TYPE
              SYNTAX  EgpNeighEntry
              ACCESS  not-accessible
              STATUS  mandatory
              DESCRIPTION
                      "Information about this entity's relationship with
                      a particular EGP neighbor."
              INDEX   { egpNeighAddr }
              ::= { egpNeighTable 1 }
          EgpNeighEntry ::=
              SEQUENCE {
                  egpNeighState
                      INTEGER,
                  egpNeighAddr
                      IpAddress,
                  egpNeighAs
                      INTEGER,
                  egpNeighInMsgs
                      Counter,
                  egpNeighInErrs
                      Counter,
                  egpNeighOutMsgs
                      Counter,
                  egpNeighOutErrs
                      Counter,
SNMP Working Group                                             [Page 55]
RFC 1213                         MIB-II                       March 1991
                  egpNeighInErrMsgs
                      Counter,
                  egpNeighOutErrMsgs
                      Counter,
                  egpNeighStateUps
                      Counter,
                  egpNeighStateDowns
                      Counter,
                  egpNeighIntervalHello
                      INTEGER,
                  egpNeighIntervalPoll
                      INTEGER,
                  egpNeighMode
                      INTEGER,
                  egpNeighEventTrigger
                      INTEGER
              }
          egpNeighState OBJECT-TYPE
              SYNTAX  INTEGER {
                          idle(1),
                          acquisition(2),
                          down(3),
                          up(4),
                          cease(5)
                      }
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The EGP state of the local system with respect to
                      this entry's EGP neighbor.  Each EGP state is
                      represented by a value that is one greater than
                      the numerical value associated with said state in
                      RFC 904."
              ::= { egpNeighEntry 1 }
          egpNeighAddr OBJECT-TYPE
              SYNTAX  IpAddress
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The IP address of this entry's EGP neighbor."
              ::= { egpNeighEntry 2 }
          egpNeighAs OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
SNMP Working Group                                             [Page 56]
RFC 1213                         MIB-II                       March 1991
              DESCRIPTION
                      "The autonomous system of this EGP peer.  Zero
                      should be specified if the autonomous system
                      number of the neighbor is not yet known."
              ::= { egpNeighEntry 3 }
          egpNeighInMsgs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of EGP messages received without error
                      from this EGP peer."
              ::= { egpNeighEntry 4 }
          egpNeighInErrs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of EGP messages received from this EGP
                      peer that proved to be in error (e.g., bad EGP
                      checksum)."
              ::= { egpNeighEntry 5 }
          egpNeighOutMsgs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of locally generated EGP messages to
                      this EGP peer."
              ::= { egpNeighEntry 6 }
          egpNeighOutErrs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of locally generated EGP messages not
                      sent to this EGP peer due to resource limitations
                      within an EGP entity."
              ::= { egpNeighEntry 7 }
          egpNeighInErrMsgs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
SNMP Working Group                                             [Page 57]
RFC 1213                         MIB-II                       March 1991
              DESCRIPTION
                      "The number of EGP-defined error messages received
                      from this EGP peer."
              ::= { egpNeighEntry 8 }
          egpNeighOutErrMsgs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of EGP-defined error messages sent to
                      this EGP peer."
              ::= { egpNeighEntry 9 }
          egpNeighStateUps OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of EGP state transitions to the UP
                      state with this EGP peer."
              ::= { egpNeighEntry 10 }
          egpNeighStateDowns OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The number of EGP state transitions from the UP
                      state to any other state with this EGP peer."
              ::= { egpNeighEntry 11 }
          egpNeighIntervalHello OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The interval between EGP Hello command
                      retransmissions (in hundredths of a second).  This
                      represents the t1 timer as defined in RFC 904."
              ::= { egpNeighEntry 12 }
          egpNeighIntervalPoll OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The interval between EGP poll command
SNMP Working Group                                             [Page 58]
RFC 1213                         MIB-II                       March 1991
                      retransmissions (in hundredths of a second).  This
                      represents the t3 timer as defined in RFC 904."
              ::= { egpNeighEntry 13 }
          egpNeighMode OBJECT-TYPE
              SYNTAX  INTEGER { active(1), passive(2) }
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The polling mode of this EGP entity, either
                      passive or active."
              ::= { egpNeighEntry 14 }
          egpNeighEventTrigger OBJECT-TYPE
              SYNTAX  INTEGER { start(1), stop(2) }
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "A control variable used to trigger operator-
                      initiated Start and Stop events.  When read, this
                      variable always returns the most recent value that
                      egpNeighEventTrigger was set to.  If it has not
                      been set since the last initialization of the
                      network management subsystem on the node, it
                      returns a value of `stop'.
                      When set, this variable causes a Start or Stop
                      event on the specified neighbor, as specified on
                      pages 8-10 of RFC 904.  Briefly, a Start event
                      causes an Idle peer to begin neighbor acquisition
                      and a non-Idle peer to reinitiate neighbor
                      acquisition.  A stop event causes a non-Idle peer
                      to return to the Idle state until a Start event
                      occurs, either via egpNeighEventTrigger or
                      otherwise."
              ::= { egpNeighEntry 15 }
          -- additional EGP objects
          egpAs OBJECT-TYPE
              SYNTAX  INTEGER
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The autonomous system number of this EGP entity."
              ::= { egp 6 }
SNMP Working Group                                             [Page 59]
RFC 1213                         MIB-II                       March 1991
          -- the Transmission group
          -- Based on the transmission media underlying each interface
          -- on a system, the corresponding portion of the Transmission
          -- group is mandatory for that system.
          -- When Internet-standard definitions for managing
          -- transmission media are defined, the transmission group is
          -- used to provide a prefix for the names of those objects.
          -- Typically, such definitions reside in the experimental
          -- portion of the MIB until they are "proven", then as a
          -- part of the Internet standardization process, the
          -- definitions are accordingly elevated and a new object
          -- identifier, under the transmission group is defined. By
          -- convention, the name assigned is:
          --
          --     type OBJECT IDENTIFIER    ::= { transmission number }
          --
          -- where "type" is the symbolic value used for the media in
          -- the ifType column of the ifTable object, and "number" is
          -- the actual integer value corresponding to the symbol.
          -- the SNMP group
          -- Implementation of the SNMP group is mandatory for all
          -- systems which support an SNMP protocol entity.  Some of
          -- the objects defined below will be zero-valued in those
          -- SNMP implementations that are optimized to support only
          -- those functions specific to either a management agent or
          -- a management station.  In particular, it should be
          -- observed that the objects below refer to an SNMP entity,
          -- and there may be several SNMP entities residing on a
          -- managed node (e.g., if the node is hosting acting as
          -- a management station).
          snmpInPkts OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of Messages delivered to the
                      SNMP entity from the transport service."
              ::= { snmp 1 }
          snmpOutPkts OBJECT-TYPE
              SYNTAX  Counter
SNMP Working Group                                             [Page 60]
RFC 1213                         MIB-II                       March 1991
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Messages which were
                      passed from the SNMP protocol entity to the
                      transport service."
              ::= { snmp 2 }
          snmpInBadVersions OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Messages which were
                      delivered to the SNMP protocol entity and were for
                      an unsupported SNMP version."
              ::= { snmp 3 }
          snmpInBadCommunityNames OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Messages delivered to
                      the SNMP protocol entity which used a SNMP
                      community name not known to said entity."
              ::= { snmp 4 }
          snmpInBadCommunityUses OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Messages delivered to
                      the SNMP protocol entity which represented an SNMP
                      operation which was not allowed by the SNMP
                      community named in the Message."
              ::= { snmp 5 }
          snmpInASNParseErrs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of ASN.1 or BER errors
                      encountered by the SNMP protocol entity when
                      decoding received SNMP Messages."
              ::= { snmp 6 }
SNMP Working Group                                             [Page 61]
RFC 1213                         MIB-II                       March 1991
          -- { snmp 7 } is not used
          snmpInTooBigs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP PDUs which were
                      delivered to the SNMP protocol entity and for
                      which the value of the error-status field is
                      `tooBig'."
              ::= { snmp 8 }
          snmpInNoSuchNames OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP PDUs which were
                      delivered to the SNMP protocol entity and for
                      which the value of the error-status field is
                      `noSuchName'."
              ::= { snmp 9 }
          snmpInBadValues OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP PDUs which were
                      delivered to the SNMP protocol entity and for
                      which the value of the error-status field is
                      `badValue'."
              ::= { snmp 10 }
          snmpInReadOnlys OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number valid SNMP PDUs which were
                      delivered to the SNMP protocol entity and for
                      which the value of the error-status field is
                      `readOnly'.  It should be noted that it is a
                      protocol error to generate an SNMP PDU which
                      contains the value `readOnly' in the error-status
                      field, as such this object is provided as a means
                      of detecting incorrect implementations of the
SNMP Working Group                                             [Page 62]
RFC 1213                         MIB-II                       March 1991
                      SNMP."
              ::= { snmp 11 }
          snmpInGenErrs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP PDUs which were
                      delivered to the SNMP protocol entity and for
                      which the value of the error-status field is
                      `genErr'."
              ::= { snmp 12 }
          snmpInTotalReqVars OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of MIB objects which have been
                      retrieved successfully by the SNMP protocol entity
                      as the result of receiving valid SNMP Get-Request
                      and Get-Next PDUs."
              ::= { snmp 13 }
          snmpInTotalSetVars OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of MIB objects which have been
                      altered successfully by the SNMP protocol entity
                      as the result of receiving valid SNMP Set-Request
                      PDUs."
              ::= { snmp 14 }
          snmpInGetRequests OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Get-Request PDUs which
                      have been accepted and processed by the SNMP
                      protocol entity."
              ::= { snmp 15 }
          snmpInGetNexts OBJECT-TYPE
              SYNTAX  Counter
SNMP Working Group                                             [Page 63]
RFC 1213                         MIB-II                       March 1991
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Get-Next PDUs which have
                      been accepted and processed by the SNMP protocol
                      entity."
              ::= { snmp 16 }
          snmpInSetRequests OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Set-Request PDUs which
                      have been accepted and processed by the SNMP
                      protocol entity."
              ::= { snmp 17 }
          snmpInGetResponses OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Get-Response PDUs which
                      have been accepted and processed by the SNMP
                      protocol entity."
              ::= { snmp 18 }
          snmpInTraps OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Trap PDUs which have
                      been accepted and processed by the SNMP protocol
                      entity."
              ::= { snmp 19 }
          snmpOutTooBigs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP PDUs which were
                      generated by the SNMP protocol entity and for
                      which the value of the error-status field is
                      `tooBig.'"
              ::= { snmp 20 }
SNMP Working Group                                             [Page 64]
RFC 1213                         MIB-II                       March 1991
          snmpOutNoSuchNames OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP PDUs which were
                      generated by the SNMP protocol entity and for
                      which the value of the error-status is
                      `noSuchName'."
              ::= { snmp 21 }
          snmpOutBadValues OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP PDUs which were
                      generated by the SNMP protocol entity and for
                      which the value of the error-status field is
                      `badValue'."
              ::= { snmp 22 }
          -- { snmp 23 } is not used
          snmpOutGenErrs OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP PDUs which were
                      generated by the SNMP protocol entity and for
                      which the value of the error-status field is
                      `genErr'."
              ::= { snmp 24 }
          snmpOutGetRequests OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Get-Request PDUs which
                      have been generated by the SNMP protocol entity."
              ::= { snmp 25 }
          snmpOutGetNexts OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
SNMP Working Group                                             [Page 65]
RFC 1213                         MIB-II                       March 1991
              DESCRIPTION
                      "The total number of SNMP Get-Next PDUs which have
                      been generated by the SNMP protocol entity."
              ::= { snmp 26 }
          snmpOutSetRequests OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Set-Request PDUs which
                      have been generated by the SNMP protocol entity."
              ::= { snmp 27 }
          snmpOutGetResponses OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Get-Response PDUs which
                      have been generated by the SNMP protocol entity."
              ::= { snmp 28 }
          snmpOutTraps OBJECT-TYPE
              SYNTAX  Counter
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION
                      "The total number of SNMP Trap PDUs which have
                      been generated by the SNMP protocol entity."
              ::= { snmp 29 }
          snmpEnableAuthenTraps OBJECT-TYPE
              SYNTAX  INTEGER { enabled(1), disabled(2) }
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "Indicates whether the SNMP agent process is
                      permitted to generate authentication-failure
                      traps.  The value of this object overrides any
                      configuration information; as such, it provides a
                      means whereby all authentication-failure traps may
                      be disabled.
                      Note that it is strongly recommended that this
                      object be stored in non-volatile memory so that it
                      remains constant between re-initializations of the
                      network management system."
SNMP Working Group                                             [Page 66]
RFC 1213                         MIB-II                       March 1991
              ::= { snmp 30 }
          END
opends/src/snmp/resource/mib/rfc2021.txt
New file
@@ -0,0 +1,25 @@
RMON2-MIB DEFINITIONS ::= BEGIN
-- Textual Conventions
ZeroBasedCounter32 ::= TEXTUAL-CONVENTION
    STATUS current
    DESCRIPTION
        "This TC describes an object which counts events with the
        following semantics: objects of this type will be set to
        zero(0) on creation and will thereafter count appropriate
        events, wrapping back to zero(0) when the value 2^32 is
        reached.
        Provided that an application discovers the new object within
        the minimum time to wrap it can use the initial value as a
        delta since it last polled the table of which this object is
        part.  It is important for a management station to be aware of
        this minimum time and the actual time between polls, and to
        discard data if the actual time is too long or there is no
        defined minimum time.
        Typically this TC is used in tables where the INDEX space is
        constantly changing and/or the TimeFilter mechanism is in use."
    SYNTAX Gauge32
END
opends/src/snmp/resource/mib/rfc2605.txt
New file
@@ -0,0 +1,792 @@
   DIRECTORY-SERVER-MIB DEFINITIONS ::= BEGIN
    IMPORTS
      MODULE-IDENTITY,  Counter32, Gauge32, OBJECT-TYPE
                 FROM SNMPv2-SMI
      mib-2      FROM RFC1213
      DisplayString,    TimeStamp
                 FROM SNMPv2-TC
      MODULE-COMPLIANCE, OBJECT-GROUP
                 FROM SNMPv2-CONF
      ZeroBasedCounter32
                 FROM RMON2-MIB
      applIndex, DistinguishedName, URLString
                 FROM NETWORK-SERVICES-MIB;
    dsMIB MODULE-IDENTITY
       LAST-UPDATED "9906070000Z"
       ORGANIZATION "IETF Mail and Directory Management Working
                     Group"
       CONTACT-INFO
      "                      Glenn Mansfield
                     Postal: Cyber Solutions Inc.
                             6-6-3, Minami Yoshinari
                             Aoba-ku, Sendai, Japan 989-3204.
                        Tel: +81-22-303-4012
                        Fax: +81-22-303-4015
                   E-mail: glenn@cysols.com
       Working Group E-mail: ietf-madman@innosoft.com
               To subscribe: ietf-madman-request@innosoft.com"
       DESCRIPTION
               " The MIB module for monitoring Directory Services."
       -- revision information
       REVISION "9906070000Z"
       DESCRIPTION
         "This revision of this MIB is published in RFC 2605.
          This revision obsoletes RFC 1567. It is incompatible with
          the original MIB and so it has been renamed from dsaMIB
          to dsMIB."
       REVISION "9311250000Z" -- 25th November 1993
       DESCRIPTION
         "The original version of this MIB was published in RFC 1567."
       ::= { mib-2 66 }
    dsTable OBJECT-TYPE
        SYNTAX SEQUENCE OF DsTableEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
          " The table holding information related to the Directory
            Servers."
        ::= {dsMIB 1}
    dsTableEntry OBJECT-TYPE
        SYNTAX DsTableEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
          " Entry containing summary description for a Directory
            Server."
        INDEX { applIndex }
        ::= {dsTable 1}
   -- General description of the Directory Server application will be
   -- available in the applTable of the NETWORK-SERVICES-MIB indexed by
   -- applIndex.
    DsTableEntry ::= SEQUENCE {
        dsServerType
            BITS,
        dsServerDescription
            DisplayString,
    -- Entry statistics/Cache performance
        dsMasterEntries
            Gauge32,
        dsCopyEntries
            Gauge32,
        dsCacheEntries
            Gauge32,
        dsCacheHits
            Counter32,
        dsSlaveHits
            Counter32
    }
    dsServerType OBJECT-TYPE
        SYNTAX BITS {
                     frontEndDirectoryServer(0),
                     backEndDirectoryServer(1)
               }
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          "This object indicates whether the server is
           a frontend or, a backend or, both. If the server
           is a frontend, then the frontEndDirectoryServer
           bit will be set. Similarly for the backend."
        ::= {dsTableEntry 1}
    dsServerDescription OBJECT-TYPE
       SYNTAX DisplayString
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "A text description of the application.  This information
          is intended to identify and briefly describe the
          application in a status display."
        ::= {dsTableEntry 2}
   -- A (C)LDAP frontend to the X.500 Directory will not have
   -- MasterEntries, CopyEntries; the following counters will
   -- be inaccessible for LDAP/CLDAP frontends to the X.500
   -- directory: dsMasterEntries, dsCopyEntries, dsSlaveHits.
    dsMasterEntries OBJECT-TYPE
        SYNTAX Gauge32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of entries mastered in the Directory Server."
        ::= {dsTableEntry 3}
    dsCopyEntries OBJECT-TYPE
        SYNTAX Gauge32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of entries for which systematic (slave)
            copies are maintained in the Directory Server."
        ::= {dsTableEntry 4}
    dsCacheEntries OBJECT-TYPE
        SYNTAX Gauge32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of entries cached (non-systematic copies) in
            the Directory Server. This will include the entries that
            are cached partially. The negative cache is not counted."
        ::= {dsTableEntry 5}
    dsCacheHits OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of operations that were serviced from
            the locally held cache."
        ::= {dsTableEntry 6}
    dsSlaveHits  OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of operations that were serviced from
            the locally held object replications ( copy-
            entries)."
        ::= {dsTableEntry 7}
    dsApplIfOpsTable OBJECT-TYPE
        SYNTAX SEQUENCE OF DsApplIfOpsEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
          " The table holding information related to the
            Directory Server operations."
        ::= {dsMIB 2}
    dsApplIfOpsEntry OBJECT-TYPE
        SYNTAX DsApplIfOpsEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
          " Entry containing operations related statistics
            for a Directory Server."
        INDEX { applIndex, dsApplIfProtocolIndex }
        ::= {dsApplIfOpsTable 1}
    DsApplIfOpsEntry ::= SEQUENCE {
        dsApplIfProtocolIndex
             INTEGER,
        dsApplIfProtocol
             OBJECT IDENTIFIER,
    -- Bindings
        dsApplIfUnauthBinds
            Counter32,
        dsApplIfSimpleAuthBinds
            Counter32,
        dsApplIfStrongAuthBinds
            Counter32,
        dsApplIfBindSecurityErrors
            Counter32,
    -- In-coming operations
        dsApplIfInOps
            Counter32,
        dsApplIfReadOps
            Counter32,
        dsApplIfCompareOps
            Counter32,
        dsApplIfAddEntryOps
            Counter32,
        dsApplIfRemoveEntryOps
            Counter32,
        dsApplIfModifyEntryOps
            Counter32,
        dsApplIfModifyRDNOps
            Counter32,
        dsApplIfListOps
            Counter32,
        dsApplIfSearchOps
            Counter32,
        dsApplIfOneLevelSearchOps
            Counter32,
        dsApplIfWholeSubtreeSearchOps
            Counter32,
    -- Out going operations
        dsApplIfReferrals
            Counter32,
        dsApplIfChainings
            Counter32,
    -- Errors
        dsApplIfSecurityErrors
            Counter32,
        dsApplIfErrors
            Counter32,
   --  replications
        dsApplIfReplicationUpdatesIn
            Counter32,
        dsApplIfReplicationUpdatesOut
            Counter32,
    -- Traffic Volume
        dsApplIfInBytes
            Counter32,
        dsApplIfOutBytes
            Counter32
    }
    -- CLDAP does not use binds; for the CLDAP interface of a Directory
    -- Server the bind related counters will be inaccessible.
    --
    -- CLDAP and LDAP implement "Read" and "List" operations
    -- indirectly via the "search" operation; the following
    -- counters will be inaccessible for the CLDAP and LDAP interfaces of
    -- Directory Servers:  dsApplIfReadOps, dsApplIfListOps
    --
    -- CLDAP does not implement "Compare", "Add", "Remove",
    -- "Modify", "ModifyRDN"; the following counters will be
    -- inaccessible for the CLDAP interfaces of Directory Servers:
    -- dsApplIfCompareOps, dsApplIfAddEntryOps,  dsApplIfRemoveEntryOps,
    -- dsApplIfModifyEntryOps, dsApplIfModifyRDNOps.
    --
    -- CLDAP Directory Servers do not return Referrals
    -- the following fields will remain inaccessible for
    -- CLDAP interfaces of Directory Servers: dsApplIfReferrals.
    dsApplIfProtocolIndex OBJECT-TYPE
        SYNTAX INTEGER (1..2147483647)
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
         "An index to uniquely identify an entry corresponding to a
          application-layer protocol interface. This index is used
          for lexicographic ordering of the table."
        ::= {dsApplIfOpsEntry 1}
    dsApplIfProtocol OBJECT-TYPE
        SYNTAX OBJECT IDENTIFIER
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
         "An identification of the protocol being used by the application
          on this interface.  For an OSI Application, this will be the
          Application Context.  For Internet applications, the IANA
          maintains a registry[22] of the OIDs which correspond to
          well-known applications.  If the application protocol is
          not listed in the registry, an OID value of the form
          {applTCPProtoID port} or {applUDProtoID port} are used for
          TCP-based and UDP-based protocols, respectively. In either
          case 'port' corresponds to the primary port number being
          used by the protocol. The OIDs applTCPProtoID and
          applUDPProtoID are defined in NETWORK-SERVICES-MIB"
        ::= {dsApplIfOpsEntry 2}
    dsApplIfUnauthBinds OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of unauthenticated/anonymous bind requests
            received."
        ::= {dsApplIfOpsEntry 3}
    dsApplIfSimpleAuthBinds OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of bind requests that were authenticated
            using simple authentication procedures like password
            checks. This includes the
            password authentication using SASL mechanisms like
            CRAM-MD5."
        ::= {dsApplIfOpsEntry 4}
    dsApplIfStrongAuthBinds OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of bind requests that were authenticated
            using TLS and X.500 strong authentication procedures.
            This includes the binds that were
            authenticated using external authentication procedures."
        ::= {dsApplIfOpsEntry 5}
    dsApplIfBindSecurityErrors OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of bind requests that have been rejected
            due to inappropriate authentication or
            invalid credentials."
        ::= {dsApplIfOpsEntry 6}
    dsApplIfInOps OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of requests received from DUAs or other
            Directory Servers."
        ::= {dsApplIfOpsEntry 7}
    dsApplIfReadOps OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of read requests  received."
        ::= {dsApplIfOpsEntry 8}
    dsApplIfCompareOps OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of compare requests received."
        ::= {dsApplIfOpsEntry 9}
    dsApplIfAddEntryOps OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of addEntry requests received."
        ::= {dsApplIfOpsEntry 10}
    dsApplIfRemoveEntryOps OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of removeEntry requests received."
        ::= {dsApplIfOpsEntry 11}
    dsApplIfModifyEntryOps OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of modifyEntry requests received."
        ::= {dsApplIfOpsEntry 12}
    dsApplIfModifyRDNOps OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of modifyRDN requests received."
        ::= {dsApplIfOpsEntry 13}
    dsApplIfListOps OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of list requests received."
        ::= {dsApplIfOpsEntry 14}
    dsApplIfSearchOps OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of search requests- baseObject searches,
            oneLevel searches and  whole subtree searches,
            received."
        ::= {dsApplIfOpsEntry 15}
    dsApplIfOneLevelSearchOps OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of oneLevel search requests received."
        ::= {dsApplIfOpsEntry 16}
    dsApplIfWholeSubtreeSearchOps   OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of whole subtree search requests received."
        ::= {dsApplIfOpsEntry 17}
    dsApplIfReferrals OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of referrals returned in response
            to requests for operations."
        ::= {dsApplIfOpsEntry 18}
    dsApplIfChainings OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of operations forwarded by this Directory Server
            to other Directory Servers."
        ::= {dsApplIfOpsEntry 19}
    dsApplIfSecurityErrors OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of requests received
            which did not meet the security requirements. "
        ::= {dsApplIfOpsEntry 20}
    dsApplIfErrors  OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of requests that could not be serviced
            due to errors other than security errors, and
            referrals.
            A partially serviced operation will not be counted
            as an error.
            The errors include naming-related, update-related,
            attribute-related and service-related errors."
        ::= {dsApplIfOpsEntry 21}
   -- Replication operations
    dsApplIfReplicationUpdatesIn OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of replication updates fetched or received from
            supplier Directory Servers."
        ::= {dsApplIfOpsEntry 22}
    dsApplIfReplicationUpdatesOut OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Number of replication updates sent to or taken by
            consumer Directory Servers."
        ::= {dsApplIfOpsEntry 23}
    dsApplIfInBytes  OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Incoming traffic, in bytes, on the interface.
            This will include requests from DUAs as well
            as responses from other Directory Servers."
        ::= {dsApplIfOpsEntry 24}
    dsApplIfOutBytes OBJECT-TYPE
        SYNTAX Counter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Outgoing traffic in bytes on the interface.
            This will include responses to DUAs and Directory
            Servers as well as requests to other Directory Servers."
        ::= {dsApplIfOpsEntry 25}
    -- The dsIntTable contains statistical data on the peer
    -- Directory Servers  with which the monitored Directory
    -- Server interacts or, attempts to interact. This  table is
    -- expected to provide a useful insight into the effect of
    -- neighbours on the Directory Server's performance.
    -- The table keeps track of the last "N" Directory Servers
    -- with which  the  monitored   Directory  has  interacted
    -- (attempted to interact), where "N" is a locally-defined
    -- constant.
    -- For a multiprotocol server, statistics for each protocol
    -- are kept separetely.
    dsIntTable OBJECT-TYPE
        SYNTAX  SEQUENCE OF DsIntEntry
        MAX-ACCESS  not-accessible
        STATUS  current
        DESCRIPTION
          " Each row of this table contains some details
            related to the history of the interaction
            of the monitored Directory Server with its
            peer Directory Servers."
        ::= { dsMIB 3 }
    dsIntEntry OBJECT-TYPE
        SYNTAX  DsIntEntry
        MAX-ACCESS  not-accessible
        STATUS  current
        DESCRIPTION
          " Entry containing interaction details of a Directory
            Server with a peer Directory Server."
        INDEX { applIndex,dsIntEntIndex, dsApplIfProtocolIndex }
        ::= { dsIntTable 1 }
    DsIntEntry ::= SEQUENCE {
       dsIntEntIndex
                 INTEGER,
       dsIntEntDirectoryName
                 DistinguishedName,
       dsIntEntTimeOfCreation
                 TimeStamp,
       dsIntEntTimeOfLastAttempt
                 TimeStamp,
       dsIntEntTimeOfLastSuccess
                 TimeStamp,
       dsIntEntFailuresSinceLastSuccess
                 Gauge32,
       dsIntEntFailures
                 ZeroBasedCounter32,
       dsIntEntSuccesses
                 ZeroBasedCounter32,
       dsIntEntURL
                 URLString
    }
    dsIntEntIndex  OBJECT-TYPE
        SYNTAX INTEGER (1..2147483647)
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
          " Together with applIndex and dsApplIfProtocolIndex, this
            object forms the unique key to
            identify the conceptual row which contains useful info
            on the (attempted) interaction between the Directory
            Server (referred to by applIndex) and a peer Directory
            Server using a particular protocol."
        ::= {dsIntEntry 1}
    dsIntEntDirectoryName  OBJECT-TYPE
        SYNTAX DistinguishedName
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Distinguished Name of the peer Directory Server to
            which this entry pertains."
        ::= {dsIntEntry 2}
    dsIntEntTimeOfCreation  OBJECT-TYPE
        SYNTAX TimeStamp
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " The value of sysUpTime when this row was created.
            If the entry was created before the network management
            subsystem was initialized, this object will contain
            a value of zero."
        ::= {dsIntEntry 3}
    dsIntEntTimeOfLastAttempt  OBJECT-TYPE
        SYNTAX TimeStamp
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " The value of sysUpTime when the last attempt was made
            to contact the peer Directory Server. If the last attempt
            was made before the network management subsystem was
            initialized, this object will contain a value of zero."
        ::= {dsIntEntry 4}
    dsIntEntTimeOfLastSuccess  OBJECT-TYPE
        SYNTAX TimeStamp
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " The value of sysUpTime when the last attempt made to
            contact the peer Directory Server was successful. If there
            have been no successful attempts this entry will have a value
            of zero. If the last successful attempt was made before
            the network management subsystem was initialized, this
            object will contain a value of zero."
        ::= {dsIntEntry 5}
    dsIntEntFailuresSinceLastSuccess  OBJECT-TYPE
        SYNTAX Gauge32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " The number of failures since the last time an
            attempt to contact the peer Directory Server was successful.
            If there have been no successful attempts, this counter
            will contain the number of failures since this entry
            was created."
        ::= {dsIntEntry 6}
   -- note this gauge has a maximum value of 4294967295 and,
   -- it does not wrap.[5]
    dsIntEntFailures  OBJECT-TYPE
        SYNTAX ZeroBasedCounter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Cumulative failures in contacting the peer Directory Server
            since the creation of this entry."
        ::= {dsIntEntry 7}
    dsIntEntSuccesses  OBJECT-TYPE
        SYNTAX ZeroBasedCounter32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " Cumulative successes in contacting the peer Directory Server
            since the creation of this entry."
        ::= {dsIntEntry 8}
    dsIntEntURL  OBJECT-TYPE
        SYNTAX URLString
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
          " URL of the peer Directory Server."
        ::= {dsIntEntry 9}
    -- Conformance information
    dsConformance OBJECT IDENTIFIER ::= { dsMIB 4 }
    dsGroups      OBJECT IDENTIFIER ::= { dsConformance 1 }
    dsCompliances OBJECT IDENTIFIER ::= { dsConformance 2 }
    -- Compliance statements
    dsEntryCompliance MODULE-COMPLIANCE
        STATUS  current
        DESCRIPTION
                "The compliance statement for SNMP entities
                which implement the DIRECTORY-SERVER-MIB for
                a summary overview of the Directory Servers ."
        MODULE  -- this module
            MANDATORY-GROUPS { dsEntryGroup }
        ::= { dsCompliances 1 }
    dsOpsCompliance MODULE-COMPLIANCE
        STATUS  current
        DESCRIPTION
                "The compliance statement for SNMP entities
                which implement the DIRECTORY-SERVER-MIB for monitoring
                Directory Server operations,  entry statistics and cache
                performance."
        MODULE  -- this module
            MANDATORY-GROUPS { dsEntryGroup, dsOpsGroup }
        ::= { dsCompliances 2 }
    dsIntCompliance MODULE-COMPLIANCE
           STATUS  current
           DESCRIPTION
                   " The compliance statement  for SNMP  entities
                     which implement the DIRECTORY-SERVER-MIB for
                     monitoring Directory Server operations and the
                     interaction of the Directory Server with peer
                     Directory Servers."
           MODULE  -- this module
           MANDATORY-GROUPS { dsEntryGroup, dsIntGroup }
           ::= { dsCompliances 3 }
    dsOpsIntCompliance MODULE-COMPLIANCE
        STATUS  current
        DESCRIPTION
                " The compliance statement  for SNMP  entities
                  which implement the DIRECTORY-SERVER-MIB for monitoring
                  Directory Server operations and the interaction of the
                  Directory Server with peer Directory Servers."
        MODULE  -- this module
        MANDATORY-GROUPS { dsEntryGroup, dsOpsGroup, dsIntGroup }
        ::= { dsCompliances 4 }
    -- Units of conformance
    dsEntryGroup    OBJECT-GROUP
        OBJECTS {dsServerType,            dsServerDescription,
                 dsMasterEntries,         dsCopyEntries,
                 dsCacheEntries,          dsCacheHits,
                 dsSlaveHits}
        STATUS  current
        DESCRIPTION
                " A collection of objects for a summary overview of the
                  Directory Servers."
        ::= { dsGroups 1 }
    dsOpsGroup    OBJECT-GROUP
        OBJECTS {
          dsApplIfProtocolIndex,          dsApplIfProtocol,
          dsApplIfUnauthBinds,            dsApplIfSimpleAuthBinds,
          dsApplIfStrongAuthBinds,        dsApplIfBindSecurityErrors,
          dsApplIfInOps,                  dsApplIfReadOps,
          dsApplIfCompareOps,             dsApplIfAddEntryOps,
          dsApplIfRemoveEntryOps,         dsApplIfModifyEntryOps,
          dsApplIfModifyRDNOps,           dsApplIfListOps,
          dsApplIfSearchOps,              dsApplIfOneLevelSearchOps,
          dsApplIfWholeSubtreeSearchOps,  dsApplIfReferrals,
          dsApplIfChainings,              dsApplIfSecurityErrors,
          dsApplIfErrors,                 dsApplIfReplicationUpdatesIn,
          dsApplIfReplicationUpdatesOut,  dsApplIfInBytes,
          dsApplIfOutBytes      }
        STATUS  current
        DESCRIPTION
                " A collection of objects for monitoring the Directory
                  Server operations."
        ::= { dsGroups 2 }
    dsIntGroup    OBJECT-GROUP
        OBJECTS {
          dsIntEntDirectoryName,         dsIntEntTimeOfCreation,
          dsIntEntTimeOfLastAttempt,     dsIntEntTimeOfLastSuccess,
          dsIntEntFailuresSinceLastSuccess, dsIntEntFailures,
          dsIntEntSuccesses,             dsIntEntURL}
        STATUS  current
        DESCRIPTION
                " A collection of objects for monitoring the Directory
                  Server's interaction with peer Directory Servers."
        ::= { dsGroups 3 }
   END
opends/src/snmp/resource/mib/rfc2788.txt
New file
@@ -0,0 +1,619 @@
   NETWORK-SERVICES-MIB DEFINITIONS ::= BEGIN
   IMPORTS
       OBJECT-TYPE, Counter32, Gauge32, MODULE-IDENTITY, mib-2
         FROM SNMPv2-SMI
       TimeStamp, TEXTUAL-CONVENTION
         FROM SNMPv2-TC
       MODULE-COMPLIANCE, OBJECT-GROUP
         FROM SNMPv2-CONF
       SnmpAdminString
           FROM SNMP-FRAMEWORK-MIB;
   application MODULE-IDENTITY
       LAST-UPDATED "200003030000Z"
       ORGANIZATION "IETF Mail and Directory Management Working Group"
       CONTACT-INFO
         "        Ned Freed
          Postal: Innosoft International, Inc.
                  1050 Lakes Drive
                  West Covina, CA 91790
                  US
             Tel: +1 626 919 3600
             Fax: +1 626 919 3614
          E-Mail: ned.freed@innosoft.com"
       DESCRIPTION
         "The MIB module describing network service applications"
       REVISION "200003030000Z"
       DESCRIPTION
         "This revision, published in RFC 2788, changes a number of
          DisplayStrings to SnmpAdminStrings. Note that this change
          is not strictly supported by SMIv2.  However, the alternative
          of deprecating the old objects and defining new objects
          would have a more adverse impact on backward compatibility
          and interoperability, given the particular semantics of
          these objects. The defining reference for distinguished
          names has also been updated from RFC 1779 to RFC 2253."
       REVISION "199905120000Z"
       DESCRIPTION
         "This revision fixes a few small technical problems found
          in previous versions, mostly in regards to the conformance
          groups for different versions of this MIB.  No changes have
          been made to the objects this MIB defines since RFC 2248."
       REVISION "199708170000Z"
       DESCRIPTION
         "This revision, published in RFC 2248, adds the
          applDescription and applURL objects, adds the quiescing
          state to the applOperStatus object and renames the MIB
          from the APPLICATION-MIB to the NETWORK-SERVICE-MIB."
       REVISION "199311280000Z"
       DESCRIPTION
         "The original version of this MIB was published in RFC 1565"
       ::= {mib-2 27}
   -- Textual conventions
   -- DistinguishedName is used to refer to objects in the
   -- directory.
   DistinguishedName ::= TEXTUAL-CONVENTION
       DISPLAY-HINT "255a"
       STATUS current
       DESCRIPTION
           "A Distinguished Name represented in accordance with
            RFC 2253, presented in the UTF-8 charset defined in
            RFC 2279."
       SYNTAX OCTET STRING (SIZE (0..255))
   -- Uniform Resource Locators are stored in URLStrings.
   URLString ::= TEXTUAL-CONVENTION
       DISPLAY-HINT "255a"
       STATUS current
       DESCRIPTION
           "A Uniform Resource Locator represented in accordance
            with RFCs 1738 and 2368, presented in the NVT ASCII
            charset defined in RFC 854."
       SYNTAX OCTET STRING (SIZE (0..255))
   -- The basic applTable contains a list of the application
   -- entities.
   applTable OBJECT-TYPE
       SYNTAX SEQUENCE OF ApplEntry
       MAX-ACCESS not-accessible
       STATUS current
       DESCRIPTION
           "The table holding objects which apply to all different
            kinds of applications providing network services.
            Each network service application capable of being
            monitored should have a single entry in this table."
       ::= {application 1}
   applEntry OBJECT-TYPE
       SYNTAX ApplEntry
       MAX-ACCESS not-accessible
       STATUS current
       DESCRIPTION
         "An entry associated with a single network service
          application."
       INDEX {applIndex}
       ::= {applTable 1}
   ApplEntry ::= SEQUENCE {
       applIndex
           INTEGER,
       applName
           SnmpAdminString,
       applDirectoryName
           DistinguishedName,
       applVersion
           SnmpAdminString,
       applUptime
           TimeStamp,
       applOperStatus
           INTEGER,
       applLastChange
           TimeStamp,
       applInboundAssociations
           Gauge32,
       applOutboundAssociations
           Gauge32,
       applAccumulatedInboundAssociations
           Counter32,
       applAccumulatedOutboundAssociations
           Counter32,
       applLastInboundActivity
           TimeStamp,
       applLastOutboundActivity
           TimeStamp,
       applRejectedInboundAssociations
           Counter32,
       applFailedOutboundAssociations
           Counter32,
       applDescription
           SnmpAdminString,
       applURL
           URLString
   }
   applIndex OBJECT-TYPE
       SYNTAX INTEGER (1..2147483647)
       MAX-ACCESS not-accessible
       STATUS current
       DESCRIPTION
         "An index to uniquely identify the network service
          application. This attribute is the index used for
          lexicographic ordering of the table."
       ::= {applEntry 1}
   applName OBJECT-TYPE
       SYNTAX SnmpAdminString
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The name the network service application chooses to be
          known by."
       ::= {applEntry 2}
   applDirectoryName OBJECT-TYPE
       SYNTAX DistinguishedName
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The Distinguished Name of the directory entry where
          static information about this application is stored.
          An empty string indicates that no information about
          the application is available in the directory."
       ::= {applEntry 3}
   applVersion OBJECT-TYPE
       SYNTAX SnmpAdminString
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The version of network service application software.
          This field is usually defined by the vendor of the
          network service application software."
       ::= {applEntry 4}
   applUptime OBJECT-TYPE
       SYNTAX TimeStamp
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The value of sysUpTime at the time the network service
          application was last initialized.  If the application was
          last initialized prior to the last initialization of the
          network management subsystem, then this object contains
          a zero value."
       ::= {applEntry 5}
   applOperStatus OBJECT-TYPE
       SYNTAX INTEGER {
         up(1),
         down(2),
         halted(3),
         congested(4),
         restarting(5),
         quiescing(6)
       }
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "Indicates the operational status of the network service
          application. 'down' indicates that the network service is
          not available. 'up' indicates that the network service
          is operational and available.  'halted' indicates that the
          service is operational but not available.  'congested'
          indicates that the service is operational but no additional
          inbound associations can be accommodated.  'restarting'
          indicates that the service is currently unavailable but is
          in the process of restarting and will be available soon.
          'quiescing' indicates that service is currently operational
          but is in the process of shutting down. Additional inbound
          associations may be rejected by applications in the
          'quiescing' state."
       ::= {applEntry 6}
   applLastChange OBJECT-TYPE
       SYNTAX TimeStamp
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The value of sysUpTime at the time the network service
          application entered its current operational state.  If
          the current state was entered prior to the last
          initialization of the local network management subsystem,
          then this object contains a zero value."
       ::= {applEntry 7}
   applInboundAssociations OBJECT-TYPE
       SYNTAX Gauge32
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The number of current associations to the network service
          application, where it is the responder.  An inbound
          association occurs when another application successfully
          connects to this one."
       ::= {applEntry 8}
   applOutboundAssociations OBJECT-TYPE
       SYNTAX Gauge32
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The number of current associations to the network service
          application, where it is the initiator.  An outbound
          association occurs when this application successfully
          connects to another one."
       ::= {applEntry 9}
   applAccumulatedInboundAssociations OBJECT-TYPE
       SYNTAX Counter32
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The total number of associations to the application entity
          since application initialization, where it was the responder."
       ::= {applEntry 10}
   applAccumulatedOutboundAssociations OBJECT-TYPE
       SYNTAX Counter32
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The total number of associations to the application entity
          since application initialization, where it was the initiator."
       ::= {applEntry 11}
   applLastInboundActivity OBJECT-TYPE
       SYNTAX TimeStamp
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The value of sysUpTime at the time this application last
          had an inbound association.  If the last association
          occurred prior to the last initialization of the network
          subsystem, then this object contains a zero value."
       ::= {applEntry 12}
   applLastOutboundActivity OBJECT-TYPE
       SYNTAX TimeStamp
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The value of sysUpTime at the time this application last
          had an outbound association.  If the last association
          occurred prior to the last initialization of the network
          subsystem, then this object contains a zero value."
       ::= {applEntry 13}
   applRejectedInboundAssociations OBJECT-TYPE
       SYNTAX Counter32
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The total number of inbound associations the application
          entity has rejected, since application initialization.
          Rejected associations are not counted in the accumulated
          association totals.  Note that this only counts
          associations the application entity has rejected itself;
          it does not count rejections that occur at lower layers
          of the network.  Thus, this counter may not reflect the
          true number of failed inbound associations."
       ::= {applEntry 14}
   applFailedOutboundAssociations OBJECT-TYPE
       SYNTAX Counter32
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The total number associations where the application entity
          is initiator and association establishment has failed,
          since application initialization.  Failed associations are
          not counted in the accumulated association totals."
       ::= {applEntry 15}
   applDescription OBJECT-TYPE
       SYNTAX SnmpAdminString
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "A text description of the application.  This information
          is intended to identify and briefly describe the
          application in a status display."
       ::= {applEntry 16}
   applURL OBJECT-TYPE
       SYNTAX URLString
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "A URL pointing to a description of the application.
          This information is intended to identify and describe
          the application in a status display."
       ::= {applEntry 17}
    -- The assocTable augments the information in the applTable
    -- with information about associations.  Note that two levels
    -- of compliance are specified below, depending on whether
    -- association monitoring is mandated.
    assocTable OBJECT-TYPE
       SYNTAX SEQUENCE OF AssocEntry
       MAX-ACCESS not-accessible
       STATUS current
       DESCRIPTION
           "The table holding a set of all active application
            associations."
       ::= {application 2}
    assocEntry OBJECT-TYPE
       SYNTAX AssocEntry
       MAX-ACCESS not-accessible
       STATUS current
       DESCRIPTION
         "An entry associated with an association for a network
          service application."
       INDEX {applIndex, assocIndex}
       ::= {assocTable 1}
    AssocEntry ::= SEQUENCE {
       assocIndex
           INTEGER,
       assocRemoteApplication
           SnmpAdminString,
       assocApplicationProtocol
           OBJECT IDENTIFIER,
       assocApplicationType
           INTEGER,
       assocDuration
           TimeStamp
    }
    assocIndex OBJECT-TYPE
       SYNTAX INTEGER (1..2147483647)
       MAX-ACCESS not-accessible
       STATUS current
       DESCRIPTION
         "An index to uniquely identify each association for a network
          service application.  This attribute is the index that is
          used for lexicographic ordering of the table.  Note that the
          table is also indexed by the applIndex."
       ::= {assocEntry 1}
    assocRemoteApplication OBJECT-TYPE
       SYNTAX SnmpAdminString
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The name of the system running remote network service
          application.  For an IP-based application this should be
          either a domain name or IP address.  For an OSI application
          it should be the string encoded distinguished name of the
          managed object.  For X.400(1984) MTAs which do not have a
          Distinguished Name, the RFC 2156 syntax 'mta in
          globalid' used in X400-Received: fields can be used. Note,
          however, that not all connections an MTA makes are
          necessarily to another MTA."
       ::= {assocEntry 2}
    assocApplicationProtocol OBJECT-TYPE
       SYNTAX OBJECT IDENTIFIER
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "An identification of the protocol being used for the
          application.  For an OSI Application, this will be the
          Application Context.  For Internet applications, OID
          values of the form {applTCPProtoID port} or {applUDPProtoID
          port} are used for TCP-based and UDP-based protocols,
          respectively. In either case 'port' corresponds to the
          primary port number being used by the protocol. The
          usual IANA procedures may be used to register ports for
         new protocols."
      ::= {assocEntry 3}
    assocApplicationType OBJECT-TYPE
       SYNTAX INTEGER {
           uainitiator(1),
           uaresponder(2),
           peerinitiator(3),
           peerresponder(4)}
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "This indicates whether the remote application is some type of
          client making use of this network service (e.g., a Mail User
          Agent) or a server acting as a peer. Also indicated is whether
          the remote end initiated an incoming connection to the network
          service or responded to an outgoing connection made by the
          local application.  MTAs and messaging gateways are
          considered to be peers for the purposes of this variable."
       ::= {assocEntry 4}
    assocDuration OBJECT-TYPE
       SYNTAX TimeStamp
       MAX-ACCESS read-only
       STATUS current
       DESCRIPTION
         "The value of sysUpTime at the time this association was
          started.  If this association started prior to the last
          initialization of the network subsystem, then this
          object contains a zero value."
       ::= {assocEntry 5}
   -- Conformance information
   applConformance OBJECT IDENTIFIER ::= {application 3}
   applGroups      OBJECT IDENTIFIER ::= {applConformance 1}
   applCompliances OBJECT IDENTIFIER ::= {applConformance 2}
   -- Compliance statements
   applCompliance MODULE-COMPLIANCE
       STATUS obsolete
       DESCRIPTION
         "The compliance statement for RFC 1565 implementations
          which support the Network Services Monitoring MIB
          for basic monitoring of network service applications.
          This is the basic compliance statement for RFC 1565."
       MODULE
         MANDATORY-GROUPS {applRFC1565Group}
       ::= {applCompliances 1}
   assocCompliance MODULE-COMPLIANCE
       STATUS obsolete
       DESCRIPTION
         "The compliance statement for RFC 1565 implementations
          which support the Network Services Monitoring MIB
          for basic monitoring of network service applications
          and their associations."
       MODULE
         MANDATORY-GROUPS {applRFC1565Group, assocRFC1565Group}
       ::= {applCompliances 2}
   applRFC2248Compliance MODULE-COMPLIANCE
       STATUS deprecated
       DESCRIPTION
         "The compliance statement for RFC 2248 implementations
          which support the Network Services Monitoring MIB
          for basic monitoring of network service applications."
       MODULE
         MANDATORY-GROUPS {applRFC2248Group}
       ::= {applCompliances 3}
   assocRFC2248Compliance MODULE-COMPLIANCE
       STATUS deprecated
       DESCRIPTION
         "The compliance statement for RFC 2248 implementations
          which support the Network Services Monitoring MIB for
          basic monitoring of network service applications and
          their associations."
       MODULE
         MANDATORY-GROUPS {applRFC2248Group, assocRFC2248Group}
       ::= {applCompliances 4}
   applRFC2788Compliance MODULE-COMPLIANCE
       STATUS current
       DESCRIPTION
         "The compliance statement for RFC 2788 implementations
          which support the Network Services Monitoring MIB
          for basic monitoring of network service applications."
       MODULE
         MANDATORY-GROUPS {applRFC2788Group}
       ::= {applCompliances 5}
   assocRFC2788Compliance MODULE-COMPLIANCE
       STATUS current
       DESCRIPTION
         "The compliance statement for RFC 2788 implementations
          which support the Network Services Monitoring MIB for
          basic monitoring of network service applications and
          their associations."
       MODULE
         MANDATORY-GROUPS {applRFC2788Group, assocRFC2788Group}
       ::= {applCompliances 6}
   -- Units of conformance
   applRFC1565Group OBJECT-GROUP
       OBJECTS {
         applName, applVersion, applUptime, applOperStatus,
         applLastChange, applInboundAssociations,
         applOutboundAssociations, applAccumulatedInboundAssociations,
         applAccumulatedOutboundAssociations, applLastInboundActivity,
         applLastOutboundActivity, applRejectedInboundAssociations,
         applFailedOutboundAssociations}
       STATUS obsolete
       DESCRIPTION
         "A collection of objects providing basic monitoring of
          network service applications.  This is the original set
          of such objects defined in RFC 1565."
       ::= {applGroups 7}
   assocRFC1565Group OBJECT-GROUP
       OBJECTS {
         assocRemoteApplication, assocApplicationProtocol,
         assocApplicationType, assocDuration}
       STATUS obsolete
       DESCRIPTION
         "A collection of objects providing basic monitoring of
          network service applications' associations.  This is the
          original set of such objects defined in RFC 1565."
       ::= {applGroups 2}
   applRFC2248Group OBJECT-GROUP
       OBJECTS {
         applName, applVersion, applUptime, applOperStatus,
         applLastChange, applInboundAssociations,
         applOutboundAssociations, applAccumulatedInboundAssociations,
         applAccumulatedOutboundAssociations, applLastInboundActivity,
         applLastOutboundActivity, applRejectedInboundAssociations,
         applFailedOutboundAssociations, applDescription, applURL}
       STATUS deprecated
       DESCRIPTION
         "A collection of objects providing basic monitoring of
          network service applications.  This group was originally
          defined in RFC 2248; note that applDirectoryName is
          missing."
       ::= {applGroups 3}
   assocRFC2248Group OBJECT-GROUP
       OBJECTS {
         assocRemoteApplication, assocApplicationProtocol,
         assocApplicationType, assocDuration}
       STATUS deprecated
       DESCRIPTION
         "A collection of objects providing basic monitoring of
          network service applications' associations.  This group
          was originally defined by RFC 2248."
       ::= {applGroups 4}
   applRFC2788Group OBJECT-GROUP
       OBJECTS {
         applName, applDirectoryName, applVersion, applUptime,
         applOperStatus, applLastChange, applInboundAssociations,
         applOutboundAssociations, applAccumulatedInboundAssociations,
         applAccumulatedOutboundAssociations, applLastInboundActivity,
         applLastOutboundActivity, applRejectedInboundAssociations,
         applFailedOutboundAssociations, applDescription, applURL}
       STATUS current
       DESCRIPTION
         "A collection of objects providing basic monitoring of
          network service applications.  This is the appropriate
          group for RFC 2788 -- it adds the applDirectoryName object
          missing in RFC 2248."
       ::= {applGroups 5}
   assocRFC2788Group OBJECT-GROUP
       OBJECTS {
         assocRemoteApplication, assocApplicationProtocol,
         assocApplicationType, assocDuration}
       STATUS current
       DESCRIPTION
         "A collection of objects providing basic monitoring of
          network service applications' associations.  This is
          the appropriate group for RFC 2788."
       ::= {applGroups 6}
   -- OIDs of the form {applTCPProtoID port} are intended to be used
   -- for TCP-based protocols that don't have OIDs assigned by other
   -- means. {applUDPProtoID port} serves the same purpose for
   -- UDP-based protocols. In either case 'port' corresponds to
   -- the primary port number being used by the protocol. For example,
   -- assuming no other OID is assigned for SMTP, an OID of
   -- {applTCPProtoID 25} could be used, since SMTP is a TCP-based
   -- protocol that uses port 25 as its primary port.
   applTCPProtoID OBJECT IDENTIFIER ::= {application 4}
   applUDPProtoID OBJECT IDENTIFIER ::= {application 5}
   END
opends/src/snmp/resource/security/opends-snmp.security
New file
@@ -0,0 +1,6 @@
localEngineID=0x8000002a017f000001000000a1
localEngineBoots=0
userEntry=localEngineID,defaultUser,,usmHMACMD5AuthProtocol,password,,,3,true
opends/src/snmp/src/org/opends/server/snmp/DIRECTORY_SERVER_MIBImpl.java
New file
@@ -0,0 +1,138 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.loggers.debug.DebugTracer;
/**
 * The class is the "DIRECTORY-SERVER-MIB" implementation.
 */
public class DIRECTORY_SERVER_MIBImpl extends DIRECTORY_SERVER_MIB {
  /**
   * The serial version identifier required to satisfy the compiler because
   * this class implements the <CODE>java.io.Serializable</CODE> interface.
   * This value was generated using the <CODE>serialver</CODE> command-line
   * utility included with the Java SDK.
   */
  private static final long serialVersionUID = 1420660265781848102L;
  /**
   * The debug log tracer for this class.
   */
  private static final DebugTracer TRACER = DebugLogger.getTracer();
  /**
   * Indicates if the SNMP Mbeans have to be registered or not
   */
  private boolean registeredSnmpMBean = false;
  /**
   * The Current Directory Server MIB
   */
  private DsMIBImpl dsMib = null;
  /**
   * ObjectName of the Current Direcotry Server MIB
   */
  private ObjectName mibObName;
  /**
   * ObjectName of the dsMIB group in the Directory Server MIB
   */
  private ObjectName groupObjName;
  /**
   * Creates the Current Directory Server MIB
   * @param registeredMBean indicates if the SNMP MBean has to register
   * in the Direcotry Server MBeanServer
   * @param mibName of the Directory Server MIB
   */
  public DIRECTORY_SERVER_MIBImpl(boolean registeredMBean, ObjectName mibName) {
    super();
    this.registeredSnmpMBean = registeredMBean;
    this.mibObName = mibName;
    if (DebugLogger.debugEnabled()) {
      TRACER.debugVerbose("DIRECTORY_SERVER_MIB=" + this.mibObName +
              " created with registerMBean=" + this.registeredSnmpMBean);
    }
  }
  /**
   * {@inheritDoc}
   * @throws java.lang.Exception if the DsMib Group couls not be initialized
   */
  @Override
  protected void initDsMIB(MBeanServer server)
          throws Exception {
    final String oid = getGroupOid("DsMIB", "1.3.6.1.2.1.66");
    if (server != null) {
      groupObjName = new ObjectName(
              SNMPConnectionHandlerDefinitions.SNMP_DOMAIN +
              "type=group,name=DsMib");
    }
    final DsMIBMeta meta = createDsMIBMetaNode("DsMIB", oid, groupObjName,
            server);
    if (meta != null) {
      meta.registerTableNodes(this, server);
      // Note that when using standard metadata,
      // the returned object must implement the "DsMIBMBean"
      // interface.
      //
      final DsMIBMBean group = (DsMIBMBean) createDsMIBMBean("DsMIB", oid,
              groupObjName, server);
      meta.setInstance(group);
      registerGroupNode("DsMIB", oid, groupObjName, meta, group, server);
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  protected Object createDsMIBMBean(String groupName,
          String groupOid, ObjectName groupObjname, MBeanServer server) {
    this.dsMib = new DsMIBImpl(this, server, this.registeredSnmpMBean);
    return this.dsMib;
  }
  /**
   * Returns the created dsMIB group
   * @return the DsMIBImpl
   */
  protected DsMIBImpl getMib() {
    return this.dsMib;
  }
  /**
   * Returns the ObjectName of the dsMIB group
   * @return the ObjectName of the created dsMIB group
   */
  protected ObjectName getObjectName() {
    return this.groupObjName;
  }
}
opends/src/snmp/src/org/opends/server/snmp/DsApplIfOpsEntryImpl.java
New file
@@ -0,0 +1,302 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import com.sun.management.snmp.SnmpStatusException;
import com.sun.management.snmp.agent.SnmpMib;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.DebugLogLevel;
/**
 * The class is used for representing "DsApplIfOpsEntryImpl" implementation.
 */
public class DsApplIfOpsEntryImpl extends DsApplIfOpsEntry implements DsEntry {
  /**
   * The serial version identifier required to satisfy the compiler because
   * this class implements the <CODE>java.io.Serializable</CODE> interface.
   * This value was generated using the <CODE>serialver</CODE> command-line
   * utility included with the Java SDK.
   */
  private static final long serialVersionUID = 3876259684025799091L;
  /**
   * The debug log tracer for this class.
   */
  private static final DebugTracer TRACER = DebugLogger.getTracer();
  /**
   * ObjectName of the DsApplIfOpsEntry
   */
  private ObjectName entryName;
  /**
   * MBeanServer where the cn=monitor Connection Handler MBean are registered
   */
  private MBeanServer server;
  /**
   * ObjectName of the cn=monitor Connection Handler MBean
   */
  private ObjectName connectionHandlerName;
  /**
   * SNMPMonitor representing the gateway beetween SNMP MBeans and cn=monitor
   * MBeans
   */
  private SNMPMonitor monitor;
  /**
   * ObjectName of the MBeans representing the Statistics of the cn=monitor
   * ConnectionHandler
   */
  private ObjectName stats;
  /**
   * Created a DsApplIfOpsEntry in the SnmpMib
   * @param mib where the entry has to be created
   * @param server where the corresponding cn=monitor MBean are registered
   * @param connectionHandlerObjectName mapping ObjectName
   * @param applIndex key in the DsTable
   * @param connectionHandlerIndex key corresponding to this entry in the
   * DsApplIfOpsTable
   */
  public DsApplIfOpsEntryImpl(SnmpMib mib, MBeanServer server,
          ObjectName connectionHandlerObjectName, int applIndex,
          int connectionHandlerIndex) {
    super(mib);
    this.server = server;
    this.connectionHandlerName = connectionHandlerObjectName;
    this.ApplIndex = new Integer(applIndex);
    this.DsApplIfProtocolIndex = new Integer(connectionHandlerIndex);
    this.monitor = SNMPMonitor.getMonitor(server);
  }
  /**
   * {@inheritDoc}
   * @return DsApplIfSearchOps
   */
  @Override
  public Long getDsApplIfSearchOps() {
    if (stats == null) {
      stats = this.monitor.getConnectionHandlerStatistics(
              connectionHandlerName);
    }
    if (stats != null) {
      long value = Long.parseLong((String) this.monitor.getAttribute(stats,
              "searchRequests"));
      return SNMPMonitor.counter32Value(value);
    } else {
      return 0L;
    }
  }
  /**
   * {@inheritDoc}
   * @return DsApplIfModifyRDNOps
   */
  @Override
  public Long getDsApplIfModifyRDNOps() {
    if (stats == null) {
      stats = this.monitor.getConnectionHandlerStatistics(
              connectionHandlerName);
    }
    if (stats != null) {
      long value = Long.parseLong((String) this.monitor.getAttribute(
              stats, "modifyDNRequests"));
      return SNMPMonitor.counter32Value(value);
    } else {
      return 0L;
    }
  }
  /**
   * {@inheritDoc}
   * @return DsApplIfModifyEntryOps
   */
  @Override
  public Long getDsApplIfModifyEntryOps() {
    if (stats == null) {
      stats = this.monitor.getConnectionHandlerStatistics(
              connectionHandlerName);
    }
    if (stats != null) {
      long value = Long.parseLong((String) this.monitor.getAttribute(
              stats, "modifyRequests"));
      return SNMPMonitor.counter32Value(value);
    } else {
      return 0L;
    }
  }
  /**
   * {@inheritDoc}
   * @return DsApplIfRemoveEntryOps
   */
  @Override
  public Long getDsApplIfRemoveEntryOps() {
    if (stats == null) {
      stats = this.monitor.getConnectionHandlerStatistics(
              connectionHandlerName);
    }
    if (stats != null) {
      long value = Long.parseLong((String) this.monitor.getAttribute(
              stats, "deleteRequests"));
      return SNMPMonitor.counter32Value(value);
    } else {
      return 0L;
    }
  }
  /**
   * {@inheritDoc}
   * @return DsApplIfAddEntryOps
   */
  @Override
  public Long getDsApplIfAddEntryOps() {
    if (stats == null) {
      stats = this.monitor.getConnectionHandlerStatistics(
              connectionHandlerName);
    }
    if (stats != null) {
      long value = Long.parseLong((String) this.monitor.getAttribute(
              stats, "addRequests"));
      return SNMPMonitor.counter32Value(value);
    } else {
      return 0L;
    }
  }
  /**
   * {@inheritDoc}
   * @return DsApplIfCompareOps
   */
  @Override
  public Long getDsApplIfCompareOps() {
    if (stats == null) {
      stats = this.monitor.getConnectionHandlerStatistics(
              connectionHandlerName);
    }
    if (stats != null) {
      long value = Long.parseLong((String) this.monitor.getAttribute(
              stats, "compareRequests"));
      return SNMPMonitor.counter32Value(value);
    } else {
      return 0L;
    }
  }
  /**
   * {@inheritDoc}
   * @return DsApplIfReadOps
   */
  @Override
  public Long getDsApplIfReadOps() {
    return this.getDsApplIfCompareOps() +
            this.getDsApplIfAddEntryOps() +
            this.getDsApplIfRemoveEntryOps() +
            this.getDsApplIfModifyEntryOps() +
            this.getDsApplIfModifyRDNOps() +
            this.getDsApplIfSearchOps();
  }
  /**
   * {@inheritDoc}
   * @return DsApplIfOutBytes
   */
  @Override
  public Long getDsApplIfOutBytes() {
    if (stats == null) {
      stats = this.monitor.getConnectionHandlerStatistics(
              connectionHandlerName);
    }
    if (stats != null) {
      long value = Long.parseLong((String) this.monitor.getAttribute(
              stats, "bytesWritten"));
      return SNMPMonitor.counter32Value(value);
    } else {
      return 0L;
    }
  }
  /**
   * {@inheritDoc}
   * @return DsApplIfInBytes
   */
  @Override
  public Long getDsApplIfInBytes() {
    if (stats == null) {
      stats = this.monitor.getConnectionHandlerStatistics(
              connectionHandlerName);
    }
    if (stats != null) {
      long value = Long.parseLong((String) this.monitor.getAttribute(
              stats, "bytesRead"));
      return SNMPMonitor.counter32Value(value);
    } else {
      return 0L;
    }
  }
  /**
   * {@inheritDoc}
   * @return DsApplIfProtocolIndex
   */
  @Override
  public Integer getDsApplIfProtocolIndex() {
    return this.DsApplIfProtocolIndex;
  }
  /**
   * {@inheritDoc}
   * @return ApplIndex index of the corresponding DsTable entry
   */
  @Override
  public Integer getApplIndex() {
    return this.ApplIndex;
  }
  /**
   * Returns the ObjectName of the SNMP entry MBean
   * @return ObjectName of the entry
   */
  public ObjectName getObjectName() {
    if (this.entryName == null) {
      try {
        String name = this.connectionHandlerName.getKeyProperty("Rdn2");
        this.entryName = new ObjectName(
                SNMPConnectionHandlerDefinitions.SNMP_DOMAIN +
                "type=DsApplIfOpsEntry,name=" + name);
      } catch (Exception ex) {
        if (DebugLogger.debugEnabled()) {
           TRACER.debugCaught(DebugLogLevel.ERROR, ex);
        }
        return null;
      }
      return this.entryName;
    }
    return this.entryName;
  }
}
opends/src/snmp/src/org/opends/server/snmp/DsEntry.java
New file
@@ -0,0 +1,43 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import javax.management.ObjectName;
/**
 * This interface should be implemented by all the DS:OID MBean and
 * allows to get the ObjectName of a SNMP OID MBean
 */
public interface DsEntry {
  /**
   * Returns the ObjectName of the SNMP Entry
   * @return the ObjectName of the SNMP Entry
   */
  public ObjectName getObjectName();
}
opends/src/snmp/src/org/opends/server/snmp/DsMIBImpl.java
New file
@@ -0,0 +1,355 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import javax.management.MBeanServer;
import com.sun.management.snmp.agent.SnmpMib;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Set;
import javax.management.MBeanServerNotification;
import javax.management.Notification;
import javax.management.NotificationListener;
import javax.management.ObjectName;
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.DebugLogLevel;
/**
 * The class reprents the "DsMIB" group implementation.
 * The group is defined with the following oid: 1.3.6.1.2.1.66.
 */
public class DsMIBImpl extends DsMIB implements NotificationListener {
   /**
   * The serial version identifier required to satisfy the compiler because
   * this class implements the <CODE>java.io.Serializable</CODE> interface.
   * This value was generated using the <CODE>serialver</CODE> command-line
   * utility included with the Java SDK.
   */
  private static final long serialVersionUID = 6787374593664749374L;
  /**
   * The debug log tracer for this class.
   */
  private static final DebugTracer TRACER = DebugLogger.getTracer();
  /**
   * Directory Server MIB access
   */
  private SnmpMib mib;
  /**
   * Register or not the SNMP MBean
   */
  private boolean registeredSnmpMBean = false;
  /**
   * List of DsTableEntries
   */
  private Hashtable<ObjectName, DsEntry> dsTableEntries =
          new Hashtable<ObjectName, DsEntry>();
  /**
   * List of DsIntTableEntries
   */
  private Hashtable<ObjectName, DsEntry> dsApplIfOpsTableEntries =
          new Hashtable<ObjectName, DsEntry>();
   /**
   * List of DsIntTableEntries
   */
  private Hashtable<ObjectName, DsEntry> dsIntTableEntries =
          new Hashtable<ObjectName, DsEntry>();
  /**
   * Directory Server MBeanServer
   */
  private MBeanServer server;
  /**
   * cn=monitor Mapping Class SNMP->MBean
   */
  private SNMPMonitor monitor;
  /**
   * Start Table indexes
   */
  private int applIndex = 1;
  private int applIfOpsIndex = 1;
  private int intIndex = 1;
  /**
   * Constructor for the "DsMIB" group.
   * If the group contains a table, the entries created through an SNMP SET
   * will not be registered in Java DMK.
   * @param myMib snmp mib
   * @param server where the MBeans are registered
   * @param registered if the MBeans should be registered in server
   */
  public DsMIBImpl(SnmpMib myMib, MBeanServer server, boolean registered) {
    super(myMib);
    this.mib = myMib;
    this.server = server;
    this.monitor = SNMPMonitor.getMonitor(server);
    this.registeredSnmpMBean = registered;
    this.dsTableEntries.clear();
    this.dsApplIfOpsTableEntries.clear();
    this.dsIntTableEntries.clear();
    this.applIndex = 1;
    this.applIfOpsIndex = 1;
    this.intIndex = 1;
    // Initialize the MIB
    initDsTables();
    if (DebugLogger.debugEnabled()) {
      TRACER.debugVerbose("DsMIB Group Created");
    }
  }
  /**
   * Returns the Set of ObjectName of all the created entries in all the Table
   * @return Set<ObjectName>
   */
  @SuppressWarnings("unchecked")
  public Set<ObjectName> getEntriesObjectNames() {
    Set<ObjectName> results = new HashSet<ObjectName>();
    results.addAll(this.dsTableEntries.keySet());
    results.addAll(this.dsApplIfOpsTableEntries.keySet());
    results.addAll(this.dsIntTableEntries.keySet());
    return results;
  }
  /**
   * Returns the list of Created Entries
   * @return Set<ObjectName> of created entries
   */
  @SuppressWarnings("unchecked")
  public Set<ObjectName> getEntries() {
    Set results = new HashSet();
    results.addAll(this.dsTableEntries.values());
    results.addAll(this.dsApplIfOpsTableEntries.values());
    results.addAll(this.dsIntTableEntries.values());
    return results;
  }
  /**
   * handleNotification callback called when an MBeansServer Notification is
   * received
   * @param notification received
   * @param handback
   */
  public void handleNotification(Notification notification, Object handback) {
    if (notification instanceof MBeanServerNotification) {
      MBeanServerNotification notif = (MBeanServerNotification) notification;
      // Process the ConnectionHandler Registration
      if (notif.getType().equals(
              MBeanServerNotification.REGISTRATION_NOTIFICATION)) {
        ObjectName name = notif.getMBeanName();
        if ((name.getKeyProperty("Rdn1").equals("cn-monitor")) &&
                (isAConnectionHandler(name))) {
          addRowInDsApplIfOpsTable(name);
        }
      }
      // Process the ConnectionHandler unregistration
      else if (notif.getType().equals(
              MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
        ObjectName name = notif.getMBeanName();
        if ((name.getKeyProperty("Rdn1").equals("cn-monitor")) &&
                (isAConnectionHandler(name))) {
          removeRowInDsApplIfOpsTable(name);
        }
      }
    }
  }
  /**
   * initDsTables in the dsMib Group
   */
  private void initDsTables() {
    // Initialize the DSTable with one Entry : Current Directory Server
    initializeDsTable();
    // Initialize the DsApplIfOpsTable with one entry per Connection Handler
    initializeDsApplIfOpsTable();
    // Register as listener of the MBeanServer Notification to process
    // new Connection Handler MBeans
    try {
      ObjectName name = new ObjectName(
              "JMImplementation:type=MBeanServerDelegate");
      this.server.addNotificationListener(name, this, null, null);
    } catch (Exception ex) {
      if (DebugLogger.debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
    }
  }
  /**
   * initializeDsTable with the current Direcotry server instance
   * Only one entry is created in this table
   **/
  private void initializeDsTable() {
    // Add the Current Directory Server Instance in the DsTable
    addRowInDsTable();
  }
  /**
   * initializeDsApplIfOpsTable with the already registered Connection
   * Handlers
   **/
  private void initializeDsApplIfOpsTable() {
    // Get the list of ConnectionHandlers MBeans
    Set connectionHandlers = this.monitor.getConnectionHandlers();
    for (Iterator iter=connectionHandlers.iterator();iter.hasNext();) {
      ObjectName name = (ObjectName)iter.next();
      // Add the ConnectionHandler in the DsApplIfOpsTable
      addRowInDsApplIfOpsTable(name);
    }
  }
 /**
  * addRowInDsTable
  * @return true if the entry has been added else false
  */
  private boolean addRowInDsTable() {
    try {
      // Create the entry
      DsTableEntryImpl entry = new DsTableEntryImpl(
              this.mib, this.server, this.applIndex);
      // if the entry alreday exists nothing to do
      if ((this.dsTableEntries.containsKey(entry.getObjectName())) ||
              (entry == null)) {
        return true;
      }
      // Add the entry in the table
      this.DsTable.addEntry(entry, entry.getObjectName());
      this.dsTableEntries.put(entry.getObjectName(), (DsEntry)entry);
      if (this.registeredSnmpMBean) {
        // Register the SNMP OID MBean
        this.server.registerMBean(entry, entry.getObjectName());
      }
    } catch (Exception ex) {
        if (DebugLogger.debugEnabled()) {
           TRACER.debugCaught(DebugLogLevel.ERROR, ex);
        }
        return false;
    }
    return true;
  }
  /**
   * addRowInDsIntTable Not Supported
   * @return false (Not Supported for this current delivery)
   */
  private boolean addRowInDsIntTable() {
    return false;
  }
  /**
   * addRowInDsApplIfOpsTable
   * @param connectionHandlerName to add
   * @return true if the entry has been added else false
   */
  private boolean addRowInDsApplIfOpsTable(ObjectName connectionHandlerName) {
    try {
      // Created the entry
      DsApplIfOpsEntryImpl entry = new DsApplIfOpsEntryImpl(
              this.mib, this.server, connectionHandlerName,
              this.applIndex, this.applIfOpsIndex);
      // If the entry already exists then nothing to do
      if ((this.dsApplIfOpsTableEntries.containsKey(entry.getObjectName())) ||
              (entry == null)) {
        return true;
      }
      // Add the entry in the Table
      this.DsApplIfOpsTable.addEntry(entry);
      this.dsApplIfOpsTableEntries.put(entry.getObjectName(), entry);
      this.applIfOpsIndex++;
      if (this.registeredSnmpMBean) {
        // Register the SNMP OID MBean in the MBeanServer
        this.server.registerMBean(entry, entry.getObjectName());
      }
    } catch (Exception ex) {
      if (DebugLogger.debugEnabled()) {
          TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
      return false;
    }
    return true;
  }
  /**
   * removeRowInDsApplIfOpsTable
   * @param connectionHandlerName
   * @return true if the entry has been removed else false
   */
  private boolean removeRowInDsApplIfOpsTable(ObjectName connectionHandlerName){
    try {
      // Check if the entry is known
      if (!this.dsApplIfOpsTableEntries.containsKey(connectionHandlerName)) {
        return false;
      }
      DsApplIfOpsEntryImpl entry = (DsApplIfOpsEntryImpl)
              this.dsApplIfOpsTableEntries.get(connectionHandlerName);
      this.DsApplIfOpsTable.removeEntry((DsApplIfOpsEntryMBean) entry);
      this.dsApplIfOpsTableEntries.remove(connectionHandlerName);
      this.server.unregisterMBean(entry.getObjectName());
      return true;
    } catch (Exception ex) {
      return false;
    }
  }
/**
 * isAConnectionHandler allows to check if the Mbean is a Connection Handler
 * @param name of the MBean
 * @return true if the MBean is a Connection Handler else false
 */
  private boolean isAConnectionHandler(ObjectName name) {
    String canonicalName = name.getCanonicalName();
    if ((canonicalName.contains("Connection_Handler")) &&
            (!(canonicalName.endsWith("_Statistics")))) {
      return true;
    } else {
      return false;
    }
  }
}
opends/src/snmp/src/org/opends/server/snmp/DsTableEntryImpl.java
New file
@@ -0,0 +1,190 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import com.sun.management.snmp.agent.SnmpMib;
import java.util.Iterator;
import java.util.Set;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.DebugLogLevel;
/**
 * The class is used for implementing the "DsTableEntry" group implementation.
 * The group is defined with the following oid: 1.3.6.1.2.1.66.1.1.
 */
public class DsTableEntryImpl extends DsTableEntry implements DsEntry {
  /**
   * The serial version identifier required to satisfy the compiler because
   * this class implements the <CODE>java.io.Serializable</CODE> interface.
   * This value was generated using the <CODE>serialver</CODE> command-line
   * utility included with the Java SDK.
   */
  private static final long serialVersionUID = -3346380035687141480L;
  /**
   * The debug log tracer for this class.
   */
  private static final DebugTracer TRACER = DebugLogger.getTracer();
  /**
   * Directory Server MBeanServer
   */
  private MBeanServer server;
  /**
   * Mapping Class
   */
  private SNMPMonitor monitor;
  /**
   * ObjectName of the entry
   */
  private ObjectName entryName;
  /**
   * Index of the Directory Server Instance (applIndex)
   */
  private Integer applIndex;
  /**
   * Creates a DsTableEntry
   * @param mib the SNMP Mib where the entry will be created
   * @param server where the mapping objects will be found
   * @param index of the entry in the DsTable
   */
  public DsTableEntryImpl(SnmpMib mib,
          MBeanServer server,
          int index) {
    super(mib);
    this.server = server;
    this.monitor = SNMPMonitor.getMonitor(server);
    this.applIndex = new Integer(index);
  }
  /**
   * {@inheritDoc}
   * @return DsCacheHits as Long
   */
  @Override
  public Long getDsCacheHits() {
    try {
      Long value = Long.parseLong((String) this.monitor.getAttribute(
              SNMPConnectionHandlerDefinitions.MONITOR_ENTRY_CACHES_OBJECTNANE,
              "entryCacheHits"));
      return SNMPMonitor.counter32Value(value);
    } catch (Exception ex) {
      if (DebugLogger.debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
    }
    return 0L;
  }
  /**
   * {@inheritDoc}
   * @return DsCacheEntries as Long
   */
  @Override
  public Long getDsCacheEntries() {
    try {
      Long value = Long.parseLong((String) this.monitor.getAttribute(
              SNMPConnectionHandlerDefinitions.MONITOR_ENTRY_CACHES_OBJECTNANE,
              "currentEntryCacheCount"));
      return SNMPMonitor.gauge32Value(value);
    } catch (Exception ex) {
      if (DebugLogger.debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
    }
    return 0L;
  }
  /**
   * {@inheritDoc}
   * @return DsMasterEntries as Long
   */
  @Override
  public Long getDsMasterEntries() {
    Set monitorBackends = null;
    Long result = 0L;
    try {
      monitorBackends = this.server.queryNames(SNMPMonitor.pattern, null);
      for (Iterator iter = monitorBackends.iterator(); iter.hasNext();) {
        ObjectName name = (ObjectName) iter.next();
        Object value = this.monitor.getAttribute(name,
                "ds-backend-entry-count");
        if (value != null) {
          result = result + new Long((String) value);
        }
      }
      return SNMPMonitor.gauge32Value(result);
    } catch (Exception ex) {
      if (DebugLogger.debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
    }
    return 0L;
  }
  /**
   * {@inheritDoc}
   * @return DsServerDescription as String
   */
  @Override
  public String getDsServerDescription() {
    String result = null;
    try {
      result = (String) this.monitor.getAttribute(
        SNMPConnectionHandlerDefinitions.MONITOR_SYSTEM_INFORMATION_OBJECTNAME,
        "workingDirectory");
    } catch (Exception ex) {
      if (DebugLogger.debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
    }
    return result;
  }
  /**
   * Gets the object of the entry
   * @return ObjectName of the entry
   */
  public ObjectName getObjectName() {
    if (this.entryName == null) {
      try {
        this.entryName = new ObjectName(
        SNMPConnectionHandlerDefinitions.SNMP_DOMAIN +
        "type=DsTableEntry,name=" +
        SNMPConnectionHandlerDefinitions.MONITOR_SYSTEM_INFORMATION_OBJECTNAME);
      } catch (Exception ex) {
        if (DebugLogger.debugEnabled()) {
          TRACER.debugCaught(DebugLogLevel.ERROR, ex);
        }
      }
    }
    return this.entryName;
  }
}
opends/src/snmp/src/org/opends/server/snmp/SNMPClassLoaderProvider.java
New file
@@ -0,0 +1,360 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import java.io.File;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.DebugLogLevel;
import static org.opends.messages.ProtocolMessages.*;
import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import com.sun.management.comm.SnmpV3AdaptorServer;
import com.sun.management.snmp.InetAddressAcl;
import com.sun.management.snmp.SnmpEngineParameters;
import com.sun.management.snmp.UserAcl;
import java.net.InetAddress;
import java.util.Iterator;
import java.util.Set;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.opends.server.admin.std.server.SNMPConnectionHandlerCfg;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.ConfigChangeResult;
import org.opends.server.types.ResultCode;
import org.opends.server.util.StaticUtils;
import org.opends.server.util.Validator;
public class SNMPClassLoaderProvider {
    /**
     * The debug log tracer for this class.
     */
    private static final DebugTracer TRACER = DebugLogger.getTracer();
    /**
     * The current configuration state.
     */
    private SNMPConnectionHandlerCfg currentConfig;
    /**
     * MBeanServer of OpenDS
     */
    private MBeanServer server;
    /**
     * MIB to manage
     */
    private DIRECTORY_SERVER_MIBImpl dsMib;
    /**
     * ObjectName of the MIB2605
     */
    private ObjectName mibObjName;
    /**
     * ObjectName of the SnmpAdaptor
     */
    private ObjectName snmpObjName;
    /**
     * SNMP Port Number for SNMP requests
     */
    private int snmpPort = 161;
    /**
     * Default SNMP trap port Number for SNMP Traps
     */
    private int snmpTrapPort = 162;
    /**
     * Default SNMP Version
     */
    private String snmpVersion = SNMPConnectionHandlerDefinitions.SNMP_VERSION_V3;
    /**
     * Registration of the SNMP MBeans
     */
    private boolean registeredSNMPMBeans = false;
    /**
     * The unique name for this connection handler
     */
    private String connectionHandlerName;
    /**
     * ObjectName of the UsmMIB
     */
    private ObjectName UsmObjName;
    private SnmpV3AdaptorServer snmpAdaptor;
    public SNMPClassLoaderProvider() {
    }
    public void initializeConnectionHandler(
            SNMPConnectionHandlerCfg configuration) {
        // Keep the connection handler configuration
        this.currentConfig = configuration;
        // Get the Directory Server JMX MBeanServer
        this.server = DirectoryServer.getJMXMBeanServer();
        // Initialize he Connection Handler with the givewn configuration
        this.initializeConnectionHandler();
    }
    public ConfigChangeResult applyConfigurationChange(
            SNMPConnectionHandlerCfg configuration) {
        try {
            // Register/UnRegister SNMP MBeans
            if ((this.registeredSNMPMBeans) &&
                    (!configuration.isRegisteredMbean())) {
                this.unregisterSnmpMBeans();
                this.registeredSNMPMBeans = configuration.isRegisteredMbean();
            } else if ((!this.registeredSNMPMBeans) &&
                    (configuration.isRegisteredMbean())) {
                this.unregisterSnmpMBeans();
                this.registeredSNMPMBeans = configuration.isRegisteredMbean();
            }
            // PortNumber/Version
            if ((this.snmpPort != configuration.getListenPort())) {
                this.server.unregisterMBean(this.snmpObjName);
                this.snmpAdaptor.stop();
                this.snmpPort = configuration.getListenPort();
                this.snmpAdaptor = this.getSnmpAdaptor(configuration);
                // Creates and starts the SNMP Adaptor
                this.snmpObjName = new ObjectName(
                        SNMPConnectionHandlerDefinitions.SNMP_DOMAIN +
                        "class=SnmpAdaptorServer,protocol=snmp,port=" + snmpPort);
                this.server.registerMBean(this.snmpAdaptor, this.snmpObjName);
                this.snmpAdaptor.start();
                // Send a coldStart SNMP Trap on the new trap port if required
                if (this.snmpTrapPort != configuration.getTrapPort()) {
                    this.snmpTrapPort = configuration.getTrapPort();
                    this.snmpAdaptor.setTrapPort(snmpTrapPort);
                    this.snmpAdaptor.snmpV1Trap(0, 0, null);
                }
            }
        } catch (Exception ex) {
            if (debugEnabled()) {
                TRACER.debugCaught(DebugLogLevel.ERROR, ex);
            }
        }
        // Check if the security file
        // If security file have changed, changeConfiguration not
        // Supported
        return new ConfigChangeResult(ResultCode.SUCCESS, false);
    }
    /**
     * Gets the ObjectName of the crated USM MIB MBean
     * @return
     */
    public ObjectName getUsmMIBName() {
        return this.UsmObjName;
    }
     // private methods
    private void initializeConnectionHandler() {
        // Compute the connectionHandler name
        this.connectionHandlerName = "SNMP Connection Handler " +
                this.currentConfig.getListenPort();
        // Gets the configuration parameters
        this.snmpPort = this.currentConfig.getListenPort();
        this.snmpTrapPort = this.currentConfig.getTrapPort();
        this.registeredSNMPMBeans = this.currentConfig.isRegisteredMbean();
        this.snmpVersion = this.currentConfig.getVersion().trim().toLowerCase();
        if (!SNMPConnectionHandlerDefinitions.SUPPORTED_SNMP_VERSION.contains(
                this.snmpVersion)) {
            this.snmpVersion = SNMPConnectionHandlerDefinitions.SNMP_VERSION_V3;
        }
        // Creates all the required objects for SNMP MIB 2605 Support
        try {
            // Creates and starts the SNMP Adaptor
            this.snmpObjName = new ObjectName(
                    SNMPConnectionHandlerDefinitions.SNMP_DOMAIN +
                    "class=SnmpAdaptorServer,protocol=snmp,port=" + snmpPort);
            // Create the SNMP Adaptor with the appropriated parameters
            this.snmpAdaptor = this.getSnmpAdaptor(this.currentConfig);
            // Create the Usm MIB to allow user management
            if ((this.registeredSNMPMBeans) && (this.snmpVersion.equals(
                    SNMPConnectionHandlerDefinitions.SNMP_VERSION_V3))) {
                this.UsmObjName = new ObjectName(
                        SNMPConnectionHandlerDefinitions.SNMP_DOMAIN +
                        "type=USM_MIB");
                try {
                     this.snmpAdaptor.registerUsmMib(server, this.UsmObjName);
                }
                catch (Exception ex) {
                }
            }
            this.snmpAdaptor.start();
            // Send a coldStart SNMP Trap.
            this.snmpAdaptor.setTrapPort(snmpTrapPort);
            this.snmpAdaptor.snmpV1Trap(0, 0, null);
            // Create an instance of the customized MIB
            this.mibObjName = new ObjectName(
                    SNMPConnectionHandlerDefinitions.SNMP_DOMAIN +
                    "class=DIRECTORY_SERVER_MIB");
            this.dsMib = new DIRECTORY_SERVER_MIBImpl(
                    this.registeredSNMPMBeans, this.mibObjName);
            this.dsMib.setSnmpAdaptor(snmpAdaptor);
            this.server.registerMBean(this.snmpAdaptor, snmpObjName);
            this.server.registerMBean(this.dsMib, this.mibObjName);
        } catch (Exception ex) {
            if (debugEnabled()) {
                TRACER.debugCaught(DebugLogLevel.ERROR, ex);
            }
        }
    }
    public void finalizeConnectionHandler() {
        try {
            // Send a trap when stop
            this.snmpAdaptor.snmpV1Trap(0, 0, null);
            String[] names = this.snmpAdaptor.getMibs();
            // Stop the SNMP Adaptor
            this.snmpAdaptor.stop();
            this.server.unregisterMBean(this.snmpObjName);
            this.server.unregisterMBean(this.mibObjName );
            this.server.unregisterMBean(new ObjectName(
                        SNMPConnectionHandlerDefinitions.SNMP_DOMAIN +
                        "type=group,name=DsMib"));
            // Unregister the created SNMP MBeans
            if (this.registeredSNMPMBeans) {
                this.unregisterSnmpMBeans();
                if (this.snmpVersion.equals(
                        SNMPConnectionHandlerDefinitions.SNMP_VERSION_V3)) {
                    this.server.unregisterMBean(this.UsmObjName);
                }
            }
        } catch (Exception ex) {
            if (debugEnabled()) {
                TRACER.debugCaught(DebugLogLevel.ERROR, ex);
            }
        }
    }
    private void unregisterSnmpMBeans() {
        Set objectNames = this.dsMib.getMib().getEntriesObjectNames();
        for (Iterator iter = objectNames.iterator(); iter.hasNext();) {
            ObjectName name = (ObjectName) iter.next();
            try {
                this.server.unregisterMBean(name);
            } catch (Exception ex) {
            }
        }
    }
    private SnmpV3AdaptorServer getSnmpAdaptor(SNMPConnectionHandlerCfg configuration) {
        Validator.ensureNotNull(configuration);
        SnmpV3AdaptorServer adaptor = null;
        try {
            // Set the USM security file
            String usmConfigPath = configuration.getSecurityAgentFile();
            File file = StaticUtils.getFileForPath(usmConfigPath);
            if (configuration.getVersion().toLowerCase().equals(
                    SNMPConnectionHandlerDefinitions.SNMP_VERSION_V3)) {
                System.setProperty("jdmk.security.file", file.getAbsolutePath());
            }
            // Create the Security Parameters for the engine
            SnmpEngineParameters engineParameters = new SnmpEngineParameters();
            // Set V3 Security parameters
            engineParameters.activateEncryption();
            // Create the UACL controller
            UserAcl uacls = (UserAcl)new SNMPUserAcl(configuration);
            engineParameters.setUserAcl(uacls);
            // V1/V2 Security parameters
            InetAddressAcl acls = (InetAddressAcl)new SNMPInetAddressAcl(configuration);
            adaptor = new SnmpV3AdaptorServer(engineParameters, null, acls,
                    configuration.getListenPort(), InetAddress.getLocalHost());
            // Enable the community to context translation for V1/V2 to V3
            adaptor.enableCommunityStringAtContext();
            return adaptor;
        } catch (Exception ex) {
            TRACER.debugError("Could not instanciate the SNMP Adaptor");
            return adaptor;
        }
    }
}
opends/src/snmp/src/org/opends/server/snmp/SNMPConnectionHandler.java
New file
@@ -0,0 +1,296 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import org.opends.messages.Message;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.ConnectionHandler;
import org.opends.server.types.ConfigChangeResult;
import org.opends.server.types.DN;
import org.opends.server.types.HostPort;
import org.opends.server.admin.std.server.SNMPConnectionHandlerCfg;
import org.opends.server.core.DirectoryServer;
import static org.opends.messages.ProtocolMessages.*;
import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
/**
 * This class defines an SNMP connection handler, which can be used to answer
 * SNMP Requests on MIB 2605. The MIB 2605 exposes a set of information
 * on Directory Server instances, protocol handlers. The information
 * regarding peer Directory Servers are not supported yet.
 */
public final class SNMPConnectionHandler
        extends ConnectionHandler<SNMPConnectionHandlerCfg>
        implements ConfigurationChangeListener<SNMPConnectionHandlerCfg>,
        AlertGenerator {
    // Current configuration
    SNMPConnectionHandlerCfg currentConfig;
    /**
     * The list of active client connection
     */
    private LinkedList<ClientConnection> connectionList;
    /**
     * The set of listeners for this connection handler
     */
    private LinkedList<HostPort> listeners = new LinkedList<HostPort>();
    /**
     * SNMP Connection Handler delegation class
     */
    private SNMPClassLoaderProvider provider;
    /**
     * Is the SNMP Connection Handler Operational
     */
    private boolean isOperational = false;
    /**
     * Creates a new instance of this connection handler.  All initialization
     * should be performed in the {@code initializeConnectionHandler} method.
     */
    public SNMPConnectionHandler() {
        super("SNMPConnectionHandler");
        this.connectionList = new LinkedList<ClientConnection>();
    }
    /**
     * {@inheritDoc}
     */
    @Override()
    public void initializeConnectionHandler(
            SNMPConnectionHandlerCfg configuration) {
        if (configuration == null) {
            Message message = ERR_SNMP_CONNHANDLER_NO_CONFIGURATION.get();
            logError(message);
            return;
        }
        // Keep the connection handler configuration
        this.currentConfig = configuration;
        String jarLocation = this.currentConfig.getOpendmkJarfile();
        if ((jarLocation==null) || (jarLocation.length()==0)){
            Message message = ERR_SNMP_CONNHANDLER_NO_OPENDMK_JARFILES.get();
            logError(message);
            return;
        }
        // Get the jarFile Location and test if exists to be able to
        // start the SNMP Connection Handler as requested
        File jarFile = new File(jarLocation);
        File fullpathFile;
        if (!jarFile.isAbsolute()) {
            fullpathFile = new File(DirectoryServer.getServerRoot(),
                    this.currentConfig.getOpendmkJarfile());
        } else {
            fullpathFile = new File(this.currentConfig.getOpendmkJarfile());
        }
        if (!fullpathFile.exists()) {
            Message message = ERR_SNMP_CONNHANDLER_NO_OPENDMK_JARFILES.get();
            logError(message);
            return;
        }
        // Clear the listeners list
        this.listeners.clear();
        this.listeners.add(new HostPort("0.0.0.0",
                this.currentConfig.getListenPort()));
        if (!this.isOperational(fullpathFile)) {
            Message message = ERR_SNMP_CONNHANDLER_NO_OPENDMK_JARFILES.get();
            logError(message);
            return;
        }
        // Create the SNMPClassLoaderProvider
        this.provider = new SNMPClassLoaderProvider();
        // Call the delegate class
        this.provider.initializeConnectionHandler(this.currentConfig);
    }
    /**
     * {@inheritDoc}
     */
    @Override()
    public void finalizeConnectionHandler(Message finalizeReason,
            boolean closeConnections) {
        if (this.provider!=null) {
            this.provider.finalizeConnectionHandler();
        }
    }
    /**
     * {@inheritDoc}
     */
    @Override()
    public String getConnectionHandlerName() {
        return "SNMP Connection Handler";
    }
    /**
     * {@inheritDoc}
     */
    @Override()
    public String getProtocol() {
        return "SNMP";
    }
    /**
     * {@inheritDoc}
     */
    @Override()
    public Collection<HostPort> getListeners() {
        // There are no listeners for this connection handler.
        return Collections.<HostPort>emptySet();
    }
    /**
     * {@inheritDoc}
     */
    @Override()
    public Collection<ClientConnection> getClientConnections() {
        // There are no client connections for this connection handler.
        return Collections.<ClientConnection>emptySet();
    }
    /**
     * {@inheritDoc}
     */
    @Override()
    public void run() {
    }
    /**
     * {@inheritDoc}
     */
    @Override()
    public void toString(StringBuilder buffer) {
        buffer.append("SNMPConnectionHandler");
    }
    /**
     * {@inheritDoc}
     */
    public boolean isConfigurationChangeAcceptable(
            SNMPConnectionHandlerCfg configuration,
            List<Message> unacceptableReasons) {
        // The configuration should always be acceptable.
        return true;
    }
    /**
     * {@inheritDoc}
     */
    public ConfigChangeResult applyConfigurationChange(
            SNMPConnectionHandlerCfg configuration) {
        if ((this.isOperational) && (this.provider!=null)){
            return this.provider.applyConfigurationChange(configuration);
        }
        return null;
    }
    /**
     * {@inheritDoc}
     */
    public DN getComponentEntryDN() {
        return this.currentConfig.dn();
    }
    /**
     * {@inheritDoc}
     */
    public String getClassName() {
        return SNMPConnectionHandler.class.getName();
    }
    /**
     * {@inheritDoc}
     */
    public LinkedHashMap<String, String> getAlerts() {
        LinkedHashMap<String, String> alerts = new LinkedHashMap<String, String>();
        return alerts;
    }
    @SuppressWarnings("unchecked")
    private void addFile(File file) {
        try {
            URL u = new URL("jar:file://"+ file.toString()+"!/");
            Class[] parameters = new Class[]{URL.class};
            URLClassLoader sysloader = (URLClassLoader)ClassLoader.getSystemClassLoader();
        Class sysclass = URLClassLoader.class;
        Method method = sysclass.getDeclaredMethod("addURL",new Class[]{URL.class});
            method.setAccessible(true);
        method.invoke(sysloader,new Object[]{ u });
        }
        catch (Throwable t) {
        }
    }//end method
    private void initSnmpClasses() {
        try {
            URLClassLoader opendsLoader = (URLClassLoader)DirectoryServer.getClassLoader();
            Class.forName("com.sun.management.comm.SnmpV3AdaptorServer", true, opendsLoader);
            Class.forName("com.sun.management.snmp.InetAddressAcl",true, opendsLoader);
            Class.forName("com.sun.management.snmp.SnmpEngineParameters",true, opendsLoader);
            Class.forName("com.sun.management.snmp.UserAcl",true, opendsLoader);
            this.isOperational = true;
        } catch (ClassNotFoundException ex) {
            this.isOperational = false;
        }
    }
    public boolean isOperational(File file) {
        this.addFile(file);
        this.initSnmpClasses();
        return this.isOperational;
    }
    public boolean isOperational() {
        return this.isOperational;
    }
}
opends/src/snmp/src/org/opends/server/snmp/SNMPConnectionHandlerDefinitions.java
New file
@@ -0,0 +1,90 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import java.util.HashSet;
import java.util.Set;
/**
 * SNMP definitions.
 */
public class SNMPConnectionHandlerDefinitions {
  // SNMP Version supported
  public static String SNMP_VERSION_V1 = "v1";
  public static String SNMP_VERSION_V2 = "v2";
  public static String SNMP_VERSION_V3 = "v3";
  /**
   * List of Supported SNMP Version
   */
  public static Set<String> SUPPORTED_SNMP_VERSION=new HashSet<String>();
  static {
    SUPPORTED_SNMP_VERSION.add(SNMP_VERSION_V1);
    SUPPORTED_SNMP_VERSION.add(SNMP_VERSION_V2);
    SUPPORTED_SNMP_VERSION.add(SNMP_VERSION_V3);
  }
  // Domain for SNMP MBeans
  public static final String SNMP_DOMAIN =
          "org.opends.server.snmp:";
  // Domain for Monitor MBeans
  public static final String JMX_DOMAIN =
          "org.opends.server:";
  // Name of monitor Mbeans
  public static final String MONITOR_CLIENT_CONNECTIONS_OBJECTNAME =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-Client_Connections";
  public static final String MONITOR_ENTRY_CACHES_OBJECTNANE =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-Entry_Caches";
  public static final String MONITOR_JVM_MEMORY_USAGE_OBJECTNAME =
          "RootDSE,Rdn1=cn-monitor,Rdn2=cn-JVM_Memory_Usage";
  public static final String MONITOR_JVM_STACK_TRACE_OBJECTNAME = "" +
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-JVM_Stack_Trace";
  public static final String MONITOR_SYSTEM_INFORMATION_OBJECTNAME =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-System_Information";
  public static final String MONITOR_VERSION_OBJECTNAME =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-Version";
  public static final String MONITOR_WORK_QUEUE_OBJECTNAME =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-Work_Queue";
  public static final String MONITOR_ADMIN_ROOT_BACKEND_OBJECTNAME =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-adminRoot_Backend";
  public static final String MONITOR_ADSTRUSTSTORE_BACKEND_OBJECTNAME =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-adstruststore_Backend";
  public static final String MONITOR_BACKUP_BACKEND_OBJECTNAME =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-backup_Backend";
  public static final String MONITOR_MONITOR_BACKEND_OBJECTNAME =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-monitor_Backend";
  public static final String MONITOR_SCHEMA_BACKEND_OBJECTNAME =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-schema_Backend";
  public static final String MONITOR_TASKS_BACKEND_OBJECTNAME =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-tasks_Backend";
  public static final String MONITOR_USERROOT_BACKEND_OBJECTNAME =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-userRoot_Backend";
  public static final String MONITOR_USERROOT_DATABASE_ENVIRONMENT_OBJECTNAME =
          "rootDSE,Rdn1=cn-monitor,Rdn2=cn-userRoot_Database_Environment";
}
opends/src/snmp/src/org/opends/server/snmp/SNMPInetAddressAcl.java
New file
@@ -0,0 +1,210 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import com.sun.management.snmp.InetAddressAcl;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.Vector;
import org.opends.server.admin.std.server.SNMPConnectionHandlerCfg;
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.loggers.debug.DebugTracer;
/**
 * This class allows to manage the IP-ACL based access rights
 * for SNMP v1/v2c.
 */
public class SNMPInetAddressAcl implements InetAddressAcl {
    /**
     * The debug log tracer for this class.
     */
    private static final DebugTracer TRACER = DebugLogger.getTracer();
    /**
     * Current Security Configuration for the SNMP Connection Handler.
     */
    private SNMPConnectionHandlerCfg currentConfig;
    private TreeSet<InetAddress> hostsList;
    private boolean allManagers = false;
    private SortedSet<String> trapsDestinations;
    private String trapsCommunity;
    private SortedSet<String> communitiesList;
    /**
     * Creates an IP-Based ACL controller
     * @param configuration of the Configuration
     */
    public SNMPInetAddressAcl(SNMPConnectionHandlerCfg configuration) {
        super();
        this.currentConfig = configuration;
        // hostsList
        SortedSet tmp = this.currentConfig.getAllowedManager();
        if (tmp.isEmpty()) {
            this.allManagers=true;
        }
        this.hostsList = new TreeSet<InetAddress>();
        // Transform the String list into InetAddress List
        for (Iterator iter = tmp.iterator(); iter.hasNext();) {
            try {
                String dest = (String) iter.next();
                this.hostsList.add(InetAddress.getByName(dest));
            } catch (UnknownHostException ex) {
            }
        }
        this.trapsDestinations = this.currentConfig.getTrapsDestination();
        this.communitiesList = this.currentConfig.getCommunity();
        this.trapsCommunity = this.currentConfig.getTrapsCommunity();
    }
    /**
     * Gets the name of the acl
     * @return the name of the acl as a String
     */
    public String getName() {
        return "OpenDS";
    }
    /**
     * {@inheritDoc}
     */
    public boolean checkReadPermission(InetAddress address) {
        if (this.allManagers) {
            return true;
        }
        if ((this.hostsList==null) || (this.hostsList.isEmpty())) {
            return false;
        }
        // check the address is in the configured allowed managers
        boolean found = false;
        for (Iterator iter = this.hostsList.iterator(); iter.hasNext();) {
            InetAddress host = (InetAddress)iter.next();
            if (host.equals(address)) {
                found = true;
                break;
            }
        }
        return found;
    }
    /**
     * {@inheritDoc}
     */
    public boolean checkReadPermission(InetAddress address, String community) {
        if ((this.checkReadPermission(address)) &&
                (this.checkCommunity(community))) {
            return true;
        } else {
            return false;
        }
    }
    /**
     * {@inheritDoc}
     */
    public boolean checkCommunity(String community) {
        return this.communitiesList.contains(community);
    }
    /**
     * {@inheritDoc}
     */
    public boolean checkWritePermission(InetAddress address) {
        // WRITE Access are always denied
        return false;
    }
    /**
     * {@inheritDoc}
     */
    public boolean checkWritePermission(InetAddress address, String community) {
        // WRITE Access are always denied
        return false;
    }
    /**
     * {@inheritDoc}
     * @return the list<InetAddress> of traps destinations
     */
    public Enumeration getTrapDestinations() {
        Vector<InetAddress> tempDests = new Vector<InetAddress>();
        for (Iterator iter = this.trapsDestinations.iterator(); iter.hasNext();)
        {
            try {
                String dest = (String) iter.next();
                InetAddress addr = InetAddress.getByName(dest);
                tempDests.add(addr);
            } catch (UnknownHostException ex) {
            }
        }
        return tempDests.elements();
    }
    /**
     * {@inheritDoc}
     * @param address
     * @return
     */
    public Enumeration getTrapCommunities(InetAddress address) {
        Vector<String> trapCommunities = new Vector<String>();
        trapCommunities.add(this.trapsCommunity);
        return trapCommunities.elements();
    }
    /**
     * {@inheritDoc}
     * @return an empty enumeration
     */
    public Enumeration getInformDestinations() {
        Vector<String> informDests = new Vector<String>();
        return informDests.elements();
    }
    /**
     * {@inheritDoc}
     * @param address
     * @return an empty enumeration
     */
    public Enumeration getInformCommunities(InetAddress address) {
        Vector<String> informCommunities = new Vector<String>();
        return informCommunities.elements();
    }
}
opends/src/snmp/src/org/opends/server/snmp/SNMPMonitor.java
New file
@@ -0,0 +1,362 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import com.sun.management.snmp.SnmpStatusException;
import java.security.PrivilegedAction;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.Set;
import javax.management.Attribute;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.security.auth.Subject;
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.jmx.Credential;
import org.opends.server.protocols.jmx.OpendsJmxPrincipal;
import org.opends.server.types.DebugLogLevel;
/**
 * The SNMPMonitor Class allows to get a singleton SNMPMonitor object allowing
 * to access the JMX cn=monitor MBean.
 */
public class SNMPMonitor {
  /**
   * Debug Tracer for this class
   */
  private static final DebugTracer TRACER = DebugLogger.getTracer();
  /**
   * Singleton SNMPMonitor object
   */
  private static SNMPMonitor monitor = null;
  /**
   * Monitor MBeanServer server
   */
  private MBeanServer server;
  /**
   * Subject Auth to use to access the JMX Mbeans cn=monitor
   */
  private Subject subject = null;
  /**
   * Pattern to use to query the cn=monitor MBeans
   */
  public static ObjectName pattern;
  static {
    try {
      pattern = new ObjectName(
              SNMPConnectionHandlerDefinitions.JMX_DOMAIN +
              "Name=rootDSE,Rdn1=cn-monitor,*");
    } catch (Exception ex) {
      if (DebugLogger.debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
    }
  }
  /**
   * Creates an SNMPMonitor object mapping
   * @param server to use to the mapping
   */
  private SNMPMonitor(MBeanServer server) {
    this.server = server;
    this.subject = new Subject();
    this.subject.getPrincipals().add(new OpendsJmxPrincipal("cn=anonymous"));
    InternalClientConnection clientConnection =
            InternalClientConnection.getRootConnection();
    this.subject.getPrivateCredentials().add(new Credential(clientConnection));
  }
  /**
   * Gets the singleton SNMPMonitor object
   * @param server
   * @return the SNMPMonitor mapping object
   */
  public static SNMPMonitor getMonitor(MBeanServer server) {
    if (monitor == null) {
      monitor = new SNMPMonitor(server);
    }
    return monitor;
  }
  /**
   * Gets the Connection Handlers Statistics MBean
   * @return the Set<ObjectName> of Connection Handlers Statistics.
   *     If Statistics do not exixist then an empty Set is returned
   */
  public Set<ObjectName> getConnectionHandlersStatistics() {
    Set<ObjectName> results = new HashSet<ObjectName>();
    try {
      Set monitorObjects = this.server.queryNames(SNMPMonitor.pattern, null);
      for (Iterator iter = monitorObjects.iterator(); iter.hasNext();) {
        ObjectName name = (ObjectName) iter.next();
        if ((name.getCanonicalName().contains("Connection_Handler")) &&
                (name.getCanonicalName().endsWith("_Statistics"))) {
          results.add(name);
        }
      }
    } catch (Exception ex) {
      if (DebugLogger.debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
    }
    return results;
  }
  /**
   * Return the ObjectName of the Connection Handler corresponding to
   * the statistics name
   * @param statistics ObjectName
   * @return the Connection Handler ObjectName, null otherwise
   */
  public ObjectName getConnectionHandler(ObjectName statistics) {
    // Check parameter
    if (statistics == null) {
      return null;
    }
    try {
      String value = statistics.getCanonicalName();
      if (!value.endsWith("_Statistics")) {
        return null;
      }
      int index = value.indexOf("_Statistics");
      String name = value.substring(0, index);
      ObjectName connectionHandlerName = new ObjectName(name);
      // Check if the MBean exists
      Set query = this.server.queryNames(connectionHandlerName, null);
      if ((query != null) && (!query.isEmpty())) {
        return connectionHandlerName;
      }
    } catch (Exception ex) {
      if (DebugLogger.debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
    }
    return null;
  }
  /**
   * Return a Set of Connection Handler ObjectNames
   * @return the Set of ObjectNames, an empty Set if no connection handlers
   */
  public Set<ObjectName> getConnectionHandlers() {
    Set monitorObjects;
    Set<ObjectName> results = new HashSet<ObjectName>();
    try {
      monitorObjects = this.server.queryNames(SNMPMonitor.pattern, null);
      for (Iterator iter = monitorObjects.iterator(); iter.hasNext();) {
        ObjectName name = (ObjectName) iter.next();
        if ((name.getCanonicalName().contains("Connection_Handler")) &&
                (!(name.getCanonicalName().endsWith("_Statistics")))) {
          results.add(name);
        }
      }
      return results;
    } catch (Exception ex) {
      if (DebugLogger.debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
      return results;
    }
  }
  /**
   * Returns the ObjectName of the Statistics Connection Handler name
   * corresponding to the Connection Handler name
   * @param connectionHandlerName
   * @return the ObjectName of the statistics ObjectName, null if the statistics
   * could not be found
   */
  public ObjectName getConnectionHandlerStatistics(
          ObjectName connectionHandlerName) {
    if (connectionHandlerName == null) {
      return null;
    }
    try {
      String value =
              connectionHandlerName.getCanonicalName().concat("_Statistics");
      ObjectName statistics = new ObjectName(value);
      // Check if the MBean exists
      Set query = this.server.queryNames(statistics, null);
      if ((query != null) && (!query.isEmpty())) {
        return statistics;
      }
    } catch (Exception ex) {
      if (DebugLogger.debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
    }
    return null;
  }
  /**
   * Get the value of the attribute
   * @param name of Mbean as a String
   * @param attribute to look for
   * @return the value of the attribute, null if the attribute could not
   * be found
   */
  public Object getAttribute(String name, String attribute) {
    try {
      ObjectName objName = new ObjectName(
              SNMPConnectionHandlerDefinitions.JMX_DOMAIN +
              "Name=" + name);
      return getAttribute(objName, attribute);
    } catch (Exception ex) {
      if (DebugLogger.debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
      return null;
    }
  }
  /**
   * Gets the value of an attribute
   * @param name of the Mbean
   * @param attribute to look for
   * @return the value of the attribute, null if the attribute value could not
   * be found
   */
  @SuppressWarnings("unchecked")
  public Object getAttribute(final ObjectName name, final String attribute) {
    return Subject.doAs(this.subject, new PrivilegedAction() {
      public Object run() {
        try {
          Attribute attr = (Attribute) server.getAttribute(name, attribute);
          if (attr != null) {
            return attr.getValue();
          }
        } catch (Exception ex) {
          if (DebugLogger.debugEnabled()) {
            TRACER.debugCaught(DebugLogLevel.ERROR, ex);
          }
        }
        return null;
      }
      });
  }
  /**
   * Wrapper for SNMP Counter32
   * @param v value
   * @return a counter32
   */
  public static long counter32Value(long v) {
    if (v > (pow(2, 32) - 1)) {
      return (v % pow(2, 32));
    } else {
      return v;
    }
  }
  /**
   * Wrapper for SNMP Counter32
   * @param V Value
   * @return a Counter32
   */
  public static Long counter32Value(Long V) {
    long v = V.longValue();
    if (v > (pow(2, 32) - 1)) {
      return new Long(v % pow(2, 32));
    } else {
      return V;
    }
  }
  /**
   * Latcher for SNMP Gauge32
   * @param v value
   * @return a gauge32
   */
  public static long gauge32Value(long v) {
    if (v > (pow(2, 32) - 1)) {
      return (pow(2, 32) - 1);
    } else {
      return v;
    }
  }
  /**
   * Latcher for SNMP Gauge32
   * @param V value
   * @return a gauge32
   */
  public static Long gauge32Value(Long V) {
    long v = V.longValue();
    if (v > (pow(2, 32) - 1)) {
      return new Long(pow(2, 32) - 1);
    } else {
      return V;
    }
  }
  /**
   * Checker for SNMP INTEGER
   * @param V value
   * @return an Integer
   * @throws com.sun.management.snmp.SnmpStatusException
   */
  public static Integer integerValue(Long V) throws SnmpStatusException {
    long v = V.longValue();
    if (v > (pow(2, 31) - 1)) {
      throw new SnmpStatusException("Returned intrumented value size too big");
    }
    Integer ret = new Integer(V.intValue());
    return ret;
  }
  /**
   * pow x^y
   */
  private static long pow(long x, long y) {
    int j = 1;
    long k = x;
    if (y == 0) {
      return 1;
    }
    if (y == 1) {
      return x;
    }
    while (j < y) {
      k = k * x;
      j++;
    }
    return k;
  }
}
opends/src/snmp/src/org/opends/server/snmp/SNMPUserAcl.java
New file
@@ -0,0 +1,158 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import com.sun.management.snmp.UserAcl;
import java.util.SortedSet;
import org.opends.server.admin.std.meta.SNMPConnectionHandlerCfgDefn.*;
import org.opends.server.admin.std.server.SNMPConnectionHandlerCfg;
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.loggers.debug.DebugTracer;
public class SNMPUserAcl implements UserAcl {
    /**
     * The debug log tracer for this class.
     */
    private static final DebugTracer TRACER = DebugLogger.getTracer();
    /**
     * If * then all the users are allowed to access in read
     */
    private static final String ALL_USERS_ALLOWED = "*";
    /**
     * Current Security Configuration for the SNMP Connection Handler.
     */
    private SNMPConnectionHandlerCfg currentConfig;
    /**
     * Configured hosts list
     */
    private SortedSet usersList;
    /**
     * Configured traps destinations
     */
    private SortedSet trapDestinations;
    /**
     * Configured communities string
     */
    private SortedSet communityList;
    /**
     * Configured Security level
     */
    private SecurityLevel securityLevel;
    /**
     * User Name template - the only user getting the write access
     * on the USM MIB . Allowed to add user clones
     */
    private String templateUsername;
    /**
     * {@inheritDoc}
     * @param configuration of the SNMP Connection Handler
     */
    public SNMPUserAcl(SNMPConnectionHandlerCfg configuration) {
        // Keep the configuration
        this.currentConfig = configuration;
        // Get the community/context string to accept
        this.communityList = this.currentConfig.getCommunity();
        // Get the list of allowed users (SNMPV3)
        this.usersList = this.currentConfig.getAllowedUser();
        // Get the traps destinations
        this.trapDestinations = this.currentConfig.getTrapsDestination();
        // Get the min security level to accept
        this.securityLevel = this.currentConfig.getSecurityLevel();
        // Get the user name template allowed to add users in the USM MIB
        this.templateUsername = this.currentConfig.getTemplateUsername();
    }
    /**
     * {@inheritDoc}
     */
    public String getName() {
        // ACL Name
        return "OpenDS";
    }
    /**
     * {@inheritDoc}
     */
    public boolean checkReadPermission(String user) {
        if ((this.usersList.contains(ALL_USERS_ALLOWED)) ||
                (this.usersList.contains(user))) {
            return true;
        }
        return false;
    }
    /**
     * {@inheritDoc}
     */
    public boolean checkReadPermission(String user, String contextName,
            int securityLevel) {
        // Special check for the defaultUser
        if ((user.equals(this.templateUsername)) && (contextName.equals("null")) && ((this.securityLevel.ordinal() + 1) >= securityLevel)) {
            return true;
        }
        // Else
        if ((checkReadPermission(user))  &&
                ((this.securityLevel.ordinal() + 1) >= securityLevel)) {
            return true;
        }
        return false;
    }
    /**
     * {@inheritDoc}
     */
    public boolean checkContextName(String contextName) {
        return this.communityList.contains(contextName);
    }
    /**
     * {@inheritDoc}
     */
    public boolean checkWritePermission(String user) {
        if (user.equals(this.templateUsername)) {
            return true;
        }
        return false;
    }
    /**
     * {@inheritDoc}
     */
    public boolean checkWritePermission(String user, String contextName,
            int securityLevel) {
        if ((checkWritePermission(user)) &&
                (contextName.equals("null")) &&
                ((this.securityLevel.ordinal() + 1) >= securityLevel)) {
            return true;
        }
        return false;
    }
}
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -259,6 +259,14 @@
      File testLibDir       = new File(testRoot, "lib");
      File testBinDir       = new File(testRoot, "bin");
      // Snmp resource
      File   snmpResourceDir = new File(buildRoot + File.separator + "src" +
                                    File.separator + "snmp" + File.separator +
                                    "resource");
      File testSnmpResourceDir = new File (testConfigDir + File.separator +
                                    "snmp");
      if (Boolean.getBoolean(PROPERTY_COPY_CLASSES_TO_TEST_PKG)) {
        copyDirectory(serverClassesDir, testClassesDir);
        copyDirectory(unitClassesDir, testClassesDir);
@@ -271,6 +279,8 @@
                    new File(testConfigDir, "schema"));
      copyDirectory(new File(resourceDir, "MakeLDIF"),
                    new File(testConfigDir, "MakeLDIF"));
      copyDirectory(new File(snmpResourceDir, "security"),
                    new File(testSnmpResourceDir, "security"));
      copyFile(new File(testResourceDir, "server.keystore"),
               new File(testConfigDir, "server.keystore"));
      copyFile(new File(testResourceDir, "server.truststore"),
opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPConnectionManager.java
New file
@@ -0,0 +1,251 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import com.sun.management.snmp.SnmpEngine;
import com.sun.management.snmp.SnmpOid;
import com.sun.management.snmp.SnmpOidTableSupport;
import com.sun.management.snmp.manager.SnmpPeer;
import com.sun.management.snmp.manager.SnmpSession;
import com.sun.management.snmp.manager.usm.SnmpUsmPeer;
import java.net.InetAddress;
import static org.testng.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.ConnectionHandler;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.types.Control;
import org.opends.server.types.DN;
import org.opends.server.types.Modification;
import org.opends.server.types.ModificationType;
import org.testng.annotations.Test;
/**
 * An abstract class that all SNMP unit test should extend.
 */
@Test(enabled=false, groups = {"precommit", "snmp"}, sequential = true)
public abstract class SNMPConnectionManager extends DirectoryServerTestCase {
    /**
     * Snmp Port
     */
    private int snmpPort;
    /**
     * Snmp Trap Port
     */
    private int trapSnmpPort;
    /**
     * Set Up the Directory Server
     * @throws java.lang.Exception
     */
    protected void setUp() throws Exception {
        // Make sure that the server is up and running.
        TestCaseUtils.restartServer();
        synchronized (this) {
            this.wait(500);
        }
        SNMPConnectionHandler snmpHandler = getSNMPConnectionHandler();
        if (snmpHandler == null) {
            throw new Exception("Unable to get a SNMP connector");
        }
    }
    /**
     * Set Down the Directory Server
     * @param message
     * @throws java.lang.Exception
     */
    protected void setDown(String message) throws Exception {
        TestCaseUtils.shutdownServer(message);
    }
    /**
     * Gets the Snmp port on which the Connection Handler is listening
     * @return
     */
    protected int getSnmpPort() {
        return this.snmpPort;
    }
    /**
     * Gets the Snmp trap port on which the Connection Handler is listening
     * @return
     */
    protected int getTrapSnmpPort() {
        return this.trapSnmpPort;
    }
    /**
     * Gets an SNMP V3 peer agent (proxy)
     * @param port
     * @return
     */
    protected SnmpUsmPeer getSnmpV3Peer(int port) {
        try {
            String host = InetAddress.getLocalHost().getCanonicalHostName();
            SnmpOidTableSupport oidTable =
                    new DIRECTORY_SERVER_MIBOidTable();
            SnmpOid.setSnmpOidTable(oidTable);
            SnmpSession session = new SnmpSession("SyncManagerV3 session");
            SnmpEngine engine = session.getEngine();
            return new SnmpUsmPeer(engine, host, port);
        } catch (Exception ex) {
            return null;
        }
    }
    /**
     * Gets an SNMP V2 agent peer (proxy)
     * @param port
     * @return
     */
    protected SnmpPeer getSnmpV2Peer(int port) {
        try {
            String host = InetAddress.getLocalHost().getCanonicalHostName();
            SnmpOidTableSupport oidTable = new DIRECTORY_SERVER_MIBOidTable();
            SnmpOid.setSnmpOidTable(oidTable);
            return new SnmpPeer(host, port);
        } catch (Exception ex) {
            return null;
        }
    }
    /**
     * Get a reference to the SNMP connection handler.
     * @return an SNMP Connection handler
     * @throws an Exception is something went wrong.
     */
    public SNMPConnectionHandler getSNMPConnectionHandler() throws Exception {
        List<ConnectionHandler> handlers =
                DirectoryServer.getConnectionHandlers();
        assertNotNull(handlers);
        SNMPConnectionHandler snmpConnectionHandler = null;
        for (ConnectionHandler handler : handlers) {
            if (handler instanceof SNMPConnectionHandler) {
                snmpConnectionHandler = (SNMPConnectionHandler) handler;
                break;
            }
        }
        if (snmpConnectionHandler == null) {
            enableSnmp();
            synchronized (this) {
                this.wait(500);
            }
            for (ConnectionHandler handler : handlers) {
                if (handler instanceof SNMPConnectionHandler) {
                    snmpConnectionHandler = (SNMPConnectionHandler) handler;
                    break;
                }
            }
        }
        assertNotNull(snmpConnectionHandler);
        return snmpConnectionHandler;
    }
    /**
     * Enable SNMP with the port chosen in TestCaseUtils.
     *
     * @throws Exception
     *           if the handler cannot be enabled.
     */
    protected void enableSnmp() throws Exception {
        // Get a free port
        this.snmpPort = TestCaseUtils.bindFreePort().getLocalPort();
        this.trapSnmpPort = TestCaseUtils.bindFreePort().getLocalPort();
        ArrayList<Modification> mods = new ArrayList<Modification>();
        InternalClientConnection conn =
                InternalClientConnection.getRootConnection();
        mods.add(new Modification(ModificationType.REPLACE,
                new org.opends.server.types.Attribute(
                "ds-cfg-enabled", "true")));
        mods.add(new Modification(ModificationType.REPLACE,
                new org.opends.server.types.Attribute(
                "ds-cfg-listen-port", String.valueOf(this.snmpPort))));
        mods.add(new Modification(ModificationType.REPLACE,
                new org.opends.server.types.Attribute(
                "ds-cfg-trap-port", String.valueOf(this.trapSnmpPort))));
       String hosts = InetAddress.getLocalHost().getCanonicalHostName();
       mods.add(new Modification(ModificationType.ADD,
                new org.opends.server.types.Attribute(
                "ds-cfg-traps-destination", hosts)));
        ModifyOperationBasis op = new ModifyOperationBasis(
                conn,
                conn.nextOperationID(),
                conn.nextMessageID(),
                new ArrayList<Control>(),
                DN.decode("cn=SNMP Connection Handler,cn=Connection Handlers,cn=config"),
                mods);
        op.run();
    }
    /**
     * Enable JMX with the port chosen in TestCaseUtils.
     *
     * @throws Exception
     *           if the handler cannot be enabled.
     */
    protected void enableJmx() throws Exception {
        ArrayList<Modification> mods = new ArrayList<Modification>();
        InternalClientConnection conn = InternalClientConnection.getRootConnection();
        mods.add(new Modification(ModificationType.REPLACE,
                new org.opends.server.types.Attribute(
                "ds-cfg-enabled", "true")));
        ModifyOperationBasis op = new ModifyOperationBasis(
                conn,
                conn.nextOperationID(),
                conn.nextMessageID(),
                new ArrayList<Control>(),
                DN.decode("cn=JMX Connection Handler,cn=Connection Handlers,cn=config"),
                mods);
        op.run();
    }
}
opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPSyncManagerV2AccessTest.java
New file
@@ -0,0 +1,312 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import com.sun.management.snmp.SnmpDefinitions;
import com.sun.management.snmp.SnmpOid;
import com.sun.management.snmp.SnmpOidTableSupport;
import com.sun.management.snmp.SnmpVarBindList;
import com.sun.management.snmp.manager.SnmpParameters;
import com.sun.management.snmp.manager.SnmpPeer;
import com.sun.management.snmp.manager.SnmpRequest;
import com.sun.management.snmp.manager.SnmpSession;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Map.Entry;
import org.opends.messages.Message;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.server.AdminTestCaseUtils;
import org.opends.server.admin.std.meta.SNMPConnectionHandlerCfgDefn;
import org.opends.server.admin.std.server.SNMPConnectionHandlerCfg;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.types.ConfigChangeResult;
import org.opends.server.types.Control;
import org.opends.server.types.DN;
import org.opends.server.types.Modification;
import org.opends.server.types.ModificationType;
import org.opends.server.types.ResultCode;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
/**
 * A simple test for : - JMX connection establishment withou using SSL -
 * JMX get and set - configuration change
 */
@Test(enabled=false, groups = {"precommit", "snmp"}, sequential = true)
public class SNMPSyncManagerV2AccessTest extends SNMPConnectionManager {
    @BeforeClass
    @Override
    public void setUp() throws Exception {
        super.setUp();
    }
    @AfterClass
    public void afterClass() throws Exception {
        super.shutdownServer();
    }
    @DataProvider(name = "listAttributes")
    Object[][] listAttributes() {
        return new Object[][]{
            {"dsServerType"},
            {"dsServerDescription"},
            {"dsMasterEntries"},
            {"dsCopyEntries"},
            {"dsCacheEntries"},
            {"dsCacheHits"},
            {"dsSlaveHits"}};
    }
    @Test(enabled=false,dataProvider = "listAttributes")
    public void checkAttribute(String attributeName) {
        // get the SNMP peer agent
        SnmpPeer agent = this.getSnmpV2Peer(this.getSnmpPort());
        assertNotNull(agent);
        // Create parameters to associate to the entity to communicate
        // with.
        // When creating the parameter object, you can specify the read
        // and write community to be used when querying the agent.
        final SnmpParameters params =
                new SnmpParameters();
        // Set to the allowed the community string
        params.setRdCommunity("OpenDS");
        // The newly created parameter must be associated to the agent.
        //
        agent.setParams(params);
        // Build the session. A session creates, controls and
        // manages one or more requests.
        //
        try {
            final SnmpSession session =
                    new SnmpSession("SyncManager session");
            // A default peer (agent) can be associated to a SnmpSession.
            // When invoking a service provided by the SnmpSession, if the
            // agent is not specified, the session will perform the service
            // using the default peer as the target of the service.
            //
            session.setDefaultPeer(agent);
            // Build the list of variables you want to query.
            // For debug purposes, you can associate a name to your list.
            //
            final SnmpVarBindList list =
                    new SnmpVarBindList("SyncManager varbind list");
            // We want to read the "dsServerDescription" variable.
            //
            // We will thus query "dsServerDescription"
            //
            list.addVarBind(attributeName);
            // Make the SNMP get request and wait for the result.
            //
            SnmpRequest request = session.snmpGetNextRequest(null, list);
            final boolean completed = request.waitForCompletion(0);
            // Check for a timeout of the request.
            //
            if (completed == false) {
                fail("SyncManager::main: Request timed out." +
                        " Check reachability of agent");
                return;
            }
            // Now we have a response. Check if the response contains
            // an error.
            //
            final int errorStatus = request.getErrorStatus();
            if (errorStatus != SnmpDefinitions.snmpRspNoError) {
                fail("Error status = " +
                        SnmpRequest.snmpErrorToString(errorStatus));
                fail("Error index = " + request.getErrorIndex());
                return;
            }
            // Now we shall display the content of the result.
            //
            final SnmpVarBindList result = request.getResponseVarBindList();
            assertNotNull(result);
            assertEquals(result.getVarBindCount(), 1);
            // Nicely stop the session
            //
            session.destroySession();
        } catch (Exception exception) {
            fail("CheckAttribute");
        }
        //
        // That's all !
        //
        return;
    }
    /**
     * Build some data for the simpleGet test.
     */
    @DataProvider(name = "listCommunities")
    Object[][] listCommunities() {
        return new Object[][]{
            {"public", false},
            {"private", false},
            {"OpenDS", true},
            {"dummy", false},
            {"", false}};
    }
    @Test(enabled = false,dataProvider = "listCommunities")
    public void checkCommunity(String community, boolean expectedResult) {
        try {
            String host = InetAddress.getLocalHost().getCanonicalHostName();
            // Initialize the SNMP Manager API.
            // Specify the OidTable containing all the MIB II knowledge.
            // Use the OidTable generated by mibgen when compiling MIB II.
            //
            final SnmpOidTableSupport oidTable = new
                    DIRECTORY_SERVER_MIBOidTable();
            SnmpOid.setSnmpOidTable(oidTable);
            // At any time, it is possible to add knowledge in the OidTable
            // using the SnmpOidDatabaseSupport.
            // For instance, we could start the Manager API like that:
            //    SnmpOidDatabaseSupport oidDB =
            //                      new SnmpOidDatabaseSupport();
            //    SnmpOid.setSnmpOidTable(oidDB);
            // Then over time, MIB knowledge can be added as follows:
            //    oidDB.add(oidTable);
            //
            // Create a SnmpPeer object for representing the entity to
            // communicate with.
            //
            final SnmpPeer agent =
                    new SnmpPeer(host, this.getSnmpPort());
            // Create parameters to associate to the entity to communicate
            // with.
            // When creating the parameter object, you can specify the read
            // and write community to be used when querying the agent.
            //
            final SnmpParameters params =
                    new SnmpParameters();
            params.setRdCommunity(community);
            // The newly created parameter must be associated to the agent.
            //
            agent.setParams(params);
            // Build the session. A session creates, controls and
            // manages one or more requests.
            //
            final SnmpSession session =
                    new SnmpSession("SyncManager session");
            // A default peer (agent) can be associated to a SnmpSession.
            // When invoking a service provided by the SnmpSession, if the
            // agent is not specified, the session will perform the service
            // using the default peer as the target of the service.
            //
            session.setDefaultPeer(agent);
            // Build the list of variables you want to query.
            // For debug purposes, you can associate a name to your list.
            //
            final SnmpVarBindList list =
                    new SnmpVarBindList("SyncManager varbind list");
            // We want to read the "dsServerDescription" variable.
            //
            // We will thus query "dsServerDescription"
            //
            list.addVarBind("dsServerDescription");
            // Make the SNMP get request and wait for the result.
            //
            SnmpRequest request = session.snmpGetNextRequest(null, list);
            final boolean completed = request.waitForCompletion(0);
            // Check for a timeout of the request.
            //
            if (completed == false) {
                fail("SyncManager::main: Request timed out." +
                        " Check reachability of agent");
                return;
            }
            // Now we have a response. Check if the response contains
            // an error.
            //
            final int errorStatus = request.getErrorStatus();
            if (errorStatus != SnmpDefinitions.snmpRspNoError) {
                fail("Error status = " +
                        SnmpRequest.snmpErrorToString(errorStatus));
                fail("Error index = " + request.getErrorIndex());
                return;
            }
            // Now we shall display the content of the result.
            //
            final SnmpVarBindList result = request.getResponseVarBindList();
            assertNotNull(result);
            assertEquals(result.getVarBindCount(), 1);
            assertEquals(result.getVarBindAt(0).isValidValue(), expectedResult);
            // Nicely stop the session
            //
            session.destroySession();
            //
            // That's all !
            //
            return;
        } catch (Exception e) {
            fail("SyncManager::main: " + "Exception occurred:", e);
        }
    }
}
opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPTrapManagerTest.java
New file
@@ -0,0 +1,149 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.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 2008 Sun Microsystems, Inc.
 */
package org.opends.server.snmp;
import com.sun.jdmk.tasks.DaemonTaskServer;
import com.sun.management.snmp.SnmpPduRequest;
import com.sun.management.snmp.SnmpPduTrap;
import com.sun.management.snmp.SnmpScopedPduRequest;
import com.sun.management.snmp.SnmpEventReportDispatcher;
import com.sun.management.snmp.manager.SnmpTrapListener;
import java.net.InetAddress;
import java.util.ArrayList;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.types.Control;
import org.opends.server.types.DN;
import org.opends.server.types.Modification;
import org.opends.server.types.ModificationType;
import org.testng.annotations.BeforeClass;
import static org.testng.Assert.*;
import org.testng.annotations.Test;
/**
 * The class is a simple example showing how to use the SNMP Manager API.
 *
 * <p>When calling the program, you must specify:
 * <br>     - host: hostname of the SNMP agent you want to query.
 * <br>     - port: port number to use.
 *
 * <p>As a reminder, if you wish to query the SNMP agent example provided
 *    as part of Java DMK, use port 8085.
 */
@Test(enabled=false, groups = {"precommit", "snmp"}, sequential = true)
public class SNMPTrapManagerTest extends SNMPConnectionManager {
    @BeforeClass
    @Override
    public void setUp() throws Exception {
        super.setUp();
    }
    @Test(enabled = false)
    public void checkTraps() {
        try {
            // Create a taskServer for processing traps.
            // This is an optional step. However using a DaemonTaskServer
            // to process incomming PDUs makes it possible to empty
            // the trap socket faster, thus reducing the hazards
            // of trap loss.
            // We set the priority of the DaemonTaskServer to
            // Thread.NORM_PRIORITY so that emptying the socket takes
            // precedence over trap processing.
            //
            final DaemonTaskServer taskServer = new DaemonTaskServer();
            taskServer.start(Thread.NORM_PRIORITY);
            // Create a listener and dispatcher for SNMP traps
            // (SnmpEventReportDispatcher).
            // SnmpEventReportDispatcher is run as a thread and listens
            // for traps in UDP port = agent port + 1.
            // Add TrapListenerImpl as SnmpTrapListener.
            // TrapListenerImpl will receive a callback when a valid trap
            // PDU is received.
            //
            final SnmpEventReportDispatcher trapAgent =
                    new SnmpEventReportDispatcher((this.getTrapSnmpPort()),
                    null, taskServer, null);
            SNMPTrapListenerImpl trapListener = new SNMPTrapListenerImpl();
            trapAgent.addTrapListener(trapListener);
            final Thread trapThread = new Thread(trapAgent);
            trapThread.setPriority(Thread.MAX_PRIORITY);
            trapThread.start();
            // One Trap
            this.setDown(
                 "On demand from org.opends.server.snmp.SNMPTrapManagerTest");
            int trapNumbers = trapListener.getNumberV1Traps();
            // Should received 3 traps
            assertEquals(trapNumbers, 1);
            // Nicely stop the SnmpEventReportDispatcher.
            //
            trapAgent.close();
            taskServer.terminate();
            return;
        } catch (Exception e) {
            fail("SyncManager::main: " +
                    "Exception occurred:" + e);
        }
    }
    private class SNMPTrapListenerImpl implements SnmpTrapListener {
        private int numberV1Traps=0;
        private int numberV2Traps=0;
        private int numberV3Traps=0;
        public void processSnmpTrapV1(SnmpPduTrap trap) {
            this.numberV1Traps++;
        }
        public void processSnmpTrapV2(SnmpPduRequest trap) {
            this.numberV2Traps++;
        }
        public void processSnmpTrapV3(SnmpScopedPduRequest trap) {
            this.numberV3Traps++;
        }
        public int getNumberV1Traps() {
            return this.numberV1Traps;
        }
        public int getNumberV2Traps() {
            return this.numberV3Traps;
        }
    }
}