The pDPIpacket() function

Format

#include <snmp_dpi.h>
 
snmp_dpi_hdr *pDPIpacket(unsigned char *packet_p);

Parameters

packet_p
A pointer to a serialized DPI packet.

Return codes

  • If successful, a pointer to a DPI parse tree (snmp_dpi_hdr) is returned. Memory for the parse tree has been dynamically allocated, and it is the callers responsibility to free it when no longer needed. You can use the fDPIparse() function to free the parse tree.
  • If not successful, a NULL pointer is returned.

Usage

The pDPIpacket() function parses the buffer 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.

Examples

  #include <snmp_dpi.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 */
  }

Context