Library layering

From Net-SNMP Wiki
Revision as of 19:33, 7 January 2007 by Tanders (Talk | contribs) (Problem)

Jump to: navigation, search

Problem

The three libraries libnetsnmpmibs, libnetsnmphelpers and libnetsnmpagent have circular dependencies instead of what should be a clean mibs -> helpers -> agent -> main library dependency chain:

  • libnetsnmpmibs depends on libnetsnmphelpers
  • both of these depend on libnetsnmpagent
  • all 3 of these depend on libnetsnmp

There are only a few problematic calls/functions that violate this dependency chain:

  • libagent -> libhelpers:
    • agent_registry.c: register_null, register_null_context and register_old_api
    • snmp_agent.c: bulk_to_next_handler
    • snmp_vars.c: init_helpers

Solutions

The brute-force approach is to move all three mibs/helpers/agent libraries into one huge libagent library again. Downside: even a minimal subagent needs to link in all the mib code which it shouldn't need.

The clever way would be to sensibly restructure the library while maintaining backward-compatibility and not causing too much overhead for agent developers. This needs to be investigated and discussed. Not sure if it's possible at all.

See the references below for the full discussion and details to date.

References