SNMP Subagent Programmer's Guide

SNMP Subagent Programmer’s Guide119728 5-1
5
Creating Executable Subagents
To convert subagent MIB definitions and source code into an executable file, follow
these steps:
1. Compile the MIB using the Toolkit’s MIB compiler, GDMOC.
2. Compile the subagent source code using the C compiler.
3. Bind the subagent object code with the run-time library using the Binder utility.
4. If the subagent will execute on a TNS/R system, optionally optimize the subagent
using the Accelerator.
This section provides examples for each of these steps and explains how to automate
them by creating a TACL routine.
MIB Compilation
Use GDMOC to convert a MIB definition into a header file that later is compiled into
the subagent source code.
The invocation line for GDMOC requires you to supply a variable name in each of three
options:
The following GDMOC invocation compiles the MIB definition for Hello World, in a
file named hellosmi, into a file named helloh. Both the MIB definition file and the
output file reside in the current subvolume. GDMOC and the header files included in
the MIB definition reside in the Install subvolume, ZSNMPSDK:
RUN ZSNMPSDK.GDMOC -g hellosmi -I zsnmpsdk -c helloh
Refer to Section 3, “Writing and Compiling MIBs,” for more information about
GDMOC.
Subagent Compilation
Before compiling the subagent source code, use the C compiler include directive to
include the GDMOC output file as a global directive that follows all the declarations of
MIB object variables:
#include "helloh"
-g
Identifies the file containing the MIB definition
-I
Identifies the subvolume containing any include files named in the MIB
definition
-c
Identifies the GDMOC output file