disconnectSNMP()--End Connection with SNMP Agent


  Syntax
 #include <qtossapi.h>

 int            disconnectSNMP(
           char         *queue_name,  
           char         *lib_name,
           long int     timeout );


  Service Program Name: QTOSSAPI

  Default Public Authority: *USE

  Threadsafe: No

The disconnectSNMP() function ends the logical connection between the SNMP subagent and the IBM® i SNMP agent.


Authorities

So that the subagent can receive messages from the SNMP agent, the following conditions must be met:


Parameters

queue_name
(Input) The name of the data queue (as a null-terminated string) on which the subagent was receiving Distributed Protocol Interface (DPI®) packets. This should be the same data queue name as previously used in a call to connectSNMP().

lib_name
(Input) The name of the IBM i library (as a null-terminated string) to which the data queue belongs. This should be the same library name as previously used in a call to connectSNMP().

timeout
(Input) The amount of time in seconds that the subagent is willing to wait for a disconnection. This field may contain any of these values:
0 Immediate disconnect, independent of whether or not the SNMP agent is available or has responded
> 0 The number of seconds to wait (maximum is 2 147 483 647)

Any other values result in an error return code.


Return Value

The indicated return values are defined in the <qtossapi.h> file.

0 snmpsa_RC_ok

The disconnectSNMP() function was successful.

-1 snmpsa_RC_err

An exception occurred. Check the subagent job log for the exception information, correct the condition, and resubmit the subagent job. (This return code is only used when a more specific return code is not available.)

-2 snmpsa_RC_noagent

The SNMP agent is not available.

-3 snmpsa_RC_mismatch

There is a code-level mismatch between the agent and the subagent. If this occurs, report the problem to the appropriate service organization.

-4 snmpsa_RC_timedout

The specified timeout value was exceeded.

-7 snmpsa_RC_parmerr

A parameter error occurred. This is more likely caused by errors in the value of a parameter (for example, a value was too large or too small) or by a pointer parameter that has a NULL value and should not. For char* parameters, it may also be caused if the length of the string exceeds some limit.

-8 snmpsa_RC_lengtherr

During an attempt to communicate with the agent, a length exception occurred. See any messages in the job log and correct any errors that are indicated, then retry the operation.

-9 snmpsa_RC_buffer

An internal buffer was not obtained. See any messages in the job log and correct any errors that are indicated, then retry the operation.

-14 snmpsa_RC_sync

A synchronization problem occurred between the agent and subagent. If this occurs, report the problem to the appropriate service organization.

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


Usage Notes

The disconnectSNMP() function ends the logical connection between the SNMP agent and a subagent. This is normally the last subagent API that a subagent calls.


Related Information


Example

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

  #include <qtossapi.h>
  int      rc;

  rc = disconnectSNMP( "QABCDEFG", "LIBABC", 0 );
  if (rc) {
     /* Handle exception. */
  }



API introduced: V3R6

[ Back to top | UNIX-Type APIs | APIs by category ]