Of MIB trees and universes with a time dimension
Ian Bruene
ianbruene at gmail.com
Sun Nov 5 19:29:21 UTC 2017
In my report during last night's mailing list storm I mentioned needing
to change the architecture of ntpsnmpd slightly. This email is a
description of how it works now for
updation/clarification/documentation/sanity checkification purposes.
In ntpsnmpd there is a class which manages the MIB tree (and currently
data retrieval as well), the tree itself takes the form of a series of
nested dicts with each dict-key forming part of an OID name. Previously
each node consisted of a tuple with the callback for read/write, and the
nested dict for that branch of the tree. I defined it as a tree because
it made some things easier to define, and reduces the chance of
accidentally forgetting an entry or mis-ordering them, during init the
manager class would then flatten the tree down to a list for ease of
search. This worked fine so long as the tree never changed, and since I
didn't understand how sequences are implemented in MIB trees I worked
with that assumption. That assumption was false.
Now each node consists of a dict with the keys "static", "callback",
"subids". If "static"==True it behaves as before: "subids" contains the
child nodes of the tree, and "callback" contains the data read/write
function. However if "static"==False "subids" contains a function which
is called by the new walkMIBTree generator to build that part of the
tree on the fly (which is more elegant even for static trees than the
code it replaced). From the perspective of the calling code everything
works as before: call functions to get an OID, and it returns whatever
one is necessary.
Since most parts of the MIB are static it is still useful to have the
Dicts of Doom, and then splice in the dynamic entries exactly when needed.
--
/"In the end; what separates a Man, from a Slave? Money? Power? No. A
Man Chooses, a Slave Obeys."/ -- Andrew Ryan
/"Utopia cannot precede the Utopian. It will exist the moment we are fit
to occupy it."/ -- Sophia Lamb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20171105/159054a9/attachment.html>
More information about the devel
mailing list