SNMP_VARS(3)SNMP_VARS(3)NAME
snmp_var_new, snmp_var_clone, snmp_var_free, snmp_var_EncodeVarBind,
snmp_var_DecodeVarBind - SNMP Variable List Operations
SYNOPSIS
cc [ flag ... ] file ... -lsnmp [ library ... ]
#include <sys/types.h>
#include <snmp/snmp.h>
struct variable_list *snmp_var_new(oid * Name, int NameLen);
struct variable_list *snmp_var_clone(struct variable_list * Src);
void snmp_var_free(struct variable_list * Ptr);
u_char *snmp_var_EncodeVarBind(u_char * Buf, int * BufLenP, struct
variable_list * VarList, int Version);
u_char *snmp_var_DecodeVarBind(u_char * Buf, int * BufLenP, struct
variable_list ** VarListP, int Version);
STRUCTURE
The variable_list structure is:
struct variable_list *next_variable;/* Next variable, or NULL */
oid *name;/* OID of variable */
int name_length;/* OID Length */
u_char type;/* ASN type of variable */
union { /* value of variable */
int *integer;
u_char *string;
oid *objid;
} val;
int val_len;/* Length of variable data */
DESCRIPTIONsnmp_var_new() creates a new variable_list structure representing the
OID Name of length NameLen. If Name is NULL, the name oid will be
empty.
snmp_var_clone() copies the variable_list structure pointed to by Src.
If the next_variable pointer is filled in, it is copied as well, so
both the original and the clone point to the same next variable_list.
snmp_var_free() frees the variable_list pointed to by Ptr. It does
nothing to the variable_list pointed to by next_variable.
snmp_var_EncodeVarBind() and snmp_var_DecodeVarBind() encode and decode
the variable_list structure into/out of the buffer pointed to by Buf.
BufLenP points to the length of space remaining in Buf. Upon success‐
ful completion, these functions return a pointer to the next available
byte in Buf and adjusts BufLenP to reflect the amount of space left in
the buffer after the encoding / decoding. Version indicates what ver‐
sion of SNMP encoding should be used. At this time, this is ignored.
RETURN VALUES
Upon error, all functions (except snmp_var_free() ) return NULL. Oth‐
erwise, the return value is as describe above.
ERRORS
If any of these return unsuccessfully, snmp_api_error() will be set.
NOTES
ASN parsing errors are counted and available via snmpInASNParseErrs(3).
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 ALSOsnmp_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)4th Berkeley Distribution Tue Sep 24 11:13:15 2002SNMP_VARS(3)