summaryrefslogtreecommitdiffstats
path: root/ldap/servers/snmp
diff options
context:
space:
mode:
authorcvsadm <cvsadm>2005-01-21 00:44:34 +0000
committercvsadm <cvsadm>2005-01-21 00:44:34 +0000
commitb2093e3016027d6b5cf06b3f91f30769bfc099e2 (patch)
treecf58939393a9032182c4fbc4441164a9456e82f8 /ldap/servers/snmp
downloadds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.tar.gz
ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.tar.xz
ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.zip
Moving NSCP Directory Server from DirectoryBranch to TRUNK, initial drop. (foxworth)ldapserver7x
Diffstat (limited to 'ldap/servers/snmp')
-rw-r--r--ldap/servers/snmp/Makefile91
-rw-r--r--ldap/servers/snmp/NETWORK-SERVICES-MIB.txt650
-rw-r--r--ldap/servers/snmp/RFC-1215.txt38
-rw-r--r--ldap/servers/snmp/RFC1155-SMI.txt119
-rw-r--r--ldap/servers/snmp/SNMPv2-CONF.txt322
-rw-r--r--ldap/servers/snmp/SNMPv2-SMI.txt344
-rw-r--r--ldap/servers/snmp/SNMPv2-TC.txt772
-rw-r--r--ldap/servers/snmp/netscape-ldap.mib727
-rw-r--r--ldap/servers/snmp/ntagt/Makefile103
-rw-r--r--ldap/servers/snmp/ntagt/msrvdefs.mak492
-rw-r--r--ldap/servers/snmp/ntagt/nslagtcom_nt.h32
-rw-r--r--ldap/servers/snmp/ntagt/nsldapagt_nt.c1738
-rw-r--r--ldap/servers/snmp/ntagt/nsldapagt_nt.def24
-rw-r--r--ldap/servers/snmp/ntagt/nsldapagt_nt.h228
-rw-r--r--ldap/servers/snmp/ntagt/nsldapmib_nt.c1041
-rw-r--r--ldap/servers/snmp/ntagt/nsldapmib_nt.h130
16 files changed, 6851 insertions, 0 deletions
diff --git a/ldap/servers/snmp/Makefile b/ldap/servers/snmp/Makefile
new file mode 100644
index 00000000..4e40d8c0
--- /dev/null
+++ b/ldap/servers/snmp/Makefile
@@ -0,0 +1,91 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#
+# Make file SNMP subagent for Netscape Directory Server
+#
+#
+# Revision History:
+#
+# 07/31/97 Created by stevross
+#
+#
+
+MCOM_ROOT = ../../../..
+LDAP_SRC = ../..
+
+NOSTDCLEAN=true # don't let nsconfig.mk define target clean
+NOSTDSTRIP=true # don't let nsconfig.mk define target strip
+NSPR20=true # probably should be defined somewhere else (not sure where)
+
+OBJDEST = $(OBJDIR)/ns-ldapagt/obj
+INCLDEST = $(OBJDIR)/ns-ldapagt/include
+BINDIR = $(LDAP_SERVER_RELDIR)
+EXTDEST = $(BINDIR)
+
+include $(MCOM_ROOT)/ldapserver/nsconfig.mk
+include $(LDAP_SRC)/nsldap.mk
+
+MCC_SERVER=
+
+ARCH := $(shell uname -s)
+ifneq ($(ARCH), WINNT)
+ARCH := $(shell $(MCOM_ROOT)/ldapserver/nsarch)
+endif
+
+
+SNMPMODULE = ns-ldapagt
+
+# the netscape-ldap.mib goes in the plugins/snmp directory, and the other mib like
+# files go in the plugins/snmp/mibs directory
+NSMIB_DEST_DIR = $(RELDIR)/plugins/snmp
+NSMIB_SRC_FILES = netscape-ldap.mib
+MIBS_DEST_DIR = $(NSMIB_DEST_DIR)/mibs
+MIBS_SRC_FILES = NETWORK-SERVICES-MIB.txt \
+ RFC1155-SMI.txt \
+ RFC-1215.txt \
+ SNMPv2-CONF.txt \
+ SNMPv2-SMI.txt \
+ SNMPv2-TC.txt
+MIB_DEST_FILES = $(addprefix $(MIBS_DEST_DIR)/,$(notdir $(MIBS_SRC_FILES))) \
+ $(addprefix $(NSMIB_DEST_DIR)/,$(NSMIB_SRC_FILES))
+
+default: all
+
+ifneq ($(ARCH), WINNT)
+all: $(EXTDEST)/$(SNMPMODULE) $(NSMIB_DEST_DIR)/$(NSMIB_SRC_FILES) $(MIB_DEST_FILES)
+else
+OBJ_SUFFIX=obj
+all: $(MIB_DEST_FILES)
+ cd ntagt; $(MAKE) $(MFLAGS) all
+endif
+
+# Rule to create destination directories
+$(MIBS_DEST_DIR) $(NSMIB_DEST_DIR):
+ $(MKDIR) $@
+
+# Rule to copy subagent binary to release area
+$(EXTDEST)/$(SNMPMODULE): $(EXTDEST)
+ifneq ($(ARCH), WINNT)
+ $(CP) $(NSCP_DISTDIR)/peer/obj/$(SNMPMODULE) $(EXTDEST)/$(SNMPMODULE)
+endif
+
+# this rule is for mib files in the local directory that go in the nsmib directory
+$(NSMIB_DEST_DIR)/$(NSMIB_SRC_FILES): $(NSMIB_DEST_DIR)
+ $(CP) ./$(NSMIB_SRC_FILES) $@
+
+# this rule is for mib files which go in the mibs subdir
+$(MIBS_DEST_DIR)/%: % $(MIBS_DEST_DIR)
+ $(CP) $< $@
+
+clean: localclean
+
+localclean:
+ifneq ($(ARCH), WINNT)
+ $(RM) $(EXTDEST)/$(SNMPMODULE)$(EXE_SUFFIX)
+endif
+
diff --git a/ldap/servers/snmp/NETWORK-SERVICES-MIB.txt b/ldap/servers/snmp/NETWORK-SERVICES-MIB.txt
new file mode 100644
index 00000000..cadc5504
--- /dev/null
+++ b/ldap/servers/snmp/NETWORK-SERVICES-MIB.txt
@@ -0,0 +1,650 @@
+-- extracted from rfc2788.txt
+-- at Fri Mar 24 07:07:18 2000
+
+ 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
+
+--
+-- Copyright (C) The Internet Society (2000). All Rights Reserved.
+--
+-- This document and translations of it may be copied and furnished to
+-- others, and derivative works that comment on or otherwise explain it
+-- or assist in its implementation may be prepared, copied, published
+-- and distributed, in whole or in part, without restriction of any
+-- kind, provided that the above copyright notice and this paragraph are
+-- included on all such copies and derivative works. However, this
+-- document itself may not be modified in any way, such as by removing
+-- the copyright notice or references to the Internet Society or other
+-- Internet organizations, except as needed for the purpose of
+-- developing Internet standards in which case the procedures for
+-- copyrights defined in the Internet Standards process must be
+-- followed, or as required to translate it into languages other than
+-- English.
+--
+-- The limited permissions granted above are perpetual and will not be
+-- revoked by the Internet Society or its successors or assigns.
+--
+-- This document and the information contained herein is provided on an
+-- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+-- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+-- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+-- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+-- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+--
diff --git a/ldap/servers/snmp/RFC-1215.txt b/ldap/servers/snmp/RFC-1215.txt
new file mode 100644
index 00000000..64327233
--- /dev/null
+++ b/ldap/servers/snmp/RFC-1215.txt
@@ -0,0 +1,38 @@
+
+RFC-1215 DEFINITIONS ::= BEGIN
+
+-- This module is a empty module. It has been created solely for the
+-- purpose of allowing other modules to correctly import the TRAP-TYPE
+-- clause from RFC-1215 where it should be imported from. It's a
+-- built in type in the UCD-SNMP code, and in fact RFC-1215 doesn't
+-- actually define a mib at all; it only defines macros. However,
+-- importing the TRAP-TYPE is conventionally done from an import
+-- clause pointing to RFC-1215.
+--
+-- Wes 7/17/98
+
+TRAP-TYPE MACRO ::=
+BEGIN
+ TYPE NOTATION ::= "ENTERPRISE" value
+ (enterprise OBJECT IDENTIFIER)
+ VarPart
+ DescrPart
+ ReferPart
+ VALUE NOTATION ::= value (VALUE INTEGER)
+ VarPart ::=
+ "VARIABLES" "{" VarTypes "}"
+ | empty
+ VarTypes ::=
+ VarType | VarTypes "," VarType
+ VarType ::=
+ value (vartype ObjectName)
+ DescrPart ::=
+ "DESCRIPTION" value (description DisplayString)
+ | empty
+ ReferPart ::=
+ "REFERENCE" value (reference DisplayString)
+ | empty
+END
+
+
+END
diff --git a/ldap/servers/snmp/RFC1155-SMI.txt b/ldap/servers/snmp/RFC1155-SMI.txt
new file mode 100644
index 00000000..3abc7ffb
--- /dev/null
+++ b/ldap/servers/snmp/RFC1155-SMI.txt
@@ -0,0 +1,119 @@
+RFC1155-SMI DEFINITIONS ::= BEGIN
+
+EXPORTS -- EVERYTHING
+ internet, directory, mgmt,
+ experimental, private, enterprises,
+ OBJECT-TYPE, ObjectName, ObjectSyntax, SimpleSyntax,
+ ApplicationSyntax, NetworkAddress, IpAddress,
+ Counter, Gauge, TimeTicks, Opaque;
+
+ -- the path to the root
+
+ internet OBJECT IDENTIFIER ::= { iso 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 }
+
+ -- definition of object types
+
+ OBJECT-TYPE MACRO ::=
+ BEGIN
+ TYPE NOTATION ::= "SYNTAX" type (TYPE ObjectSyntax)
+ "ACCESS" Access
+ "STATUS" Status
+ VALUE NOTATION ::= value (VALUE ObjectName)
+
+ Access ::= "read-only"
+ | "read-write"
+ | "write-only"
+ | "not-accessible"
+ Status ::= "mandatory"
+ | "optional"
+ | "obsolete"
+ END
+
+ -- names of objects in the MIB
+
+ ObjectName ::=
+ OBJECT IDENTIFIER
+
+ -- syntax of objects in the MIB
+
+ ObjectSyntax ::=
+ CHOICE {
+ simple
+ SimpleSyntax,
+ -- note that simple SEQUENCEs are not directly
+ -- mentioned here to keep things simple (i.e.,
+ -- prevent mis-use). However, application-wide
+ -- types which are IMPLICITly encoded simple
+ -- SEQUENCEs may appear in the following CHOICE
+
+ application-wide
+ ApplicationSyntax
+ }
+
+ SimpleSyntax ::=
+ CHOICE {
+ number
+ INTEGER,
+ string
+ OCTET STRING,
+ object
+ OBJECT IDENTIFIER,
+ empty
+ NULL
+ }
+
+ ApplicationSyntax ::=
+ CHOICE {
+ address
+ NetworkAddress,
+ counter
+ Counter,
+ gauge
+ Gauge,
+ ticks
+ TimeTicks,
+ arbitrary
+ Opaque
+
+ -- other application-wide types, as they are
+ -- defined, will be added here
+ }
+
+ -- 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)
+
+ Gauge ::=
+ [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"
+
+ END
diff --git a/ldap/servers/snmp/SNMPv2-CONF.txt b/ldap/servers/snmp/SNMPv2-CONF.txt
new file mode 100644
index 00000000..24a1eed9
--- /dev/null
+++ b/ldap/servers/snmp/SNMPv2-CONF.txt
@@ -0,0 +1,322 @@
+SNMPv2-CONF DEFINITIONS ::= BEGIN
+
+IMPORTS ObjectName, NotificationName, ObjectSyntax
+ FROM SNMPv2-SMI;
+
+-- definitions for conformance groups
+
+OBJECT-GROUP MACRO ::=
+BEGIN
+ TYPE NOTATION ::=
+ ObjectsPart
+ "STATUS" Status
+ "DESCRIPTION" Text
+ ReferPart
+
+ VALUE NOTATION ::=
+ value(VALUE OBJECT IDENTIFIER)
+
+ ObjectsPart ::=
+ "OBJECTS" "{" Objects "}"
+ Objects ::=
+ Object
+ | Objects "," Object
+ Object ::=
+
+ value(ObjectName)
+
+ Status ::=
+ "current"
+ | "deprecated"
+ | "obsolete"
+
+ ReferPart ::=
+ "REFERENCE" Text
+ | empty
+
+ -- a character string as defined in [2]
+ Text ::= value(IA5String)
+END
+
+-- more definitions for conformance groups
+
+NOTIFICATION-GROUP MACRO ::=
+BEGIN
+ TYPE NOTATION ::=
+ NotificationsPart
+ "STATUS" Status
+ "DESCRIPTION" Text
+ ReferPart
+
+ VALUE NOTATION ::=
+ value(VALUE OBJECT IDENTIFIER)
+
+ NotificationsPart ::=
+ "NOTIFICATIONS" "{" Notifications "}"
+ Notifications ::=
+ Notification
+ | Notifications "," Notification
+ Notification ::=
+ value(NotificationName)
+
+ Status ::=
+ "current"
+ | "deprecated"
+ | "obsolete"
+
+ ReferPart ::=
+ "REFERENCE" Text
+ | empty
+
+ -- a character string as defined in [2]
+ Text ::= value(IA5String)
+END
+
+-- definitions for compliance statements
+
+MODULE-COMPLIANCE MACRO ::=
+BEGIN
+ TYPE NOTATION ::=
+ "STATUS" Status
+ "DESCRIPTION" Text
+ ReferPart
+ ModulePart
+
+ VALUE NOTATION ::=
+ value(VALUE OBJECT IDENTIFIER)
+
+ Status ::=
+ "current"
+ | "deprecated"
+ | "obsolete"
+
+ ReferPart ::=
+ "REFERENCE" Text
+ | empty
+
+ ModulePart ::=
+ Modules
+ Modules ::=
+ Module
+ | Modules Module
+ Module ::=
+ -- name of module --
+ "MODULE" ModuleName
+ MandatoryPart
+ CompliancePart
+
+ ModuleName ::=
+ -- identifier must start with uppercase letter
+ identifier ModuleIdentifier
+ -- must not be empty unless contained
+ -- in MIB Module
+ | empty
+ ModuleIdentifier ::=
+ value(OBJECT IDENTIFIER)
+ | empty
+
+ MandatoryPart ::=
+ "MANDATORY-GROUPS" "{" Groups "}"
+ | empty
+
+ Groups ::=
+
+ Group
+ | Groups "," Group
+ Group ::=
+ value(OBJECT IDENTIFIER)
+
+ CompliancePart ::=
+ Compliances
+ | empty
+
+ Compliances ::=
+ Compliance
+ | Compliances Compliance
+ Compliance ::=
+ ComplianceGroup
+ | Object
+
+ ComplianceGroup ::=
+ "GROUP" value(OBJECT IDENTIFIER)
+ "DESCRIPTION" Text
+
+ Object ::=
+ "OBJECT" value(ObjectName)
+ SyntaxPart
+ WriteSyntaxPart
+ AccessPart
+ "DESCRIPTION" Text
+
+ -- must be a refinement for object's SYNTAX clause
+ SyntaxPart ::= "SYNTAX" Syntax
+ | empty
+
+ -- must be a refinement for object's SYNTAX clause
+ WriteSyntaxPart ::= "WRITE-SYNTAX" Syntax
+ | empty
+
+ 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
+
+ AccessPart ::=
+ "MIN-ACCESS" Access
+ | empty
+ Access ::=
+ "not-accessible"
+ | "accessible-for-notify"
+ | "read-only"
+ | "read-write"
+ | "read-create"
+
+ -- a character string as defined in [2]
+ Text ::= value(IA5String)
+END
+
+-- definitions for capabilities statements
+
+AGENT-CAPABILITIES MACRO ::=
+BEGIN
+ TYPE NOTATION ::=
+ "PRODUCT-RELEASE" Text
+ "STATUS" Status
+ "DESCRIPTION" Text
+ ReferPart
+ ModulePart
+
+ VALUE NOTATION ::=
+ value(VALUE OBJECT IDENTIFIER)
+
+ Status ::=
+ "current"
+ | "obsolete"
+
+ ReferPart ::=
+ "REFERENCE" Text
+ | empty
+
+ ModulePart ::=
+ Modules
+ | empty
+ Modules ::=
+ Module
+ | Modules Module
+ Module ::=
+ -- name of module --
+ "SUPPORTS" ModuleName
+ "INCLUDES" "{" Groups "}"
+ VariationPart
+
+ ModuleName ::=
+
+ -- identifier must start with uppercase letter
+ identifier ModuleIdentifier
+ ModuleIdentifier ::=
+ value(OBJECT IDENTIFIER)
+ | empty
+
+ Groups ::=
+ Group
+ | Groups "," Group
+ Group ::=
+ value(OBJECT IDENTIFIER)
+
+ VariationPart ::=
+ Variations
+ | empty
+ Variations ::=
+ Variation
+ | Variations Variation
+
+ Variation ::=
+ ObjectVariation
+ | NotificationVariation
+
+ NotificationVariation ::=
+ "VARIATION" value(NotificationName)
+ AccessPart
+ "DESCRIPTION" Text
+
+ ObjectVariation ::=
+ "VARIATION" value(ObjectName)
+ SyntaxPart
+ WriteSyntaxPart
+ AccessPart
+ CreationPart
+ DefValPart
+ "DESCRIPTION" Text
+
+ -- must be a refinement for object's SYNTAX clause
+ SyntaxPart ::= "SYNTAX" Syntax
+ | empty
+
+ WriteSyntaxPart ::= "WRITE-SYNTAX" Syntax
+ | empty
+
+ 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
+
+ AccessPart ::=
+ "ACCESS" Access
+ | empty
+
+ Access ::=
+ "not-implemented"
+ -- only "not-implemented" for notifications
+ | "accessible-for-notify"
+ | "read-only"
+ | "read-write"
+ | "read-create"
+ -- following is for backward-compatibility only
+ | "write-only"
+
+ CreationPart ::=
+ "CREATION-REQUIRES" "{" Cells "}"
+ | empty
+ Cells ::=
+ Cell
+ | Cells "," Cell
+ Cell ::=
+ value(ObjectName)
+
+ DefValPart ::= "DEFVAL" "{" Defvalue "}"
+ | empty
+
+ Defvalue ::= -- must be valid for the object's syntax
+ -- in this macro's SYNTAX clause, if present,
+ -- or if not, in object's OBJECT-TYPE macro
+ value(ObjectSyntax)
+ | "{" BitsValue "}"
+
+ BitsValue ::= BitNames
+ | empty
+
+ BitNames ::= BitName
+ | BitNames "," BitName
+
+ BitName ::= identifier
+
+ -- a character string as defined in [2]
+ Text ::= value(IA5String)
+END
+
+END
diff --git a/ldap/servers/snmp/SNMPv2-SMI.txt b/ldap/servers/snmp/SNMPv2-SMI.txt
new file mode 100644
index 00000000..1c01e1df
--- /dev/null
+++ b/ldap/servers/snmp/SNMPv2-SMI.txt
@@ -0,0 +1,344 @@
+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
diff --git a/ldap/servers/snmp/SNMPv2-TC.txt b/ldap/servers/snmp/SNMPv2-TC.txt
new file mode 100644
index 00000000..860bf71e
--- /dev/null
+++ b/ldap/servers/snmp/SNMPv2-TC.txt
@@ -0,0 +1,772 @@
+SNMPv2-TC DEFINITIONS ::= BEGIN
+
+IMPORTS
+ TimeTicks FROM SNMPv2-SMI;
+
+-- definition of textual conventions
+
+TEXTUAL-CONVENTION MACRO ::=
+
+BEGIN
+ TYPE NOTATION ::=
+ DisplayPart
+ "STATUS" Status
+ "DESCRIPTION" Text
+ ReferPart
+ "SYNTAX" Syntax
+
+ VALUE NOTATION ::=
+ value(VALUE Syntax) -- adapted ASN.1
+
+ DisplayPart ::=
+ "DISPLAY-HINT" Text
+ | empty
+
+ Status ::=
+ "current"
+ | "deprecated"
+ | "obsolete"
+
+ ReferPart ::=
+ "REFERENCE" Text
+ | empty
+
+ -- a character string as defined in [2]
+ Text ::= value(IA5String)
+
+ Syntax ::= -- Must be one of the following:
+ -- a base type (or its refinement), or
+ -- a BITS pseudo-type
+ type
+ | "BITS" "{" NamedBits "}"
+
+ NamedBits ::= NamedBit
+ | NamedBits "," NamedBit
+
+ NamedBit ::= identifier "(" number ")" -- number is nonnegative
+
+END
+
+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); 'notInService' has
+ no implication regarding the internal consistency of
+ the row, availability of resources, or consistency with
+ the current state of the managed device;
+
+ - `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 (i.e., one or more required columns in
+ the conceptual row have not been instanciated);
+
+ - `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 attempt 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|see 8 ->D| ->D
+--------------+--------------+-----------+-------------+-------------
+set status |inconsistent- |inconsist- |noError |noError ->C
+column to | Value| entValue| |
+notInService | | | |
+ | | or | | or
+ | | | |
+ | |see 3 ->C| ->C|see 6
+--------------+--------------+-----------+-------------+-------------
+set status |noError |noError |noError |noError ->A
+column to | | | | or
+destroy | ->A| ->A| ->A|see 7
+--------------+--------------+-----------+-------------+-------------
+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.
+
+ (2) if other variable bindings included in the same PDU,
+ provide values for all columns which are missing but
+ required, and all columns have acceptable values, then
+ return noError and goto D.
+
+ (3) if other variable bindings included in the same PDU,
+ provide legal 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.
+
+ (6) the return value can indicate one of the following
+ errors:
+
+ wrongValue: because the agent does not support
+ notInService (e.g., an agent which does not support
+ createAndWait), or
+
+ inconsistentValue: because the agent is unable to take
+ the row out of service at this time, perhaps because it
+ is in use and cannot be de-activated.
+
+ (7) the return value can indicate the following error:
+
+ inconsistentValue: because the agent is unable to
+ remove the row at this time, perhaps because it is in
+ use and cannot be de-activated.
+
+ (8) the transition to D can fail, e.g., if the values of the
+ conceptual row are inconsistent, then the error code would
+ be inconsistentValue.
+
+ NOTE: Other processing of (this and other varbinds 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 (attempt 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 absence 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' or `inconsistentValue'. 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.
+
+ If sysUpTime is reset to zero as a result of a re-
+ initialization of the network management (sub)system, then
+ the values of all TimeStamp objects are also reset.
+ However, after approximately 497 days without a re-
+ initialization, the sysUpTime object will reach 2^^32-1 and
+ then increment around to zero; in this case, existing values
+ of TimeStamp objects do not change. This can lead to
+ ambiguities in the value of TimeStamp objects."
+ 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..13
+ 10 11 minutes from UTC 0..59
+
+ * Notes:
+ - the value of year is in network-byte order
+ - daylight saving time in New Zealand is +13
+
+ 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 written.
+ Conversely, if the value is either other(1), volatile(2) or
+ nonVolatile(3), it cannot be modified to be permanent(4) or
+ readOnly(5). (All illegal modifications result in a
+ 'wrongValue' error.)
+
+ 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
+ the SNMPv2-TM MIB module. Other possible values are defined
+ in other MIB modules."
+ REFERENCE "The SNMPv2-TM MIB module is defined in RFC 1906."
+ SYNTAX OBJECT IDENTIFIER
+
+TAddress ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "Denotes a transport service address.
+
+ A TAddress value is always interpreted within the context of a
+ TDomain value. Thus, each definition of a TDomain value must
+ be accompanied by a definition of a textual convention for use
+ with that TDomain. Some possible textual conventions, such as
+ SnmpUDPAddress for snmpUDPDomain, are defined in the SNMPv2-TM
+ MIB module. Other possible textual conventions are defined in
+ other MIB modules."
+ REFERENCE "The SNMPv2-TM MIB module is defined in RFC 1906."
+ SYNTAX OCTET STRING (SIZE (1..255))
+
+END
diff --git a/ldap/servers/snmp/netscape-ldap.mib b/ldap/servers/snmp/netscape-ldap.mib
new file mode 100644
index 00000000..3e51839a
--- /dev/null
+++ b/ldap/servers/snmp/netscape-ldap.mib
@@ -0,0 +1,727 @@
+-- BEGIN COPYRIGHT BLOCK
+-- Copyright 2001 Sun Microsystems, Inc.
+-- Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+-- All rights reserved.
+-- END COPYRIGHT BLOCK
+--
+--
+-- MIB for Netscape Directory Server 7
+--
+-- This is an implementation of the MADMAN mib for monitoring LDAP/CLDAP and X.500
+-- directories described in RFC 2788 and 2789
+-- with the addition of traps for server up and down events
+
+NSLDAP-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ MODULE-IDENTITY, Counter32, Gauge32, OBJECT-TYPE
+ FROM SNMPv2-SMI
+ DisplayString, TimeStamp, TEXTUAL-CONVENTION
+ FROM SNMPv2-TC
+ MODULE-COMPLIANCE, OBJECT-GROUP
+ FROM SNMPv2-CONF
+ applIndex, DistinguishedName, URLString
+ FROM NETWORK-SERVICES-MIB
+ enterprises
+ FROM RFC1155-SMI
+ TRAP-TYPE
+ FROM RFC-1215;
+
+ netscape OBJECT IDENTIFIER ::= { enterprises 1450 }
+
+ URLString ::= TEXTUAL-CONVENTION
+ STATUS current
+ DESCRIPTION
+ "I couldn't find it but madman said it should be here, guessing DisplayString"
+ SYNTAX DisplayString
+
+ nsldap MODULE-IDENTITY
+ LAST-UPDATED "200207160000Z"
+ ORGANIZATION "Netscape Communications Corp"
+ CONTACT-INFO
+ " AOL Strategic Business Solutions
+ Postal: 22000 AOL Way
+ Dulles, VA 20166
+
+ Website: http://enterprise.netscape.com"
+ DESCRIPTION
+ " An implementation of the MADMAN mib for monitoring LDAP/CLDAP and X.500
+ directories described in RFC 2788 and 2789
+ used for Netscape Directory Server 7"
+ ::= { netscape 7}
+
+ dsOpsTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF DsOpsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ " The table holding information related to the
+ DS operations."
+ ::= {nsldap 1}
+
+ dsOpsEntry OBJECT-TYPE
+ SYNTAX DsOpsEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ " Entry containing operations related statistics
+ for a DS."
+ INDEX { applIndex}
+ ::= {dsOpsTable 1}
+
+ DsOpsEntry ::= SEQUENCE {
+
+ -- Bindings
+
+ dsAnonymousBinds
+ Counter32,
+ dsUnAuthBinds
+ Counter32,
+ dsSimpleAuthBinds
+ Counter32,
+ dsStrongAuthBinds
+ Counter32,
+ dsBindSecurityErrors
+ Counter32,
+
+ -- In-coming operations
+
+ dsInOps
+ Counter32,
+ dsReadOps
+ Counter32,
+ dsCompareOps
+ Counter32,
+ dsAddEntryOps
+ Counter32,
+ dsRemoveEntryOps
+ Counter32,
+ dsModifyEntryOps
+ Counter32,
+ dsModifyRDNOps
+ Counter32,
+ dsListOps
+ Counter32,
+ dsSearchOps
+ Counter32,
+ dsOneLevelSearchOps
+ Counter32,
+ dsWholeSubtreeSearchOps
+ Counter32,
+
+ -- Out going operations
+
+ dsReferrals
+ Counter32,
+ dsChainings
+ Counter32,
+
+ -- Errors
+
+ dsSecurityErrors
+ Counter32,
+ dsErrors
+ Counter32
+ }
+
+ -- CLDAP does not use binds; for A CLDAP DS 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 CLDAP and LDAP DSs:
+ -- dsReadOps, dsListOps
+ --
+ -- CLDAP does not implement "Compare", "Add", "Remove",
+ -- "Modify", "ModifyRDN"; the following counters will be
+ -- inaccessible for CLDAP DSs:
+ -- dsCompareOps, dsAddEntryOps, dsRemoveEntryOps,
+ -- dsModifyEntryOps, dsModifyRDNOps.
+ --
+ -- CLDAP and LDAP DS's do not return Referrals
+ -- the following fields will remain inaccessible for
+ -- CLDAP and LDAP DSs: dsReferrals.
+
+ dsAnonymousBinds OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of anonymous binds to this DS from UAs
+ since application start."
+ ::= {dsOpsEntry 1}
+
+ dsUnAuthBinds OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of un-authenticated binds to this DS since
+ application start."
+ ::= {dsOpsEntry 2}
+
+ dsSimpleAuthBinds OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of binds to this DS that were authenticated
+ using simple authentication procedures since
+ application start."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 8.1.2.1.1. and, RFC1777 Section 4.1"
+ ::= {dsOpsEntry 3}
+
+ dsStrongAuthBinds OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of binds to this DS that were authenticated
+ using the strong authentication procedures since
+ application start. This includes the binds that were
+ authenticated using external authentication procedures."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Sections 8.1.2.1.2 & 8.1.2.1.3. and, RFC1777 Section 4.1."
+ ::= {dsOpsEntry 4}
+
+ dsBindSecurityErrors OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of bind operations that have been rejected
+ by this DS due to inappropriateAuthentication or
+ invalidCredentials."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 12.7.2 and, RFC1777 Section 4."
+ ::= {dsOpsEntry 5}
+
+ dsInOps OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of operations forwarded to this DS
+ from UAs or other DSs since application
+ start up."
+ ::= {dsOpsEntry 6}
+
+ dsReadOps OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of read operations serviced by
+ this DS since application startup."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 9.1."
+ ::= {dsOpsEntry 7}
+
+ dsCompareOps OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of compare operations serviced by
+ this DS since application startup."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 9.2. and, RFC1777 section 4.8"
+ ::= {dsOpsEntry 8}
+
+ dsAddEntryOps OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of addEntry operations serviced by
+ this DS since application startup."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 11.1. and, RFC1777 Section 4.5."
+ ::= {dsOpsEntry 9}
+
+ dsRemoveEntryOps OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of removeEntry operations serviced by
+ this DS since application startup."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 11.2. and, RFC1777 Section 4.6."
+ ::= {dsOpsEntry 10}
+
+ dsModifyEntryOps OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of modifyEntry operations serviced by
+ this DS since application startup."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 11.3. and, RFC1777 Section 4.4."
+ ::= {dsOpsEntry 11}
+
+ dsModifyRDNOps OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of modifyRDN operations serviced by
+ this DS since application startup."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 11.4.and, RFC1777 Section 4.7"
+ ::= {dsOpsEntry 12}
+
+ dsListOps OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of list operations serviced by
+ this DS since application startup."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 10.1."
+ ::= {dsOpsEntry 13}
+
+ dsSearchOps OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of search operations- baseObject searches,
+ oneLevel searches and wholeSubtree searches,
+ serviced by this DS since application startup."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 10.2. and, RFC1777 Section 4.3."
+ ::= {dsOpsEntry 14}
+
+ dsOneLevelSearchOps OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of oneLevel search operations serviced
+ by this DS since application startup."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 10.2.2.2. and, RFC1777 Section 4.3."
+ ::= {dsOpsEntry 15}
+
+ dsWholeSubtreeSearchOps OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of wholeSubtree search operations serviced
+ by this DS since application startup."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 10.2.2.2. and, RFC1777 Section 4.3."
+ ::= {dsOpsEntry 16}
+
+ dsReferrals OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of referrals returned by this DS in response
+ to requests for operations since application startup."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 12.6."
+ ::= {dsOpsEntry 17}
+
+ dsChainings OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of operations forwarded by this DS
+ to other DSs since application startup."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.518, 1988:
+ Section 14."
+ ::= {dsOpsEntry 18}
+
+ dsSecurityErrors OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of operations forwarded to this DS
+ which did not meet the security requirements. "
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Section 12.7. and, RFC1777 Section 4."
+ ::= {dsOpsEntry 19}
+
+ dsErrors OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of operations 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 NameErrors, UpdateErrors, Attribute
+ errors and ServiceErrors."
+ REFERENCE
+ " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+ Sections 12.4, 12.5, 12.8 & 12.9. and, RFC1777 Section 4."
+ ::= {dsOpsEntry 20}
+
+ -- Entry statistics/Cache performance
+ dsEntriesTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF DsEntriesEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ " The table holding information related to the
+ entry statistics and cache performance of the DSs."
+ ::= {nsldap 2}
+
+ dsEntriesEntry OBJECT-TYPE
+ SYNTAX DsEntriesEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ " Entry containing statistics pertaining to entries
+ held by a DS."
+ INDEX { applIndex }
+ ::= {dsEntriesTable 1}
+
+
+ DsEntriesEntry ::= SEQUENCE {
+
+ dsMasterEntries
+ Gauge32,
+ dsCopyEntries
+ Gauge32,
+ dsCacheEntries
+ Gauge32,
+ dsCacheHits
+ Counter32,
+ dsSlaveHits
+ Counter32
+ }
+
+ -- 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 DS."
+ ::= {dsEntriesEntry 1}
+
+ dsCopyEntries OBJECT-TYPE
+ SYNTAX Gauge32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of entries for which systematic (slave)
+ copies are maintained in the DS."
+ ::= {dsEntriesEntry 2}
+
+ dsCacheEntries OBJECT-TYPE
+ SYNTAX Gauge32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of entries cached (non-systematic copies) in
+ the DS. This will include the entries that are
+ cached partially. The negative cache is not counted."
+ ::= {dsEntriesEntry 3}
+
+ dsCacheHits OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of operations that were serviced from
+ the locally held cache since application
+ startup."
+ ::= {dsEntriesEntry 4}
+
+ dsSlaveHits OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Number of operations that were serviced from
+ the locally held object replications ( shadow
+ entries) since application startup."
+ ::= {dsEntriesEntry 5}
+
+ -- The dsIntTable contains statistical data on the peer DSs
+ -- with which the monitored DSs (attempt to) interact. This
+ -- table will provide a useful insight into the effect of
+ -- neighbours on the DS performance.
+ -- The table keeps track of the last "N" DSs with which the
+ -- monitored DSs has interacted (attempted to interact),
+ -- where "N" is a locally-defined constant.
+
+ 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 DSs with their respective
+ peer DSs."
+ ::= { nsldap 3 }
+
+ dsIntEntry OBJECT-TYPE
+ SYNTAX DsIntEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ " Entry containing interaction details of a DS
+ with a peer DS."
+ INDEX { applIndex, dsIntIndex }
+ ::= { dsIntTable 1 }
+
+ DsIntEntry ::= SEQUENCE {
+
+ dsIntIndex
+ INTEGER,
+ dsName
+ DistinguishedName,
+ dsTimeOfCreation
+ TimeStamp,
+ dsTimeOfLastAttempt
+ TimeStamp,
+ dsTimeOfLastSuccess
+ TimeStamp,
+ dsFailuresSinceLastSuccess
+ Counter32,
+ dsFailures
+ Counter32,
+ dsSuccesses
+ Counter32,
+ dsURL
+ URLString
+
+ }
+
+ dsIntIndex OBJECT-TYPE
+ SYNTAX INTEGER (1..2147483647)
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ " Together with applIndex it forms the unique key to
+ identify the conceptual row which contains useful info
+ on the (attempted) interaction between the DS (referred
+ to by applIndex) and a peer DS."
+ ::= {dsIntEntry 1}
+
+ dsName OBJECT-TYPE
+ SYNTAX DistinguishedName
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Distinguished Name of the peer DS to which this
+ entry pertains."
+ ::= {dsIntEntry 2}
+
+ dsTimeOfCreation 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}
+
+ dsTimeOfLastAttempt OBJECT-TYPE
+ SYNTAX TimeStamp
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " The value of sysUpTime when the last attempt was made
+ to contact this DS. If the last attempt was made before
+ the network management subsystem was initialized, this
+ object will contain a value of zero."
+ ::= {dsIntEntry 4}
+
+ dsTimeOfLastSuccess OBJECT-TYPE
+ SYNTAX TimeStamp
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " The value of sysUpTime when the last attempt made to
+ contact this DS 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}
+
+ dsFailuresSinceLastSuccess OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " The number of failures since the last time an
+ attempt to contact this DS was successful. If
+ there has been no successful attempts, this counter
+ will contain the number of failures since this entry
+ was created."
+ ::= {dsIntEntry 6}
+
+ dsFailures OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Cumulative failures since the creation of
+ this entry."
+ ::= {dsIntEntry 7}
+
+ dsSuccesses OBJECT-TYPE
+ SYNTAX Counter32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " Cumulative successes since the creation of
+ this entry."
+ ::= {dsIntEntry 8}
+
+ dsURL OBJECT-TYPE
+ SYNTAX URLString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ " URL of the DS application."
+ ::= {dsIntEntry 9}
+
+--
+-- Information about this installation of the directory server
+--
+
+ dsEntityTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF DsEntityEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "This table holds general information related to an installed
+ instance of a directory server"
+ ::= {nsldap 5}
+
+ dsEntityEntry OBJECT-TYPE
+ SYNTAX DsEntityEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Entry of general information about an installed instance
+ of a directory server"
+ INDEX { applIndex}
+ ::= {dsEntityTable 1}
+
+ DsEntityEntry ::= SEQUENCE {
+ dsEntityDescr
+ DisplayString,
+ dsEntityVers
+ DisplayString,
+ dsEntityOrg
+ DisplayString,
+ dsEntityLocation
+ DisplayString,
+ dsEntityContact
+ DisplayString,
+ dsEntityName
+ DisplayString
+ }
+
+ dsEntityDescr OBJECT-TYPE
+ SYNTAX DisplayString(SIZE (0..255))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "A general textual description of this directory server."
+ ::= {dsEntityEntry 1}
+
+ dsEntityVers OBJECT-TYPE
+ SYNTAX DisplayString(SIZE (0..255))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "The version of this directory server"
+ ::={dsEntityEntry 2}
+
+ dsEntityOrg OBJECT-TYPE
+ SYNTAX DisplayString(SIZE (0..255))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Organization responsible for directory server at this installation"
+ ::={dsEntityEntry 3}
+
+ dsEntityLocation OBJECT-TYPE
+ SYNTAX DisplayString(SIZE (0..255))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Physical location of this entity (directory server).
+ For example: hostname, building number, lab number, etc."
+ ::={dsEntityEntry 4}
+
+ dsEntityContact OBJECT-TYPE
+ SYNTAX DisplayString(SIZE (0..255))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Contact person(s)responsible for the directory server at this
+ installation, together with information on how to conact."
+ ::={dsEntityEntry 5}
+
+ dsEntityName OBJECT-TYPE
+ SYNTAX DisplayString(SIZE (0..255))
+ ACCESS read-only
+ STATUS mandatory
+ DESCRIPTION
+ "Name assigned to this entity at the installation site"
+ ::={dsEntityEntry 6}
+
+--
+-- Traps
+--
+--
+ nsDirectoryServerDown TRAP-TYPE
+ ENTERPRISE netscape
+ VARIABLES { dsEntityDescr, dsEntityVers, dsEntityLocation,
+ dsEntityContact }
+ DESCRIPTION "This trap is generated whenever the agent detects the
+ directory server to be (potentially) Down."
+ ::= 7001
+
+ nsDirectoryServerStart TRAP-TYPE
+ ENTERPRISE netscape
+ VARIABLES { dsEntityDescr, dsEntityVers, dsEntityLocation }
+ DESCRIPTION "This trap is generated whenever the agent detects the
+ directory server to have (re)started."
+ ::= 7002
+
+ END
+
diff --git a/ldap/servers/snmp/ntagt/Makefile b/ldap/servers/snmp/ntagt/Makefile
new file mode 100644
index 00000000..22605b2f
--- /dev/null
+++ b/ldap/servers/snmp/ntagt/Makefile
@@ -0,0 +1,103 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#############################################################################
+# SNMP NT Subagent Common Rulesets #
+#############################################################################
+
+MCOM_ROOT = ../../../../..
+MSRV_ROOT = ../../..
+SLAPD_ROOT = $(MSRV_ROOT)/servers/slapd
+SNMP_ROOT = $(MSRV_ROOT)/servers/snmp
+LIBDEST = $(OBJDIR)/obj
+BINDIR = $(LDAP_SERVER_RELDIR)
+
+NOSTDCLEAN = true # don't let nsconfig.mk define target clean
+NOSTDSTRIP = true # don't let nsconfig.mk define target strip
+NSPR20 = true
+
+include $(MCOM_ROOT)/ldapserver/nsconfig.mk
+include $(MSRV_ROOT)/nsldap.mk
+
+OBJ_SUFFIX = obj
+
+INCLUDES += -I../../slapd -I$(MCOM_ROOT)/ldapserver/ldap/include
+
+CCOPTS += $(CFLAGS) $(DLL_CFLAGS) $(MCC_INCLUDE) $(INCLUDES) -I$(SNMP_ROOT)
+CXXOPTS += $(CFLAGS) $(DLL_CXXFLAGS) $(MCC_INCLUDE) $(INCLUDES) -I$(SNMP_ROOT)
+
+EXTRA_LIBS = advapi32.lib user32.lib snmpapi.lib mgmtapi.lib $(LDAP_SDK_LIBLDAP_DLL)
+
+#############################################################################
+# SNMP NT Subagent Core Components #
+#############################################################################
+
+LOCAL_SRCS = agtmmap.c \
+ nsldapagt_nt.c \
+ nsldapmib_nt.c
+
+SNMP_SRCS = $(LOCAL_SRCS)
+
+LOCAL_INCS = agtmmap.h \
+ nsldapagt_nt.h \
+ nsldapmib_nt.h
+
+SNMP_INCS = $(LOCAL_INCS)
+
+SNMP_OBJS = $(addprefix $(LIBDEST)/, \
+ agtmmap.$(OBJ_SUFFIX) \
+ nsldapagt_nt.$(OBJ_SUFFIX) \
+ nsldapmib_nt.$(OBJ_SUFFIX))
+
+
+SNMP_LIB = ns-ldapagt.$(DLL_SUFFIX)
+SNMP_IMPLIB = ns-ldapagt.$(LIB_SUFFIX)
+
+#############################################################################
+# SNMP NT Subagent Build Rules #
+#############################################################################
+
+# Now we get into the actual build rules
+AGTMMAP = agtmmap
+
+all: $(LDAP_SERVER_RELDIR) $(AGTMMAP) $(BINDIR)/$(SNMP_LIB)
+
+over: clean all
+
+$(AGTMMAP): $(SLAPD_ROOT)/$(AGTMMAP).c $(SLAPD_ROOT)/$(AGTMMAP).h
+ $(CP) $(SLAPD_ROOT)/$(AGTMMAP).c .
+ $(CP) $(SLAPD_ROOT)/$(AGTMMAP).h .
+
+$(SNMP_OBJS): $(SNMP_SRCS) $(SNMP_INCS)
+
+$(BINDIR)/$(SNMP_LIB): $(SNMP_OBJS) $(SNMP_RES) Makefile
+ $(LINK_DLL) $(LD_EXTRAS) /DEF:"nsldapagt_nt.def" /VERSION:"7" \
+ $(SNMP_OBJS) $(EXTRA_LIBS)
+
+$(LIBDEST)/%.$(OBJ_SUFFIX): %.cxx
+ $(CCP) -c $(CXXOPTS) $< -Fo$(LIBDEST)/$*.$(OBJ_SUFFIX)
+
+$(LIBDEST)/%.$(OBJ_SUFFIX): %.c
+ $(CC) -c $(CCOPTS) $< -Fo$(LIBDEST)/$*.$(OBJ_SUFFIX)
+
+$(LIBDEST)/%.$(OBJ_SUFFIX): $(SNMP_ROOT)/%.cxx
+ $(CCP) -c $(CXXOPTS) $< -Fo$(LIBDEST)/$*.$(OBJ_SUFFIX)
+
+$(LIBDEST)/%.$(OBJ_SUFFIX): $(SNMP_ROOT)/%.c
+ $(CC) -c $(CCOPTS) $< -Fo$(LIBDEST)/$*.$(OBJ_SUFFIX)
+
+clean: localclean
+
+localclean:
+ $(RM) $(SNMP_OBJS) $(LIBDEST)/$(SNMP_LIB) $(LIBDEST)/$(SNMP_IMPLIB) $(AGTMMAP).c $(AGTMMAP).h
+
+#############################################################################
+# Depend Area #
+#############################################################################
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
diff --git a/ldap/servers/snmp/ntagt/msrvdefs.mak b/ldap/servers/snmp/ntagt/msrvdefs.mak
new file mode 100644
index 00000000..ac877d9c
--- /dev/null
+++ b/ldap/servers/snmp/ntagt/msrvdefs.mak
@@ -0,0 +1,492 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# Copyright 2001 Sun Microsystems, Inc.
+# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#############################################################################
+# Mail Server Common Rulesets #
+#############################################################################
+
+MSRV_RELEASE = 4.0
+
+ifeq ($(DEBUG), optimize)
+MSRV_DEBUG = no
+else
+MSRV_DEBUG = yes
+endif
+
+ifeq ($(MSRV_DEBUG), yes)
+DEBUG_DEST = DBG-
+else
+DEBUG_DEST =
+endif
+
+# this allows mixing DBG objects with non DBG libs, avoiding
+# a complete autobuild or other linking hacks. Any DBG libs
+# (under mailserv2) will get picked up first, followed by non-DBG
+# libs. In any event, no DBG libs will be linked if MSRV_DEBUG=no.
+NDBGDEST = $(MSRV_ROOT)/built/$(ARCH)
+
+# This is where we are generally supposed to put built stuff
+BLDDEST = $(MSRV_ROOT)/built/$(DEBUG_DEST)$(ARCH)
+
+# module specific locations for build stuff
+LIBDEST = $(BLDDEST)/lib
+NETDEST = $(BLDDEST)/network
+LOCDEST = $(BLDDEST)/local
+EXTDEST = $(BLDDEST)/extras
+BINDEST = $(BLDDEST)/bin
+OBJDEST = $(BLDDEST)/obj
+
+IMPORTS_DIR = $(MSRV_ROOT)/code/import
+
+
+# Extensions for generated files.
+
+SHLIB_SUFFIX = so
+ARCHIVE_SUFFIX = a
+OBJ_SUFFIX = o
+EXE_SUFFIX =
+
+export SHLIB_EXT ARCHIVE_EXT OBJ_EXT EXE_EXT
+
+RM = rm -f
+AR = ar cr
+MD = mkdir -p
+MAKE = gmake
+STRIP = strip
+CP = cp
+ECHO = echo
+
+# For reasons you really don't want to know, we put all the C++ core
+# modules into a static lib on Unix platforms. If the system supports
+# shared libs, we use it only for C-derived object modules.
+
+ifneq ($(ARCH), WINNT)
+STAT_LIB = libNSmObj.$(ARCHIVE_SUFFIX)
+endif
+
+ifeq ($(ARCH), WINNT)
+
+ifeq ($(DEBUG), full)
+ML_DEBUG = /DEBUG
+ifeq ($(NTDEBUGENV),ON)
+MC_DEBUGENV= /D__NTDebugEnv__
+else
+MC_DEBUGENV=
+endif
+ifeq ($(NTDEBUGSLEEP),ON)
+MC_DEBUG=/D__NTDebug__ /D__NTDebugSleep__ $(MC_DEBUGENV)
+else
+MC_DEBUG = /D__NTDebug__ $(MC_DEBUGENV)
+endif
+else
+ML_DEBUG =
+MC_DEBUG =
+endif
+
+endif
+### Solaris #############################################################
+
+ifeq ($(ARCH), SOLARIS)
+ BUILD_SHARED = TRUE
+ BUILDAPI_SHARED = FALSE
+ PLUGIN_SHARED = TRUE
+ CC = gcc
+ CXX = g++
+
+ifeq ($(PURIFY), yes)
+ CC = /stuff/iasrc3/xtern/purify/purify gcc
+ CXX = /stuff/iasrc3/xtern/purify/purify g++
+endif
+
+ifeq ($(QUANTIFY), yes)
+ CC = /stuff/iasrc3/xtern/quantify/quantify gcc
+ CXX = /stuff/iasrc3/xtern/quantify/quantify g++
+endif
+
+ LD = ld
+ DLL_CFLAGS = -fpic
+ DLL_CXXFLAGS = -fpic
+ DLL_LDFLAGS = -G
+ OPTIMIZE_FLAGS = -O2
+ CFLAGS = $(DLL_CFLAGS) -DSVR4 -D__svr4__ -DSOLARIS \
+ -DHAVE_NIS -DHAS_GETSPNAM -DHAS_FGETPWENT \
+ -DXP_UNIX -DSTATOBJS \
+ -DMSRV_RELEASE=\"$(MSRV_RELEASE)\" \
+ -DOSVERSION=$(OSVERSION) -D_REENTRANT
+ LD_EXTRAS = -L/tools/ns/lib -lthread -lsocket -lnsl -lgen -ldl
+ MADM_LDLIBS = -ldl
+endif
+
+### IRIX notes ##########################################################
+## Suppress warnings about statement unreachable (3203) and
+## unused parameters (3262). Increase Olimit
+## Suppress REALLY ANNOYING link warnings unless a debug build
+## 84 is unsed libs. 85 is duplicate symbol preemption.
+## This hides duplicate symbols in the link - so watch it
+##########################################################################
+ifeq ($(ARCH), IRIX)
+ BUILD_SHARED = TRUE
+ BUILDAPI_SHARED = FALSE
+ PLUGIN_SHARED = TRUE
+ CC = cc
+ifneq ($(MSRV_DEBUG),yes)
+ CXX = CC -woff 3203,3262 -Wl,-woff,84 -Wl,-woff,85
+else
+ CXX = CC
+endif
+ LD = CC
+ DLL_CFLAGS =
+ DLL_CXXFLAGS =
+ DLL_LDFLAGS = -shared
+ OPTIMIZE_FLAGS = -O -Olimit 4096
+ CFLAGS = $(DLL_CFLAGS) -DIRIX -DSTATOBJS \
+ -DHAVE_NIS -DHAS_GETSPNAM -DHAS_FGETPWENT \
+ -DXP_UNIX \
+ -DMSRV_RELEASE=\"$(MSRV_RELEASE)\" \
+ -DOSVERSION=$(OSVERSION)
+
+ LD_EXTRAS =
+endif
+
+### HPUX notes ###########################################################
+## g++ does not support pic on a300 architecture
+## -Wl,+b,/usr/lib,+s is needed so that runtime can find shared lib
+## correctly
+## Also, gcc is used to compile and link modules with c-based main
+## to overcome a global constructor problem. Change in
+## admin/src/Makefile and code/network/IMAP4-Server/unix/Makefile
+## and code/tools/Makefile
+#########################################################################
+
+ifeq ($(ARCH), HPUX)
+ SHLIB_SUFFIX = sl
+ BUILD_SHARED = TRUE
+ BUILDAPI_SHARED = FALSE
+ PLUGIN_SHARED = TRUE
+ CC = cc
+ CXX = g++
+ LD = ld
+ NATIVE_CFLAGS = -Aa -D_HPUX_SOURCE
+ DLL_CFLAGS = +z
+ DLL_CXXFLAGS =
+ DLL_LDFLAGS = -b
+ OPTIMIZE_FLAGS = -O
+ CFLAGS = -DHPUX -DSTATOBJS -DHAVE_NIS \
+ -DXP_UNIX -DHAS_FGETPWENT \
+ -DMSRV_RELEASE=\"$(MSRV_RELEASE)\" \
+ -DOSVERSION=$(OSVERSION)
+ LD_EXTRAS = -Wl,+b,/usr/lib,+s \
+ -L/tools/ns/lib -liostream -ldld -lm
+ #-L/tools/ns/lib -liostream -ldld -lm -lpthread
+ MSRV_INCLUDES = -I/tools/ns/lib/g++-include
+endif
+
+
+### OSF1 notes ############################################################
+## -taso options and -DIS_64 are needed to get 32 bit behavior on the alpha
+## ...otherwise libdbm will not work
+###########################################################################
+
+ifeq ($(ARCH), OSF1)
+ BUILD_SHARED = TRUE
+ BUILDAPI_SHARED = FALSE
+ PLUGIN_SHARED = TRUE
+ CC = cc -taso -DIS_64 -Olimit 4000
+ CXX = g++
+ LD = ld
+ DLL_CFLAGS =
+ DLL_CXXFLAGS =
+ DLL_LDFLAGS =
+ OPTIMIZE_FLAGS = -O
+ CFLAGS = -DOSF1 -DSTATOBJS -DHAVE_NIS -DXP_UNIX \
+ -DHAS_FGETPWENT \
+ -DMSRV_RELEASE=\"$(MSRV_RELEASE)\" \
+ -DOSVERSION=$(OSVERSION)
+ LD_EXTRAS = -lc_r -L/tools/ns/lib -liostream -Wl,-taso
+ MSRV_INCLUDES = -I/tools/ns/lib/g++-include
+endif
+
+### AIX notes #############################################################
+## Yah, right. In your dreams...
+## What a horrid c++ platform. We need to supply our own g++ config file
+## because the systems supplied one is broken. Lots of surprises in store.
+## Needs a separate build tree on 3.2.5 because automount is broken.
+## Also, like HP - gcc is used to compile and link modules with c-based main
+## to overcome a global constructor problem. Change in
+## admin/src/Makefile and code/network/IMAP4-Server/unix/Makefile
+## and code/tools/Makefile
+##
+## DLL_CFLAGS type of stuff is set specifically in plugins/Makefile
+## and also local/SMTP-Router/Makefile to use a specific export list
+## (for the NSmatch plugin in this case). Also see further below for the
+## linker override option to use the import list instead of a named lib
+##########################################################################
+
+## AIX 4
+ifeq ($(ARCH), AIX)
+ BUILD_SHARED = FALSE
+ BUILDAPI_SHARED = FALSE
+ PLUGIN_SHARED = TRUE
+ SHLIB_SUFFIX = _shr.a
+ CC = cc
+ CXX = g++
+# CXX = g++ -I$(MSRV_ROOT)/code/include/aix
+ LD = ld
+ DLL_CLAGS =
+ DLL_CXXFLAGS =
+ OPTIMIZE_FLAGS = -O
+ CFLAGS = -DAIX -DAIXV3 -DAIXV4 -DSTATOBJS \
+ -DHAVE_NIS -DXP_UNIX -mcpu=common\
+ -DMSRV_RELEASE=\"$(MSRV_RELEASE)\" \
+ -DOSVERSION=$(OSVERSION)
+ LD_EXTRAS = -L/gnu/install/lib -L/gnu/install/lib/gcc-lib/powerpc-ibm-aix4.1.4.0/2.7.2.1/common -lstdc++ -ls -lsvld -lgcc -lc_r
+# LD_EXTRAS = -L/usr/gnu/lib -liostream -ls -ldl
+ MSRV_INCLUDES = -I/gnu/install/lib/g++-include
+# MSRV_INCLUDES = -I/usr/gnu/lib/g++-include
+endif
+
+## AIX 3
+#ifeq ($(ARCH), AIX)
+# BUILD_SHARED = FALSE
+# BUILDAPI_SHARED = FALSE
+# PLUGIN_SHARED = TRUE
+# CC = svcc
+# CXX = g++ -I$(MSRV_ROOT)/code/include/aix
+# LD = ld
+# DLL_CLAGS =
+# DLL_CXXFLAGS =
+# OPTIMIZE_FLAGS = -O
+# CFLAGS = -DAIX -DAIXV3 -DSTATOBJS \
+# -DHAVE_NIS -DXP_UNIX \
+# -DMSRV_RELEASE=\"$(MSRV_RELEASE)\"
+# LD_EXTRAS = -L/tools/ns/lib -liostream -ls
+# MSRV_INCLUDES = -I/tools/ns/lib/g++-include
+#endif
+
+
+ifeq ($(ARCH), WINNT)
+
+ SHLIB_SUFFIX = dll
+ ARCHIVE_SUFFIX = lib
+ RM = del /q
+ EXE_SUFFIX = .exe
+ OBJ_SUFFIX = obj
+
+ SHARED_LIB = NetscapeMTA30.$(SHLIB_SUFFIX)
+ SHARED_IMPLIB = NetscapeMTA30.$(ARCHIVE_SUFFIX)
+ SHARED_BASE_LIB = NetscapeMTAX30.$(SHLIB_SUFFIX)
+ SHARED_BASE_IMPLIB = NetscapeMTAX30.$(ARCHIVE_SUFFIX)
+ MATCH_LIB = NSMatch30.$(SHLIB_SUFFIX)
+ MATCH_IMPLIB = NSMatch30.$(ARCHIVE_SUFFIX)
+ POSEC_LIB = nsSupport30.$(SHLIB_SUFFIX)
+ POSEC_IMPLIB = nsSupport30.$(ARCHIVE_SUFFIX)
+ MDBAPI_LIB = NetscapeMDB30.$(SHLIB_SUFFIX)
+ MDBAPI_IMPLIB = NetscapeMDB30.$(ARCHIVE_SUFFIX)
+ BUILD_SHARED = TRUE
+ BUILDAPI_SHARED = TRUE
+ PLUGIN_SHARED = TRUE
+ POSEC_SHARED = FALSE
+ CFLAGS = /D__NT__ $(MC_DEBUG) \
+ /DMSRV_RELEASE=\"$(MSRV_RELEASE)\" \
+ /D$(NS_PRODUCT) $(XP_FLAG) \
+ /D__USE_THREAD_HEAPS__ -Gy
+ OPTIMIZE_FLAGS = -Ob1 -O2
+ DLL_CFLAGS = /D__Lib__
+ DLL_CXXFLAGS = /D__Lib__
+ LD_EXTRAS = /INCREMENTAL:NO $(ML_DEBUG)
+ LINK_CONSOLE = link /NOLOGO /SUBSYSTEM:CONSOLE $(ML_DEBUG) \
+ /OUT:$@ /OPT:REF /MAP
+endif
+
+
+.SUFFIXES: .cxx
+
+# In Debug mode, always build archive libraries
+
+ifeq ($(MSRV_DEBUG), yes)
+
+ifneq ($(ARCH), WINNT)
+MSRV_DBG_DEFINES = -g -DMSRV_DEBUG $(DBG_FLAGS)
+BUILD_SHARED = FALSE
+PLUGIN_SHARED = FALSE
+else
+MSRV_DBG_DEFINES = /Od /Zi $(DBG_FLAGS)
+endif
+
+else
+MSRV_DBG_DEFINES = $(OPTIMIZE_FLAGS)
+endif
+
+
+ifneq ($(ARCH), WINNT)
+
+ifeq ($(BUILD_SHARED), TRUE)
+ SHARED_LIB = libNSmail.$(SHLIB_SUFFIX)
+else
+ SHARED_LIB = libNSmail.$(ARCHIVE_SUFFIX)
+endif
+
+ifeq ($(BUILDAPI_SHARED), TRUE)
+ MDBAPI_LIB = libNSmdb.$(SHLIB_SUFFIX)
+else
+ MDBAPI_LIB = libNSmdb.$(ARCHIVE_SUFFIX)
+endif
+
+
+ifeq ($(PLUGIN_SHARED), TRUE)
+ifeq ($(ARCH), AIX)
+ MATCH_LIB = libNSmatch$(SHLIB_SUFFIX)
+ HDR_LIB = libNShdr$(SHLIB_SUFFIX)
+else
+ MATCH_LIB = libNSmatch.$(SHLIB_SUFFIX)
+ HDR_LIB = libNShdr.$(SHLIB_SUFFIX)
+endif
+else
+ MATCH_LIB = libNSmatch.$(ARCHIVE_SUFFIX)
+ HDR_LIB = libNShdr.$(ARCHIVE_SUFFIX)
+endif
+
+
+ifeq ($(ARCH), HPUX)
+ifeq ($(MSRV_HPUX_CURSES_STATIC), TRUE)
+CURSES=/usr/lib/libHcurses.a
+else
+CURSES=/usr/lib/libcurses.sl
+endif
+else
+CURSES=-lcurses -ltermcap
+endif
+
+ifeq ($(ARCH), AIX)
+CURSES=-lcurses
+endif
+
+# Before merge stuff - nirmal 4/24
+#LD_LINKLIB = -L$(LIBDEST) -L/usr/lib -L$(NDBGDEST)/lib \
+# -lNSmdb -lNSmail -lNSmObj \
+# -lNSmail -lNSmdb -L$(NSCP_DISTDIR)/lib \
+# -llcache10 -lldap10 $(CURSES)
+#
+
+ifeq ($(ARCH), HPUX)
+LD_LINKLIB = -L$(LIBDEST) -L/usr/lib -L$(NDBGDEST)/lib \
+ -lNSmdb -lNSmail -lNSmObj -lNSmail -lNSmdb \
+ -L$(NSCP_DISTDIR)/lib -llcache10 \
+ -lldap10 \
+ $(CURSES)
+else
+LD_LINKLIB = -L$(LIBDEST) -L/usr/lib -L$(NDBGDEST)/lib \
+ -lNSmdb -lNSmail -lNSmObj -lNSmail -lNSmdb \
+ $(NSCP_DISTDIR)/lib/liblcache10.$(SHLIB_SUFFIX) \
+ $(NSCP_DISTDIR)/lib/libldap10.$(SHLIB_SUFFIX) \
+ $(CURSES)
+endif
+
+ifeq ($(ARCH), AIX)
+CURSES=-lcurses
+LD_LINKLIB = -L$(LIBDEST) -L/usr/lib -L$(NDBGDEST)/lib \
+ -lNSmdb -lNSmail -lNSmObj \
+ $(NSCP_DISTDIR)/lib/liblcache10$(SHLIB_SUFFIX) \
+ $(NSCP_DISTDIR)/lib/libldap10$(SHLIB_SUFFIX) \
+ $(NSCP_DISTDIR)/lib/libssldap10.a \
+ $(CURSES)
+
+endif
+
+
+LD_MATCHLIB = -lNSmatch
+else # ARCH = WINNT section
+LD_POSECLIB = $(addprefix $(LIBDEST)/, $(POSEC_IMPLIB))
+LD_LINKLIB = $(addprefix $(LIBDEST)/, $(SHARED_IMPLIB))
+LD_MATCHLIB = $(addprefix $(LIBDEST)/, $(MATCH_IMPLIB))
+endif
+
+ifeq ($(ARCH), WINNT)
+LD_LINKLIB += $(NSCP_DISTDIR)/lib/nsldap32v10.lib $(NSCP_DISTDIR)/lib/nslch32v10.lib
+LDX_LINKLIB = $(LD_LINKLIB) $(LIBDEST)/$(SHARED_BASE_IMPLIB)
+
+I18NLIBS=$(addsuffix .$(LIB_SUFFIX),\
+ $(addprefix $(OBJDIR)/lib/lib, \
+ ldapu $(LIBADMIN) $(FRAME) $(CRYPT) $(LIBACCESS))) \
+ $(LIBDBM) $(LIBXP) $(LIBNSPR) $(LIBARES) $(LIBSEC)
+else
+
+# The way I18LIBS was defined in server3_mail_branch, is quite misleading.
+# (see modules.mk for details). After this, LD_LINKLIB gets redefined
+# and that adds unwanted lines to the link of bunch of things. Please
+# add I18LIBS to the individual makefiles, where necessary. See
+# mailserv2/admin/src/Makefile -> DEPLIBS for an example.
+# I am changing this definition for the merge. Retain these changes in
+# future merges. I haved added posix4 to keep what was before merge.
+# - Nirmal 4/24/97.
+#I18NLIBS=$(addsuffix .$(LIB_SUFFIX),\
+# $(addprefix $(OBJDIR)/lib/lib, \
+# ldapu $(LIBADMIN) $(FRAME) $(CRYPT) $(LIBACCESS))) \
+# $(LIBDBM) $(LIBXP) $(LIBNSPR) $(LIBARES) \
+# -L$(MCOM_ROOT)/components/ldapsdk/$(NSOBJDIR_NAME)/lib \
+# -lssldap10 $(LIBSEC)
+I18NLIBS=$(addsuffix .$(LIB_SUFFIX),\
+ $(addprefix $(OBJDIR)/lib/lib, \
+ ldapu $(LIBADMIN) $(FRAME) $(CRYPT) $(LIBACCESS))) \
+ $(LIBDBM) $(LIBXP) $(LIBNSPR) $(LIBARES) \
+ -L$(NSCP_DISTDIR)/lib \
+ -lssldap10 $(LIBSEC)
+
+endif
+
+ifeq ($(ARCH), SOLARIS) # IRIX and HPUX have no posix4 lib
+ I18NLIBS += -lposix4
+endif
+
+LD_LINKLIB += $(I18NLIBS)
+
+ifeq ($(ARCH), IRIX)
+LD_LINKLIB += $(NSCP_DISTDIR)/lib/libldap10.so
+endif
+
+##########################################################################
+## AIX override to make dynamic linking work correctly
+## instead of linking directly with the shared object, we use an
+## import list. Note this syntax only works with g++ or gcc as the compiler
+##########################################################################
+
+ifeq ($(ARCH), AIX)
+LD_MATCHLIB = -Wl,-bI:$(MSRV_ROOT)/code/plugins/NSMatch.exp
+endif
+
+
+
+DB_DEFINES = -DMEMMOVE -D__DBINTERFACE_PRIVATE -DPOSIX_MISTAKE
+
+INCLUDES = -I$(MSRV_ROOT)/code/include \
+ -I$(MCOM_ROOT)/lib/libdbm \
+ -I$(MSRV_ROOT)/contrib/regex \
+ $(MSRV_INCLUDES)
+
+CCOPTS = $(MSRV_DBG_DEFINES) $(CFLAGS) $(INCLUDES) \
+ $(MCC_INCLUDE) $(NSPR_DEFINES)
+CXXOPTS = $(MSRV_DBG_DEFINES) $(CFLAGS) $(INCLUDES) \
+ $(MCC_INCLUDE) $(NSPR_DEFINES)
+
+
+MSRVDESTS = $(BLDDEST) $(LIBDEST) $(NETDEST) $(LOCDEST) $(EXTDEST) \
+ $(BINDEST) $(OBJDEST)
+
+$(MSRVDESTS):
+ $(MD) $@
+
+default: all
+
+all: $(MSRVDESTS)
+
+depend: localdepend
+
+clean: localclean
+
+spotless: clean
+ $(RM) -r $(BLDDEST)
+
diff --git a/ldap/servers/snmp/ntagt/nslagtcom_nt.h b/ldap/servers/snmp/ntagt/nslagtcom_nt.h
new file mode 100644
index 00000000..0a9f7eb5
--- /dev/null
+++ b/ldap/servers/snmp/ntagt/nslagtcom_nt.h
@@ -0,0 +1,32 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+/*-------------------------------------------------------------------------
+ *
+ * nslagtcom_nt.h - Common definitions for NS Directory Server's SNMP
+ * subagent on NT.
+ * The definitions in here should be kept so that modules
+ * other than the subagent can share this file.
+ *
+ * Revision History:
+ * 07/27/1997 Steve Ross Created
+ *
+ *
+ *
+ *-----------------------------------------------------------------------*/
+
+#ifndef __NSLAGTCOM_NT_H_
+#define __NSLMAGTCOM_NT_H_
+
+/*-------------------------------------------------------------------------
+ *
+ * Defines
+ *
+ *-----------------------------------------------------------------------*/
+
+#define MAGT_NSEV_SNMPTRAP "NSEV_SNMPTRAP_LDAP"
+
+#endif /* __NSLAGTCOM_NT_H_ */
diff --git a/ldap/servers/snmp/ntagt/nsldapagt_nt.c b/ldap/servers/snmp/ntagt/nsldapagt_nt.c
new file mode 100644
index 00000000..268ee27e
--- /dev/null
+++ b/ldap/servers/snmp/ntagt/nsldapagt_nt.c
@@ -0,0 +1,1738 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+/*-------------------------------------------------------------------------
+ *
+ * nsldapagt_nt.c - SNMP Extension Agent for Directory Server on NT.
+ * Provides SNMP data to NT SNMP Service on behalf of the
+ * Directory Server installed on the current system. SNMP
+ * data is collected from the following sources:
+ * 1. config file (static data)
+ * 2. daemonstats file (dynamic data)
+ *
+ * Revision History:
+ * 07/25/1997 Steve Ross Created
+ *
+ *
+ *-----------------------------------------------------------------------*/
+
+
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <io.h>
+#include <windows.h>
+#include <winsock.h>
+#include <time.h>
+#include <snmp.h>
+#include "nt/regparms.h"
+#include "agtmmap.h"
+#include "nslagtcom_nt.h"
+#include "nsldapmib_nt.h"
+#include "nsldapagt_nt.h"
+#include "ldap.h"
+
+/*-------------------------------------------------------------------------
+ *
+ * Defines
+ *
+ *-----------------------------------------------------------------------*/
+
+#define REPLACE(x, y) do {if ((x)) SNMP_free((x));\
+ (x) = SNMP_malloc(strlen((y)) + 1);\
+ if ((x)) strcpy((x), (y));} while(0)
+
+#define export extern "C"
+
+/*-------------------------------------------------------------------------
+ *
+ * Globals
+ *
+ *-----------------------------------------------------------------------*/
+
+instance_list_t *pInstanceList = NULL;
+
+/*
+ * Extension Agent DLLs need access to elapsed time agent has been active.
+ * This is implemented by initializing the Extension Agent with a time zero
+ * reference, and allowing the agent to compute elapsed time by subtracting
+ * the time zero reference from the current system time. This Extension
+ * Agent implements this reference with dwTimeZero.
+ */
+DWORD dwTimeZero = 0;
+
+/*-------------------------------------------------------------------------
+ *
+ * Externs
+ *
+ *-----------------------------------------------------------------------*/
+
+extern AsnObjectIdentifier MIB_OidPrefix;
+extern UINT MIB_num_vars;
+
+/*------------------------ prototypes -----------------------------------*/
+// char *getRootDirFromConfFile(char *filename, char *szLogPath);
+char *getRootDirFromConfFile(char *filename);
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtInitInstance: initializes entry in instance list
+ *
+ *
+ *
+ *
+ *
+ *-----------------------------------------------------------------------*/
+
+ int MagtInitInstance(instance_list_t *pInstance)
+ {
+
+
+ pInstance->ghTrapEvent = NULL;
+ pInstance->pOpsStatInfo = NULL;
+ pInstance->pEntriesStatInfo = NULL;
+ pInstance->ppIntStatInfo = NULL;
+ pInstance->pMibInfo = NULL;
+ pInstance->oldUpdateTime = 0;
+ pInstance->oldStartTime = 0;
+ pInstance->graceCycles = MAGT_TIME_QUANTUM;
+ pInstance->mmapStale = MAGT_FALSE;
+ pInstance->mmapOk = MAGT_FALSE;
+ pInstance->serverUp = MAGT_FALSE;
+ pInstance->downTrapSent = MAGT_FALSE;
+ pInstance->trapType = MAGT_TRAP_NONE;
+
+ return 0;
+ }
+
+ int MagtInitStats(MagtOpsTblInfo_t *OpsTblInfo,
+ MagtEntriesTblInfo_t *EntriesTblInfo,
+ MagtIntTblInfo_t **IntTblInfo )
+ {
+ int i;
+
+ if (OpsTblInfo != NULL)
+ {
+ OpsTblInfo->AnonymousBinds = 0;
+ OpsTblInfo->UnAuthBinds = 0;
+ OpsTblInfo->SimpleAuthBinds = 0;
+ OpsTblInfo->StrongAuthBinds = 0;
+ OpsTblInfo->BindSecurityErrors = 0;
+ OpsTblInfo->InOps = 0;
+ OpsTblInfo->ReadOps = 0;
+ OpsTblInfo->CompareOps = 0;
+ OpsTblInfo->AddEntryOps = 0;
+ OpsTblInfo->RemoveEntryOps = 0;
+ OpsTblInfo->ModifyEntryOps = 0;
+ OpsTblInfo->ModifyRDNOps = 0;
+ OpsTblInfo->ListOps = 0;
+ OpsTblInfo->SearchOps = 0;
+ OpsTblInfo->OneLevelSearchOps = 0;
+ OpsTblInfo->WholeSubtreeSearchOps = 0;
+ OpsTblInfo->Referrals = 0;
+ OpsTblInfo->Chainings = 0;
+ OpsTblInfo->SecurityErrors = 0;
+ OpsTblInfo->Errors = 0;
+ }
+
+ if(EntriesTblInfo != NULL)
+ {
+ EntriesTblInfo->MasterEntries = 0;
+ EntriesTblInfo->CopyEntries = 0;
+ EntriesTblInfo->CacheEntries = 0;
+ EntriesTblInfo->CacheHits = 0;
+ EntriesTblInfo->SlaveHits = 0;
+ }
+
+ if(IntTblInfo != NULL)
+ {
+ for(i=0; i < NUM_SNMP_INT_TBL_ROWS; i++)
+ {
+ strcpy(IntTblInfo[i]->DsName.val, "Not Available");
+ IntTblInfo[i]->DsName.len = strlen("Not Available");
+
+ IntTblInfo[i]->TimeOfCreation = 0;
+ IntTblInfo[i]->TimeOfLastAttempt = 0;
+ IntTblInfo[i]->TimeOfLastSuccess = 0;
+ IntTblInfo[i]->FailuresSinceLastSuccess = 0;
+ IntTblInfo[i]->Failures = 0;
+ IntTblInfo[i]->Successes = 0;
+
+ strcpy(IntTblInfo[i]->URL.val, "Not Available");
+ IntTblInfo[i]->URL.len = strlen("Not Available");
+ }
+ }
+
+ return 0;
+ }
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtCheckServer: Checks the Server's status and indicates
+ * which trap is to be generated if necessary.
+ *
+ * Returns: MAGT_TRAP_NONE - No trap to be generated
+ * Trap # - Id of trap to be generated
+ *
+ *-----------------------------------------------------------------------*/
+
+int MagtCheckServer(instance_list_t *pInstance)
+{
+ int err;
+
+ if (pInstance->mmapStale == MAGT_TRUE)
+ pInstance->mmapOk = MAGT_FALSE; /* Ensure open of mmap */
+
+ err = MagtReadStats(&(pInstance->hdrInfo),
+ NULL,
+ NULL,
+ NULL,
+ pInstance->szStatsPath,
+ pInstance->szLogPath); /* Find times info in hdr */
+
+ if (pInstance->mmapOk == MAGT_FALSE)
+ {
+ if (err != 0) /* Cannot open mmap file */
+ {
+ if ((pInstance->serverUp == MAGT_TRUE) || /* Server status changes */
+ (pInstance->downTrapSent == MAGT_FALSE)) /* Down trap was not sent */
+ {
+ pInstance->serverUp = MAGT_FALSE;
+ pInstance->downTrapSent = MAGT_TRUE;
+ pInstance->trapType = MAGT_TRAP_SERVER_DOWN;
+ }
+ }
+ else
+ {
+ pInstance->mmapOk = MAGT_TRUE;
+
+ /*
+ * Since mmapOk was false, it means the mmap file couldn't be
+ * opened before. Now it is opened ok, so it will be assumed
+ * that the server has gone down and up and a start trap may need
+ * to be sent.
+ */
+ if (pInstance->mmapStale == MAGT_FALSE)
+ pInstance->serverUp = MAGT_FALSE;
+ else
+ pInstance->mmapStale = MAGT_FALSE; /* Not stale anymore */
+ }
+ }
+
+ if (pInstance->trapType == MAGT_TRAP_NONE)
+ {
+ if (err != 0)
+ {
+ pInstance->mmapOk = MAGT_FALSE;
+
+ /*
+ * If the mmap file does not exist, assume server has gone down.
+ */
+ if (err == ENOENT)
+ {
+ if((pInstance->serverUp == MAGT_TRUE) || /* Server status changes */
+ (pInstance->downTrapSent == MAGT_FALSE)) /* Down trap was not sent */
+ {
+ pInstance->serverUp = MAGT_FALSE;
+ pInstance->downTrapSent = MAGT_TRUE;
+ pInstance->trapType = MAGT_TRAP_SERVER_DOWN;
+ }
+ }
+ }
+ else /* Got hdr info ok */
+ {
+
+ /*
+ * The fact that header info can be read will be taken as the
+ * server is up. If it was not up before, a server start trap
+ * will need to be sent.
+ */
+ if (((pInstance->hdrInfo.restarted) || (pInstance->hdrInfo.startTime > pInstance->oldStartTime))
+ && (pInstance->hdrInfo.updateTime > pInstance->oldUpdateTime))
+ {
+ pInstance->oldUpdateTime = pInstance->hdrInfo.updateTime;
+ pInstance->oldStartTime = pInstance->hdrInfo.startTime;
+ pInstance->graceCycles = MAGT_TIME_QUANTUM;
+ pInstance->serverUp = MAGT_TRUE;
+ pInstance->downTrapSent = MAGT_FALSE;
+ pInstance->trapType = MAGT_TRAP_SERVER_START;
+ }
+ else
+ {
+ if (pInstance->hdrInfo.updateTime > pInstance->oldUpdateTime)
+ {
+ pInstance->oldUpdateTime = pInstance->hdrInfo.updateTime;
+ if (pInstance->graceCycles == 0)
+ {
+
+ /*
+ * The server has probably been stuck and has been restarted.
+ */
+ pInstance->serverUp = MAGT_TRUE;
+ pInstance->downTrapSent = MAGT_FALSE;
+ pInstance->trapType = MAGT_TRAP_SERVER_START;
+ }
+
+ /*
+ * Reset grace cycles in either case because server is healthy.
+ */
+ pInstance->graceCycles = MAGT_TIME_QUANTUM;
+ }
+ else /* Mmap file not updated */
+ {
+ pInstance->mmapStale = MAGT_TRUE;
+
+ /*
+ * The server is not responding, send trap if one has not
+ * been sent yet.
+ */
+ if (pInstance->graceCycles > 0)
+ {
+ pInstance->graceCycles--;
+ if (pInstance->graceCycles == 0)
+ {
+ pInstance->trapType = MAGT_TRAP_SERVER_DOWN;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return pInstance->trapType;
+}
+
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtCleanUp: Cleans up any allocated global resources.
+ *
+ * Returns: None
+ *
+ *-----------------------------------------------------------------------*/
+
+void MagtCleanUp()
+{
+ instance_list_t *pInstance;
+
+ for (pInstance = pInstanceList; pInstance; pInstance = pInstance->pNext)
+ {
+ if (pInstance->pCfgInfo != NULL)
+ GlobalFree(pInstance->pCfgInfo);
+
+ if (pInstance->pMibInfo != NULL)
+ GlobalFree(pInstance->pMibInfo);
+
+ if (pInstance->szRootDir != NULL)
+ GlobalFree(pInstance->szRootDir);
+
+ if (pInstance->ghTrapEvent != NULL)
+ CloseHandle(pInstance->ghTrapEvent);
+ }
+
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtConfProcess: Processes a configuration entry and updates the
+ * corresponding static info field.
+ *
+ * Returns: None
+ *
+ *-----------------------------------------------------------------------*/
+
+void MagtConfProcess(char *line, int lineLen,
+ MagtLDAPInfo_t *info)
+
+{
+ char keyWord[MAGT_MAX_LINELEN + 1];
+ char *val, *p;
+
+ if (line == NULL) /* Shouldn't happen */
+ return;
+
+ if ((*line) == '#') /* Comment - Ignore */
+ return;
+
+ keyWord[0] = '\0';
+
+ if (sscanf(line, "%s", keyWord) != 1) /* Partial entry */
+ return;
+
+ val = line;
+
+ /*
+ * Go past any spaces preceding the keyword.
+ */
+ while ((*val) && (isspace(*val)))
+ ++val;
+
+ if (!(*val))
+ return;
+
+ /*
+ * Go past the keyword.
+ */
+ for (; (*val) && !(isspace(*val)); ++val);
+
+ if (!(*val))
+ return;
+
+ /*
+ * Go past the spaces that follow the key word.
+ */
+ while ((*val) && (isspace(*val)))
+ ++val;
+
+ if (!(*val))
+ return;
+
+ /*
+ * Strip CRLF characters.
+ */
+ if ((p = strchr(val, '\r')) != NULL)
+ *p = '\0';
+ if ((p = strchr(val, '\n')) != NULL)
+ *p = '\0';
+
+ /*
+ * Now val points to the value and keyWord points to the key word.
+ */
+
+ if (!stricmp(keyWord, "nsslapd-port:"))
+ {
+ info->port = atoi(val);
+ return;
+ }
+
+ if (!stricmp(keyWord, "nsslapd-localhost:"))
+ {
+ REPLACE(info->host, val);
+ info->host[strlen(info->host)] = '\0';
+ return;
+ }
+
+ if (!stricmp(keyWord, "nsslapd-rootdn:"))
+ {
+ REPLACE(info->rootdn, val);
+ info->rootdn[strlen(info->rootdn)] = '\0';
+ return;
+ }
+
+ if (!stricmp(keyWord, "nsslapd-rootpw:"))
+ {
+ REPLACE(info->rootpw, val);
+ info->rootpw[strlen(info->rootpw)] = '\0';
+ return;
+ }
+
+ /*
+ * None of the above? Invalid keyword. Just return.
+ */
+ return;
+}
+
+
+char *getRootDirFromConfFile(char *confpath)
+{
+ char *rootDir = NULL;
+ const char *config = "\\config\0" ;
+ char instanceDir[MAGT_MAX_LINELEN + 1] = "";
+ size_t len ;
+
+ if (confpath) {
+ len = strlen(confpath) - strlen(config) ;
+ strncpy(instanceDir, confpath, len);
+ rootDir = _strdup(instanceDir) ; // allocate memory for rootDir and set up to value pointed by instanceDir
+ return rootDir ;
+ }
+ else return NULL ;
+}
+
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtInitMibStorage: Initializes the storage pointers of MIB variables.
+ *
+ * Returns: None
+ *
+ *-----------------------------------------------------------------------*/
+
+void MagtInitMibStorage(MagtMibEntry_t * MibInfo,
+ MagtOpsTblInfo_t * pOpsStatInfo,
+ MagtEntriesTblInfo_t * pEntriesStatInfo,
+ MagtIntTblInfo_t ** ppIntStatInfo,
+ MagtStaticInfo_t * pCfgInfo)
+{
+ switch(MibInfo->uId)
+ {
+ case MAGT_ID_DESC:
+ MibInfo->Storage = pCfgInfo->entityDescr.val;
+ break;
+ case MAGT_ID_VERS:
+ MibInfo->Storage = pCfgInfo->entityVers.val;
+ break;
+ case MAGT_ID_ORG:
+ MibInfo->Storage = pCfgInfo->entityOrg.val;
+ break;
+ case MAGT_ID_LOC:
+ MibInfo->Storage = pCfgInfo->entityLocation.val;
+ break;
+ case MAGT_ID_CONTACT:
+ MibInfo->Storage = pCfgInfo->entityContact.val;
+ break;
+ case MAGT_ID_NAME:
+ MibInfo->Storage = pCfgInfo->entityName.val;
+ break;
+ case MAGT_ID_APPLINDEX:
+ MibInfo->Storage = &pCfgInfo->ApplIndex;
+ break;
+
+ /* operations table attrs */
+ case MAGT_ID_ANONYMOUS_BINDS:
+ MibInfo->Storage = &pOpsStatInfo->AnonymousBinds;
+ break;
+ case MAGT_ID_UNAUTH_BINDS:
+ MibInfo->Storage = &pOpsStatInfo->UnAuthBinds;
+ break;
+ case MAGT_ID_SIMPLE_AUTH_BINDS:
+ MibInfo->Storage = &pOpsStatInfo->SimpleAuthBinds;
+ break;
+ case MAGT_ID_STRONG_AUTH_BINDS:
+ MibInfo->Storage = &pOpsStatInfo->StrongAuthBinds;
+ break;
+ case MAGT_ID_BIND_SECURITY_ERRORS:
+ MibInfo->Storage = &pOpsStatInfo->BindSecurityErrors;
+ break;
+ case MAGT_ID_IN_OPS:
+ MibInfo->Storage = &pOpsStatInfo->InOps;
+ break;
+ case MAGT_ID_READ_OPS:
+ MibInfo->Storage = &pOpsStatInfo->ReadOps;
+ break;
+ case MAGT_ID_COMPARE_OPS:
+ MibInfo->Storage = &pOpsStatInfo->CompareOps;
+ break;
+ case MAGT_ID_ADD_ENTRY_OPS:
+ MibInfo->Storage = &pOpsStatInfo->AddEntryOps;
+ break;
+ case MAGT_ID_REMOVE_ENTRY_OPS:
+ MibInfo->Storage = &pOpsStatInfo->RemoveEntryOps;
+ break;
+ case MAGT_ID_MODIFY_ENTRY_OPS:
+ MibInfo->Storage = &pOpsStatInfo->ModifyEntryOps;
+ break;
+ case MAGT_ID_MODIFY_RDN_OPS:
+ MibInfo->Storage = &pOpsStatInfo->ModifyRDNOps;
+ break;
+ case MAGT_ID_LIST_OPS:
+ MibInfo->Storage = &pOpsStatInfo->ListOps;
+ break;
+ case MAGT_ID_SEARCH_OPS:
+ MibInfo->Storage = &pOpsStatInfo->SearchOps;
+ break;
+ case MAGT_ID_ONE_LEVEL_SEARCH_OPS:
+ MibInfo->Storage = &pOpsStatInfo->OneLevelSearchOps;
+ break;
+ case MAGT_ID_WHOLE_SUBTREE_SEARCH_OPS:
+ MibInfo->Storage = &pOpsStatInfo->WholeSubtreeSearchOps;
+ break;
+ case MAGT_ID_REFERRALS:
+ MibInfo->Storage = &pOpsStatInfo->Referrals;
+ break;
+ case MAGT_ID_CHAININGS:
+ MibInfo->Storage = &pOpsStatInfo->Chainings;
+ break;
+ case MAGT_ID_SECURITY_ERRORS:
+ MibInfo->Storage = &pOpsStatInfo->SecurityErrors;
+ break;
+ case MAGT_ID_ERRORS:
+ MibInfo->Storage = &pOpsStatInfo->Errors;
+ break;
+ /* entries table attrs */
+ case MAGT_ID_MASTER_ENTRIES:
+ MibInfo->Storage = &pEntriesStatInfo->MasterEntries;
+ break;
+ case MAGT_ID_COPY_ENTRIES:
+ MibInfo->Storage = &pEntriesStatInfo->CopyEntries;
+ break;
+ case MAGT_ID_CACHE_ENTRIES:
+ MibInfo->Storage = &pEntriesStatInfo->CacheEntries;
+ break;
+ case MAGT_ID_CACHE_HITS:
+ MibInfo->Storage = &pEntriesStatInfo->CacheHits;
+ break;
+ case MAGT_ID_SLAVE_HITS:
+ MibInfo->Storage = &pEntriesStatInfo->SlaveHits;
+ break;
+ /* interaction table entries
+ *---------------------------------
+ * a little different because table of N entries, we can get current value of n
+ * from MibInfo->Oid.ids[MibInfo->Oid.idLength] because dsIntIndex is last,
+ * subtract 1 from it because oids go from 1 to NUM_SNMP_INT_TBL_ROWS array goes
+ * from 0 to NUM_SNMP_INT_TBL_ROWS - 1
+ * if this ever changes this logic will have to change to get it from
+ * appropriate spot
+ */
+ case MAGT_ID_DS_NAME:
+ MibInfo->Storage = ppIntStatInfo[MibInfo->Oid.ids[MibInfo->Oid.idLength - 1] - 1]->DsName.val;
+ break;
+ case MAGT_ID_TIME_OF_CREATION:
+ MibInfo->Storage = &(ppIntStatInfo[MibInfo->Oid.ids[MibInfo->Oid.idLength - 1] - 1]->TimeOfCreation);
+ break;
+ case MAGT_ID_TIME_OF_LAST_ATTEMPT:
+ MibInfo->Storage = &(ppIntStatInfo[MibInfo->Oid.ids[MibInfo->Oid.idLength - 1] - 1]->TimeOfLastAttempt);
+ break;
+ case MAGT_ID_TIME_OF_LAST_SUCCESS:
+ MibInfo->Storage = &(ppIntStatInfo[MibInfo->Oid.ids[MibInfo->Oid.idLength - 1] - 1]->TimeOfLastSuccess);
+ break;
+ case MAGT_ID_FAILURES_SINCE_LAST_SUCCESS:
+ MibInfo->Storage = &(ppIntStatInfo[MibInfo->Oid.ids[MibInfo->Oid.idLength - 1] - 1]->FailuresSinceLastSuccess);
+ break;
+ case MAGT_ID_FAILURES:
+ MibInfo->Storage = &(ppIntStatInfo[MibInfo->Oid.ids[MibInfo->Oid.idLength - 1] - 1]->Failures);
+ break;
+ case MAGT_ID_SUCCESSES:
+ MibInfo->Storage = &(ppIntStatInfo[MibInfo->Oid.ids[MibInfo->Oid.idLength - 1] - 1]->Successes);
+ break;
+ case MAGT_ID_URL:
+ MibInfo->Storage = ppIntStatInfo[MibInfo->Oid.ids[MibInfo->Oid.idLength - 1] - 1]->URL.val;
+ break;
+
+
+ default:
+ break;
+ }
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * ReadStaticSettingsOverLdap: Reads static information from the directory server
+ *
+ *
+ * Returns: 0 - No error
+ * -1 - Errors
+ *
+ *-----------------------------------------------------------------------*/
+
+int ReadStaticSettingsOverLdap(MagtLDAPInfo_t ldapInfo, MagtStaticInfo_t *staticInfo, int *SNMPoff)
+{
+ LDAP *ld;
+ LDAPMessage *result, *e;
+ BerElement *ber;
+ char *a;
+ char **vals;
+ char *attrs[]={LDAP_ATTR_SNMP_ENABLED,
+ LDAP_ATTR_SNMP_DESCRIPTION,
+ LDAP_ATTR_SNMP_ORGANIZATION,
+ LDAP_ATTR_SNMP_LOCATION,
+ LDAP_ATTR_SNMP_CONTACT,
+ NULL};
+ /* set the applIndex to the ldap port */
+ staticInfo->ApplIndex = ldapInfo.port;
+
+ /* get rest of static settings from the Directory Server */
+ if ( ( ld = ldap_init( ldapInfo.host, ldapInfo.port ) ) == NULL )
+ {
+ return -1;
+ }
+
+ if ( ldap_simple_bind_s( ld, NULL, NULL) != LDAP_SUCCESS )
+ {
+ return -1;
+ }
+
+
+ if ( ldap_search_s( ld, LDAP_CONFIG_DN, LDAP_SCOPE_BASE, BASE_OBJECTCLASS_SEARCH,
+ attrs, 0, &result ) != LDAP_SUCCESS )
+ {
+ return -1;
+
+ }else{
+
+ e = ldap_first_entry( ld, result );
+
+ if(e != NULL)
+ {
+ for ( a = ldap_first_attribute( ld, e, &ber );
+ a != NULL; a = ldap_next_attribute( ld, e, ber ) )
+ {
+ if ((vals = ldap_get_values( ld, e, a)) != NULL )
+ {
+ MagtDispStr_t *pStaticAttr=NULL;
+ /* we only want the first value, ignore any others */
+ if( 0 == strcmp(LDAP_ATTR_SNMP_ENABLED, a) )
+ {
+ if(0 == stricmp(SNMP_ON, vals[0]) )
+ {
+ *SNMPoff = 0;
+ }else{
+ *SNMPoff = 1;
+ }
+ }else if( 0 == strcmp(LDAP_ATTR_SNMP_DESCRIPTION, a) ){
+ pStaticAttr = &(staticInfo->entityDescr);
+ }else if( 0 == strcmp(LDAP_ATTR_SNMP_ORGANIZATION, a) ){
+ pStaticAttr = &(staticInfo->entityOrg);
+ }else if( 0 == strcmp(LDAP_ATTR_SNMP_LOCATION, a) ){
+ pStaticAttr = &(staticInfo->entityLocation);
+ }else if( 0 == strcmp(LDAP_ATTR_SNMP_CONTACT, a) ){
+ pStaticAttr = &(staticInfo->entityContact);
+ }
+ /* stevross: missing the following for NT
+ version
+ DSName
+ */
+
+ /* for Unix also missing
+ MasterHost, MasterPort
+ */
+ if(pStaticAttr != NULL && vals[0] != NULL)
+ {
+ REPLACE(pStaticAttr->val, vals[0]);
+ pStaticAttr->len = strlen(pStaticAttr->val);
+ }
+
+ ldap_value_free( vals );
+
+ }
+
+ ldap_memfree( a );
+
+ }
+
+ if ( ber != NULL )
+ {
+ ldap_ber_free( ber, 0 );
+ }
+ }
+ }
+
+ ldap_msgfree( result );
+ ldap_unbind( ld );
+
+ return 0;
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtLoadStaticInfo: Loads static information from the configuration
+ * file.
+ *
+ * Returns: 0 - No error
+ * -1 - Errors
+ *
+ *-----------------------------------------------------------------------*/
+
+int MagtLoadStaticInfo(MagtStaticInfo_t *staticInfo, char *pszRootDir, int *SNMPOff, char *pszLogPath)
+{
+ char confpath[MAX_PATH];
+ FILE *fp;
+ char linebuf[MAGT_MAX_LINELEN + 1];
+ int lineLen;
+ char logMsg[1024];
+ MagtLDAPInfo_t ldapInfo;
+
+ /*
+ * Set-up default values first.
+ */
+
+ staticInfo->entityDescr.val = NULL;
+ staticInfo->entityVers.val = NULL;
+ staticInfo->entityOrg.val = NULL;
+ staticInfo->entityLocation.val = NULL;
+ staticInfo->entityContact.val = NULL;
+ staticInfo->entityName.val = NULL;
+
+ staticInfo->ApplIndex = 0;
+
+ REPLACE(staticInfo->entityDescr.val, "Netscape Directory Server");
+ staticInfo->entityDescr.len = strlen(staticInfo->entityDescr.val);
+
+ REPLACE(staticInfo->entityVers.val, "7");
+ staticInfo->entityVers.len = strlen(staticInfo->entityVers.val);
+
+ REPLACE(staticInfo->entityOrg.val, "Not Available");
+ staticInfo->entityOrg.len = strlen(staticInfo->entityOrg.val);
+
+ REPLACE(staticInfo->entityLocation.val, "Not Available");
+ staticInfo->entityLocation.len = strlen(staticInfo->entityLocation.val);
+
+ REPLACE(staticInfo->entityContact.val, "Not Available");
+ staticInfo->entityContact.len = strlen(staticInfo->entityContact.val);
+
+ REPLACE(staticInfo->entityName.val, "Not Available");
+ staticInfo->entityName.len = strlen(staticInfo->entityName.val);
+
+ /*
+ * Read any config info from dse.ldif (for now its just port used as
+ * applIndex
+ */
+
+ wsprintf(confpath, "%s/%s/%s", pszRootDir, MAGT_CONFDIR, DSE_LDIF);
+
+ if ((fp = fopen(confpath, "r")) == (FILE *) NULL)
+ {
+ wsprintf(logMsg,
+ "Failed to open dse.ldif (error = %d)\n",
+ errno);
+ MagtLog(logMsg, pszLogPath);
+ return (-1);
+ }
+
+
+ while ((lineLen = MagtReadLine(linebuf, MAGT_MAX_LINELEN, fp)) > 0)
+ {
+ /*
+ * Update the configured entries.
+ */
+ MagtConfProcess(linebuf, lineLen, &ldapInfo);
+ }
+ fclose (fp);
+
+ if( 0 != ReadStaticSettingsOverLdap(ldapInfo, staticInfo, SNMPOff) < 0 )
+ {
+ wsprintf(logMsg,
+ "Failed to read SNMP configuration over ldap\n");
+ MagtLog(logMsg, pszLogPath);
+ return (-1);
+ }
+
+ return (0);
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtLog: Logs the specified message into the log file.
+ * Notes: Log file is opened and closed each time.
+ *
+ * Returns: None
+ *
+ *-----------------------------------------------------------------------*/
+
+void MagtLog(char *logMsg, char *pszLogPath)
+{
+ FILE *f;
+ char *szTime;
+
+ f = fopen(pszLogPath, "a");
+ if (!f)
+ return;
+ szTime = MagtLogTime();
+ if (szTime != NULL)
+ {
+ fprintf(f, "%s %s", szTime, logMsg);
+ SNMP_free(szTime);
+ }
+ else /* No time string returned */
+ {
+ fprintf(f, "%s %s", "00000000000000", logMsg);
+ }
+ fclose(f);
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtLogTime: Returns time for logging purpose.
+ *
+ * Returns: Formatted time string - No error
+ * "00000000000000" - Errors
+ *
+ *-----------------------------------------------------------------------*/
+
+char *MagtLogTime()
+{
+ time_t timeNow;
+ struct tm tmLocal;
+ char dateBuf[64];
+ char *timeStr = NULL;
+ static timeZoneSet = MAGT_FALSE;
+
+ timeNow = time(0);
+ memcpy(&tmLocal, localtime(&timeNow), sizeof(tmLocal));
+
+ /*
+ * Set up the timezone information.
+ */
+ if (!timeZoneSet)
+ {
+ tzset();
+ timeZoneSet = MAGT_TRUE;
+ }
+
+ /*
+ * Create the date string.
+ */
+ if (!strftime(dateBuf, 64, "%Y%m%d%H%M%S", &tmLocal))
+ {
+ strcpy(dateBuf, "00000000000000");
+ }
+ REPLACE(timeStr, dateBuf);
+
+ return timeStr;
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtOpenLog: Creates and opens the log file.
+ * Backs up any old log file.
+ *
+ * Returns: None
+ *
+ *-----------------------------------------------------------------------*/
+
+void MagtOpenLog(char *pszRootDir, char *pszLogPath)
+{
+ char logDir[MAX_PATH];
+ char oldPath[MAX_PATH];
+ int fd;
+
+ wsprintf(logDir, "%s\\%s", pszRootDir, "logs");
+ if (mkdir(logDir) != 0)
+ {
+ if (errno != EEXIST)
+ return;
+ }
+
+ wsprintf(pszLogPath, "%s\\%s", logDir, MAGT_LOGFILE);
+ wsprintf(oldPath, "%s\\%s%s", logDir, MAGT_LOGFILE, ".old");
+
+ /*
+ * Rename old log file to keep a back up.
+ */
+ unlink(oldPath);
+ rename(pszLogPath, oldPath);
+
+ /*
+ * Create and open new log file.
+ */
+ fd = open(pszLogPath,
+ _O_WRONLY | _O_CREAT | _O_TRUNC,
+ _S_IWRITE);
+ if (fd != -1)
+ close(fd);
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtReadLine: Reads one line of text (up to n chars) from specified
+ * file.
+ *
+ * Returns: Len read - No error
+ * -1 - Errors
+ *
+ *-----------------------------------------------------------------------*/
+
+int MagtReadLine(char *buf, int n, FILE *fp)
+{
+ if (fgets(buf, n, fp) != NULL)
+ {
+ return(strlen(buf));
+ }
+ else
+ {
+ return(-1);
+ }
+}
+
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtReadStats: Reads statistics from stats file. The hdr and tbl data
+ * buffers will be filled in if they are not NULL.
+ *
+ * Returns: 0 - No errors
+ * errno - Errors
+ *
+ *-----------------------------------------------------------------------*/
+
+int MagtReadStats(MagtHdrInfo_t *hdrInfo,
+ MagtOpsTblInfo_t *OpsTblInfo,
+ MagtEntriesTblInfo_t *EntriesTblInfo,
+ MagtIntTblInfo_t **IntTblInfo,
+ char * pszStatsPath,
+ char * pszLogPath)
+{
+ int hdl;
+ int err;
+ int i;
+ struct agt_stats_t *pfile_stats;
+
+ if ((err = agt_mopen_stats(pszStatsPath, O_RDONLY, &hdl)) != 0)
+ {
+
+ /*
+ now with multiple instances this function gets called
+ on every snmprequest. Hence
+ logging here became too expensive, now let caller interpret
+ results and figure out if it should log something or not
+ */
+
+
+ return err;
+ }
+
+
+
+ if ( (hdl > 1) || (hdl < 0) )
+ {
+ return (EINVAL); /* Inavlid handle */
+ }
+
+ if ((mmap_tbl [hdl].maptype != AGT_MAP_READ) && (mmap_tbl [hdl].maptype != AGT_MAP_RDWR))
+ {
+ return (EINVAL); /* Inavlid handle */
+ }
+
+ if (mmap_tbl [hdl].fp <= (caddr_t) 0)
+ {
+ return (EFAULT); /* Something got corrupted */
+ }
+
+#if (0)
+ fprintf (stderr, "%s@%d> fp = %d\n", __FILE__, __LINE__, mmap_tbl [hdl].fp);
+#endif
+
+ pfile_stats = (struct agt_stats_t *) (mmap_tbl [hdl].fp);
+
+ /*
+ * Only fill in buffers if they are not NULL. This way, one can choose
+ * to get only the hdr info or only the tbl info.
+ */
+ if (hdrInfo != NULL)
+ {
+ hdrInfo->versMajor = pfile_stats->hdr_stats.hdrVersionMjr;
+ hdrInfo->versMinor = pfile_stats->hdr_stats.hdrVersionMnr;
+ hdrInfo->restarted = pfile_stats->hdr_stats.restarted;
+ hdrInfo->startTime = pfile_stats->hdr_stats.startTime;
+ hdrInfo->updateTime = pfile_stats->hdr_stats.updateTime;
+ }
+ if (OpsTblInfo != NULL){
+ OpsTblInfo->AnonymousBinds = pfile_stats->ops_stats.dsAnonymousBinds;
+ OpsTblInfo->UnAuthBinds = pfile_stats->ops_stats.dsUnAuthBinds;
+ OpsTblInfo->SimpleAuthBinds = pfile_stats->ops_stats.dsSimpleAuthBinds;
+ OpsTblInfo->StrongAuthBinds = pfile_stats->ops_stats.dsStrongAuthBinds;
+ OpsTblInfo->BindSecurityErrors = pfile_stats->ops_stats.dsBindSecurityErrors;
+ OpsTblInfo->InOps = pfile_stats->ops_stats.dsInOps;
+ OpsTblInfo->ReadOps = pfile_stats->ops_stats.dsReadOps;
+ OpsTblInfo->CompareOps = pfile_stats->ops_stats.dsCompareOps;
+ OpsTblInfo->AddEntryOps = pfile_stats->ops_stats.dsAddEntryOps;
+ OpsTblInfo->RemoveEntryOps = pfile_stats->ops_stats.dsRemoveEntryOps;
+ OpsTblInfo->ModifyEntryOps = pfile_stats->ops_stats.dsModifyEntryOps;
+ OpsTblInfo->ModifyRDNOps = pfile_stats->ops_stats.dsModifyRDNOps;
+ OpsTblInfo->ListOps = pfile_stats->ops_stats.dsListOps;
+ OpsTblInfo->SearchOps = pfile_stats->ops_stats.dsSearchOps;
+ OpsTblInfo->OneLevelSearchOps = pfile_stats->ops_stats.dsOneLevelSearchOps;
+ OpsTblInfo->WholeSubtreeSearchOps = pfile_stats->ops_stats.dsWholeSubtreeSearchOps;
+ OpsTblInfo->Referrals = pfile_stats->ops_stats.dsReferrals;
+ OpsTblInfo->Chainings = pfile_stats->ops_stats.dsChainings;
+ OpsTblInfo->SecurityErrors = pfile_stats->ops_stats.dsSecurityErrors;
+ OpsTblInfo->Errors = pfile_stats->ops_stats.dsErrors;
+ }
+ if(EntriesTblInfo != NULL){
+ EntriesTblInfo->MasterEntries = pfile_stats->entries_stats.dsMasterEntries;
+ EntriesTblInfo->CopyEntries = pfile_stats->entries_stats.dsCopyEntries;
+ EntriesTblInfo->CacheEntries = pfile_stats->entries_stats.dsCacheEntries;
+ EntriesTblInfo->CacheHits = pfile_stats->entries_stats.dsCacheHits;
+ EntriesTblInfo->SlaveHits = pfile_stats->entries_stats.dsSlaveHits;
+ }
+
+ if(IntTblInfo != NULL){
+ for(i=0; i < NUM_SNMP_INT_TBL_ROWS; i++)
+ {
+
+ strcpy(IntTblInfo[i]->DsName.val, pfile_stats->int_stats[i].dsName);
+ IntTblInfo[i]->DsName.len = strlen(pfile_stats->int_stats[i].dsName);
+
+ IntTblInfo[i]->TimeOfCreation = pfile_stats->int_stats[i].dsTimeOfCreation;
+ IntTblInfo[i]->TimeOfLastAttempt = pfile_stats->int_stats[i].dsTimeOfLastAttempt;
+ IntTblInfo[i]->TimeOfLastSuccess = pfile_stats->int_stats[i].dsTimeOfLastSuccess;
+ IntTblInfo[i]->FailuresSinceLastSuccess = pfile_stats->int_stats[i].dsFailuresSinceLastSuccess;
+ IntTblInfo[i]->Failures = pfile_stats->int_stats[i].dsFailures;
+ IntTblInfo[i]->Successes = pfile_stats->int_stats[i].dsSuccesses;
+ strcpy(IntTblInfo[i]->URL.val, pfile_stats->int_stats[i].dsURL);
+ IntTblInfo[i]->URL.len = strlen(pfile_stats->int_stats[i].dsURL);
+
+ }
+ }
+
+ agt_mclose_stats(hdl);
+ return 0;
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * DllMain: Standard WIN32 DLL entry point.
+ *
+ * Returns: TRUE
+ *
+ *-----------------------------------------------------------------------*/
+
+BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
+{
+
+ switch(dwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ break;
+ case DLL_PROCESS_DETACH:
+ MagtCleanUp();
+ break;
+ default:
+ break;
+ }
+
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * SnmpExtensionInit: Entry point to coordinate the initializations of the
+ * Extension Agent and the Extendible Agent. The
+ * Extendible Agent provides the Extension Agent with a
+ * time zero reference; and the Extension Agent
+ * provides the Extendible Agent with an Event handle
+ * for communicating occurence of traps, and an object
+ * identifier representing the root of the MIB subtree
+ * that the Extension Agent supports.
+ *
+ * Returns: TRUE - No error
+ * FALSE - Errors
+ *
+ *-----------------------------------------------------------------------*/
+
+BOOL WINAPI SnmpExtensionInit(IN DWORD dwTimeZeroReference,
+ OUT HANDLE *hPollForTrapEvent,
+ OUT AsnObjectIdentifier *supportedView)
+{
+ int nMibIndex = 0;
+ SECURITY_ATTRIBUTES sa;
+ PSECURITY_ATTRIBUTES psa = NULL;
+ SECURITY_DESCRIPTOR sd;
+ char logMsg[1024];
+ int i;
+
+ instance_list_t *pInstance;
+
+ /*
+ * Record the time reference provided by the Extendible Agent.
+ */
+
+ dwTimeZero = dwTimeZeroReference;
+
+ /*
+ * Create a security descriptor that gives everyone access to the
+ * trap event. This is so that the SNMP process can set the event
+ * when it detects that the server is up or down. Without this
+ * relaxed ACL, the SNMP process which usually runs as the Netscape
+ * DS user can not set the trap event created by this DLL which is
+ * loaded by the Extendible Agent, which usually runs as LocalSystem.
+ */
+ if (InitializeSecurityDescriptor(&sd,
+ SECURITY_DESCRIPTOR_REVISION) == TRUE)
+ {
+ if (SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE) == TRUE)
+ {
+ sa.nLength = sizeof(SECURITY_ATTRIBUTES);
+ sa.bInheritHandle = TRUE;
+ sa.lpSecurityDescriptor = &sd;
+ psa = &sa;
+ }
+ }
+
+ /*
+ * Create an event that will be used to communicate the occurence of
+ * traps to the Extendible Agent.
+ * The event will have a signaled initial state so that the status of
+ * the server can be checked as soon as the subagent is loaded and
+ * the necessary trap will be generated.
+ */
+ if ((*hPollForTrapEvent = CreateEvent(psa,
+ FALSE,
+ FALSE,
+ MAGT_NSEV_SNMPTRAP)) == NULL)
+ {
+ return FALSE;
+ }
+
+ /*
+ * Indicate the MIB view supported by this Extension Agent, an object
+ * identifier representing the sub root of the MIB that is supported.
+ */
+ *supportedView = MIB_OidPrefix;
+
+
+ /*
+ * Initialize globals.
+ */
+
+ if ( !_FindNetscapeServers() )
+ {
+ return FALSE;
+ }
+
+ for (pInstance = pInstanceList; pInstance; pInstance = pInstance->pNext)
+ {
+ MagtInitInstance(pInstance);
+ }
+
+ for (pInstance = pInstanceList; pInstance; pInstance = pInstance->pNext)
+ {
+ /* build the mib */
+
+ if ((pInstance->pOpsStatInfo = (MagtOpsTblInfo_t *) GlobalAlloc(GPTR,
+ sizeof(MagtOpsTblInfo_t))) == NULL)
+ {
+ wsprintf(logMsg, "Failed to allocate ops stats structure (error = %d)\n",
+ GetLastError());
+ MagtLog(logMsg, pInstance->szLogPath);
+ return FALSE;
+ }
+
+ if ((pInstance->pEntriesStatInfo = (MagtEntriesTblInfo_t *) GlobalAlloc(GPTR,
+ sizeof(MagtEntriesTblInfo_t))) == NULL)
+ {
+ wsprintf(logMsg, "Failed to allocate entries stat structure (error = %d)\n",
+ GetLastError());
+ MagtLog(logMsg, pInstance->szLogPath);
+ return FALSE;
+ }
+
+ if ((pInstance->ppIntStatInfo = (MagtIntTblInfo_t **) GlobalAlloc(GPTR,
+ NUM_SNMP_INT_TBL_ROWS * sizeof(MagtIntTblInfo_t *))) == NULL)
+ {
+ wsprintf(logMsg, "Failed to allocate interaction stat structure (error = %d)\n",
+ GetLastError());
+ MagtLog(logMsg, pInstance->szLogPath);
+ return FALSE;
+ }
+
+ for(i =0; i < NUM_SNMP_INT_TBL_ROWS; i++)
+ {
+ pInstance->ppIntStatInfo[i] = (MagtIntTblInfo_t *) GlobalAlloc(GPTR,
+ sizeof(MagtIntTblInfo_t));
+
+ /* make the static char for name and url so they have one address for later use */
+ pInstance->ppIntStatInfo[i]->DsName.val = (char *) GlobalAlloc(GPTR,
+ 100 * sizeof(char));
+ pInstance->ppIntStatInfo[i]->URL.val = (char *) GlobalAlloc(GPTR,
+ 100 * sizeof(char));
+ }
+
+ /* initialize the stats we just allocated */
+ MagtInitStats(pInstance->pOpsStatInfo,
+ pInstance->pEntriesStatInfo,
+ pInstance->ppIntStatInfo);
+
+
+ if( Mib_init(&(pInstance->pMibInfo), pInstance->pCfgInfo->ApplIndex) == -1)
+ {
+ wsprintf(logMsg, "Failed to create Mib structure (error = %d)\n",
+ GetLastError());
+ MagtLog(logMsg, pInstance->szLogPath);
+ return FALSE;
+ }
+
+ for (nMibIndex = 0; nMibIndex < (int) MIB_num_vars; nMibIndex++)
+ {
+ MagtInitMibStorage(&(pInstance->pMibInfo[nMibIndex]),
+ pInstance->pOpsStatInfo,
+ pInstance->pEntriesStatInfo,
+ pInstance->ppIntStatInfo,
+ pInstance->pCfgInfo);
+ }
+
+
+ /*
+ * Construct the path to stats file.
+ */
+ wsprintfA(pInstance->szStatsPath, "%s/logs/%s", pInstance->szRootDir,
+ AGT_STATS_FILE);
+
+ if (MagtReadStats(NULL, pInstance->pOpsStatInfo,
+ pInstance->pEntriesStatInfo,
+ pInstance->ppIntStatInfo,
+ pInstance->szStatsPath,
+ pInstance->szLogPath) != 0)
+ {
+ wsprintf(logMsg,
+ "Failed to open Memory Mapped Stats File. Make sure ns-slapd is running\n",
+ GetLastError());
+ MagtLog(logMsg, pInstance->szLogPath);
+ }
+
+
+ }
+
+ /* now that all mib's set up set next pointer from last entry to first
+ entry of next instance */
+
+ for (nMibIndex = 0; nMibIndex < (int) MIB_num_vars; nMibIndex++)
+ {
+
+ for (pInstance = pInstanceList; pInstance; pInstance = pInstance->pNext)
+ {
+ if(pInstance->pNext != NULL)
+ {
+ pInstance->pMibInfo[nMibIndex].MibNext = &(pInstance->pNext->pMibInfo[nMibIndex]);
+ }else{
+ if (nMibIndex + 1 != (int) MIB_num_vars)
+ {
+ pInstance->pMibInfo[nMibIndex].MibNext = &(pInstanceList->pMibInfo[nMibIndex + 1]);
+ }
+ }
+ }
+
+
+ }
+
+ /*
+ * Set event to have SnmpExtensionTrap invoked for initial check of
+ * Server status.
+ */
+ if (SetEvent(*hPollForTrapEvent) == FALSE)
+ {
+ /* don't have a specific instance to log it to, find something better to do later */
+ }
+
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * SnmpExtensionTrap: Entry point to communicate traps to the Extendible
+ * Agent. The Extendible Agent will query this entry
+ * point when the trap event (supplied at initialization
+ * time) is asserted, which indicates that zero or more
+ * traps may have occured. The Extendible Agent will
+ * repeatedly call this entry point until FALSE is
+ * returned, indicating that all outstanding traps have
+ * been processed.
+ *
+ * Returns: TRUE - Valid trap data
+ * FALSE - No trap data
+ *
+ *-----------------------------------------------------------------------*/
+
+BOOL WINAPI SnmpExtensionTrap(OUT AsnObjectIdentifier *enterprise,
+ OUT AsnInteger *genericTrap,
+ OUT AsnInteger *specificTrap,
+ OUT AsnTimeticks *timeStamp,
+ OUT RFC1157VarBindList *variableBindings)
+{
+ static UINT oidList[] = {1, 3, 6, 1, 4, 1, 1450};
+ static UINT oidListLen = MAGT_OID_SIZEOF(oidList);
+ static RFC1157VarBind *trapVars = NULL;
+ static MagtTrapTask_t trapTask = MAGT_TRAP_GENERATION;
+ int nVarLen;
+ char logMsg[1024];
+ instance_list_t *pInstance;
+
+
+ if (trapTask == MAGT_TRAP_CLEANUP)
+ {
+ if (variableBindings->list != NULL)
+ SNMP_FreeVarBind(variableBindings->list);
+
+ trapTask = MAGT_TRAP_GENERATION;
+ }
+
+
+ if (trapTask == MAGT_TRAP_GENERATION)
+ {
+
+ for (pInstance = pInstanceList; pInstance; pInstance = pInstance->pNext)
+ {
+ MagtCheckServer(pInstance);
+
+ /*
+ * If there is no trap to be generated for this instance keep looking at other
+ * instances.
+ */
+ if (pInstance->trapType == MAGT_TRAP_NONE)
+ {
+ continue;
+ }
+
+ enterprise->ids = (UINT *) SNMP_malloc(sizeof(UINT) * oidListLen);
+ if (enterprise->ids == NULL)
+ {
+ wsprintf(logMsg,
+ "Failed to allocate enterprise id\n");
+ MagtLog(logMsg, pInstance->szLogPath);
+ return FALSE;
+ }
+ enterprise->idLength = oidListLen;
+ memcpy(enterprise->ids, oidList, sizeof(UINT) * oidListLen);
+
+ *genericTrap = SNMP_GENERICTRAP_ENTERSPECIFIC;
+ *specificTrap = pInstance->trapType;
+ *timeStamp = GetCurrentTime() - dwTimeZero;
+
+ /*
+ * Set up the variable binding list with variables specified in the MIB
+ * for each trap.
+ */
+ if ((trapVars = SNMP_malloc(sizeof(RFC1157VarBind) * 4)) == NULL)
+ {
+ wsprintf(logMsg,
+ "Failed to allocate trap variables\n");
+ MagtLog(logMsg, pInstance->szLogPath);
+ SNMP_oidfree(enterprise);
+ return FALSE;
+ }
+
+ if ((nVarLen = MagtFillTrapVars(pInstance->trapType, trapVars, pInstance->pCfgInfo)) == 0)
+ {
+ wsprintf(logMsg,
+ "Failed to fill trap variables\n");
+ MagtLog(logMsg, pInstance->szLogPath);
+ SNMP_free(trapVars);
+ SNMP_oidfree(enterprise);
+ return FALSE;
+ }
+
+ variableBindings->list = trapVars;
+ variableBindings->len = nVarLen;
+
+ trapTask = MAGT_TRAP_CLEANUP;
+
+ wsprintf(logMsg,
+ "Sending trap %d\n",
+ pInstance->trapType);
+ MagtLog(logMsg, pInstance->szLogPath);
+
+ /* reset the trap type for this instance */
+ pInstance->trapType = MAGT_TRAP_NONE;
+
+ /*
+ * Indicate that a trap should be sent and parameters contain valid
+ * data.
+ */
+ return TRUE;
+ }
+
+
+ }
+
+ /*
+ * Indicate that no more traps are available and parameters do not
+ * refer to any valid data.
+ */
+
+ return FALSE;
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * SnmpExtensionQuery: Entry point to resolve queries for MIB variables in
+ * their supported MIB view (supplied at
+ * initialization time). The supported requestType is
+ * Get/GetNext.
+ *
+ * Returns: TRUE - No error
+ * FALSE - Errors
+ *
+ *-----------------------------------------------------------------------*/
+
+BOOL WINAPI SnmpExtensionQuery(IN BYTE requestType,
+ IN OUT RFC1157VarBindList *variableBindings,
+ OUT AsnInteger *errorStatus,
+ OUT AsnInteger *errorIndex)
+{
+ static time_t lastChkTime = 0;
+ UINT i;
+ HANDLE hTrapEvent;
+ time_t currTime;
+
+ /*
+ * Check for valid input.
+ */
+
+ if (variableBindings == NULL ||
+ errorStatus == NULL ||
+ errorIndex == NULL)
+ {
+ return FALSE;
+ }
+
+ /*
+ * Iterate through the variable bindings list to resolve individual
+ * variable bindings.
+ */
+
+ for (i = 0; i < variableBindings->len; i++)
+ {
+ *errorStatus = MagtResolveVarBind(&variableBindings->list[i],
+ requestType);
+
+ /*
+ * Test and handle case where GetNext past end of MIB view supported by
+ * this Extension Agent occurs. Special processing is required to
+ * communicate this situation to the Extendible Agent so it can take
+ * appropriate action.
+ */
+ if (*errorStatus == SNMP_ERRORSTATUS_NOSUCHNAME &&
+ requestType == MAGT_MIB_ACTION_GETNEXT)
+ {
+ *errorStatus = SNMP_ERRORSTATUS_NOERROR;
+
+ /*
+ * Modify variable binding of such variables so the OID points just
+ * outside the MIB view supported by this Extension Agent. The
+ * Extendible Agent tests for this, and takes appropriate action.
+ */
+ SNMP_oidfree(&variableBindings->list[i].name);
+ SNMP_oidcpy(&variableBindings->list[i].name, &MIB_OidPrefix);
+ variableBindings->list[i].name.ids[MAGT_MIB_PREFIX_LEN - 1]++;
+ }
+
+ /*
+ * If an error was indicated, communicate error status and error index
+ * to the Extendible Agent. The Extendible Agent will ensure that the
+ * original variable bindings are returned in the response packet.
+ */
+ if (*errorStatus != SNMP_ERRORSTATUS_NOERROR)
+ {
+ *errorIndex = i + 1;
+ return FALSE;
+ }
+ }
+
+ /*
+ * Before going back, set the trap event so server status can be checked
+ * to see if a trap needs to be generated. This is to cover the case the
+ * SNMP process is unable to set the trap event because it is stuck.
+ */
+ currTime = time(0);
+
+ /*
+ * If just check status, do not generate event again.
+ */
+ if ((currTime - lastChkTime) >= MAGT_TIME_QUANTUM * 3)
+ {
+ if ((hTrapEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE,
+ (LPCTSTR)MAGT_NSEV_SNMPTRAP)) != NULL)
+ SetEvent(hTrapEvent);
+
+ lastChkTime = currTime;
+ }
+
+ return TRUE;
+}
+
+
+/* --- Open Function --------------------------------------------------------------------- */
+
+
+/* _FindNetscapeServers()
+ * Function to loop through registry looking for netscape servers
+ * Stores them into pInstanceList as it finds them.
+ */
+
+#define MAX_KEY_SIZE 128
+DWORD
+_FindNetscapeServers()
+{
+ LONG regStatus,
+ status;
+ HKEY hKeyNetscape = NULL,
+ hKeyNetscapeConf;
+ DWORD dwKey,
+ type,
+ dwServerKeySize,
+ size,
+ dwServerCount = 0;
+ WCHAR szServerKeyName[MAX_KEY_SIZE],
+ szPath[MAX_KEY_SIZE];
+ FILETIME fileTime;
+ instance_list_t *pNew;
+ instance_list_t *pCurrent;
+ DWORD iUniqueID = 0;
+ char logMsg[1024];
+ regStatus = RegOpenKeyEx(
+ HKEY_LOCAL_MACHINE,
+ TEXT(KEY_SOFTWARE_NETSCAPE) TEXT("\\") TEXT(DS_KEY_ROOT),
+ 0L,
+ KEY_ALL_ACCESS,
+ &hKeyNetscape);
+
+ if (regStatus != ERROR_SUCCESS) {
+ goto ExitPoint;
+ }
+
+ dwKey = 0;
+ do {
+ dwServerKeySize = MAX_KEY_SIZE;
+ regStatus = RegEnumKeyEx(
+ hKeyNetscape,
+ dwKey,
+ (char *) szServerKeyName,
+ &dwServerKeySize,
+ NULL,
+ 0,
+ 0,
+ &fileTime);
+ dwKey++;
+
+ if (regStatus == ERROR_SUCCESS) {
+
+ regStatus = RegOpenKeyEx(
+ hKeyNetscape,
+ (char *) szServerKeyName,
+ 0L,
+ KEY_ALL_ACCESS,
+ &hKeyNetscapeConf);
+
+ if (regStatus != ERROR_SUCCESS) {
+ continue;
+ }
+
+ /* Now look for "ConfigurationPath" to find 3.0 netscape servers */
+ size = MAX_KEY_SIZE;
+ status = RegQueryValueEx(
+ hKeyNetscapeConf,
+ TEXT(VALUE_CONFIG_PATH),
+ 0L,
+ &type,
+ (LPBYTE)szPath,
+ &size);
+ if ( status == ERROR_SUCCESS ) {
+ /* this is a netscape server */
+ if ( (pNew = (instance_list_t *)malloc(sizeof(instance_list_t))) == NULL) {
+ status = (unsigned long)-1;
+ RegCloseKey(hKeyNetscapeConf);
+ goto ExitPoint;
+ }
+ if ( (pNew->pInstanceName = (PWCH)malloc(sizeof(WCHAR) *(dwServerKeySize+1))) == NULL) {
+ status = (unsigned long)-1;
+ RegCloseKey(hKeyNetscapeConf);
+ goto ExitPoint;
+ }
+ if ( (pNew->pConfPath = (PWCH)malloc(sizeof(WCHAR) *(size+1))) == NULL) {
+ status = (unsigned long)-1;
+ RegCloseKey(hKeyNetscapeConf);
+ goto ExitPoint;
+ }
+
+
+ pNew->Handle = 0;
+ pNew->pData = NULL;
+
+ pNew->instance.ParentObjectTitleIndex = 0;
+ pNew->instance.ParentObjectInstance = 0;
+ pNew->instance.UniqueID = -1;
+ pNew->instance.NameOffset = sizeof(PERF_INSTANCE_DEFINITION);
+ lstrcpy((char *) pNew->pInstanceName, (char *) szServerKeyName);
+
+ lstrcpy((char *) pNew->pConfPath, (char *) szPath);
+
+ pNew->instance.NameLength = (dwServerKeySize+1) * sizeof(WCHAR);
+ pNew->instance.ByteLength = sizeof(PERF_INSTANCE_DEFINITION) +
+ (((pNew->instance.NameLength + sizeof(DWORD)-1)/sizeof(DWORD))*sizeof(DWORD));
+ pNew->instance.UniqueID = iUniqueID++;
+
+ wsprintf(pNew->szLogPath, "\\%s", MAGT_LOGFILE);
+ if( ((char *) pNew->szRootDir = getRootDirFromConfFile(pNew->pConfPath) ) != NULL)
+ {
+ /* can only check if getRootDir */
+
+ /* open the log */
+
+ MagtOpenLog(pNew->szRootDir, pNew->szLogPath);
+
+ if ((pNew->pCfgInfo = (MagtStaticInfo_t *) GlobalAlloc(GPTR,
+ sizeof(MagtStaticInfo_t))) == NULL)
+ {
+ /* something fatal happened but try to free this
+ node that won't be used anyway
+ */
+ if(pNew != NULL)
+ {
+ free(pNew);
+ }
+ status = (unsigned long)-1;
+ goto ExitPoint;
+ }
+
+ MagtLoadStaticInfo(pNew->pCfgInfo, pNew->szRootDir, &pNew->SNMPOff, pNew->szLogPath);
+
+
+ if ( pNew->SNMPOff )
+ {
+ wsprintf(logMsg,
+ "SNMP subagent is not configured to be on\n");
+ MagtLog(logMsg, pNew->szLogPath);
+
+ /* since not adding this to list free it */
+ if(pNew != NULL)
+ {
+ free(pNew);
+ }
+ }else{
+ /* new instance that is on to add to list */
+
+ /* if first element null or less than first element add to beginning */
+ if( (pInstanceList == NULL)
+ || (pNew->pCfgInfo->ApplIndex < pInstanceList->pCfgInfo->ApplIndex) )
+ {
+ pNew->pNext = pInstanceList;
+ pInstanceList = pNew;
+ }else{
+ /* must be after first element */
+ for(pCurrent= pInstanceList; pCurrent; pCurrent=pCurrent->pNext)
+ {
+ if(pNew->pCfgInfo->ApplIndex == pCurrent->pCfgInfo->ApplIndex)
+ {
+ /* ApplIndex must be unique, another instance on this host
+ is already configured to be on using this applIndex,
+ so I can't monitor this one. Log the error and
+ don't add this instance to the list */
+
+ wsprintf(logMsg,
+ "Another server instance with this ApplIndex: %d is already being"
+ " monitored. ApplIndex must be unique. Turn off"
+ " SNMP monitoring of the other server instance or change"
+ " the ApplIndex of one of the server instances.\n",
+ pNew->pCfgInfo->ApplIndex);
+ MagtLog(logMsg, pNew->szLogPath);
+
+ /* since not adding this to list free it */
+ if(pNew != NULL)
+ {
+ free(pNew);
+ }
+ }else if( (pCurrent->pNext == NULL)
+ || ( (pNew->pCfgInfo->ApplIndex > pCurrent->pCfgInfo->ApplIndex)
+ && (pNew->pCfgInfo->ApplIndex < pCurrent->pNext->pCfgInfo->ApplIndex)) )
+ {
+ /* if next is null or if greater this element and less then next one
+ add it inbetween */
+ pNew->pNext=pCurrent->pNext;
+ pCurrent->pNext=pNew;
+ break;
+ }
+ }
+ }
+ }
+ }
+ dwServerCount++;
+ }
+
+ RegCloseKey(hKeyNetscapeConf);
+ }
+
+ } while ( regStatus != ERROR_NO_MORE_ITEMS );
+
+ExitPoint:
+ if (hKeyNetscape)
+ RegCloseKey (hKeyNetscape);
+
+ return dwServerCount;
+}
+
diff --git a/ldap/servers/snmp/ntagt/nsldapagt_nt.def b/ldap/servers/snmp/ntagt/nsldapagt_nt.def
new file mode 100644
index 00000000..9968af40
--- /dev/null
+++ b/ldap/servers/snmp/ntagt/nsldapagt_nt.def
@@ -0,0 +1,24 @@
+; BEGIN COPYRIGHT BLOCK
+; Copyright 2001 Sun Microsystems, Inc.
+; Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+; All rights reserved.
+; END COPYRIGHT BLOCK
+;
+LIBRARY ns-ldapagt
+
+DESCRIPTION 'Netscape Directory Server SNMP Agent'
+
+CODE LOADONCALL MOVEABLE DISCARDABLE
+DATA PRELOAD MOVEABLE SINGLE
+
+SEGMENTS
+ _TEXT PRELOAD
+ INIT_TEXT PRELOAD
+
+HEAPSIZE 1024
+
+EXPORTS
+ SnmpExtensionInit
+ SnmpExtensionTrap
+ SnmpExtensionQuery
+
diff --git a/ldap/servers/snmp/ntagt/nsldapagt_nt.h b/ldap/servers/snmp/ntagt/nsldapagt_nt.h
new file mode 100644
index 00000000..16e472db
--- /dev/null
+++ b/ldap/servers/snmp/ntagt/nsldapagt_nt.h
@@ -0,0 +1,228 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+/*-------------------------------------------------------------------------
+ *
+ * nsldapagt_nt.h - Definitions for NS Directory Server's SNMP subagent on
+ * NT.
+ *
+ * Revision History:
+ * 07/25/1997 Steve Ross Created
+ *
+ *
+ *-----------------------------------------------------------------------*/
+
+#ifndef __NSLDAPAGT_NT_H_
+#define __NSLDAPAGT_NT_H_
+
+/*-------------------------------------------------------------------------
+ *
+ * Defines
+ *
+ *-----------------------------------------------------------------------*/
+
+#define MAGT_MAX_LINELEN 255
+#define MAGT_CONFFILE "snmp.conf"
+#define MAGT_CONFDIR "config"
+#define DSE_LDIF "dse.ldif"
+#define MAGT_LOGFILE "nsldapagt.log"
+#define MAGT_TIME_QUANTUM 10
+
+#define MAGT_TRAP_NONE 0
+#define MAGT_TRAP_SERVER_DOWN 7001
+#define MAGT_TRAP_SERVER_START 7002
+
+#define LDAP_CONFIG_DN "cn=SNMP,cn=config"
+#define BASE_OBJECTCLASS_SEARCH "objectclass=*"
+
+#define LDAP_ATTR_SNMP_ENABLED "nssnmpenabled"
+#define LDAP_ATTR_SNMP_DESCRIPTION "nssnmpdescription"
+#define LDAP_ATTR_SNMP_ORGANIZATION "nssnmporganization"
+#define LDAP_ATTR_SNMP_LOCATION "nssnmplocation"
+#define LDAP_ATTR_SNMP_CONTACT "nssnmpcontact"
+
+#define SNMP_ON "ON"
+
+/*-------------------------------------------------------------------------
+ *
+ * Types
+ *
+ *-----------------------------------------------------------------------*/
+
+typedef enum
+{
+ MAGT_FALSE = 0,
+ MAGT_TRUE
+} MagtBool_t;
+
+typedef enum
+{
+ MAGT_TRAP_GENERATION,
+ MAGT_TRAP_CLEANUP
+} MagtTrapTask_t;
+
+typedef struct MagtDispStr
+{
+ int len;
+ unsigned char *val;
+} MagtDispStr_t;
+
+typedef struct MagtStaticInfo
+{
+ MagtDispStr_t entityDescr;
+ MagtDispStr_t entityVers;
+ MagtDispStr_t entityOrg;
+ MagtDispStr_t entityLocation;
+ MagtDispStr_t entityContact;
+ MagtDispStr_t entityName;
+ int ApplIndex;
+
+} MagtStaticInfo_t;
+
+typedef struct MagtLDAPInfo
+{
+ char *host;
+ int port;
+ char *rootdn;
+ char *rootpw;
+
+
+} MagtLDAPInfo_t;
+
+typedef struct MagtHdrInfo
+{
+ int versMajor;
+ int versMinor;
+ int restarted;
+ time_t startTime;
+ time_t updateTime;
+} MagtHdrInfo_t;
+
+typedef struct MagtOpsTblInfo
+{
+ int AnonymousBinds;
+ int UnAuthBinds;
+ int SimpleAuthBinds;
+ int StrongAuthBinds;
+ int BindSecurityErrors;
+ int InOps;
+ int ReadOps;
+ int CompareOps;
+ int AddEntryOps;
+ int RemoveEntryOps;
+ int ModifyEntryOps;
+ int ModifyRDNOps;
+ int ListOps;
+ int SearchOps;
+ int OneLevelSearchOps;
+ int WholeSubtreeSearchOps;
+ int Referrals;
+ int Chainings;
+ int SecurityErrors;
+ int Errors;
+} MagtOpsTblInfo_t;
+
+typedef struct MagtEntriesTblInfo
+{
+ int MasterEntries;
+ int CopyEntries;
+ int CacheEntries;
+ int CacheHits;
+ int SlaveHits;
+} MagtEntriesTblInfo_t;
+
+typedef struct MagtIntTblInfo
+{
+ MagtDispStr_t DsName;
+ time_t TimeOfCreation;
+ time_t TimeOfLastAttempt;
+ time_t TimeOfLastSuccess;
+ int FailuresSinceLastSuccess;
+ int Failures;
+ int Successes;
+ MagtDispStr_t URL;
+}MagtIntTblInfo_t;
+
+typedef struct instance_list_t {
+ PERF_INSTANCE_DEFINITION instance;
+ PWSTR pInstanceName;
+ PWSTR pConfPath;
+ int Handle;
+ struct agt_stats_t * pData;
+ HANDLE ghTrapEvent;
+ MagtOpsTblInfo_t * pOpsStatInfo;
+ MagtEntriesTblInfo_t * pEntriesStatInfo;
+ MagtIntTblInfo_t ** ppIntStatInfo;
+ MagtStaticInfo_t * pCfgInfo;
+ MagtMibEntry_t * pMibInfo;
+ char * szRootDir;
+ char szLogPath[MAX_PATH];
+ char szStatsPath[MAX_PATH];
+ int SNMPOff;
+
+
+ /* trap stuff */
+ time_t oldUpdateTime;
+ time_t oldStartTime;
+ int graceCycles;
+ MagtBool_t mmapStale;
+ MagtBool_t mmapOk;
+ MagtBool_t serverUp;
+ MagtBool_t downTrapSent;
+ int trapType;
+ MagtHdrInfo_t hdrInfo;
+
+ struct instance_list_t * pNext;
+} instance_list_t;
+
+/*-------------------------------------------------------------------------
+ *
+ * Prototypes
+ *
+ *-----------------------------------------------------------------------*/
+
+int MagtCheckServer(instance_list_t *pInstance);
+
+void MagtCleanUp();
+
+void MagtConfProcess(char *line, int lineLen,
+ MagtLDAPInfo_t *info);
+
+char *MagtGetRootDir(void);
+
+
+void MagtInitMibStorage(MagtMibEntry_t * MibInfo,
+ MagtOpsTblInfo_t * pOpsStatInfo,
+ MagtEntriesTblInfo_t * pEntriesStatInfo,
+ MagtIntTblInfo_t ** ppIntStatInfo,
+ MagtStaticInfo_t * pCfgInfo);
+
+
+int MagtLoadStaticInfo(MagtStaticInfo_t *staticInfo, char *pszRootDir, int *SNMPOff, char *pszLogPath);
+
+void MagtLog(char *logMsg, char *pszLogPath);
+
+char *MagtLogTime();
+
+void MagtOpenLog(char *pszRootDir, char *pszLogPath);
+
+int MagtReadLine(char *buf,
+ int n,
+ FILE *fp);
+
+int MagtReadStats(MagtHdrInfo_t *hdrInfo,
+ MagtOpsTblInfo_t *OpsTblInfo,
+ MagtEntriesTblInfo_t *EntriesTblInfo,
+ MagtIntTblInfo_t **IntTblInfo,
+ char * pszStatsPath,
+ char * pszLogPath);
+
+DWORD _FindNetscapeServers();
+
+extern instance_list_t *pInstanceList;
+
+
+#endif /* __NSLDAPAGT_NT_H_ */
diff --git a/ldap/servers/snmp/ntagt/nsldapmib_nt.c b/ldap/servers/snmp/ntagt/nsldapmib_nt.c
new file mode 100644
index 00000000..af977a23
--- /dev/null
+++ b/ldap/servers/snmp/ntagt/nsldapmib_nt.c
@@ -0,0 +1,1041 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+/*-------------------------------------------------------------------------
+ *
+ * nsldapmib_nt.c - NS Directory Server's MIB for extended SNMP agent
+ * on NT.
+ *
+ * Revision History:
+ * 07/25/1997 Steve Ross Created
+ *
+ *
+ *-----------------------------------------------------------------------*/
+
+#include <stdio.h>
+#include <malloc.h>
+#include <time.h>
+#include <windows.h>
+#include <malloc.h>
+#include <snmp.h>
+#include <mgmtapi.h>
+#include "nsldapmib_nt.h"
+#include "nsldapagt_nt.h"
+#include "agtmmap.h"
+
+/*-------------------------------------------------------------------------
+ *
+ * Globals
+ *
+ *-----------------------------------------------------------------------*/
+
+/*
+ * For ldap, the prefix to all MIB variables is 1.3.6.1.4.1.1450.7
+ */
+UINT OID_Prefix[] = {1, 3, 6, 1, 4, 1, 1450, 7};
+AsnObjectIdentifier MIB_OidPrefix = {MAGT_OID_SIZEOF(OID_Prefix),
+ OID_Prefix};
+
+/*
+ * OID of each MIB variable.
+ * For example, the OID for mtaReceivedMessages is:
+ * 1.3.6.1.4.1.1450.7
+ *
+ * - nsldap = netscape 7
+ * -dsOpsTable = nsldap 1
+ * -dsEntriesTable = nsldap 2
+ * -dsIntTable = nsldap 3
+ * -dsEntityINfo = nsldap 5
+ *
+ */
+
+
+UINT OID_ApplIndex[] = {389};
+/* setup the parts of the OID we know in advance */
+
+/* ops table */
+UINT OID_AnonymousBinds[] = {1, 1, 1};
+UINT OID_UnAuthBinds[] = {1, 1, 2};
+UINT OID_SimpleAuthBinds[] = {1, 1, 3};
+UINT OID_StrongAuthBinds[] = {1, 1, 4};
+UINT OID_BindSecurityErrors[] = {1, 1, 5};
+UINT OID_InOps[] = {1, 1, 6};
+UINT OID_ReadOps[] = {1, 1, 7};
+UINT OID_CompareOps[] = {1, 1, 8};
+UINT OID_AddEntryOps[] = {1, 1, 9};
+UINT OID_RemoveEntryOps[] = {1, 1, 10};
+UINT OID_ModifyEntryOps[] = {1, 1, 11};
+UINT OID_ModifyRDNOps[] = {1, 1, 12};
+UINT OID_ListOps[] = {1, 1, 13};
+UINT OID_SearchOps[] = {1, 1, 14};
+UINT OID_OneLevelSearchOps[] = {1, 1, 15};
+UINT OID_WholeSubtreeSearchOps[] = {1, 1, 16};
+UINT OID_Referrals[] = {1, 1, 17};
+UINT OID_Chainings[] = {1, 1, 18};
+UINT OID_SecurityErrors[] = {1, 1, 19};
+UINT OID_Errors[] = {1, 1, 20};
+
+/* entries table */
+UINT OID_MasterEntries[] = {2, 1, 1};
+UINT OID_CopyEntries[] = {2, 1, 2};
+UINT OID_CacheEntries[] = {2, 1, 3};
+UINT OID_CacheHits[] = {2, 1, 4};
+UINT OID_SlaveHits[] = {2, 1, 5};
+
+/* interaction table */
+UINT OID_DsIntIndex[] = {3, 1, 1};
+UINT OID_DsName[] = {3, 1, 2};
+UINT OID_TimeOfCreation[] = {3, 1, 3};
+UINT OID_TimeOfLastAttempt[] = {3, 1, 4};
+UINT OID_TimeOfLastSuccess[] = {3, 1, 5};
+UINT OID_FailuresSinceLastSuccess[] = {3, 1, 6};
+UINT OID_Failures[] = {3, 1, 7};
+UINT OID_Successes[] = {3, 1, 8};
+UINT OID_URL[] = {3, 1, 9};
+
+/* entity table */
+UINT OID_EntityDescr[] = {5, 1, 1};
+UINT OID_EntityVers[] = {5, 1, 2};
+UINT OID_EntityOrg[] = {5, 1, 3};
+UINT OID_EntityLocation[] = {5, 1, 4};
+UINT OID_EntityContact[] = {5, 1, 5};
+UINT OID_EntityName[] = {5, 1, 6};
+
+
+/* make AsnObjectIdentifiers so can use snmputilOidcpy for each server instance, and append to put on indexes later */
+/* ops table */
+AsnObjectIdentifier ASN_AnonymousBinds = {MAGT_OID_SIZEOF(OID_AnonymousBinds) ,OID_AnonymousBinds};
+AsnObjectIdentifier ASN_UnAuthBinds = {MAGT_OID_SIZEOF(OID_UnAuthBinds) ,OID_UnAuthBinds};
+AsnObjectIdentifier ASN_SimpleAuthBinds = {MAGT_OID_SIZEOF(OID_SimpleAuthBinds) ,OID_SimpleAuthBinds};
+AsnObjectIdentifier ASN_StrongAuthBinds = {MAGT_OID_SIZEOF(OID_StrongAuthBinds) ,OID_StrongAuthBinds};
+AsnObjectIdentifier ASN_BindSecurityErrors = {MAGT_OID_SIZEOF(OID_BindSecurityErrors) ,OID_BindSecurityErrors};
+AsnObjectIdentifier ASN_InOps = {MAGT_OID_SIZEOF(OID_InOps) ,OID_InOps};
+AsnObjectIdentifier ASN_ReadOps = {MAGT_OID_SIZEOF(OID_ReadOps) ,OID_ReadOps};
+AsnObjectIdentifier ASN_CompareOps = {MAGT_OID_SIZEOF(OID_CompareOps) ,OID_CompareOps};
+AsnObjectIdentifier ASN_AddEntryOps = {MAGT_OID_SIZEOF(OID_AddEntryOps) ,OID_AddEntryOps};
+AsnObjectIdentifier ASN_RemoveEntryOps = {MAGT_OID_SIZEOF(OID_RemoveEntryOps) ,OID_RemoveEntryOps};
+AsnObjectIdentifier ASN_ModifyEntryOps = {MAGT_OID_SIZEOF(OID_ModifyEntryOps) ,OID_ModifyEntryOps};
+AsnObjectIdentifier ASN_ModifyRDNOps = {MAGT_OID_SIZEOF(OID_ModifyRDNOps) ,OID_ModifyRDNOps};
+AsnObjectIdentifier ASN_ListOps = {MAGT_OID_SIZEOF(OID_ListOps) ,OID_ListOps};
+AsnObjectIdentifier ASN_SearchOps = {MAGT_OID_SIZEOF(OID_SearchOps) ,OID_SearchOps};
+AsnObjectIdentifier ASN_OneLevelSearchOps = {MAGT_OID_SIZEOF(OID_OneLevelSearchOps) ,OID_OneLevelSearchOps};
+AsnObjectIdentifier ASN_WholeSubtreeSearchOps = {MAGT_OID_SIZEOF(OID_WholeSubtreeSearchOps),OID_WholeSubtreeSearchOps};
+AsnObjectIdentifier ASN_Referrals = {MAGT_OID_SIZEOF(OID_Referrals) ,OID_Referrals};
+AsnObjectIdentifier ASN_Chainings = {MAGT_OID_SIZEOF(OID_Chainings) ,OID_Chainings};
+AsnObjectIdentifier ASN_SecurityErrors = {MAGT_OID_SIZEOF(OID_SecurityErrors) ,OID_SecurityErrors};
+AsnObjectIdentifier ASN_Errors = {MAGT_OID_SIZEOF(OID_Errors) ,OID_Errors};
+
+/* entries table */
+AsnObjectIdentifier ASN_MasterEntries = {MAGT_OID_SIZEOF(OID_MasterEntries) ,OID_MasterEntries};
+AsnObjectIdentifier ASN_CopyEntries = {MAGT_OID_SIZEOF(OID_CopyEntries) ,OID_CopyEntries};
+AsnObjectIdentifier ASN_CacheEntries = {MAGT_OID_SIZEOF(OID_CacheEntries) ,OID_CacheEntries};
+AsnObjectIdentifier ASN_CacheHits = {MAGT_OID_SIZEOF(OID_CacheHits) ,OID_CacheHits};
+AsnObjectIdentifier ASN_SlaveHits = {MAGT_OID_SIZEOF(OID_SlaveHits) ,OID_SlaveHits};
+
+/* interaction table */
+AsnObjectIdentifier ASN_DsName = {MAGT_OID_SIZEOF(OID_DsName) ,OID_DsName};
+AsnObjectIdentifier ASN_TimeOfCreation = {MAGT_OID_SIZEOF(OID_TimeOfCreation) ,OID_TimeOfCreation};
+AsnObjectIdentifier ASN_TimeOfLastAttempt = {MAGT_OID_SIZEOF(OID_TimeOfLastAttempt) ,OID_TimeOfLastAttempt};
+AsnObjectIdentifier ASN_TimeOfLastSuccess = {MAGT_OID_SIZEOF(OID_TimeOfLastSuccess) ,OID_TimeOfLastSuccess};
+AsnObjectIdentifier ASN_FailuresSinceLastSuccess = {MAGT_OID_SIZEOF(OID_FailuresSinceLastSuccess) ,OID_FailuresSinceLastSuccess};
+AsnObjectIdentifier ASN_Failures = {MAGT_OID_SIZEOF(OID_Failures) ,OID_Failures};
+AsnObjectIdentifier ASN_Successes = {MAGT_OID_SIZEOF(OID_Successes) ,OID_Successes};
+AsnObjectIdentifier ASN_URL = {MAGT_OID_SIZEOF(OID_URL) ,OID_URL};
+
+/* entity table */
+AsnObjectIdentifier ASN_EntityDescr = {MAGT_OID_SIZEOF(OID_EntityDescr) ,OID_EntityDescr};
+AsnObjectIdentifier ASN_EntityVers = {MAGT_OID_SIZEOF(OID_EntityVers) ,OID_EntityVers};
+AsnObjectIdentifier ASN_EntityOrg = {MAGT_OID_SIZEOF(OID_EntityOrg) ,OID_EntityOrg};
+AsnObjectIdentifier ASN_EntityLocation = {MAGT_OID_SIZEOF(OID_EntityLocation) ,OID_EntityLocation};
+AsnObjectIdentifier ASN_EntityContact = {MAGT_OID_SIZEOF(OID_EntityContact) ,OID_EntityContact};
+AsnObjectIdentifier ASN_EntityName = {MAGT_OID_SIZEOF(OID_EntityName) ,OID_EntityName};
+
+/*
+ * Storage definitions for MIB.
+ */
+char szPlaceHolder[] = "Not Available";
+int nPlaceHolder = 0;
+
+#define NUM_ENTITY_COLUMNS 6
+#define NUM_OPS_COLUMNS 20
+#define NUM_ENTRIES_COLUMNS 5
+#define NUM_INT_COLUMNS 8
+#define NUM_INT_ROWS 5
+
+
+UINT MIB_num_vars;
+
+void OidAppendIndex(AsnObjectIdentifier *Oid, int Index);
+
+int Mib_init(MagtMibEntry_t **Mib, int ApplIndex)
+{
+ int i;
+ int j;
+
+ MIB_num_vars = (UINT) 71;
+
+ /* allocate the memory for this Mib Instance */
+ if( (*Mib = (MagtMibEntry_t *) GlobalAlloc(GPTR, MIB_num_vars *
+ sizeof(MagtMibEntry_t ) )) == NULL)
+ {
+ return -1;
+ }
+
+ /**************************
+ * Ops Table Stuff
+ * --------------
+ * AnonymousBinds
+ * UnAuthBinds
+ * SimpleAuthBinds
+ * StrongAuthBinds
+ * BindSecurityErrors
+ * InOps
+ * ReadOps
+ * CompareOps
+ * AddEntryOps
+ * RemoveEntryOps
+ * ModifyEntryOps
+ * ModifyRDNOps
+ * ListOps
+ * SearchOps
+ * OneLevelSearchOps
+ * WholeSubtreeSearchOps
+ * Referrals
+ * Chainings
+ * SecurityErrors
+ * Errors
+ **************************/
+
+
+ i=0;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_AnonymousBinds);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_ANONYMOUS_BINDS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_UnAuthBinds);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_UNAUTH_BINDS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_SimpleAuthBinds);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_SIMPLE_AUTH_BINDS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_StrongAuthBinds);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_STRONG_AUTH_BINDS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_BindSecurityErrors);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_BIND_SECURITY_ERRORS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_InOps);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_IN_OPS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_ReadOps);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_READ_OPS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_CompareOps);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_COMPARE_OPS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_AddEntryOps);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_ADD_ENTRY_OPS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_RemoveEntryOps);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_REMOVE_ENTRY_OPS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_ModifyEntryOps);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_MODIFY_ENTRY_OPS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_ModifyRDNOps);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_MODIFY_RDN_OPS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_ListOps);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_LIST_OPS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_SearchOps);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_SEARCH_OPS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_OneLevelSearchOps);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_ONE_LEVEL_SEARCH_OPS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_WholeSubtreeSearchOps);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_WHOLE_SUBTREE_SEARCH_OPS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_Referrals);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_REFERRALS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_Chainings);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_CHAININGS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_SecurityErrors);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_SECURITY_ERRORS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_Errors);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_ERRORS;
+
+ /**************************
+ * Entries Table Stuff
+ * --------------
+ * MasterEntries
+ * CopyEntries
+ * CacheEntries
+ * CacheHits
+ * SlaveHits
+ **************************/
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_MasterEntries);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_MASTER_ENTRIES;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_CopyEntries);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_COPY_ENTRIES;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_CacheEntries);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_CACHE_ENTRIES;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_CacheHits);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_CACHE_HITS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_SlaveHits);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_SLAVE_HITS;
+
+
+ /**************************
+ * Interaction Table Stuff
+ * --------------
+ * DsName
+ * TimeOfCreation
+ * TimeOfLastAttempt
+ * TimeOfLastSuccess
+ * FailuresSinceLastSuccess
+ * Failures
+ * Successes
+ * URL
+ **************************/
+
+ for(j=1; j <= NUM_SNMP_INT_TBL_ROWS; j++)
+ {
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_DsName);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ OidAppendIndex(&((*Mib)[i].Oid), j);
+ (*Mib)[i].Storage = szPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1213_DISPSTRING;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_DS_NAME;
+
+ }
+
+ for(j=1; j <= NUM_SNMP_INT_TBL_ROWS; j++)
+ {
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_TimeOfCreation);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ OidAppendIndex(&((*Mib)[i].Oid), j);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_TIMETICKS;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_TIME_OF_CREATION;
+ }
+
+ for(j=1; j <= NUM_SNMP_INT_TBL_ROWS; j++)
+ {
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_TimeOfLastAttempt);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ OidAppendIndex(&((*Mib)[i].Oid), j);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_TIMETICKS;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_TIME_OF_LAST_ATTEMPT;
+ }
+
+ for(j=1; j <= NUM_SNMP_INT_TBL_ROWS; j++)
+ {
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_TimeOfLastSuccess);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ OidAppendIndex(&((*Mib)[i].Oid), j);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_TIMETICKS;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_TIME_OF_LAST_SUCCESS;
+ }
+
+ for(j=1; j <= NUM_SNMP_INT_TBL_ROWS; j++)
+ {
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_FailuresSinceLastSuccess);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ OidAppendIndex(&((*Mib)[i].Oid), j);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_FAILURES_SINCE_LAST_SUCCESS;
+ }
+
+ for(j=1; j <= NUM_SNMP_INT_TBL_ROWS; j++)
+ {
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_Failures);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ OidAppendIndex(&((*Mib)[i].Oid), j);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_FAILURES;
+ }
+
+ for(j=1; j <= NUM_SNMP_INT_TBL_ROWS; j++)
+ {
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_Successes);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ OidAppendIndex(&((*Mib)[i].Oid), j);
+ (*Mib)[i].Storage = &nPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1155_COUNTER;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_SUCCESSES;
+ }
+
+ for(j=1; j <= NUM_SNMP_INT_TBL_ROWS; j++)
+ {
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_URL);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ OidAppendIndex(&((*Mib)[i].Oid), j);
+ (*Mib)[i].Storage = szPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1213_DISPSTRING;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_URL;
+ }
+
+ /**************************
+ * Entity Stuff
+ * --------------
+ * EntityDescr
+ * EntityVers
+ * EntityOrg
+ * EntityLocation
+ * EntityContact
+ * EntityName
+ **************************/
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_EntityDescr);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = szPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1213_DISPSTRING;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_DESC;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_EntityVers);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = szPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1213_DISPSTRING;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_VERS;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_EntityOrg);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = szPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1213_DISPSTRING;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_ORG;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_EntityLocation);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = szPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1213_DISPSTRING;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_LOC;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_EntityContact);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = szPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1213_DISPSTRING;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_CONTACT;
+
+ i++;
+ SnmpUtilOidCpy(&((*Mib)[i].Oid), &ASN_EntityName);
+ OidAppendIndex(&((*Mib)[i].Oid), ApplIndex);
+ (*Mib)[i].Storage = szPlaceHolder;
+ (*Mib)[i].Type = ASN_RFC1213_DISPSTRING;
+ (*Mib)[i].Access = MAGT_MIB_ACCESS_READ;
+ (*Mib)[i].MibFunc = MagtMIBLeafFunc;
+ (*Mib)[i].MibNext = NULL;
+ (*Mib)[i].uId = MAGT_ID_NAME;
+
+ return 0;
+}
+
+void OidAppendIndex(AsnObjectIdentifier *Oid, int Index)
+{
+ UINT OID_Index[1];
+ AsnObjectIdentifier ASN_Index;
+
+ OID_Index[0] = Index;
+ ASN_Index.ids = OID_Index;
+ ASN_Index.idLength = 1;
+
+ SnmpUtilOidAppend(Oid, &ASN_Index);
+
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtFillTrapVars: Fills in the variable list for the specified trap.
+ *
+ * Returns: 0 - No variable filled
+ * n - Number of variables filled
+ *
+ *-----------------------------------------------------------------------*/
+
+int MagtFillTrapVars(int trapType, RFC1157VarBind *trapVars, MagtStaticInfo_t *pCfgInfo)
+{
+ MagtDispStr_t varVals[4];
+ int nVarLen = 0;
+ int i, j;
+ static AsnObjectIdentifier varOid[4] = {{MAGT_OID_SIZEOF(OID_EntityDescr),
+ OID_EntityDescr},
+ {MAGT_OID_SIZEOF(OID_EntityVers),
+ OID_EntityVers},
+ {MAGT_OID_SIZEOF(OID_EntityLocation),
+ OID_EntityLocation},
+ {MAGT_OID_SIZEOF(OID_EntityContact),
+ OID_EntityContact}};
+
+ /*
+ * Get the variable values from the static info which has been obtained
+ * from the snmp config file at initialization time.
+ */
+ varVals[0].len = pCfgInfo->entityDescr.len;
+ varVals[0].val = pCfgInfo->entityDescr.val;
+ varVals[1].len = pCfgInfo->entityVers.len;
+ varVals[1].val = pCfgInfo->entityVers.val;
+ varVals[2].len = pCfgInfo->entityLocation.len;
+ varVals[2].val = pCfgInfo->entityLocation.val;
+ varVals[3].len = pCfgInfo->entityContact.len;
+ varVals[3].val = pCfgInfo->entityContact.val;
+
+ for (i = 0; i < 4; i++)
+ {
+ SNMP_oidcpy(&trapVars[i].name, &MIB_OidPrefix);
+ SNMP_oidappend(&trapVars[i].name, &varOid[i]);
+ trapVars[i].value.asnType = ASN_OCTETSTRING;
+ trapVars[i].value.asnValue.string.length = varVals[i].len;
+ trapVars[i].value.asnValue.string.stream =
+ SNMP_malloc((trapVars[i].value.asnValue.string.length) *
+ sizeof(char));
+ if (trapVars[i].value.asnValue.string.stream == NULL)
+ {
+
+ /*
+ * Clean up any allocated variable binding allocated up until now.
+ */
+ for (j = 0; j < i; j++)
+ {
+ SNMP_FreeVarBind(&trapVars[j]);
+ return nVarLen;
+ }
+ }
+ memcpy(trapVars[i].value.asnValue.string.stream, varVals[i].val,
+ trapVars[i].value.asnValue.string.length);
+ trapVars[i].value.asnValue.string.dynamic = TRUE;
+ }
+
+ switch (trapType)
+ {
+ case MAGT_TRAP_SERVER_DOWN:
+ nVarLen = 4;
+ break;
+ case MAGT_TRAP_SERVER_START:
+ nVarLen = 3;
+ break;
+ default:
+ break;
+ }
+
+ return nVarLen;
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtMIBLeafFunc: Performs generic actions on leaf variables in the MIB.
+ * Note that SET action is not supported.
+ *
+ * Returns: SNMP_ERRORSTATUS_NOERROR - No error
+ * PDU error codes - Errors
+ *
+ *-----------------------------------------------------------------------*/
+
+UINT MagtMIBLeafFunc(IN UINT Action, IN MagtMibEntry_t *mibPtr,
+ IN RFC1157VarBind *VarBind)
+{
+ UINT ErrStat = SNMP_ERRORSTATUS_NOERROR;
+ static AsnObjectIdentifier ApplIndexOid = {MAGT_OID_SIZEOF(OID_ApplIndex),
+ OID_ApplIndex};
+ instance_list_t *pInstance;
+ char logMsg[1024];
+
+ switch(Action)
+ {
+ case MAGT_MIB_ACTION_GETNEXT:
+ /*
+ * If there is no next pointer, this is the end of the MIB tree.
+ */
+ if (mibPtr->MibNext == NULL)
+ {
+ ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
+ return ErrStat;
+ }
+
+ /*
+ * Set up VarBind to contain the OID of the next variable.
+ */
+ SNMP_oidfree(&VarBind->name);
+ SNMP_oidcpy(&VarBind->name, &MIB_OidPrefix);
+ SNMP_oidappend(&VarBind->name, &mibPtr->MibNext->Oid);
+
+ /*
+ * Call function to process the GET request.
+ */
+ ErrStat = (*mibPtr->MibNext->MibFunc)(MAGT_MIB_ACTION_GET, mibPtr->MibNext,
+ VarBind);
+ break;
+ case MAGT_MIB_ACTION_GET:
+
+ /*
+ * Make sure that the variable's access right allows GET.
+ */
+ if (mibPtr->Access != MAGT_MIB_ACCESS_READ &&
+ mibPtr->Access != MAGT_MIB_ACCESS_READWRITE)
+ {
+ ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
+ return ErrStat;
+ }
+
+ if (mibPtr->Storage == NULL) /* Counter not supported */
+ {
+ ErrStat = SNMP_ERRORSTATUS_GENERR;
+ return ErrStat;
+ }
+
+ if ((VarBind->name.ids[MAGT_MIB_PREFIX_LEN] > 1) &&
+ (SNMP_oidcmp(&mibPtr->Oid, &ApplIndexOid) != 0))
+ {
+
+ /*
+ * Read stats file to update counter statistics.
+ */
+
+ /* need to update all of them because don't know which instance resulted
+ into call into this function */
+ for (pInstance = pInstanceList; pInstance; pInstance = pInstance->pNext)
+ {
+ if (MagtReadStats(NULL, pInstance->pOpsStatInfo,
+ pInstance->pEntriesStatInfo,
+ pInstance->ppIntStatInfo,
+ pInstance->szStatsPath,
+ pInstance->szLogPath) != 0)
+ {
+
+ /* this server is off/or went down since we
+ started up snmp. The snmp agent will
+ return last values it was set to until
+ server starts back up. If server was not
+ started will return null for strings and
+ 0 for values */
+
+ /* to log for each snmp request is to expensive
+ for now, just silently acknowledge the fact
+ and think about something better for the future
+ */
+
+
+ }
+ }
+ }
+
+ /*
+ * Set up VarBind's return value.
+ */
+ VarBind->value.asnType = mibPtr->Type;
+ switch (VarBind->value.asnType)
+ {
+ case ASN_RFC1155_TIMETICKS:
+ case ASN_RFC1155_COUNTER:
+ case ASN_RFC1155_GAUGE:
+ case ASN_INTEGER:
+ VarBind->value.asnValue.number = *(AsnInteger *)(mibPtr->Storage);
+ break;
+ case ASN_RFC1155_IPADDRESS:
+ case ASN_OCTETSTRING: /* = ASN_RFC1213_DISPSTRING */
+ VarBind->value.asnValue.string.length =
+ strlen((LPSTR)mibPtr->Storage);
+ VarBind->value.asnValue.string.stream =
+ SNMP_malloc((VarBind->value.asnValue.string.length + 2) *
+ sizeof(char));
+ if (VarBind->value.asnValue.string.stream == NULL)
+ {
+ ErrStat = SNMP_ERRORSTATUS_GENERR;
+ return ErrStat;
+ }
+ memcpy(VarBind->value.asnValue.string.stream,
+ (LPSTR)mibPtr->Storage,
+ VarBind->value.asnValue.string.length);
+ VarBind->value.asnValue.string.dynamic = TRUE;
+ break;
+ case ASN_OBJECTIDENTIFIER:
+ VarBind->value.asnValue.object =
+ *(AsnObjectIdentifier *)(mibPtr->Storage);
+ break;
+ default:
+ ErrStat = SNMP_ERRORSTATUS_GENERR;
+ break;
+ } /* Switch */
+
+ break;
+ default:
+ ErrStat = SNMP_ERRORSTATUS_GENERR;
+ break;
+ } /* Switch */
+
+ return ErrStat;
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * MagtResolveVarBind: Resolves a single variable binding. Modifies the
+ * variable on a GET or a GETNEXT.
+ *
+ * Returns: SNMP_ERRORSTATUS_NOERROR - No error
+ * PDU error codes - Errors
+ *
+ *-----------------------------------------------------------------------*/
+
+UINT MagtResolveVarBind(IN OUT RFC1157VarBind *VarBind, IN UINT PduAction)
+{
+ MagtMibEntry_t *mibPtr = NULL;
+ AsnObjectIdentifier TempOid;
+ int CompResult;
+ UINT i = 0;
+ UINT nResult;
+ instance_list_t *pInstance;
+
+ pInstance = pInstanceList;
+
+ while (mibPtr == NULL && pInstance !=NULL)
+ {
+ /*
+ * Construct OID with complete prefix for comparison purpose
+ */
+ SNMP_oidcpy(&TempOid, &MIB_OidPrefix);
+ SNMP_oidappend(&TempOid, &(pInstance->pMibInfo[i].Oid));
+
+ /*
+ * Check for OID in MIB. On a GET-NEXT, the OID does not have to match
+ * exactly a variable in the MIB, it must only fall under the MIB root.
+ */
+ CompResult = SNMP_oidcmp(&VarBind->name, &TempOid);
+
+ if (CompResult < 0) /* Not an exact match */
+ {
+ if (PduAction != MAGT_MIB_ACTION_GETNEXT) /* Only GET-NEXT is valid */
+ {
+
+ pInstance=pInstance->pNext;
+ i=0;
+ if(pInstance == NULL)
+ {
+ nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
+ return nResult;
+ }else{
+ continue;
+ }
+
+ }
+
+ /*
+ * Since the match was not exact, but var bind name is within MIB,
+ * we are at the next MIB variable down from the one specified.
+ */
+ PduAction = MAGT_MIB_ACTION_GET;
+ mibPtr = &(pInstance->pMibInfo[i]);
+
+ /*
+ * Replace var bind name with new name.
+ */
+ SNMP_oidfree(&VarBind->name);
+ SNMP_oidcpy(&VarBind->name, &MIB_OidPrefix);
+ SNMP_oidappend(&VarBind->name, &mibPtr->Oid);
+ }
+ else
+ {
+ if (CompResult == 0) /* Found an exact match */
+ {
+ mibPtr = &(pInstance->pMibInfo[i]);
+ }else{
+ /* see if it is one of the other ApplIndex */
+ instance_list_t *pApplIndex;
+ for(pApplIndex = pInstance; pApplIndex; pApplIndex=pApplIndex->pNext)
+ {
+ SNMP_oidfree(&TempOid);
+
+ SNMP_oidcpy(&TempOid, &MIB_OidPrefix);
+ SNMP_oidappend(&TempOid, &(pApplIndex->pMibInfo[i].Oid));
+
+ CompResult = SNMP_oidcmp(&VarBind->name, &TempOid);
+ if(CompResult == 0)
+ {
+ mibPtr = &(pApplIndex->pMibInfo[i]);
+ }
+ }
+ }
+
+
+ }
+
+ /*
+ * Free OID memory before checking another variable.
+ */
+ SNMP_oidfree(&TempOid);
+ i++;
+
+ if(i == MIB_num_vars)
+ {
+ pInstance=pInstance->pNext;
+ i=0;
+ }
+ } /* While */
+
+ if (mibPtr == NULL) /* OID not within MIB's scope */
+ {
+ nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
+ return nResult;
+ }
+
+ if (*mibPtr->MibFunc == NULL)
+ {
+ nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
+ return nResult;
+ }
+
+ /*
+ * Call function to process request. Each MIB entry has a function pointer
+ * that knows how to process its MIB variable.
+ */
+ nResult = (*mibPtr->MibFunc)(PduAction, mibPtr, VarBind);
+
+ SNMP_oidfree(&TempOid); /* Free temp memory */
+
+ return nResult;
+
+}
diff --git a/ldap/servers/snmp/ntagt/nsldapmib_nt.h b/ldap/servers/snmp/ntagt/nsldapmib_nt.h
new file mode 100644
index 00000000..ac53dad7
--- /dev/null
+++ b/ldap/servers/snmp/ntagt/nsldapmib_nt.h
@@ -0,0 +1,130 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright 2001 Sun Microsystems, Inc.
+ * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+/*-------------------------------------------------------------------------
+ *
+ * nsldapmib_nt.h - Definitions for NS Directory Server's MIB on NT.
+ *
+ * Revision History:
+ * 07/25/1997 Steve Ross Created
+ *
+ *
+ *
+ *-----------------------------------------------------------------------*/
+
+#ifndef __NSLDAPMIB_NT_H_
+#define __NSLDAPMIB_NT_H_
+
+/*-------------------------------------------------------------------------
+ *
+ * Defines
+ *
+ *-----------------------------------------------------------------------*/
+
+#define MAGT_MIB_PREFIX_LEN MIB_OidPrefix.idLength
+#define MAGT_MAX_STRING_LEN 255
+
+#define MAGT_MIB_ACCESS_READ 0
+#define MAGT_MIB_ACCESS_WRITE 1
+#define MAGT_MIB_ACCESS_READWRITE 2
+
+#define MAGT_MIB_ACTION_GET ASN_RFC1157_GETREQUEST
+#define MAGT_MIB_ACTION_SET ASN_RFC1157_SETREQUEST
+#define MAGT_MIB_ACTION_GETNEXT ASN_RFC1157_GETNEXTREQUEST
+
+/*
+ * Macro to determine number of sub-oids in array.
+ */
+#define MAGT_OID_SIZEOF(Oid) (sizeof Oid / sizeof(UINT))
+
+/*
+ * Unique ID for each entry in the MIB.
+ */
+enum
+{
+ MAGT_ID_DESC = 0,
+ MAGT_ID_VERS,
+ MAGT_ID_ORG,
+ MAGT_ID_LOC,
+ MAGT_ID_CONTACT,
+ MAGT_ID_NAME,
+ /* operations table attrs */
+ MAGT_ID_ANONYMOUS_BINDS,
+ MAGT_ID_UNAUTH_BINDS,
+ MAGT_ID_SIMPLE_AUTH_BINDS,
+ MAGT_ID_STRONG_AUTH_BINDS ,
+ MAGT_ID_BIND_SECURITY_ERRORS,
+ MAGT_ID_IN_OPS,
+ MAGT_ID_READ_OPS,
+ MAGT_ID_COMPARE_OPS,
+ MAGT_ID_ADD_ENTRY_OPS,
+ MAGT_ID_REMOVE_ENTRY_OPS,
+ MAGT_ID_MODIFY_ENTRY_OPS,
+ MAGT_ID_MODIFY_RDN_OPS,
+ MAGT_ID_LIST_OPS,
+ MAGT_ID_SEARCH_OPS,
+ MAGT_ID_ONE_LEVEL_SEARCH_OPS,
+ MAGT_ID_WHOLE_SUBTREE_SEARCH_OPS,
+ MAGT_ID_REFERRALS,
+ MAGT_ID_CHAININGS,
+ MAGT_ID_SECURITY_ERRORS,
+ MAGT_ID_ERRORS,
+ /* entries table attrs */
+ MAGT_ID_MASTER_ENTRIES,
+ MAGT_ID_COPY_ENTRIES,
+ MAGT_ID_CACHE_ENTRIES,
+ MAGT_ID_CACHE_HITS,
+ MAGT_ID_SLAVE_HITS,
+ /* interaction table entries */
+ MAGT_ID_DS_NAME,
+ MAGT_ID_TIME_OF_CREATION,
+ MAGT_ID_TIME_OF_LAST_ATTEMPT,
+ MAGT_ID_TIME_OF_LAST_SUCCESS,
+ MAGT_ID_FAILURES_SINCE_LAST_SUCCESS,
+ MAGT_ID_FAILURES,
+ MAGT_ID_SUCCESSES,
+ MAGT_ID_URL,
+ /* applIndex */
+ MAGT_ID_APPLINDEX
+};
+
+/*-------------------------------------------------------------------------
+ *
+ * Types
+ *
+ *-----------------------------------------------------------------------*/
+
+typedef struct MagtMibEntry
+{
+ AsnObjectIdentifier Oid;
+ void *Storage;
+ BYTE Type;
+ UINT Access;
+ UINT (*MibFunc)(UINT, struct MagtMibEntry *, RFC1157VarBind *);
+ struct MagtMibEntry *MibNext;
+ UINT uId;
+} MagtMibEntry_t;
+
+#include "nsldapagt_nt.h"
+/*-------------------------------------------------------------------------
+ *
+ * Prototypes
+ *
+ *-----------------------------------------------------------------------*/
+
+int MagtFillTrapVars(int trapType,
+ RFC1157VarBind * trapVars,
+ MagtStaticInfo_t * pCfgInfo);
+
+UINT MagtMIBLeafFunc(IN UINT Action,
+ IN MagtMibEntry_t *MibPtr,
+ IN RFC1157VarBind *VarBind);
+
+UINT MagtResolveVarBind(IN OUT RFC1157VarBind *VarBind,
+ IN UINT PduAction);
+
+int Mib_init(MagtMibEntry_t **Mib, int ApplIndex);
+#endif /* __NSLDAPMIB_NT_H_ */