mkDPIopen()--Make a DPI Open Packet


  Syntax
 #include <qtossapi.h>

 unsigned char     *mkDPIopen(
      char             *oid_p,
      char             *description_p,
      unsigned long    timeout,
      unsigned long    max_varbinds,
      char             character_set,
      unsigned long    password_len,
      unsigned char    *password_p );

  Service Program Name: QTOSSAPI

  Default Public Authority: *USE

  Threadsafe: No

The mkDPIopen() function makes a Distributed Protocol Interface (DPI®) open packet and returns a pointer to the packet.


Authorities and Locks

None.


Parameters

oid_p
(Input) A pointer to a NULL-terminated character string that represents the OBJECT IDENTIFIER, which uniquely identifies the subagent.

description_p
(Input) A pointer to a NULL-terminated character string, which is a descriptive name for the subagent. This can be any DisplayString, which basically is a byte string that contains only characters from the ASCII network virtual terminal (NVT) set.

timeout
(Input) The requested timeout for this subagent. An agent often has a limit for this value, and it will use that limit if this value is larger. A timeout of zero has a special meaning in the sense that the agent will then use its own default timeout value. The upper bound and default timeout values for DPI subagents are maintained by the SNMP agent in the subagent MIB. For details about the subagent MIB, see "SNMP Subagent MIB" in the Simple Network Management Protocol (SNMP) Support Link to PDF manual.

max_varBinds
(Input) The maximum number of varbinds per DPI packet that the subagent is prepared to handle. The agent tries to combine up to this number of varbinds (belonging to the same subtree) in a single DPI packet. If zero is specified, there is no explicit upper bound on the number of varbinds. In all cases, the actual number of varbinds is constrained by buffer sizes.

character_set
(Input) The character set that you want to use for string-based data fields in the DPI packets and structures. In general, the SNMP agent communicates to all SNMP managers in NVT ASCII and stores information in its own MIBs in ASCII. However, the agent will do some translations. Currently, only DPI_NATIVE_CSET is supported. For a System i® product, this is EBCDIC (coded character set identifier (CCSID) 500).

The specifics are as follows:



password_len
(Input) The length (in bytes) of an optional password. For the agent on a System i platform, subagents do not need to supply a password. If not, then a zero length may be specified.

password_p
(Input) A pointer to an byte string that represents the password for this subagent. This corresponds to an SNMP agent community name. A password may include any character value, including the NULL character. If the password_len is zero, then this can be a NULL pointer.

Return Value

value The value returned is a pointer to the DPI packet.

If successful, then a pointer to a static DPI packet buffer is returned. The first 2 bytes of the buffer (in network byte order) contain the length of the remaining packet. The DPI_PACKET_LEN() function can be used to calculate the total length of the DPI packet.

NULL If unsuccessful, then a NULL pointer is returned.

Be aware that the static buffer for the DPI packet is shared by other mkDPIxxxx() functions that create a serialized DPI packet.

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


Usage Notes

The mkDPIopen() function creates a serialized DPI OPEN packet that can then be sent to the SNMP agent.

The SNMP agent will send a DPI response packet back to the subagent with a code that can be used to determine if the open request was successful. This will be one of the SNMP_ERROR_DPI_* return codes found in <qtossapi.h>. Following receipt of this response packet, the subagent will need to call the pDPIpacket() to parse this DPI packet. The error_code should be checked.

If the error_code is SNMP_ERROR_DPI_duplicateSubAgentIdentifier, then another subagent with the same subagent OID has already sent an open DPI packet and the SA MIB OID saAllowDuplicateIDs is 2 (No). Either choose a different OID for this subagent, change saAllowDuplicateIDs to 1 (Yes) or stop the other subagent that has the requested identifier. The fDPIparse() function would normally be called after that to free the parsed DPI response packet. For information about saAllowDuplicateIDs, see "SNMP Subagent MIB" in the Simple Network Management Protocol (SNMP) Support Link to PDF manual.


Related Information


Example

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

  #include <qtossapi.h>
  unsigned char *pack_p;

  pack_p = mkDPIopen("1.3.6.1.2.3.4.5",
                "Sample DPI sub-agent"
                0L,2L, DPI_NATIVE_CSET,
                0,(char *)0);
  if (pack_p) {
     /* Send packet to the agent. */
  }


API introduced: V3R6

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