]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add remaining apps to new mod loader macros.
authorMichael Jerris <mike@jerris.com>
Wed, 20 Jun 2007 06:05:31 +0000 (06:05 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 20 Jun 2007 06:05:31 +0000 (06:05 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5401 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_loadable_module.h
src/mod/applications/mod_enum/mod_enum.c
src/mod/applications/mod_esf/mod_esf.c
src/mod/applications/mod_rss/mod_rss.c

index 098179e0ee7aed7708e7eebbe99039a0242b2261..e957dde468223928dd9af8157bc40becd0c4526f 100644 (file)
@@ -295,6 +295,14 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void);
        break; \
        }
 
+#define SWITCH_ADD_DIALPLAN(dp_int, int_name, funcptr) \
+       for (;;) { \
+       dp_int = switch_loadable_module_create_interface(*module_interface, SWITCH_DIALPLAN_INTERFACE); \
+       dp_int->hunt_function = funcptr; \
+       dp_int->interface_name = int_name; \
+       break; \
+       }
+
 ///\}
 
 SWITCH_END_EXTERN_C
index afd29058cf9be4d490e4a4df2b720ac2fa6d6d8d..09f8d578e290e7bc83c6e7fce78c7f1412cb5bc4 100644 (file)
@@ -111,13 +111,6 @@ static switch_status_t load_config(void)
        switch_xml_t cfg, xml = NULL, param, settings, route, routes;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-       memset(&globals, 0, sizeof(globals));
-       if (switch_core_new_memory_pool(&globals.pool) != SWITCH_STATUS_SUCCESS) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
-               status = SWITCH_STATUS_TERM;
-               goto done;
-       }
-
        switch_core_hash_init(&globals.routes, globals.pool);
 
        if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
@@ -564,7 +557,7 @@ static switch_caller_extension_t *enum_dialplan_hunt(switch_core_session_t *sess
 
 }
 
-static void enum_app_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(enum_app_function)
 {
        int argc = 0;
        char *argv[4] = { 0 };
@@ -685,54 +678,26 @@ SWITCH_STANDARD_API(enum_function)
 }
 
 
-static switch_dialplan_interface_t enum_dialplan_interface = {
-       /*.interface_name = */ "enum",
-       /*.hunt_function = */ enum_dialplan_hunt
-               /*.next = NULL */
-};
-
-static switch_application_interface_t enum_application_interface = {
-       /*.interface_name */ "enum",
-       /*.application_function */ enum_app_function,
-       /* long_desc */ "Perform an ENUM lookup",
-       /* short_desc */ "Perform an ENUM lookup",
-       /* syntax */ "<number> [<root>]",
-       /* flags */ SAF_SUPPORT_NOMEDIA,
-       /*.next */ NULL
-};
-
-static switch_api_interface_t enum_api_interface = {
-       /*.interface_name */ "enum",
-       /*.desc */ "ENUM",
-       /*.function */ enum_function,
-       /*.syntax */ "",
-       /*.next */ NULL
-};
-
-static switch_loadable_module_interface_t enum_module_interface = {
-       /*.module_name */ modname,
-       /*.endpoint_interface */ NULL,
-       /*.timer_interface */ NULL,
-       /*.dialplan_interface */ &enum_dialplan_interface,
-       /*.codec_interface */ NULL,
-       /*.application_interface */ &enum_application_interface,
-       /*.api_interface */ &enum_api_interface,
-       /*.file_interface */ NULL,
-       /*.speech_interface */ NULL,
-       /*.directory_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_enum_load)
 {
+       switch_api_interface_t *api_interface;
+       switch_application_interface_t *app_interface;
+       switch_dialplan_interface_t *dp_interface;
 
        if (dns_init(0) < 0) {
                return SWITCH_STATUS_FALSE;
        }
 
+       memset(&globals, 0, sizeof(globals));
+       globals.pool = pool;
+
        load_config();
 
        /* connect my internal structure to the blank pointer passed to me */
-       *module_interface = &enum_module_interface;
+       *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+       SWITCH_ADD_API(api_interface, "enum", "ENUM", enum_function, "");
+       SWITCH_ADD_APP(app_interface, "enum", "Perform an ENUM lookup", "Perform an ENUM lookup", enum_app_function, "<number> [<root>]", SAF_SUPPORT_NOMEDIA);
+       SWITCH_ADD_DIALPLAN(dp_interface, "enum", enum_dialplan_hunt);
 
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
index 336ad0899de1c5d753b5c41d7bd221dfc8f30335..43d9b8d7dc12d228fc607922141649ddd40229ea 100644 (file)
@@ -54,7 +54,7 @@ typedef enum {
        SEND_TYPE_NOMEDIA = 3
 } ls_how_t;
 
-static void bcast_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(bcast_function)
 {
        switch_channel_t *channel;
        switch_socket_t *socket;
@@ -228,36 +228,18 @@ static void bcast_function(switch_core_session_t *session, char *data)
 }
 
 
-static switch_application_interface_t bcast_application_interface = {
-       /*.interface_name */ "esf_ls_page_group",
-       /*.application_function */ bcast_function,
-       NULL, NULL, NULL,
-       /* flags */ SAF_NONE,
-       /*.next */ NULL
-};
-
-static switch_loadable_module_interface_t mod_ivrtest_module_interface = {
-       /*.module_name = */ modname,
-       /*.endpoint_interface = */ NULL,
-       /*.timer_interface = */ NULL,
-       /*.dialplan_interface = */ NULL,
-       /*.codec_interface = */ NULL,
-       /*.application_interface */ &bcast_application_interface
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_esf_load)
 {
+       switch_application_interface_t *app_interface;
 
        /* connect my internal structure to the blank pointer passed to me */
-       *module_interface = &mod_ivrtest_module_interface;
+       *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+       SWITCH_ADD_APP(app_interface, "esf_ls_page_group", NULL, NULL, bcast_function, NULL, SAF_NONE);
 
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
 }
 
-
-//switch_status_t switch_module_runtime(void)
-
 /* For Emacs:
  * Local Variables:
  * mode:c
index 693d3d99c3f76d9ef3e16b8eb17121b2de1af690..9b57c01ede7e312768608a23ff495eb23bc34daa 100644 (file)
@@ -152,7 +152,7 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
        return SWITCH_STATUS_SUCCESS;
 }
 
-static void rss_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(rss_function)
 {
        switch_channel_t *channel;
        switch_status_t status;
@@ -613,33 +613,14 @@ static void rss_function(switch_core_session_t *session, char *data)
        switch_core_session_reset(session);
 }
 
-static switch_application_interface_t rss_application_interface = {
-       /*.interface_name */ "rss",
-       /*.application_function */ rss_function,
-       NULL, NULL, NULL,
-       /* flags */ SAF_NONE,
-       /*.next */ NULL
-};
-
-
-static switch_loadable_module_interface_t rss_module_interface = {
-       /*.module_name */ modname,
-       /*.endpoint_interface */ NULL,
-       /*.timer_interface */ NULL,
-       /*.dialplan_interface */ NULL,
-       /*.codec_interface */ NULL,
-       /*.application_interface */ &rss_application_interface,
-       /*.api_interface */ NULL,
-       /*.file_interface */ NULL,
-       /*.speech_interface */ NULL,
-       /*.directory_interface */ NULL
-};
-
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_rss_load)
 {
+       switch_application_interface_t *app_interface;
+
        /* connect my internal structure to the blank pointer passed to me */
-       *module_interface = &rss_module_interface;
+       *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+       SWITCH_ADD_APP(app_interface, "rss", NULL, NULL, rss_function, NULL, SAF_NONE);
 
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;