200 lines
5.8 KiB
HTML
200 lines
5.8 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>mkDPIresponse()--Make a DPI Response 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. -->
|
|
<!-- 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>mkDPIresponse()--Make a DPI Response Packet</h2>
|
|
|
|
<div class="box" style="width: 60%;">
|
|
<br>
|
|
Syntax<br>
|
|
<pre>
|
|
#include <qtossapi.h>
|
|
|
|
unsigned char *mkDPIresponse(
|
|
snmp_dpi_hdr <em>*hdr_p</em>,
|
|
long int <em>error_code</em>,
|
|
long int <em>error_index</em>,
|
|
snmp_dpi_set_packet <em>*packet_p</em> );
|
|
|
|
</pre>
|
|
|
|
<br>
|
|
Service Program Name: QTOSSAPI<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Default Public Authority: *USE<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Threadsafe: No<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
</div>
|
|
|
|
<p>The <strong>mkDPIresponse()</strong> function makes a DPI response 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>hdr_p</strong></dt>
|
|
|
|
<dd>(Input) A pointer to the snmp_dpi_hdr structure of the DPI request to which
|
|
this DPI packet will be the response. The function uses this structure to copy
|
|
the packet_id and the DPI version and release so that the DPI packet is
|
|
correctly formatted as a response.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>error_code</strong></dt>
|
|
|
|
<dd>(Input) The error code from the <strong><qtossapi.h></strong>
|
|
file.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>error_index</strong></dt>
|
|
|
|
<dd>(Input) The first varbind in error. Counting starts at 1 for the first
|
|
varbind. This field should be zero if there is no error.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>packet_p</strong></dt>
|
|
|
|
<dd>(Input) A pointer to a chain of snmp_dpi_set_packet structures. This
|
|
partial structure will be freed by the mkDPIresponse() function. Therefore, on
|
|
return, you cannot refer to it anymore. Pass a NULL pointer if there are no
|
|
varbinds to be returned.</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"><em>NULL</em></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 book
|
|
<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>mkDPIresponse()</strong> function is used by a subagent to
|
|
prepare a DPI RESPONSE packet to a GET, GETNEXT, SET, COMMIT, or UNDO request.
|
|
The resulting packet can be sent to the SNMP agent.</p>
|
|
|
|
<p>Unnecessary free operations may result in an MCH6902 (type 2). If this
|
|
occurs, remove the call to <strong>fDPIset()</strong>.</p>
|
|
|
|
<br>
|
|
<h3>Related Information</h3>
|
|
|
|
<ul>
|
|
<li>The <<strong>qtossapi.h</strong>> 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</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 <qtossapi.h>
|
|
unsigned char *pack_p;
|
|
snmp_dpi_hdr *hdr_p;
|
|
snmp_dpi_set_packet *set_p;
|
|
long int num;
|
|
|
|
hdr_p = pDPIpacket(pack_p); /* Parse incoming packet. */
|
|
/* Assume it's in pack_p. */
|
|
if (hdr_p) {
|
|
/* Analyze packet, assume GET, no error. */
|
|
set_p = mkDPIset(snmp_dpi_set_packet_NULL_p,
|
|
"1.3.6.1.2.3.4.5.", "1.0",
|
|
SNMP_TYPE_Integer32,
|
|
sizeof(num), &num);
|
|
if (set_p) {
|
|
pack_p = mkDPIresponse(hdr_p,
|
|
SNMP_ERROR_noError, 0L, set_p);
|
|
if (pack_p) {
|
|
/* Send packet to subagent. */
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
</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>
|
|
|