module.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2008, Digium, Inc.
00005  *
00006  * Mark Spencer <markster@digium.com>
00007  * Kevin P. Fleming <kpfleming@digium.com>
00008  * Luigi Rizzo <rizzo@icir.org>
00009  *
00010  * See http://www.asterisk.org for more information about
00011  * the Asterisk project. Please do not directly contact
00012  * any of the maintainers of this project for assistance;
00013  * the project provides a web site, mailing lists and IRC
00014  * channels for your use.
00015  *
00016  * This program is free software, distributed under the terms of
00017  * the GNU General Public License Version 2. See the LICENSE file
00018  * at the top of the source tree.
00019  */
00020 
00021 /*! \file
00022  * \brief Asterisk module definitions.
00023  *
00024  * This file contains the definitons for functions Asterisk modules should
00025  * provide and some other module related functions.
00026  */
00027 
00028 /*! \li \ref module.h uses the configuration file \ref modules.conf
00029  * \addtogroup configuration_file
00030  */
00031 
00032 /*! \page modules.conf modules.conf
00033  * \verbinclude modules.conf.sample
00034  */
00035 
00036 #ifndef _ASTERISK_MODULE_H
00037 #define _ASTERISK_MODULE_H
00038 
00039 #include "asterisk/utils.h"
00040 
00041 #if defined(__cplusplus) || defined(c_plusplus)
00042 extern "C" {
00043 #endif
00044 
00045 /*! \brief The text the key() function should return. */
00046 #define ASTERISK_GPL_KEY \
00047 "This paragraph is copyright (c) 2006 by Digium, Inc. \
00048 In order for your module to load, it must return this \
00049 key via a function called \"key\".  Any code which \
00050 includes this paragraph must be licensed under the GNU \
00051 General Public License version 2 or later (at your \
00052 option).  In addition to Digium's general reservations \
00053 of rights, Digium expressly reserves the right to \
00054 allow other parties to license this paragraph under \
00055 different terms. Any use of Digium, Inc. trademarks or \
00056 logos (including \"Asterisk\" or \"Digium\") without \
00057 express written permission of Digium, Inc. is prohibited.\n"
00058 
00059 #define AST_MODULE_CONFIG "modules.conf" /*!< \brief Module configuration file */
00060 
00061 enum ast_module_unload_mode {
00062    AST_FORCE_SOFT = 0, /*!< Softly unload a module, only if not in use */
00063    AST_FORCE_FIRM = 1, /*!< Firmly unload a module, even if in use */
00064    AST_FORCE_HARD = 2, /*!< as FIRM, plus dlclose() on the module. Not recommended
00065             as it may cause crashes */
00066 };
00067 
00068 enum ast_module_load_result {
00069    AST_MODULE_LOAD_SUCCESS = 0,    /*!< Module loaded and configured */
00070    AST_MODULE_LOAD_DECLINE = 1,    /*!< Module is not configured */
00071    AST_MODULE_LOAD_SKIP = 2,       /*!< Module was skipped for some reason */
00072    AST_MODULE_LOAD_PRIORITY = 3,   /*!< Module is not loaded yet, but is added to prioity heap */
00073    AST_MODULE_LOAD_FAILURE = -1,   /*!< Module could not be loaded properly */
00074 };
00075 
00076 /*!
00077  * \since 12
00078  * \brief Possible return types for \ref ast_module_reload
00079  */
00080 enum ast_module_reload_result {
00081    AST_MODULE_RELOAD_SUCCESS = 0,      /*!< The module was reloaded succesfully */
00082    AST_MODULE_RELOAD_QUEUED,           /*!< The module reload request was queued */
00083    AST_MODULE_RELOAD_NOT_FOUND,        /*!< The requested module was not found */
00084    AST_MODULE_RELOAD_ERROR,            /*!< An error occurred while reloading the module */
00085    AST_MODULE_RELOAD_IN_PROGRESS,      /*!< A module reload request is already in progress */
00086    AST_MODULE_RELOAD_UNINITIALIZED,    /*!< The module has not been initialized */
00087    AST_MODULE_RELOAD_NOT_IMPLEMENTED,  /*!< This module doesn't support reloading */
00088 };
00089 
00090 enum ast_module_support_level {
00091    AST_MODULE_SUPPORT_UNKNOWN,
00092    AST_MODULE_SUPPORT_CORE,
00093    AST_MODULE_SUPPORT_EXTENDED,
00094    AST_MODULE_SUPPORT_DEPRECATED,
00095 };
00096 
00097 /*! 
00098  * \brief Load a module.
00099  * \param resource_name The name of the module to load.
00100  *
00101  * This function is run by the PBX to load the modules.  It performs
00102  * all loading and initialization tasks.   Basically, to load a module, just
00103  * give it the name of the module and it will do the rest.
00104  *
00105  * \return See possible enum values for ast_module_load_result.
00106  */
00107 enum ast_module_load_result ast_load_resource(const char *resource_name);
00108 
00109 /*! 
00110  * \brief Unload a module.
00111  * \param resource_name The name of the module to unload.
00112  * \param ast_module_unload_mode The force flag. This should be set using one of the AST_FORCE flags.
00113  *
00114  * This function unloads a module.  It will only unload modules that are not in
00115  * use (usecount not zero), unless #AST_FORCE_FIRM or #AST_FORCE_HARD is 
00116  * specified.  Setting #AST_FORCE_FIRM or #AST_FORCE_HARD will unload the
00117  * module regardless of consequences (NOT RECOMMENDED).
00118  *
00119  * \retval 0 on success.
00120  * \retval -1 on error.
00121  */
00122 int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode);
00123 
00124 /*!
00125  * \brief Reload asterisk modules.
00126  * \param name the name of the module to reload
00127  *
00128  * This function reloads the specified module, or if no modules are specified,
00129  * it will reload all loaded modules.
00130  *
00131  * \note Modules are reloaded using their reload() functions, not unloading
00132  * them and loading them again.
00133  *
00134  * \retval The \ref ast_module_reload_result status of the module load request
00135  */
00136 enum ast_module_reload_result ast_module_reload(const char *name);
00137 
00138 /*! 
00139  * \brief Notify when usecount has been changed.
00140  *
00141  * This function calulates use counts and notifies anyone trying to keep track
00142  * of them.  It should be called whenever your module's usecount changes.
00143  *
00144  * \note The ast_module_user_* functions take care of calling this function for you.
00145  */
00146 void ast_update_use_count(void);
00147 
00148 /*!
00149  * \brief Ask for a list of modules, descriptions, use counts and status.
00150  * \param modentry A callback to an updater function.
00151  * \param like
00152  *
00153  * For each of the modules loaded, modentry will be executed with the resource,
00154  * description, and usecount values of each particular module.
00155  *
00156  * \return the number of modules loaded
00157  */
00158 int ast_update_module_list(int (*modentry)(const char *module, const char *description,
00159                                            int usecnt, const char *status, const char *like,
00160                                            enum ast_module_support_level support_level),
00161                            const char *like);
00162 
00163 /*!
00164  * \brief Check if module with the name given is loaded
00165  * \param name Module name, like "chan_sip.so"
00166  * \retval 1 if true 
00167  * \retval 0 if false
00168  */
00169 int ast_module_check(const char *name);
00170 
00171 /*! 
00172  * \brief Add a procedure to be run when modules have been updated.
00173  * \param updater The function to run when modules have been updated.
00174  *
00175  * This function adds the given function to a linked list of functions to be
00176  * run when the modules are updated. 
00177  *
00178  * \retval 0 on success 
00179  * \retval -1 on failure.
00180  */
00181 int ast_loader_register(int (*updater)(void));
00182 
00183 /*! 
00184  * \brief Remove a procedure to be run when modules are updated.
00185  * \param updater The updater function to unregister.
00186  *
00187  * This removes the given function from the updater list.
00188  * 
00189  * \retval 0 on success
00190  * \retval -1 on failure.
00191  */
00192 int ast_loader_unregister(int (*updater)(void));
00193 
00194 /*!
00195  * \brief Run the unload() callback for all loaded modules
00196  *
00197  * This function should be called when Asterisk is shutting down gracefully.
00198  */
00199 void ast_module_shutdown(void);
00200 
00201 /*! 
00202  * \brief Match modules names for the Asterisk cli.
00203  * \param line Unused by this function, but this should be the line we are
00204  *        matching.
00205  * \param word The partial name to match. 
00206  * \param pos The position the word we are completing is in.
00207  * \param state The possible match to return.
00208  * \param rpos The position we should be matching.  This should be the same as
00209  *        pos.
00210  * \param needsreload This should be 1 if we need to reload this module and 0
00211  *        otherwise.  This function will only return modules that are reloadble
00212  *        if this is 1.
00213  *
00214  * \retval A possible completion of the partial match.
00215  * \retval NULL if no matches were found.
00216  */
00217 char *ast_module_helper(const char *line, const char *word, int pos, int state, int rpos, int needsreload);
00218 
00219 /* Opaque type for module handles generated by the loader */
00220 
00221 struct ast_module;
00222 
00223 /*!
00224  * \brief Get the name of a module.
00225  * \param mod A pointer to the module.
00226  * \return the name of the module
00227  * \retval NULL if mod or mod->info is NULL
00228  */
00229 const char *ast_module_name(const struct ast_module *mod);
00230 
00231 /* User count routines keep track of which channels are using a given module
00232    resource.  They can help make removing modules safer, particularly if
00233    they're in use at the time they have been requested to be removed */
00234 
00235 struct ast_module_user;
00236 struct ast_module_user_list;
00237 
00238 /*! \page ModMngmnt The Asterisk Module management interface
00239  *
00240  * All modules must implement the module API (load, unload...)
00241  */
00242 
00243 enum ast_module_flags {
00244    AST_MODFLAG_DEFAULT = 0,
00245    AST_MODFLAG_GLOBAL_SYMBOLS = (1 << 0),
00246    AST_MODFLAG_LOAD_ORDER = (1 << 1),
00247 };
00248 
00249 enum ast_module_load_priority {
00250    AST_MODPRI_REALTIME_DEPEND =    10,  /*!< Dependency for a realtime driver */
00251    AST_MODPRI_REALTIME_DEPEND2 =   20,  /*!< Second level dependency for a realtime driver (func_curl needs res_curl, but is needed by res_config_curl) */
00252    AST_MODPRI_REALTIME_DRIVER =    30,  /*!< A realtime driver, which provides configuration services for other modules */
00253    AST_MODPRI_TIMING =             40,  /*!< Dependency for a channel (MOH needs timing interfaces to be fully loaded) */
00254    AST_MODPRI_CHANNEL_DEPEND =     50,  /*!< Channel driver dependency (may depend upon realtime, e.g. MOH) */
00255    AST_MODPRI_CHANNEL_DRIVER =     60,  /*!< Channel drivers (provide devicestate) */
00256    AST_MODPRI_APP_DEPEND =         70,  /*!< Dependency for an application */
00257    AST_MODPRI_DEVSTATE_PROVIDER =  80,  /*!< Applications and other modules that _provide_ devicestate (e.g. meetme) */
00258    AST_MODPRI_DEVSTATE_PLUGIN =    90,  /*!< Plugin for a module that provides devstate (e.g. res_calendar_*) */
00259    AST_MODPRI_CDR_DRIVER =        100,  /*!< CDR or CEL backend */
00260    AST_MODPRI_DEFAULT =           128,  /*!< Modules not otherwise defined (such as most apps) will load here */
00261    AST_MODPRI_DEVSTATE_CONSUMER = 150,  /*!< Certain modules, which consume devstate, need to load after all others (e.g. app_queue) */
00262 };
00263 
00264 struct ast_module_info {
00265 
00266    /*!
00267     * The 'self' pointer for a module; it will be set by the loader before
00268     * it calls the module's load_module() entrypoint, and used by various
00269     * other macros that need to identify the module.
00270     */
00271 
00272    struct ast_module *self;
00273    enum ast_module_load_result (*load)(void);   /*!< register stuff etc. Optional. */
00274    int (*reload)(void);       /*!< config etc. Optional. */
00275    int (*unload)(void);       /*!< unload. called with the module locked */
00276    int (*backup_globals)(void);     /*!< for embedded modules, backup global data */
00277    void (*restore_globals)(void);      /*!< for embedded modules, restore global data */
00278    const char *name;       /*!< name of the module for loader reference and CLI commands */
00279    const char *description;      /*!< user friendly description of the module. */
00280 
00281    /*! 
00282     * This holds the ASTERISK_GPL_KEY, signifiying that you agree to the terms of
00283     * the Asterisk license as stated in the ASTERISK_GPL_KEY.  Your module will not
00284     * load if it does not return the EXACT key string.
00285     */
00286 
00287    const char *key;
00288    unsigned int flags;
00289 
00290    /*! The value of AST_BUILDOPT_SUM when this module was compiled */
00291    const char buildopt_sum[33];
00292 
00293    /*! This value represents the order in which a module's load() function is initialized.
00294     *  The lower this value, the higher the priority.  The value is only checked if the
00295     *  AST_MODFLAG_LOAD_ORDER flag is set.  If the AST_MODFLAG_LOAD_ORDER flag is not set,
00296     *  this value will never be read and the module will be given the lowest possible priority
00297     *  on load. */
00298    unsigned char load_pri;
00299 
00300    /*! Modules which should be loaded first, in comma-separated string format.
00301     * These are only required for loading, when the optional_api header file
00302     * detects that the compiler does not support the optional API featureset. */
00303    const char *nonoptreq;
00304    /*! The support level for the given module */
00305    enum ast_module_support_level support_level;
00306 };
00307 
00308 void ast_module_register(const struct ast_module_info *);
00309 void ast_module_unregister(const struct ast_module_info *);
00310 
00311 struct ast_module_user *__ast_module_user_add(struct ast_module *, struct ast_channel *);
00312 void __ast_module_user_remove(struct ast_module *, struct ast_module_user *);
00313 void __ast_module_user_hangup_all(struct ast_module *);
00314 
00315 #define ast_module_user_add(chan) __ast_module_user_add(ast_module_info->self, chan)
00316 #define ast_module_user_remove(user) __ast_module_user_remove(ast_module_info->self, user)
00317 #define ast_module_user_hangup_all() __ast_module_user_hangup_all(ast_module_info->self)
00318 
00319 struct ast_module *__ast_module_ref(struct ast_module *mod, const char *file, int line, const char *func);
00320 void __ast_module_shutdown_ref(struct ast_module *mod, const char *file, int line, const char *func);
00321 void __ast_module_unref(struct ast_module *mod, const char *file, int line, const char *func);
00322 
00323 /*!
00324  * \brief Hold a reference to the module
00325  * \param mod Module to reference
00326  * \return mod
00327  *
00328  * \note A module reference will prevent the module
00329  * from being unloaded.
00330  */
00331 #define ast_module_ref(mod)           __ast_module_ref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
00332 /*!
00333  * \brief Prevent unload of the module before shutdown
00334  * \param mod Module to hold
00335  *
00336  * \note This should not be balanced by a call to ast_module_unref.
00337  */
00338 #define ast_module_shutdown_ref(mod)  __ast_module_shutdown_ref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
00339 /*!
00340  * \brief Release a reference to the module
00341  * \param mod Module to release
00342  */
00343 #define ast_module_unref(mod)         __ast_module_unref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
00344 
00345 #if defined(__cplusplus) || defined(c_plusplus)
00346 #define AST_MODULE_INFO(keystr, flags_to_set, desc, load_func, unload_func, reload_func, load_pri, support_level) \
00347    static struct ast_module_info __mod_info = { \
00348       NULL,                                                          \
00349       load_func,                                                     \
00350       reload_func,                                                   \
00351       unload_func,                                                   \
00352       NULL,                                                          \
00353       NULL,                                                          \
00354       AST_MODULE,                                                    \
00355       desc,                                                          \
00356       keystr,                                                        \
00357       flags_to_set,                                                  \
00358       AST_BUILDOPT_SUM,                                              \
00359       load_pri,                                                      \
00360       NULL,                                                          \
00361       support_level,                                                 \
00362    };                                                                 \
00363    static void  __attribute__((constructor)) __reg_module(void)       \
00364    {                                                                  \
00365       ast_module_register(&__mod_info);                              \
00366    }                                                                  \
00367    static void  __attribute__((destructor)) __unreg_module(void)      \
00368    {                                                                  \
00369       ast_module_unregister(&__mod_info);                            \
00370    }                                                                  \
00371    static const __attribute__((unused)) struct ast_module_info *ast_module_info = &__mod_info
00372 
00373 #define AST_MODULE_INFO_STANDARD(keystr, desc)              \
00374    AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc,   \
00375          load_module,                                    \
00376          unload_module,                                  \
00377          NULL,                                           \
00378          AST_MODPRI_DEFAULT,                             \
00379          AST_MODULE_SUPPORT_CORE                         \
00380              )
00381 
00382 #define AST_MODULE_INFO_STANDARD_EXTENDED(keystr, desc)     \
00383    AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc,   \
00384          load_module,                                    \
00385          unload_module,                                  \
00386          NULL,                                           \
00387          AST_MODPRI_DEFAULT,                             \
00388          AST_MODULE_SUPPORT_EXTENDED                     \
00389              )
00390 #define AST_MODULE_INFO_STANDARD_DEPRECATED(keystr, desc)   \
00391    AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc,   \
00392          load_module,                                    \
00393          unload_module,                                  \
00394          NULL,                                           \
00395          AST_MODPRI_DEFAULT,                             \
00396          AST_MODULE_SUPPORT_DEPRECATED                   \
00397              )
00398 
00399 #else /* plain C */
00400 
00401 /* forward declare this pointer in modules, so that macro/function
00402    calls that need it can get it, since it will actually be declared
00403    and populated at the end of the module's source file... */
00404 static const __attribute__((unused)) struct ast_module_info *ast_module_info;
00405 
00406 #if !defined(EMBEDDED_MODULE)
00407 #define __MODULE_INFO_SECTION
00408 #define __MODULE_INFO_GLOBALS
00409 #else
00410 /*
00411  * For embedded modules we need additional information to backup and
00412  * restore the global variables in the module itself, so we can unload
00413  * reload the module.
00414  * EMBEDDED_MODULE is defined as the module name, so the calls to make_var()
00415  * below will actually define different symbols for each module.
00416  */
00417 #define __MODULE_INFO_SECTION __attribute__((section(".embed_module")))
00418 #define __MODULE_INFO_GLOBALS .backup_globals = __backup_globals, .restore_globals = __restore_globals,
00419 
00420 #define make_var_sub(mod, type) __ ## mod ## _ ## type
00421 #define make_var(mod, type) make_var_sub(mod, type)
00422 
00423 extern void make_var(EMBEDDED_MODULE, bss_start);
00424 extern void make_var(EMBEDDED_MODULE, bss_end);
00425 extern void make_var(EMBEDDED_MODULE, data_start);
00426 extern void make_var(EMBEDDED_MODULE, data_end);
00427 
00428 static void * __attribute__((section(".embed_module"))) __global_backup;
00429 
00430 static int __backup_globals(void)
00431 {
00432    size_t data_size = & make_var(EMBEDDED_MODULE, data_end) - & make_var(EMBEDDED_MODULE, data_start);
00433 
00434    if (__global_backup)
00435       return 0;
00436 
00437    if (!data_size)
00438       return 0;
00439 
00440    if (!(__global_backup = ast_malloc(data_size)))
00441       return -1;
00442 
00443    memcpy(__global_backup, & make_var(EMBEDDED_MODULE, data_start), data_size);
00444 
00445    return 0;
00446 }
00447 
00448 static void __restore_globals(void)
00449 {
00450    size_t data_size = & make_var(EMBEDDED_MODULE, data_end) - & make_var(EMBEDDED_MODULE, data_start);
00451    size_t bss_size = & make_var(EMBEDDED_MODULE, bss_end) - & make_var(EMBEDDED_MODULE, bss_start);
00452 
00453    if (bss_size)
00454       memset(& make_var(EMBEDDED_MODULE, bss_start), 0, bss_size);
00455 
00456    if (!data_size || !__global_backup)
00457       return;
00458 
00459    memcpy(& make_var(EMBEDDED_MODULE, data_start), __global_backup, data_size);
00460 }
00461 #undef make_var
00462 #undef make_var_sub
00463 #endif /* EMBEDDED_MODULE */
00464 
00465 #define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...) \
00466    static struct ast_module_info             \
00467       __MODULE_INFO_SECTION            \
00468       __mod_info = {             \
00469       __MODULE_INFO_GLOBALS            \
00470       .name = AST_MODULE,           \
00471       .flags = flags_to_set,           \
00472       .description = desc,          \
00473       .key = keystr,             \
00474       .buildopt_sum = AST_BUILDOPT_SUM,      \
00475       fields                  \
00476    };                   \
00477    static void  __attribute__((constructor)) __reg_module(void) \
00478    { \
00479       ast_module_register(&__mod_info); \
00480    } \
00481    static void  __attribute__((destructor)) __unreg_module(void) \
00482    { \
00483       ast_module_unregister(&__mod_info); \
00484    } \
00485    static const struct ast_module_info *ast_module_info = &__mod_info
00486 
00487 #define AST_MODULE_INFO_STANDARD(keystr, desc)              \
00488    AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc,   \
00489          .load = load_module,                            \
00490          .unload = unload_module,                        \
00491          .load_pri = AST_MODPRI_DEFAULT,                 \
00492          .support_level = AST_MODULE_SUPPORT_CORE,       \
00493              )
00494 
00495 #define AST_MODULE_INFO_STANDARD_EXTENDED(keystr, desc)     \
00496    AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc,   \
00497          .load = load_module,                            \
00498          .unload = unload_module,                        \
00499          .load_pri = AST_MODPRI_DEFAULT,                 \
00500          .support_level = AST_MODULE_SUPPORT_EXTENDED,   \
00501              )
00502 
00503 #define AST_MODULE_INFO_STANDARD_DEPRECATED(keystr, desc)   \
00504    AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc,   \
00505          .load = load_module,                            \
00506          .unload = unload_module,                        \
00507          .load_pri = AST_MODPRI_DEFAULT,                 \
00508          .support_level = AST_MODULE_SUPPORT_DEPRECATED, \
00509              )
00510 
00511 #endif   /* plain C */
00512 
00513 /*! 
00514  * \brief Register an application.
00515  *
00516  * \param app Short name of the application
00517  * \param execute a function callback to execute the application. It should return
00518  *                non-zero if the channel needs to be hung up.
00519  * \param synopsis a short description (one line synopsis) of the application
00520  * \param description long description with all of the details about the use of 
00521  *                    the application
00522  * 
00523  * This registers an application with Asterisk's internal application list. 
00524  * \note The individual applications themselves are responsible for registering and unregistering
00525  *       and unregistering their own CLI commands.
00526  * 
00527  * \retval 0 success 
00528  * \retval -1 failure.
00529  */
00530 #define ast_register_application(app, execute, synopsis, description) ast_register_application2(app, execute, synopsis, description, ast_module_info->self)
00531 
00532 /*! 
00533  * \brief Register an application using XML documentation.
00534  *
00535  * \param app Short name of the application
00536  * \param execute a function callback to execute the application. It should return
00537  *                non-zero if the channel needs to be hung up.
00538  * 
00539  * This registers an application with Asterisk's internal application list. 
00540  * \note The individual applications themselves are responsible for registering and unregistering
00541  *       and unregistering their own CLI commands.
00542  * 
00543  * \retval 0 success 
00544  * \retval -1 failure.
00545  */
00546 #define ast_register_application_xml(app, execute) ast_register_application(app, execute, NULL, NULL)
00547 
00548 
00549 /*!
00550  * \brief Register an application.
00551  *
00552  * \param app Short name of the application
00553  * \param execute a function callback to execute the application. It should return
00554  *                non-zero if the channel needs to be hung up.
00555  * \param synopsis a short description (one line synopsis) of the application
00556  * \param description long description with all of the details about the use of
00557  *                    the application
00558  * \param mod module this application belongs to
00559  *
00560  * This registers an application with Asterisk's internal application list.
00561  * \note The individual applications themselves are responsible for registering and unregistering
00562  *       and unregistering their own CLI commands.
00563  *
00564  * \retval 0 success
00565  * \retval -1 failure.
00566  */
00567 int ast_register_application2(const char *app, int (*execute)(struct ast_channel *, const char *),
00568                  const char *synopsis, const char *description, void *mod);
00569 
00570 /*! 
00571  * \brief Unregister an application
00572  * 
00573  * \param app name of the application (does not have to be the same string as the one that was registered)
00574  * 
00575  * This unregisters an application from Asterisk's internal application list.
00576  * 
00577  * \retval 0 success 
00578  * \retval -1 failure
00579  */
00580 int ast_unregister_application(const char *app);
00581 
00582 const char *ast_module_support_level_to_string(enum ast_module_support_level support_level);
00583 
00584 /*! Macro to safely ref and unref the self module for the current scope */
00585 #define SCOPED_MODULE_USE(module) \
00586    RAII_VAR(struct ast_module *, __self__ ## __LINE__, ast_module_ref(module), ast_module_unref)
00587 
00588 #if defined(__cplusplus) || defined(c_plusplus)
00589 }
00590 #endif
00591 
00592 #endif /* _ASTERISK_MODULE_H */

Generated on Thu Apr 16 06:27:40 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6