36 #ifndef _ASTERISK_MODULE_H
37 #define _ASTERISK_MODULE_H
41 #if defined(__cplusplus) || defined(c_plusplus)
46 #define ASTERISK_GPL_KEY \
47 "This paragraph is copyright (c) 2006 by Digium, Inc. \
48 In order for your module to load, it must return this \
49 key via a function called \"key\". Any code which \
50 includes this paragraph must be licensed under the GNU \
51 General Public License version 2 or later (at your \
52 option). In addition to Digium's general reservations \
53 of rights, Digium expressly reserves the right to \
54 allow other parties to license this paragraph under \
55 different terms. Any use of Digium, Inc. trademarks or \
56 logos (including \"Asterisk\" or \"Digium\") without \
57 express written permission of Digium, Inc. is prohibited.\n"
59 #define AST_MODULE_CONFIG "modules.conf"
84 AST_MODULE_LOAD_SKIP = 2,
90 AST_MODULE_LOAD_PRIORITY = 3,
119 enum ast_module_support_level {
120 AST_MODULE_SUPPORT_UNKNOWN,
121 AST_MODULE_SUPPORT_CORE,
122 AST_MODULE_SUPPORT_EXTENDED,
123 AST_MODULE_SUPPORT_DEPRECATED,
216 int usecnt,
const char *status,
const char *like,
217 enum ast_module_support_level support_level),
233 int usecnt,
const char *status,
const char *like,
234 enum ast_module_support_level support_level,
236 const char *like,
void *data);
252 int usecnt,
const char *status,
const char *like,
253 enum ast_module_support_level support_level,
254 void *
data,
const char *condition),
255 const char *like,
void *data,
const char *condition);
321 struct ast_module_user_list;
328 enum ast_module_flags {
329 AST_MODFLAG_DEFAULT = 0,
330 AST_MODFLAG_GLOBAL_SYMBOLS = (1 << 0),
331 AST_MODFLAG_LOAD_ORDER = (1 << 1),
438 void __ast_module_user_hangup_all(
struct ast_module *);
440 #define ast_module_user_add(chan) __ast_module_user_add(AST_MODULE_SELF, chan)
441 #define ast_module_user_remove(user) __ast_module_user_remove(AST_MODULE_SELF, user)
442 #define ast_module_user_hangup_all() __ast_module_user_hangup_all(AST_MODULE_SELF)
444 struct ast_module *__ast_module_ref(
struct ast_module *mod,
const char *file,
int line,
const char *func);
445 struct ast_module *__ast_module_running_ref(
struct ast_module *mod,
const char *file,
int line,
const char *func);
446 void __ast_module_shutdown_ref(
struct ast_module *mod,
const char *file,
int line,
const char *func);
447 void __ast_module_unref(
struct ast_module *mod,
const char *file,
int line,
const char *func);
457 #define ast_module_ref(mod) __ast_module_ref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
469 #define ast_module_running_ref(mod) \
470 __ast_module_running_ref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
478 #define ast_module_shutdown_ref(mod) __ast_module_shutdown_ref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
483 #define ast_module_unref(mod) __ast_module_unref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
485 #if defined(__cplusplus) || defined(c_plusplus)
486 #define AST_MODULE_INFO(keystr, flags_to_set, desc, load_func, unload_func, reload_func, load_pri, support_level) \
487 static struct ast_module_info __mod_info = { \
507 static void __attribute__((constructor)) __reg_module(void) \
509 ast_module_register(&__mod_info); \
511 static void __attribute__((destructor)) __unreg_module(void) \
513 ast_module_unregister(&__mod_info); \
515 struct ast_module *AST_MODULE_SELF_SYM(void) \
517 return __mod_info.self; \
519 static const __attribute__((unused)) struct ast_module_info *ast_module_info = &__mod_info
522 #define AST_MODULE_INFO_STANDARD(keystr, desc) \
523 AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc, \
527 AST_MODPRI_DEFAULT, \
528 AST_MODULE_SUPPORT_CORE \
531 #define AST_MODULE_INFO_STANDARD_EXTENDED(keystr, desc) \
532 AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc, \
536 AST_MODPRI_DEFAULT, \
537 AST_MODULE_SUPPORT_EXTENDED \
539 #define AST_MODULE_INFO_STANDARD_DEPRECATED(keystr, desc) \
540 AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc, \
544 AST_MODPRI_DEFAULT, \
545 AST_MODULE_SUPPORT_DEPRECATED \
553 #if !defined(AST_IN_CORE)
557 #define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...) \
558 static struct ast_module_info \
560 .name = AST_MODULE, \
561 .flags = flags_to_set, \
562 .description = desc, \
564 .buildopt_sum = AST_BUILDOPT_SUM, \
567 static void __attribute__((constructor)) __reg_module(void) \
569 ast_module_register(&__mod_info); \
571 static void __attribute__((destructor)) __unreg_module(void) \
573 ast_module_unregister(&__mod_info); \
575 struct ast_module *AST_MODULE_SELF_SYM(void) \
577 return __mod_info.self; \
579 static const struct ast_module_info *ast_module_info = &__mod_info
581 #define AST_MODULE_INFO_STANDARD(keystr, desc) \
582 AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc, \
583 .load = load_module, \
584 .unload = unload_module, \
585 .load_pri = AST_MODPRI_DEFAULT, \
586 .support_level = AST_MODULE_SUPPORT_CORE, \
589 #define AST_MODULE_INFO_STANDARD_EXTENDED(keystr, desc) \
590 AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc, \
591 .load = load_module, \
592 .unload = unload_module, \
593 .load_pri = AST_MODPRI_DEFAULT, \
594 .support_level = AST_MODULE_SUPPORT_EXTENDED, \
597 #define AST_MODULE_INFO_STANDARD_DEPRECATED(keystr, desc) \
598 AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc, \
599 .load = load_module, \
600 .unload = unload_module, \
601 .load_pri = AST_MODPRI_DEFAULT, \
602 .support_level = AST_MODULE_SUPPORT_DEPRECATED, \
624 #define ast_register_application(app, execute, synopsis, description) ast_register_application2(app, execute, synopsis, description, AST_MODULE_SELF)
640 #define ast_register_application_xml(app, execute) ast_register_application(app, execute, NULL, NULL)
662 const char *synopsis,
const char *description,
void *mod);
676 const char *ast_module_support_level_to_string(
enum ast_module_support_level support_level);
679 #define SCOPED_MODULE_USE(module) \
680 RAII_VAR(struct ast_module *, __self__ ## __LINE__, ast_module_ref(module), ast_module_unref)
682 #if defined(__cplusplus) || defined(c_plusplus)
Main Channel structure associated with a channel.
static SQLHSTMT execute(struct odbc_obj *obj, void *data, int silent)
Common execution function for SQL queries.
char * ast_module_helper(const char *line, const char *word, int pos, int state, int rpos, enum ast_module_helper_type type)
Match modules names for the Asterisk cli.
enum ast_module_load_result ast_load_resource(const char *resource_name)
Load a module.
enum ast_module_reload_result ast_module_reload(const char *name)
Reload asterisk modules.
ast_module_reload_result
Possible return types for ast_module_reload.
int ast_refresh_resource(const char *resource_name, enum ast_module_unload_mode force, int recursive)
Unload and load a module again.
void ast_update_use_count(void)
Notify when usecount has been changed.
int ast_unregister_application(const char *app)
Unregister an application.
const char * enhances
Modules that we provide enhanced functionality for.
int ast_module_check(const char *name)
Check if module with the name given is loaded.
int ast_update_module_list(int(*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level), const char *like)
Ask for a list of modules, descriptions, use counts and status.
int ast_update_module_list_data(int(*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level, void *data), const char *like, void *data)
Ask for a list of modules, descriptions, use counts and status.
const char * optional_modules
Comma-separated list of optionally required modules.
int ast_loader_unregister(int(*updater)(void))
Remove a procedure to be run when modules are updated.
int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode)
Unload a module.
int ast_update_module_list_condition(int(*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level, void *data, const char *condition), const char *like, void *data, const char *condition)
Ask for a list of modules, descriptions, use counts and status.
union ast_frame::@224 data
Module could not be loaded properly.
Module has failed to load, may be in an inconsistent state.
int ast_loader_register(int(*updater)(void))
Add a procedure to be run when modules have been updated.
const char * ast_module_name(const struct ast_module *mod)
Get the name of a module.
int ast_register_application2(const char *app, int(*execute)(struct ast_channel *, const char *), const char *synopsis, const char *description, void *mod)
Register an application.
enum ast_module_load_result(* load)(void)
enum ast_module_support_level support_level
const char buildopt_sum[33]