pDPIpacket()--Parse a DPI Packet


  Syntax
 #include <qtossapi.h>

 snmp_dpi_hdr  *pDPIpacket( unsigned char *packet_p );  


  Service Program Name: QTOSSAPI

  Default Public Authority: *USE

  Threadsafe: No

The pDPIpacket() function parses a serialized Distributed Protocol Interface (DPI) packet to make it available for processing by the subagent.


Authorities and Locks

None.


Parameters

packet_p
(Input) A pointer to a serialized (incoming) DPI packet.

Return Value

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 the Simple Network Management Protocol (SNMP) SupportLink to PDF manual.


Usage Notes

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.


Related Information


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_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) {
        ...
        }
  }


API introduced: V3R6

[ Back to top | UNIX-Type APIs | APIs by category ]