#include <qtossapi.h>
snmp_dpi_set_packet *mkDPIset(
snmp_dpi_set_packet *packet_p,
char *group_p,
char *instance_p,
int value_type,
int value_len,
void *value_p );
The mkDPIset() function makes a DPI set structure and adds it to a chained list of set structures if previous calls have been made.
None.
See the <qtossapi.h> file for a list of currently defined value types.
| value | The value returned is a pointer to the DPI
packet.
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 DPI_PACKET_LEN() function can be used to calculate the total length of the DPI packet. |
| NULL | If unsuccessful, then a NULL pointer is returned. |
For more information, see "SNMP Subagent Problem Determination" in the Simple Network Management
Protocol
book.
The mkDPIset() 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 mkDPIresponse() or mkDPItrap(), 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).
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).
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.
See Code disclaimer information for information pertaining to code examples.
#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. */
}
}
| Top | UNIX-Type APIs | APIs by category |