Difference between revisions of "Library layering"

From Net-SNMP Wiki
Jump to: navigation, search
(Problem)
(References)
Line 55: Line 55:
 
==References==
 
==References==
  
* [http://www.net-snmp.org/support/irc/net-snmp.log.2006-10-19.html 2006-10-19 #net-snmp IRC log]
+
* [http://www.net-snmp.org/support/irc/net-snmp.log.2006-10-19.html 2006-10-19 #net-snmp IRC log] (starting at 07:12:29)
 
* Bug [http://sf.net/support/tracker.php?aid=1565496 #1565496]: library layering violation
 
* Bug [http://sf.net/support/tracker.php?aid=1565496 #1565496]: library layering violation
 
* Bug [http://sf.net/support/tracker.php?aid=1619827 #1619827]: building with --as-needed is broken
 
* Bug [http://sf.net/support/tracker.php?aid=1619827 #1619827]: building with --as-needed is broken

Revision as of 09:21, 8 January 2007

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:

Critical dependency Symbol/function referencing source file/function (under agent/) Comment
agent -> mibs make_tempfile  ? move
agent -> helpers netsnmp_init_helpers snmp_vars.c:init_agent()  ?
agent -> helpers netsnmp_register_null agent_registry.c  ?
agent -> helpers netsnmp_register_null_context agent_registry.c  ?
agent -> helpers netsnmp_register_old_api agent_registry.c  ?
agent -> helpers netsnmp_bulk_to_next_fix_requests mibgroup/agentx/master.c  ?
agent -> helpers netsnmp_get_bulk_to_next_handler mibgroup/agentx/master.c  ?

Discussion

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. That's like it effectively already is today, but it lowers the chance to ever sort it out.

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, though.

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

Proposal

  • rework Makefiles to build libnetsnmp, libnetsnmpagent, libnetsnmphelpers and libnetsnmpmibs in that order (done for MAIN)
  • rework Makefiles/configure to fullfil internal and external library dependencies correctly
  • move:
    • make_tempfile from libnetsnmpmibs to libnetsnmpagent
    • ...
  • ...

References