Processing a CLOSE Request

An agent can send a CLOSE packet if it encounters an error or for some other reason. It can also do so if an SNMP MANAGER tells it to "invalidate" the subagent connection.

Here is an example of how to handle such a packet.

#include <snmp_dpi.h>           /* DPI 2.0 API definitions */

static int do_close(snmp_dpi_hdr *hdr_p,
                    snmp_dpi_close_packet *pack_p)
{
  printf("DPI CLOSE received from agent, reason=%d\n",
         pack_p->reason_code);

  DPIdisconnect_from_agent(handle);
  return(-1); /* causes exit in main loop */
} /* end of do_close() */


[Back: Processing an UNREGISTER Request]
[Next: Generating a TRAP]