varbind(3snmp)


varbind: free_varbind_list, link_varbind, make_varbind, print_varbind_list -- operations on variable bindings

Synopsis

#include <snmp/snmp.h>

void free_varbind_list(struct type_SNMP_VarBindList *vbl_ptr);

void link_varbind(PDU *pdu_ptr, VarBindList *vbl_ptr);

VarBindList *make_varbind(OID oid_ptr, short type, unsigned long ul_value, long sl_value, OctetString *os_value, OID oid_value);

#include <snmp/snmp.h> #include <snmp/snmpuser.h>

void print_varbind_list(VarBind *vbl_ptr);

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(3snmp)) by adding the VarBindList entry created by a call to make_varbind). 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 to associate this VarBindList with a PDU. The structure is freed when the PDU is freed with a call to free_pdu.

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)

References

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