SNMP Manager Programmer's Guide

Programming Examples
SNMP Manager Programmer’s Guide–134249
2-43
SNMPGT
1. The header files support various activities the manager performs:
2. MAXOIDS defines the maximum number of OIDs that can be accepted from the
invocation line. TBSIZE defines the size of the encoded-packet buffers.
3. An encoded-packet buffer for requests and one for responses is allocated.
4. Variables for handling OIDs are declared using types defined by Manager Services.
The variable base_component_list is an array that can hold as many as 32 OIDs; 32
is set by the Manager Services library define MAX_OID_COUNT. The structure
base_oid holds the number of components in and a pointer to the component array.
5. Pointers for the response packet (*rcvd_pkt) and the request packet (*send_pkt) are
defined; these packets must have the structure SNMP_PKT_T, defined by Manager
Services.
6. A structure containing descriptors for the encoded-packet buffer is declared.
Encoded-packet buffers must be described by a structure of type EBUFFER_T,
defined by Manager Services.
7. Two structures for describing the UDP sockets for sending requests (dest) and
receiving responses (from) are declared. The structure sockaddr_in is defined in
in.h.
8. The UDP port to use to address the agent is initialized to 161 using the Manager
Services define SNMP_REQUEST_PORT.
9. Other default values are initialized. The community name is set to "public", the
retry count to 0, the timeout to 5 seconds, and the request ID to 1.
SNMP operations asn1.h
localio.h
buffer.h
objectid.h
snmp.h
snmpstat.h
buildpkt.h
print.h
Defines various ASN.1 structures
Defines structures for holding unencoded
ASN.1 information
Defines encoded-packet buffer structures and
function prototypes
Defines entry points into the OID structure
Includes snmpdefs.h, which defines the
unencoded-packet structure
Not utilized, but required by the Manager
Services library
Defines function prototypes for packet
construction
Prints packets
C operations stdio.h
ctype.h
errno.h
Define C library utilities for such activities as
memory management, string management, and
error reporting.
UDP operations systype.h
socket.h
netdb.h
in.h
Define TCP/IP library structures and function
prototypes needed to handle UDP packets