Difference between revisions of "Library layering"
(→Solutions) |
|||
Line 9: | Line 9: | ||
There are only a few problematic calls/functions that violate this dependency chain: | There are only a few problematic calls/functions that violate this dependency chain: | ||
− | * | + | * agent -> helpers: |
** agent_registry.c: register_null, register_null_context and register_old_api | ** agent_registry.c: register_null, register_null_context and register_old_api | ||
** snmp_agent.c: bulk_to_next_handler | ** snmp_agent.c: bulk_to_next_handler | ||
** snmp_vars.c: init_helpers | ** snmp_vars.c: init_helpers | ||
− | == | + | * agent -> mibs |
+ | ** make_tempfile | ||
+ | ==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 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. | ||
Line 21: | Line 23: | ||
See the references below for the full discussion and details to date. | 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 (tanders has a working draft version) | ||
+ | * rework Makefiles/configure to fullfil internal and external library dependencies correctly | ||
+ | * move: | ||
+ | ** make_tempfile from libnetsnmpmibs to libnetsnmpagent | ||
+ | ** ... | ||
+ | * ... | ||
==References== | ==References== |
Revision as of 22:40, 7 January 2007
Contents
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:
- agent -> helpers:
- agent_registry.c: register_null, register_null_context and register_old_api
- snmp_agent.c: bulk_to_next_handler
- snmp_vars.c: init_helpers
- agent -> mibs
- make_tempfile
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 (tanders has a working draft version)
- rework Makefiles/configure to fullfil internal and external library dependencies correctly
- move:
- make_tempfile from libnetsnmpmibs to libnetsnmpagent
- ...
- ...
References
- 2006-10-19 #net-snmp IRC log
- Bug #1565496: library layering violation
- Bug #1619827: building with --as-needed is broken