|
|
#include <snmp/snmpio.h>void initialize_io(char program_name, char name);
int send_request(int socket, AuthHeader auth_pointer);
int get_response(int seconds);
int close_up();
int make_req_id();
send_request is invoked by the applications which wish to send an SNMP request to the agent (whose address and port have been initialized by the routine initialize_io). The argument socket must refer to the global variable fd.
get_response is invoked by an application waiting to receive a response from the agent to which it sent a query. It uses the global file descriptor fd to receive incoming SNMP messages. The received message and its length are stored in the global variables packet and packet_len respectively, which can be accessed later by the application. If get_response fails to receive a response within the number of seconds specified by the application, it returns with a TIMEOUT. The management application may re-try the operation, if necessary.
close_up is invoked by the management applications to close the UDP end-point (the global variable fd ) when they exit (error or otherwise).
make_req_id generates a positive number using the current value of time of the day. This number is used by SNMP applications in the request-id of the field of the PDU which they generate.