[svn-commits] kpfleming: branch group/new_loader_completion r40305 - /team/group/new_loader...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Aug 17 14:28:02 MST 2006


Author: kpfleming
Date: Thu Aug 17 16:28:01 2006
New Revision: 40305

URL: http://svn.digium.com/view/asterisk?rev=40305&view=rev
Log:
use an enum for module load results so that modules can be cleanly unloaded if no configuration was found
various other minor cleanups

Modified:
    team/group/new_loader_completion/include/asterisk/module.h

Modified: team/group/new_loader_completion/include/asterisk/module.h
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/include/asterisk/module.h?rev=40305&r1=40304&r2=40305&view=diff
==============================================================================
--- team/group/new_loader_completion/include/asterisk/module.h (original)
+++ team/group/new_loader_completion/include/asterisk/module.h Thu Aug 17 16:28:01 2006
@@ -51,23 +51,29 @@
 #define AST_MODULE_CONFIG "modules.conf" /*!< \brief Module configuration file */
 
 enum ast_module_unload_mode {
-	AST_FORCE_SOFT = 0, /*! Softly unload a module, only if not in use */
-	AST_FORCE_FIRM = 1, /*! Firmly unload a module, even if in use */
-	AST_FORCE_HARD = 2, /*! as FIRM, plus dlclose() on the module. Not recommended
+	AST_FORCE_SOFT = 0, /*!< Softly unload a module, only if not in use */
+	AST_FORCE_FIRM = 1, /*!< Firmly unload a module, even if in use */
+	AST_FORCE_HARD = 2, /*!< as FIRM, plus dlclose() on the module. Not recommended
 				as it may cause crashes */
 };
 
+enum ast_module_load_result {
+	AST_MODULE_LOAD_SUCCESS = 0,	/*!< Module loaded and configured */
+	AST_MODULE_LOAD_DECLINE = 1,	/*!< Module is not configured */
+	AST_MODULE_LOAD_FAILURE = -1,	/*!< Module could not be loaded properly */
+};
+
 /*! 
  * \brief Load a module.
- * \param resource_name The filename of the module to load.
+ * \param resource_name The name of the module to load.
  *
  * This function is run by the PBX to load the modules.  It performs
  * all loading and initilization tasks.   Basically, to load a module, just
  * give it the name of the module and it will do the rest.
  *
- * \return Zero on success, -1 on error.
- */
-int ast_load_resource(const char *resource_name);
+ * \return See possible enum values for ast_module_load_result.
+ */
+enum ast_module_load_result ast_load_resource(const char *resource_name);
 
 /*! 
  * \brief Unloads a module.
@@ -77,7 +83,7 @@
  * This function unloads a module.  It will only unload modules that are not in
  * use (usecount not zero), unless #AST_FORCE_FIRM or #AST_FORCE_HARD is 
  * specified.  Setting #AST_FORCE_FIRM or #AST_FORCE_HARD will unload the
- * module regardless of consequences (NOT_RECOMMENDED).
+ * module regardless of consequences (NOT RECOMMENDED).
  *
  * \return Zero on success, -1 on error.
  */
@@ -175,25 +181,19 @@
 	*/
 
 	struct ast_module *self;
-
-	int (*load)(void);		/* register stuff etc. Optional. */
-
-	int (*reload)(void);		/* config etc. Optional. */
-
-	int (*unload)(void);		/* unload. called with the module locked */
-
-	const char *name;		/* name of the module for loader reference and CLI commands */
-
-	const char *description;	/* user friendly description of the module. */
+	enum ast_module_load_result (*load)(void);	/* register stuff etc. Optional. */
+	int (*reload)(void);			/* config etc. Optional. */
+	int (*unload)(void);			/* unload. called with the module locked */
+	const char *name;			/* name of the module for loader reference and CLI commands */
+	const char *description;		/* user friendly description of the module. */
 
 	/*! 
-	 * This returns the ASTERISK_GPL_KEY, signifiying that you agree to the terms of
+	 * This holds the ASTERISK_GPL_KEY, signifiying that you agree to the terms of
 	 * the Asterisk license as stated in the ASTERISK_GPL_KEY.  Your module will not
 	 * load if it does not return the EXACT key string.
 	 */
 
 	const char *key;
-
 	const struct ast_flags flags;
 };
 



More information about the svn-commits mailing list