SNMP Utilities

Name

SNMP Utilities -- SNMP Utility Wrapper Functions for NET-SNMP calls

Synopsis


#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>


#define     MAX_ASN_STR_LEN
int         snmp_get                        (struct snmp_session *ss,
                                                const char *objid,
                                                struct snmp_value *value);
int         snmp_set                        (struct snmp_session *ss,
                                                char *objid,
                                                struct snmp_value value);

Description

These SNMP wrapper utility functions where created to hide the more complex logic needed to use straight net-snmp calls from plugin developers.

Details

MAX_ASN_STR_LEN

#define                MAX_ASN_STR_LEN 300

snmp_get ()

int    snmp_get        (struct snmp_session *ss,
                         const char *objid,
                         struct snmp_value *value);

Gets a single value indicated by the objectid using snmp. In the case of multiple values being returned, the type in value will be ASN_NULL (0x05). Nothing else in value will be filled in.

ss :

a handle to the snmp session needed to make an snmp transaction.

objid :

string containing the OID entry.

value :

the value received from snmp will be put in this union.

Returns :

0 if successful, -1 if there was an error.

snmp_set ()

int    snmp_set        (struct snmp_session *ss,
                         char *objid,
                         struct snmp_value value);

Sets a value where indicated by the objectid using snmp.

ss :

a handle to the snmp session needed to make an snmp transaction.

objid :

string containing the OID to set.

value :

the value to set the oid with.

Returns :

0 if Success, less than 0 if Failure.