Syntax
#include <snmp_dpi.h> int DPIawait_packet_from_agent( /* await a DPI packet */ int handle, /* on this connection */ int timeout, /* timeout in seconds */ unsigned char **message_p, /* receives ptr to data */ unsigned long *length); /* receives length of data */
Parameters
handle
Return Values
If successful, a zero (DPI_RC_noError) is returned. The buffer pointer and length of the caller will be set to point to the received DPI packet and to the length of that packet.
If failure, a negative integer is returned. It indicates the kind of error that occurred. See Return Codes from DPI Transport-Related Functions for a list of possible error codes.
Description
The DPIawait_packet_from_agent() function is used at the subagent side to await a DPI packet from the DPI capable SNMP agent. The programmer can specify how long to wait.
Examples
#include <snmp_dpi.h> int handle;
unsigned char *pack_p;
unsigned long length;
handle = DPIconnect_to_agent_TCP("localhost", "public");
if (handle < 0) {
printf("Error %d from connect\n",handle);
exit(1);
} /* endif */
/* do useful stuff */
rc = DPIawait_packet_from_agent(handle, -1,
&pack_p, &length);
if (rc) {
printf("Error %d from await packet\n");
exit(1);
} /* endif */
/* handle the packet */
Related Information