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 00025 /* provided in asterisk.c */ 00026 extern char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH]; 00027 extern char ast_config_AST_CONFIG_FILE[AST_CONFIG_MAX_PATH]; 00028 extern char ast_config_AST_MODULE_DIR[AST_CONFIG_MAX_PATH]; 00029 extern char ast_config_AST_SPOOL_DIR[AST_CONFIG_MAX_PATH]; 00030 extern char ast_config_AST_MONITOR_DIR[AST_CONFIG_MAX_PATH]; 00031 extern char ast_config_AST_VAR_DIR[AST_CONFIG_MAX_PATH]; 00032 extern char ast_config_AST_LOG_DIR[AST_CONFIG_MAX_PATH]; 00033 extern char ast_config_AST_AGI_DIR[AST_CONFIG_MAX_PATH]; 00034 extern char ast_config_AST_DB[AST_CONFIG_MAX_PATH]; 00035 extern char ast_config_AST_KEY_DIR[AST_CONFIG_MAX_PATH]; 00036 extern char ast_config_AST_PID[AST_CONFIG_MAX_PATH]; 00037 extern char ast_config_AST_SOCKET[AST_CONFIG_MAX_PATH]; 00038 extern char ast_config_AST_RUN_DIR[AST_CONFIG_MAX_PATH]; 00039 extern char ast_config_AST_CTL_PERMISSIONS[AST_CONFIG_MAX_PATH]; 00040 extern char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH]; 00041 extern char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH]; 00042 extern char ast_config_AST_CTL[AST_CONFIG_MAX_PATH]; 00043 00044 /* Provided by asterisk.c */ 00045 int ast_set_priority(int); 00046 /* Provided by module.c */ 00047 int load_modules(const int preload_only); 00048 /* Provided by pbx.c */ 00049 int load_pbx(void); 00050 /* Provided by logger.c */ 00051 int init_logger(void); 00052 void close_logger(void); 00053 /* Provided by frame.c */ 00054 int init_framer(void); 00055 /* Provided by logger.c */ 00056 int reload_logger(int); 00057 /* Provided by term.c */ 00058 int term_init(void); 00059 /* Provided by db.c */ 00060 int astdb_init(void); 00061 /* Provided by channel.c */ 00062 void ast_channels_init(void); 00063 /* Provided by dnsmgr.c */ 00064 int dnsmgr_init(void); 00065 void dnsmgr_start_refresh(void); 00066 void dnsmgr_reload(void); 00067 00068 /*! 00069 * \brief Register the version of a source code file with the core. 00070 * \param file the source file name 00071 * \param version the version string (typically a CVS revision keyword string) 00072 * \return nothing 00073 * 00074 * This function should not be called directly, but instead the 00075 * ASTERISK_FILE_VERSION macro should be used to register a file with the core. 00076 */ 00077 void ast_register_file_version(const char *file, const char *version); 00078 00079 /*! 00080 * \brief Unregister a source code file from the core. 00081 * \param file the source file name 00082 * \return nothing 00083 * 00084 * This function should not be called directly, but instead the 00085 * ASTERISK_FILE_VERSION macro should be used to automatically unregister 00086 * the file when the module is unloaded. 00087 */ 00088 void ast_unregister_file_version(const char *file); 00089 00090 /*! 00091 * \brief Register/unregister a source code file with the core. 00092 * \param file the source file name 00093 * \param version the version string (typically a CVS revision keyword string) 00094 * 00095 * This macro will place a file-scope constructor and destructor into the 00096 * source of the module using it; this will cause the version of this file 00097 * to registered with the Asterisk core (and unregistered) at the appropriate 00098 * times. 00099 * 00100 * Example: 00101 * 00102 * \code 00103 * ASTERISK_FILE_VERSION(__FILE__, "\$Revision\$") 00104 * \endcode 00105 * 00106 * \note The dollar signs above have been protected with backslashes to keep 00107 * SVN from modifying them in this file; under normal circumstances they would 00108 * not be present and SVN would expand the Revision keyword into the file's 00109 * revision number. 00110 */ 00111 #if defined(__GNUC__) && !defined(LOW_MEMORY) 00112 #define ASTERISK_FILE_VERSION(file, version) \ 00113 static void __attribute__((constructor)) __register_file_version(void) \ 00114 { \ 00115 ast_register_file_version(file, version); \ 00116 } \ 00117 static void __attribute__((destructor)) __unregister_file_version(void) \ 00118 { \ 00119 ast_unregister_file_version(file); \ 00120 } 00121 #elif !defined(LOW_MEMORY) /* ! __GNUC__ && ! LOW_MEMORY*/ 00122 #define ASTERISK_FILE_VERSION(file, x) static const char __file_version[] = x; 00123 #else /* LOW_MEMORY */ 00124 #define ASTERISK_FILE_VERSION(file, x) 00125 #endif /* __GNUC__ */ 00126 00127 #endif /* _ASTERISK_H */