varbind(3N) varbind(3N)
NAME
free_varbind_list, link_varbind, make_varbind,
print_varbind_list - operations on variable bindings.
SYNOPSIS
#include <snmp/snmp.h>
void free_varbind_list(vbl_ptr) struct type_SNMP_VarBindList
*vbl_ptr;
void link_varbind(pdu_ptr, vbl_ptr); PDU
*pdu_ptr; /* the pointer to the PDU header
alloc'ed by make_pdu() */ VarBindList *vbl_ptr; /* pointer
to the VarBindList created by make_varbind() */
VarBindList *make_varbind(oid_ptr, type, ul_value, sl_value,
os_value, oid_value) OID oid_ptr short type; /*
variable type: INTEGER_TYPE, OBJECT_ID_TYPE values */ unsigned
long ul_value; /* COUNTER_TYPE, GAUGE_TYPE values */
long sl_value; /* INTEGER_TYPE, TIME_TICKS_TYPE
values */ OctetString *os_value; /* OCTET_PRIM_TYPE,
IP_ADDR_PRIM_TYPE, etc. values */ OID
oid_value; /* OBJECT_ID_TYPE value */
#include <snmp/snmp.h> #include <snmp/snmpuser.h>
void print_varbind_list(vbl_ptr) VarBind *vbl_ptr; /* pointer
to a VarBind List */
DESCRIPTION
free_varbind_list frees all memory associated with the
variable bindings, including the name and the value of each
one of them.
link_varbind completes a PDU (created by a call to
make_pdu(3)) by adding the VarBindList entry created by a call
to make_varbind(3). link_varbind should be called exactly
once for each vbl_ptr being associated with a PDU, as this
association is used to reclaim memory when the PDU is freed.
make_varbind is called to create a VarBindList entry to be
chained onto a PDU. It returns a pointer to a malloc'ed data
structure of type VarBind. Usually, this pointer is then used
in a call to link_varbind(3) to associate this VarBindList
with a PDU. The structure is freed when the PDU is freed with
a call to free_pdu(3).
Copyright 1994 Novell, Inc. Page 1
varbind(3N) varbind(3N)
A VarBindList is a variable-value binding. It binds the name,
the type, and the value of a variable into one construct. The
current list of SNMP types and the value type associated with
each is:
COUNTER_TYPE: uses ul_value
GAUGE_TYPE: uses ul_value
INTEGER_TYPE: uses sl_value
TIME_TICKS_TYPE: uses sl_value
OBJECT_ID_TYPE: uses oid_value
OCTET_PRIM_TYPE: uses os_value
OCTET_CONSTRUCT_TYPE: uses os_value
IP_ADDR_PRIM_TYPE: uses os_value
IP_ADDR_CONSTRUCT_TYPE: uses os_value
OPAQUE_PRIM_TYPE: uses os_value
OPAQUE_CONSTRUCT_TYPE: uses os_value
NULL_TYPE: no passed value needed
print_varbind_list prints out the contents of a VarBindList
list in a human-readable form. This is a quick user interface
for printing out the SNMP responses in simple SNMP utilities.
If the PDU structure is pointed to by a *pdu_ptr, the call is:
print_varbind_list(pdu_ptr->var_bind_list)
SEE ALSO
octetstring(3N), oid(3N), snmp_authentication(3N),
snmp_pdu(3N).
Copyright 1994 Novell, Inc. Page 2