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

175 lines
5.3 KiB
HTML
Raw 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>pDPIpacket()--Parse a DPI 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>pDPIpacket()--Parse a DPI Packet</h2>
<div class="box" style="width: 80%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;qtossapi.h&gt;
snmp_dpi_hdr *pDPIpacket( unsigned char *<em>packet_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>pDPIpacket()</strong> function parses a serialized Distributed
Protocol Interface (DPI) packet to make it available for processing by the
subagent.</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>packet_p</strong></dt>
<dd>(Input) A pointer to a serialized (incoming) DPI packet.</dd>
</dl>
<br>
<h3>Return Value</h3>
<table cellpadding="5">
<!-- cols="15 85" -->
<tr>
<td align="left" valign="top" nowrap><em>pointer value</em></td>
<td align="left" valign="top">The <strong>pDPIpacket()</strong> function was
successful. The value returned is a pointer to the DPI packet.
<p>If successful, a pointer to the snmp_dpi_hdr structure is returned. Storage
for the structure has been dynamically allocated, and it is the caller's
responsibility to free it when no longer needed. You can use the
<strong>fDPIparse()</strong> function to free the structure.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>NULL</em></td>
<td align="left" valign="top">The <strong>pDPIpacket()</strong> function was
not successful.
<p>If unsuccessful, a NULL pointer is returned.</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 (SNMP) Support</a> <img src="wbpdf.gif" alt="Link to PDF"> book.</p>
<br>
<h3>Usage Notes</h3>
<p>The <strong>pDPIpacket()</strong> function parses the buffer that is pointed
to by the <em>packet_p</em> parameter. It ensures that the buffer contains a
valid DPI packet and that the packet is for a DPI version and release that is
supported by the DPI functions in use.</p>
<p>Typical follow-on processing will examine the packet_type in the returned
snmp_dpi_hdr, and take various actions to process the various types of DPI
packets that may arrive. A subagent would normally expect to handle all the
possible DPI packet types listed in <strong>&lt;qtossapi.h&gt;</strong>, except
SNMPv2 types (SNMP_DPI_GETBULK and SNMP_DPI_TRAPV2), and types sent only to
SNMP agents (SNMP_DPI_OPEN, SNMP_DPI_REGISTER, SNMP_DPI_TRAP, and
SNMP_DPI_INFORM). Note that a close or unregister packet can be sent from an
agent to the subagent. And if the subagent receives an are-you-there packet, it
should build and send a response packet with the proper error_code.</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="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;
snmp_dpi_hdr *hdr_p;
hdr_p = pDPIpacket(pack_p); /* Parse incoming packet. */
/* Assume it's in pack_p. */
if (hdr_p) {
/* Analyze packet, and handle it. */
switch( hdr_p-&gt;packet_type) {
...
}
}
</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>