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

250 lines
7.1 KiB
HTML

<!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>receiveDPIpacket()--Receive a DPI Packet from the SNMP Agent</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. -->
<!-- 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>
<a name="Top_Of_Page"></a>
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<h2>receiveDPIpacket()--Receive a DPI Packet from the SNMP Agent</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;qtossapi.h&gt;
int receiveDPIpacket(
sa_dataq_msg <em>*dataq_msg_p</em>,
void <em>*dpi_msg_p</em>,
unsigned long int <em>*length_p</em> );
</pre>
<br>
&nbsp;Service Program Name: QTOSSAPI<br>
<!-- iddvc RMBR -->
<br>
&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;Threadsafe: No<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>receiveDPIpacket()</strong> function obtains a copy of a DPI
packet sent by the SNMP agent to the subagent, and returns the DPI packet to
the caller.</p>
<br>
<h3>Authorities</h3>
<p>Unlike the <strong>waitDPIpacket()</strong> function, this function does not
actually refer to the subagent,s data queue.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong>dataq_msg_p</strong></dt>
<dd>(Input) A pointer to the data queue message that was sent to the subagent
to tell it that a DPI packet is pending. Note that the message must have
already been received from the data queue by the subagent and placed in a
buffer. This is a pointer to that message in the buffer. Use of this function
assumes that the data queue messages are handled directly by the subagent,s own
code. See <strong>waitDPIpacket()</strong> for an alternative.
<p>The sa_dataq_msg structure is defined in the
<strong>&lt;qtossapi.h&gt;</strong> file.</p>
</dd>
<dt><strong>dpi_msg_p</strong></dt>
<dd>(I/O) A pointer to a buffer set up by the subagent that will contain the
DPI serialized packet on successful return from this routine.<br>
<br>
</dd>
<dt><strong>length_p</strong></dt>
<dd>(Output) A pointer to an integer that will contain the length of the DPI
packet contained in the subagent,s buffer on successful return.</dd>
</dl>
<br>
<h3>Return Value</h3>
<p>The return values are defined in the <strong>&lt;qtossapi.h&gt;</strong>
file.</p>
<table cellpadding="5">
<!-- cols="5 95" -->
<tr>
<td align="left" valign="top"><em>0</em></td>
<td align="left" valign="top"><em>snmpsa_RC_ok</em>
<p>The call was successful.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>-1</em></td>
<td align="left" valign="top"><em>snmpsa_RC_err</em>
<p>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.)</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>-2</em></td>
<td align="left" valign="top"><em>snmpsa_RC_noagent</em>
<p>The SNMP agent is not available.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>-3</em></td>
<td align="left" valign="top"><em>snmpsa_RC_mismatch</em>
<p>A previous DPI packet was found. The subagent may want to process this
packet or call <strong>receiveDPIpacket()</strong> again to get the next
packet. See any messages in the job log and correct any errors that are
indicated, then retry the operation.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>-5</em></td>
<td align="left" valign="top"><em>snmpsa_RC_nonagentmsg</em>
<p>The data queue message is not from the SNMP agent. (There is no DPI packet
pending.)</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>-7</em></td>
<td align="left" valign="top"><em>snmpsa_RC_parmerr</em>
<p>A parameter error occurred, probably a null pointer.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>-8</em></td>
<td align="left" valign="top"><em>snmpsa_RC_lengtherr</em>
<p>A parameter was an incorrect length.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>-9</em></td>
<td align="left" valign="top"><em>snmpsa_RC_buffer</em>
<p>Check the job log of the subagent for MCH3802. If found, the problem was
likely due to agent workload, and the subagent can retry the request. If a
different exception is found, see any messages in the job log, correct any
errors that are indicated, and then retry the operation.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>-12</em></td>
<td align="left" valign="top"><em>snmpsa_RC_connectfirst</em>
<p>The subagent must connect to the SNMP agent before making this call.</p>
</td>
</tr>
</table>
<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>receiveDPIpacket()</strong> function obtains a copy of a DPI
packet sent to the subagent. The copy is placed in a buffer owned by the
subagent.</p>
<p>Use of this function by a subagent requires that the subagent programmer
must wait for and receive the prompting message on the subagent,s data queue.
An alternative is to use the <strong>waitDPIpacket()</strong> function, which
handles the data queue for the subagent and also receives the DPI packet.</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="waitsnmp.htm">waitDPIpacket()</a>--Wait for 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;
#define MAX_MSG_SIZE 4096
char dpibuff[MAX_MSG_SIZE],
dataqbuff[80];
int rc, len;
/* Wait for message on data queue. When it arrives... */
QRCVDTAQ( ... )
/* Handle exceptions. */
rc = receiveDPIpacket( &amp;dataqbuff[0],
&amp;dpibuff[0], &amp;len );
if (rc) {
/* Handle exceptions. */
}
</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>