SNMP Subagent Programmer's Guide
Programming Tutorials
SNMP Subagent Programmer’s Guide—119728 2-45
Dynamic Directory Program
MIB
Example 2-9 shows the MIB definition used by Dynamic Directory. The MIB defines
the same number and type of objects used by Static Directory, but names them
differently. It also identifies the next and locator functions used by the subagent and
assigns read-write access to the MIB object named dirName. Items in bold type indicate
differences from the Static Directory MIB.
Example 2-9. Dynamic Directory MIB Definition
#include "typessmi"
DYNAMIC-DIRECTORY-TABLE DEFINITIONS ::= BEGIN
private OBJECT IDENTIFIER ::= { iso(1) org(3) dod(6) internet(1) 4 }
enterprises OBJECT IDENTIFIER ::= { private 1 }
peer OBJECT IDENTIFIER ::= { enterprises 442 }
--Within the 'peer' arc, entire subtrees are dedicated to the following
peer-products OBJECT IDENTIFIER ::= { peer 1 }
peer-demos OBJECT IDENTIFIER ::= { peer 2 }
dir OBJECT IDENTIFIER ::= { peer-demos 4 }
-- the table group has one attribute of its own - the number of rows
-- in the contained table. It also contains the table of names.
dirName OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..255))
ACCESS read-write
C_STRUCT directory, FIELD dir_name
STATUS mandatory
DESCRIPTION
"The name of the directory to be queried..."
::= { dir 1 }
dirFiles OBJECT-TYPE
SYNTAX SEQUENCE OF FileEntry
ACCESS not-accessible
STATUS mandatory
::= { dir 2 }
fileEntry OBJECT-TYPE
SYNTAX FileEntry
ACCESS not-accessible
STATUS mandatory
INDEX { fileName }
C_NEXT_FUNC next_file
::= { dirFiles 1 }
FileEntry ::=
SEQUENCE {
fileName
DisplayString
}
fileName OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..255))
ACCESS read-only
C_STRUCT file_entry, FIELD file_name
C_LOCATOR_FUNC locate_file
STATUS mandatory
DESCRIPTION
"The name of one of the files in the directory."
::= { fileEntry 1 }
END