git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@101 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2005-12-09 19:33:21 +00:00
parent bbb07474a7
commit 86c1904cce
3 changed files with 21 additions and 0 deletions

View File

@ -46,6 +46,7 @@ struct switch_loadable_module_interface {
const switch_dialplan_interface *dialplan_interface;
const switch_codec_interface *codec_interface;
const switch_application_interface *application_interface;
const switch_api_interface *api_interface;
};
SWITCH_DECLARE(switch_status) switch_loadable_module_init(void);
@ -54,6 +55,7 @@ SWITCH_DECLARE(switch_codec_interface *) loadable_module_get_codec_interface(cha
SWITCH_DECLARE(switch_dialplan_interface *) loadable_module_get_dialplan_interface(char *name);
SWITCH_DECLARE(switch_timer_interface *) loadable_module_get_timer_interface(char *name);
SWITCH_DECLARE(switch_application_interface *) loadable_module_get_application_interface(char *name);
SWITCH_DECLARE(switch_application_interface *) loadable_module_get_api_interface(char *name);
SWITCH_DECLARE(int) loadable_module_get_codecs(switch_memory_pool *pool, switch_codec_interface **array, int arraylen);
SWITCH_DECLARE(int) loadable_module_get_codecs_sorted(switch_memory_pool *pool, switch_codec_interface **array, int arraylen, char **prefs, int preflen);
SWITCH_DECLARE(void) loadable_module_shutdown(void);

View File

@ -130,6 +130,7 @@ typedef struct switch_timer_interface switch_timer_interface;
typedef struct switch_dialplan_interface switch_dialplan_interface;
typedef struct switch_codec_interface switch_codec_interface;
typedef struct switch_application_interface switch_application_interface;
typedef struct switch_api_interface switch_api_interface;
typedef struct switch_core_session switch_core_session;
typedef struct switch_loadable_module_interface switch_loadable_module_interface;
typedef struct switch_caller_profile switch_caller_profile;

View File

@ -60,6 +60,7 @@ struct switch_loadable_module_container {
switch_hash *dialplan_hash;
switch_hash *timer_hash;
switch_hash *application_hash;
switch_hash *api_hash;
switch_memory_pool *pool;
};
@ -205,6 +206,7 @@ SWITCH_DECLARE(switch_status) switch_loadable_module_init()
switch_core_hash_init(&loadable_modules.codec_hash, loadable_modules.pool);
switch_core_hash_init(&loadable_modules.timer_hash, loadable_modules.pool);
switch_core_hash_init(&loadable_modules.application_hash, loadable_modules.pool);
switch_core_hash_init(&loadable_modules.api_hash, loadable_modules.pool);
switch_core_hash_init(&loadable_modules.dialplan_hash, loadable_modules.pool);
while (apr_dir_read(&finfo, finfo_flags, module_dir_handle) == APR_SUCCESS) {
@ -297,6 +299,17 @@ SWITCH_DECLARE(switch_status) switch_loadable_module_init()
}
}
if (new_module->interface->api_interface) {
const switch_api_interface *ptr;
for(ptr = new_module->interface->api_interface; ptr; ptr = ptr->next) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Adding API Function '%s'\n", ptr->interface_name);
switch_core_hash_insert(loadable_modules.api_hash,
(char *) ptr->interface_name,
(void *) ptr);
}
}
}
}
@ -350,6 +363,11 @@ SWITCH_DECLARE(switch_application_interface *) loadable_module_get_application_i
return switch_core_hash_find(loadable_modules.application_hash, name);
}
SWITCH_DECLARE(switch_application_interface *) loadable_module_get_api_interface(char *name)
{
return switch_core_hash_find(loadable_modules.api_hash, name);
}
SWITCH_DECLARE(int) loadable_module_get_codecs(switch_memory_pool *pool, switch_codec_interface **array, int arraylen)
{
apr_hash_index_t* hi;