Asterisk - The Open Source Telephony Project GIT-master-67613d1
module.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 1999 - 2008, Digium, Inc.
5 *
6 * Mark Spencer <markster@digium.com>
7 * Kevin P. Fleming <kpfleming@digium.com>
8 * Luigi Rizzo <rizzo@icir.org>
9 *
10 * See http://www.asterisk.org for more information about
11 * the Asterisk project. Please do not directly contact
12 * any of the maintainers of this project for assistance;
13 * the project provides a web site, mailing lists and IRC
14 * channels for your use.
15 *
16 * This program is free software, distributed under the terms of
17 * the GNU General Public License Version 2. See the LICENSE file
18 * at the top of the source tree.
19 */
20
21/*! \file
22 * \brief Asterisk module definitions.
23 *
24 * This file contains the definitons for functions Asterisk modules should
25 * provide and some other module related functions.
26 */
27
28/*! \li \ref module.h uses the configuration file \ref modules.conf
29 * \addtogroup configuration_file
30 */
31
32/*! \page modules.conf modules.conf
33 * \verbinclude modules.conf.sample
34 */
35
36#ifndef _ASTERISK_MODULE_H
37#define _ASTERISK_MODULE_H
38
39#include "asterisk/utils.h"
40
41#if defined(__cplusplus) || defined(c_plusplus)
42extern "C" {
43#endif
44
45/*! \brief The text the key() function should return. */
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"
58
59#define AST_MODULE_CONFIG "modules.conf" /*!< \brief Module configuration file */
60
62 AST_FORCE_SOFT = 0, /*!< Softly unload a module, only if not in use */
63 AST_FORCE_FIRM = 1, /*!< Firmly unload a module, even if in use */
64 AST_FORCE_HARD = 2, /*!< as FIRM, plus dlclose() on the module. Not recommended
65 as it may cause crashes */
66};
67
69 /*! Module is loaded and configured. */
71 /*!
72 * \brief Module has failed to load, may be in an inconsistent state.
73 *
74 * This value is used when a module fails to start but does not risk
75 * system-wide stability. Declined modules will prevent any other
76 * dependent module from starting.
77 */
79 /*! \internal
80 * \brief Module was skipped for some reason.
81 *
82 * \note For loader.c use only. Should never be returned by modules.
83 */
85 /*! \internal
86 * \brief Module is not loaded yet, but is added to priority list.
87 *
88 * \note For loader.c use only. Should never be returned by modules.
89 */
91 /*!
92 * \brief Module could not be loaded properly.
93 *
94 * This return should only be returned by modules for unrecoverable
95 * failures that cause the whole system to become unstable. In almost
96 * all cases \ref AST_MODULE_LOAD_DECLINE should be used instead.
97 *
98 * \warning Returning this code from any module will cause startup to abort.
99 * If startup is already completed this code has the same effect as
100 * \ref AST_MODULE_LOAD_DECLINE.
101 */
103};
104
105/*!
106 * \since 12
107 * \brief Possible return types for \ref ast_module_reload
108 */
110 AST_MODULE_RELOAD_SUCCESS = 0, /*!< The module was reloaded succesfully */
111 AST_MODULE_RELOAD_QUEUED, /*!< The module reload request was queued */
112 AST_MODULE_RELOAD_NOT_FOUND, /*!< The requested module was not found */
113 AST_MODULE_RELOAD_ERROR, /*!< An error occurred while reloading the module */
114 AST_MODULE_RELOAD_IN_PROGRESS, /*!< A module reload request is already in progress */
115 AST_MODULE_RELOAD_UNINITIALIZED, /*!< The module has not been initialized */
116 AST_MODULE_RELOAD_NOT_IMPLEMENTED, /*!< This module doesn't support reloading */
117};
118
124};
125
126/*! Used to specify which modules should be returned by ast_module_helper. */
128 /*! Modules that are loaded by dlopen. */
130 /*! Running modules that include a reload callback. */
132 /*! Modules that can be loaded or started. */
134 /*! Modules that can be unloaded. */
136 /*! Running modules */
138};
139
140/*!
141 * \brief Load a module.
142 * \param resource_name The name of the module to load.
143 *
144 * This function is run by the PBX to load the modules. It performs
145 * all loading and initialization tasks. Basically, to load a module, just
146 * give it the name of the module and it will do the rest.
147 *
148 * \return See possible enum values for ast_module_load_result.
149 */
150enum ast_module_load_result ast_load_resource(const char *resource_name);
151
152/*!
153 * \brief Unload a module.
154 * \param resource_name The name of the module to unload.
155 * \param ast_module_unload_mode The force flag. This should be set using one of the AST_FORCE flags.
156 *
157 * This function unloads a module. It will only unload modules that are not in
158 * use (usecount not zero), unless #AST_FORCE_FIRM or #AST_FORCE_HARD is
159 * specified. Setting #AST_FORCE_FIRM or #AST_FORCE_HARD will unload the
160 * module regardless of consequences (NOT RECOMMENDED).
161 *
162 * \retval 0 on success.
163 * \retval -1 on error.
164 */
165int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode);
166
167/*!
168 * \brief Reload asterisk modules.
169 * \param name the name of the module to reload
170 *
171 * This function reloads the specified module, or if no modules are specified,
172 * it will reload all loaded modules.
173 *
174 * \note Modules are reloaded using their reload() functions, not unloading
175 * them and loading them again.
176 *
177 * \retval The \ref ast_module_reload_result status of the module load request
178 */
180
181/*!
182 * \brief Notify when usecount has been changed.
183 *
184 * This function calculates use counts and notifies anyone trying to keep track
185 * of them. It should be called whenever your module's usecount changes.
186 *
187 * \note The ast_module_user_* functions take care of calling this function for you.
188 */
189void ast_update_use_count(void);
190
191/*!
192 * \brief Ask for a list of modules, descriptions, use counts and status.
193 * \param modentry A callback to an updater function.
194 * \param like
195 *
196 * For each of the modules loaded, modentry will be executed with the resource,
197 * description, and usecount values of each particular module.
198 *
199 * \return the number of modules loaded
200 */
201int ast_update_module_list(int (*modentry)(const char *module, const char *description,
202 int usecnt, const char *status, const char *like,
203 enum ast_module_support_level support_level),
204 const char *like);
205
206/*!
207 * \brief Ask for a list of modules, descriptions, use counts and status.
208 * \param modentry A callback to an updater function
209 * \param like
210 * \param data Data passed into the callback for manipulation
211 *
212 * For each of the modules loaded, modentry will be executed with the resource,
213 * description, and usecount values of each particular module.
214 *
215 * \return the number of modules loaded
216 * \since 13.5.0
217 */
218int ast_update_module_list_data(int (*modentry)(const char *module, const char *description,
219 int usecnt, const char *status, const char *like,
220 enum ast_module_support_level support_level,
221 void *data),
222 const char *like, void *data);
223
224/*!
225 * \brief Ask for a list of modules, descriptions, use counts and status.
226 * \param modentry A callback to an updater function
227 * \param like
228 * \param data Data passed into the callback for manipulation
229 * \param condition The condition to meet
230 *
231 * For each of the modules loaded, modentry will be executed with the resource,
232 * description, and usecount values of each particular module.
233 *
234 * \return the number of conditions met
235 * \since 13.5.0
236 */
237int ast_update_module_list_condition(int (*modentry)(const char *module, const char *description,
238 int usecnt, const char *status, const char *like,
239 enum ast_module_support_level support_level,
240 void *data, const char *condition),
241 const char *like, void *data, const char *condition);
242
243/*!
244 * \brief Check if module with the name given is loaded
245 * \param name Module name, like "chan_pjsip.so"
246 * \retval 1 if true
247 * \retval 0 if false
248 */
249int ast_module_check(const char *name);
250
251/*!
252 * \brief Add a procedure to be run when modules have been updated.
253 * \param updater The function to run when modules have been updated.
254 *
255 * This function adds the given function to a linked list of functions to be
256 * run when the modules are updated.
257 *
258 * \retval 0 on success
259 * \retval -1 on failure.
260 */
261int ast_loader_register(int (*updater)(void));
262
263/*!
264 * \brief Remove a procedure to be run when modules are updated.
265 * \param updater The updater function to unregister.
266 *
267 * This removes the given function from the updater list.
268 *
269 * \retval 0 on success
270 * \retval -1 on failure.
271 */
272int ast_loader_unregister(int (*updater)(void));
273
274/*!
275 * \brief Match modules names for the Asterisk cli.
276 * \param line Unused by this function, but this should be the line we are
277 * matching.
278 * \param word The partial name to match.
279 * \param pos The position the word we are completing is in.
280 * \param state The possible match to return.
281 * \param rpos The position we should be matching. This should be the same as
282 * pos.
283 * \param type The type of action that will be performed by CLI.
284 *
285 * \retval A possible completion of the partial match.
286 * \retval NULL if no matches were found or Asterisk is not yet fully booted.
287 */
288char *ast_module_helper(const char *line, const char *word, int pos, int state, int rpos, enum ast_module_helper_type type);
289
290/* Opaque type for module handles generated by the loader */
291
292struct ast_module;
293
294/*!
295 * \brief Get the name of a module.
296 * \param mod A pointer to the module.
297 * \return the name of the module
298 * \retval NULL if mod or mod->info is NULL
299 */
300const char *ast_module_name(const struct ast_module *mod);
301
302/* User count routines keep track of which channels are using a given module
303 resource. They can help make removing modules safer, particularly if
304 they're in use at the time they have been requested to be removed */
305
306struct ast_module_user;
307struct ast_module_user_list;
308
309/*! \page ModMngmnt The Asterisk Module management interface
310 *
311 * All modules must implement the module API (load, unload...)
312 */
313
318};
319
321 AST_MODPRI_REALTIME_DEPEND = 10, /*!< Dependency for a realtime driver */
322 AST_MODPRI_REALTIME_DEPEND2 = 20, /*!< Second level dependency for a realtime driver (func_curl needs res_curl, but is needed by res_config_curl) */
323 AST_MODPRI_REALTIME_DRIVER = 30, /*!< A realtime driver, which provides configuration services for other modules */
324 AST_MODPRI_CORE = 40, /*!< A core module originally meant to start between preload and load. */
325 AST_MODPRI_TIMING = 50, /*!< Dependency for a channel (MOH needs timing interfaces to be fully loaded) */
326 AST_MODPRI_CHANNEL_DEPEND = 60, /*!< Channel driver dependency (may depend upon realtime, e.g. MOH) */
327 AST_MODPRI_CHANNEL_DRIVER = 70, /*!< Channel drivers (provide devicestate) */
328 AST_MODPRI_APP_DEPEND = 80, /*!< Dependency for an application */
329 AST_MODPRI_DEVSTATE_PROVIDER = 90, /*!< Applications and other modules that _provide_ devicestate (e.g. meetme) */
330 AST_MODPRI_DEVSTATE_PLUGIN = 100, /*!< Plugin for a module that provides devstate (e.g. res_calendar_*) */
331 AST_MODPRI_CDR_DRIVER = 110, /*!< CDR or CEL backend */
332 AST_MODPRI_DEFAULT = 128, /*!< Modules not otherwise defined (such as most apps) will load here */
333 AST_MODPRI_DEVSTATE_CONSUMER = 150, /*!< Certain modules, which consume devstate, need to load after all others (e.g. app_queue) */
334};
335
337 /*!
338 * The 'self' pointer for a module; it will be set by the loader before
339 * it calls the module's load_module() entrypoint, and used by various
340 * other macros that need to identify the module.
341 */
343 /*! Register stuff etc. Optional. */
344 enum ast_module_load_result (*load)(void);
345 /*! Config etc. Optional. */
346 int (*reload)(void);
347 /*! Unload. called with the module locked */
348 int (*unload)(void);
349 /*! Name of the module for loader reference and CLI commands */
350 const char *name;
351 /*! User friendly description of the module. */
352 const char *description;
353
354 /*!
355 * This holds the ASTERISK_GPL_KEY, signifying that you agree to the terms of
356 * the Asterisk license as stated in the ASTERISK_GPL_KEY. Your module will not
357 * load if it does not return the EXACT key string.
358 */
359 const char *key;
360 unsigned int flags;
361
362 /*! The value of AST_BUILDOPT_SUM when this module was compiled */
363 const char buildopt_sum[33];
364
365 /*! This value represents the order in which a module's load() function is initialized.
366 * The lower this value, the higher the priority. The value is only checked if the
367 * AST_MODFLAG_LOAD_ORDER flag is set. If the AST_MODFLAG_LOAD_ORDER flag is not set,
368 * this value will never be read and the module will be given the lowest possible priority
369 * on load. */
370 unsigned char load_pri;
371
372 /*! Modules which must always be started first, in comma-separated string format. */
373 const char *requires;
374
375 /*!
376 * \brief Comma-separated list of optionally required modules.
377 *
378 * The listed modules are optional, but load order is enforced. For example
379 * app_voicemail optionally requires res_adsi. This means that app_voicemail
380 * will happily load without res_adsi, but if both are being loaded the module
381 * loader will force res_adsi to start first.
382 */
383 const char *optional_modules;
384
385 /*!
386 * \brief Modules that we provide enhanced functionality for.
387 *
388 * This is similar to a "requires" but specifies that we add functionality to
389 * the other modules. Any module that requires something we "enhances" will
390 * also require us, but only if we are dlopen'ed.
391 *
392 * Example:
393 * - res_fax_spandsp has .enhances = "res_fax".
394 * - res_my_module has .requires = "res_fax" but has no direct knowledge
395 * of res_fax_spandsp.
396 *
397 * This forces the following startup order among the 3 modules:
398 * 1) res_fax starts.
399 * 2) res_fax_spandsp starts, holds a reference to res_fax.
400 * 3) res_mymod starts, holds a reference to res_fax and res_fax_spandsp.
401 *
402 * If res_fax_spandsp were not being loaded res_mymod would load with
403 * res_fax only. If res_fax_spandsp were later loaded res_mymod would
404 * get a reference to it.
405 */
406 const char *enhances;
407
408 /*! These reserved fields should be NULL, they exist to allow addition to this
409 * structure in a non-breaking way. */
414
415 /*! The support level for the given module */
417};
418
419void ast_module_register(const struct ast_module_info *);
420void ast_module_unregister(const struct ast_module_info *);
421
425
426#define ast_module_user_add(chan) __ast_module_user_add(AST_MODULE_SELF, chan)
427#define ast_module_user_remove(user) __ast_module_user_remove(AST_MODULE_SELF, user)
428#define ast_module_user_hangup_all() __ast_module_user_hangup_all(AST_MODULE_SELF)
429
430struct ast_module *__ast_module_ref(struct ast_module *mod, const char *file, int line, const char *func);
431struct ast_module *__ast_module_running_ref(struct ast_module *mod, const char *file, int line, const char *func);
432void __ast_module_shutdown_ref(struct ast_module *mod, const char *file, int line, const char *func);
433void __ast_module_unref(struct ast_module *mod, const char *file, int line, const char *func);
434
435/*!
436 * \brief Hold a reference to the module
437 * \param mod Module to reference
438 * \return mod
439 *
440 * \note A module reference will prevent the module
441 * from being unloaded.
442 */
443#define ast_module_ref(mod) __ast_module_ref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
444
445/*!
446 * \brief Hold a reference to the module if it is running.
447 * \param mod Module to reference
448 * \retval mod if running
449 * \retval NULL if not running
450 *
451 * The returned pointer should be released with ast_module_unref.
452 *
453 * \note A module reference will prevent the module from being unloaded.
454 */
455#define ast_module_running_ref(mod) \
456 __ast_module_running_ref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
457
458/*!
459 * \brief Prevent unload of the module before shutdown
460 * \param mod Module to hold
461 *
462 * \note This should not be balanced by a call to ast_module_unref.
463 */
464#define ast_module_shutdown_ref(mod) __ast_module_shutdown_ref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
465/*!
466 * \brief Release a reference to the module
467 * \param mod Module to release
468 */
469#define ast_module_unref(mod) __ast_module_unref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
470
471#if defined(__cplusplus) || defined(c_plusplus)
472#define AST_MODULE_INFO(keystr, flags_to_set, desc, load_func, unload_func, reload_func, load_pri, support_level) \
473 static struct ast_module_info __mod_info = { \
474 NULL, \
475 load_func, \
476 reload_func, \
477 unload_func, \
478 AST_MODULE, \
479 desc, \
480 keystr, \
481 flags_to_set, \
482 AST_BUILDOPT_SUM, \
483 load_pri, \
484 NULL, \
485 NULL, \
486 NULL, \
487 NULL, \
488 NULL, \
489 NULL, \
490 NULL, \
491 support_level, \
492 }; \
493 static void __attribute__((constructor)) __reg_module(void) \
494 { \
495 ast_module_register(&__mod_info); \
496 } \
497 static void __attribute__((destructor)) __unreg_module(void) \
498 { \
499 ast_module_unregister(&__mod_info); \
500 } \
501 struct ast_module *AST_MODULE_SELF_SYM(void) \
502 { \
503 return __mod_info.self; \
504 } \
505 static const __attribute__((unused)) struct ast_module_info *ast_module_info = &__mod_info
506
507
508#define AST_MODULE_INFO_STANDARD(keystr, desc) \
509 AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc, \
510 load_module, \
511 unload_module, \
512 NULL, \
513 AST_MODPRI_DEFAULT, \
514 AST_MODULE_SUPPORT_CORE \
515 )
516
517#define AST_MODULE_INFO_STANDARD_EXTENDED(keystr, desc) \
518 AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc, \
519 load_module, \
520 unload_module, \
521 NULL, \
522 AST_MODPRI_DEFAULT, \
523 AST_MODULE_SUPPORT_EXTENDED \
524 )
525#define AST_MODULE_INFO_STANDARD_DEPRECATED(keystr, desc) \
526 AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc, \
527 load_module, \
528 unload_module, \
529 NULL, \
530 AST_MODPRI_DEFAULT, \
531 AST_MODULE_SUPPORT_DEPRECATED \
532 )
533
534#else /* plain C */
535
536/* forward declare this pointer in modules, so that macro/function
537 calls that need it can get it, since it will actually be declared
538 and populated at the end of the module's source file... */
539#if !defined(AST_IN_CORE)
540static const __attribute__((unused)) struct ast_module_info *ast_module_info;
541#endif
542
543#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...) \
544 static struct ast_module_info \
545 __mod_info = { \
546 .name = AST_MODULE, \
547 .flags = flags_to_set, \
548 .description = desc, \
549 .key = keystr, \
550 .buildopt_sum = AST_BUILDOPT_SUM, \
551 fields \
552 }; \
553 static void __attribute__((constructor)) __reg_module(void) \
554 { \
555 ast_module_register(&__mod_info); \
556 } \
557 static void __attribute__((destructor)) __unreg_module(void) \
558 { \
559 ast_module_unregister(&__mod_info); \
560 } \
561 struct ast_module *AST_MODULE_SELF_SYM(void) \
562 { \
563 return __mod_info.self; \
564 } \
565 static const struct ast_module_info *ast_module_info = &__mod_info
566
567#define AST_MODULE_INFO_STANDARD(keystr, desc) \
568 AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc, \
569 .load = load_module, \
570 .unload = unload_module, \
571 .load_pri = AST_MODPRI_DEFAULT, \
572 .support_level = AST_MODULE_SUPPORT_CORE, \
573 )
574
575#define AST_MODULE_INFO_STANDARD_EXTENDED(keystr, desc) \
576 AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc, \
577 .load = load_module, \
578 .unload = unload_module, \
579 .load_pri = AST_MODPRI_DEFAULT, \
580 .support_level = AST_MODULE_SUPPORT_EXTENDED, \
581 )
582
583#define AST_MODULE_INFO_STANDARD_DEPRECATED(keystr, desc) \
584 AST_MODULE_INFO(keystr, AST_MODFLAG_LOAD_ORDER, desc, \
585 .load = load_module, \
586 .unload = unload_module, \
587 .load_pri = AST_MODPRI_DEFAULT, \
588 .support_level = AST_MODULE_SUPPORT_DEPRECATED, \
589 )
590
591#endif /* plain C */
592
593/*!
594 * \brief Register an application.
595 *
596 * \param app Short name of the application
597 * \param execute a function callback to execute the application. It should return
598 * non-zero if the channel needs to be hung up.
599 * \param synopsis a short description (one line synopsis) of the application
600 * \param description long description with all of the details about the use of
601 * the application
602 *
603 * This registers an application with Asterisk's internal application list.
604 * \note The individual applications themselves are responsible for registering and unregistering
605 * and unregistering their own CLI commands.
606 *
607 * \retval 0 success
608 * \retval -1 failure.
609 */
610#define ast_register_application(app, execute, synopsis, description) ast_register_application2(app, execute, synopsis, description, AST_MODULE_SELF)
611
612/*!
613 * \brief Register an application using XML documentation.
614 *
615 * \param app Short name of the application
616 * \param execute a function callback to execute the application. It should return
617 * non-zero if the channel needs to be hung up.
618 *
619 * This registers an application with Asterisk's internal application list.
620 * \note The individual applications themselves are responsible for registering and unregistering
621 * and unregistering their own CLI commands.
622 *
623 * \retval 0 success
624 * \retval -1 failure.
625 */
626#define ast_register_application_xml(app, execute) ast_register_application(app, execute, NULL, NULL)
627
628
629/*!
630 * \brief Register an application.
631 *
632 * \param app Short name of the application
633 * \param execute a function callback to execute the application. It should return
634 * non-zero if the channel needs to be hung up.
635 * \param synopsis a short description (one line synopsis) of the application
636 * \param description long description with all of the details about the use of
637 * the application
638 * \param mod module this application belongs to
639 *
640 * This registers an application with Asterisk's internal application list.
641 * \note The individual applications themselves are responsible for registering and unregistering
642 * and unregistering their own CLI commands.
643 *
644 * \retval 0 success
645 * \retval -1 failure.
646 */
647int ast_register_application2(const char *app, int (*execute)(struct ast_channel *, const char *),
648 const char *synopsis, const char *description, void *mod);
649
650/*!
651 * \brief Unregister an application
652 *
653 * \param app name of the application (does not have to be the same string as the one that was registered)
654 *
655 * This unregisters an application from Asterisk's internal application list.
656 *
657 * \retval 0 success
658 * \retval -1 failure
659 */
660int ast_unregister_application(const char *app);
661
663
664/*! Macro to safely ref and unref the self module for the current scope */
665#define SCOPED_MODULE_USE(module) \
666 RAII_VAR(struct ast_module *, __self__ ## __LINE__, ast_module_ref(module), ast_module_unref)
667
668#if defined(__cplusplus) || defined(c_plusplus)
669}
670#endif
671
672#endif /* _ASTERISK_MODULE_H */
static const char app[]
Definition: app_adsiprog.c:56
jack_status_t status
Definition: app_jack.c:146
static int usecnt
Definition: chan_ooh323.c:332
static const char type[]
Definition: chan_ooh323.c:109
short word
static const char name[]
Definition: format_mp3.c:68
static char * synopsis
Definition: func_enum.c:154
static SQLHSTMT execute(struct odbc_obj *obj, void *data, int silent)
Common execution function for SQL queries.
Definition: func_odbc.c:471
void __ast_module_unref(struct ast_module *mod, const char *file, int line, const char *func)
Definition: loader.c:2750
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.
Definition: loader.c:2583
int ast_loader_unregister(int(*updater)(void))
Remove a procedure to be run when modules are updated.
Definition: loader.c:2697
struct ast_module * __ast_module_ref(struct ast_module *mod, const char *file, int line, const char *func)
Definition: loader.c:2714
ast_module_flags
Definition: module.h:314
@ AST_MODFLAG_LOAD_ORDER
Definition: module.h:317
@ AST_MODFLAG_DEFAULT
Definition: module.h:315
@ AST_MODFLAG_GLOBAL_SYMBOLS
Definition: module.h:316
int ast_module_check(const char *name)
Check if module with the name given is loaded.
Definition: loader.c:2669
void ast_module_register(const struct ast_module_info *)
Definition: loader.c:659
void ast_update_use_count(void)
Notify when usecount has been changed.
Definition: loader.c:2544
const char * ast_module_support_level_to_string(enum ast_module_support_level support_level)
Definition: loader.c:2771
int ast_loader_register(int(*updater)(void))
Add a procedure to be run when modules have been updated.
Definition: loader.c:2682
struct ast_module_user * __ast_module_user_add(struct ast_module *, struct ast_channel *)
Definition: loader.c:800
int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode)
Unload a module.
Definition: loader.c:1219
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.
Definition: pbx_app.c:103
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.
Definition: loader.c:1374
enum ast_module_load_result ast_load_resource(const char *resource_name)
Load a module.
Definition: loader.c:1824
void __ast_module_shutdown_ref(struct ast_module *mod, const char *file, int line, const char *func)
Definition: loader.c:2740
ast_module_load_priority
Definition: module.h:320
@ AST_MODPRI_APP_DEPEND
Definition: module.h:328
@ AST_MODPRI_DEFAULT
Definition: module.h:332
@ AST_MODPRI_CDR_DRIVER
Definition: module.h:331
@ AST_MODPRI_CHANNEL_DRIVER
Definition: module.h:327
@ AST_MODPRI_CORE
Definition: module.h:324
@ AST_MODPRI_REALTIME_DEPEND
Definition: module.h:321
@ AST_MODPRI_TIMING
Definition: module.h:325
@ AST_MODPRI_REALTIME_DRIVER
Definition: module.h:323
@ AST_MODPRI_CHANNEL_DEPEND
Definition: module.h:326
@ AST_MODPRI_DEVSTATE_CONSUMER
Definition: module.h:333
@ AST_MODPRI_REALTIME_DEPEND2
Definition: module.h:322
@ AST_MODPRI_DEVSTATE_PROVIDER
Definition: module.h:329
@ AST_MODPRI_DEVSTATE_PLUGIN
Definition: module.h:330
ast_module_support_level
Definition: module.h:119
@ AST_MODULE_SUPPORT_DEPRECATED
Definition: module.h:123
@ AST_MODULE_SUPPORT_CORE
Definition: module.h:121
@ AST_MODULE_SUPPORT_EXTENDED
Definition: module.h:122
@ AST_MODULE_SUPPORT_UNKNOWN
Definition: module.h:120
ast_module_unload_mode
Definition: module.h:61
@ AST_FORCE_SOFT
Definition: module.h:62
@ AST_FORCE_HARD
Definition: module.h:64
@ AST_FORCE_FIRM
Definition: module.h:63
ast_module_reload_result
Possible return types for ast_module_reload.
Definition: module.h:109
@ AST_MODULE_RELOAD_IN_PROGRESS
Definition: module.h:114
@ AST_MODULE_RELOAD_QUEUED
Definition: module.h:111
@ AST_MODULE_RELOAD_SUCCESS
Definition: module.h:110
@ AST_MODULE_RELOAD_ERROR
Definition: module.h:113
@ AST_MODULE_RELOAD_NOT_IMPLEMENTED
Definition: module.h:116
@ AST_MODULE_RELOAD_NOT_FOUND
Definition: module.h:112
@ AST_MODULE_RELOAD_UNINITIALIZED
Definition: module.h:115
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx_app.c:392
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.
Definition: loader.c:2610
static const struct ast_module_info * ast_module_info
Definition: module.h:540
ast_module_load_result
Definition: module.h:68
@ AST_MODULE_LOAD_PRIORITY
Definition: module.h:90
@ AST_MODULE_LOAD_FAILURE
Module could not be loaded properly.
Definition: module.h:102
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
@ AST_MODULE_LOAD_SKIP
Definition: module.h:84
const char * ast_module_name(const struct ast_module *mod)
Get the name of a module.
Definition: loader.c:615
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.
Definition: loader.c:2638
struct ast_module * __ast_module_running_ref(struct ast_module *mod, const char *file, int line, const char *func)
Definition: loader.c:2730
void ast_module_unregister(const struct ast_module_info *)
Definition: loader.c:768
void __ast_module_user_remove(struct ast_module *, struct ast_module_user *)
Definition: loader.c:826
ast_module_helper_type
Definition: module.h:127
@ AST_MODULE_HELPER_RELOAD
Definition: module.h:131
@ AST_MODULE_HELPER_LOADED
Definition: module.h:129
@ AST_MODULE_HELPER_UNLOAD
Definition: module.h:135
@ AST_MODULE_HELPER_LOAD
Definition: module.h:133
@ AST_MODULE_HELPER_RUNNING
Definition: module.h:137
enum ast_module_reload_result ast_module_reload(const char *name)
Reload asterisk modules.
Definition: loader.c:1567
void __ast_module_user_hangup_all(struct ast_module *)
Definition: loader.c:853
Main Channel structure associated with a channel.
struct ast_module * self
Definition: module.h:342
enum ast_module_load_result(* load)(void)
Definition: module.h:344
enum ast_module_support_level support_level
Definition: module.h:416
void * reserved2
Definition: module.h:411
void * reserved1
Definition: module.h:410
const char * description
Definition: module.h:352
void * reserved3
Definition: module.h:412
const char buildopt_sum[33]
Definition: module.h:363
const char * name
Definition: module.h:350
unsigned char load_pri
Definition: module.h:370
void * reserved4
Definition: module.h:413
int(* reload)(void)
Definition: module.h:346
unsigned int flags
Definition: module.h:360
const char *const char * optional_modules
Comma-separated list of optionally required modules.
Definition: module.h:383
const char * key
Definition: module.h:359
int(* unload)(void)
Definition: module.h:348
const char * enhances
Modules that we provide enhanced functionality for.
Definition: module.h:406
Utility functions.