SNMP Manager Programmer's Guide
Constructing and Interpreting Packets
SNMP Manager Programmer’s Guide–134249
5-13
SNMP_Create_Request()
VERSION_RFC1067
VERSION_RFC1098
VERSION_RFC1157
SNMP_VERSION_1
community-length
is the number of bytes in the community identifier to which community-
identifier points.
community-identifier
is a pointer to a character buffer containing the community identifier.
request-id
is an integer you use to correlate the request packet with a subsequent response
packet.
num-varbinds
is an integer indicating how many variable bindings the packet will contain. After
SNMP_Create_Request() completes, call an SNMP_Bind_ function as many times
as the number of variable bindings in order to associate the variable bindings with
the packet.
The following example, taken from SNMPSET, initializes a packet for a Set request.
Variables for some of the arguments in the SNMP_Create_Request() call are declared
and initialized in the main block:
char *community="public";
int oidcnt;
short requestid = 1;
SNMP_PKT_T *send_pkt;
After the command-line arguments are parsed and any values overriding default values
obtained, the request packet is initialized:
send-pkt = SNMP_Create_Request(SET_REQUEST_PDU, VERSION_RFC1067,
strlen(community), community, (INT_32_T) requestid,
oidcnt);