Syntax
#include <snmp_dpi.h> unsigned char *mkDPIopen( /* Make a DPI open packet */ char *oid_p, /* subagent Identifier (OID) */ char *description_p, /* subagent descriptive name */ unsigned long timeout, /* requested default timeout */ unsigned long max_varBinds, /* max varBinds per DPI ndle */ char character_set, /* selected character set */ #define DPI_NATIVE_CSET 0 /* 0 = native character set */ #define DPI_ASCII_CSET 1 /* 1 = ASCII character set */ unsigned long password_len, /* length of password (if any)*/ unsigned char *password_p); /* ptr to password (if any) */
Parameters
oid_p
If a value of zero is specified, the agent will try to combine up to as many varBinds as are present in the SNMP packet and belong to the same sub-tree. For example, a value of zero means no limit.
DPI_NATIVE_CSET
Return Values
If successful, a pointer to a static DPI packet buffer is returned. The first two bytes of the buffer in network byte order contain the length of the remaining packet. The macro DPI_PACKET_LEN can be used to calculate the total length of the DPI packet.
If failure, a NULL pointer is returned.
Note: The static buffer for the DPI packet is shared by other mkDPIxxxx() functions that create a serialized DPI packet.
Description
The mkDPIopen() function creates a serialized DPI OPEN packet that can then be sent to the DPI peer which is a DPI capable SNMP agent.
Normally you will want to use the native character set, which is the easiest for the subagent programmer. However, if the agent and subagent each run on their own platform and those platforms use different native character sets, you must select the ASCII character set, so that you both know exactly how to represent string-based data that is being send back and forth.
Currently you do not need to specify a password to connect to the OS/2 SNMP agent. Therefore, you can pass a length of zero and a NULL pointer for the password.
Examples
#include <snmp_dpi.h> unsigned char *pack_p;
pack_p = mkDPIopen("1.3.6.1.2.3.4.5",
"Sample DPI subagent"
0L,2L, DPI_NATIVE_CSET, /* max 2 varBinds */
0,(char *)0);
if (pack_p) {
/* send packet to the agent */
} /* endif */
Related Information