#include <qtossapi.h> snmp_dpi_hdr *pDPIpacket( unsigned char *packet_p );
The pDPIpacket() function parses a serialized Distributed Protocol Interface (DPI) packet to make it available for processing by the subagent.
None.
pointer value | The pDPIpacket() function was
successful. The value returned is a pointer to the DPI packet.
If successful, a pointer to the snmp_dpi_hdr structure is returned. Storage for the structure has been dynamically allocated, and it is the caller's responsibility to free it when no longer needed. You can use the fDPIparse() function to free the structure. |
NULL | The pDPIpacket() function was
not successful.
If unsuccessful, a NULL pointer is returned. |
For more information, see "SNMP Subagent Problem Determination" in the Simple Network Management Protocol (SNMP) Support book.
The pDPIpacket() function parses the buffer that is pointed to by the packet_p parameter. It ensures that the buffer contains a valid DPI packet and that the packet is for a DPI version and release that is supported by the DPI functions in use.
Typical follow-on processing will examine the packet_type in the returned snmp_dpi_hdr, and take various actions to process the various types of DPI packets that may arrive. A subagent would normally expect to handle all the possible DPI packet types listed in <qtossapi.h>, except SNMPv2 types (SNMP_DPI_GETBULK and SNMP_DPI_TRAPV2), and types sent only to SNMP agents (SNMP_DPI_OPEN, SNMP_DPI_REGISTER, SNMP_DPI_TRAP, and SNMP_DPI_INFORM). Note that a close or unregister packet can be sent from an agent to the subagent. And if the subagent receives an are-you-there packet, it should build and send a response packet with the proper error_code.
See Code disclaimer information for information pertaining to code examples.
#include <qtossapi.h> unsigned char *pack_p; snmp_dpi_hdr *hdr_p; hdr_p = pDPIpacket(pack_p); /* Parse incoming packet. */ /* Assume it's in pack_p. */ if (hdr_p) { /* Analyze packet, and handle it. */ switch( hdr_p->packet_type) { ... } }
Top | UNIX-Type APIs | APIs by category |