SNMP Manager Programmer's Guide

Programming Examples
SNMP Manager Programmer’s Guide–134249
2-126
SNMPHOST Source Code
56. InitDevTable() allocates memory for retrieved device information.
57. Memory is allocated and descriptors initialized for the GetNext and Get encoded-
packet buffers.
58. GetHostDevices() retrieves device information.
59. DisplayHostDevices() prints it.
60. Buffer memory is deallocated, and SNMP_Close_() terminates communication with
the agent.
Example 2-18. Contents of snmphosc (page 1 of 23)
#include <stdio.h> nolist
#include <ctype.h> nolist
#include <asn1.h> nolist
#include <localio.h> nolist
#include <buffer.h> nolist
#include <objectid.h> nolist
#include <snmp.h> nolist
#include <snmpstat.h> nolist
#include <buildpkt.h> nolist
#include <talh> nolist
#include <errno.h> nolist
#include <systype.h> nolist
#include <socket.h> nolist
#include <netdb.h> nolist
#include <in.h> nolist
#include <print.h> nolist
#include "snmpfs.h" nolist <--1
#include <snmphost.h> nolist
#ifdef __TANDEM
#include <cextdecs(FILE_OPEN_, \
FILE_CLOSE_, \
READX, \
WRITEX, \
FILE_GETINFO_, \
AWAITIOX)> nolist
#else
#include <grdapi.h>
#endif
#define MAX_REQID_VALUE 0X7FFFFFFF
SNMP_STATS_T snmp_stats;
OIDC_T base_component_list[MAX_OID_COUNT];
OBJ_ID_T base_oid = { MAX_OID_COUNT, base_component_list };
char *buffp;
short debug_level = 1; /* Default to messages only */