Merged revisions 284610 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 2 Sep 2010 05:27:53 +0000 (05:27 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 2 Sep 2010 05:27:53 +0000 (05:27 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r284610 | tilghman | 2010-09-02 00:20:59 -0500 (Thu, 02 Sep 2010) | 10 lines

  When optional_api is non-optional, force dependent modules to be loaded.

  (closes issue #17707)
   Reported by: ira
   Patches:
         20100819__issue17707__asterisk1.8.diff.txt uploaded by tilghman (license 14)
   Tested by: tilghman

  Review: https://reviewboard.asterisk.org/r/876/
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@284628 65c4cc65-6c06-0410-ace0-fbb531ad65f3

18 files changed:
apps/app_adsiprog.c
apps/app_followme.c
apps/app_getcpeid.c
apps/app_queue.c
apps/app_speech_utils.c
apps/app_stack.c
apps/app_voicemail.c
channels/chan_agent.c
channels/chan_dahdi.c
channels/chan_iax2.c
channels/chan_mgcp.c
channels/chan_sip.c
funcs/func_aes.c
include/asterisk/module.h
main/loader.c
pbx/pbx_dundi.c
pbx/pbx_loopback.c
pbx/pbx_realtime.c

index 8af1473..c138f04 100644 (file)
@@ -1591,4 +1591,8 @@ static int load_module(void)
        return AST_MODULE_LOAD_SUCCESS;
 }
 
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Asterisk ADSI Programming Application");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk ADSI Programming Application",
+               .load = load_module,
+               .unload = unload_module,
+               .nonoptreq = "res_adsi",
+               );
index fcab992..b17d525 100644 (file)
@@ -51,7 +51,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/cli.h"
 #include "asterisk/manager.h"
 #include "asterisk/config.h"
-#include "asterisk/monitor.h"
 #include "asterisk/utils.h"
 #include "asterisk/causes.h"
 #include "asterisk/astdb.h"
index 93df162..2207081 100644 (file)
@@ -132,4 +132,8 @@ static int load_module(void)
        return ast_register_application_xml(app, cpeid_exec);
 }
 
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Get ADSI CPE ID");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Get ADSI CPE ID",
+               .load = load_module,
+               .unload = unload_module,
+               .nonoptreq = "res_adsi",
+               );
index ccdee7f..08167b4 100644 (file)
@@ -57,7 +57,7 @@
  */
 
 /*** MODULEINFO
-       <depend>res_monitor</depend>
+       <use>res_monitor</use>
  ***/
 
 #include "asterisk.h"
@@ -8197,5 +8197,6 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "True Call Queueing",
                .unload = unload_module,
                .reload = reload,
                .load_pri = AST_MODPRI_DEVSTATE_CONSUMER,
+               .nonoptreq = "res_monitor",
               );
 
index 60af436..0323f7c 100644 (file)
@@ -955,4 +955,8 @@ static int load_module(void)
        return res;
 }
 
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Dialplan Speech Applications");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Dialplan Speech Applications",
+               .load = load_module,
+               .unload = unload_module,
+               .nonoptreq = "res_speech",
+               );
index dcf13a0..29c37a2 100644 (file)
@@ -704,4 +704,8 @@ static int load_module(void)
        return 0;
 }
 
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Dialplan subroutines (Gosub, Return, etc)");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Dialplan subroutines (Gosub, Return, etc)",
+               .load = load_module,
+               .unload = unload_module,
+               .nonoptreq = "res_agi",
+               );
index 4ff67e3..5b050e9 100644 (file)
@@ -38,7 +38,8 @@
  */
 
 /*** MODULEINFO
-       <depend>res_smdi</depend>
+       <use>res_adsi</use>
+       <use>res_smdi</use>
  ***/
 
 /*** MAKEOPTS
@@ -13085,4 +13086,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, tdesc,
                .load = load_module,
                .unload = unload_module,
                .reload = reload,
+               .nonoptreq = "res_adsi,res_smdi",
                );
index b8e142d..37a6688 100644 (file)
@@ -32,6 +32,7 @@
  */
 /*** MODULEINFO
         <depend>chan_local</depend>
+        <depend>res_monitor</depend>
  ***/
 
 #include "asterisk.h"
@@ -2484,4 +2485,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Agent Proxy Channel",
                .unload = unload_module,
                .reload = reload,
                .load_pri = AST_MODPRI_CHANNEL_DRIVER,
+               .nonoptreq = "res_monitor,chan_local",
               );
index 14c43f8..25246cd 100644 (file)
@@ -38,7 +38,7 @@
  */
 
 /*** MODULEINFO
-       <depend>res_smdi</depend>
+       <use>res_smdi</use>
        <depend>dahdi</depend>
        <depend>tonezone</depend>
        <use>pri</use>
@@ -17941,4 +17941,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, tdesc,
        .unload = unload_module,
        .reload = reload,
        .load_pri = AST_MODPRI_CHANNEL_DRIVER,
+               .nonoptreq = "res_smdi",
        );
index f038f20..90ae4ee 100644 (file)
@@ -14620,4 +14620,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Inter Asterisk eXchan
                .unload = unload_module,
                .reload = reload,
                .load_pri = AST_MODPRI_CHANNEL_DRIVER,
+               .nonoptreq = "res_crypto",
                );
index a787eab..2f953a9 100644 (file)
@@ -30,7 +30,7 @@
  */
 
 /*** MODULEINFO
-        <depend>res_pktccops</depend>
+        <use>res_pktccops</use>
  ***/
 
 #include "asterisk.h"
@@ -4915,4 +4915,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Media Gateway Control
                .unload = unload_module,
                .reload = reload,
                .load_pri = AST_MODPRI_CHANNEL_DRIVER,
+               .nonoptreq = "res_pktccops",
               );
index 09531f2..432aded 100644 (file)
  */
 
 /*** MODULEINFO
+       <depend>res_crypto</depend>
        <depend>chan_local</depend>
  ***/
 
@@ -28623,4 +28624,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Session Initiation Pr
                .unload = unload_module,
                .reload = reload,
                .load_pri = AST_MODPRI_CHANNEL_DRIVER,
+               .nonoptreq = "res_crypto,chan_local",
               );
index 21ee244..7cc8f4d 100644 (file)
@@ -163,4 +163,8 @@ static int load_module(void)
        return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
 }
 
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "AES dialplan functions");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "AES dialplan functions",
+               .load = load_module,
+               .unload = unload_module,
+               .nonoptreq = "res_crypto",
+       );
index 24f66fc..aaa8cbe 100644 (file)
@@ -242,6 +242,11 @@ struct ast_module_info {
         *  this value will never be read and the module will be given the lowest possible priority
         *  on load. */
        unsigned char load_pri;
+
+       /*! Modules which should be loaded first, in comma-separated string format.
+        * These are only required for loading, when the optional_api header file
+        * detects that the compiler does not support the optional API featureset. */
+       const char *nonoptreq;
 };
 
 void ast_module_register(const struct ast_module_info *);
index 17bb1f8..dea236b 100644 (file)
@@ -414,6 +414,26 @@ static struct ast_module *load_dynamic_module(const char *resource_in, unsigned
                return NULL;
        }
 
+       /* This section is a workaround for a gcc 4.1 bug that has already been
+        * fixed in later versions.  Unfortunately, some distributions, such as
+        * RHEL/CentOS 5, distribute gcc 4.1, so we're stuck with having to deal
+        * with this issue.  This basically ensures that optional_api modules are
+        * loaded before any module which requires their functionality. */
+#if !defined(HAVE_ATTRIBUTE_weak_import) && !defined(HAVE_ATTRIBUTE_weakref)
+       if (!ast_strlen_zero(mod->info->nonoptreq)) {
+               /* Force any required dependencies to load */
+               char *each, *required_resource = ast_strdupa(mod->info->nonoptreq);
+               while ((each = strsep(&required_resource, ","))) {
+                       each = ast_strip(each);
+
+                       /* Is it already loaded? */
+                       if (!find_resource(each, 0)) {
+                               load_dynamic_module(each, global_symbols_only);
+                       }
+               }
+       }
+#endif
+
        while (!dlclose(lib));
        resource_being_loaded = NULL;
 
index aaa30da..ef482df 100644 (file)
@@ -4880,5 +4880,6 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Distributed Universal Nu
                .load = load_module,
                .unload = unload_module,
                .reload = reload,
+               .nonoptreq = "res_crypto",
               );
 
index f51ec82..9ab1463 100644 (file)
@@ -41,7 +41,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/sched.h"
 #include "asterisk/io.h"
 #include "asterisk/utils.h"
-#include "asterisk/crypto.h"
 #include "asterisk/astdb.h"
 
 
index 2697ea0..f183c86 100644 (file)
@@ -46,7 +46,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/sched.h"
 #include "asterisk/io.h"
 #include "asterisk/utils.h"
-#include "asterisk/crypto.h"
 #include "asterisk/astdb.h"
 #include "asterisk/app.h"
 #include "asterisk/astobj2.h"