Syntax
#include <snmp_dpi.h> unsigned char *mkDPIAreYouThere(void);
Parameters
Return Values
If successful, a pointer to a static DPI packet buffer is returned. The first two bytes of the buffer in network byte order contain the length of the remaining packet. The macro DPI_PACKET_LEN can be used to calculate the total length of the DPI packet.
If failure, a NULL pointer is returned.
Note: The static buffer for the DPI packet is shared by other mkDPIxxxx() functions that create a serialized DPI packet.
Description
The mkDPIAreYouThere() function creates a serialized DPI ARE_YOU_THERE packet that can be sent to the DPI peer, which is normally the agent.
A subagent connected via TCP probably does not need this function because, normally when the agent breaks the "connection", you will receive an EOF on the file descriptor. For unreliable "connections", like over UDP, this function may be useful to periodically poll the agent and verify that it still knows about the subagent.
If your "connection" to the agent is still healthy, the agent will send a DPI RESPONSE with SNMP_ERROR_DPI_noError in the error code field and zero in the error index field. The RESPONSE will have no varBind data. If your "connection" is not healthy, the agent may send a response with an error indication, or may just not send a response at all.
Examples
#include <snmp_dpi.h> unsigned char *pack_p;
pack_p = mkDPIAreYouThere();
if (pack_p) {
/* send the packet to the agent */
} /* endif */
/* wait for response with DPIawait_packet_from_agent() */
/* normally the response should come back pretty quickly, */
/* but it depends on the load of the agent */
Related Information