On 11/15/2010 01:26 PM, Timo Teräs wrote:
> I personally would favor option C. That would minimize amount of
> temporary containers, and keep data in one place. It would also get rid
> of most duplicate code. However, it removes some of the abstraction that
> is currently in place (but do we really need it?).

I started working on this. I mostly have the netlink code ready, and
were about to fix the mib code. However, it turns out the files I almost
edited are fully autogenerated.

The problem is that the function:
int inetNetToMediaTable_container_load(netsnmp_container *container)

Gets only container, and I can't associate my context data with it
easily. This is called from inetNetToMediaTable_interface.c which says
in big letters "NOT USER EDITABLE CODE". So I can't modify the proto
type either.

So I should either modify mib2c to allow passing additional data with
it, or make inetNetToMediaTable not use mib2c anymore. Either does not
sound nice.

However, my final idea is to have inetNetToMediaTable_container_init()
return a custom container that has data for the contained container, and
the state needed for my dynamic updates. It'd also need wrappers for
making the outer container forward all calls to the inner container.
It's also possible to generalize the "container with container-and-data"
with some pointer trickery (see container_of macro in linux kernel).

Would this sound like a reasonable approach?

- Timo

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to