snmpGetbulk_v3()--Retrieve Bulk MIB Objects Using SNMP Version 3


  Syntax
 #include <qtomeapi.h>

 int snmpGetbulk_v3(snmppdu_bulk  *    pdu_ptr,
                    char  *            host_ptr,
                    unsigned long int  time_out,
                    char  *            user_ptr,
                    snmp_auth_cb *     my_auth_cb_ptr
                    snmppdu *          response_pdu_ptr);

  Service Program Name: QTOMEAPI

  Default Public Authority: *USE

  Threadsafe: No

An SNMP managing application uses the snmpGetbulk_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 snmpGetbulk_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) get bulk type as defined in the <qtomeapi.h> file.

This structure contains the get bulk PDU, the number of non-repeater OIDs, the maximum number of "get next" attempts for the remaining OIDs, 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_ptr
(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.
response_pdu_ptr
(Output) A pointer to an snmppdu structure that will contain the results of the get bulk request. The storage used by snmppdu structure and the associated varbinds must be provided by the caller of this API. The total number of varbind structures that must be provided can be determined with the formula T = ((V - N) * M) + N where T is the total number of varbinds to be returned, V is the number of varbinds provided by the pdu_ptr parameter, N is the number of non-repeater varbinds provided by the pdu_ptr parameter, and M is the maximum repetitions value specified by the pdu_ptr parameter. The maximum number of varbinds that this API will return is 512.

Authorities

Service Program Authority
*USE

Return Value

The following are the possible return codes posted by the snmpGetbulk_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 storage area (Response PDU) where the data is returned is the responsibility of the user, not the API. The user may use the MakeResponsePDUSpace routine to allocate the necessary storage (see MakeResponsePDUSpace Routine). To allocate storage for the input PDU, the user may use the AddVarbind routine (see AddVarbind Routine). To deallocate storage for both the response and input PDUs, 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 uses ASCII.

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