Wed Jan 8 2020 09:50:15

Asterisk developer's documentation


module.h File Reference

Asterisk module definitions. More...

#include "asterisk/utils.h"

Go to the source code of this file.

Data Structures

struct  ast_module_info
 

Macros

#define __MODULE_INFO_GLOBALS
 
#define __MODULE_INFO_SECTION
 
#define AST_MODULE_CONFIG   "modules.conf"
 Module configuration file. More...
 
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
 
#define AST_MODULE_INFO_STANDARD(keystr, desc)
 
#define ast_module_user_add(chan)   __ast_module_user_add(ast_module_info->self, chan)
 
#define ast_module_user_hangup_all()   __ast_module_user_hangup_all(ast_module_info->self)
 
#define ast_module_user_remove(user)   __ast_module_user_remove(ast_module_info->self, user)
 
#define ast_register_application(app, execute, synopsis, description)   ast_register_application2(app, execute, synopsis, description, ast_module_info->self)
 Register an application. More...
 
#define ast_register_application_xml(app, execute)   ast_register_application(app, execute, NULL, NULL)
 Register an application using XML documentation. More...
 
#define ASTERISK_GPL_KEY   "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n"
 The text the key() function should return. More...
 

Enumerations

enum  ast_module_flags { AST_MODFLAG_DEFAULT = 0, AST_MODFLAG_GLOBAL_SYMBOLS = (1 << 0), AST_MODFLAG_LOAD_ORDER = (1 << 1) }
 
enum  ast_module_load_priority {
  AST_MODPRI_REALTIME_DEPEND = 10, AST_MODPRI_REALTIME_DEPEND2 = 20, AST_MODPRI_REALTIME_DRIVER = 30, AST_MODPRI_TIMING = 40,
  AST_MODPRI_CHANNEL_DEPEND = 50, AST_MODPRI_CHANNEL_DRIVER = 60, AST_MODPRI_APP_DEPEND = 70, AST_MODPRI_DEVSTATE_PROVIDER = 80,
  AST_MODPRI_DEVSTATE_PLUGIN = 90, AST_MODPRI_CDR_DRIVER = 100, AST_MODPRI_DEFAULT = 128, AST_MODPRI_DEVSTATE_CONSUMER = 150
}
 
enum  ast_module_load_result {
  AST_MODULE_LOAD_SUCCESS = 0, AST_MODULE_LOAD_DECLINE = 1, AST_MODULE_LOAD_SKIP = 2, AST_MODULE_LOAD_PRIORITY = 3,
  AST_MODULE_LOAD_FAILURE = -1
}
 
enum  ast_module_unload_mode { AST_FORCE_SOFT = 0, AST_FORCE_FIRM = 1, AST_FORCE_HARD = 2 }
 

Functions

struct ast_module_user__ast_module_user_add (struct ast_module *, struct ast_channel *)
 
void __ast_module_user_hangup_all (struct ast_module *)
 
void __ast_module_user_remove (struct ast_module *, struct ast_module_user *)
 
enum ast_module_load_result ast_load_resource (const char *resource_name)
 Load a module. More...
 
int ast_loader_register (int(*updater)(void))
 Add a procedure to be run when modules have been updated. More...
 
int ast_loader_unregister (int(*updater)(void))
 Remove a procedure to be run when modules are updated. More...
 
int ast_module_check (const char *name)
 Check if module with the name given is loaded. More...
 
char * ast_module_helper (const char *line, const char *word, int pos, int state, int rpos, int needsreload)
 Match modules names for the Asterisk cli. More...
 
const char * ast_module_name (const struct ast_module *mod)
 Get the name of a module. More...
 
struct ast_moduleast_module_ref (struct ast_module *)
 
void ast_module_register (const struct ast_module_info *)
 
void ast_module_shutdown (void)
 Run the unload() callback for all loaded modules. More...
 
void ast_module_unref (struct ast_module *)
 
void ast_module_unregister (const struct ast_module_info *)
 
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. More...
 
int ast_unload_resource (const char *resource_name, enum ast_module_unload_mode)
 Unload a module. More...
 
int ast_unregister_application (const char *app)
 Unregister an application. More...
 
int ast_update_module_list (int(*modentry)(const char *module, const char *description, int usecnt, const char *like), const char *like)
 Ask for a list of modules, descriptions, and use counts. More...
 
void ast_update_use_count (void)
 Notify when usecount has been changed. More...
 

Variables

static struct ast_module_infoast_module_info
 

Detailed Description

Asterisk module definitions.

This file contains the definitons for functions Asterisk modules should provide and some other module related functions.

Definition in file module.h.

Macro Definition Documentation

#define __MODULE_INFO_GLOBALS

Definition at line 317 of file module.h.

#define __MODULE_INFO_SECTION

Definition at line 316 of file module.h.

#define AST_MODULE_CONFIG   "modules.conf"

Module configuration file.

Definition at line 51 of file module.h.

Referenced by load_modules().

#define AST_MODULE_INFO (   keystr,
  flags_to_set,
  desc,
  fields... 
)

Definition at line 374 of file module.h.

#define AST_MODULE_INFO_STANDARD (   keystr,
  desc 
)
Value:
.load = load_module, \
.unload = unload_module, \
.load_pri = AST_MODPRI_DEFAULT, \
)
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
Definition: module.h:374
static int load_module(void)
#define unload_module
Definition: agent.c:75
static const char desc[]
Definition: cdr_radius.c:85

Definition at line 396 of file module.h.

#define ast_module_user_hangup_all ( )    __ast_module_user_hangup_all(ast_module_info->self)

Definition at line 270 of file module.h.

#define ast_register_application (   app,
  execute,
  synopsis,
  description 
)    ast_register_application2(app, execute, synopsis, description, ast_module_info->self)

Register an application.

Parameters
appShort name of the application
executea function callback to execute the application. It should return non-zero if the channel needs to be hung up.
synopsisa short description (one line synopsis) of the application
descriptionlong description with all of the details about the use of the application

This registers an application with Asterisk's internal application list.

Note
The individual applications themselves are responsible for registering and unregistering and unregistering their own CLI commands.
Return values
0success
-1failure.

Definition at line 421 of file module.h.

Referenced by load_module().

#define ast_register_application_xml (   app,
  execute 
)    ast_register_application(app, execute, NULL, NULL)

Register an application using XML documentation.

Parameters
appShort name of the application
executea function callback to execute the application. It should return non-zero if the channel needs to be hung up.

This registers an application with Asterisk's internal application list.

Note
The individual applications themselves are responsible for registering and unregistering and unregistering their own CLI commands.
Return values
0success
-1failure.

Definition at line 437 of file module.h.

Referenced by load_module().

#define ASTERISK_GPL_KEY   "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n"

The text the key() function should return.

Definition at line 38 of file module.h.

Enumeration Type Documentation

Enumerator
AST_MODFLAG_DEFAULT 
AST_MODFLAG_GLOBAL_SYMBOLS 
AST_MODFLAG_LOAD_ORDER 

Definition at line 198 of file module.h.

Enumerator
AST_MODPRI_REALTIME_DEPEND 

Dependency for a realtime driver

AST_MODPRI_REALTIME_DEPEND2 

Second level dependency for a realtime driver (func_curl needs res_curl, but is needed by res_config_curl)

AST_MODPRI_REALTIME_DRIVER 

A realtime driver, which provides configuration services for other modules

AST_MODPRI_TIMING 

Dependency for a channel (MOH needs timing interfaces to be fully loaded)

AST_MODPRI_CHANNEL_DEPEND 

Channel driver dependency (may depend upon realtime, e.g. MOH)

AST_MODPRI_CHANNEL_DRIVER 

Channel drivers (provide devicestate)

AST_MODPRI_APP_DEPEND 

Dependency for an application

AST_MODPRI_DEVSTATE_PROVIDER 

Applications and other modules that provide devicestate (e.g. meetme)

AST_MODPRI_DEVSTATE_PLUGIN 

Plugin for a module that provides devstate (e.g. res_calendar_*)

AST_MODPRI_CDR_DRIVER 

CDR or CEL backend

AST_MODPRI_DEFAULT 

Modules not otherwise defined (such as most apps) will load here

AST_MODPRI_DEVSTATE_CONSUMER 

Certain modules, which consume devstate, need to load after all others (e.g. app_queue)

Definition at line 204 of file module.h.

204  {
205  AST_MODPRI_REALTIME_DEPEND = 10, /*!< Dependency for a realtime driver */
206  AST_MODPRI_REALTIME_DEPEND2 = 20, /*!< Second level dependency for a realtime driver (func_curl needs res_curl, but is needed by res_config_curl) */
207  AST_MODPRI_REALTIME_DRIVER = 30, /*!< A realtime driver, which provides configuration services for other modules */
208  AST_MODPRI_TIMING = 40, /*!< Dependency for a channel (MOH needs timing interfaces to be fully loaded) */
209  AST_MODPRI_CHANNEL_DEPEND = 50, /*!< Channel driver dependency (may depend upon realtime, e.g. MOH) */
210  AST_MODPRI_CHANNEL_DRIVER = 60, /*!< Channel drivers (provide devicestate) */
211  AST_MODPRI_APP_DEPEND = 70, /*!< Dependency for an application */
212  AST_MODPRI_DEVSTATE_PROVIDER = 80, /*!< Applications and other modules that _provide_ devicestate (e.g. meetme) */
213  AST_MODPRI_DEVSTATE_PLUGIN = 90, /*!< Plugin for a module that provides devstate (e.g. res_calendar_*) */
214  AST_MODPRI_CDR_DRIVER = 100, /*!< CDR or CEL backend */
215  AST_MODPRI_DEFAULT = 128, /*!< Modules not otherwise defined (such as most apps) will load here */
216  AST_MODPRI_DEVSTATE_CONSUMER = 150, /*!< Certain modules, which consume devstate, need to load after all others (e.g. app_queue) */
217 };
Enumerator
AST_MODULE_LOAD_SUCCESS 

Module loaded and configured

AST_MODULE_LOAD_DECLINE 

Module is not configured

AST_MODULE_LOAD_SKIP 

Module was skipped for some reason

AST_MODULE_LOAD_PRIORITY 

Module is not loaded yet, but is added to prioity heap

AST_MODULE_LOAD_FAILURE 

Module could not be loaded properly

Definition at line 60 of file module.h.

60  {
61  AST_MODULE_LOAD_SUCCESS = 0, /*!< Module loaded and configured */
62  AST_MODULE_LOAD_DECLINE = 1, /*!< Module is not configured */
63  AST_MODULE_LOAD_SKIP = 2, /*!< Module was skipped for some reason */
64  AST_MODULE_LOAD_PRIORITY = 3, /*!< Module is not loaded yet, but is added to prioity heap */
65  AST_MODULE_LOAD_FAILURE = -1, /*!< Module could not be loaded properly */
66 };
Enumerator
AST_FORCE_SOFT 

Softly unload a module, only if not in use

AST_FORCE_FIRM 

Firmly unload a module, even if in use

AST_FORCE_HARD 

as FIRM, plus dlclose() on the module. Not recommended as it may cause crashes

Definition at line 53 of file module.h.

53  {
54  AST_FORCE_SOFT = 0, /*!< Softly unload a module, only if not in use */
55  AST_FORCE_FIRM = 1, /*!< Firmly unload a module, even if in use */
56  AST_FORCE_HARD = 2, /*!< as FIRM, plus dlclose() on the module. Not recommended
57  as it may cause crashes */
58 };

Function Documentation

struct ast_module_user* __ast_module_user_add ( struct ast_module ,
struct ast_channel  
)

Definition at line 209 of file loader.c.

References ast_atomic_fetchadd_int(), ast_calloc, AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_update_use_count(), ast_module_user::chan, ast_module::usecount, and ast_module::users.

Referenced by ast_func_read(), ast_func_read2(), ast_func_write(), and pbx_exec().

210 {
211  struct ast_module_user *u;
212 
213  u = ast_calloc(1, sizeof(*u));
214  if (!u) {
215  return NULL;
216  }
217 
218  u->chan = chan;
219 
220  AST_LIST_LOCK(&mod->users);
221  AST_LIST_INSERT_HEAD(&mod->users, u, entry);
222  AST_LIST_UNLOCK(&mod->users);
223 
224  ast_atomic_fetchadd_int(&mod->usecount, +1);
225 
227 
228  return u;
229 }
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
struct ast_module_user::@276 entry
void ast_update_use_count(void)
Notify when usecount has been changed.
Definition: loader.c:1222
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return * the previous value of *p. This can be used to handle reference co...
Definition: lock.h:603
struct ast_channel * chan
Definition: loader.c:73
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
Definition: linkedlists.h:696
#define ast_calloc(a, b)
Definition: astmm.h:82
void __ast_module_user_hangup_all ( struct ast_module )

Definition at line 254 of file loader.c.

References ast_atomic_fetchadd_int(), ast_free, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_softhangup(), AST_SOFTHANGUP_APPUNLOAD, ast_update_use_count(), ast_module_user::chan, ast_module::usecount, and ast_module::users.

Referenced by ast_unload_resource().

255 {
256  struct ast_module_user *u;
257 
258  AST_LIST_LOCK(&mod->users);
259  while ((u = AST_LIST_REMOVE_HEAD(&mod->users, entry))) {
260  if (u->chan) {
262  }
263  ast_atomic_fetchadd_int(&mod->usecount, -1);
264  ast_free(u);
265  }
266  AST_LIST_UNLOCK(&mod->users);
267 
269 }
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
struct ast_module_user::@276 entry
void ast_update_use_count(void)
Notify when usecount has been changed.
Definition: loader.c:1222
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return * the previous value of *p. This can be used to handle reference co...
Definition: lock.h:603
int ast_softhangup(struct ast_channel *chan, int reason)
Softly hangup up a channel.
Definition: channel.c:2746
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Definition: linkedlists.h:818
struct ast_channel * chan
Definition: loader.c:73
#define ast_free(a)
Definition: astmm.h:97
void __ast_module_user_remove ( struct ast_module ,
struct ast_module_user  
)

Definition at line 231 of file loader.c.

References ast_atomic_fetchadd_int(), ast_free, AST_LIST_LOCK, AST_LIST_REMOVE, AST_LIST_UNLOCK, ast_update_use_count(), ast_module::usecount, and ast_module::users.

Referenced by ast_func_read(), ast_func_read2(), ast_func_write(), and pbx_exec().

232 {
233  if (!u) {
234  return;
235  }
236 
237  AST_LIST_LOCK(&mod->users);
238  u = AST_LIST_REMOVE(&mod->users, u, entry);
239  AST_LIST_UNLOCK(&mod->users);
240  if (!u) {
241  /*
242  * Was not in the list. Either a bad pointer or
243  * __ast_module_user_hangup_all() has been called.
244  */
245  return;
246  }
247 
248  ast_atomic_fetchadd_int(&mod->usecount, -1);
249  ast_free(u);
250 
252 }
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
struct ast_module_user::@276 entry
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
Definition: linkedlists.h:841
void ast_update_use_count(void)
Notify when usecount has been changed.
Definition: loader.c:1222
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return * the previous value of *p. This can be used to handle reference co...
Definition: lock.h:603
#define ast_free(a)
Definition: astmm.h:97
enum ast_module_load_result ast_load_resource ( const char *  resource_name)

Load a module.

Parameters
resource_nameThe name of the module to load.

This function is run by the PBX to load the modules. It performs all loading and initialization tasks. Basically, to load a module, just give it the name of the module and it will do the rest.

Returns
See possible enum values for ast_module_load_result.

Definition at line 947 of file loader.c.

References AST_LIST_LOCK, AST_LIST_UNLOCK, ast_test_suite_event_notify, and load_resource().

Referenced by handle_load(), load_module(), and manager_moduleload().

948 {
949  int res;
951  res = load_resource(resource_name, 0, NULL, 0);
952  if (!res) {
953  ast_test_suite_event_notify("MODULE_LOAD", "Message: %s", resource_name);
954  }
956 
957  return res;
958 }
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
static enum ast_module_load_result load_resource(const char *resource_name, unsigned int global_symbols_only, struct ast_heap *resource_heap, int required)
Definition: loader.c:893
#define ast_test_suite_event_notify(s, f,...)
Definition: test.h:184
int ast_loader_register ( int(*)(void)  updater)

Add a procedure to be run when modules have been updated.

Parameters
updaterThe function to run when modules have been updated.

This function adds the given function to a linked list of functions to be run when the modules are updated.

Return values
0on success
-1on failure.

Definition at line 1268 of file loader.c.

References AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_malloc, and loadupdate::updater.

1269 {
1270  struct loadupdate *tmp;
1271 
1272  if (!(tmp = ast_malloc(sizeof(*tmp))))
1273  return -1;
1274 
1275  tmp->updater = v;
1279 
1280  return 0;
1281 }
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
int(* updater)(void)
Definition: loader.c:122
struct loadupdate::@279 entry
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
Definition: linkedlists.h:696
#define ast_malloc(a)
Definition: astmm.h:91
int ast_loader_unregister ( int(*)(void)  updater)

Remove a procedure to be run when modules are updated.

Parameters
updaterThe updater function to unregister.

This removes the given function from the updater list.

Return values
0on success
-1on failure.

Definition at line 1283 of file loader.c.

References AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, and loadupdate::updater.

1284 {
1285  struct loadupdate *cur;
1286 
1289  if (cur->updater == v) {
1291  break;
1292  }
1293  }
1296 
1297  return cur ? 0 : -1;
1298 }
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
int(* updater)(void)
Definition: loader.c:122
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:600
struct loadupdate::@279 entry
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:554
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:528
int ast_module_check ( const char *  name)

Check if module with the name given is loaded.

Parameters
nameModule name, like "chan_sip.so"
Return values
1if true
0if false

Check if module with the name given is loaded.

Definition at line 1255 of file loader.c.

References ast_strlen_zero(), and find_resource().

Referenced by ifmodule_read(), load_module(), manager_modulecheck(), and unload_module().

1256 {
1257  struct ast_module *cur;
1258 
1259  if (ast_strlen_zero(name))
1260  return 0; /* FALSE */
1261 
1262  cur = find_resource(name, 1);
1263 
1264  return (cur != NULL);
1265 }
static struct ast_module * find_resource(const char *resource, int do_lock)
Definition: loader.c:356
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
static const char name[]
char* ast_module_helper ( const char *  line,
const char *  word,
int  pos,
int  state,
int  rpos,
int  needsreload 
)

Match modules names for the Asterisk cli.

Parameters
lineUnused by this function, but this should be the line we are matching.
wordThe partial name to match.
posThe position the word we are completing is in.
stateThe possible match to return.
rposThe position we should be matching. This should be the same as pos.
needsreloadThis should be 1 if we need to reload this module and 0 otherwise. This function will only return modules that are reloadble if this is 1.
Return values
Apossible completion of the partial match.
NULLif no matches were found.

Definition at line 626 of file loader.c.

References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strdup, ast_module::info, name, reload_classes::name, ast_module_info::reload, and ast_module::resource.

Referenced by conf_run(), handle_modlist(), handle_reload(), handle_unload(), and load_module().

627 {
628  struct ast_module *cur;
629  int i, which=0, l = strlen(word);
630  char *ret = NULL;
631 
632  if (pos != rpos)
633  return NULL;
634 
637  if (!strncasecmp(word, cur->resource, l) &&
638  (cur->info->reload || !needsreload) &&
639  ++which > state) {
640  ret = ast_strdup(cur->resource);
641  break;
642  }
643  }
645 
646  if (!ret) {
647  for (i=0; !ret && reload_classes[i].name; i++) {
648  if (!strncasecmp(word, reload_classes[i].name, l) && ++which > state)
649  ret = ast_strdup(reload_classes[i].name);
650  }
651  }
652 
653  return ret;
654 }
struct ast_module::@278 entry
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
#define ast_strdup(a)
Definition: astmm.h:109
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
const char * name
Definition: loader.c:277
Definition: ael.tab.c:203
int(* reload)(void)
Definition: module.h:229
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490
static const char name[]
struct ast_module_info * info
Definition: loader.c:90
char resource[0]
Definition: loader.c:99
const char* ast_module_name ( const struct ast_module mod)

Get the name of a module.

Parameters
modA pointer to the module.
Returns
the name of the module
Return values
NULLif mod or mod->info is NULL

Definition at line 104 of file loader.c.

Referenced by acf_retrieve_docs(), ast_register_application2(), and unload_dynamic_module().

105 {
106  if (!mod || !mod->info) {
107  return NULL;
108  }
109 
110  return mod->info->name;
111 }
const char * name
Definition: module.h:233
struct ast_module_info * info
Definition: loader.c:90
struct ast_module* ast_module_ref ( struct ast_module )

Definition at line 1300 of file loader.c.

References ast_atomic_fetchadd_int(), ast_update_use_count(), and ast_module::usecount.

Referenced by __oh323_new(), agi_handle_command(), alsa_new(), ast_agi_register(), ast_app_exec_sub(), ast_app_expand_sub_args(), ast_fax_tech_register(), ast_iax2_new(), ast_rtp_instance_new(), ast_srtp_create(), ast_timer_open(), dahdi_new(), dahdi_pri_cc_agent_init(), data_result_generate_node(), fax_session_new(), fax_session_reserve(), find_best_technology(), fn_wrapper(), gtalk_new(), handle_cli_file_convert(), handle_orig(), load_module(), local_alloc(), mgcp_new(), mixmonitor_exec(), moh_alloc(), moh_files_alloc(), mute_add_audiohook(), my_module_ref(), newpvt(), oss_new(), phone_check_exception(), phone_new(), sip_handle_cc(), sip_new(), skinny_new(), and smdi_load().

1301 {
1302  if (!mod) {
1303  return NULL;
1304  }
1305 
1306  ast_atomic_fetchadd_int(&mod->usecount, +1);
1308 
1309  return mod;
1310 }
void ast_update_use_count(void)
Notify when usecount has been changed.
Definition: loader.c:1222
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return * the previous value of *p. This can be used to handle reference co...
Definition: lock.h:603
void ast_module_register ( const struct ast_module_info )

Definition at line 147 of file loader.c.

References ast_calloc, AST_LIST_HEAD_INIT, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_UNLOCK, embedded_module_list, embedding, ast_module::info, ast_module::resource, resource_being_loaded, and ast_module::users.

148 {
149  struct ast_module *mod;
150 
151  if (embedding) {
152  if (!(mod = ast_calloc(1, sizeof(*mod) + strlen(info->name) + 1)))
153  return;
154  strcpy(mod->resource, info->name);
155  } else {
156  mod = resource_being_loaded;
157  }
158 
159  mod->info = info;
160  AST_LIST_HEAD_INIT(&mod->users);
161 
162  /* during startup, before the loader has been initialized,
163  there are no threads, so there is no need to take the lock
164  on this list to manipulate it. it is also possible that it
165  might be unsafe to use the list lock at that point... so
166  let's avoid it altogether
167  */
168  if (embedding) {
170  } else {
172  /* it is paramount that the new entry be placed at the tail of
173  the list, otherwise the code that uses dlopen() to load
174  dynamic modules won't be able to find out if the module it
175  just opened was registered or failed to load
176  */
179  }
180 
181  /* give the module a copy of its own handle, for later use in registrations and the like */
182  *((struct ast_module **) &(info->self)) = mod;
183 }
struct module_user_list users
Definition: loader.c:93
struct ast_module::@278 entry
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
static struct ast_module * resource_being_loaded
Definition: loader.c:143
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
const char * name
Definition: module.h:233
struct ast_module * self
Definition: module.h:227
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:716
#define AST_LIST_HEAD_INIT(head)
Initializes a list head structure.
Definition: linkedlists.h:611
static struct module_list embedded_module_list
Definition: loader.c:119
#define ast_calloc(a, b)
Definition: astmm.h:82
static unsigned int embedding
Definition: loader.c:85
struct ast_module_info * info
Definition: loader.c:90
char resource[0]
Definition: loader.c:99
void ast_module_shutdown ( void  )

Run the unload() callback for all loaded modules.

This function should be called when Asterisk is shutting down gracefully.

Note
Some resources, like timers, are started up dynamically, and thus may be still in use, even if all channels are dead. We must therefore check the usecount before asking modules to unload.
If we go through the entire list without changing anything, ignore the usecounts and unload, then exit.

Definition at line 513 of file loader.c.

References AST_LIST_HEAD_DESTROY, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_module::declined, ast_module::flags, free, ast_module::info, ast_module::running, ast_module_info::unload, ast_module::usecount, and ast_module::users.

Referenced by really_quit().

514 {
515  struct ast_module *mod;
516  int somethingchanged = 1, final = 0;
517 
519 
520  /*!\note Some resources, like timers, are started up dynamically, and thus
521  * may be still in use, even if all channels are dead. We must therefore
522  * check the usecount before asking modules to unload. */
523  do {
524  if (!somethingchanged) {
525  /*!\note If we go through the entire list without changing
526  * anything, ignore the usecounts and unload, then exit. */
527  final = 1;
528  }
529 
530  /* Reset flag before traversing the list */
531  somethingchanged = 0;
532 
534  if (!final && mod->usecount) {
535  continue;
536  }
538  if (mod->flags.running && !mod->flags.declined && mod->info->unload) {
539  mod->info->unload();
540  }
542  free(mod);
543  somethingchanged = 1;
544  }
546  } while (somethingchanged && !final);
547 
549 }
unsigned int running
Definition: loader.c:95
struct module_user_list users
Definition: loader.c:93
struct ast_module::@278 entry
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
int usecount
Definition: loader.c:92
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:600
#define AST_LIST_HEAD_DESTROY(head)
Destroys a list head structure.
Definition: linkedlists.h:638
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:554
unsigned int declined
Definition: loader.c:96
int(* unload)(void)
Definition: module.h:230
struct ast_module::@277 flags
#define free(a)
Definition: astmm.h:94
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:528
struct ast_module_info * info
Definition: loader.c:90
void ast_module_unref ( struct ast_module )
void ast_module_unregister ( const struct ast_module_info )

Definition at line 185 of file loader.c.

References ast_free, AST_LIST_HEAD_DESTROY, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_module::info, and ast_module::users.

186 {
187  struct ast_module *mod = NULL;
188 
189  /* it is assumed that the users list in the module structure
190  will already be empty, or we cannot have gotten to this
191  point
192  */
195  if (mod->info == info) {
197  break;
198  }
199  }
202 
203  if (mod) {
205  ast_free(mod);
206  }
207 }
struct module_user_list users
Definition: loader.c:93
struct ast_module::@278 entry
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:600
#define AST_LIST_HEAD_DESTROY(head)
Destroys a list head structure.
Definition: linkedlists.h:638
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:554
#define ast_free(a)
Definition: astmm.h:97
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:528
struct ast_module_info * info
Definition: loader.c:90
int ast_register_application2 ( const char *  app,
int(*)(struct ast_channel *, const char *)  execute,
const char *  synopsis,
const char *  description,
void *  mod 
)

Register an application.

Parameters
appShort name of the application
executea function callback to execute the application. It should return non-zero if the channel needs to be hung up.
synopsisa short description (one line synopsis) of the application
descriptionlong description with all of the details about the use of the application
modmodule this application belongs to

This registers an application with Asterisk's internal application list.

Note
The individual applications themselves are responsible for registering and unregistering and unregistering their own CLI commands.
Return values
0success
-1failure.

Register an application.

Definition at line 6344 of file pbx.c.

References ast_app::arguments, ast_calloc, ast_free, ast_log(), ast_module_name(), AST_RWLIST_INSERT_BEFORE_CURRENT, AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, AST_STATIC_DOC, ast_string_field_init, ast_string_field_set, ast_strlen_zero(), ast_verb, AST_XML_DOC, ast_xmldoc_build_arguments(), ast_xmldoc_build_description(), ast_xmldoc_build_seealso(), ast_xmldoc_build_synopsis(), ast_xmldoc_build_syntax(), COLOR_BRCYAN, ast_app::docsrc, ast_app::execute, LOG_WARNING, ast_app::seealso, ast_app::syntax, and term_color().

Referenced by ast_cc_init(), ast_features_init(), and load_pbx().

6345 {
6346  struct ast_app *tmp, *cur = NULL;
6347  char tmps[80];
6348  int length, res;
6349 #ifdef AST_XML_DOCS
6350  char *tmpxml;
6351 #endif
6352 
6354  AST_RWLIST_TRAVERSE(&apps, tmp, list) {
6355  if (!(res = strcasecmp(app, tmp->name))) {
6356  ast_log(LOG_WARNING, "Already have an application '%s'\n", app);
6358  return -1;
6359  } else if (res < 0)
6360  break;
6361  }
6362 
6363  length = sizeof(*tmp) + strlen(app) + 1;
6364 
6365  if (!(tmp = ast_calloc(1, length))) {
6367  return -1;
6368  }
6369 
6370  if (ast_string_field_init(tmp, 128)) {
6372  ast_free(tmp);
6373  return -1;
6374  }
6375 
6376  strcpy(tmp->name, app);
6377  tmp->execute = execute;
6378  tmp->module = mod;
6379 
6380 #ifdef AST_XML_DOCS
6381  /* Try to lookup the docs in our XML documentation database */
6383  /* load synopsis */
6384  tmpxml = ast_xmldoc_build_synopsis("application", app, ast_module_name(tmp->module));
6385  ast_string_field_set(tmp, synopsis, tmpxml);
6386  ast_free(tmpxml);
6387 
6388  /* load description */
6389  tmpxml = ast_xmldoc_build_description("application", app, ast_module_name(tmp->module));
6390  ast_string_field_set(tmp, description, tmpxml);
6391  ast_free(tmpxml);
6392 
6393  /* load syntax */
6394  tmpxml = ast_xmldoc_build_syntax("application", app, ast_module_name(tmp->module));
6395  ast_string_field_set(tmp, syntax, tmpxml);
6396  ast_free(tmpxml);
6397 
6398  /* load arguments */
6399  tmpxml = ast_xmldoc_build_arguments("application", app, ast_module_name(tmp->module));
6400  ast_string_field_set(tmp, arguments, tmpxml);
6401  ast_free(tmpxml);
6402 
6403  /* load seealso */
6404  tmpxml = ast_xmldoc_build_seealso("application", app, ast_module_name(tmp->module));
6405  ast_string_field_set(tmp, seealso, tmpxml);
6406  ast_free(tmpxml);
6407  tmp->docsrc = AST_XML_DOC;
6408  } else {
6409 #endif
6412 #ifdef AST_XML_DOCS
6413  tmp->docsrc = AST_STATIC_DOC;
6414  }
6415 #endif
6416 
6417  /* Store in alphabetical order */
6418  AST_RWLIST_TRAVERSE_SAFE_BEGIN(&apps, cur, list) {
6419  if (strcasecmp(tmp->name, cur->name) < 0) {
6421  break;
6422  }
6423  }
6425  if (!cur)
6426  AST_RWLIST_INSERT_TAIL(&apps, tmp, list);
6427 
6428  ast_verb(2, "Registered application '%s'\n", term_color(tmps, tmp->name, COLOR_BRCYAN, 0, sizeof(tmps)));
6429 
6431 
6432  return 0;
6433 }
const ast_string_field description
Definition: pbx.c:979
Definition: pbx.c:1301
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
Definition: linkedlists.h:51
#define LOG_WARNING
Definition: logger.h:144
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
Definition: linkedlists.h:150
char * ast_xmldoc_build_description(const char *type, const char *name, const char *module)
Generate description documentation from XML.
Definition: xmldoc.c:1899
char * ast_xmldoc_build_synopsis(const char *type, const char *name, const char *module)
Generate synopsis documentation from XML.
Definition: xmldoc.c:1894
char * ast_xmldoc_build_arguments(const char *type, const char *name, const char *module)
Generate the [arguments] tag based on type of node (&#39;application&#39;, &#39;function&#39; or &#39;agi&#39;) and name...
Definition: xmldoc.c:1761
#define ast_verb(level,...)
Definition: logger.h:243
#define COLOR_BRCYAN
Definition: term.h:60
static const char app[]
Definition: app_adsiprog.c:49
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
Definition: stringfields.h:249
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
#define AST_RWLIST_TRAVERSE
Definition: linkedlists.h:493
#define AST_RWLIST_INSERT_BEFORE_CURRENT
Definition: linkedlists.h:595
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
Definition: linkedlists.h:542
char * term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout)
Definition: term.c:184
const ast_string_field syntax
Definition: pbx.c:979
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
static char * synopsis
Definition: func_enum.c:156
#define ast_free(a)
Definition: astmm.h:97
enum ast_doc_src docsrc
Definition: pbx.c:981
char * ast_xmldoc_build_syntax(const char *type, const char *name, const char *module)
Get the syntax for a specified application or function.
Definition: xmldoc.c:1156
char * ast_xmldoc_build_seealso(const char *type, const char *name, const char *module)
Parse the &lt;see-also&gt; node content.
Definition: xmldoc.c:1461
#define AST_RWLIST_INSERT_TAIL
Definition: linkedlists.h:726
const char * ast_module_name(const struct ast_module *mod)
Get the name of a module.
Definition: loader.c:104
#define ast_calloc(a, b)
Definition: astmm.h:82
ast_app: A registered application
Definition: pbx.c:971
const ast_string_field seealso
Definition: pbx.c:979
int(* execute)(struct ast_channel *chan, const char *data)
Definition: pbx.c:972
#define AST_RWLIST_TRAVERSE_SAFE_END
Definition: linkedlists.h:602
const ast_string_field arguments
Definition: pbx.c:979
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
Definition: stringfields.h:344
int ast_unload_resource ( const char *  resource_name,
enum  ast_module_unload_mode 
)

Unload a module.

Parameters
resource_nameThe name of the module to unload.
ast_module_unload_modeThe force flag. This should be set using one of the AST_FORCE flags.

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).

Return values
0on success.
-1on error.

Definition at line 551 of file loader.c.

References __ast_module_user_hangup_all(), AST_FORCE_FIRM, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_log(), ast_test_suite_event_notify, ast_update_use_count(), ast_module::declined, find_resource(), ast_module::flags, ast_module::info, ast_module::lib, LOG_WARNING, ast_module_info::restore_globals, ast_module::running, ast_module_info::unload, unload_dynamic_module(), and ast_module::usecount.

Referenced by handle_unload(), manager_moduleload(), and unload_module().

552 {
553  struct ast_module *mod;
554  int res = -1;
555  int error = 0;
556 
558 
559  if (!(mod = find_resource(resource_name, 0))) {
561  ast_log(LOG_WARNING, "Unload failed, '%s' could not be found\n", resource_name);
562  return -1;
563  }
564 
565  if (!mod->flags.running || mod->flags.declined) {
566  ast_log(LOG_WARNING, "Unload failed, '%s' is not loaded.\n", resource_name);
567  error = 1;
568  }
569 
570  if (!error && (mod->usecount > 0)) {
571  if (force)
572  ast_log(LOG_WARNING, "Warning: Forcing removal of module '%s' with use count %d\n",
573  resource_name, mod->usecount);
574  else {
575  ast_log(LOG_WARNING, "Soft unload failed, '%s' has use count %d\n", resource_name,
576  mod->usecount);
577  error = 1;
578  }
579  }
580 
581  if (!error) {
582  /* Request any channels attached to the module to hangup. */
584 
585  res = mod->info->unload();
586  if (res) {
587  ast_log(LOG_WARNING, "Firm unload failed for %s\n", resource_name);
588  if (force <= AST_FORCE_FIRM) {
589  error = 1;
590  } else {
591  ast_log(LOG_WARNING, "** Dangerous **: Unloading resource anyway, at user request\n");
592  }
593  }
594 
595  if (!error) {
596  /*
597  * Request hangup on any channels that managed to get attached
598  * while we called the module unload function.
599  */
601  sched_yield();
602  }
603  }
604 
605  if (!error)
606  mod->flags.running = mod->flags.declined = 0;
607 
609 
610  if (!error && !mod->lib && mod->info && mod->info->restore_globals)
611  mod->info->restore_globals();
612 
613 #ifdef LOADABLE_MODULES
614  if (!error) {
616  ast_test_suite_event_notify("MODULE_UNLOAD", "Message: %s", resource_name);
617  }
618 #endif
619 
620  if (!error)
622 
623  return res;
624 }
unsigned int running
Definition: loader.c:95
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
void __ast_module_user_hangup_all(struct ast_module *)
Definition: loader.c:254
#define LOG_WARNING
Definition: logger.h:144
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
int usecount
Definition: loader.c:92
void ast_update_use_count(void)
Notify when usecount has been changed.
Definition: loader.c:1222
static struct ast_module * find_resource(const char *resource, int do_lock)
Definition: loader.c:356
unsigned int declined
Definition: loader.c:96
int(* unload)(void)
Definition: module.h:230
#define ast_test_suite_event_notify(s, f,...)
Definition: test.h:184
static void unload_dynamic_module(struct ast_module *mod)
Definition: loader.c:393
struct ast_module::@277 flags
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
void(* restore_globals)(void)
Definition: module.h:232
struct ast_module_info * info
Definition: loader.c:90
void * lib
Definition: loader.c:91
int ast_unregister_application ( const char *  app)

Unregister an application.

Parameters
appname of the application (does not have to be the same string as the one that was registered)

This unregisters an application from Asterisk's internal application list.

Return values
0success
-1failure

Definition at line 7705 of file pbx.c.

References ast_free, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_string_field_free_memory, ast_verb, and unreference_cached_app().

Referenced by __unload_module(), cc_shutdown(), features_shutdown(), load_module(), unload_module(), and unload_pbx().

7706 {
7707  struct ast_app *tmp;
7708 
7710  AST_RWLIST_TRAVERSE_SAFE_BEGIN(&apps, tmp, list) {
7711  if (!strcasecmp(app, tmp->name)) {
7714  ast_verb(2, "Unregistered application '%s'\n", tmp->name);
7716  ast_free(tmp);
7717  break;
7718  }
7719  }
7722 
7723  return tmp ? 0 : -1;
7724 }
static void unreference_cached_app(struct ast_app *app)
Definition: pbx.c:7686
Definition: pbx.c:1301
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
Definition: linkedlists.h:51
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
Definition: linkedlists.h:150
#define ast_verb(level,...)
Definition: logger.h:243
static const char app[]
Definition: app_adsiprog.c:49
#define AST_RWLIST_REMOVE_CURRENT
Definition: linkedlists.h:565
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
Definition: linkedlists.h:542
#define ast_free(a)
Definition: astmm.h:97
ast_app: A registered application
Definition: pbx.c:971
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Definition: stringfields.h:253
#define AST_RWLIST_TRAVERSE_SAFE_END
Definition: linkedlists.h:602
int ast_update_module_list ( int(*)(const char *module, const char *description, int usecnt, const char *like)  modentry,
const char *  like 
)

Ask for a list of modules, descriptions, and use counts.

Parameters
modentryA callback to an updater function.
likeFor each of the modules loaded, modentry will be executed with the resource, description, and usecount values of each particular module.
Returns
the number of modules loaded

Definition at line 1234 of file loader.c.

References AST_LIST_TRAVERSE, AST_LIST_TRYLOCK, AST_LIST_UNLOCK, ast_module_info::description, ast_module::info, ast_module::resource, and ast_module::usecount.

Referenced by ast_var_Modules(), and handle_modlist().

1236 {
1237  struct ast_module *cur;
1238  int unlock = -1;
1239  int total_mod_loaded = 0;
1240 
1242  unlock = 0;
1243 
1245  total_mod_loaded += modentry(cur->resource, cur->info->description, cur->usecount, like);
1246  }
1247 
1248  if (unlock)
1250 
1251  return total_mod_loaded;
1252 }
const char * description
Definition: module.h:234
struct ast_module::@278 entry
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
int usecount
Definition: loader.c:92
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490
#define AST_LIST_TRYLOCK(head)
Locks a list, without blocking if the list is locked.
Definition: linkedlists.h:104
struct ast_module_info * info
Definition: loader.c:90
char resource[0]
Definition: loader.c:99
void ast_update_use_count ( void  )

Notify when usecount has been changed.

This function calulates use counts and notifies anyone trying to keep track of them. It should be called whenever your module's usecount changes.

Note
The ast_module_user_* functions take care of calling this function for you.

Definition at line 1222 of file loader.c.

References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, and loadupdate::updater.

Referenced by __ast_module_user_add(), __ast_module_user_hangup_all(), __ast_module_user_remove(), ast_module_ref(), ast_module_unref(), ast_unload_resource(), handle_request_do(), oh323_request(), sip_request_call(), start_resource(), and unistim_new().

1223 {
1224  /* Notify any module monitors that the use count for a
1225  resource has changed */
1226  struct loadupdate *m;
1227 
1230  m->updater();
1232 }
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:39
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:139
int(* updater)(void)
Definition: loader.c:122
struct loadupdate::@279 entry
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490

Variable Documentation

Definition at line 313 of file module.h.