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. \
48In order for your module to load, it must return this \
49key via a function called \"key\". Any code which \
50includes this paragraph must be licensed under the GNU \
51General Public License version 2 or later (at your \
52option). In addition to Digium's general reservations \
53of rights, Digium expressly reserves the right to \
54allow other parties to license this paragraph under \
55different terms. Any use of Digium, Inc. trademarks or \
56logos (including \"Asterisk\" or \"Digium\") without \
57express written permission of Digium, Inc. is prohibited.\n"
59#define AST_MODULE_CONFIG "modules.conf"
236 const char *like,
void *data);
254 void *data,
const char *condition),
255 const char *like,
void *data,
const char *condition);
321struct ast_module_user_list;
387 const char *
requires;
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)
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)
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)
static SQLHSTMT execute(struct odbc_obj *obj, void *data, int silent)
Common execution function for SQL queries.
void __ast_module_unref(struct ast_module *mod, const char *file, int line, const char *func)
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_loader_unregister(int(*updater)(void))
Remove a procedure to be run when modules are updated.
struct ast_module * __ast_module_ref(struct ast_module *mod, const char *file, int line, const char *func)
@ AST_MODFLAG_GLOBAL_SYMBOLS
int ast_module_check(const char *name)
Check if module with the name given is loaded.
void ast_module_register(const struct ast_module_info *)
void ast_update_use_count(void)
Notify when usecount has been changed.
const char * ast_module_support_level_to_string(enum ast_module_support_level support_level)
int ast_loader_register(int(*updater)(void))
Add a procedure to be run when modules have been updated.
struct ast_module_user * __ast_module_user_add(struct ast_module *, struct ast_channel *)
int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode)
Unload 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.
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.
int ast_refresh_resource(const char *resource_name, enum ast_module_unload_mode force, int recursive)
Unload and load a module again.
void __ast_module_shutdown_ref(struct ast_module *mod, const char *file, int line, const char *func)
@ AST_MODPRI_CHANNEL_DRIVER
@ AST_MODPRI_REALTIME_DEPEND
@ AST_MODPRI_REALTIME_DRIVER
@ AST_MODPRI_CHANNEL_DEPEND
@ AST_MODPRI_DEVSTATE_CONSUMER
@ AST_MODPRI_REALTIME_DEPEND2
@ AST_MODPRI_DEVSTATE_PROVIDER
@ AST_MODPRI_DEVSTATE_PLUGIN
@ AST_MODULE_SUPPORT_DEPRECATED
@ AST_MODULE_SUPPORT_CORE
@ AST_MODULE_SUPPORT_EXTENDED
@ AST_MODULE_SUPPORT_UNKNOWN
ast_module_reload_result
Possible return types for ast_module_reload.
@ AST_MODULE_RELOAD_IN_PROGRESS
@ AST_MODULE_RELOAD_QUEUED
@ AST_MODULE_RELOAD_SUCCESS
@ AST_MODULE_RELOAD_ERROR
@ AST_MODULE_RELOAD_NOT_IMPLEMENTED
@ AST_MODULE_RELOAD_NOT_FOUND
@ AST_MODULE_RELOAD_UNINITIALIZED
int ast_unregister_application(const char *app)
Unregister an application.
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.
static const struct ast_module_info * ast_module_info
@ AST_MODULE_LOAD_PRIORITY
@ AST_MODULE_LOAD_FAILURE
Module could not be loaded properly.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
const char * ast_module_name(const struct ast_module *mod)
Get the name of 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.
struct ast_module * __ast_module_running_ref(struct ast_module *mod, const char *file, int line, const char *func)
void ast_module_unregister(const struct ast_module_info *)
void __ast_module_user_remove(struct ast_module *, struct ast_module_user *)
@ AST_MODULE_HELPER_RELOAD
@ AST_MODULE_HELPER_LOADED
@ AST_MODULE_HELPER_UNLOAD
@ AST_MODULE_HELPER_RUNNING
enum ast_module_reload_result ast_module_reload(const char *name)
Reload asterisk modules.
void __ast_module_user_hangup_all(struct ast_module *)
Main Channel structure associated with a channel.
enum ast_module_load_result(* load)(void)
enum ast_module_support_level support_level
const char buildopt_sum[33]
const char *const char * optional_modules
Comma-separated list of optionally required modules.
const char * enhances
Modules that we provide enhanced functionality for.