SNMP Subagent Programmer's Guide
Programming Tutorials
SNMP Subagent Programmer’s Guide—119728 2-37
Static Directory Program
Note that several C library header files (12) are included to support the system calls
in build_files(). The build_files() function uses two defines (16) generated by
GDMOC.
8. Each entry (file name) is made available for management. The third parameter of
this mgmt_new_instance() call points to the filled-in structure holding file names.
Because each entry is individually registered with mgmt_new_instance(), the run-
time library can handle all the ordering and locating operations required when
processing SNMP requests.
9. Incoming SNMP requests are processed as they arrive until connection with the
NonStop agent is lost.
Example 2-6. Static Directory Main Program (page 1 of 3)
#include "tdmporth"
#include "machtypH"
#include "syspubH"
#include "errnoH"
#include "smitypeH"
#include "mgmtpubH"
#include "dirH"
<-- 1
/*
* The SMI compiler output must be included after all
* the attribute data structures have been defined since
* this output will make reference to these structures.
*/
#pragma nowarn (93)
#include "fixedlsh"
#pragma warn (93)
/*****************************************************************************
* safe_malloc Allocate a chunk of memory. Cause the program
* to exit if no memory is available.
****************************************************************************/
Void *
safe_malloc(register int size)
...
safe_malloc(size)
register int size;
{
register Void *data;
data = (Void *) malloc(size);
if (data == NULL)
{
(void) fprintf(stderr, "malloc %s bytes failure\n",size);
exit(2);
}
return(data);
}
/*****************************************************************************
* main Main routine for the fixed directory lister
****************************************************************************/
int
main(int argc,
char **argv)
...