As an aid to developing an SNMP agent and its associated MIB, the MIB tree can be dynamically changed at run-time from alternate tasks in VxWorks. The functions snmpdTreeAdd( ) and snmpdTreeRemove( ) can be used to dynamically add and remove sections of a MIB tree, respectively. For more information, see the explanations of each function in F. SNMP Reference.
|
WARNING: Sections of the MIB tree can only be removed dynamically if they are added dynamically. |
A MIB addition which is to be added dynamically to the data tree is developed in a similar fashion to that developed at compile-time.
Rather than walk through each step, please refer to the above examples in 6.3 Compile-time MIB Extensions for instructions on Steps 1 through 4.
|
NOTE: If you develop the new MIB extension in the same file as the standard MIB, you can easily extract the new information using the EXCLUDE directive (or the mibcomp option -exclude). For more information, see 5.1 Configuring VxWorks for Use with WindNet SNMP and The EXCLUDE Keyword. |
Use mibcomp to compile the new MIB information into a C representation of the new data tree. Use the -leaf option to generate a C header file that defines constants specifying the last component of each object's identifier (OID) as well as any enumerated values associated with the object's SYNTAX and any known bounds on the object's value. (See A. The MIB Compiler User's Guide for more information on mibcomp and its options.)
(The \ character in these command lines indicates continuation onto the next line.)
% mibcomp -l $WIND_BASE/target/src/snmpv1/mibs rfc1155.smi rfc1213.mib \ -start wrs -o mibhand.h -skel.h demo.mib
This example shows commands for compiling for a 68020-based target. (The \ character indicates continuation onto the next line.)
% cc68k -m68020 -msoft-float -O -fvolatile -fno-builtin -Wall -ansi \ -nostdinc -DCPU=MC68020 -DVXWORKS -I$WIND_BASE/target/h \ -I$WIND_BASE/target/h/snmp/ -I. -c demo.c demomib.c
Use the ld( ) routine under VxWorks to load the newly-created module into VxWorks. Once the module is loaded, use snmpdTreeAdd( ) to add the module to the running MIB.
(For more information on ld( ), see the VxWorks Reference Manual. For more information on snmpdTreeAdd( ), see the appropriate manual page in F. SNMP Reference.)
|
NOTE: Depending on how views were initialized in the agent, you may now need to update the view tables. See 4.9 View Tables. |