snmpio_api: initialize_io, send_request, get_response, close_up, make_req_id -- SNMP management routines


#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();


initialize_io opens a UDP end-point and sets the receiving address and other data associated with the application (including setting up a signal handler to handle SIGALRM). If this routine fails for any reason, the management application exits. The file descriptor associated with the UDP end-point is the global variable fd, which is used by management applications to send/receive SNMP messages. The program_name argument is the name of the SNMP application invoking the function, while name is the name/network address of the machine.

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.


snmp_authentication(3snmp), snmp_pdu(3snmp)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004