snmpGetnext_v3()--Retrieve Next MIB Object Using SNMP Version 3


  Syntax
 #include <qtomeapi.h>

 int snmpGetnext_v3(snmppdu  *         pdu_ptr,
                    char  *            host_ptr,
                    unsigned long int  time_out,
                    char  *            user_ptr,
                    snmp_auth_cb *     my_auth_cb);

  Service Program Name: QTOMEAPI

  Default Public Authority: *USE

  Threadsafe: No

An SNMP managing application uses the snmpGetnext_v3() function to get the value of one or more management information base (MIB) objects from an SNMP agent or subagent on a local or remote system. The snmpGetnext_v3() function gets the value of the object instance that is next in lexicographic order. This function uses the SNMP version 3 protocol to communicate with the local or remote agent.

Parameters

pdu_ptr
(Input) A pointer to a structure of the protocol data unit (PDU) type as defined in the <qtomeapi.h> file.

This structure contains the PDU type (GET NEXT in this instance), the error status, the error index, and the pointer to the varbind structure.

The varbind structure (found in the qtomeapi.h file) consists of the following:

struct _varBind{
   struct _varBind * next;
   char   *oid;                          /* Null Terminated */
   unsigned char asn_type;
   int    val_len;
   union {
      int  * int_val;
      char * str_val;
   } val;
};

The fields for this structure are described as follows:


host_ptr
(Input) A pointer to the character string that contains the Internet Protocol (IP) address. The internet address may be an IPv4 or IPv6 address.

An IPv4 internet address is specified in the form nnn.nnn.nnn.nnn, where nnn is a decimal number ranging from 0 through 255. An IPv4 internet address is not valid if it has a value of all binary ones or all binary zeros for the network identifier (ID) portion or the host ID portion of the address.

An IPv6 internet address is specified in the form x:x:x:x:x:x:x:x, where x is a hexadecimal number ranging from 0 through X'FFFF'. "::" may be used once in the IPv6 address to indicate one or more groups of 16 bits of zeros. The "::" may be used to compress leading, imbedded, or trailing zeros in the address.

This parameter can also be stored in host address format, that is, mycompany.com. This parameter must contain printable characters only.

time_out
(Input) The time-out value.

This parameter is the amount of time in seconds that the management application is willing to wait for the response PDU. The minimum value is 1, and the maximum is 100.

user_ptr
(Input) A pointer to the character string that contains the SNMPv3 User-based Security Model (USM) user name.

The USM user name must exist in the file /QIBM/USERDATA/OS/SNMP/SNMPD.CONF. The USM user name is a NULL terminated string.

my_auth_cb
(Input/Output) The address of a pointer to an SNMPv3 authentication control block built by the snmpDiscover_v3() function for the host specified by the host_ptr parameter.

Authorities

Service Program Authority
*USE

Return Value

The following are the possible return codes posted by the snmpGetnext_v3() function:

For more information, see the Simple Network Management Protocol (SNMP) SupportLink to PDF manual.


Error Conditions

Following are the possible error statuses returned in the error status field of the PDU structure. These values are returned by the SNMP agents.


Usage Notes

The area where the data is returned is the responsibility of the user, not the API. To allocate storage, the user may use the AddVarbind routine (see AddVarbind Routine). To deallocate storage, the user may use the FreePdu routine (see FreePdu Routine).

You must use the correct PDU type on AddVarbind. It must match the operation on which you call. For example, if you build a PDU wherein AddVarbind passes a PDU type of Set and then you call the snmpGet operation using the PDU that you just created with Set, you will receive an error on the snmpGet call.

All character strings that are passed to the APIs must be null-terminated unless you explicitly provide the length, if a length field is available.

If you are building a PDU to go to a remote agent, you must remember to do correct translation of strings. The IBM i system is an EBCDIC system, whereas an SNMP agent on an AIX computer is an ASCII system.

These APIs are blocked, which means that on a call to the API a PDU is sent across a communications protocol to an SNMP agent on a local or remote system. The call returns when a response has been received from the agent or when the command times out. On the return, all returned data is placed in the appropriate locations. You need do no further action to retrieve such data.


Related Information


Example

For examples that pertain to the SNMP manager APIs, see Using SNMP Manager APIs--Example.



API introduced: V7R2