[asterisk-commits] branch group/new_loader_completion r22326 - in /team/group/new_loader_complet...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Apr 24 14:02:59 MST 2006


Author: kpfleming
Date: Mon Apr 24 16:02:58 2006
New Revision: 22326

URL: http://svn.digium.com/view/asterisk?rev=22326&view=rev
Log:
update the remaining resource modules for the new module descriptor syntax

Modified:
    team/group/new_loader_completion/res/res_features.c
    team/group/new_loader_completion/res/res_indications.c
    team/group/new_loader_completion/res/res_monitor.c
    team/group/new_loader_completion/res/res_musiconhold.c
    team/group/new_loader_completion/res/res_odbc.c
    team/group/new_loader_completion/res/res_osp.c
    team/group/new_loader_completion/res/res_smdi.c
    team/group/new_loader_completion/res/res_speech.c
    team/group/new_loader_completion/udptl.c

Modified: team/group/new_loader_completion/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/res/res_features.c?rev=22326&r1=22325&r2=22326&view=diff
==============================================================================
--- team/group/new_loader_completion/res/res_features.c (original)
+++ team/group/new_loader_completion/res/res_features.c Mon Apr 24 16:02:58 2006
@@ -1558,9 +1558,11 @@
 {
 	/* Data is unused at the moment but could contain a parking
 	   lot context eventually */
-	int res=0;
-	struct localuser *u;
-	LOCAL_USER_ADD(u);
+	int res = 0;
+	struct ast_module_user *u;
+
+	u = ast_module_user_add(chan);
+
 	/* Setup the exten/priority to be s/1 since we don't know
 	   where this call should return */
 	strcpy(chan->exten, "s");
@@ -1571,16 +1573,16 @@
 		res = ast_safe_sleep(chan, 1000);
 	if (!res)
 		res = ast_park_call(chan, chan, 0, NULL);
-	LOCAL_USER_REMOVE(u);
-	if (!res)
-		res = AST_PBX_KEEPALIVE;
-	return res;
+
+	ast_module_user_remove(u);
+
+	return !res ? AST_PBX_KEEPALIVE : res;
 }
 
 static int park_exec(struct ast_channel *chan, void *data)
 {
-	int res=0;
-	struct localuser *u;
+	int res = 0;
+	struct ast_module_user *u;
 	struct ast_channel *peer=NULL;
 	struct parkeduser *pu, *pl=NULL;
 	struct ast_context *con;
@@ -1591,7 +1593,9 @@
 		ast_log(LOG_WARNING, "Park requires an argument (extension number)\n");
 		return -1;
 	}
-	LOCAL_USER_ADD(u);
+	
+	u = ast_module_user_add(chan);
+
 	park = atoi((char *)data);
 	ast_mutex_lock(&parking_lock);
 	pu = parkinglot;
@@ -1696,7 +1700,9 @@
 			ast_verbose(VERBOSE_PREFIX_3 "Channel %s tried to talk to nonexistent parked call %d\n", chan->name, park);
 		res = -1;
 	}
-	LOCAL_USER_REMOVE(u);
+
+	ast_module_user_remove(u);
+
 	return res;
 }
 
@@ -2094,16 +2100,15 @@
 	return ast_add_extension2(con, 1, ast_parking_ext(), 1, NULL, NULL, parkcall, strdup(""), FREE, registrar);
 }
 
-static int reload(void *mod)
+static int reload(void)
 {
 	return load_config();
 }
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	int res;
 	
-	__mod_desc = mod;
 	AST_LIST_HEAD_INIT(&feature_list);
 	memset(parking_ext, 0, sizeof(parking_ext));
 	memset(parking_con, 0, sizeof(parking_con));
@@ -2125,9 +2130,9 @@
 }
 
 
-static int unload_module(void *mod)
-{
-	STANDARD_HANGUP_LOCALUSERS;
+static int unload_module(void)
+{
+	ast_module_user_hangup_all();
 
 	ast_manager_unregister("ParkedCalls");
 	ast_manager_unregister("Park");
@@ -2137,14 +2142,8 @@
 	return ast_unregister_application(parkedcall);
 }
 
-static const char *description(void)
-{
-	return "Call Features Resource";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_0 | NO_UNLOAD, reload, NULL, NULL);
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODULE_DEFAULT, "Call Features Resource",
+		.load = load_module,
+		.unload = unload_module,
+		.reload = reload,
+	       );

Modified: team/group/new_loader_completion/res/res_indications.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/res/res_indications.c?rev=22326&r1=22325&r2=22326&view=diff
==============================================================================
--- team/group/new_loader_completion/res/res_indications.c (original)
+++ team/group/new_loader_completion/res/res_indications.c Mon Apr 24 16:02:58 2006
@@ -363,7 +363,7 @@
 /*
  * Standard module functions ...
  */
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	/* remove the registed indications... */
 	ast_unregister_indication_country(NULL);
@@ -378,7 +378,7 @@
 }
 
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	if (ind_load_module())
 		return -1;
@@ -392,7 +392,7 @@
 	return 0;
 }
 
-static int reload(void *mod)
+static int reload(void)
 {
 	/* remove the registed indications... */
 	ast_unregister_indication_country(NULL);
@@ -400,14 +400,8 @@
 	return ind_load_module();
 }
 
-static const char *description(void)
-{
-	return "Indications Configuration";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_0 | NO_USECOUNT, reload, NULL, NULL);
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODULE_DEFAULT, "Indications Resource",
+		.load = load_module,
+		.unload = unload_module,
+		.reload = reload,
+	       );

Modified: team/group/new_loader_completion/res/res_monitor.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/res/res_monitor.c?rev=22326&r1=22325&r2=22326&view=diff
==============================================================================
--- team/group/new_loader_completion/res/res_monitor.c (original)
+++ team/group/new_loader_completion/res/res_monitor.c Mon Apr 24 16:02:58 2006
@@ -645,7 +645,7 @@
 }
 	
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	ast_register_application("Monitor", start_monitor_exec, monitor_synopsis, monitor_descrip);
 	ast_register_application("StopMonitor", stop_monitor_exec, stopmonitor_synopsis, stopmonitor_descrip);
@@ -661,7 +661,7 @@
 	return 0;
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	ast_unregister_application("Monitor");
 	ast_unregister_application("StopMonitor");
@@ -677,14 +677,5 @@
 	return 0;
 }
 
-static const char *description(void)
-{
-	return "Call Monitoring Resource";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_0 | NO_USECOUNT | NO_UNLOAD, NULL, NULL, NULL);	/* MOD_0 because it exports some symbols */
+/* usecount semantics need to be defined */
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Call Monitoring Resource");

Modified: team/group/new_loader_completion/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/res/res_musiconhold.c?rev=22326&r1=22325&r2=22326&view=diff
==============================================================================
--- team/group/new_loader_completion/res/res_musiconhold.c (original)
+++ team/group/new_loader_completion/res/res_musiconhold.c Mon Apr 24 16:02:58 2006
@@ -1182,7 +1182,7 @@
 	return 1;
 }
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	int res;
 
@@ -1209,7 +1209,7 @@
 	return 0;
 }
 
-static int reload(void *mod)
+static int reload(void)
 {
 	if (init_classes(1))
 		ast_install_music_functions(local_ast_moh_start, local_ast_moh_stop, local_ast_moh_cleanup);
@@ -1217,20 +1217,13 @@
 	return 0;
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return -1;
 }
 
-static const char *description(void)
-{
-	return "Music On Hold Resource";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_0 | NO_USECOUNT | NO_UNLOAD, reload, NULL, NULL);
-
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODULE_DEFAULT, "Music On Hold Resource",
+		.load = load_module,
+		.unload = unload_module,
+		.reload = reload,
+	       );

Modified: team/group/new_loader_completion/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/res/res_odbc.c?rev=22326&r1=22325&r2=22326&view=diff
==============================================================================
--- team/group/new_loader_completion/res/res_odbc.c (original)
+++ team/group/new_loader_completion/res/res_odbc.c Mon Apr 24 16:02:58 2006
@@ -512,9 +512,7 @@
 	return ODBC_SUCCESS;
 }
 
-LOCAL_USER_DECL;
-
-static int reload(void *mod)
+static int reload(void)
 {
 	static char *cfg = "res_odbc.conf";
 	struct ast_config *config;
@@ -658,13 +656,13 @@
 	return 0;
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	/* Prohibit unloading */
 	return -1;
 }
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	load_odbc_config();
 	ast_cli_register(&odbc_show_struct);
@@ -672,14 +670,8 @@
 	return 0;
 }
 
-static const char *description(void)
-{
-	return "ODBC Resource";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_0, reload, NULL, NULL);
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODULE_DEFAULT, "ODBC Resource",
+		.load = load_module,
+		.unload = unload_module,
+		.reload = reload,
+	       );

Modified: team/group/new_loader_completion/res/res_osp.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/res/res_osp.c?rev=22326&r1=22325&r2=22326&view=diff
==============================================================================
--- team/group/new_loader_completion/res/res_osp.c (original)
+++ team/group/new_loader_completion/res/res_osp.c Mon Apr 24 16:02:58 2006
@@ -1068,14 +1068,14 @@
 	return(RESULT_SUCCESS);
 }
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	osp_load();
 	ast_cli_register(&osp_cli);
 	return 0;
 }
 
-static int reload(void *mod)
+static int reload(void)
 {
 	ast_cli_unregister(&osp_cli);
 	osp_unload();
@@ -1084,32 +1084,17 @@
 	return 0;
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	ast_cli_unregister(&osp_cli);
 	osp_unload();
 	return 0;
 }
 
-static const char *description(void)
-{
-	return "Open Settlement Protocol Support";
-}
-
-#if 0
-/* XXX usecount handling still needs to be fixed.
- */
-int usecount(void)
-{
-	return(osp_usecount);
-}
-#endif
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_0, reload, NULL, NULL)
-
-
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODULE_DEFAULT, "Open Settlement Protocol Resource",
+		.load = load_module,
+		.unload = unload_module,
+		.reload = reload,
+	       );
+
+

Modified: team/group/new_loader_completion/res/res_smdi.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/res/res_smdi.c?rev=22326&r1=22325&r2=22326&view=diff
==============================================================================
--- team/group/new_loader_completion/res/res_smdi.c (original)
+++ team/group/new_loader_completion/res/res_smdi.c Mon Apr 24 16:02:58 2006
@@ -501,7 +501,7 @@
 	ASTOBJ_CONTAINER_DESTROY(&iface->mwi_q);
 	free(iface);
 
-	ast_atomic_fetchadd_int(&me->usecnt, -1);
+	ast_module_unref(ast_module_info.self);
 }
 
 /*!
@@ -685,7 +685,7 @@
 
 			ASTOBJ_CONTAINER_LINK(&smdi_ifaces, iface);
 			ASTOBJ_UNREF(iface, ast_smdi_interface_destroy);
-			ast_atomic_fetchadd_int(&me->usecnt, +1);
+			ast_module_ref(ast_module_info.self);
 		} else {
 			ast_log(LOG_NOTICE, "Ignoring unknown option %s in %s\n", v->name, config_file);
 		}
@@ -705,17 +705,10 @@
 	return res;
 }
 
-
-static const char *description(void)
-{
-	return "Asterisk Simplified Message Desk Interface (SMDI) Module";
-}
-
-static int load_module(void *mod)
+static int load_module(void)
 {
 	int res;
 
-	me = mod;
 	/* initialize our containers */
 	memset(&smdi_ifaces, 0, sizeof(smdi_ifaces));
 	ASTOBJ_CONTAINER_INIT(&smdi_ifaces);
@@ -731,7 +724,7 @@
 		return 0;
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	/* this destructor stops any running smdi_read threads */
 	ASTOBJ_CONTAINER_DESTROYALL(&smdi_ifaces, ast_smdi_interface_destroy);
@@ -740,7 +733,7 @@
 	return 0;
 }
 
-static int reload(void *mod)
+static int reload(void)
 {
 	int res;
 
@@ -755,9 +748,8 @@
 		return 0;
 }
 
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_0, reload, NULL, NULL);
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODULE_DEFAULT, "Simplified Message Desk Interface (SMDI) Resource",
+		.load = load_module,
+		.unload = unload_module,
+		.reload = reload,
+	       );

Modified: team/group/new_loader_completion/res/res_speech.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/res/res_speech.c?rev=22326&r1=22325&r2=22326&view=diff
==============================================================================
--- team/group/new_loader_completion/res/res_speech.c (original)
+++ team/group/new_loader_completion/res/res_speech.c Mon Apr 24 16:02:58 2006
@@ -336,13 +336,13 @@
 	return res;
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	/* We can not be unloaded */
 	return -1;
 }
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	int res = 0;
 
@@ -352,14 +352,4 @@
 	return res;
 }
 
-static const char *description(void)
-{
-	return "Generic Speech Recognition API";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_0 | NO_USECOUNT | NO_UNLOAD, NULL, NULL, NULL);
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Generic Speech Recognition API");

Modified: team/group/new_loader_completion/udptl.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/udptl.c?rev=22326&r1=22325&r2=22326&view=diff
==============================================================================
--- team/group/new_loader_completion/udptl.c (original)
+++ team/group/new_loader_completion/udptl.c Mon Apr 24 16:02:58 2006
@@ -771,7 +771,7 @@
 	int i;
 	long int flags;
 
-	if ((udptl = malloc(sizeof(struct ast_udptl))) == NULL)
+	if ((udptl = ast_malloc(sizeof(struct ast_udptl))) == NULL)
 		return NULL;
 	memset(udptl, 0, sizeof(struct ast_udptl));
 



More information about the asterisk-commits mailing list