[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

snmpconf Policy MIB: varbinds



In my other emails, I have proposed enhancements that would make the 
language described in the MIB (slightly) less C-like. In this message, I 
will do the reverse. I think that the readVarbind(), writeVarbind() and 
send() functions as proposed in the October 11th draft are decidedly unlike 
C.  They propose a mysterious two-dimensional nameless array of varbinds 
that are accessed using the writeVarbind and readVarbind functions. The 
individual varbind lists are referenced by numbers instead of by name. 
Shades of FORTAN 68 (or worse) loom large. It is also unclear whether this 
mysterious array is global or local.

My proposal: Declare varbind lists as (named) variables:

varbind_list  getstuff;
append(getstuff, "1.2.3.4.5.6.7");
append(getstuff, "1.2.3.4.5.7.7");
snmpget(getstuff);
string val1 = find_oid(getstuff, "1.2.3.4.5.6.7");

varbind_list setstuff;
append(setstuff, "1.2.3.4.5.6.7", "Hello world");
snmpset(setstuff);

varbind_list walkstuff;
append(walkstuff, "1.2.3.4.55.6");
append(walkstuff, "1.2.3.4.55.7");
while (snmpgetnext(walkstuff))
{
   oid0 = lookup_oid(walkstuff, 0);
   val0 = lookup_value(walkstuff, 0);
   oid0 = lookup_oid(walkstuff, 1);
   val0 = lookup_value(walkstuff, 1);
}

In brief:

- varbind_list would be an intrinsic type.
- append(varbind_list, oid [, value ]) appends a varbind to the list. It 
replaces writeVarbind(). Note that the type need not be specified because 
it is implied by the Oid.
- snmpget(), snmpset(), snmpgetnext(), etc. are separate functions that 
replace the generic snmpsend() function. It is not essetial that we do this.
- find_oid() and lookup_value() would replace readVarbind(). find_oid() 
finds an oid in a varbind list by oid name and returns its value. 
lookup_oid() and lookup_value() return the components of a varbind in the 
nth position in the varbind list.

- Pablo
---------------------------------------------------------------------
Pablo Halpern                                    phalpern@newview.org
http://www.halpernwightsoftware.com