#include <qtossapi.h> void fDPIset( snmp_dpi_set_packet *packet_p );
The fDPIset() function frees storage that was previously allocated for snmp_dpi_set_packet structures.
None.
The fDPIset() function is typically used if you must free a chain of one or more snmp_dpi_set_packet structures. This may be the case if you are in the middle of preparing a chain of such structures for a DPI® RESPONSE packet, but then run into an error before you can actually make the response.
If you get to the point where you make a DPI response packet to which you pass the chain of snmp_dpi_set_packet structures, then the mkDPIresponse() function will free the chain of snmp_dpi_set_packet structures. Similarly, if you pass the chain of snmp_dpi_set_packet structures to mkDPItrap() to make a DPI trap request, the storage will be freed.
Unnecessary free operations may result in an MCH6902 (type 2). If this occurs, remove the call to fDPIset().
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; snmp_dpi_set_packet *set_p, *first_p; long int num1 = 0, num2 = 0; /* ... */ /* The subagent was waiting for work from the SNMP agent, and */ /* a message arrives... */ hdr_p = pDPIpacket(pack_p); /* Assume pack_p */ /* analyze packet and assume all OK */ /* points to the */ /* now prepare response; 2 varBinds */ /* incoming packet. */ set_p = mkDPIset(snmp_dpi_NULL_p, /* Create first one */ "1.3.6.1.2.3.4.5.","1.0", /* OID=1, instance=0.*/ SNMP_TYPE_Integer32, sizeof(num1), &num1); if (set_p) { /* If successful, then */ first_p = set_p; /* save pointer to first */ set_p = mkDPIset(set_p, /* chain. Next one */ "1.3.6.1.2.3.4.5.","1.1", /* OID=1, instance=1.*/ SNMP_TYPE_Integer32, sizeof(num2), &num2); if (set_p) { /*If successful, 2nd one */ pack_p = mkDPIresponse(hdr_p, /* makes response. */ SNMP_ERROR_noError, /* It will also free */ 0L, first_p); /* the set_p tree. */ /* Send DPI response to agent. */ } else { /* If 2nd mkDPIset fails, */ fDPIset(first_p); /* it must free chain. */ } }