mkDPItrap()--Make a DPI Trap Packet
Syntax
#include <qtossapi.h> unsigned char *mkDPItrap( long int generic, long int specific, snmp_dpi_set_packet *packet_p, char *enterprise_p );
Service Program Name: QTOSSAPI
Default Public Authority: *USE
Threadsafe: No
The mkDPItrap() function makes a DPI™ trap packet and returns a pointer to the packet.
Authorities and Locks
None.
Parameters
- generic
- (Input) The generic trap type. The range of this value is 0 through 6,
where 6 (enterpriseSpecific) is the type that is probably used most by DPI
subagent programmers. The values 0 through 5 are well-defined standard SNMP
traps.
- specific
- (Input) The (enterprise) specific trap type. This can be any value that is
valid for the Management Information Base (MIB) subtrees that the subagent
implements.
- packet_p
- (Input) A pointer to a chain of snmp_dpi_set_structures that represents the
varbinds to be passed with the trap. This partial structure will be freed by
the mkDPItrap() function; therefore, you cannot refer to it anymore on
completion of the call. A NULL pointer means that there are no varbinds to be
included in the trap.
- enterprise_p
- (Input) A pointer to a NULL-terminated character string that represents the
enterprise ID (OBJECT IDENTIFIER) for which this trap is defined. A NULL
pointer can be used. In this case, the subagent Identifier as passed in the DPI
OPEN packet will be used when the agent receives the DPI TRAP packet.
Note: This OID must not end in a period (.).
Return Value
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. |
Be aware that the static buffer for the DPI packet is shared by other mkDPIxxxx() functions that create a serialized DPI packet.
For more information, see the Simple Network Management Protocol (SNMP) Support manual.
Usage Notes
The mkDPItrap() function is used at the subagent side to prepare a DPI TRAP packet. The resulting packet can be sent to the SNMP agent.
Unnecessary free operations may result in an MCH6902 (type 2). If this occurs, remove the call to fDPIset().
Related Information
- The <qtossapi.h> file (see Header
Files for UNIX®-Type Functions)
- DPI_PACKET_LEN()--Get Length of DPI Packet
Example
Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
#include <qtossapi.h> unsigned char *pack_p; snmp_dpi_set_packet *set_p; long int num; 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 = mkDPItrap(6,1,set_p, (char *)0); if (pack_p) { /* Send packet to subagent. */ } }
API introduced: V3R6