[asterisk-dev] [Code Review] Add 'optional API' support to eliminate need for registration of loadable APIs
Kevin Fleming
kpfleming at digium.com
Wed Nov 26 14:33:47 CST 2008
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/62/
-----------------------------------------------------------
(Updated 2008-11-26 14:33:47.042796)
Review request for Asterisk Developers.
Changes
-------
optional_api.h is now included in the diff. all AGI API calls are now documented. all AGI API calls are optional now, since we can't rely on lazy symbol resolution with all linkers. app_stack no longer has to 'remember' whether it registered with AGI or not, since ast_agi_unregister() will do the right thing in all cases.
Summary
-------
On systems where GCC provides both weak symbols and symbol aliases (pretty widely available), use a combination of them to provide automatically used (or avoided) stub functions for loadable APIs. This patch includes usage of this technique for ast_agi_register() only, but the technique could be used for all loadable APIs (res_musiconhold, res_adsi, res_odbc, etc).
This technique allows the consumer of the API to safely tell whether any module providing the API has been loaded or not, and then tailor its operation to take that result into account. For app_stack, this means it can optionally register its AGI command; for other modules that depend on the loadable API, they could issue an appropriate error message and safely exit when the loadable API is not present.
Diffs (updated)
-----
/trunk/apps/app_stack.c 159571
/trunk/autoconf/ast_gcc_attribute.m4 159571
/trunk/configure.ac 159571
/trunk/contrib/asterisk-ng-doxygen 159571
/trunk/include/asterisk/agi.h 159571
/trunk/include/asterisk/autoconfig.h.in 159571
/trunk/include/asterisk/optional_api.h PRE-CREATION
/trunk/res/res_agi.c 159571
Diff: http://reviewboard.digium.com/r/62/diff
Testing
-------
Compile testing
Thanks,
Kevin
More information about the asterisk-dev
mailing list