Asterisk.org: Developer Documentation (28 Oct 2009)

Wed Oct 28 15:47:49 2009

## Asterisk developer's documentation

# asterisk.h

Go to the documentation of this file.

    00001 /*
    00002  * Asterisk -- A telephony toolkit for Linux.
    00003  *
    00004  * General Definitions for Asterisk top level program
    00005  *
    00006  * Copyright (C) 1999-2005, Mark Spencer
    00007  *
    00008  * Mark Spencer <markster@digium.com>
    00009  *
    00010  * This program is free software, distributed under the terms of
    00011  * the GNU General Public License
    00012  */
    00013
    00014 /*! \file
    00015  * \brief Asterisk main include file. File version handling, generic pbx functions.
    00016  */
    00017
    00018 #ifndef _ASTERISK_H
    00019 #define _ASTERISK_H
    00020
    00021 #define DEFAULT_LANGUAGE "en"
    00022
    00023 #define AST_CONFIG_MAX_PATH 255
    00024 #define  setpriority __PLEASE_USE_ast_set_priority_INSTEAD_OF_setpriority__
    00025 #define  sched_setscheduler   __PLEASE_USE_ast_set_priority_INSTEAD_OF_sched_setscheduler__
    00026
    00027 /* provided in asterisk.c */
    00028 extern char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH];
    00029 extern char ast_config_AST_CONFIG_FILE[AST_CONFIG_MAX_PATH];
    00030 extern char ast_config_AST_MODULE_DIR[AST_CONFIG_MAX_PATH];
    00031 extern char ast_config_AST_SPOOL_DIR[AST_CONFIG_MAX_PATH];
    00032 extern char ast_config_AST_MONITOR_DIR[AST_CONFIG_MAX_PATH];
    00033 extern char ast_config_AST_VAR_DIR[AST_CONFIG_MAX_PATH];
    00034 extern char ast_config_AST_LOG_DIR[AST_CONFIG_MAX_PATH];
    00035 extern char ast_config_AST_AGI_DIR[AST_CONFIG_MAX_PATH];
    00036 extern char ast_config_AST_DB[AST_CONFIG_MAX_PATH];
    00037 extern char ast_config_AST_KEY_DIR[AST_CONFIG_MAX_PATH];
    00038 extern char ast_config_AST_PID[AST_CONFIG_MAX_PATH];
    00039 extern char ast_config_AST_SOCKET[AST_CONFIG_MAX_PATH];
    00040 extern char ast_config_AST_RUN_DIR[AST_CONFIG_MAX_PATH];
    00041 extern char ast_config_AST_CTL_PERMISSIONS[AST_CONFIG_MAX_PATH];
    00042 extern char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH];
    00043 extern char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH];
    00044 extern char ast_config_AST_CTL[AST_CONFIG_MAX_PATH];
    00045
    00046 /* Provided by asterisk.c */
    00047 int ast_set_priority(int);
    00048 /* Provided by module.c */
    00049 int load_modules(const int preload_only);
    00050 /* Provided by pbx.c */
    00051 int load_pbx(void);
    00052 /* Provided by logger.c */
    00053 int init_logger(void);
    00054 void close_logger(void);
    00055 /* Provided by frame.c */
    00056 int init_framer(void);
    00057 /* Provided by logger.c */
    00058 int reload_logger(int);
    00059 /* Provided by term.c */
    00060 int term_init(void);
    00061 /* Provided by db.c */
    00062 int astdb_init(void);
    00063 /* Provided by channel.c */
    00064 void ast_channels_init(void);
    00065 /* Provided by dnsmgr.c */
    00066 int dnsmgr_init(void);
    00067 void dnsmgr_start_refresh(void);
    00068 void dnsmgr_reload(void);
    00069
    00070 /*!
    00071  * \brief Register the version of a source code file with the core.
    00072  * \param file the source file name
    00073  * \param version the version string (typically a CVS revision keyword string)
    00074  * \return nothing
    00075  *
    00076  * This function should not be called directly, but instead the
    00077  * ASTERISK_FILE_VERSION macro should be used to register a file with the core.
    00078  */
    00079 void ast_register_file_version(const char *file, const char *version);
    00080
    00081 /*!
    00082  * \brief Unregister a source code file from the core.
    00083  * \param file the source file name
    00084  * \return nothing
    00085  *
    00086  * This function should not be called directly, but instead the
    00087  * ASTERISK_FILE_VERSION macro should be used to automatically unregister
    00088  * the file when the module is unloaded.
    00089  */
    00090 void ast_unregister_file_version(const char *file);
    00091
    00092 /*!
    00093  * \brief Register/unregister a source code file with the core.
    00094  * \param file the source file name
    00095  * \param version the version string (typically a CVS revision keyword string)
    00096  *
    00097  * This macro will place a file-scope constructor and destructor into the
    00098  * source of the module using it; this will cause the version of this file
    00099  * to registered with the Asterisk core (and unregistered) at the appropriate
    00100  * times.
    00101  *
    00102  * Example:
    00103  *
    00104  * \code
    00105  * ASTERISK_FILE_VERSION(__FILE__, "\$Revision\$")
    00106  * \endcode
    00107  *
    00108  * \note The dollar signs above have been protected with backslashes to keep
    00109  * SVN from modifying them in this file; under normal circumstances they would
    00110  * not be present and SVN would expand the Revision keyword into the file's
    00111  * revision number.
    00112  */
    00113 #if defined(__GNUC__) && !defined(LOW_MEMORY)
    00114 #define ASTERISK_FILE_VERSION(file, version) \
    00115    static void __attribute__((constructor)) __register_file_version(void) \
    00116    { \
    00117       ast_register_file_version(file, version); \
    00118    } \
    00119    static void __attribute__((destructor)) __unregister_file_version(void) \
    00120    { \
    00121       ast_unregister_file_version(file); \
    00122    }
    00123 #elif !defined(LOW_MEMORY) /* ! __GNUC__  && ! LOW_MEMORY*/
    00124 #define ASTERISK_FILE_VERSION(file, x) static const char __file_version[] = x;
    00125 #else /* LOW_MEMORY */
    00126 #define ASTERISK_FILE_VERSION(file, x)
    00127 #endif /* __GNUC__ */
    00128
    00129 #endif /* _ASTERISK_H */