[Freeswitch-svn] [commit] r5401 - in freeswitch/trunk/src: include mod/applications/mod_enum mod/applications/mod_esf mod/applications/mod_rss

Freeswitch SVN mikej at freeswitch.org
Wed Jun 20 02:05:32 EDT 2007


Author: mikej
Date: Wed Jun 20 02:05:31 2007
New Revision: 5401

Modified:
   freeswitch/trunk/src/include/switch_loadable_module.h
   freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
   freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c
   freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c

Log:
add remaining apps to new mod loader macros.

Modified: freeswitch/trunk/src/include/switch_loadable_module.h
==============================================================================
--- freeswitch/trunk/src/include/switch_loadable_module.h	(original)
+++ freeswitch/trunk/src/include/switch_loadable_module.h	Wed Jun 20 02:05:31 2007
@@ -295,6 +295,14 @@
 	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

Modified: freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c	Wed Jun 20 02:05:31 2007
@@ -111,13 +111,6 @@
 	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 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 @@
 }
 
 
-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;

Modified: freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c	Wed Jun 20 02:05:31 2007
@@ -54,7 +54,7 @@
 	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 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

Modified: freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c	Wed Jun 20 02:05:31 2007
@@ -152,7 +152,7 @@
 	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 @@
 	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;



More information about the Freeswitch-svn mailing list