SNMP_MINI_CLIENT(3)

NAME
init_mini_snmp_client, close_mini_snmp_client, snmp_mini_response_len, snmp_mini_open, snmp_mini_close, snmp_mini_set_int, snmp_mini_set_str, snmp_mini_get, snmp_mini_getnext - SNMP Mini Client

SYNOPSIS
cc [ flag ... ] file ... -lsnmp [ library ... ]

#include <sys/types.h>
#include <snmp/snmp.h>

void init_mini_snmp_client(int Size);

void close_mini_snmp_client(void);

int snmp_mini_response_len(int Index);

void *snmp_mini_open(char * Host, int port, char * community);

void snmp_mini_close(void * MiniSession);

int snmp_mini_set_int(char * Host, char *Community, oid * Query, int QueryLen, int Value, void *MiniSession);

int snmp_mini_set_str(char * Host, char *Community, oid * Query, int QueryLen, char * Value, int ValueLen, void *MiniSession);

void **snmp_mini_get(char * Host, char *Community, int NumQueries, oid ** Queries, int * QueryLens, void *MiniSession);

int snmp_mini_getnext(char * Host, char *Community, oid * Query, int QueryLen, oid * ResponseOID, void ** ResponseData, void *MiniSession);

DESCRIPTION
The SNMP mini-client is a quick way to send a few requests to a remote SNMP agent. The client takes care of memory allocation / deallocation for all returned data. The only thing the user must deal with is the specification of what OIDs to fetch.

init_mini_snmp_client() initializes the mini-client. The Size argument must be greater than the max number of items you will fetch during one snmp_mini_client_get() call. This initializes the return array to the appropriate size.

close_mini_snmp_client() Cleans up any memory still in use by the mini-client. Once called, any data that was ever returned by the mini-client, if not copied, is invalid.

snmp_mini_response_len() allows one to fetch the length of the returned data. Index is the index into the returned array of responses.

snmp_mini_open() and snmp_mini_close() allow the user to open and close a connection to a host. While all of the mini-client functions will also do this, by opening the connection first with snmp_mini_open(), the connection may be on an alternate port. Opening the connection once and using it over and over again will also save the overhead of establishing the connection again and again.

snmp_mini_set_int() and snmp_mini_set_str() will send an SNMP SET request to the host specified by Host, using community string Community, setting the OID Query of length QueryLen to Value. MiniSession may be used instead of Host and Community. MiniSession is what is returned by snmp_mini_open().

snmp_mini_get() sends NumQueries SNMP GET requests to Host with community string Community( or uses session MiniSession). The OIDs to fetch are in the array Queries, and the OID lengths are in the array QueryLens. If successful, the returned array contains all of the responses. Returned array index X is the response to Query array index X.

snmp_mini_getnext() sends an SNMP GETNEXT request to Host with community string Community( or uses session MiniSession). The next OID is placed in ResponseOID and it's length is returned. The data pertaining to that oid is pointed to by ResponseData.

ERRORS
If any of these return unsuccessfully, snmp_api_error() will be set.

NOTES
The set commands have not been tested extensively.

RFCS
Related RFCs: 1065, 1066, 1067
Related SNMPv2 RFCs: 1901, 1902, 1902, 1904, 1905, 1906, 1907, 1908, 1909

RELATED URLS
CMU Networking Group: http://www.net.cmu.edu/
CMU SNMP Home Page: http://www.net.cmu.edu/projects/snmp

SEE ALSO
snmp_api(3), snmp_api_errors(3), snmp_client(3), snmp_coexistance(3), snmp_error(3), snmp_extra(3), snmp_mib(3), snmp_mibii(3), snmp_mini_client(3), snmp_msg(3), snmp_packet_dump(3), snmp_pdu(3), snmp_sess_api(3), snmp_vars(3), snmp_version_info(3), snmp_oid(5) snmp(3)