ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/opensnmp.htm

284 lines
9.7 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>mkDPIopen()--Make a DPI Open Packet</title>
<!-- Begin Header Records ========================================== -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- Direct1 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!-- Edited by Kersten Feb 02 -->
<!-- End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<a name="Top_Of_Page"></a>
<h2>mkDPIopen()--Make a DPI Open Packet</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;qtossapi.h&gt;
unsigned char *mkDPIopen(
char <em>*oid_p</em>,
char <em>*description_p</em>,
unsigned long <em>timeout</em>,
unsigned long <em>max_varbinds</em>,
char <em>character_set</em>,
unsigned long <em>password_len</em>,
unsigned char <em>*password_p</em> );
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QTOSSAPI<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: No<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>mkDPIopen()</strong> function makes a Distributed Protocol
Interface (DPI) open packet and returns a pointer to the packet.</p>
<br>
<!-- Please NOTE: DO NOT DELETE THIS SECTION if this API has no authorities and locks. -->
<!-- Instead, use the commented out coding below to indicate NONE. -->
<h3>Authorities and Locks</h3>
<!-- Use this if there are no authorities and locks. -->
<p>None.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong>oid_p</strong></dt>
<dd>(Input) A pointer to a NULL-terminated character string that represents the
OBJECT IDENTIFIER, which uniquely identifies the subagent.<br>
<br>
</dd>
<dt><strong>description_p</strong></dt>
<dd>(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.<br>
<br>
</dd>
<dt><strong>timeout</strong></dt>
<dd>(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 <a href=
"../books/sc415412.pdf" target="_blank">Simple Network Management
Protocol</a> <img src="wbpdf.gif" alt="Link to PDF"> book.<br>
<br>
</dd>
<dt><strong>max_varBinds</strong></dt>
<dd>(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.<br>
<br>
</dd>
<dt><strong>character_set</strong></dt>
<dd>(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 the iSeries server, this is EBCDIC (coded character set
identifier (CCSID) 500).
<p>The specifics are as follows:</p>
<ul>
<li>On SET, COMMIT and UNDO requests from the agent, if the OID Structure of
Management Information (SMI) type is SNMP_TYPE_OCTET_STRING and the textual
convention is DisplayString, the agent will translate from ASCII to EBCDIC. The
<strong>&lt;qtossapi.h&gt;</strong> file contains the C-language defines for
these SMI types.
<p><strong>Note</strong>: A subagent implementation with DisplayString OIDs
that have read/write access should check the value_type in the
snmp_dpi_set_packet (see the <strong>&lt;qtossapi.h&gt;</strong> file). If the
value_type is not equal to the SNMP_TYPE_DisplayString in the set request, then
the agent will not have converted from ASCII to EBCDIC. In this case, the
subagent should perform the translation.</p>
</li>
<li>If the textual convention is DisplayString during the processing of a GET
or GETNEXT from a subagent, the agent will convert from EBCDIC to ASCII.<br>
<br>
</li>
<li>When processing a DPI open packet, the agent will translate the description
(see the description_p parameter) from EBCDIC to ASCII for storage in the
subagent MIB.<br>
<br>
</li>
<li>In the SNMP MIB II system group, there are a number of DisplayString OIDs.
These are all stored in ASCII. (The Internet standard <em>RFC 1213</em>,
"Management Information Base for Network Management of TCP/IP-based internets:
MIB-II", defines MIB II and the system group as well as other groups.)</li>
</ul>
<br>
<br>
</dd>
<dt><strong>password_len</strong></dt>
<dd>(Input) The length (in bytes) of an optional password. For the iSeries
server agent, subagents do not need to supply a password. If not, then a zero
length may be specified.<br>
<br>
</dd>
<dt><strong>password_p</strong></dt>
<dd>(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.</dd>
</dl>
<br>
<h3>Return Value</h3>
<table cellpadding="5">
<!-- cols="10 90" -->
<tr>
<td align="left" valign="top"><em>value</em></td>
<td align="left" valign="top">The value returned is a pointer to the DPI
packet.
<p>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 <strong>DPI_PACKET_LEN()</strong> function can be used to
calculate the total length of the DPI packet.</p>
</td>
</tr>
<tr>
<td align="left" valign="top">NULL</td>
<td align="left" valign="top">If unsuccessful, then a NULL pointer is
returned.</td>
</tr>
</table>
<p>Be aware that the static buffer for the DPI packet is shared by other
mkDPI<em>xxxx</em>() functions that create a serialized DPI packet.</p>
<p>For more information, see "SNMP Subagent Problem Determination" in the <a
href="../books/sc415412.pdf" target="_blank">Simple Network Management
Protocol</a> <img src="wbpdf.gif" alt="Link to PDF"> book.</p>
<br>
<h3>Usage Notes</h3>
<p>The <strong>mkDPIopen()</strong> function creates a serialized DPI OPEN
packet that can then be sent to the SNMP agent.</p>
<p>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
<strong>&lt;qtossapi.h&gt;</strong>. Following receipt of this response packet,
the subagent will need to call the <strong>pDPIpacket()</strong> to parse this
DPI packet. The error_code should be checked.</p>
<p>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 <strong>fDPIparse()</strong>
function would normally be called after that to free the parsed DPI response
packet. For information about saAllowDuplicateIDs, see "SNMP Subagent MIB" in
the <a href="../books/sc415412.pdf" target="_blank">Simple Network
Management Protocol</a> <img src="wbpdf.gif" alt="Link to PDF"> book.</p>
<br>
<h3>Related Information</h3>
<ul>
<li>The &lt;<strong>qtossapi.h</strong>&gt; file (see <a href="unix13.htm">Header
Files for UNIX-Type Functions</a>)<br>
<br>
</li>
<li><a href="dlensnmp.htm">DPI_PACKET_LEN()</a>--Get Length of DPI Packet<br>
<br>
</li>
<li><a href="fparsnmp.htm">fDPIparse()</a>--Free Storage from DPI Packet
Parse<br>
<br>
</li>
<li><a href="ppacsnmp.htm">pDPIpacket()</a>--Parse a DPI Packet</li>
</ul>
<br>
<h3>Example</h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<pre>
#include &lt;qtossapi.h&gt;
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. */
}
</pre>
<br>
<hr>
API introduced: V3R6
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> |
<a href="unix.htm">UNIX-Type APIs</a> |
<a href="aplist.htm">APIs by category</a> </td>
</tr>
</table></center>
</body>
</html>