Syntax
#include <snmp_dpi.h> int DPIsend_packet_to_agent( /* send a DPI packet */ int handle, /* on this connection */ unsigned char *message_p, /* ptr to the packet data */ unsigned long length); /* length of the packet */
Parameters
handle
Return Values
If successful, a zero (DPI_RC_noError) is returned.
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 DPIsend_packet_to_agent() function is used at the subagent side to send a DPI packet to the DPI capable SNMP agent.
Examples
#include <snmp_dpi.h> int handle;
unsigned char *pack_p;
handle = DPIconnect_to_agent_TCP("localhost", "public");
if (handle < 0) {
printf("Error %d from connect\n",handle);
exit(1);
} /* endif */
pack_p = mkDPIopen("1.3.6.1.2.3.4.5",
"Sample DPI subagent"
0L,2L,,DPI_NATIVE_CSET,
0,(char *)0);
if (pack_p) {
rc = DPIsend_packet_to_agent(handle,pack_p,
DPI_PACKET_LEN(pack_p));
if (rc) {
printf("Error %d from await packet\n");
exit(1);
} /* endif */
} else {
printf("Can't make DPI OPEN packet\n");
exit(1);
} /* endif */
/* await the response */
Related Information