238 lines
7.4 KiB
HTML
238 lines
7.4 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>mkDPIset()--Make a DPI Set Packet</title>
|
|
<!-- 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. -->
|
|
<!-- Begin Header Records ========================================== -->
|
|
<!-- Direct1 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
|
|
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
|
|
<!--End Header Records -->
|
|
<!-- Edited by Kersten Feb 02 -->
|
|
<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>mkDPIset()--Make a DPI Set Packet</h2>
|
|
|
|
<div class="box" style="width: 50%;">
|
|
<br>
|
|
Syntax<br>
|
|
<pre>
|
|
#include <qtossapi.h>
|
|
|
|
snmp_dpi_set_packet *mkDPIset(
|
|
snmp_dpi_set_packet <em>*packet_p</em>,
|
|
char <em>*group_p</em>,
|
|
char <em>*instance_p</em>,
|
|
int <em>value_type</em>,
|
|
int <em>value_len</em>,
|
|
void <em>*value_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>mkDPIset()</strong> function makes a DPI set structure and adds
|
|
it to a chained list of set structures if previous calls have been made.</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 chain of snmp_dpi_set_packet structures. Pass a NULL
|
|
pointer if this is the first structure to be created. Typically, to handle
|
|
multiple varbinds, this routine will be called repeatedly with this parameter
|
|
having as its value the result returned from the previous call. Each new
|
|
snmp_dpi_set_packet will be chained at the end.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>group_p</strong></dt>
|
|
|
|
<dd>(Input) A pointer to a NULL-terminated character string that represents the
|
|
registered subtree that caused this GET request to be passed to this DPI
|
|
subagent. The subtree must have a trailing dot.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>instance_p</strong></dt>
|
|
|
|
<dd>(Input) A pointer to a NULL-terminated character string that represents the
|
|
rest (the piece following the subtree part) of the OBJECT IDENTIFIER of the
|
|
variable instance being accessed. Use of the term <em>instance_p</em> here
|
|
should not be confused with an OBJECT instance because this instance_p string
|
|
may consist of a piece of the OBJECT IDENTIFIER plus the INSTANCE
|
|
IDENTIFIER.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>value_type</strong></dt>
|
|
|
|
<dd>(Input) The type of the value.
|
|
|
|
<p>See the <strong><qtossapi.h></strong> file for a list of currently
|
|
defined value types.</p>
|
|
</dd>
|
|
|
|
<dt><strong>value_len</strong></dt>
|
|
|
|
<dd>(Input) A signed integer that specifies the length (in bytes) of the value
|
|
pointed to by the value_p parameter. The length may be zero if the value is of
|
|
type SNMP_TYPE_NULL.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>value_p</strong></dt>
|
|
|
|
<dd>(Input) A pointer to the actual value. This parameter may contain a NULL
|
|
pointer if the value is of (implicit or explicit) type SNMP_TYPE_NULL.</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>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>mkDPIset()</strong> function is used at the subagent side to
|
|
prepare a chain of one or more snmp_dpi_set_packet structures. This chain is
|
|
then later used to create a DPI packet, using a call to
|
|
<strong>mkDPIresponse()</strong> or <strong>mkDPItrap()</strong>, which can
|
|
then be sent to an SNMP agent. Each occurrence of an snmp_dpi_set_packet
|
|
corresponds to a varbind in a protocol data unit (PDU).</p>
|
|
|
|
<p>This function is unlike the other subagent APIs that have names beginning
|
|
mkDPI, in that this function does not make a DPI packet that can be sent
|
|
directly. Hence, it returns a pointer to an snmp_dpi_set_packet rather than a
|
|
char * (as do the other mkDPI functions).</p>
|
|
|
|
<p>Note that if the nth (n > 1) call to this function fails for
|
|
some reason, the pointer to the chain of previously built snmp_dpi_set_packet
|
|
structures will be lost unless the caller saves it.</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<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="fsetsnmp.htm">fDPIset()</a>--Free Storage from DPI Set Packet<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="respsnmp.htm">mkDPIresponse(</a>)--Make a DPI Response Packet<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="trapsnmp.htm">mkDPItrap()</a>--Make a DPI Trap 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>
|
|
|