SNMP Subagent Programmer's Guide

Programming Tutorials
SNMP Subagent Programmer’s Guide—119728 2-35
Static Directory Program
Logic
Static Directory is implemented by using three source code files:
Logic Flow
As Figure 2-4 illustrates, Static Directory calls these functions in fixedlsc:
mgmt_init_env()
mgmt_new_instance() for the MIB
build_files()
mgmt_new_instance() for each table entry
mgmt_poll
Source Code
The Static Directory source code appears in Example 2-6, Example 2-7, and
Example 2-8:
Example 2-6 shows the source code in fixedlsc.
Example 2-7 shows the source code in dirH.
Example 2-8 shows the source code in dirC.
Numbers in the examples correspond to comments in the discussions located between
here and the examples.
Global Declarations
This subagent includes a file defining structures it uses:
1. The file named dirH defines the structures for holding the values for MIB objects
dirName (the subvolume name) and fileName (the associated file names).
Main Control Block
The main block uses the functions shown in Figure 2-4:
2. Two pointers are declared for referring to subvolume and file names:
fixedlsc The main program
dirH The definition of structures directory and file_entry
dirC The definition of three functions used by the subagent: build_files(),
insert_new_file(), and comp_files()
*dir Points to the structure containing the subvolume name.
*file Points to the structure containing the associated file names.